malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1010;   const int base = 31337;   const int mod = 1e9 + 7;   const int inf = 0x3f3f3f3f;   const int logo = 20;   const int off = 1 << logo;   const int treesiz = off << 1;   int n, m, k;   vector<int> graph[maxn];   int a[maxn], ss[maxn], cs[maxn];   bool bio[maxn];   int cnt = 0;   int dfs(int x) {     bio[x] = true;     cnt += graph[x].size();     int out = 1;     for (int i = 0; i < graph[x].size(); i++) {       int tren = graph[x][i];       if (!bio[tren]) out += dfs(tren);     }     return out;   }   int main() {     scanf( %d%d%d , &n, &m, &k);     for (int i = 0; i < k; i++) scanf( %d , a + i);     for (int i = 0; i < m; i++) {       int a, b;       scanf( %d%d , &a, &b);       graph[a].push_back(b);       graph[b].push_back(a);     }     memset(bio, false, sizeof bio);     int maxi = 0;     for (int i = 0; i < k; i++) {       ss[i] = dfs(a[i]);       maxi = max(maxi, ss[i]);       cs[i] = cnt / 2, cnt = 0;     }     int ax = 0;     for (int i = 1; i <= n; i++) {       if (!bio[i]) ax += dfs(i);     }     long long tren = 0;     long long sol = 0;     for (int i = 0; i < k; i++) {       tren += ss[i] * (ss[i] - 1) / 2 - cs[i];     }     cnt /= 2;     for (int i = 0; i < k; i++) {       int pt = a[i];       int ts = ss[i] + ax;       sol = max(sol, tren - (ss[i] * (ss[i] - 1) / 2 - cs[i]) +                          (ts * (ts - 1) / 2 - cnt - cs[i]));     }     printf( %lld n , sol);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 1e9 + 7;   const int MAXN = 1e6 + 7;   const double EPS = 1e-6;   const int M = 15;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     srand(time(0));     vector<vector<int> > dp(M + 1);     vector<vector<pair<int, int> > > nxt(M + 1);     for (int m = 0; m <= M; m++) {       int N = (1 << m);       dp[m].resize(N, INF);       nxt[m].resize(N);       queue<int> q;       if (m < M) {         q.push(0);         dp[m][0] = 0;       } else {         for (int i = 0; i < 8; i++) {           q.push(i << 12);           dp[M][i << 12] = 0;         }       }       while (!q.empty()) {         int mask = q.front();         q.pop();         for (int a = 0; a < m; a++) {           for (int k = 1; k < m; k++) {             int b = a + k, c = a + 2 * k;             if (c >= m) break;             int mask1 = mask;             mask1 ^= (1 << a);             mask1 ^= (1 << b);             mask1 ^= (1 << c);             if (dp[m][mask1] != INF) continue;             dp[m][mask1] = dp[m][mask] + 1;             nxt[m][mask1] = {a, k};             q.push(mask1);           }         }       }     }     int n;     cin >> n;     vector<int> all(n);     for (int i = 0; i < n; i++) {       cin >> all[i];     }     if (n < 15) {       int mask = 0;       for (int i = n - 1; i >= 0; i--) {         mask = mask * 2 + all[i];       }       if (dp[n][mask] == INF) {         cout <<  NO n ;         return 0;       }       cout <<  YES n ;       cout << dp[n][mask] <<   n ;       while (mask) {         int a = nxt[n][mask].first, k = nxt[n][mask].second;         mask ^= (1 << a);         mask ^= (1 << (a + k));         mask ^= (1 << (a + 2 * k));         cout << a + 1 <<     << a + 1 + k <<     << a + 1 + 2 * k <<   n ;       }       return 0;     }     cout <<  YES n ;     vector<pair<int, int> > res;     for (int i = 0, sz = M, fl = false; !fl; i += 12) {       if (i >= n - 14) {         sz = 14;         i = n - 14;         fl = true;       }       int mask = 0;       for (int j = sz - 1; j >= 0; j--) {         mask = mask * 2 + all[i + j];       }       assert(dp[sz][mask] != INF);       while (dp[sz][mask]) {         int a = nxt[sz][mask].first, k = nxt[sz][mask].second;         int b = a + k, c = a + 2 * k;         all[i + a] ^= 1;         all[i + b] ^= 1;         all[i + c] ^= 1;         mask ^= (1 << a);         mask ^= (1 << b);         mask ^= (1 << c);         res.push_back({i + a, k});       }     }     for (int i = 0; i < n; i++) {       assert(!all[i]);     }     cout << res.size() <<   n ;     for (auto p : res) {       int a = p.first, k = p.second;       cout << a + 1 <<     << a + k + 1 <<     << a + 2 * k + 1 <<   n ;     }   }
# include <algorithm>   # include <iostream>   # include <numeric>   # include <vector>   # include <set>      using namespace std;      int main() {     int n, a, b;     while (cin >> n >> a >> b) {       string s;       cin >> s;       set<char> chars_set;       for (char c : s) {         chars_set.insert(c);       }       vector<char> chars(chars_set.begin(), chars_set.end());       int cc = (int)chars.size();       vector<int> L(cc, n + 1);       vector<int> R(cc, -1);       vector<int> cnt(cc, 0);       for (int i = 0; i < n; i++) {         for (int j = 0; j < cc; j++) {           if (s[i] == chars[j]) {             L[j] = min(L[j], i);             R[j] = max(R[j], i);             cnt[j] += 1;           }         }       }       vector<int> order(cc);       iota(order.begin(), order.end(), 0);       sort(order.begin(), order.end(), [&](int i, int j) {         return L[i] < L[j];       });       vector<int> order2 = order;       sort(order2.begin(), order2.end(), [&](int i, int j) {         return R[i] < R[j];       });       vector<int> order3 = order;       sort(order3.begin(), order3.end(), [&](int i, int j) {         return (L[i] + R[i]) / 2 < (L[j] + R[j]) / 2;       });       vector<int> order4 = order;       sort(order4.begin(), order4.end(), [&](int i, int j) {         return cnt[i] < cnt[j];       });       vector<bool> can(1 << cc, 0);       can[0] = 1;       for (int t = 1; t < (1 << cc); t++) {         int max_R = -1;         int min_L = -1;         int total = 0;         for (int i : order) {           if (!(t & (1 << i))) {             continue;           }           if (min_L == -1) {             min_L = L[i];           }           total += cnt[i];           max_R = max(max_R, R[i]);         }         int len = max_R - min_L + 1;         if (total * b >= a * len) {           can[t] = 0;           for (int i = 0; i < cc; i++) {             if (t & (1 << i)) {               if (can[t ^ (1 << i)]) {                 can[t] = 1;                 break;               }             }           }           if (can[t]) {             continue;           }         }         int nt = 0;         for (auto& v : {order, order2, order3, order4}) {           for (int i : v) {             if (!(t & (1 << i))) {               continue;             }             nt |= (1 << i);             if (nt != t && can[nt] && can[t ^ nt]) {               can[t] = 1;               break;             }           }         }       }       string ret =   ;       for (int i = 0; i < cc; i++) {         if (can[(1 << cc) - 1 - (1 << i)]) {           ret += chars[i];         }       }       cout << ret.size();       for (char c : ret) {         cout <<     << c;       }       cout <<   n ;     }     return 0;   } //
#include <bits/stdc++.h>   const int maxn = 10010;   const int mod = 1000000007;   int n;   char ch[4][maxn];   int f[maxn][8][2];   int obs[maxn];   int ot, vt;   void part0() {     memset(obs, 0, sizeof(obs));     for (int j = 1; j <= n; j++)       for (int i = 3; i >= 1; i--)         obs[j] = (obs[j] << 1) + ((ch[i][j] !=  . ) ? 1 : 0);     for (int i = 1; i <= 3; i++)       for (int j = 1; j <= n; j++)         if (ch[i][j] ==  O ) {           ot = j;           vt = 1 << (i - 1);         }   }   void init() {     scanf( %d , &n);     for (int i = 1; i <= 3; i++) scanf( %s , ch[i] + 1);   }   void solve() {     part0();     memset(f, 0, sizeof(f));     f[0][7][0] = 1;     for (int i = 1; i <= n; i++)       for (int j = 0; j < 8; j++)         for (int k = 0; k < 2; k++) {           if (!f[i - 1][j][k]) continue;           int cnt = j ^ 7;           if (cnt & obs[i]) continue;           int oc = cnt | obs[i];           for (int c = 0; c <= 6; c += 3) {             if (oc & c) continue;             int oct = oc | c;             if ((i == ot - 1) && (cnt & vt) ||                 (i == ot) && (!(oc ^ vt)) && (vt != 2) ||                 (i - 2 == ot) && (cnt & vt)) {               f[i][oct][1] = (f[i][oct][1] + f[i - 1][j][k]) % mod;             } else               f[i][oct][k] = (f[i][oct][k] + f[i - 1][j][k]) % mod;           }         }   }   void print() { printf( %d n , f[n][7][1]); }   int main() {     init();     solve();     print();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int bs(int arr[], int n, int target) {     int left = 0, mid, right = n - 1;     while (left <= right) {       mid = left + (right - left) / 2;       if (arr[mid] < target)         left = mid + 1;       else         right = mid - 1;     }     return left + 1;   }   int main() {     int n, m;     cin >> n >> m;     int songs[n];     int c, t, sum = 0;     for (int i = 0; i < n; i++) {       cin >> c >> t;       sum += (c * t);       songs[i] = sum;     }     int query;     while (m--) {       cin >> query;       cout << bs(songs, n, query) <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long mod = 1000000007;   const int N = 5e5;   int main() {     long long n, a, b, c, t;     cin >> n >> a >> b >> c >> t;     long long arr[n + 1];     for (long long i = 1; i <= n; i++) {       cin >> arr[i];     }     long long s = n * a;     if (b >= c) {       cout << s << endl;     } else {       long long q = 1;       long long s2 = 0;       long long q2 = 1;       long long s3 = 0;       for (long long i = 1; i <= n; i++) {         if (arr[i] != t) {           s2 += (t - arr[i]) * c;           q++;         }       }       for (long long i = 1; i <= n; i++) {         arr[i] = a - (t - arr[i]) * b;       }       for (long long i = 1; i <= n; i++) {         s3 += arr[i];       }       cout << s2 + s3;     }   }
#include <bits/stdc++.h>   using namespace std;   const int inf = 1e9;   int main() {     int n, d, h;     cin >> n >> d >> h;     if (h * 2 < d || h > n || d > n || h > d || n < d + 1 ||         (h == 1 && d == 1 && (n != 2)))       cout << -1;     else {       if (h == 1) {         for (int i = 2; i <= n; i++) cout << 1 <<     << i << endl;         return 0;       }       for (int i = 1; i <= h; i++) cout << i <<     << i + 1 << endl;       for (int i = 1; i <= d - h; i++)         cout << ((i == 1) ? 1 : i + h) <<     << i + h + 1 << endl;       for (int i = 0; i < n - d - 1; i++) cout << 2 <<     << n - i << endl;     }     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize( Ofast )   #pragma GCC optimize( unroll-loops )   #pragma GCC target( sse2 )   using namespace std;   template <typename Arg1>   void __f(const char* name, Arg1&& arg1) {     std::cerr << name <<   :   << arg1 <<   n ;   }   template <typename Arg1, typename... Args>   void __f(const char* names, Arg1&& arg1, Args&&... args) {     const char* comma = strchr(names + 1,  , );     std::cerr.write(names, comma - names) <<   :   << arg1 <<   |  ;     __f(comma + 1, args...);   }   long long max(long long a, long long b) { return (a > b) ? a : b; }   long long min(long long a, long long b) { return (a < b) ? a : b; }   void amax(long long& a, long long b) { a = max(a, b) % 1000000007; }   void amin(long long& a, long long b) { a = min(a, b) % 1000000007; }   void inc(long long& a, long long b) { a = (a + b) % 1000000007; }   void dec(long long& a, long long b) { a = (a - b + 1000000007) % 1000000007; }   long long solve() {     long long n, p;     cin >> n >> p;     vector<long long> in(n + 10, 1e9), out(n + 10, 0);     for (long long i = 0; i < p; i++) {       long long x;       cin >> x;       amin(in[x], i + 1);       amax(out[x], i + 1);     }     long long ans = 0;     for (long long i = 1; i < n + 1; i++) {       if (out[i] == 0) {         ans++;       }       long long cur = out[i];       if (in[i] > out[i + 1] && i + 1 <= n) ans++;       if (in[i] > out[i - 1] && i > 1) ans++;     }     cout << ans;     return 0;   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long t = 1;     while (t--) {       solve();     }   }
#include <bits/stdc++.h>   using namespace std;   int n, arr[206];   char str[206];   inline bool check1() {     for (int i = 0; i < (n >> 1); ++i) {       if (arr[i] >= arr[i + (n >> 1)]) return 0;     }     return 1;   }   inline bool check2() {     for (int i = 0; i < (n >> 1); ++i) {       if (arr[i] <= arr[i + (n >> 1)]) return 0;     }     return 1;   }   int main() {     scanf( %d , &n);     scanf( %s , str);     n = strlen(str);     for (int i = 0; i < n; ++i) arr[i] = (int)(str[i] -  0 );     sort(arr, arr + (n / 2));     sort(arr + (n / 2), arr + n);     puts((check1() || check2()) ?  YES  :  NO );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int n, k;   void inp() {     cin >> n >> k;     return;   }   void solve() {     set<long long int> second;     for (long long int i = 1; i <= k; i++)       if (second.count(n % i))         return void(cout <<  No n );       else         second.insert(n % i);     cout <<  Yes n ;     return;   }   int main() {     clock_t beg = clock();     {       cin.tie(0);       ios_base::sync_with_stdio(false);     };     inp();     solve();     clock_t end = clock();     fprintf(stderr,  %.3f sec n , (double)(end - beg) / CLOCKS_PER_SEC);     return 0;   }
#include <bits/stdc++.h>   const int MAXN = 5;   const double eps = 1e-4;   struct node {     double x, y;     node(double x = 0, double y = 0) : x(x), y(y) {}     inline bool operator<(const node &rhs) const {       if (fabs(x - rhs.x) >= eps) return x < rhs.x;       if (fabs(y - rhs.y) >= eps) return y < rhs.y;       return 0;     }     inline bool operator==(const node &rhs) const {       return !(*this < rhs) && !(rhs < *this);     }   } p[MAXN * MAXN << 1];   struct circle {     double a, b, r;     circle(double a = 0, double b = 0, double r = 0) : a(a), b(b), r(r) {}   } c[MAXN];   std::vector<node> ans;   inline void getcircle_intersection(circle x, circle y) {     if (x.r < y.r) std::swap(x, y);     if (fabs((x.r + y.r) * (x.r + y.r) - (x.a - y.a) * (x.a - y.a) -              (x.b - y.b) * (x.b - y.b)) < eps) {       const double dx = (y.a - x.a), dy = (y.b - x.b), k = x.r / (x.r + y.r);       ans.push_back(node(x.a + dx * k, x.b + dy * k));       return;     }     if (fabs(y.r + sqrt((x.a - y.a) * (x.a - y.a) + (x.b - y.b) * (x.b - y.b)) -              x.r) < eps) {       const double dx = (y.a - x.a), dy = (y.b - x.b), k = x.r / (x.r - y.r);       ans.push_back(node(x.a + dx * k, x.b + dy * k));       return;     }     if ((x.r + y.r) * (x.r + y.r) <         (x.a - y.a) * (x.a - y.a) + (x.b - y.b) * (x.b - y.b))       return;     if (y.r + sqrt((x.a - y.a) * (x.a - y.a) + (x.b - y.b) * (x.b - y.b)) < x.r)       return;     const double lk = (x.a - y.a) / (y.b - x.b),                  lb = (x.r * x.r - y.r * y.r + y.a * y.a - x.a * x.a + y.b * y.b -                        x.b * x.b) /                       (2 * y.b - 2 * x.b);     const double fa = lk * lk + 1, fb = 2 * lk * lb - 2 * x.a - 2 * x.b * lk,                  fc = x.a * x.a + x.b * x.b + lb * lb - 2 * x.b * lb - x.r * x.r;     double dt = fb * fb - 4 * fa * fc;     if (fabs(dt) > eps && dt < 0) return;     dt = fabs(dt);     const double ax1 = (-fb + sqrt(dt)) / (2 * fa),                  ax2 = (-fb - sqrt(dt)) / (2 * fa);     ans.push_back(node(ax1, lk * ax1 + lb));     ans.push_back(node(ax2, lk * ax2 + lb));   }   inline bool point_on_circle(const node &x, const circle &y) {     return fabs((x.x - y.a) * (x.x - y.a) + (x.y - y.b) * (x.y - y.b) -                 y.r * y.r) <= eps;   }   int main() {     int n;     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       double a, b, r;       scanf( %lf%lf%lf , &a, &b, &r);       c[i].a = a * cos(233) + b * sin(233);       c[i].b = -a * sin(233) + b * cos(233);       c[i].r = r;     }     for (int i = 1; i <= n; i++)       for (int j = i + 1; j <= n; j++) getcircle_intersection(c[i], c[j]);     std::sort(ans.begin(), ans.end());     int sz = std::unique(ans.begin(), ans.end()) - ans.begin();     int tot = 0;     for (int i = 1; i <= n; i++) {       int ptot = 0;       for (unsigned j = 0; j < sz; j++) ptot += point_on_circle(ans[j], c[i]);       tot += ptot + !ptot;     }     if (sz == 0) tot--;     printf( %d n , tot - sz + 2);     return 0;   }
#include <bits/stdc++.h>   const int maxn = 2e5 + 5;   using namespace std;   int a[maxn * 2];   int main() {     int n;     cin >> n;     int flag = 0;     for (int t = 0; t < n; t++) {       scanf( %d , &a[t]);       if (a[t] == 1) {         flag = 1;       }     }     for (int t = n; t < 2 * n; t++) {       a[t] = a[t - n];     }     int s = 1;     int maxnn = -1;     for (int t = 1; t < 2 * n; t++) {       if (a[t] == a[t - 1] && a[t] == 1) {         s++;       } else {         s = 1;       }       if (s > maxnn) {         maxnn = s;       }     }     if (maxnn > n) {       maxnn = n;     }     if (flag == 1)       cout << maxnn << endl;     else {       cout <<  0  << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<int> computer(100, 0);   int n, q, free_computers;   long s;   int t, k, d;   void question() {     cin >> t >> k >> d;     free_computers = 0;     for (int j = 0; j < n && free_computers < k; j++) {       if (computer[j] <= t) free_computers++;     }     if (k > free_computers)       cout << -1 <<   n ;     else {       s = 0;       for (int j = 0; j < n && k != 0; j++) {         if (computer[j] <= t) {           k--;           computer[j] = d + t;           s += j + 1;         }       }       cout << s <<   n ;     }   }   int main() {     cin >> n >> q;     for (int i = 0; i < q; i++) question();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int Int() {     int x;     cin >> x;     return x;   }   double din() {     double x;     cin >> x;     return x;   }   string Str() {     string x;     getline(cin, x);     return x;   }   char Ch() {     char x;     cin >> x;     return x;   }   int main() {     int h1 = Int();     char ch = Ch();     int m1 = Int();     int h2 = Int();     ch = Ch();     int m2 = Int();     int x = (((h2 * 60) + m2) - ((h1 * 60) + m1)) / 2;     int y = ((h1 * 60) + m1) + x;     int z;     h1 = y / 60;     m1 = y % 60;     cout << setfill( 0 ) << setw(2) << h1 <<  :  << setfill( 0 ) << setw(2) << m1          << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int a[200008], sign[200008];   int b[200008];   int main() {     int n;     scanf( %d , &n);     int t;     memset(a, 0, sizeof(a));     memset(sign, 0, sizeof(sign));     for (int i = 0; i < n; i++) {       scanf( %d , &t);       int k = t;       int time = 0;       b[i] = t;       while (k) {         a[k] += time;         sign[k]++;         if (k & 1 && k > 1) {           int kk = k / 2 * 2, tim = time + 2;           while (kk < 200008) {             a[kk] += tim;             sign[kk]++;             kk <<= 1;             tim++;           }         }         k >>= 1;         time++;       }       k = t, time = 0;       while (k < 200008) {         a[k] += time;         sign[k]++;         k <<= 1;         time++;       }       sign[t]--;     }     int res = 0x3f3f3f3f;     for (int i = 1; i < 200008; i++) {       if (sign[i] == n) {         res = min(res, a[i]);       }     }     printf( %d n , res);   }
#include <bits/stdc++.h>   using namespace std;   template <typename Arg1>   void __f(const char* name, Arg1&& arg1) {     cerr << name <<   :   << arg1 <<   n ;   }   template <typename Arg1, typename... Args>   void __f(const char* names, Arg1&& arg1, Args&&... args) {     const char* comma = strchr(names + 1,  , );     cout.write(names, comma - names) <<   :   << arg1 <<   |  ;     __f(comma + 1, args...);   }   long long pows(long long b, long long e) {     if (e == 0)       return 1;     else if (e % 2 == 0) {       long long a = pow(b, e / 2);       return a * a;     } else {       long long a = pow(b, e / 2);       return b * a * a;     }   }   long long powm(long long x, long long y, long long m) {     x = x % m;     long long res = 1;     while (y) {       if (y & 1) res = res * x;       res %= m;       y = y >> 1;       x = x * x;       x %= m;     }     return res;   }   long long modInverse(long long a, long long m = 1000000007) {     if (m == 1) return 0;     long long m0 = m, y = 0, x = 1;     while (a > 1) {       long long q = a / m, t = m;       m = a % m, a = t;       t = y;       y = x - q * y;       x = t;     }     if (x < 0) x += m0;     return x;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long n, m, i, j, k, x, y, z, e, f, p, q, g, l, r, w, h,         count1 = 0, prod = 1, a, b, c, d, index, x1, x2, diff, ans = 0, sum = 0,         sum1 = 0, sum2 = 0, flag = 0, flag1 = 0, flag2 = 0;     string s, s1, s2;     cin >> n;     if (n == 1) {       cout <<  1 ;       return 0;     } else {       ans = 1;       k = 3;       for (i = 2; i <= n; i++) {         ans += k * 4;         k += 3;       }       cout << ans;     }   }
#include <bits/stdc++.h>   using namespace std;   long long gcd(long long a, long long b) {     if (b == 0) return a;     return gcd(b, a % b);   }   template <typename A, size_t N, typename T>   void Fill(A (&array)[N], const T &val) {     std::fill((T *)array, (T *)(array + N), val);   }   class Graph {    public:     int vn;     int sumcost = 0;     vector<vector<pair<int, int>>> g;     Graph(int n) {       vn = n;       g.resize(n);     }     virtual void con(int a, int b, int w) = 0;     int getWeight(int f, int t) {       auto itr = lower_bound((g[f]).begin(), (g[f]).end(), make_pair(t, INT_MIN));       if (itr != g[f].end()) return itr->second;       return INT_MIN;     }     int Costsum() { return sumcost; }     void scan(int edcount, bool oindexed, bool w) {       for (int i = (0); (edcount) > i; i++) {         int a, b, c = 1;         scanf( %d %d , &a, &b);         if (w) scanf( %d , &c);         con(a - oindexed, b - oindexed, c);       }     }   };   class BiDGraph : public Graph {    public:     BiDGraph(int n) : Graph(n) {}     void con(int a, int b, int w = 1) {       g[a].push_back({b, w});       g[b].push_back({a, w});       sumcost++;     }   };   class DGraph : public Graph {    public:     DGraph(int n) : Graph(n) {}     void con(int a, int b, int w = 1) {       g[a].push_back({b, w});       sumcost++;     }   };   signed main() {     int n;     scanf( %d , &n);     printf( %d n , (n - 1) / 2);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     vector<int> arr;     int n, a;     cin >> n;     for (int i = 0; i < n; i++) {       cin >> a;       arr.push_back(a);     }     sort(arr.begin(), arr.end());     cout << arr[n - 1] << endl;     arr.clear();     return 0;   }
#include <bits/stdc++.h>   int len, p;   char s[111111], buf[111111];   void add(char ch) { buf[len++] = ch; }   void out() {     printf( < );     for (int i = 0; i < len; i++) printf( %c , buf[i]);     printf( > n );     len = 0;   }   int main() {     gets(s);     len = p = 0;     for (p = 0; s[p]; p++) {       if (s[p] ==    ) {         p++;         while (s[p] !=    ) {           add(s[p]);           p++;         }         out();       } else if (s[p] ==    ) {         if (len) out();       } else         add(s[p]);     }     if (len) out();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string s1, s2, s3, s4;     long long int n;     cin >> s1 >> s2;     cin >> n;     for (long long int i = 0; i < n; i++) {       cout << s1 <<     << s2 << endl;       cin >> s3 >> s4;       if (s1.compare(s3) == 0) {         s1 = s4;       } else {         s2 = s4;       }     }     cout << s1 <<     << s2 << endl;     return 0;   }