malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   const long long INF = (long long)1e9 + 9;   const long long maxn = (long long)1e9 + 6;   using namespace std;   signed main() {     long long t;     cin >> t;     while (t--) {       long long n, cnt = 0;       cin >> n;       map<string, long long> mp;       vector<string> s(n), answer(n);       for (long long i = 0; i < n; i++) {         cin >> s[i];         mp[s[i]]++;       }       for (long long i = 0; i < n; i++) {         if (mp[s[i]] == 1) {           answer[i] = s[i];           mp[s[i]] = true;         } else {           string temp = s[i];           mp[temp]--;           cnt++;           for (long long where = 0; where < 4; where++) {             for (char ch =  0 ; ch <=  9 ; ch++) {               temp[where] = ch;               if (not mp.count(temp)) {                 answer[i] = temp;                 mp[temp]++;                 where = 4;                 break;               }             }           }         }       }       cout << cnt << endl;       for (long long i = 0; i < n; i++) {         cout << answer[i] << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int gcd(long long int a, long long int b) {     if (b) {       return gcd(b, a % b);     } else       return a;   }   int main() {     long long int l, r;     cin >> l >> r;     if (abs(l - r) < 2) {       cout <<  -1  << endl;       return 0;     }     long long int i = 0, j = 0, k = 0;     long long int ans1 = 0, ans2 = 0, ans3 = 0;     bool a = false;     for (i = l; i <= r; i += 1) {       for (j = i + 1; j <= r; j += 1) {         if (gcd(i, j) == 1) {           for (k = j + 1; j < r; j += 1) {             if (gcd(j, k) == 1 and gcd(i, k) != 1) {               a = true;               break;             }           }         }         if (a == true) break;       }       if (a == true) break;     }     if (a == true)       cout << i <<     << j <<     << k << endl;     else       cout <<  -1  << endl;     return 0;   }
#include <bits/stdc++.h>   const int inf = 1039074182;   using namespace std;   int n;   long long a[100005];   void fi() {     cout <<  sjfnb n ;     exit(0);   }   void se() {     cout <<  cslnb n ;     exit(0);   }   int main() {     cin >> n;     for (int i = 0; i < n; i++) {       scanf( %I64d , a + i);     }     if (n == 1) {       if (a[0] & 1) {         fi();       } else {         se();       }     }     sort(a, a + n);     int equals = 0;     for (int i = 0; i < n - 1; i++) {       equals += (a[i] == a[i + 1]);     }     if (equals >= 2) se();     for (int i = 0; i < n - 1; i++) {       if (a[i] == a[i + 1] && (a[i] == 0 || (i && a[i] - 1 == a[i - 1]))) se();     }     long long sum = 0;     for (int i = 0; i < n; i++) {       sum += a[i];     }     if ((sum - 1LL * n * (n - 1) / 2) & 1)       fi();     else       se();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       int b, p, f;       int h, c;       cin >> b >> p >> f >> h >> c;       if (b >= p * 2 + f * 2)         cout << p * h + f * c << endl;       else {         if (c >= h) {           cout << min(b / 2, f) * c + min((b - min(b / 2, f) * 2) / 2, p) * h                << endl;         } else           cout << min(b / 2, p) * h + min((b - min(b / 2, p) * 2) / 2, f) * c                << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize( Ofast )   #pragma GCC optimize( unroll-loops )   #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native )   using namespace std;   long long MOD = 1000000007;   long double EPS = 1e-9;   mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());   int getRand(int l, int r) {     uniform_int_distribution<int> uid(l, r);     return uid(rng);   }   long long binpow(long long b, long long p, long long mod) {     long long ans = 1;     b %= mod;     for (; p; p >>= 1) {       if (p & 1) ans = ans * b % mod;       b = b * b % mod;     }     return ans;   }   void pre() {}   struct UnionFind {     int n, set_size, *parent, *rank;     UnionFind() {}     UnionFind(int a) {       n = set_size = a;       parent = new int[n + 1];       rank = new int[n + 1];       for (int i = 1; i <= n; ++i) parent[i] = i, rank[i] = 1;     }     int find(int x) {       if (x != parent[x]) return parent[x] = find(parent[x]);       return x;     }     void merge(int x, int y) {       int xroot = find(x), yroot = find(y);       if (xroot != yroot) {         if (rank[xroot] >= rank[yroot]) {           parent[yroot] = xroot;           rank[xroot] += rank[yroot];         } else {           parent[xroot] = yroot;           rank[yroot] += rank[xroot];         }         set_size -= 1;       }     }     void reset() {       set_size = n;       for (int i = 1; i <= n; i++) parent[i] = i, rank[i] = 1;     }     int size() { return set_size; }     void print() {       for (int i = 1; i <= n; ++i) cout << i <<   ->   << parent[i] <<   n ;     }   } uf(300300);   int n, m, k;   map<pair<int, int>, int> blocked;   set<int> unvisited;   void dfs(int tt) {     vector<long long> deleter;     for (auto v : unvisited) {       if (blocked.find(make_pair(tt, v)) == blocked.end()) {         deleter.emplace_back(v);         uf.merge(tt, v);       }     }     for (auto v : deleter) {       unvisited.erase(v);     }     for (auto v : deleter) {       dfs(v);     }   }   void solve() {     int n, m, k, kk;     cin >> n >> m >> kk;     k = kk;     int onedeg = n - 1;     for (long long i = 1; i <= m; ++i) {       int u, v;       cin >> u >> v;       blocked[make_pair(u, v)] = 1;       blocked[make_pair(v, u)] = 1;       if (u == 1 || v == 1) onedeg--;     }     for (long long i = 2; i <= n; ++i) {       unvisited.insert(i);     }     int cmp = 0;     while (!unvisited.empty()) {       int stt = *(unvisited.begin());       unvisited.erase(stt);       dfs(stt);     }     for (long long i = 2; i <= n; ++i) {       if (k && uf.find(1) != uf.find(i) &&           blocked.find(make_pair(1, i)) == blocked.end()) {         k--;         uf.merge(1, i);       }     }     bool pos = 1;     for (long long i = 2; i <= n; ++i) {       if (uf.find(1) != uf.find(i)) pos = 0;     }     if (pos && onedeg >= kk)       cout <<  possible n ;     else       cout <<  impossible n ;   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     pre();     long long t = 1;     for (long long i = 1; i <= t; i++) {       solve();     }   }
#include <bits/stdc++.h>   using namespace std;   const long long T = 200002;   const long long MAXD = T * T * T;   int n, s;   int N[T];   int PREFP[T];   int SUFL[T];   int main(void) {     cin >> n;     for (int i = (int)1; i <= (int)n; i++) {       cin >> N[i];     }     for (int i = (int)1; i <= (int)n; i++) {       PREFP[i] += N[i] + PREFP[i - 1];     }     for (int i = (int)n; i >= (int)1; i--) {       int k = N[i] == 0 ? 1 : 0;       SUFL[i] = k + SUFL[i + 1];     }     int b = 1;     int e = n;     long long ans = 0;     while (true) {       while (N[b] != 1 && b <= n) {         b++;       }       while (N[e] != 0 && e >= 1) {         e--;       }       if (e > b) {         long long bs = SUFL[b] - SUFL[e + 1];         long long es = PREFP[e] - PREFP[b - 1];         if (bs > es) {           e--;           ans += es;         } else {           b++;           ans += bs;         }       } else {         break;       }     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long MAX = 1e6 + 1;   const long long PRIME = 1e9 + 7;   long long gcd(long long a, long long b) {     if (b == 0) return a;     return gcd(b, a % b);   }   void solve() {     long long n;     cin >> n;     string s;     bool flag = 1;     cin >> s;     long long l = 0, r = 0;     vector<long long> a(n, 0);     for (long long i = 0; i < n; i++) {       if (s[i] ==  > )         l++;       else if (s[i] ==  < )         r++;       else {         a[i] = 1;         a[(i + 1) % n] = 1;       }     }     if (l != 0 && r == 0) {       cout << n <<   n ;       return;     }     if (r != 0 && l == 0) {       cout << n <<   n ;       return;     }     if (l == 0 && r == 0) {       cout << n <<   n ;       return;     }     long long ans = 0;     for (long long i = 0; i < n; i++) {       ans += a[i];     }     cout << ans <<   n ;   }   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long t;     cin >> t;     while (t--) {       solve();     }   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   using ld = long double;   const int inf = 0x3c3c3c3c;   const long long infl = 0x3c3c3c3c3c3c3c3c;   const int MAX_N = 2e5 + 9;   const ll MAX_R = 2 * 1e15 + 9;   int a[MAX_N];   int px[MAX_N], py[MAX_N];   int main() {     cin.tie(NULL);     cin.sync_with_stdio(false);     cout.sync_with_stdio(false);     ll sx, sy;     ll dx, dy;     cin >> sx >> sy;     cin >> dx >> dy;     int n;     cin >> n;     string s;     cin >> s;     for (int i = 0; i < n; i++)       px[i + 1] = (s[i] ==  R  ? 1 : 0) + (s[i] ==  L  ? -1 : 0) + px[i];     for (int i = 0; i < n; i++)       py[i + 1] = (s[i] ==  U  ? 1 : 0) + (s[i] ==  D  ? -1 : 0) + py[i];     ll l = 0, r = MAX_R;     while (l + 1 < r) {       ll m = (l + r) / 2;       ll cx = 1LL * (m / n) * px[n] + px[m % n];       ll cy = 1LL * (m / n) * py[n] + py[m % n];       ll v = abs(dx - (sx + cx)) + abs(dy - (sy + cy));       if (v <= m)         r = m;       else         l = m;     }     if (r == MAX_R) return !printf( -1 );     printf( %lld , r);   }
#include <bits/stdc++.h>   using namespace std;   long l[101][101], n, i, j;   int main() {     cin >> n;     int x1, y1, x2, y2;     while (n--) {       cin >> x1 >> y1 >> x2 >> y2;       for (i = x1; i <= x2; i++)         for (j = y1; j <= y2; j++) l[i][j]++;     }     long long res = 0;     for (i = 1; i <= 100; i++)       for (j = 1; j <= 100; j++) res += l[i][j];     cout << res;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 10;   int a[N], x[N << 1], y[N << 1];   int main() {     int n;     scanf( %d , &n);     for (int i = 1; i <= n; ++i) scanf( %d , &a[i]);     int cnt = 0;     stack<int> st1, st2;     bool flag = 1;     for (int i = n; i >= 1; --i) {       if (a[i] == 1) st1.push(i);       if (a[i] == 2) {         x[++cnt] = i, y[cnt] = i;         st2.push(i);         if (!st1.empty()) {           int top = st1.top();           st1.pop();           x[++cnt] = i, y[cnt] = top;         } else {           flag = 0;           break;         }       }       if (a[i] == 3) {         x[++cnt] = i, y[cnt] = i;         if (!st2.empty()) {           int top = st2.top();           st2.pop();           x[++cnt] = i, y[cnt] = top;           st2.push(i);         } else if (!st1.empty()) {           int top = st1.top();           st1.pop();           x[++cnt] = i, y[cnt] = top;           x[++cnt] = top, y[cnt] = top;           st2.push(i);         } else {           flag = 0;           break;         }       }     }     if (!flag) {       printf( -1 n );       return 0;     }     while (!st1.empty()) {       int top = st1.top();       st1.pop();       x[++cnt] = top, y[cnt] = top;     }     printf( %d n , cnt);     for (int i = 1; i <= cnt; ++i) printf( %d %d n , x[i], y[i]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long xa, ya;     long long xb, yb;     long long xc, yc;     cin >> xa >> ya >> xb >> yb >> xc >> yc;     long long x = xa;     long long y = ya;     long long X = xb;     long long Y = yb;     for (int i = 0; i < 4; ++i) {       if (i == 0) {         xa = x;         ya = y;       }       if (i == 1) {         xa = -y;         ya = x;       }       if (i == 2) {         xa = -x;         ya = -y;       }       if (i == 3) {         xa = y;         ya = -x;       }       xb = X - xa;       yb = Y - ya;       if (xc == 0) {         if (yc == 0) {           if (xb != 0 || yb != 0) continue;           cout <<  YES n ;           return 0;         }         if (xb % yc == 0 && yb % yc == 0) {           cout <<  YES n ;           return 0;         }         continue;       }       if ((xb * yc - yb * xc) % (xc * xc + yc * yc) == 0) {         long long b = (xb * yc - yb * xc) / (xc * xc + yc * yc);         if ((xb - b * yc) % xc == 0) {           cout <<  YES n ;           return 0;         }       }     }     cout <<  NO n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int mx[4005], S[4005];   int n, l[4005], r[4005], a[4005];   bool inter(int i, int j) {     if (l[i] >= l[j] && l[i] <= r[j]) return 1;     if (r[i] >= l[j] && r[i] <= r[j]) return 1;     if (l[j] >= l[i] && l[j] <= r[i]) return 1;     if (r[j] >= l[i] && r[j] <= r[i]) return 1;     return 0;   }   bool check(int d) {     int i, j, p, q;     l[0] = -(1 << 30);     for (i = 1; i <= n; i++) mx[i] = n;     for (i = 1; i <= n; i++) {       for (j = 1; j <= n; j++) S[j] = 0;       for (j = 1; j <= n; j++)         if (mx[j] > 0) S[mx[j]]++;       for (j = 1; j <= n; j++) S[j] = S[j] + S[j - 1];       for (j = i; j <= n; j++)         if (S[j] > j - i + 1) return 0;       for (j = i; j <= n; j++)         if (S[j] == j - i + 1) break;       q = j, p = 0;       for (j = 1; j <= n; j++)         if (mx[j] > 0 && mx[j] <= q && l[j] > l[p]) p = j;       mx[p] = -1, a[i] = p;       for (j = 1; j <= n; j++)         if (mx[j] > 0 && inter(p, j)) mx[j] = min(mx[j], i + d);     }     return 1;   }   int main() {     int i, ll, rr, mid;     scanf( %d , &n);     for (i = 1; i <= n; i++) scanf( %d %d , &l[i], &r[i]);     ll = 0, rr = n - 1;     while (rr - ll > 1) {       mid = (ll + rr) >> 1;       if (check(mid))         rr = mid;       else         ll = mid;     }     check(rr);     for (i = 1; i <= n; i++) printf( %d  , a[i]);     return 0;   }
#include<bits/stdc++.h>   #define ll long long   using namespace std;   ll t1,n,a[500010],mn[500010][2],f[2],sum[2],z[2];   int main(){    ll i,j,op,flag;    scanf( %lld ,&t1);    while(t1--){     scanf( %lld ,&n);     for(i=1;i<=n;i++)scanf( %lld ,&a[i]);     mn[n+1][0]=mn[n+1][1]=1e18;     for(i=n;i;i--){      mn[i][0]=mn[i+1][0];mn[i][1]=mn[i+1][1];      if(i%2==0){       mn[i][0]+=a[i];mn[i][1]-=a[i];      }       else{        mn[i][0]-=a[i];mn[i][1]+=a[i];       }      mn[i][i%2]=min(mn[i][i%2],a[i]);     }     //for(i=1;i<=n;i++)printf( %d %d %d n ,i,mn[i][0],mn[i][1]);     sum[0]=sum[1]=0;z[0]=z[1]=0;     for(i=1;i<=n;i++){      sum[i%2]+=a[i];      op=i%2;      if(sum[op]-sum[op^1]<0)break;     }     sum[0]=sum[1]=0;     for(j=1;j<=n;j++)z[j%2]+=a[j];     if(i>n&&z[0]==z[1]){      puts( YES );continue;     }     //z[0]=sum[0];z[0]=sum[1];     sum[0]=sum[1]=0;flag=0;     //printf( ? %d %d %d n ,i,z[0],z[1]);     for(j=1;j<=min(i,n-1);j++){      if(j%2==0){       f[0]=mn[j+2][0]-a[j]+a[j+1];       f[1]=mn[j+2][1]+a[j]-a[j+1];       f[0]=min(f[0],a[j+1]);       f[1]=min(f[1],a[j]-a[j+1]);      }       else{        f[0]=mn[j+2][0]+a[j]-a[j+1];       f[1]=mn[j+2][1]-a[j]+a[j+1];       f[0]=min(f[0],a[j]-a[j+1]);       f[1]=min(f[1],a[j+1]);       }      //printf( %d %d %d %d %d n ,j,f[0],f[1],sum[0],sum[1]);      op=j%2;      if(f[0]+sum[0]-sum[1]>=0&&f[1]+sum[1]-sum[0]>=0&&z[op]-a[j]+a[j+1]==z[op^1]+a[j]-a[j+1]){        flag=1;break;       }      sum[j%2]+=a[j];     }     if(flag)puts( YES );      else puts( NO );    }   }
#include <bits/stdc++.h>   using namespace std;   const int N = 310;   long long xh, yh, xu, yu;   int n;   long long a[N], b[N], c[N];   int main() {     scanf( %I64d%I64d , &xh, &yh);     scanf( %I64d%I64d , &xu, &yu);     scanf( %d , &n);     for (int i = 0; i < n; ++i) {       scanf( %I64d%I64d%I64d , a + i, b + i, c + i);     }     int cnt = 0;     for (int i = 0; i < n; ++i) {       if (a[i] * xu + b[i] * yu + c[i] < 0 && a[i] * xh + b[i] * yh + c[i] > 0) {         ++cnt;       } else if (a[i] * xu + b[i] * yu + c[i] > 0 &&                  a[i] * xh + b[i] * yh + c[i] < 0) {         ++cnt;       }     }     printf( %d n , cnt);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int r, h;     scanf( %d %d , &r, &h);     int res = ((2.0 * h + r) / 2.0 / r);     res *= 2;     int res2 = 1 + 2 * (int)((((h + r) - r * 0.5 * sqrt(3.0))) / r);     printf( %d  , max(res, res2));     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     set<pair<int, int> > h;     vector<int> d(n), s(n);     for (int i = 0; i < n; i++) {       cin >> d[i] >> s[i];       if (d[i]) {         h.insert({d[i], i});       }     }     vector<pair<int, int> > ans;     while (!h.empty()) {       pair<int, int> v = *h.begin();       h.erase(h.begin());       int w = s[v.second];       h.erase(make_pair(d[w], w));       d[w]--;       s[w] ^= v.second;       ans.push_back({v.second, w});       if (d[w]) h.insert(make_pair(d[w], w));     }     cout << ans.size() <<   n ;     for (auto& x : ans) {       cout << x.first <<     << x.second <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     long long n, i, m, s = 0, d = 0;     cin >> n >> m;     long long a[n], b[n], c[n];     for (i = 0; i < n; i++) {       cin >> a[i] >> b[i];       s += a[i];       c[i] = a[i] - b[i];     }     sort(c, c + n);     for (i = 0; i < n; i++)       if (s > m) {         s = s - c[n - 1 - i];         d++;       }     if (s > m)       cout << -1;     else       cout << d;   }   int main() {     long long a;     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct pInfo {     int idx;     long long reach;     pInfo(int i, long long r) { idx = i, reach = r; };   };   long long n, pos[200005], len[200005], R[200005], U[200005][19], S[200005][19],       q, a, b;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     while (cin >> n) {       memset(R, -1, sizeof R);       memset(U, -1, sizeof U);       for (int i = 0; i < n; ++i) cin >> pos[i] >> len[i];       pos[n] = 9990000000LL;       stack<pInfo> st;       st.push(pInfo(n, 9990000000LL));       for (int i = n - 1; i >= 0; --i) {         long long lim = pos[i] + len[i], reach = lim;         while (pos[st.top().idx] <= lim) {           reach = max(reach, st.top().reach);           st.pop();         }         R[i] = reach;         U[i][0] = st.top().idx;         S[i][0] = max(pos[U[i][0]] - reach, 0LL);         st.push(pInfo(i, reach));       }       for (int j = 1; j < 19; ++j) {         for (int i = 0; i < n; ++i) {           if (U[i][j - 1] == -1) continue;           U[i][j] = U[U[i][j - 1]][j - 1];           S[i][j] = S[i][j - 1] + S[U[i][j - 1]][j - 1];         }       }       cin >> q;       while (q--) {         cin >> a >> b;         --a;         --b;         long long res = 0;         while (a >= 0 && a <= b) {           int jmp = 0;           while (U[a][jmp] >= 0 && U[a][jmp] <= b) jmp++;           if (!jmp) break;           res += S[a][jmp - 1];           a = U[a][jmp - 1];         }         cout << res <<   n ;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int N(0), aSum(0), bSum(0), cap(0), last(0), out(0);     cin >> N;     for (int i = 0; i < N; i++) {       int a(0), b(0);       cin >> a >> b;       aSum += a;       bSum += b;       cap = bSum - aSum;       if (cap >= out) out = cap;     }     cout << out << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 2e5 + 5;   const int INF = 1e7;   const long long Mod = 1e9 + 7;   long long powmod(long long a, long long b) {     long long res = 1;     a %= Mod;     assert(b >= 0);     for (; b; b >>= 1) {       if (b & 1) res = res * a % Mod;       a = a * a % Mod;     }     return res;   }   long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }   struct haha {     int pos, dat;   } arr[maxn];   char st[maxn];   int sheng[maxn], xiao[2], k, res, arrnum;   int main() {     scanf( %s , st);     k = strlen(st);     res = 0;     for (int i = 0; i <= k - 1; i++) {       if (st[i] ==  1 ) {         sheng[i] = 1 + max(xiao[1], xiao[0]);         xiao[1] = sheng[i];       } else {         sheng[i] = ++xiao[0];         res++;       }     }     int qian[3] = {0};     arrnum = 0;     for (int i = 0; i <= k - 1; i++) {       if (st[i] ==  1 ) {         qian[2] = sheng[i];       } else {         while (arrnum > 0 && arr[arrnum].dat >= qian[2] - sheng[i]) arrnum--;         arrnum++;         arr[arrnum].pos = i;         arr[arrnum].dat = qian[2] - sheng[i];       }     }     arrnum++;     arr[arrnum].pos = k;     arr[arrnum].dat = k * 2;     int arrnow = 1;     res = 0;     for (int i = 0; i <= k - 1; i++)       if (st[i] ==  1 ) {         if (qian[0] >= qian[1]) {           qian[2] = sheng[i];           bool boo = true;           while (arrnow <= arrnum && arr[arrnow].pos < i) arrnow++;           if (arrnow > arrnum)             boo = false;           else {             if (res >= arr[arrnow].dat) boo = false;           }           if (boo) {             st[i] =  0 ;             res++;             qian[0] = sheng[i];           }         }         qian[1] = sheng[i];       } else {         qian[0] = res + sheng[i];       }     printf( %s , st);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, l, r, x, res = 0;   vector<int> subset;   void search(int k, const vector<int>& v) {     if (k == n) {       long long count = accumulate(subset.begin(), subset.end(), 0);       if (count >= l && count <= r && (subset.back() - subset.front()) >= x)         ++res;     } else {       subset.push_back(v[k]);       search(k + 1, v);       subset.pop_back();       search(k + 1, v);     }   }   int main() {     cin >> n >> l >> r >> x;     vector<int> c(n);     for (int i = 0; i < n; ++i) cin >> c[i];     sort(c.begin(), c.end());     search(0, c);     cout << res;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     int x, y;     cin >> x;     int c = 1;     bool ch = true;     for (int i = 0; i < n - 1; i++) {       cin >> y;       if (y > x) {         if (c != 1) ch = false;       } else if (x == y) {         if (c > 2) {           ch = false;         } else           c = 2;       } else if (x > y) {         c = 3;       }       x = y;     }     if (ch)       cout <<  YES ;     else       cout <<  NO ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   vector<int> ans{1}, pr{2, 3, 5, 7, 11};   int main() {     cin >> n;     for (int p : pr) {       if (ans.size() > n) break;       for (int i = 0; i < (int)ans.size(); i++) {         if (ans[i] * p <= 2 * n * n) ans.emplace_back(ans[i] * p);       }     }     reverse(begin(ans), end(ans));     ans.resize(n);     for (int x : ans) cout << x <<    ;   }
#include<bits/stdc++.h>   using namespace std;   int main()   {       int t;       cin>>t;       while(t--)       {           int n,k1,k2;           cin>>n>>k1>>k2;           int w,b;           int y1,y2;           y1=n-k1;           y2=n-k2;           cin>>w>>b;          if((min(k1,k2)+(k1+k2-2*min(k1,k2))/2)>=w && (min(y1,y2)+(y1+y2-2*min(y1,y2))/2)>=b)           cout<< YES <<endl;          else           cout<< NO <<endl;       }   }