aboutsummaryrefslogtreecommitdiff
path: root/contests/Round849
diff options
context:
space:
mode:
Diffstat (limited to 'contests/Round849')
-rwxr-xr-xcontests/Round849/A/mainbin0 -> 26728 bytes
-rwxr-xr-xcontests/Round849/A/main.cpp92
-rw-r--r--contests/Round849/A/main_input0.txt11
-rw-r--r--contests/Round849/A/main_output0.txt10
-rwxr-xr-xcontests/Round849/B/mainbin0 -> 19080 bytes
-rwxr-xr-xcontests/Round849/B/main.cpp122
-rw-r--r--contests/Round849/B/main_input0.txt15
-rw-r--r--contests/Round849/B/main_output0.txt7
-rwxr-xr-xcontests/Round849/C/mainbin0 -> 18656 bytes
-rwxr-xr-xcontests/Round849/C/main.cpp105
-rw-r--r--contests/Round849/C/main_input0.txt19
-rw-r--r--contests/Round849/C/main_output0.txt9
-rwxr-xr-xcontests/Round849/D/mainbin0 -> 67128 bytes
-rwxr-xr-xcontests/Round849/D/main.cpp104
-rw-r--r--contests/Round849/D/main_input0.txt11
-rw-r--r--contests/Round849/D/main_output0.txt5
-rwxr-xr-xcontests/Round849/E/mainbin0 -> 27104 bytes
-rwxr-xr-xcontests/Round849/E/main.cpp124
-rw-r--r--contests/Round849/E/main_input0.txt11
-rw-r--r--contests/Round849/E/main_input1.txt3
-rw-r--r--contests/Round849/E/main_input2.txt3
-rw-r--r--contests/Round849/E/main_output0.txt5
-rw-r--r--contests/Round849/E/main_output1.txt1
-rw-r--r--contests/Round849/E/main_output2.txt1
-rwxr-xr-xcontests/Round849/F/mainbin0 -> 22520 bytes
-rwxr-xr-xcontests/Round849/F/main.cpp114
-rw-r--r--contests/Round849/F/main_input0.txt19
-rw-r--r--contests/Round849/F/main_output0.txt9
-rwxr-xr-xcontests/Round849/G1/mainbin0 -> 39896 bytes
-rwxr-xr-xcontests/Round849/G1/main.cpp108
-rw-r--r--contests/Round849/G1/main_input0.txt21
-rw-r--r--contests/Round849/G1/main_output0.txt10
-rwxr-xr-xcontests/Round849/G2/mainbin0 -> 41712 bytes
-rwxr-xr-xcontests/Round849/G2/main.cpp142
-rw-r--r--contests/Round849/G2/main_input0.txt21
-rw-r--r--contests/Round849/G2/main_output0.txt10
-rwxr-xr-xcontests/Round849/G2Joe/mainbin0 -> 66008 bytes
-rwxr-xr-xcontests/Round849/G2Joe/main.cpp129
-rw-r--r--contests/Round849/G2Joe/main_input0.txt21
-rw-r--r--contests/Round849/G2Joe/main_input1.txt3
-rw-r--r--contests/Round849/G2Joe/main_input2.txt3
-rw-r--r--contests/Round849/G2Joe/main_output0.txt10
-rw-r--r--contests/Round849/G2Joe/main_output1.txt1
-rw-r--r--contests/Round849/G2Joe/main_output2.txt1
44 files changed, 1280 insertions, 0 deletions
diff --git a/contests/Round849/A/main b/contests/Round849/A/main
new file mode 100755
index 0000000..3e81677
--- /dev/null
+++ b/contests/Round849/A/main
Binary files differ
diff --git a/contests/Round849/A/main.cpp b/contests/Round849/A/main.cpp
new file mode 100755
index 0000000..aa30531
--- /dev/null
+++ b/contests/Round849/A/main.cpp
@@ -0,0 +1,92 @@
+#include<bits/stdc++.h>
+using namespace std;
+
+using ll = long long;
+using pi = pair<int, int>;
+using vpi = vector<pi>;
+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
+
+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};
+
+//pretty printing
+template<typename K, typename V>
+void printm(const map<K, V> &mp) {
+ cerr << "{" << endl;
+ for (auto p : mp) {
+ cerr << " { " << p.first << " : " << p.second << " }\n";
+ }
+ cerr << "}" << endl;
+}
+template<typename T>
+void printv(const vector<T> &v) {
+ cerr << "[";
+ for (int i = 0; i < v.size(); i++) {
+ if (i == v.size() - 1) {
+ cerr << v[i];
+ } else {
+ cerr << v[i] << ", ";
+ }
+ }
+ cerr << "]\n";
+}
+
+template<typename T>
+void printvv(const vector<vector<T>> &v) {
+ cerr << "[\n";
+ for (auto &vec : v) {
+ cout << " ";
+ printv(vec);
+ }
+ cerr << "]\n";
+}
+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() {
+ string haystack = "codeforces";
+ char ch;
+ cin >> ch;
+ cout << (count(all(haystack), ch) ? "YES" : "NO") << '\n';
+}
+
+int main () {
+ ios_base::sync_with_stdio(false);
+ cin.tie(NULL);
+ int tt;
+ cin >> tt;
+ while(tt--) {
+ solve();
+ }
+}
+
+
diff --git a/contests/Round849/A/main_input0.txt b/contests/Round849/A/main_input0.txt
new file mode 100644
index 0000000..9d71f59
--- /dev/null
+++ b/contests/Round849/A/main_input0.txt
@@ -0,0 +1,11 @@
+10
+a
+b
+c
+d
+e
+f
+g
+h
+i
+j
diff --git a/contests/Round849/A/main_output0.txt b/contests/Round849/A/main_output0.txt
new file mode 100644
index 0000000..6df8a46
--- /dev/null
+++ b/contests/Round849/A/main_output0.txt
@@ -0,0 +1,10 @@
+NO
+NO
+YES
+YES
+YES
+YES
+NO
+NO
+NO
+NO
diff --git a/contests/Round849/B/main b/contests/Round849/B/main
new file mode 100755
index 0000000..24928cb
--- /dev/null
+++ b/contests/Round849/B/main
Binary files differ
diff --git a/contests/Round849/B/main.cpp b/contests/Round849/B/main.cpp
new file mode 100755
index 0000000..da40ca0
--- /dev/null
+++ b/contests/Round849/B/main.cpp
@@ -0,0 +1,122 @@
+#include<bits/stdc++.h>
+using namespace std;
+
+using ll = long long;
+using pi = pair<int, int>;
+using vpi = vector<pi>;
+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
+
+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};
+
+//pretty printing
+template<typename K, typename V>
+void printm(const map<K, V> &mp) {
+ cerr << "{" << endl;
+ for (auto p : mp) {
+ cerr << " { " << p.first << " : " << p.second << " }\n";
+ }
+ cerr << "}" << endl;
+}
+template<typename T>
+void printv(const vector<T> &v) {
+ cerr << "[";
+ for (int i = 0; i < v.size(); i++) {
+ if (i == v.size() - 1) {
+ cerr << v[i];
+ } else {
+ cerr << v[i] << ", ";
+ }
+ }
+ cerr << "]\n";
+}
+
+template<typename T>
+void printvv(const vector<vector<T>> &v) {
+ cerr << "[\n";
+ for (auto &vec : v) {
+ cout << " ";
+ printv(vec);
+ }
+ cerr << "]\n";
+}
+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
+ */
+
+struct Point {
+ int x;
+ int y;
+ Point(int x, int y) {
+ this->x = x;
+ this->y = y;
+ }
+};
+
+void solve() {
+ Point p(0, 0);
+ int n;
+ cin >> n;
+ string str;
+ cin >> str;
+ for (auto ch: str) {
+ if(ch == 'U') {
+ p.y++;
+ }
+ else if(ch == 'D') {
+ p.y--;
+ }
+ else if(ch == 'R') {
+ p.x++;
+ }
+ else if(ch == 'L') {
+ p.x--;
+ }
+
+ if (p.x == 1 && p.y == 1) {
+ cout << "YES" << '\n';
+ return;
+ }
+ }
+ 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/Round849/B/main_input0.txt b/contests/Round849/B/main_input0.txt
new file mode 100644
index 0000000..bca5a3e
--- /dev/null
+++ b/contests/Round849/B/main_input0.txt
@@ -0,0 +1,15 @@
+7
+7
+UUURDDL
+2
+UR
+8
+RRRUUDDD
+3
+LLL
+4
+DUUR
+5
+RUDLL
+11
+LLLLDDRUDRD
diff --git a/contests/Round849/B/main_output0.txt b/contests/Round849/B/main_output0.txt
new file mode 100644
index 0000000..4699a2d
--- /dev/null
+++ b/contests/Round849/B/main_output0.txt
@@ -0,0 +1,7 @@
+YES
+YES
+NO
+NO
+YES
+YES
+NO
diff --git a/contests/Round849/C/main b/contests/Round849/C/main
new file mode 100755
index 0000000..7f05022
--- /dev/null
+++ b/contests/Round849/C/main
Binary files differ
diff --git a/contests/Round849/C/main.cpp b/contests/Round849/C/main.cpp
new file mode 100755
index 0000000..91c1a12
--- /dev/null
+++ b/contests/Round849/C/main.cpp
@@ -0,0 +1,105 @@
+#include<bits/stdc++.h>
+using namespace std;
+
+using ll = long long;
+using pi = pair<int, int>;
+using vpi = vector<pi>;
+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
+
+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};
+
+//pretty printing
+template<typename K, typename V>
+void printm(const map<K, V> &mp) {
+ cerr << "{" << endl;
+ for (auto p : mp) {
+ cerr << " { " << p.first << " : " << p.second << " }\n";
+ }
+ cerr << "}" << endl;
+}
+template<typename T>
+void printv(const vector<T> &v) {
+ cerr << "[";
+ for (int i = 0; i < v.size(); i++) {
+ if (i == v.size() - 1) {
+ cerr << v[i];
+ } else {
+ cerr << v[i] << ", ";
+ }
+ }
+ cerr << "]\n";
+}
+
+template<typename T>
+void printvv(const vector<vector<T>> &v) {
+ cerr << "[\n";
+ for (auto &vec : v) {
+ cout << " ";
+ printv(vec);
+ }
+ cerr << "]\n";
+}
+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
+ */
+
+int countPairs(string &str) {
+ int cnt = 0;
+ for (int i = 0; i < str.length() / 2; i++) {
+ if (str[i] != str[str.length() - 1 - i]) {
+ cnt++;
+ } else {
+ break;
+ }
+ }
+ return cnt;
+}
+
+void solve() {
+ int n;
+ cin >> n;
+ string str;
+ cin >> str;
+ cout << str.length() - 2 * countPairs(str) << '\n';
+}
+
+int main () {
+ ios_base::sync_with_stdio(false);
+ cin.tie(NULL);
+ int tt;
+ cin >> tt;
+ while(tt--) {
+ solve();
+ }
+}
+
+
diff --git a/contests/Round849/C/main_input0.txt b/contests/Round849/C/main_input0.txt
new file mode 100644
index 0000000..b07910f
--- /dev/null
+++ b/contests/Round849/C/main_input0.txt
@@ -0,0 +1,19 @@
+9
+3
+100
+4
+0111
+5
+10101
+6
+101010
+7
+1010110
+1
+1
+2
+10
+2
+11
+10
+1011011010
diff --git a/contests/Round849/C/main_output0.txt b/contests/Round849/C/main_output0.txt
new file mode 100644
index 0000000..89375dd
--- /dev/null
+++ b/contests/Round849/C/main_output0.txt
@@ -0,0 +1,9 @@
+1
+2
+5
+0
+3
+1
+0
+2
+4
diff --git a/contests/Round849/D/main b/contests/Round849/D/main
new file mode 100755
index 0000000..b59f7cc
--- /dev/null
+++ b/contests/Round849/D/main
Binary files differ
diff --git a/contests/Round849/D/main.cpp b/contests/Round849/D/main.cpp
new file mode 100755
index 0000000..9e9da38
--- /dev/null
+++ b/contests/Round849/D/main.cpp
@@ -0,0 +1,104 @@
+#include<bits/stdc++.h>
+using namespace std;
+
+using ll = long long;
+using pi = pair<int, int>;
+using vpi = vector<pi>;
+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
+
+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};
+
+//pretty printing
+template<typename K, typename V>
+void printm(const map<K, V> &mp) {
+ cerr << "{" << endl;
+ for (auto p : mp) {
+ cerr << " { " << p.first << " : " << p.second << " }\n";
+ }
+ cerr << "}" << endl;
+}
+template<typename T>
+void printv(const vector<T> &v) {
+ cerr << "[";
+ for (int i = 0; i < v.size(); i++) {
+ if (i == v.size() - 1) {
+ cerr << v[i];
+ } else {
+ cerr << v[i] << ", ";
+ }
+ }
+ cerr << "]\n";
+}
+
+template<typename T>
+void printvv(const vector<vector<T>> &v) {
+ cerr << "[\n";
+ for (auto &vec : v) {
+ cout << " ";
+ printv(vec);
+ }
+ cerr << "]\n";
+}
+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
+ */
+
+// abcabcabc
+void solve() {
+ int n;
+ cin >> n;
+ string str;
+ cin >> str;
+ vi fq(27);
+ int split = 0;
+ for (int i = 0; i < n; i++) {
+ char ch = str[i];
+ fq[ch - 'a']++;
+ if (fq[ch - 'a'] > 1) {
+ split = i;
+ break;
+ }
+ }
+ cout << unordered_set<char>(str.begin(), str.begin() + split).size() + unordered_set<char>(str.begin() + split, str.end()).size() << '\n';
+}
+
+int main () {
+ ios_base::sync_with_stdio(false);
+ cin.tie(NULL);
+ int tt;
+ cin >> tt;
+ while(tt--) {
+ solve();
+ }
+}
+
+
diff --git a/contests/Round849/D/main_input0.txt b/contests/Round849/D/main_input0.txt
new file mode 100644
index 0000000..8d60cf9
--- /dev/null
+++ b/contests/Round849/D/main_input0.txt
@@ -0,0 +1,11 @@
+5
+2
+aa
+7
+abcabcd
+5
+aaaaa
+10
+paiumoment
+4
+aazz
diff --git a/contests/Round849/D/main_output0.txt b/contests/Round849/D/main_output0.txt
new file mode 100644
index 0000000..8162782
--- /dev/null
+++ b/contests/Round849/D/main_output0.txt
@@ -0,0 +1,5 @@
+2
+7
+2
+10
+3
diff --git a/contests/Round849/E/main b/contests/Round849/E/main
new file mode 100755
index 0000000..6a259d3
--- /dev/null
+++ b/contests/Round849/E/main
Binary files differ
diff --git a/contests/Round849/E/main.cpp b/contests/Round849/E/main.cpp
new file mode 100755
index 0000000..d1605ce
--- /dev/null
+++ b/contests/Round849/E/main.cpp
@@ -0,0 +1,124 @@
+#include<bits/stdc++.h>
+using namespace std;
+
+using ll = long long;
+using pi = pair<int, int>;
+using vpi = vector<pi>;
+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
+
+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};
+
+//pretty printing
+template<typename K, typename V>
+void printm(const map<K, V> &mp) {
+ cerr << "{" << endl;
+ for (auto p : mp) {
+ cerr << " { " << p.first << " : " << p.second << " }\n";
+ }
+ cerr << "}" << endl;
+}
+template<typename T>
+void printv(const vector<T> &v) {
+ cerr << "[";
+ for (int i = 0; i < v.size(); i++) {
+ if (i == v.size() - 1) {
+ cerr << v[i];
+ } else {
+ cerr << v[i] << ", ";
+ }
+ }
+ cerr << "]\n";
+}
+
+template<typename T>
+void printvv(const vector<vector<T>> &v) {
+ cerr << "[\n";
+ for (auto &vec : v) {
+ cout << " ";
+ printv(vec);
+ }
+ cerr << "]\n";
+}
+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
+ */
+
+/*
+ * Ideally we want them all to be positive
+ * If we can't get them all to be positive we want to flip the largest numbers in absloute
+ * The 0 can be a joker because flipping its sign is meaningless anyways
+*/
+
+void solve() {
+ int n;
+ cin >> n;
+ vll v(n);
+ for (auto &x : v) cin >> x;
+ int neg = 0;
+ for (auto x : v) {
+ neg += (x < 0);
+ }
+ ll sum = 0;
+ if (neg % 2 == 0) {
+ for (auto x : v) {
+ if (x < 0) {
+ sum += -x;
+ } else {
+ sum += x;
+ }
+ }
+ } else {
+ for (auto &x : v) {
+ if (x < 0) {
+ x = -x;
+ }
+ }
+ for (auto x : v) {
+ sum += x;
+ }
+ sum -= *min_element(all(v)) * 2;
+ }
+ cout << sum << '\n';
+
+}
+
+int main () {
+ ios_base::sync_with_stdio(false);
+ cin.tie(NULL);
+ int tt;
+ cin >> tt;
+ while(tt--) {
+ solve();
+ }
+}
+
+
diff --git a/contests/Round849/E/main_input0.txt b/contests/Round849/E/main_input0.txt
new file mode 100644
index 0000000..7111644
--- /dev/null
+++ b/contests/Round849/E/main_input0.txt
@@ -0,0 +1,11 @@
+5
+3
+-1 -1 -1
+5
+1 5 -5 0 2
+3
+1 2 3
+6
+-1 10 9 8 7 6
+2
+-1 -1
diff --git a/contests/Round849/E/main_input1.txt b/contests/Round849/E/main_input1.txt
new file mode 100644
index 0000000..5285b38
--- /dev/null
+++ b/contests/Round849/E/main_input1.txt
@@ -0,0 +1,3 @@
+1
+4
+1 -10 9 8 \ No newline at end of file
diff --git a/contests/Round849/E/main_input2.txt b/contests/Round849/E/main_input2.txt
new file mode 100644
index 0000000..028be5f
--- /dev/null
+++ b/contests/Round849/E/main_input2.txt
@@ -0,0 +1,3 @@
+1
+7
+-1 1 -1 1 -1 1 -1 \ No newline at end of file
diff --git a/contests/Round849/E/main_output0.txt b/contests/Round849/E/main_output0.txt
new file mode 100644
index 0000000..9ce57b7
--- /dev/null
+++ b/contests/Round849/E/main_output0.txt
@@ -0,0 +1,5 @@
+1
+13
+6
+39
+2
diff --git a/contests/Round849/E/main_output1.txt b/contests/Round849/E/main_output1.txt
new file mode 100644
index 0000000..a5c750f
--- /dev/null
+++ b/contests/Round849/E/main_output1.txt
@@ -0,0 +1 @@
+27 \ No newline at end of file
diff --git a/contests/Round849/E/main_output2.txt b/contests/Round849/E/main_output2.txt
new file mode 100644
index 0000000..c793025
--- /dev/null
+++ b/contests/Round849/E/main_output2.txt
@@ -0,0 +1 @@
+7 \ No newline at end of file
diff --git a/contests/Round849/F/main b/contests/Round849/F/main
new file mode 100755
index 0000000..ebe8061
--- /dev/null
+++ b/contests/Round849/F/main
Binary files differ
diff --git a/contests/Round849/F/main.cpp b/contests/Round849/F/main.cpp
new file mode 100755
index 0000000..79a7299
--- /dev/null
+++ b/contests/Round849/F/main.cpp
@@ -0,0 +1,114 @@
+#include<bits/stdc++.h>
+using namespace std;
+
+using ll = long long;
+using pi = pair<int, int>;
+using vpi = vector<pi>;
+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
+
+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};
+
+//pretty printing
+template<typename K, typename V>
+void printm(const map<K, V> &mp) {
+ cerr << "{" << endl;
+ for (auto p : mp) {
+ cerr << " { " << p.first << " : " << p.second << " }\n";
+ }
+ cerr << "}" << endl;
+}
+template<typename T>
+void printv(const vector<T> &v) {
+ cerr << "[";
+ for (int i = 0; i < v.size(); i++) {
+ if (i == v.size() - 1) {
+ cerr << v[i];
+ } else {
+ cerr << v[i] << ", ";
+ }
+ }
+ cerr << "]\n";
+}
+
+template<typename T>
+void printvv(const vector<vector<T>> &v) {
+ cerr << "[\n";
+ for (auto &vec : v) {
+ cout << " ";
+ printv(vec);
+ }
+ cerr << "]\n";
+}
+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
+ */
+
+int sumDigits(int x) {
+ int sum = 0;
+ while(x) {
+ sum += x % 10;
+ x /= 10;
+ }
+ return sum;
+}
+
+void solve() {
+ int n, q;
+ cin >> n >> q;
+ vi v(n);
+ for (auto &x: v) cin >> x; // O(n)
+ for (int i = 0; i < q; i++) { // O(q)
+ int x, y, z;
+ cin >> x;
+ if (x == 1) {
+ cin >> y >> z;
+ for (int i = y - 1; i < z; i++) {
+ v[i] = sumDigits(v[i]);
+ }
+ } else {
+ cin >> y;
+ cout << v[y - 1] << '\n';
+ }
+ }
+}
+
+int main () {
+ ios_base::sync_with_stdio(false);
+ cin.tie(NULL);
+ int tt;
+ cin >> tt;
+ while(tt--) {
+ solve();
+ }
+}
+
+
diff --git a/contests/Round849/F/main_input0.txt b/contests/Round849/F/main_input0.txt
new file mode 100644
index 0000000..e5b8ab3
--- /dev/null
+++ b/contests/Round849/F/main_input0.txt
@@ -0,0 +1,19 @@
+3
+5 8
+1 420 69 1434 2023
+1 2 3
+2 2
+2 3
+2 4
+1 2 5
+2 1
+2 3
+2 5
+2 3
+9999 1000
+1 1 2
+2 1
+2 2
+1 1
+1
+2 1
diff --git a/contests/Round849/F/main_output0.txt b/contests/Round849/F/main_output0.txt
new file mode 100644
index 0000000..974b142
--- /dev/null
+++