aboutsummaryrefslogtreecommitdiff
path: root/contests/Round898
diff options
context:
space:
mode:
authoromagdy7 <omar.professional8777@gmail.com>2023-09-24 21:04:29 +0300
committeromagdy7 <omar.professional8777@gmail.com>2023-09-24 21:04:29 +0300
commit60214bc8d0cfa68c1e3b74b62d9dcd1f548390eb (patch)
treeed741f03971fc54e4258e9f161fa456a468a9962 /contests/Round898
parent6cde2cdd6a4753193f83ff1cd2f635582f3949eb (diff)
downloadcompetitive-programming-60214bc8d0cfa68c1e3b74b62d9dcd1f548390eb.tar.xz
competitive-programming-60214bc8d0cfa68c1e3b74b62d9dcd1f548390eb.zip
Solved 5 problem in the last Div.4
Diffstat (limited to 'contests/Round898')
-rwxr-xr-xcontests/Round898/A/main.cpp143
-rw-r--r--contests/Round898/A/main_input0.txt7
-rw-r--r--contests/Round898/A/main_output0.txt6
-rwxr-xr-xcontests/Round898/B/main.cpp147
-rw-r--r--contests/Round898/B/main_input0.txt9
-rw-r--r--contests/Round898/B/main_output0.txt4
-rwxr-xr-xcontests/Round898/C/main.cpp163
-rw-r--r--contests/Round898/C/main_input0.txt41
-rw-r--r--contests/Round898/C/main_output0.txt4
-rwxr-xr-xcontests/Round898/D/main.cpp146
-rw-r--r--contests/Round898/D/main_input0.txt17
-rw-r--r--contests/Round898/D/main_output0.txt8
-rwxr-xr-xcontests/Round898/E/main.cpp157
-rw-r--r--contests/Round898/E/main_input0.txt11
-rw-r--r--contests/Round898/E/main_output0.txt5
-rwxr-xr-xcontests/Round898/F/main.cpp165
-rw-r--r--contests/Round898/F/main_input0.txt16
-rw-r--r--contests/Round898/F/main_output0.txt5
-rw-r--r--contests/Round898/G/main.cpp161
-rw-r--r--contests/Round898/G/main_input0.txt9
-rw-r--r--contests/Round898/G/main_output0.txt8
21 files changed, 1232 insertions, 0 deletions
diff --git a/contests/Round898/A/main.cpp b/contests/Round898/A/main.cpp
new file mode 100755
index 0000000..a6c5585
--- /dev/null
+++ b/contests/Round898/A/main.cpp
@@ -0,0 +1,143 @@
+#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 dbg() { cerr << "\n"; }
+
+template <typename T, typename... TS> void dbg(T val, TS... vals) {
+ cerr << val << " ";
+ dbg(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() {
+ string s;
+ cin >> s;
+ string tmp1 = s;
+ string tmp2 = s;
+ string tmp3 = s;
+ swap(tmp1[0], tmp1[1]);
+ swap(tmp2[0], tmp2[2]);
+ swap(tmp3[1], tmp3[2]);
+ if (s == "abc" || tmp1 == "abc" || tmp2 == "abc" || tmp3 == "abc") {
+ cout << "YES\n";
+ } else {
+ cout << "NO\n";
+ }
+}
+
+int main() {
+ ios_base::sync_with_stdio(false);
+ cin.tie(NULL);
+ int tt;
+ cin >> tt;
+ while (tt--) {
+ solve();
+ }
+}
diff --git a/contests/Round898/A/main_input0.txt b/contests/Round898/A/main_input0.txt
new file mode 100644
index 0000000..67b9fb9
--- /dev/null
+++ b/contests/Round898/A/main_input0.txt
@@ -0,0 +1,7 @@
+6
+abc
+acb
+bac
+bca
+cab
+cba
diff --git a/contests/Round898/A/main_output0.txt b/contests/Round898/A/main_output0.txt
new file mode 100644
index 0000000..d8b63f9
--- /dev/null
+++ b/contests/Round898/A/main_output0.txt
@@ -0,0 +1,6 @@
+YES
+YES
+YES
+NO
+NO
+YES
diff --git a/contests/Round898/B/main.cpp b/contests/Round898/B/main.cpp
new file mode 100755
index 0000000..66112a9
--- /dev/null
+++ b/contests/Round898/B/main.cpp
@@ -0,0 +1,147 @@
+#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 dbg() { cerr << "\n"; }
+
+template <typename T, typename... TS> void dbg(T val, TS... vals) {
+ cerr << val << " ";
+ dbg(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;
+ vll v(n);
+ for (auto &x : v) {
+ cin >> x;
+ }
+ ll mx = 0;
+ for (int i = 0; i < n; i++) {
+ vll tmp = v;
+ tmp[i]++;
+ ll sum = 1;
+ for (int j = 0; j < n; j++) {
+ sum *= tmp[j];
+ }
+ mx = max(mx, sum);
+ }
+ cout << mx << '\n';
+}
+
+int main() {
+ ios_base::sync_with_stdio(false);
+ cin.tie(NULL);
+ int tt;
+ cin >> tt;
+ while (tt--) {
+ solve();
+ }
+}
diff --git a/contests/Round898/B/main_input0.txt b/contests/Round898/B/main_input0.txt
new file mode 100644
index 0000000..246ddda
--- /dev/null
+++ b/contests/Round898/B/main_input0.txt
@@ -0,0 +1,9 @@
+4
+4
+2 2 1 2
+3
+0 1 2
+5
+4 3 2 3 4
+9
+9 9 9 9 9 9 9 9 9
diff --git a/contests/Round898/B/main_output0.txt b/contests/Round898/B/main_output0.txt
new file mode 100644
index 0000000..5ff12ca
--- /dev/null
+++ b/contests/Round898/B/main_output0.txt
@@ -0,0 +1,4 @@
+16
+2
+432
+430467210
diff --git a/contests/Round898/C/main.cpp b/contests/Round898/C/main.cpp
new file mode 100755
index 0000000..c27011c
--- /dev/null
+++ b/contests/Round898/C/main.cpp
@@ -0,0 +1,163 @@
+#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 dbg() { cerr << "\n"; }
+
+template <typename T, typename... TS> void dbg(T val, TS... vals) {
+ cerr << val << " ";
+ dbg(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
+ */
+
+bool is_ring(int i, int j, int ring) {
+ if (ring == 1) {
+ return i == 0 || i == 9 || j == 0 || j == 9;
+ } else if (ring == 2) {
+ return i == 1 || i == 8 || j == 1 || j == 8;
+ } else if (ring == 3) {
+ return i == 2 || i == 7 || j == 2 || j == 7;
+ } else if (ring == 4) {
+ return i == 3 || i == 6 || j == 3 || j == 6;
+ } else if (ring == 5) {
+ return i == 4 || i == 5 || j == 4 || j == 5;
+ }
+ return false;
+}
+
+void solve() {
+ vector<string> v(10);
+ for (auto &str : v) {
+ cin >> str;
+ }
+ int ans = 0;
+ for (int i = 0; i < 10; i++) {
+ for (int j = 0; j < 10; j++) {
+ if (v[i][j] == 'X') {
+ for (int k = 1; k <= 5; k++) {
+ if (is_ring(i, j, k)) {
+ ans += k;
+ break;
+ }
+ }
+ }
+ }
+ }
+ cout << ans << '\n';
+}
+
+int main() {
+ ios_base::sync_with_stdio(false);
+ cin.tie(NULL);
+ int tt;
+ cin >> tt;
+ while (tt--) {
+ solve();
+ }
+}
diff --git a/contests/Round898/C/main_input0.txt b/contests/Round898/C/main_input0.txt
new file mode 100644
index 0000000..95a660f
--- /dev/null
+++ b/contests/Round898/C/main_input0.txt
@@ -0,0 +1,41 @@
+4
+X.........
+..........
+.......X..
+.....X....
+......X...
+..........
+.........X
+..X.......
+..........
+.........X
+..........
+..........
+..........
+..........
+..........
+..........
+..........
+..........
+..........
+..........
+..........
+..........
+..........
+..........
+....X.....
+..........
+..........
+..........
+..........
+..........
+XXXXXXXXXX
+XXXXXXXXXX
+XXXXXXXXXX
+XXXXXXXXXX
+XXXXXXXXXX
+XXXXXXXXXX
+XXXXXXXXXX
+XXXXXXXXXX
+XXXXXXXXXX
+XXXXXXXXXX
diff --git a/contests/Round898/C/main_output0.txt b/contests/Round898/C/main_output0.txt
new file mode 100644
index 0000000..4731b69
--- /dev/null
+++ b/contests/Round898/C/main_output0.txt
@@ -0,0 +1,4 @@
+17
+0
+5
+220
diff --git a/contests/Round898/D/main.cpp b/contests/Round898/D/main.cpp
new file mode 100755
index 0000000..ffa3208
--- /dev/null
+++ b/contests/Round898/D/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 dbg() { cerr << "\n"; }
+
+template <typename T, typename... TS> void dbg(T val, TS... vals) {
+ cerr << val << " ";
+ dbg(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, k;
+ cin >> n >> k;
+ string s;
+ cin >> s;
+ int last_black = find(all(s), 'B') - s.begin();
+ int ans = 0;
+ int i = 0;
+ while (i < n) {
+ if (s[i] == 'B') {
+ ans++;
+ i += k;
+ } else {
+ i++;
+ }
+ }
+ cout << ans << '\n';
+}
+
+int main() {
+ ios_base::sync_with_stdio(false);
+ cin.tie(NULL);
+ int tt;
+ cin >> tt;
+ while (tt--) {
+ solve();
+ }
+}
diff --git a/contests/Round898/D/main_input0.txt b/contests/Round898/D/main_input0.txt
new file mode 100644
index 0000000..aa4b098
--- /dev/null
+++ b/contests/Round898/D/main_input0.txt
@@ -0,0 +1,17 @@
+8
+6 3
+WBWWWB
+7 3
+WWBWBWW
+5 4
+BWBWB
+5 5
+BBBBB
+8 2
+BWBWBBBB
+10 2
+WBBWBBWBBW
+4 1
+BBBB
+3 2
+WWW
diff --git a/contests/Round898/D/main_output0.txt b/contests/Round898/D/main_output0.txt
new file mode 100644
index 0000000..ca0b797
--- /dev/null
+++ b/contests/Round898/D/main_output0.txt
@@ -0,0 +1,8 @@
+2
+1
+2
+1
+4
+3
+4
+0
diff --git a/contests/Round898/E/main.cpp b/contests/Round898/E/main.cpp
new file mode 100755
index 0000000..ca3db87
--- /dev/null
+++ b/contests/Round898/E/main.cpp
@@ -0,0 +1,157 @@
+#include <bits/stdc++.h>
+#include <climits>
+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 dbg() { cerr << "\n"; }
+
+template <typename T, typename... TS> void dbg(T val, TS... vals) {
+ cerr << val << " ";
+ dbg(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
+ */
+
+bool is_more(vi &v, int h, int x) {
+ ll w = 0;
+ for (auto x : v) {
+ if (h > x) {
+ w += h - x;
+ }
+ }
+ return w > x;
+}
+
+void solve() {
+ int n, x;
+ cin >> n >> x;
+ vi v(n);
+ for (auto &y : v) {
+ cin >> y;
+ }
+ ll l = 1, r = INT_MAX;
+ while (r - l > 1) {
+ ll mid = (r + l) / 2;
+ if (is_more(v, mid, x)) {
+ r = mid;
+ } else {
+ l = mid;
+ }
+ }
+ cout << l << '\n';
+}
+
+int main() {
+ ios_base::sync_with_stdio(false);
+ cin.tie(NULL);
+ int tt;
+ cin >> tt;
+ while (tt--) {
+ solve();
+ }
+}
diff --git a/contests/Round898/E/main_input0.txt b/contests/Round898/E/main_input0.txt
new file mode 100644
index 0000000..22ab867
--- /dev/null
+++ b/contests/Round898/E/main_input0.txt
@@ -0,0 +1,11 @@
+5
+7 9
+3 1 2 4 6 2 5
+3 10
+1 1 1
+4 1
+1 4 3 4
+6 1984
+2 6 5 9 1 8
+1 1000000000
+1
diff --git a/contests/Round898/E/main_output0.txt b/contests/Round898/E/main_output0.txt
new file mode 100644
index 0000000..21620d0
--- /dev/null
+++ b/contests/Round898/E/main_output0.txt
@@ -0,0 +1,5 @@
+4
+4
+2
+335
+1000000001
diff --git a/contests/Round898/F/main.cpp b/contests/Round898/F/main.cpp
new file mode 100755
index 0000000..87704f4
--- /dev/null
+++ b/contests/Round898/F/main.cpp
@@ -0,0 +1,165 @@
+#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_se