malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   void pb_200() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);   }   int32_t main() {     long long int x;     cin >> x;     while (x--) {       long long int n;       cin >> n;       long long int *arr = new long long int[n];       ;       for (long long int i = 0; i < n; ++i) cin >> arr[i];       long long int i = n - 1;       while (i > 0 and arr[i] <= arr[i - 1]) i--;       if (i == 0) {         cout << 0 << endl;         continue;       }       while (i > 0 and arr[i] >= arr[i - 1]) i--;       cout << i << endl;     }   }
#include <bits/stdc++.h>   int a[1005][1005];   int n;   void solve(int x) {     for (int flag = 0; flag < n; flag++) {       if (a[x][flag] == 0) {         for (int flag1 = flag; flag1 < n; flag1++) {           a[x][flag1] = a[x][flag1 + 1];         }         break;       }     }   }   int main() {     while (scanf( %d , &n) != EOF) {       memset(a, 0, sizeof(a));       for (int flag = 0; flag < n; flag++) {         for (int flag1 = 0; flag1 < n; flag1++) {           a[flag][flag1] = (flag + flag1) % n;         }       }       for (int flag = 1; flag < n; flag++) {         solve(flag);       }       for (int flag = 1; flag < n; flag++) {         a[flag][n - 1] = a[flag][flag];         a[flag][flag] = 0;       }       for (int flag = 0; flag < n; flag++) {         for (int flag1 = 0; flag1 < flag; flag1++) {           a[flag][flag1] = a[flag1][flag];         }       }       for (int flag = 0; flag < n; flag++) {         printf( %d , a[flag][0]);         for (int flag1 = 1; flag1 < n; flag1++) {           printf(  %d , a[flag][flag1]);         }         printf(  n );       }     }   }
#include <bits/stdc++.h>   using namespace std;   long long fact[(long long)(1e6 + 10)], mod_inv[(long long)(1e6 + 10)];   long long _pow(long long a, long long n) {     if (n == 0) return 1;     if (n % 2 == 1) return (a * _pow(a, n - 1)) % (long long)(1e9 + 7);     long long x = _pow(a, n / 2) % (long long)(1e9 + 7);     return (x * x) % (long long)(1e9 + 7);   }   void inv() {     mod_inv[0] = 1;     for (int i = 1; i < (long long)(1e6 + 10) - 1; i++) {       mod_inv[i] = _pow(fact[i], (long long)(1e9 + 7) - 2);     }   }   void f() {     fact[0] = 1;     mod_inv[0] = 1;     for (int i = 1; i < (long long)(1e6 + 10) - 1; i++) {       fact[i] = fact[i - 1] * i;       fact[i] %= (long long)(1e9 + 7);       mod_inv[i] = _pow(fact[i], (long long)(1e9 + 7) - 2);     }   }   void init() { f(); }   long long nCr(long long n, long long r) {     return (((mod_inv[n - r] * mod_inv[r]) % (long long)(1e9 + 7)) * fact[n]) %            (long long)(1e9 + 7);   }   pair<long long, long long> black[2010];   bool cmp(pair<long long, long long> a, pair<long long, long long> b) {     return (a.first == b.first) ? a.second < b.second : a.first < b.first;   }   int main() {     std::ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     init();     int h, w, n;     cin >> h >> w >> n;     for (int i = 0; i < n; i++) {       cin >> black[i].first >> black[i].second;       black[i].first--;       black[i].second--;     }     long long dp[n + 1];     memset(dp, 0, sizeof(dp));     black[n] = make_pair(h - 1, w - 1);     sort(black, black + n, cmp);     for (int i = 0; i < n + 1; i++) {       dp[i] = nCr(black[i].first + black[i].second, black[i].first);       for (int j = 0; j < i; j++) {         if (black[j].second > black[i].second) continue;         dp[i] -= (dp[j] * nCr(black[i].first - black[j].first + black[i].second -                                   black[j].second,                               black[i].second - black[j].second)) %                  (long long)(1e9 + 7);         dp[i] += (long long)(1e9 + 7);         dp[i] %= (long long)(1e9 + 7);       }     }     cout << dp[n] << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int T;     cin >> T;     while (T--) {       int n, m, k;       cin >> n >> m >> k;       vector<vector<int>> G(n + 1);       vector<int> deg(n + 1);       for (int i = 1; i <= m; i++) {         int x, y;         cin >> x >> y;         G[x].push_back(y);         G[y].push_back(x);         deg[x] += 1;         deg[y] += 1;       }       for (int i = 1; i <= n; i++) {         sort(G[i].begin(), G[i].end());       }       auto del = [&](int x, int y) -> void {         deg[x] -= 1;         deg[y] -= 1;       };       queue<int> Q;       for (int i = 1; i <= n; i++) {         if (deg[i] < k - 1) {           Q.push(i);         }       }       while (!Q.empty()) {         int cur = Q.front();         Q.pop();         for (auto nx : G[cur]) {           if (deg[nx] == 0) {             continue;           }           del(cur, nx);           if (deg[nx] == k - 2) {             Q.push(nx);           }         }         assert(deg[cur] == 0);       }       auto go = [&]() -> void {         for (int i = 1; i <= n; i++) {           if (deg[i] == k - 1) {             Q.push(i);           }         }         while (!Q.empty()) {           int cur = Q.front();           Q.pop();           if (deg[cur] == k - 1) {             bool good = true;             vector<int> vec;             for (auto nx : G[cur]) {               if (deg[nx]) {                 vec.push_back(nx);               }             }             assert(vec.size() == k - 1);             for (int i = 0; good && i < k - 1; i++) {               for (int j = i + 1; good && j < k - 1; j++) {                 int x = vec[i];                 int y = vec[j];                 auto it = lower_bound(G[x].begin(), G[x].end(), y);                 if (it == G[x].end() || *it != y) {                   good = false;                 }               }             }             if (good) {               cout <<  2 n ;               for (auto t : vec) {                 cout << t <<    ;               }               cout << cur <<   n ;               return;             }           }           for (auto nx : G[cur]) {             if (deg[nx] == 0) {               continue;             }             del(cur, nx);             if (deg[nx] == k - 1) {               Q.push(nx);             }           }         }         vector<int> ans;         for (int i = 1; i <= n; i++) {           if (deg[i]) {             ans.push_back(i);           }         }         if (ans.empty()) {           cout << -1 <<   n ;         } else {           cout <<  1   << ans.size() <<   n ;           for (auto t : ans) {             cout << t <<    ;           }           cout <<   n ;         }       };       go();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());   const int N = 100100;   int n;   int deg[N];   int main() {     scanf( %d , &n);     for (int i = 1; i < n; i++) {       int v, u;       scanf( %d%d , &v, &u);       v--;       u--;       deg[v]++;       deg[u]++;     }     for (int v = 0; v < n; v++) {       if (deg[v] == 2) {         printf( NO n );         return 0;       }     }     printf( YES n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int cal(long long n) {     int sum = 0;     string s = to_string(n);     for (int i = 0; i < s.size(); i++) {       sum = sum + (s[i] -  0 );     }     return sum;   }   int main() {     long long n;     cin >> n;     if (n < 9) {       cout << n << endl;       return 0;     }     long long i = 9;     long long a = -1;     for (int j = 0; j < 13; j++) {       if (i <= n) {         a = i;         i = i * 10 + 9;       } else {         break;       }     }     long long b = n - a;     cout << cal(a) + cal(b) << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T>   bool chkmax(T &a, T b) {     return (a < b) ? a = b, 1 : 0;   }   template <typename T>   bool chkmin(T &a, T b) {     return (a > b) ? a = b, 1 : 0;   }   inline int read() {     int x = 0, fh = 1;     char ch = getchar();     for (; !isdigit(ch); ch = getchar())       if (ch ==  - ) fh = -1;     for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + (ch ^  0 );     return x * fh;   }   int n, m, k, K;   int mp[605][605];   int st[605];   vector<int> G[605];   int vis[605];   int mat[605];   bool dfs(int x) {     for (int v : G[x]) {       if (!vis[v]) {         vis[v] = 1;         if (!mat[v] || dfs(mat[v])) {           mat[v] = x;           return 1;         }       }     }     return 0;   }   bool check(int x) {     for (int i = (1), _end_ = (int)(n); i <= _end_; ++i) G[i].clear();     for (int i = (1), _end_ = (int)(k); i <= _end_; ++i) {       for (int j = (1), _end_ = (int)(n); j <= _end_; ++j) {         if (mp[st[i]][j] <= x) G[i].push_back(j);       }     }     int ans = 0;     memset(mat, 0, sizeof(mat));     for (int i = (1), _end_ = (int)(k); i <= _end_; ++i) {       memset(vis, 0, sizeof(vis));       if (dfs(i)) ans++;     }     return ans >= K;   }   int main() {     n = read();     m = read();     k = read();     K = read();     memset(mp, 0x3f3f3f3f, sizeof(mp));     for (int i = (1), _end_ = (int)(n); i <= _end_; ++i) mp[i][i] = 0;     for (int i = (1), _end_ = (int)(k); i <= _end_; ++i) st[i] = read();     for (int i = (1), _end_ = (int)(m); i <= _end_; ++i) {       int x = read(), y = read(), w = read();       if (chkmin(mp[x][y], w)) mp[x][y] = mp[y][x] = w;     }     for (int kk = (1), _end_ = (int)(n); kk <= _end_; ++kk) {       for (int i = (1), _end_ = (int)(n); i <= _end_; ++i) {         for (int j = (1), _end_ = (int)(n); j <= _end_; ++j) {           if (chkmin(mp[i][j], mp[i][kk] + mp[kk][j])) mp[j][i] = mp[i][j];         }       }     }     int l = 0, r = 0x3f3f3f3f;     int ans = 0x3f3f3f3f;     while (l <= r) {       int mid = (l + r) >> 1;       if (check(mid))         ans = mid, r = mid - 1;       else         l = mid + 1;     }     if (ans == 0x3f3f3f3f)       puts( -1 );     else       printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int tree[4000009][3];   int a[1000009];   void init(int node, int b, int e) {     if (b == e) {       tree[node][a[b]] = 1;       tree[node][1 - a[b]] = 0;       tree[node][2] = 0;       return;     }     int mid = (b + e) / 2;     int left = node * 2;     int right = node * 2 + 1;     init(left, b, mid);     init(right, mid + 1, e);     tree[node][2] = min(tree[left][0], tree[right][1]);     tree[node][0] = tree[left][0] - tree[node][2] + tree[right][0];     tree[node][1] = tree[left][1] + tree[right][1] - tree[node][2];     tree[node][2] += tree[left][2] + tree[right][2];   }   pair<int, pair<int, int>> query(int node, int b, int e, int l, int r) {     if (l > e || r < b) return {0, {0, 0}};     if (b >= l && e <= r) return {tree[node][2], {tree[node][0], tree[node][1]}};     int mid = b + e >> 1;     int left = node * 2;     int right = node * 2 + 1;     pair<int, pair<int, int>> p1 = query(left, b, mid, l, r);     pair<int, pair<int, int>> p2 = query(right, mid + 1, e, l, r);     int mn = min(p1.second.first, p2.second.second);     int tot = p1.first + p2.first + mn;     int lf = p1.second.first + p2.second.first - mn;     int rf = p1.second.second + p2.second.second - mn;     return {tot, {lf, rf}};   }   int main() {     string s;     cin >> s;     int n = s.length();     for (int i = 0; i < n; i++) {       if (s[i] ==  ( )         a[i + 1] = 0;       else         a[i + 1] = 1;     }     int q;     cin >> q;     init(1, 1, n);     while (q--) {       int l, r;       cin >> l >> r;       cout << 2 * query(1, 1, n, l, r).first << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   long long int n, tmp;   long long int k, c = 0;   list<int> game;   int main() {     cin >> n >> k;     for (int i = 0; i < n; i++) {       cin >> tmp;       game.push_back(tmp);     }     while (*game.begin() != n) {       if (*game.begin() > *(++game.begin())) {         tmp = *(++game.begin());         game.erase(++game.begin());         game.push_back(tmp);         c++;       } else {         tmp = *game.begin();         game.erase(game.begin());         game.push_back(tmp);         c = 1;       }       if (c == k) {         cout << *game.begin();         return 0;       }     }     cout << n;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   char s[200003];   long long k;   struct pos {     char c;     int nom;   };   pos a[100003];   pos b[100003];   pos c[100003];   void mergesort(pos *a, pos *b, int n) {     int i, i1, i0, iRight, iEnd, width, j;     for (width = 1; width < n; width *= 2)       for (i = 0; i < n; i += width * 2) {         i0 = i;         i1 = iRight = min(i + width, n);         iEnd = min(i + width * 2, n);         for (j = i; j < iEnd; j++)           if (i0 < iRight && (i1 == iEnd || a[i0].c <= a[i1].c))             b[j] = a[i0++];           else             b[j] = a[i1++];         for (j = i; j < iEnd; j++) a[j] = b[j];       }   }   int main() {     scanf( %s , s);     scanf( %I64d , &k);     int i, j, jj;     for (i = 0; s[i]; i++) {       a[i].nom = i;       a[i].c = s[i];     }     long long n = i;     if (k > ((n * (n + 1)) >> 1)) {       printf( No such line. n );       return 0;     }     long long sum;     long long add;     int coun = n;     while (k > 0) {       mergesort(a, c, coun);       sum = 0;       i = 0;       while (i < coun) {         add = 0;         j = i;         while (j < coun && a[j].c == a[i].c) j++;         for (jj = i; jj < j; jj++) add += n - a[jj].nom;         if (sum + add >= k) break;         sum += add;         i = j;       }       printf( %c , a[i].c);       k -= sum;       k -= j - i;       coun = 0;       for (jj = i; jj < j; jj++) {         if (a[jj].nom != n - 1) {           b[coun].c = s[a[jj].nom + 1];           b[coun++].nom = a[jj].nom + 1;         }       }       for (jj = 0; jj < coun; jj++) a[jj] = b[jj];     }   }
#include <bits/stdc++.h>   using namespace std;   int n;   int a[200001];   int b[200001];   int main() {     cin >> n;     int tong = 0;     int i;     for (i = 1; i <= n; i++) cin >> a[i], tong += a[i];     int k = 1;     i = 1;     bool ok = true;     while (i <= n) {       if (tong % n == 0 && a[i] == tong / n) {         b[k] = i;         k++;         ok = false;       }       i++;     };     if (ok) {       cout << 0 << endl;       return 0;     }     cout << k - 1 << endl;     for (i = 1; i < k; i++) cout << b[i] <<    ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct SEG {     int segment_length;     char chars;   };   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     ;     string s;     cin >> s;     SEG cur;     vector<SEG> st;     cur.segment_length = 0;     cur.chars =  - ;     for (char x : s) {       if (x == cur.chars) {         cur.segment_length++;       } else {         if (cur.segment_length > 0) st.push_back(cur);         cur.segment_length = 1;         cur.chars = x;       }     }     st.push_back(cur);     int ans = 0;     int p;     while (((int)(st).size()) > 1) {       vector<SEG> effect;       for (int x = 0; x < ((int)(st).size()); x++) {         cur = st[x];         if (x == 0 or x == ((int)(st).size()) - 1) {           cur.segment_length--;         } else {           cur.segment_length -= 2;         }         if (cur.segment_length <= 0) {           continue;         }         if (effect.empty()) {           effect.push_back(cur);         } else {           if (effect.back().chars == cur.chars) {             effect.back().segment_length += cur.segment_length;           } else {             effect.push_back(cur);           }         }       }       st = effect;       ans++;     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int n, s, min, max, l, r;     cin >> n;     s = pow(n, 2);     long long int v[s + 1];     for (long long int i = 0; i < s; i++) {       v[i] = i + 1;     }     for (long long int i = 0; i < n; i++) {       l = i;       r = n - 1;       if (n % 2 == 0) {         for (long long int j = 1; j <= n; j++) {           if (j <= n / 2) {             min = *min_element(v + l, v + r);             cout << min <<    ;             l = l + n;             r = r + n;           }           if (j > n / 2) {             max = *max_element(v + l - i, v + r - i + 1);             cout << max <<    ;             l = l + n;             r = r + n;           }         }       }       if (n % 2 != 0) {         for (long long int j = 1; j <= n; j++) {           if (j <= (n / 2) + 1) {             min = *min_element(v + l, v + r);             cout << min <<    ;             l = l + n;             r = r + n;           }           if (j > (n / 2) + 1) {             max = *max_element(v + l - i, v + r - i + 1);             cout << max <<    ;             l = l + n;             r = r + n;           }         }       }       cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     string n;     int s;     cin >> n >> s;     int sum = 0;     vector<int> digit;     for (int i = 0; i < (int)n.size(); i++) {       digit.push_back(n[i] -  0 );       sum += digit[i];     }     if (sum <= s) {       cout << 0 <<   n ;       return;     }     sum = 0;     int pos = -1;     for (int i = 0; i < (int)digit.size(); i++) {       sum += digit[i];       if (sum >= s) {         pos = i;         s -= (sum - digit[i]);         break;       }     }     if (pos == 0) {       digit.insert(digit.begin(), 1);       pos++;     } else {       digit[pos - 1]++;     }     for (int i = pos; i < (int)digit.size(); i++) digit[i] = 0;     long long num = 0;     for (int i = 0; i < (int)digit.size(); i++) num = num * 10 + digit[i];     long long res = num - stoll(n);     cout << res <<   n ;   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int t;     cin >> t;     while (t--) {       solve();     }   }
#include <bits/stdc++.h>   using namespace std;   using LL = long long;   using LD = long double;   void err() { cerr <<   033[39;0m  << endl; }   template <typename T, typename... A>   void err(T a, A... x) {     cerr << a <<    ;     err(x...);   }   const int N = 1e6 + 10;   struct Node {     map<int, Node*> link;     Node* fa;     int count;   } pool[N];   int cnt;   Node* new_node(Node* fa) {     Node* ret = pool + cnt++;     ret->fa = fa;     ret->link.clear();     ret->count = 0;     return ret;   }   int stk[N], top;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int T;     cin >> T;     while (T--) {       int n;       cin >> n;       top = 0;       LL ans = 0;       auto cur = new_node(nullptr);       cur->count = 1;       for (decay<decltype(n)>::type i = (0), _i = (n); i < _i; ++i) {         int c;         cin >> c;         if (top == 0 || stk[top - 1] != c) {           if (!cur->link[c]) {             cur->link[c] = new_node(cur);           }           cur = cur->link[c];           ans += cur->count++;           stk[top++] = c;         } else {           cur = cur->fa;           ans += cur->count++;           --top;         }       }       cout << ans << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int tc, i, j, k, cs = 1, m, n, ans;     {       scanf( %d%d , &m, &n);       if (n > m) swap(m, n);       if (n == 1)         ans = m;       else if (n == 2) {         ans = (m / 4) * 4;         if (m % 4 == 1)           ans += 2;         else if (m % 4 == 2)           ans += 4;         else if (m % 4 == 3)           ans += 4;       } else {         ans = ((m + 1) / 2) * ((n + 1) / 2);         ans += (m / 2) * (n / 2);       }       printf( %d n , ans);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   long long dp[210][210];   struct point {     long long x, y;     void read() { scanf( %I64d%I64d , &x, &y); }   } P[210];   long long cross(point a, point b, point c) {     return (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x);   }   int main() {     long long s = 0;     scanf( %d , &n);     for (int i = 1; i <= n; i++) P[i].read();     P[n + 1] = P[1];     for (int i = 2; i <= n; i++) s += cross(P[1], P[i], P[i + 1]);     if (s > 0)       for (int i = 1; i <= n / 2; i++) swap(P[i], P[n - i + 1]);     for (int i = 1; i < n; i++) dp[i][i + 1] = 1;     for (int i = 2; i < n; i++)       for (int j = 1; j <= n - i; j++)         for (int k = j + 1; k < i + j; k++)           if (cross(P[j], P[i + j], P[k]) > 0)             dp[j][i + j] = (dp[j][i + j] + dp[j][k] * dp[k][i + j]) % 1000000007;     printf( %I64d , dp[1][n]);   }
#include <bits/stdc++.h>   using namespace std;   long long powmod(long long a, long long b) {     long long res = 1;     a %= 1000000007;     for (; b; b >>= 1) {       if (b & 1) res = res * a % 1000000007;       a = a * a % 1000000007;     }     return res;   }   long long gcd(long long x, long long y) {     while (y) {       long long t = x % y;       x = y;       y = t;     }     return x;   }   template <typename T>   inline bool chkmin(T &a, const T &b) {     return a > b ? a = b, 1 : 0;   }   template <typename T>   inline bool chkmax(T &a, const T &b) {     return a < b ? a = b, 1 : 0;   }   unsigned int read() {     unsigned int x = 0, f = 1;     char ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) {       x = x * 10 + ch -  0 ;       ch = getchar();     }     return x * f;   }   int n, m;   int fst[1010], vv[400100], nxt[400100], e;   int col[1010], vis[1010];   void add(int u, int v) {     vv[e] = v, nxt[e] = fst[u], fst[u] = e++;     vv[e] = u, nxt[e] = fst[v], fst[v] = e++;   }   void init() {     e = 0;     memset(fst, -1, sizeof fst);   }   bool color(int u, int o) {     vis[u] = o;     int res = 1;     for (int i = fst[u]; ~i; i = nxt[i]) {       int v = vv[i];       if (vis[v] == o) {         if (col[v] == col[u]) res = 0;         continue;       }       col[v] = col[u] ^ 1;       if (!color(v, o)) res = 0;     }     return res;   }   int ans[1010], d[1010];   int main() {     init();     scanf( %d %d , &n, &m);     for (int i = 1; i <= m; i++) {       int u = read(), v = read();       add(u, v);     }     int bit = 1, tot = 0;     for (int i = 1; i <= n; i++) {       if (!vis[i]) {         if (!color(i, ++tot)) {           bit = 0;           break;         }       }     }     if (!bit) {       puts( -1 );       return 0;     }     for (int i = 1; i <= n; i++)       if (vis[i] > 0) {         memset(d, 0, sizeof d);         queue<int> q;         q.push(i);         d[i] = 1;         while (!q.empty()) {           int u = q.front();           q.pop();           chkmax(ans[vis[i]], d[u] - 1);           for (int i = fst[u]; ~i; i = nxt[i]) {             int v = vv[i];             if (d[v]) continue;             d[v] = d[u] + 1;             q.push(v);           }         }         vis[i] = 0;       }     for (int i = 1; i <= tot; i++) ans[0] += ans[i];     printf( %d n , ans[0]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     for (int q = 0; q < t; q++) {       int n;       cin >> n;       vector<int> a(n);       for (int i = 0; i < n; i++) cin >> a[i];       int moves = 0;       int max_size = 0;       int alice = 0, bob = 0;       while (a.size() != 0) {         moves++;         int curr_size = 0;         if (moves % 2 == 1) {           while (curr_size <= max_size) {             curr_size += a[0];             alice += a[0];             a.erase(a.begin());             if (a.size() == 0) break;           }         }         if (moves % 2 == 0) {           while (curr_size <= max_size) {             curr_size += a[(int)a.size() - 1];             bob += a[(int)a.size() - 1];             a.erase(a.begin() + (int)a.size() - 1);             if (a.size() == 0) break;           }         }         max_size = max(max_size, curr_size);       }       cout << moves <<     << alice <<     << bob <<   n ;     }   }