malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int cl[5000010], cr[5000010], ld[5000010], sl = 1;   bool yz[5000010];   void pushd(int x) {     if (cl[x] == 0) {       cl[x] = ++sl;       yz[cl[x]] = 1;     }     if (cr[x] == 0) {       cr[x] = ++sl;       yz[cr[x]] = 1;     }     yz[x] = 0;     if (ld[x] == 0) return;     ld[cl[x]] = ld[cr[x]] = ld[x];     ld[x] = 0;   }   vector<int> cf[50010], ve[5000010];   void addqj(int i, long long l, long long r, long long L, long long R, int x) {     if (R <= l || r <= L) return;     if (L <= l && r <= R) {       ld[i] = x;       cf[x].push_back(i);       return;     }     long long m = (l + r) >> 1;     pushd(i);     addqj(cl[i], l, m, L, R, x);     addqj(cr[i], m, r, L, R, x);   }   void link(int x, int y) {     if (yz[x] && yz[y]) {       if (ld[x] < ld[y])         ve[x].push_back(y);       else         ve[y].push_back(x);       return;     }     link(yz[x] ? x : cl[x], yz[y] ? y : cl[y]);     link(yz[x] ? x : cr[x], yz[y] ? y : cr[y]);   }   int find(int i, long long l, long long r, long long x) {     if (yz[i]) return i;     long long m = (l + r) >> 1;     return x < m ? find(cl[i], l, m, x) : find(cr[i], m, r, x);   }   int lx[50010], fa[5000010], ans[50010];   long long A[50010], B[50010];   int getv(int x) { return x == fa[x] ? x : fa[x] = getv(fa[x]); }   void merge(int x, int y) {     x = getv(x);     y = getv(y);     if (x != y) fa[x] = y;   }   int main() {     int n, m;     scanf( %d%d , &n, &m);     ld[1] = m + 1;     yz[1] = 1;     for (int i = 1; i <= m; i++) {       char zf[10];       scanf( %s%lld%lld , zf, &A[i], &B[i]);       lx[i] = zf[0] ==  b  ? 0 : 1;       if (lx[i] == 0) addqj(1, 0, (1ll << n), A[i], B[i] + 1, i);     }     for (int i = 1; i <= sl; i++) {       fa[i] = i;       if (!yz[i]) link(cl[i], cr[i]);     }     for (int i = 1; i <= sl; i++) {       if (ld[i] != m + 1) continue;       for (int j = 0; j < ve[i].size(); j++) merge(i, ve[i][j]);     }     for (int i = m; i >= 1; i--) {       if (lx[i])         ans[i] = (getv(find(1, 0, (1ll << n), A[i])) ==                   getv(find(1, 0, (1ll << n), B[i])));       else {         for (int x = 0; x < cf[i].size(); x++) {           int u = cf[i][x];           for (int y = 0; y < ve[u].size(); y++) merge(u, ve[u][y]);         }       }     }     for (int i = 1; i <= m; i++) {       if (lx[i]) printf( %d n , ans[i]);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 15;   long long Get_Num(int num[], int b, int n) {     long long number = 0;     long long in = 1;     for (int i = n - 1; i >= 0; i--) {       number += num[i] * in;       in = in * b;     }     return number;   }   int main() {     int x[N], y[N];     int b;     int n;     long long X, Y;     cin >> n >> b;     for (int i = 0; i < n; i++) {       cin >> x[i];     }     X = Get_Num(x, b, n);     cin >> n >> b;     for (int i = 0; i < n; i++) {       cin >> y[i];     }     Y = Get_Num(y, b, n);     if (X == Y) {       printf( = n );     } else if (X > Y) {       printf( > n );     } else {       printf( < n );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       long n, m;       cin >> n >> m;       long sum = 0;       if (n == 1 || n == 2) {         if (n == 1)           cout << 0 << endl;         else           cout << m << endl;       } else {         cout << 2 * m << endl;       }     }   }
#include <bits/stdc++.h>   using namespace std;   const int mod = 1e9 + 7;   long long n, m;   int k;   int mpow(int a, long long b) {     int c = 1;     for (; b; b >>= 1, a = 1ll * a * a % mod)       if (b & 1) c = 1ll * c * a % mod;     return c;   }   int main() {     scanf( %lld%lld%d , &n, &m, &k);     if ((n + m) & 1)       if (k == -1) {         printf( 0 n );         return 0;       }     int tmp = mpow(2, n - 1);     printf( %d n , mpow(tmp, m - 1));   }
#include <bits/stdc++.h>   using namespace std;   int tt(char p) {     int s;     if (p ==  > )       s = 8;     else if (p ==  < )       s = 9;     else if (p ==  + )       s = 10;     else if (p ==  - )       s = 11;     else if (p ==  . )       s = 12;     else if (p ==  , )       s = 13;     else if (p ==  [ )       s = 14;     else       s = 15;     return s;   }   int main() {     string x;     int t = 0;     int q = x.length() - 1;     cin >> x;     for (int i = 0; i < x.length(); ++i) {       t = (t * 16 + tt(x[i])) % 1000003;     }     cout << t;     return 0;   }
#include <bits/stdc++.h>   template <typename T>   inline T MIN(T a, T b) {     return a < b ? a : b;   }   template <typename T>   inline T MAX(T a, T b) {     return a > b ? a : b;   }   using namespace std;   void reop() { freopen( input.txt ,  r , stdin); }   int a[100001] = {0};   int ans = 0, curans = 0;   bool test(int div, int n, int start) {     int prev = start;     for (int i = 2; i < n; ++i) {       if (a[i] == prev + div)         prev = a[i];       else if (a[i] + 1 == prev + div) {         prev = a[i] + 1;         curans++;       } else if (a[i] - 1 == prev + div) {         prev = a[i] - 1;         curans++;       } else         return false;     }     ans = MIN(ans, curans);     return true;   }   int main() {     int n;     cin >> n;     for (int i = 0; i < n; i++) {       cin >> a[i];     }     if (n == 1 || n == 2) {       cout << 0;       return 0;     }     ans = 1000000007;     for (int i = -1; i <= 1; ++i) {       for (int j = -1; j <= 1; ++j) {         curans = 0;         int div = a[1] + j - (a[0] + i);         if (j) curans++;         if (i) curans++;         test(div, n, a[1] + j);       }     }     cout << (ans == 1000000007 ? -1 : ans);     return 0;   }
#include<bits/stdc++.h>   #define int long long   #define pii pair<int,int>   #define F first   #define S second   #define pi acos(-1.0)   #define pb push_back   #define sf(x) scanf( %lld ,&x)   #define pf(x) printf( %lld ,&x)   using namespace std;   const int mod=1e9+7;   int a1[2000],ar[2000],ff[2000] ;   map<int,int>mp,mk ;   int bigmod(int a , int b)   {       if(b==0) return 1 ;       int x = bigmod(a,b/2) ;       x=((x%mod)*(x%mod))%mod ;       if(b%2) x=((x%mod)*(a%mod))%mod ;       return x ;   }   int ncr(int a , int b)   {       int p=(ff[a-b]*ff[b])%mod ;       p=(ff[a]*bigmod(p,mod-2)) ; p%=mod ;       return p ;   }   int32_t main()   {       ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0) ;       ff[0]=1 ; ff[1]=1 ;       for(int i = 2 ; i <= 1000 ; i++) ff[i]=(ff[i-1]*i)%mod ;       int t ; cin>>t ;       while(t--)       {           int n,k,mx=0 ; cin>>n>>k ; mp.clear() ; mk.clear() ;           set<int>st ;           for(int i = 1 ; i <= n ; i++){cin>>ar[i] ; mp[ar[i]]++ ; a1[i]=ar[i] ; }           sort(a1+1,a1+n+1) ; reverse(a1+1,a1+n+1) ;          // for(int i = 1 ; i <= n ; i++) cout<<a1[i]<<    ; cout<<endl ;           for(int i = 1 ; i <= k ; i++) {mx+=a1[i] ; st.insert(a1[i]) ; mk[a1[i]]++ ;}           int ans=1 ;           for(int x : st)           {               int p=mp[x],q=mk[x] ;             //  cout<<x<<   <<p<<   <<q<<endl ;               ans*=ncr(p,q); ans%=mod ;           }           cout<<ans<<endl ;       }   }
#include <bits/stdc++.h>   using namespace std;   const int N = 2e5 + 2, M = 1e9 + 7;   int tt = 1, n, k;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cin >> tt;     while (tt--) {       cin >> n;       if (n == 1) {         cout <<  a n ;         continue;       }       string second =   , ans =   ;       for (int i = 0; i < n / 2 - 1; i++) second +=  a ;       ans +=  a  + second +  b  + second;       if (n & 1) ans +=  c ;       cout << ans <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 2e5 + 7;   const long long inf = 1e17 + 7;   pair<long long, long long> a[maxn];   pair<long long, long long> A[maxn];   pair<pair<long long, long long>, pair<long long, long long> > S[maxn];   int pos;   inline long long elf(pair<long long, long long> z, long long x) {     return z.first * x + z.second;   }   inline long long earl(pair<long long, long long> z, long long v) {     long long a = z.first, b = z.second;     long long x = (v - b) / a;     if (a * x >= v - b) return x;     return x + 1;   }   inline long double intx(pair<long long, long long> l1,                           pair<long long, long long> l2) {     long long a1 = l1.first, a2 = l2.first, b1 = l1.second, b2 = l2.second;     return (long double)(b2 - b1) / (long double)(a1 - a2);   }   void ins(long long a, long long b) {     while (pos >= 2 && intx(S[pos].first, S[pos - 1].first) >=                            intx(make_pair(a, b), S[pos].first))       pos--;     S[pos].second.second = ceil(intx(S[pos].first, make_pair(a, b))) - 1;     pos++;     S[pos] =         make_pair(make_pair(a, b),                   make_pair(ceil(intx(S[pos - 1].first, make_pair(a, b))), inf));   }   int main() {     int n;     long long s;     scanf( %d %lld , &n, &s);     for (int i = 1; i <= n; i++) {       scanf( %lld %lld , &a[i].first, &a[i].second);     }     sort(a + 1, a + n + 1);     a[0].first = -1;     long long cur = -1;     long long best = inf;     int idx = 0;     for (int i = n; i >= 0; i--) {       if (a[i].first != cur) {         if (cur > 0) {           idx++;           A[idx] = make_pair(cur, best);         }         cur = a[i].first;         best = inf;       }       best = min(best, a[i].second);     }     n = idx;     for (int i = 1; i <= n; i++) a[i] = A[i];     best = inf;     idx = 0;     for (int i = 1; i <= n; i++) {       if (a[i].second >= best) continue;       idx++;       A[idx] = a[i];       best = min(best, a[i].second);     }     n = idx;     reverse(A + 1, A + n + 1);     long long ans = inf;     pos = 1;     S[pos] = make_pair(make_pair(A[1].first, 0), make_pair(0, inf));     int fp = 1;     for (int i = 2; i <= n; i++) {       while (fp < pos && elf(S[fp].first, S[fp].second.second) < A[i].second)         fp++;       long long cx = earl(S[fp].first, A[i].second);       long long fcx = elf(S[fp].first, cx);       ins(A[i].first, fcx - A[i].second - A[i].first * cx);       fp = min(fp, pos);     }     for (int i = 1; i <= pos; i++) {       ans = min(ans, earl(S[i].first, s));     }     printf( %lld n , ans);   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e6 + 3;   const long long int M = 1000000007;   void solve() {     string s;     cin >> s;     int n = s.length();     for (int i = 0; i < n - 1; ++i) {       s +=  0 ;     }     long long int ans = 0;     for (int i = 0; i < 2 * (n - 1) + 1; ++i) {       ans += ans + s[i] -  0 ;       ans %= M;     }     cout << ans;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     solve(), cout <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct like {     int id;     int change = 0;   };   int main() {     int n, s, max = 0, idmax = 0, count = 0, k = 0;     cin >> n;     like *A = new like[n];     for (int i = 0; i < n; i++) {       cin >> s;       k = 1;       for (int j = 0; j < count; j++) {         if (A[j].id == s) {           A[j].change++;           k = 0;           if (A[j].change > max) {             max = A[j].change;             idmax = A[j].id;           }         }       }       if (k == 1) {         A[count].id = s;         A[count].change++;         if (A[count].change > max) {           max = A[count].change;           idmax = A[count].id;         }         count++;       }     }     cout << idmax << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int H[100000][5], V[100000][5];   long long dp[32];   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     int n, m;     cin >> n >> m;     for (int i = 1; i < m; ++i)       for (int j = 0; j < n; ++j) cin >> H[i][j];     for (int i = 0; i < m; ++i)       for (int j = 0; j < n; ++j) cin >> V[i][j];     for (int i = 1; i < (1 << n); ++i) dp[i] = 1e18;     const int sz = 1 << n;     for (int i = 1; i < m; ++i) {       for (int j = 0; j < sz; ++j) {         for (int k = 0; k < n; ++k) {           if (!(j & (1 << k))) {             auto &t = dp[j | (1 << k)];             const auto &nt = dp[j] + H[i][k];             if (nt < t) t = nt;           }         }         for (int k = 0; k < n; ++k) {           if ((((j >> k)) ^ ((j >> ((k + 1) % n)))) & 1) dp[j] += V[i][k];         }       }     }     cout << dp[sz - 1] << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int arr[100000], arr1[100000], arr2[100000];   int main() {     int n, flag = 0;     cin >> n;     multiset<long long int> m;     multiset<long long int>::iterator it;     for (int i = 0; i < n; i++) {       cin >> arr[i];       m.insert(arr[i]);       if (i == 0)         arr1[i] = arr[i];       else         arr1[i] = arr1[i - 1] + arr[i];     }     for (int i = n - 1; i >= 0; i--) {       if (i == n - 1)         arr2[n - 1 - i] = arr[i];       else         arr2[n - 1 - i] = arr2[n - 2 - i] + arr[i];     }     if (arr1[n - 1] % 2 != 0)       cout <<  NO ;     else {       long long int sum = arr1[n - 1] / 2;       it = m.find(arr[0]);       m.erase(it);       if (arr1[0] == sum || arr2[0] == sum) flag = 1;       if (!flag) {         for (int i = 1; i < n - 1; i++) {           if (m.find(sum - arr1[i - 1]) != m.end()) {             flag = 1;             break;           }           if (!flag) {             int low = i + 1, high = n - 1;             while (low < high) {               int mid = low + (high - low + 1) / 2;               if (arr1[mid] - arr1[i] + arr1[i - 1] > sum)                 high = mid - 1;               else                 low = mid;             }             if (arr1[low] - arr1[i] + arr1[i - 1] == sum) {               flag = 1;               break;             }           }           it = m.find(arr[i]);           m.erase(it);         }       }       m.clear();       if (!flag) {         for (int i = 0; i < n; i++) m.insert(arr[i]);         it = m.find(arr[n - 1]);         m.erase(it);         for (int i = 1; i < n - 1; i++) {           if (m.find(sum - arr2[i - 1]) != m.end()) {             flag = 1;             break;           }           int low = i + 1, high = n - 1;           while (low < high) {             int mid = low + (high - low + 1) / 2;             if (arr2[mid] - arr2[i] + arr2[i - 1] > sum)               high = mid - 1;             else               low = mid;           }           if (arr2[low] - arr2[i] + arr2[i - 1] == sum) {             flag = 1;             cout << i << endl;             break;           }           it = m.find(arr[n - 1 - i]);           m.erase(it);         }       }       if (flag)         cout <<  YES ;       else         cout <<  NO ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   const ll MOD = 1e9 + 7;   void dfs(int node, vector<vector<pair<int, int>>>& adj, vector<bool>& vu,            ll& cnt) {     for (auto& p : adj[node]) {       if (!vu[p.first] and p.second == 0) {         vu[p.first] = true;         ++cnt;         dfs(p.first, adj, vu, cnt);       }     }   }   ll getPow(ll a, ll p) {     ll ret = 1, cp = a;     while (p) {       if (p & 1) ret = (ret * cp) % MOD;       p >>= 1;       cp = (cp * cp) % MOD;     }     return ret;   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     int n, k, a, b, c;     cin >> n >> k;     vector<vector<pair<int, int>>> adj(n + 1);     for (int i = 1; i < n; ++i) {       cin >> a >> b >> c;       adj[a].emplace_back(b, c);       adj[b].emplace_back(a, c);     }     vector<bool> vu(n + 1);     ll ans = getPow(n, k);     for (int i = 1; i <= n; ++i) {       if (!vu[i]) {         ll tmp = 1;         vu[i] = true;         dfs(i, adj, vu, tmp);         ans = (ans - getPow(tmp, k)) % MOD;       }     }     cout << (ans + MOD) % MOD;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, v[5000];   char a[5000][5050];   bool dfs(int x, int from) {     v[x] = 1;     for (int y = 0; y < n; y++)       if (a[x][y] ==  1 ) {         if (!v[y]) {           if (dfs(y, x)) return true;         } else {           if (a[y][from] ==  1 ) {             printf( %d %d %d n , y + 1, from + 1, x + 1);             return true;           }         }       }     return false;   }   int main() {     scanf( %d , &n);     gets(a[0]);     for (int i = 0; i < n; i++) gets(a[i]);     for (int i = 0; i < n; i++)       if (!v[i])         if (dfs(i, -1)) return 0;     puts( -1 );   }
#include <bits/stdc++.h>   const double EPS = 0.0000000001;   const long long mod1 = 998244353;   const long long mod2 = 1000000007;   const long long mod3 = 1000000009;   const long long mod4 = 998244353;   const long long inf = 10000000000000000;   using namespace std;   signed main() {     cin.tie(0);     cout.tie(0);     std::ios_base::sync_with_stdio(0);     long long n, a;     cin >> n >> a;     long long matrix[a][n];     for (long long i = 0; i < a; i++) {       for (long long z = 0; z < n; z++) {         char c;         cin >> c;         matrix[i][z] = (c -  0 );       }     }     bool used[a];     for (long long i = 0; i < a; i++) {       bool p = 0;       for (long long z = 0; z < n; z++) {         if (!matrix[i][z]) p = 1;       }       used[i] = p;     }     long long c = 0;     long long x = 1;     long long maxi = -1;     for (long long i = 0; i < a; i++) {       if (used[i]) {         c++;         continue;       }       maxi = max(maxi, c);       c = 0;     }     maxi = max(maxi, c);     cout << maxi;   }
#include <bits/stdc++.h>   using namespace std;   pair<int, int> x[1024], y[1024];   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int t;     cin >> t;     while (t--) {       int n;       cin >> n;       for (int i = 0; i < n; i++) {         cin >> x[i].first >> x[i].second;         y[i].first = x[i].first;         y[i].second = x[i].second;       }       sort(x, x + n, [](const pair<int, int>& a, const pair<int, int>& b) {         return a.first < b.first || (a.first == b.first && a.second < b.second);       });       sort(y, y + n, [](const pair<int, int>& a, const pair<int, int>& b) {         return a.second < b.second || (a.second == b.second && a.first < b.first);       });       string ans =   ;       int r = 0, c = 0;       for (int i = 0; i < n; i++) {         if (x[i] != y[i]) {           cout <<  NO  << endl;           ans =   ;           break;         } else {           ans += string(x[i].first - r,  R );           ans += string(x[i].second - c,  U );           r = x[i].first;           c = x[i].second;         }       }       if (!ans.empty()) {         cout <<  YES  << endl << ans << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   char s[123456];   int main() {     scanf( %s , s);     stack<pair<int, int> > st;     int best = 0, rr = -1;     int sqb = 0;     for (int i = 0; s[i]; ++i) {       if (s[i] ==  (  || s[i] ==  [ ) {         st.push(make_pair(i, sqb));         sqb = 0;       } else if (s[i] ==  ) ) {         if (st.size() > 0 && s[st.top().first] ==  ( ) {           sqb += st.top().second;           if (best < sqb) {             best = sqb;             rr = i;           }           st.pop();         } else {           stack<pair<int, int> >().swap(st);           sqb = 0;         }       } else if (s[i] ==  ] ) {         if (st.size() > 0 && s[st.top().first] ==  [ ) {           sqb += st.top().second + 1;           if (best < sqb) {             best = sqb;             rr = i;           }           st.pop();         } else {           stack<pair<int, int> >().swap(st);           sqb = 0;         }       }     }     s[rr + 1] = 0;     int ll = rr;     stack<int> out;     for (int i = rr; i >= 0; --i) {       if (s[i] ==  )  || s[i] ==  ] ) {         out.push(i);       } else if (s[i] ==  ( ) {         if (out.size() > 0 && s[out.top()] ==  ) ) {           ll = i;           out.pop();         } else           break;       } else if (s[i] ==  [ ) {         if (out.size() > 0 && s[out.top()] ==  ] ) {           ll = i;           out.pop();         } else           break;       }     }     while (out.size() > 0) {       ll = out.top() + 1;       out.pop();     }     printf( %d n , best);     puts(s + ll);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int dx[] = {0, 0, 1, -1};   int dy[] = {-1, 1, 0, 0};   template <class T>   T power(T N, T P) {     return (P == 0) ? 1 : N * power(N, P - 1);   }   template <class T>   T gcd(T a, T b) {     if (b == 0) return a;     return gcd(b, a % b);   }   struct debugger {     template <typename T>     debugger& operator,(const T& v) {       cerr << v <<    ;       return *this;     }   } dbg;   void make_unique(vector<int>& a) {     sort(a.begin(), a.end());     a.erase(unique(a.begin(), a.end()), a.end());   }   int on(int n, int pos) { return n = n | (1 << pos); }   void off(int& n, int pos) { n = n & ~(1 << pos); }   bool check(int n, int pos) { return (bool)(n & (1 << pos)); }   const int N = 1e5 + 10;   const int M = 64;   int id, cnt[M * N], a[N * M][5];   int new_node() {     for (int i = 0; i < 3; i++) {       a[id][i] = -1;     }     cnt[id] = 0;     return id++;   }   vector<int> bit(70);   void make(long long int x) {     bit.clear();     int i = 0;     while (x) {       bit.push_back(x % 2);       x /= 2LL;       i++;     }     while (i < M - 1) {       bit.push_back(0LL);       i++;     }     reverse(bit.begin(), bit.end());   }   void add(long long int x) {     make(x);     int cur = 0, typ;     for (int i = 0; i < M; i++) {       typ = bit[i];       if (a[cur][typ] == -1) {         a[cur][typ] = new_node();       }       cur = a[cur][typ];       ++cnt[cur];     }   }   void del(long long int x) {     make(x);     int cur = 0, typ;     for (int i = 0; i < M; i++) {       typ = bit[i];       cur = a[cur][typ];       --cnt[cur];     }   }   long long int query(long long int x) {     make(x);     int cur = 0, typ;     long long int ans = 0LL;     for (int i = 0; i < M; i++) {       typ = bit[i];       if (cnt[a[cur][!typ]] > 0) {         ans += (1LL << (M - i - 2));         cur = a[cur][!typ];       } else {         if (a[cur][typ] == -1) return ans;         cur = a[cur][typ];       }     }     return ans;   }   long long int arr[N];   int main() {     int n;     while (scanf( %d , &n) != EOF) {       id = 0;       new_node();       for (__typeof(n) i = 1; i <= n; i++) {         scanf( %lld , &arr[i]);       }       long long int xr = 0LL;       for (int i = n; i >= 1; i--) {         xr ^= arr[i];         add(xr);       }       long long int mx = 0LL;       long long int nw = 0LL;       mx = max(mx, query(nw));       for (int i = 1; i <= n; i++) {         nw ^= arr[i];         mx = max(mx, query(nw));         del(xr);         xr ^= arr[i];       }       printf( %lld n , mx);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t > 0) {       t--;       string s, x;       cin >> s;       x.push_back(s[0]);       for (int i = 1; i < s.size(); i++) {         if (i % 2 != 0) x.push_back(s[i]);       }       cout << x << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int q = 1, i, j;     while (q--) {       int n, r;       cin >> r >> n;       vector<int> t(n + 1), x(n + 1), y(n + 1);       t[0] = 0, x[0] = 1, y[0] = 1;       for (i = 1; i < (n + 1); i++) {         cin >> t[i] >> x[i] >> y[i];       }       vector<int> dp(n + 1, INT_MIN), pref(n + 1, INT_MIN);       dp[0] = 0;       for (i = 1; i < (n + 1); i++) {         dp[i] = 1 + pref[max(i - 2 * r, 0)];         for (j = max(0, i - 2 * r + 1); j < (i); j++) {           if (t[i] - t[j] >= abs(x[i] - x[j]) + abs(y[i] - y[j])) {             dp[i] = max(dp[i], dp[j] + 1);           }         }         pref[i] = max({dp[i], pref[i - 1], 0});       }       cout << pref[n] <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(false);     int n, m, a;     cin >> n >> m;     int l = 1, mx = 0;     for (int i = 0; i < n; i++) {       cin >> a;       if ((a + m - 1) / m >= mx) {         mx = (a + m - 1) / m;         l = i + 1;       }     }     cout << l << endl;     return 0;   }