malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int main() {     int n = 0, d = 0, count = 0, maxCount = 0;     cin >> n >> d;     string s =   ;     for (int i = 0; i < d; i++) {       cin >> s;       int res = 1;       for (int j = 0; j < s.size(); j++) {         res &= (s[j] -  0 );       }       if (res == 1) {         maxCount = max(count, maxCount);         count = 0;       } else {         count++;       }     }     maxCount = max(count, maxCount);     cout << maxCount;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int read() {     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 << 3) + (x << 1) + (ch ^ 48);       ch = getchar();     }     return x * f;   }   int n, m, k, cnt, a[200005], Of, Os;   char ch[200005];   int abs(int x, int y) {     if (x > y)       return x - y;     else       return y - x;   }   int main() {     n = read();     m = read();     k = read();     ;     for (int i = 1; i <= n; i++) {       scanf( %s , (ch + 1));       int f = 0, s = 0, ff = 0, ss = 0;       for (int j = 1; j <= m; j++) {         if (ch[j] ==  G ) f = j, ff++;         if (ch[j] ==  R ) s = j, ss++;       }       if (f == 0 && s != 0 && ss != m) Os = 1;       if (f != 0 && s == 0 && ff != m) Of = 1;       if (f && s) a[++cnt] = abs(s - f) - 1;     }     if (Os == 1 && Of == 1)       puts( Draw );     else if (Os == 1 && Of == 0)       puts( Second );     else if (Of == 1 && Os == 0)       puts( First );     else {       for (int i = 0; i <= 8; i++) {         int ff = 0;         for (int j = 1; j <= cnt; j++) ff += ((a[j] >> i) & 1);         if (ff % (k + 1)) {           puts( First );           return 0;         }       }       puts( Second );     }   }
#include <bits/stdc++.h>   using namespace std;   vector<int> zp;   int zer;   int one;   int n;   int allz;   int q() {     cout <<  ?  <<    ;     for (int i = 0; i < n; i++) {       cout << zp[i];     }     cout << endl;     int x;     cin >> x;     return x;   }   void get(int bg, int ed, int W) {     if ((zer != -1) and (one != -1)) {       return;     }     int cur = W;     int L = ed - bg;     int d = cur - allz;     if (d == -L) {       one = bg;       return;     }     if (d == L) {       zer = bg;       return;     }     int mid = (bg + ed) / 2;     for (int i = mid; i < ed; i++) {       zp[i] = 0;     }     int D = q();     get(bg, mid, D);     for (int i = mid; i < ed; i++) {       zp[i] = 1;     }     if ((zer != -1) and (one != -1)) {       return;     }     for (int i = bg; i < mid; i++) {       zp[i] = 0;     }     get(mid, ed, W - D + allz);     for (int i = bg; i < mid; i++) {       zp[i] = 1;     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cin >> n;     zp.resize(n);     zer = -1;     one = -1;     allz = q();     for (int i = 0; i < n; i++) {       zp[i] = 1;     }     get(0, n, n - allz);     cout <<  !   << zer + 1 <<     << one + 1 << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   #pragma warning(disable : 4996)   #pragma comment(linker,  /STACK:20000007 )   #pragma GCC optimize( unroll-loops )   const int N = (int)1e6 + 100;   const int maxn = (int)1e3 + 100;   const int base = (int)1e9;   const int mod = (int)1e9 + 7;   const int inf = INT_MAX;   const long long ll_inf = LLONG_MAX;   const long double PI = acos((long double)-1.0);   const long double eps = 1e-8;   int n, m, k;   char ch[1003][1003];   bool mark[1003][1003];   int d[1003][1003];   int x, y, x1, y2;   vector<int> dx = {1, 0, -1, 0};   vector<int> dy = {0, -1, 0, 1};   void bfs(int x, int y) {     d[x][y] = 1;     queue<pair<int, int> > Q;     Q.push(make_pair(x, y));     while (!Q.empty()) {       auto P = Q.front();       Q.pop();       int x, y;       tie(x, y) = P;       mark[x][y] = true;       if (x == x1 && y == y2) return;       for (int i = 0; i < 4; ++i) {         for (int j = 1; j <= k; ++j) {           int r = x, c = y;           r += dx[i] * j;           c += dy[i] * j;           if (r < 1 || c < 1 || c > m || r > n ||               (ch[r][c] ==  #  || (d[r][c] && d[r][c] <= d[x][y])))             break;           if (d[r][c] > d[x][y] + 1) {             d[r][c] = min(d[r][c], d[x][y] + 1);             Q.push({r, c});           } else if (!d[r][c]) {             d[r][c] = d[x][y] + 1;             Q.push({r, c});           }         }       }     }   }   void solve() {     cin >> n >> m >> k;     for (int i = 1; i <= n; ++i) {       for (int j = 1; j <= m; ++j) {         cin >> ch[i][j];       }     }     cin >> x >> y >> x1 >> y2;     bfs(x, y);     cout << --d[x1][y2] <<   n ;   }   int main() {     int T = 1;     for (; T; --T) solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<long long> res;   long long n, a, b;   void solve(long long x, long long y) {     long long i, k;     for (i = 1, k = 0; k < x; i += a, k++) {       for (long long j = i + 1; j < i + a; j++) res.push_back(j);       res.push_back(i);     }     for (k = 0; k < y; i += b, k++) {       for (long long j = i + 1; j < i + b; j++) res.push_back(j);       res.push_back(i);     }   }   int main() {     cout.sync_with_stdio(false);     cin.tie(NULL);     cin >> n >> a >> b;     for (long long i = 0; i <= n; i++)       if (a * i <= n and (n - a * i) % b == 0) {         solve(i, (n - a * i) / b);         for (long long val : res) cout << val <<    ;         cout << endl;         return 0;       }     cout << -1 << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int T;     cin >> T;     while (T-- > 0) {       int N;       cin >> N;       struct MM {         int min, max;       };       MM data[129];       for (int i = 0; i <= 128; ++i) {         if (i >= 63 && i < 63 + N)           data[i] = {i - 62, i - 62};         else           data[i] = {0, 0};       }       for (int i = 62; i >= 0; --i) {         MM& fi = data[2 * i + 1];         MM& se = data[2 * i + 2];         if (se.min == 0) {           data[i] = fi;         } else {           string res;           if (fi.min == fi.max && se.min == se.max) {             cout <<  ?   << fi.min <<     << se.min << endl;             cout.flush();             cin >> res;             if (res ==  < )               data[i] = {fi.min, se.max};             else               data[i] = {se.min, fi.max};           } else {             cout <<  ?   << fi.min <<     << se.min << endl;             cout.flush();             cin >> res;             if (res ==  < )               data[i].min = fi.min;             else               data[i].min = se.min;             cout <<  ?   << fi.max <<     << se.max << endl;             cout.flush();             cin >> res;             if (res ==  > )               data[i].max = fi.max;             else               data[i].max = se.max;           }         }       }       cout <<  !   << data[0].min <<     << data[0].max << endl;       cout.flush();     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, a, b;     scanf( %d , &n);     ;     if (n == 1) {       scanf( %d , &a);       scanf( %d , &b);       printf( %d %d n , a, b);       return 0;     }     multimap<int, int> l;     multimap<int, int>::iterator p, it;     set<int> s;     for (int i = 0; i < (n); i++) {       scanf( %d , &a);       ;       scanf( %d , &b);       ;       l.insert(make_pair(a, b));       l.insert(make_pair(b, a));       if (s.count(a))         s.erase(a);       else         s.insert(a);       if (s.count(b))         s.erase(b);       else         s.insert(b);     }     a = *s.begin();     b = *s.rbegin();     printf( %d  , a);     p = l.find(a);     while (true) {       printf( %d  , p->second);       it = l.find(p->second);       if (it->second == p->first) {         l.erase(it);         it = l.find(p->second);       }       p = it;       if (it->second == b) break;     }     printf( %d n , b);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int ToInt(string& s, int len) {     int r = 0;     for (int i = 0, max_ = (len); i < max_; ++i) {       r *= 10;       r += s[i] -  0 ;     }     return r;   }   int GCD(int a, int b) { return b != 0 ? GCD(b, a % b) : a; }   int LCM(int a, int b) { return a * (b / GCD(a, b)); }   long long Pow(long long n, long long e) {     if (e == 0) return 1;     if (e == 1)       return n;     else if (e & 1) {       long long t = Pow(n, e / 2);       return n * t * t;     } else {       long long t = Pow(n, e / 2);       return t * t;     }   }   pair<int, char> v[26];   bool toRem[26];   int main() {     string s;     getline(cin, s);     int K;     scanf( %d , &K);     for (int i = 0, max_ = (26); i < max_; ++i) v[i].second =  a  + i;     for (int i = 0, max_ = ((int)(s).size()); i < max_; ++i)       ++v[s[i] -  a ].first;     sort(v, v + 26);     int j = 0, rem = 26;     while (j < 26) {       if (K < v[j].first) break;       toRem[v[j].second -  a ] = true;       K -= v[j].first;       --rem;       ++j;     }     printf( %d n , rem);     for (int i = 0, max_ = ((int)(s).size()); i < max_; ++i)       if (!toRem[s[i] -  a ]) printf( %c , s[i]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long a = 0, b = 0, f = 0, t = 0, x[101010], s2 = 0, s3 = 0, i = 0, j = 0,             p = 0, k = 0;   string d1, d2, d3;   int main() {     cin >> a >> p;     for (b = 1; b <= a; b++) {       cin >> f;       if (f > p)         s2 += 2;       else         s2 += 1;     }     cout << s2;   }
#include <bits/stdc++.h>   using namespace std;      #define fr(i, a, b) for(int i = a; i < b; ++i)   #define rf(i, a, b) for(int i = a - 1; i >= b; --i)   #define len(v) size(v)   #define all(v) begin(v), end(v)   #define int long long   #define ff first   #define ss second   #define ii pair<int, int>   #define vi vector<int>   #define vv vector<vi>   #define pb push_back   #define ub upper_bound   #define lb lower_bound   #define ts to_string      template<typename A, typename B> A amax(A &a, B b) {a = max(a, b); return a;}   template<typename A, typename B> A amin(A &a, B b) {a = min(a, b); return a;}   template<typename A, typename B> string ts(pair<A, B> p);   string ts(const string& s) {return     + s +    ;}   string ts(const char* s) {return ts((string)s);}   template<typename A> string ts(A v) {       bool first = true;       string res =  { ;       for(const auto &x : v) {           if(!first) res +=  ,  ;           first = false, res += ts(x);       }       res +=  } ;       return res;   }   template<typename A, typename B> string ts(pair<A, B> p) {       return  (  + ts(p.ff) +  ,   + ts(p.ss) +  ) ;   }   void debug_out() {cerr <<   n ;}   template<typename H, typename... T> void debug_out(H h, T... t) {       cerr <<     << ts(h);       debug_out(t...);   }      #ifdef LOCAL   #define dbg(...) cerr <<  [  << #__VA_ARGS__ <<  ]: , debug_out(__VA_ARGS__)   #else   #define dbg(...)    #endif      const int INF = 0x3f3f3f3f3f3f3f3fll;   const int MOD = 1e9 + 7;    const int N   = 1e6 + 5;      void solve() {         int n;       cin >> n;       vector<pair<int, int>> a(n);       fr(i, 0, n) {           cin >> a[i].ff;           a[i].ss = i + 1;       }       sort(all(a));          int ans = 0;       fr(i, 0, n) {           int n1 = a[i].ff, i1 = a[i].ss;           fr(j, i + 1, n) {               int n2 = a[j].ff, j1 = a[j].ss;               if(n1 * n2 > 2 * n) break;               if(n1 * n2 == i1 + j1) {                   ans++;               }           }       }          cout << ans <<   n ;      }      int32_t main() {       ios_base::sync_with_stdio(false);        cin.tie(nullptr);          int t = 0;       if(!t) cin >> t;       while(t--) solve();   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int q;     cin >> q;     while (q--) {       long long x[3];       cin >> x[0] >> x[1] >> x[2];       sort(x, x + 3);       x[2] -= x[1] - x[0];       cout << x[1] + x[2] / 2 << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   int n, m, i, j, kol, tmp, flag[1000];   char s[1000][1000];   int main() {     cin >> n >> m;     for (i = 1; i <= n; i++) {       cin >> s[i];     }     for (j = 0; j < m; j++) {       tmp = 0;       for (i = 1; i <= n - 1; i++)         if ((s[i][j] > s[i + 1][j]) && (flag[i] == 0)) tmp = 1;       kol += tmp;       if (tmp == 0)         for (i = 1; i <= n - 1; i++)           if ((s[i][j] < s[i + 1][j]) && (flag[i] == 0)) flag[i] = 1;     }     cout << kol;   }
#include <bits/stdc++.h>   using namespace std;   int a[501][501], b[501][501], i, j, n, m, k;   int main() {     vector<int> vea;     vector<int> veb;     cin >> n >> m;     for (i = 1; i <= n; i++) {       for (j = 1; j <= m; j++) cin >> a[i][j];     }     for (i = 1; i <= n; i++) {       for (j = 1; j <= m; j++) cin >> b[i][j];     }     for (i = 1; i <= n; i++) {       j = 1;       k = i;       while (true) {         vea.push_back(a[k][j]);         veb.push_back(b[k][j]);         k--;         j++;         if (k == 0 || j == m + 1) break;       }       sort(vea.begin(), vea.end());       sort(veb.begin(), veb.end());       for (j = 0; j < vea.size(); j++) {         if (vea[j] != veb[j]) {           cout <<  NO ;           return 0;         }       }       while (!vea.empty()) vea.pop_back();       while (!veb.empty()) veb.pop_back();     }     for (i = 1; i <= n; i++) {       j = m;       k = i;       while (true) {         vea.push_back(a[k][j]);         veb.push_back(b[k][j]);         k++;         j--;         if (k == n + 1 || j == 0) break;       }       sort(vea.begin(), vea.end());       sort(veb.begin(), veb.end());       for (j = 0; j < vea.size(); j++) {         if (vea[j] != veb[j]) {           cout <<  NO ;           return 0;         }       }       while (!vea.empty()) vea.pop_back();       while (!veb.empty()) veb.pop_back();     }     for (j = 1; j <= m; j++) {       i = 1;       k = j;       while (true) {         vea.push_back(a[i][k]);         veb.push_back(b[i][k]);         k--;         i++;         if (k == 0 || i == n + 1) break;       }       sort(vea.begin(), vea.end());       sort(veb.begin(), veb.end());       for (i = 0; i < vea.size(); i++) {         if (vea[i] != veb[i]) {           cout <<  NO ;           return 0;         }       }       while (!vea.empty()) vea.pop_back();       while (!veb.empty()) veb.pop_back();     }     for (j = m; j >= 1; j--) {       i = n;       k = j;       while (true) {         vea.push_back(a[i][k]);         veb.push_back(b[i][k]);         k++;         i--;         if (k == m + 1 || i == 0) break;       }       sort(vea.begin(), vea.end());       sort(veb.begin(), veb.end());       for (i = 0; i < vea.size(); i++) {         if (vea[i] != veb[i]) {           cout <<  NO ;           return 0;         }       }       while (!vea.empty()) vea.pop_back();       while (!veb.empty()) veb.pop_back();     }     cout <<  YES ;   }
#include <bits/stdc++.h>   using namespace std;   struct sz {     long long f[2][2];   } a, b, c, z;   long long p, x, y, ans, dt;   int n, f[1000007];   sz chen(sz a, sz b) {     sz c;     c.f[0][0] = c.f[0][1] = c.f[1][0] = c.f[1][1] = 0;     for (int k = 0; k <= 1; k++)       for (int i = 0; i <= 1; i++)         for (int j = 0; j <= 1; j++)           c.f[i][j] = (c.f[i][j] + a.f[i][k] * b.f[k][j]) % p;     return c;   }   sz mi(sz a, long long x) {     if (x == 0) return z;     if (x == 1) return a;     sz b = mi(a, x >> 1);     b = chen(b, b);     if (x & 1) b = chen(b, a);     return b;   }   int main() {     z.f[0][0] = z.f[1][1] = 1;     z.f[0][1] = z.f[1][0] = 0;     cin >> n >> x >> y >> p;     for (int i = 1; i <= n; i++) scanf( %d , &f[i]);     if (n == 1) {       cout << ((f[1] % p) + p) % p;       return 0;     }     a.f[0][0] = a.f[0][1] = 1;     a.f[1][1] = 3;     if (x == 0) {       for (int i = 1; i <= n; i++) ans = (ans + f[i]) % p;       dt = f[1] + f[n];     } else {       b = mi(a, x);       for (int i = 1; i <= n; i++)         if (i == 1 || i == n)           ans = (ans + (b.f[0][1] * 1 + 1) * f[i]) % p;         else           ans = (ans + (b.f[0][1] * 2 + 1) * f[i]) % p;       c.f[0][0] = c.f[0][1] = c.f[1][0] = 1;       c.f[1][1] = 0;       b = mi(c, x);       dt = 0;       dt = (f[1] + f[n] * b.f[0][0] + f[n - 1] * b.f[0][1]) % p;     }     if (y != 0) {       b = mi(a, y);       ans = (ans * (b.f[0][1] * 2 + 1) - dt * b.f[0][1]) % p;     }     ans = (ans + p) % p;     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int n, i;     cin >> n;     long long int a[n];     for (i = 0; i < n; i = i + 1) {       cin >> a[i];     }     long long int mn = a[n - 1];     long long int m[n];     for (i = n - 1; i >= 0; i--) {       mn = min(mn, a[i]);       m[i] = mn;     }     for (i = 0; i < n; i = i + 1) {       long long int low = i;       long long int high = n - 1;       long long int res = i;       while (low <= high) {         long long int mid = (low + high) / 2;         if (m[mid] >= a[i]) {           high = mid - 1;         } else if (m[mid] < a[i]) {           low = mid + 1;           res = max(res, mid);         }       }       cout << res - i - 1 <<    ;     }     cout << endl;   }
#include <bits/stdc++.h>   using namespace std;   long long n;   bool use[100000 + 10], b[100000 + 10];   int a[100000 + 10], Now;   int Ans;   int L[100000 + 10], R[100000 + 10], CNT = 0;   int main() {     int Cnt = 0;     scanf( %I64d , &n);     for (long long i = 3; i <= n; i += 2) {       if (b[i]) continue;       Now = 1;       a[1] = i;       for (long long j = 2 * i; j <= n; j += i) {         b[j] = false;         if (use[j]) continue;         a[++Now] = j;       }       if (Now == 1) continue;       if (Now % 2 == 0) {         for (int i = 1; i + 1 <= Now; i += 2) {           Ans++;           L[Ans] = a[i];           use[a[i]] = true;           R[Ans] = a[i + 1];           use[a[i + 1]] = true;         }       } else {         Ans++;         L[Ans] = a[1];         use[a[1]] = true;         R[Ans] = a[3];         use[a[3]] = true;         for (int i = 4; i + 1 <= Now; i += 2) {           Ans++;           L[Ans] = a[i];           use[a[i]] = true;           R[Ans] = a[i + 1];           use[a[i + 1]] = true;         }       }     }     Now = 0;     for (long long j = 2; j <= n; j += 2) {       b[j] = false;       if (use[j]) continue;       a[++Now] = j;     }     if (Now % 2 == 0) {       for (int i = 1; i + 1 <= Now; i += 2) {         Ans++;         L[Ans] = a[i];         use[a[i]] = true;         R[Ans] = a[i + 1];         use[a[i + 1]] = true;       }     } else {       if (Now != 1) {         Ans++;         L[Ans] = a[1];         use[a[1]] = true;         R[Ans] = a[3];         use[a[3]] = true;         for (int i = 4; i + 1 <= Now; i += 2) {           Ans++;           L[Ans] = a[i];           use[a[i]] = true;           R[Ans] = a[i + 1];           use[a[i + 1]] = true;         }       }     }     printf( %d n , Ans);     for (int i = 1; i <= Ans; i++) printf( %d %d n , L[i], R[i]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long n;     cin >> n;     long long a[n];     for (int i = 0; i < n; ++i) {       a[i] = i + 1;     }     long long ans = 0;     long long i = 1, j = 1, k = 2;     for (int q = 0; q < n - 2; ++q) {       ans += i * a[j] * a[k];       j = (j + 1) % (n);       k = (k + 1) % (n);     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1005;   int n, q, len[N];   char name[N][20], ip[N][20];   bool dy(char ip1[], char ip2[], int len) {     for (int i = 0; i < len; i++)       if (ip1[i] != ip2[i]) return 0;     return 1;   }   int main() {     scanf( %d%d , &n, &q);     for (int i = 1; i <= n; i++)       scanf( %s%s , name[i], ip[i]), len[i] = strlen(ip[i]);     while (q--) {       char na[20], IP[20];       scanf( %s%s , na, IP);       int L = strlen(IP) - 1;       IP[L] =   0 ;       for (int i = 1; i <= n; i++)         if (len[i] == L && dy(IP, ip[i], L)) {           printf( %s %s; #%s n , na, IP, name[i]);           break;         }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     vector<int> arr{2,  3,  5,  7,  11, 13, 17, 19, 23, 29,                     31, 37, 41, 43, 47, 4,  9,  25, 49};     int i = 0, k = 0;     int l = arr.size();     while (i < l) {       string s;       cout << arr[i] << endl;       cin >> s;       if (s ==  yes ) k++;       if (k == 2) {         cout <<  composite  << endl;         break;       }       i++;     }     if (k < 2) {       cout <<  prime  << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, A[100001], Ans[100001];   bool k[100001];   int solve(int x) {     if (Ans[x]) return Ans[x];     int tmp = 0, cnt = 0, pre = 1;     for (int i = 1; i <= n; i++) {       if (!k[A[i]]) {         if (cnt == x) {           tmp++;           cnt = 1;           for (int j = pre; j < i; j++) {             k[A[j]] = 0;           }           pre = i;           k[A[i]] = 1;         } else {           cnt++;           k[A[i]] = 1;         }       }     }     if (cnt) {       tmp++;       for (int i = pre; i <= n; i++) k[A[i]] = 0;     }     return Ans[x] = tmp;   }   void work(int x, int y) {     int l = solve(x), r = solve(y);     if (l == r) {       for (int i = x; i <= y; i++) {         Ans[i] = l;       }       return;     }     int mid = (x + y) / 2;     work(x, mid);     work(mid + 1, y);   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) scanf( %d , &A[i]);     work(1, n);     for (int i = 1; i <= n; i++) printf( %d  , Ans[i]);   }
#include <bits/stdc++.h>   int atob(int t, int a, int b) {     int ret = 0, p = 1;     while (t) {       ret += t % b * p;       p *= a;       t /= b;     }     return ret;   }   int maxbit(int t) {     int ret = t % 10;     while (t) {       if (ret < t % 10) ret = t % 10;       t /= 10;     }     return ret;   }   int len(int t) {     int cnt = 0;     while (t) {       cnt++;       t /= 10;     }     return cnt;   }   int main() {     int a, b, base, res = 0;     scanf( %d%d , &a, &b);     base = maxbit(a) + 1;     if (base < maxbit(b) + 1) base = maxbit(b) + 1;     for (; base <= 10; ++base) {       int ta = atob(a, base, 10), tb = atob(b, base, 10),           t = atob(ta + tb, 10, base);       if (res < len(t)) res = len(t);     }     printf( %d , res);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long oo = 1e9;   const int maxSize = 1001000;   const int mod = 1e9 + 7;   const double EPS = (1e-9);   int dcmp(double x, double y) { return fabs(x - y) <= EPS ? 0 : x < y ? -1 : 1; }   int main() {     int one = 0, remain1 = 0, two = 0, a, b;     int n, res = 0;     scanf( %d%d%d , &n, &a, &b);     for (int i = 0; i < n; i++) {       int num;       scanf( %d , &num);       if (num == 1) {         if (a)           a--;         else if (remain1 < 2 * b)           remain1++;         else           res++;       } else {         if (b - remain1 > 0)           b--;         else           res += 2;       }     }     cout << res;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e3 + 7;   int n;   int a[N], b[N], x[N], y[N];   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %d%d , &a[i], &b[i]);     }     for (int i = 1; i <= n; i++) {       scanf( %d%d , &x[i], &y[i]);     }     sort(a + 1, a + 1 + n);     sort(b + 1, b + 1 + n);     sort(x + 1, x + 1 + n);     sort(y + 1, y + 1 + n);     cout << a[1] + x[n] <<     << b[1] + y[n] << endl;     return 0;   }