aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcodeforces/AllDistinct/mainbin0 -> 38264 bytes
-rwxr-xr-xcodeforces/AllDistinct/main.cpp146
-rw-r--r--codeforces/AllDistinct/main_input0.txt9
-rw-r--r--codeforces/AllDistinct/main_output0.txt4
-rwxr-xr-xcodeforces/LuckyNumbers/mainbin0 -> 26936 bytes
-rwxr-xr-xcodeforces/LuckyNumbers/main.cpp172
-rw-r--r--codeforces/LuckyNumbers/main_input0.txt6
-rw-r--r--codeforces/LuckyNumbers/main_input1.txt2
-rw-r--r--codeforces/LuckyNumbers/main_output0.txt5
-rw-r--r--codeforces/LuckyNumbers/main_output1.txt1
-rwxr-xr-xcodeforces/Marthon/mainbin0 -> 42736 bytes
-rwxr-xr-xcodeforces/Marthon/main.cpp139
-rw-r--r--codeforces/Marthon/main_input0.txt5
-rw-r--r--codeforces/Marthon/main_output0.txt4
-rwxr-xr-xcodeforces/PlayingInCasino/mainbin0 -> 65088 bytes
-rwxr-xr-xcodeforces/PlayingInCasino/main.cpp151
-rw-r--r--codeforces/PlayingInCasino/main_input0.txt12
-rw-r--r--codeforces/PlayingInCasino/main_output0.txt3
-rwxr-xr-xcodeforces/SortZero/mainbin0 -> 38528 bytes
-rwxr-xr-xcodeforces/SortZero/main.cpp150
-rw-r--r--codeforces/SortZero/main_input0.txt11
-rw-r--r--codeforces/SortZero/main_output0.txt5
-rwxr-xr-xcodeforces/Sum/main.cpp12
-rwxr-xr-xcodeforces/TaisaAndDice/mainbin0 -> 21816 bytes
-rwxr-xr-xcodeforces/TaisaAndDice/main.cpp145
-rw-r--r--codeforces/TaisaAndDice/main_input0.txt8
-rw-r--r--codeforces/TaisaAndDice/main_output0.txt7
-rwxr-xr-xcodeforces/WoefulPermutation/mainbin0 -> 17736 bytes
-rwxr-xr-xcodeforces/WoefulPermutation/main.cpp136
-rw-r--r--codeforces/WoefulPermutation/main_input0.txt3
-rw-r--r--codeforces/WoefulPermutation/main_output0.txt2
-rw-r--r--codeforces/WonderfulPermutation/2144
-rwxr-xr-xcodeforces/WonderfulPermutation/mainbin0 -> 39584 bytes
-rwxr-xr-xcodeforces/WonderfulPermutation/main.cpp145
-rw-r--r--codeforces/WonderfulPermutation/main_input0.txt9
-rw-r--r--codeforces/WonderfulPermutation/main_output0.txt4
-rwxr-xr-xcodeforces/Yes-Yes/mainbin0 -> 25608 bytes
-rwxr-xr-xcodeforces/Yes-Yes/main.cpp148
-rw-r--r--codeforces/Yes-Yes/main.py12
-rw-r--r--codeforces/Yes-Yes/main_input0.txt13
-rw-r--r--codeforces/Yes-Yes/main_input1.txt13
-rw-r--r--codeforces/Yes-Yes/main_output0.txt12
-rw-r--r--codeforces/Yes-Yes/main_output1.txt12
-rwxr-xr-xcodeforces/YetAnotherPromotion/mainbin0 -> 17832 bytes
-rwxr-xr-xcodeforces/YetAnotherPromotion/main.cpp142
-rw-r--r--codeforces/YetAnotherPromotion/main_input0.txt11
-rw-r--r--codeforces/YetAnotherPromotion/main_output0.txt5
47 files changed, 1802 insertions, 6 deletions
diff --git a/codeforces/AllDistinct/main b/codeforces/AllDistinct/main
new file mode 100755
index 0000000..aa1f15f
--- /dev/null
+++ b/codeforces/AllDistinct/main
Binary files differ
diff --git a/codeforces/AllDistinct/main.cpp b/codeforces/AllDistinct/main.cpp
new file mode 100755
index 0000000..d8288fc
--- /dev/null
+++ b/codeforces/AllDistinct/main.cpp
@@ -0,0 +1,146 @@
+#include<bits/stdc++.h>
+using namespace std;
+
+using ll = long long;
+using pii = pair<int, int>;
+using vpi = vector<pii>;
+using vi = vector<int>;
+using vll = vector<long long>;
+using mpii = map<int, int>;
+using mpll = map<ll, ll>;
+using db = long double;
+
+#define pb push_back
+#define all(x) (x).begin(), (x).end()
+#define rall(x) (x).rbegin(), (x).rend()
+#define lb lower_bound
+#define ub upper_bound
+#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
+#define ceil(a, b) ((a) + (b) - 1) / (b))
+
+const int MOD = (int)1e9 + 7;
+const db PI = acos((db)-1);
+const int dx[4]{1, 0, -1, 0};
+const int dy[4]{0, 1, 0, -1};
+
+template<typename K, typename V> ostream& operator<<(ostream& os, const pair<K, V>& p);
+template<typename T> ostream& operator<<(ostream& os, const vector<T>& vec);
+template<typename K, typename V> ostream& operator<<(ostream& os, const map<K, V>& m);
+template<typename K, typename V> ostream& operator<<(ostream& os, const unordered_map<K, V>& m);
+template<typename T> ostream& operator<<(ostream& os, const set<T>& s);
+template<typename T> ostream& operator<<(ostream& os, const unordered_set<T>& s);
+
+template<typename K, typename V>
+ostream& operator<<(ostream& os, const pair<K, V>& p) {
+ os << "(" << p.first << ", " << p.second << ")";
+ return os;
+}
+
+template<typename T>
+ostream& operator<<(ostream& os, const vector<T>& vec) {
+ os << "{";
+ for (size_t i = 0; i < vec.size(); ++i) {
+ if (i > 0) os << ", ";
+ os << vec[i];
+ }
+ os << "}";
+ return os;
+}
+
+
+template<typename K, typename V>
+ostream& operator<<(ostream& os, const map<K, V>& m) {
+ os << "{";
+ for (const auto& p : m) {
+ os << p.first << ": " << p.second << ", ";
+ }
+ os << "}";
+ return os;
+}
+
+template<typename K, typename V>
+ostream& operator<<(ostream& os, const unordered_map<K, V>& m) {
+ os << "{";
+ for (const auto& p : m) {
+ os << p.first << ": " << p.second << ", ";
+ }
+ os << "}";
+ return os;
+}
+
+template<typename T>
+ostream& operator<<(ostream& os, const set<T>& s) {
+ int i = 0;
+ os << "{";
+ for (const auto& e : s) {
+ if (i > 0) os << ", ";
+ os << e;
+ i++;
+ }
+ os << "}";
+ return os;
+}
+
+template<typename T>
+ostream& operator<<(ostream& os, const unordered_set<T>& s) {
+ int i = 0;
+ os << "{";
+ for (const auto& e : s) {
+ if (i > 0) os << ", ";
+ os << e;
+ i++;
+ }
+ os << "}";
+ return os;
+}
+
+void print() {
+ cerr << "\n";
+}
+
+template<typename T, typename... TS>
+void print(T val, TS... vals) {
+ cerr << val << " ";
+ print(vals...);
+}
+
+
+
+/* stuff you should look for:
+ ---------------------------
+ * special cases (n=1?)
+ * int overflow, array bounds
+ * do smth instead of nothing and stay organized
+ * WRITE STUFF DOWN
+ * DON'T GET STUCK ON ONE APPROACH
+ */
+
+void solve() {
+ int n;
+ cin >> n;
+ vi v(n);
+ set<int> st;
+ for (auto &x : v) {
+ cin >> x;
+ st.insert(x);
+ }
+ int distinct = st.size();
+ if ((n - distinct) % 2 == 1) {
+ cout << distinct - 1 << '\n';
+ } else {
+ cout << distinct << '\n';
+ }
+
+}
+
+int main () {
+ ios_base::sync_with_stdio(false);
+ cin.tie(NULL);
+ int tt;
+ cin >> tt;
+ while(tt--) {
+ solve();
+ }
+}
+
+
diff --git a/codeforces/AllDistinct/main_input0.txt b/codeforces/AllDistinct/main_input0.txt
new file mode 100644
index 0000000..888e289
--- /dev/null
+++ b/codeforces/AllDistinct/main_input0.txt
@@ -0,0 +1,9 @@
+4
+6
+2 2 2 3 3 3
+5
+9 1 9 9 1
+4
+15 16 16 15
+4
+10 100 1000 10000
diff --git a/codeforces/AllDistinct/main_output0.txt b/codeforces/AllDistinct/main_output0.txt
new file mode 100644
index 0000000..85222d5
--- /dev/null
+++ b/codeforces/AllDistinct/main_output0.txt
@@ -0,0 +1,4 @@
+2
+1
+2
+4
diff --git a/codeforces/LuckyNumbers/main b/codeforces/LuckyNumbers/main
new file mode 100755
index 0000000..506cb3e
--- /dev/null
+++ b/codeforces/LuckyNumbers/main
Binary files differ
diff --git a/codeforces/LuckyNumbers/main.cpp b/codeforces/LuckyNumbers/main.cpp
new file mode 100755
index 0000000..90b029e
--- /dev/null
+++ b/codeforces/LuckyNumbers/main.cpp
@@ -0,0 +1,172 @@
+#include<bits/stdc++.h>
+using namespace std;
+
+using ll = long long;
+using pii = pair<int, int>;
+using vpi = vector<pii>;
+using vi = vector<int>;
+using vll = vector<long long>;
+using mpii = map<int, int>;
+using mpll = map<ll, ll>;
+using db = long double;
+
+#define pb push_back
+#define all(x) (x).begin(), (x).end()
+#define rall(x) (x).rbegin(), (x).rend()
+#define lb lower_bound
+#define ub upper_bound
+#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
+#define ceil(a, b) ((a) + (b) - 1) / (b))
+
+const int MOD = (int)1e9 + 7;
+const db PI = acos((db)-1);
+const int dx[4]{1, 0, -1, 0};
+const int dy[4]{0, 1, 0, -1};
+
+template<typename K, typename V> ostream& operator<<(ostream& os, const pair<K, V>& p);
+template<typename T> ostream& operator<<(ostream& os, const vector<T>& vec);
+template<typename K, typename V> ostream& operator<<(ostream& os, const map<K, V>& m);
+template<typename K, typename V> ostream& operator<<(ostream& os, const unordered_map<K, V>& m);
+template<typename T> ostream& operator<<(ostream& os, const set<T>& s);
+template<typename T> ostream& operator<<(ostream& os, const unordered_set<T>& s);
+
+template<typename K, typename V>
+ostream& operator<<(ostream& os, const pair<K, V>& p) {
+ os << "(" << p.first << ", " << p.second << ")";
+ return os;
+}
+
+template<typename T>
+ostream& operator<<(ostream& os, const vector<T>& vec) {
+ os << "{";
+ for (size_t i = 0; i < vec.size(); ++i) {
+ if (i > 0) os << ", ";
+ os << vec[i];
+ }
+ os << "}";
+ return os;
+}
+
+
+template<typename K, typename V>
+ostream& operator<<(ostream& os, const map<K, V>& m) {
+ os << "{";
+ for (const auto& p : m) {
+ os << p.first << ": " << p.second << ", ";
+ }
+ os << "}";
+ return os;
+}
+
+template<typename K, typename V>
+ostream& operator<<(ostream& os, const unordered_map<K, V>& m) {
+ os << "{";
+ for (const auto& p : m) {
+ os << p.first << ": " << p.second << ", ";
+ }
+ os << "}";
+ return os;
+}
+
+template<typename T>
+ostream& operator<<(ostream& os, const set<T>& s) {
+ int i = 0;
+ os << "{";
+ for (const auto& e : s) {
+ if (i > 0) os << ", ";
+ os << e;
+ i++;
+ }
+ os << "}";
+ return os;
+}
+
+template<typename T>
+ostream& operator<<(ostream& os, const unordered_set<T>& s) {
+ int i = 0;
+ os << "{";
+ for (const auto& e : s) {
+ if (i > 0) os << ", ";
+ os << e;
+ i++;
+ }
+ os << "}";
+ return os;
+}
+
+void print() {
+ cerr << "\n";
+}
+
+template<typename T, typename... TS>
+void print(T val, TS... vals) {
+ cerr << val << " ";
+ print(vals...);
+}
+
+
+
+/* stuff you should look for:
+ ---------------------------
+ * special cases (n=1?)
+ * int overflow, array bounds
+ * do smth instead of nothing and stay organized
+ * WRITE STUFF DOWN
+ * DON'T GET STUCK ON ONE APPROACH
+ */
+
+vi cache;
+
+
+int getLucky(int n) {
+ int mx = 0;
+ int mn = 10;
+ while(n) {
+ mx = max(mx, n % 10);
+ mn = min(mn, n % 10);
+ n /= 10;
+ }
+ return mx - mn;
+}
+
+void fillCache() {
+ for (int i = 0; i < 1e6 + 3; i++) {
+ if (getLucky(i) == 9) {
+ cache.pb(i);
+ }
+ }
+}
+
+void solve() {
+ int l, r;
+ cin >> l >> r;
+ pii ans = {0, 0};
+ if (r - l >= 100) {
+ for (auto x : cache) {
+ if (x >= l && x <= r) {
+ cout << x << '\n';
+ return;
+ }
+ }
+ }
+ for (int i = l; i <= r; i++) {
+ int luck = getLucky(i);
+ if (luck >= ans.first) {
+ ans = {luck, i};
+ }
+ }
+ cout << ans.second << '\n';
+}
+
+int main () {
+ ios_base::sync_with_stdio(false);
+ cin.tie(NULL);
+ int tt;
+ cin >> tt;
+ fillCache();
+ while(tt--) {
+ solve();
+ }
+}
+
+
diff --git a/codeforces/LuckyNumbers/main_input0.txt b/codeforces/LuckyNumbers/main_input0.txt
new file mode 100644
index 0000000..6c4fb52
--- /dev/null
+++ b/codeforces/LuckyNumbers/main_input0.txt
@@ -0,0 +1,6 @@
+5
+59 63
+42 49
+15 15
+53 57
+1 100
diff --git a/codeforces/LuckyNumbers/main_input1.txt b/codeforces/LuckyNumbers/main_input1.txt
new file mode 100644
index 0000000..95bce4d
--- /dev/null
+++ b/codeforces/LuckyNumbers/main_input1.txt
@@ -0,0 +1,2 @@
+1
+1 2 \ No newline at end of file
diff --git a/codeforces/LuckyNumbers/main_output0.txt b/codeforces/LuckyNumbers/main_output0.txt
new file mode 100644
index 0000000..f5ad0b0
--- /dev/null
+++ b/codeforces/LuckyNumbers/main_output0.txt
@@ -0,0 +1,5 @@
+60
+49
+15
+57
+90
diff --git a/codeforces/LuckyNumbers/main_output1.txt b/codeforces/LuckyNumbers/main_output1.txt
new file mode 100644
index 0000000..c227083
--- /dev/null
+++ b/codeforces/LuckyNumbers/main_output1.txt
@@ -0,0 +1 @@
+0 \ No newline at end of file
diff --git a/codeforces/Marthon/main b/codeforces/Marthon/main
new file mode 100755
index 0000000..060071d
--- /dev/null
+++ b/codeforces/Marthon/main
Binary files differ
diff --git a/codeforces/Marthon/main.cpp b/codeforces/Marthon/main.cpp
new file mode 100755
index 0000000..d740ca3
--- /dev/null
+++ b/codeforces/Marthon/main.cpp
@@ -0,0 +1,139 @@
+#include<bits/stdc++.h>
+using namespace std;
+
+using ll = long long;
+using pii = pair<int, int>;
+using vpi = vector<pii>;
+using vi = vector<int>;
+using vll = vector<long long>;
+using mpii = map<int, int>;
+using mpll = map<ll, ll>;
+using db = long double;
+
+#define pb push_back
+#define all(x) (x).begin(), (x).end()
+#define rall(x) (x).rbegin(), (x).rend()
+#define lb lower_bound
+#define ub upper_bound
+#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
+#define ceil(a, b) ((a) + (b) - 1) / (b))
+
+const int MOD = (int)1e9 + 7;
+const db PI = acos((db)-1);
+const int dx[4]{1, 0, -1, 0};
+const int dy[4]{0, 1, 0, -1};
+
+template<typename K, typename V> ostream& operator<<(ostream& os, const pair<K, V>& p);
+template<typename T> ostream& operator<<(ostream& os, const vector<T>& vec);
+template<typename K, typename V> ostream& operator<<(ostream& os, const map<K, V>& m);
+template<typename K, typename V> ostream& operator<<(ostream& os, const unordered_map<K, V>& m);
+template<typename T> ostream& operator<<(ostream& os, const set<T>& s);
+template<typename T> ostream& operator<<(ostream& os, const unordered_set<T>& s);
+
+template<typename K, typename V>
+ostream& operator<<(ostream& os, const pair<K, V>& p) {
+ os << "(" << p.first << ", " << p.second << ")";
+ return os;
+}
+
+template<typename T>
+ostream& operator<<(ostream& os, const vector<T>& vec) {
+ os << "{";
+ for (size_t i = 0; i < vec.size(); ++i) {
+ if (i > 0) os << ", ";
+ os << vec[i];
+ }
+ os << "}";
+ return os;
+}
+
+
+template<typename K, typename V>
+ostream& operator<<(ostream& os, const map<K, V>& m) {
+ os << "{";
+ for (const auto& p : m) {
+ os << p.first << ": " << p.second << ", ";
+ }
+ os << "}";
+ return os;
+}
+
+template<typename K, typename V>
+ostream& operator<<(ostream& os, const unordered_map<K, V>& m) {
+ os << "{";
+ for (const auto& p : m) {
+ os << p.first << ": " << p.second << ", ";
+ }
+ os << "}";
+ return os;
+}
+
+template<typename T>
+ostream& operator<<(ostream& os, const set<T>& s) {
+ int i = 0;
+ os << "{";
+ for (const auto& e : s) {
+ if (i > 0) os << ", ";
+ os << e;
+ i++;
+ }
+ os << "}";
+ return os;
+}
+
+template<typename T>
+ostream& operator<<(ostream& os, const unordered_set<T>& s) {
+ int i = 0;
+ os << "{";
+ for (const auto& e : s) {
+ if (i > 0) os << ", ";
+ os << e;
+ i++;
+ }
+ os << "}";
+ return os;
+}
+
+void print() {
+ cerr << "\n";
+}
+
+template<typename T, typename... TS>
+void print(T val, TS... vals) {
+ cerr << val << " ";
+ print(vals...);
+}
+
+
+
+/* stuff you should look for:
+ ---------------------------
+ * special cases (n=1?)
+ * int overflow, array bounds
+ * do smth instead of nothing and stay organized
+ * WRITE STUFF DOWN
+ * DON'T GET STUCK ON ONE APPROACH
+ */
+
+void solve() {
+ vi v(4);
+ for (int i = 0; i < 4; ++i) {
+ cin >> v[i];
+ }
+ int timur = v[0];
+ sort(all(v));
+ int posTimur = find(all(v), timur) - v.begin();
+ cout << 3 - posTimur << "\n";
+}
+
+int main () {
+ ios_base::sync_with_stdio(false);
+ cin.tie(NULL);
+ int tt;
+ cin >> tt;
+ while(tt--) {
+ solve();
+ }
+}
+
+
diff --git a/codeforces/Marthon/main_input0.txt b/codeforces/Marthon/main_input0.txt
new file mode 100644
index 0000000..9c4bac8
--- /dev/null
+++ b/codeforces/Marthon/main_input0.txt
@@ -0,0 +1,5 @@
+4
+2 3 4 1
+10000 0 1 2
+500 600 400 300
+0 9999 10000 9998
diff --git a/codeforces/Marthon/main_output0.txt b/codeforces/Marthon/main_output0.txt
new file mode 100644
index 0000000..35f5032
--- /dev/null
+++ b/codeforces/Marthon/main_output0.txt
@@ -0,0 +1,4 @@
+2
+0
+1
+3
diff --git a/codeforces/PlayingInCasino/main b/codeforces/PlayingInCasino/main
new file mode 100755
index 0000000..35326fe
--- /dev/null
+++ b/codeforces/PlayingInCasino/main
Binary files differ
diff --git a/codeforces/PlayingInCasino/main.cpp b/codeforces/PlayingInCasino/main.cpp
new file mode 100755
index 0000000..4c55293
--- /dev/null
+++ b/codeforces/PlayingInCasino/main.cpp
@@ -0,0 +1,151 @@
+#include<bits/stdc++.h>
+using namespace std;
+
+using ll = long long;
+using pii = pair<int, int>;
+using vpi = vector<pii>;
+using vi = vector<int>;
+using vll = vector<long long>;
+using mpii = map<int, int>;
+using mpll = map<ll, ll>;
+using db = long double;
+
+#define pb push_back
+#define all(x) (x).begin(), (x).end()
+#define rall(x) (x).rbegin(), (x).rend()
+#define lb lower_bound
+#define ub upper_bound
+#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
+#define ceil(a, b) ((a) + (b) - 1) / (b))
+
+const int MOD = (int)1e9 + 7;
+const db PI = acos((db)-1);
+const int dx[4]{1, 0, -1, 0};
+const int dy[4]{0, 1, 0, -1};
+
+template<typename K, typename V> ostream& operator<<(ostream& os, const pair<K, V>& p);
+template<typename T> ostream& operator<<(ostream& os, const vector<T>& vec);
+template<typename K, typename V> ostream& operator<<(ostream& os, const map<K, V>& m);
+template<typename K, typename V> ostream& operator<<(ostream& os, const unordered_map<K, V>& m);
+template<typename T> ostream& operator<<(ostream& os, const set<T>& s);
+template<typename T> ostream& operator<<(ostream& os, const unordered_set<T>& s);
+
+template<typename K, typename V>
+ostream& operator<<(ostream& os, const pair<K, V>& p) {
+ os << "(" << p.first << ", " << p.second << ")";
+ return os;
+}
+
+template<typename T>
+ostream& operator<<(ostream& os, const vector<T>& vec) {
+ os << "{";
+ for (size_t i = 0; i < vec.size(); ++i) {
+ if (i > 0) os << ", ";
+ os << vec[i];
+ }
+ os << "}";
+ return os;
+}
+
+
+template<typename K, typename V>
+ostream& operator<<(ostream& os, const map<K, V>& m) {
+ os << "{";
+ for (const auto& p : m) {
+ os << p.first << ": " << p.second << ", ";
+ }
+ os << "}";
+ return os;
+}
+
+template<typename K, typename V>
+ostream& operator<<(ostream& os, const unordered_map<K, V>& m) {
+ os << "{";
+ for (const auto& p : m) {
+ os << p.first << ": " << p.second << ", ";
+ }
+ os << "}";
+ return os;
+}
+
+template<typename T>
+ostream& operator<<(ostream& os, const set<T>& s) {
+ int i = 0;
+ os << "{";
+ for (const auto& e : s) {
+ if (i > 0) os << ", ";
+ os << e;
+ i++;
+ }
+ os << "}";
+ return os;
+}
+
+template<typename T>
+ostream& operator<<(ostream& os, const unordered_set<T>& s) {
+ int i = 0;
+ os << "{";
+ for (const auto& e : s) {
+ if (i > 0) os << ", ";
+ os << e;
+ i++;
+ }
+ os << "}";
+ return os;
+}
+
+void print() {
+ cerr << "\n";
+}
+
+template<typename T, typename... TS>
+void print(T val, TS... vals) {
+ cerr << val << " ";
+ print(vals...);
+}
+
+
+
+/* stuff you should look for:
+ ---------------------------
+ * special cases (n=1?)
+ * int overflow, array bounds
+ * do smth instead of nothing and stay organized
+ * WRITE STUFF DOWN
+ * DON'T GET STUCK ON ONE APPROACH
+ */
+
+void solve() {
+ int n, m;
+ cin >> n >> m;
+ ll ans = 0;
+ vector<vll> a(m, vll(n));
+ for (int i = 0; i < n; i++) {
+ vi v(m);
+ for (int j = 0; j < m; j++) {
+ cin >> v[j];
+ a[j][i] = v[j];
+ }
+ }
+ for (int i = 0; i < m; i++) {
+ sort(rall(a[i]));
+ for (int j = 0; j < n; j++) {
+ int after = n - 1 - j;
+ int before = j;
+ ans += a[i][j] * (after - before);
+ }
+ }
+ cout << ans << '\n';
+}
+
+int main () {
+ ios_base::sync_with_stdio(false);
+ cin.tie(NULL);
+ int tt;
+ cin >> tt;
+ while(tt--) {
+ solve();
+ }
+}
+
+
diff --git a/codeforces/PlayingInCasino/main_input0.txt b/codeforces/PlayingInCasino/main_input0.txt
new file mode 100644
index 0000000..42d5477
--- /dev/null
+++ b/codeforces/PlayingInCasino/main_input0.txt
@@ -0,0 +1,12 @@
+3
+3 5
+1 4 2 8 5
+7 9 2 1 4
+3 8 5 3 1
+1 4
+4 15 1 10
+4 3
+1 2 3
+3 2 1
+1 2 1
+4 2 7
diff --git a/codeforces/PlayingInCasino/main_output0.txt b/codeforces/PlayingInCasino/main_output0.txt
new file mode 100644
index 0000000..9c33d42
--- /dev/null
+++ b/codeforces/PlayingInCasino/main_output0.txt
@@ -0,0 +1,3 @@
+50
+0
+31
diff --git a/codeforces/SortZero/main b/codeforces/SortZero/main
new file mode 100755
index 0000000..4f0d902
--- /dev/null
+++ b/codeforces/SortZero/main
Binary files differ
diff --git a/codeforces/SortZero/main.cpp b/codeforces/SortZero/main.cpp
new file mode 100755
index 0000000..eadfde0
--- /dev/null
+++ b/codeforces/SortZero/main.cpp
@@ -0,0 +1,150 @@
+#include<bits/stdc++.h>
+using namespace std;
+
+using ll = long long;
+using pii = pair<int, int>;
+using vpi = vector<pii>;
+using vi = vector<int>;
+using vll = vector<long long>;
+using mpii = map<int, int>;
+using mpll = map<ll, ll>;