malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include<bits/stdc++.h>   #define inf 0x3f3f3f   using namespace std;   typedef long long ll;   const int maxn = 3e5+5;   const int mod = 1e9+7;   int a[maxn],b[maxn];   int main()   {    int T;    cin>>T;    while(T--){     int n;     cin>>n;     for(int i=1;i<=n;i++) cin>>a[i];     for(int j=1;j<=n;j++) cin>>b[j];     int cnt1=0,cnt2=0;     vector<int> v1,v2;     for(int i=1;i<=n;i++){      if(a[i]>b[i]){       cnt1+=a[i]-b[i];        for(int j=0;j<a[i]-b[i];j++) v1.push_back(i);      }      else{       cnt2+=b[i]-a[i];       for(int j=0;j<b[i]-a[i];j++) v2.push_back(i);      }     }     if(cnt1!=cnt2){      cout<< -1 n ;      continue;     }     cout<<v1.size()<<  n ;     for(int i=0;i<v1.size();i++){      cout<<v1[i]<<   <<v2[i]<<  n ;     }    }    return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int i, n, m, z, ck = 0;     cin >> n >> m >> z;     for (i = 1; i <= z; i++) {       if (n * i > z)         break;       else if ((n * i) % m == 0) {         ck++;       }     }     cout << ck << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1700;   int n, m, tim, res[N * N], num[N * N], a[N][N], s[N][N], id[N][N];   bool ray[N][N];   bool check(int x, int y) {     return s[x + 3][y + 3] - s[x - 4][y + 3] - s[x + 3][y - 4] +                s[x - 4][y - 4] <=            15;   }   void dfs1(int x, int y) {     if (id[x][y] || !a[x][y]) return;     id[x][y] = *res;     dfs1(x - 1, y);     dfs1(x + 1, y);     dfs1(x, y - 1);     dfs1(x, y + 1);   }   void dfs2(int x, int y) {     if (!a[x][y] || ray[x][y]) return;     if (!check(x, y)) {       if (num[id[x][y]] != tim) {         num[id[x][y]] = tim;         res[id[x][y]]++;       }       return;     }     ray[x][y] = true;     dfs2(x - 1, y);     dfs2(x + 1, y);     dfs2(x, y - 1);     dfs2(x, y + 1);   }   int main() {     scanf( %d%d , &n, &m);     n += 5;     m += 5;     for (int i = 6; i <= n; i++)       for (int j = 6; j <= m; j++) scanf( %d , &a[i][j]);     n += 5;     m += 5;     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++)         s[i][j] = s[i - 1][j] + s[i][j - 1] - s[i - 1][j - 1] + a[i][j];     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++)         if (a[i][j] && !id[i][j]) {           ++*res;           dfs1(i, j);         }     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++)         if (a[i][j] && !ray[i][j] && check(i, j)) {           ++tim;           dfs2(i, j);         }     sort(res + 1, res + *res + 1);     printf( %d n , *res);     for (int i = 1; i <= *res; i++) printf( %d  , res[i]);   }
#include <bits/stdc++.h>   using namespace std;   int n, k, a[111000], s, ans[111000];   int main() {     cin >> n >> k;     for (register int i = 1; i <= n; i++) {       cin >> a[i];       s += a[i];     }     if (s % k != 0) {       cout <<  No ;       return 0;     }     int t = s / k;     int cnt = 0;     for (register int i = 1; i <= n;) {       int sum = 0, tmp = 0;       while (sum < t) {         sum += a[i];         i++;         tmp++;       }       if (sum != t) {         cout <<  No ;         return 0;       }       ans[++cnt] = tmp;     }     cout <<  Yes  << endl;     for (register int i = 1; i <= cnt; i++) cout << ans[i] <<    ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int w[100001];   int main() {     map<string, int> mp;     int n, m;     cin >> n >> m;     for (int i = 0; i < n; i++) {       cin >> w[i];     }     sort(w, w + n);     string s;     for (int i = 0; i < m; i++) {       cin >> s;       mp[s]++;     }     int a[101], k = 0;     for (map<string, int>::iterator i = mp.begin(); i != mp.end(); i++) {       a[k++] = (*i).second;     }     sort(a, a + k);     long long s1 = 0, p = 0;     for (int i = 0; i < k; i++) {       s1 += a[k - i - 1] * w[i];       p += a[k - i - 1] * w[n - i - 1];     }     cout << s1 <<     << p;   }
#include <bits/stdc++.h>   using namespace std;   const int Max = 2e6 + 10;   const int Mod = 1e9 + 7;   const int MAX = 2e18;   int main() {     long long int x, j = 0, mx = 0, mx2 = 0, cnt = 0;     bool f = 0, f2 = 0, f3 = 0;     string s;     cin >> x >> s;     long long int ar[x + 5];     memset(ar, 0, sizeof(ar));     ;     for (int i = 0; i < x; i++) {       if (s[i] ==  G ) {         ar[j]++;         f2 = 1;         cnt++;         if (f == 1) {           f3 = 1;         }       } else {         f = 1;         if (i != x - 1) {           j++;         }       }     }     if (f == 0) {       cout << x << endl;       ;       return 0;     }     if (f2 == 0) {       cout << 0 << endl;       ;       return 0;     }     if (f3 == 0) {       cout << cnt << endl;       ;       return 0;     }     for (int i = 0; i < j + 1; i++) {       if (ar[i + 1] == 0) {         mx2 = max(mx2, ar[i]);         ar[i] = 0;         i++;         continue;       }       mx2 = max(mx2, ar[i]);       ar[i] = ar[i] + ar[i + 1];       mx = max(mx, ar[i]);     }     if (mx2 > mx) {       if (mx2 < cnt) {         cout << mx2 + 1 << endl;         ;       } else {         cout << mx2 << endl;         ;       }     } else if (cnt > mx) {       cout << mx + 1 << endl;       ;     } else {       cout << mx << endl;       ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     long long n;     cin >> n;     if (n <= 30)       cout <<  NO n ;     else {       cout <<  YES n ;       long long d = n - 30;       long long a = 6, b = 10, c = 14;       if (d == 6 || d == 10 || d == 14)         cout <<  6 10 15   << d - 1 << endl;       else         cout <<  6 10 14   << d << endl;     }   }   signed main() {     long long t;     cin >> t;     while (t--) solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long int;   const ll mod = 1000000007;   const ll M = 1000000000000000000ll;   inline ll add(ll a, ll b) { return ((a % mod + b % mod) % mod); }   inline ll sub(ll a, ll b) { return ((a % mod - b % mod + mod) % mod); }   inline ll mult(ll a, ll b) { return (((a % mod) * (b % mod)) % mod); }   inline ll power(ll n, ll x) {     ll p = 1;     while (x != 0) {       if (x % 2 == 0) {         n = mult(n, n);         x = x / 2;       }       p = mult(p, n);       x--;     }     return p;   }   inline ll recurmult(ll a, ll b) {     ll r = 0;     while (b) {       if (b & 1) r = add(r, a);       a = mult(2, a);       b >>= 1;     }     return r % mod;   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     ll n, ma = 0;     cin >> n;     ll arr[n + 1];     ll ans[n + 1];     for (ll i = 0; i < n; i++) cin >> arr[i];     ans[0] = arr[0];     ma = ans[0];     for (ll i = 1; i < n; i++) {       ans[i] = ma + arr[i];       ma = max(ma, ans[i]);     }     for (ll i = 0; i < n; i++) cout << ans[i] <<    ;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int x1, x2, x3, n1, n2, n3;     scanf( %d %d %d , &x1, &x2, &x3);     n3 = (x1 - x2 + x3) / 2;     n2 = x3 - n3;     n1 = x1 - n3;     if (n1 < 0 || n2 < 0 || n3 < 0 || 2 * (n1 + n2 + n3) != x1 + x2 + x3)       printf( Impossible n );     else       printf( %d %d %d n , n1, n2, n3);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct pp {     long long int len, v;   };   bool cmp(pp& a, pp& b) {     if (a.v == b.v) return a.len > b.len;     return a.v > b.v;   }   int main() {     long long int n, k;     cin >> n;     cout << (n - 1) * n * (2 * n - 1) / 6 - 1 - 1 + n * (n - 1) / 2 << endl;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   using db = double;   using pii = pair<int, int>;   using pll = pair<ll, ll>;   using pdd = pair<db, db>;   using vi = vector<int>;   using vl = vector<ll>;   using vd = vector<db>;   using vs = vector<string>;   using vii = vector<pii>;   using vll = vector<pll>;   using vdd = vector<pdd>;   template <class T>   bool ckmin(T& a, const T& b) {     return (b < a) ? a = b, 1 : 0;   }   template <class T>   bool ckmax(T& a, const T& b) {     return (a < b) ? a = b, 1 : 0;   }   const ll MOD = 1e9 + 7;   const ll MOD2 = 998244353;   const int kx[] = {0, 1, 0, -1}, ky[] = {1, 0, -1, 0};   void fileIO(string filename) {     freopen((filename +  .in ).c_str(),  r , stdin);     freopen((filename +  .out ).c_str(),  w , stdout);   }   int solve(string s) {     int n = (int)s.size(), tot = count((s).begin(), (s).end(),  1 ), cmin = tot,         cur = 0;     vi dp(n);     for (int(i) = 0; i < n; ++i) {       cur += s[i] ==  1 ;       dp[i] = s[i] ==  0 ;       if (i) dp[i] += min(dp[i - 1], cur - (s[i] ==  1 ));       ckmin(cmin, dp[i] + tot - cur);     }     return cmin;   }   int main(void) {     ios_base::sync_with_stdio(0);     cin.tie(0);     int t;     cin >> t;     while (t--) {       int n, k, tot, ans = INT_MAX;       cin >> n >> k;       string ss;       cin >> ss;       tot = count((ss).begin(), (ss).end(),  1 );       vs s(k);       vi cnt(k);       for (int(i) = 0; i < n; ++i) s[i % k] += ss[i];       for (int(i) = 0; i < k; ++i)         cnt[i] = count((s[i]).begin(), (s[i]).end(),  1 );       for (int(i) = 0; i < k; ++i) ckmin(ans, solve(s[i]) + tot - cnt[i]);       cout << ans <<   n ;     }     cerr <<  Time elapsed:   << 1.0 * clock() / CLOCKS_PER_SEC <<  s n ;   }
#include<bits/stdc++.h>         using namespace std;   #define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);      #define PB(x, v) x.push_back(v);   #define M_P(a, b) make_pair(a, b)   #define pll pair<ll, ll>   #define ll long long int   #define mll map<ll, ll>   #define vl vector<ll>   #define fa(x, v) for(auto x: v)   #define fr(i, a, b, step) for(auto i= a;i <=b; i+=step)   #define TEST  Int test; cin >> test; while(test--)   #define FTEST Int TesT; cin >> TesT; for(Int test = 1; test<=TesT; test++)   /**So..a**/   #define B_ begin()   #define E_ end()   #define all(a) a.begin(), a.end()   #define rall(a) a.rbegin(), a.rend()   #define NL_   n    #define F first   #define S second   #define FF first.first   #define FS first.second   #define SF second.first   #define SS second.second   #include <iomanip>   #define __lcm(a, b) (a/__gcd(a, b)*b)   #define PI acos(-1)   #define EXP 10e-6    ll prime(ll a,ll b){     ll ans=0;                         return ans;    }   int main()   {                              ll n,m,k,i,j,sum=0,cnt=0,x;              string s,ss,str,st;            bool sign=1,ok=true,cheak=1;            ll t,tc;           ll a,b,c;           ll ans=0;              ok=1;             sum=0;                          ll fac=1;           cin>>t;           while(t--)           {            cnt=0;            ok=1;sign=0;              int first=0;              int p=0;              int fst=0,scnd=0;            cin>>n>>k;                         int mid=(n+1)/2;                            vector<ll>vv,v;             for(i=1;i<=mid;i++){                            vv.push_back(i);                      }             for(i=mid+1;i<=n;i++){                            v.push_back(i);       }       /*       for(auto i:vv)cout<<i<<   ;       cout<<endl;       for(auto i:v)cout<<i<<   ;       cout<<endl;            */            if(k==0){             for(i=1;i<=n;i++)cout<<i<<   ;             cout<<endl;             continue;      }                    if((k+k+1) > n)cout<<-1<<endl;      else {               for(i=1;i<=n;i++)       {                    if(ok){                    cout<<vv[first++]<<   ;         ok=0;         sign=1;              fst++;         continue;        }            if(sign){                       ok=1;         sign=0;         cout<<v[p++]<<   ;          scnd++;         cnt++;          if(cnt==k)break;        }       }              for(i=fst;i<vv.size();i++)cout<<vv[i]<<   ;       for(i=scnd;i<v.size();i++)cout<<v[i]<<   ;                     cout<<endl;      }                 }                         return 0;   }
#include <bits/stdc++.h>   using namespace std;   void read(long long a = 0) {     freopen( in ,  r , stdin);     if (a) freopen( out ,  w , stdout);   }   int main() {     long long n, m, k;     cin >> n >> m >> k;     long long done = 0;     while (k--) {       long long x, y;       cin >> x >> y;       long long mi = 1e15;       mi = min(mi, x - 1);       mi = min(mi, n - x);       mi = min(mi, y - 1);       mi = min(mi, m - y);       done |= (mi <= 4);     }     if (done)       cout <<  YES ;     else       cout <<  NO ;   }
#include <bits/stdc++.h>   const int inf = 1 << 30;   const long long INF = 1ll << 61;   using namespace std;   int n, m;   int c[1000000 + 55];   int nnum[1000000 + 55];   int aa[1000000 + 55];   int sum[1000000 + 55];   int len;   void init() {     memset(c, 0, sizeof(c));     memset(aa, -1, sizeof(aa));   }   bool input() {     while (cin >> n >> m) {       for (int i = 0; i < m; i++) cin >> nnum[i];       return false;     }     return true;   }   int lowbit(int x) { return x & (-x); }   void add(int i, int val) {     while (i <= n) {       c[i] += val;       i += lowbit(i);     }   }   int get_sum(int i) {     int sum = 0;     while (i > 0) {       sum += c[i];       i -= lowbit(i);     }     return sum;   }   void binary_find(int pos) {     for (int i = 0; i <= pos; i++) {       int l = 1;       int r = n;       while (l <= r) {         int mid = (l + r) >> 1;         int ret = get_sum(mid);         if (aa[mid] == -1) {           if (ret >= nnum[i] - i)             r = mid - 1;           else             l = mid + 1;         } else if (ret == nnum[i] - i) {           add(mid, -1);           aa[mid] = -1;           len--;           break;         } else if (ret > nnum[i] - i)           r = mid - 1;         else if (ret < nnum[i] - i)           l = mid + 1;       }     }   }   void cal() {     int q = n;     len = 0;     int cnt = 1;     while (q--) {       int type;       cin >> type;       if (type == -1) {         if (len == 0) continue;         if (nnum[0] > len) continue;         int now = lower_bound(nnum, nnum + m, len) - nnum;         binary_find(now);       } else {         aa[cnt] = type;         add(cnt, 1);         cnt++;         len++;       }     }     if (len <= 0) {       puts( Poor stack! );       return;     }     for (int i = 1; i <= n; i++)       if (aa[i] != -1) printf( %d , aa[i]);     puts(  );   }   void output() {}   int main() {     while (true) {       init();       if (input()) return 0;       cal();       output();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int e, d, c, x, aux, aux2;   priority_queue<pair<long long int, long long int> > q;   void res(long long int n) {     long long int k = n;     e = 0;     d = 1;     while (k > 0) {       d = d * 10 + 1;       e++;       k = k / 10;     }     c = (d - 1) / 10;     if (c > n) {       d = c;       c = (d - 1) / 10;       e--;     }   }   void dis(long long v) {     q.push(make_pair(0, v));     aux = q.top().second;     while (aux != 0) {       res(aux);       aux2 = q.top().first;       q.pop();       if (d - aux < aux) q.push(make_pair(aux2 - (e + 1), d - aux));       q.push(make_pair(aux2 - e, aux - c));       aux = q.top().second;     }     x = q.top().first;   }   int main() {     long long int a;     cin >> a;     dis(a);     cout << x * -1 << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   int a[111111], b[111111], ra[111111];   set<pair<int, int> > s;   int main() {     ios::sync_with_stdio(false);     cin >> n;     for (int i = 0, _n = (int)(n); i < _n; i++) cin >> a[i], a[i]--, ra[a[i]] = i;     for (int i = 0, _n = (int)(n); i < _n; i++) cin >> b[i], b[i]--;     for (int i = 0, _n = (int)(n); i < _n; i++)       s.insert(pair<int, int>(ra[b[i]] - i, i));     for (int i = 0, _n = (int)(n); i < _n; i++) {       int ans = 999999;       auto x = s.upper_bound(pair<int, int>(-i, 0));       if (x != s.end()) ans = min(ans, abs(x->first + i));       if (x != s.begin()) x--, ans = min(ans, abs(x->first + i));       cout << ans << endl;       x = s.lower_bound(pair<int, int>(ra[b[i]] - i, i));       s.erase(x);       s.insert(pair<int, int>(x->first - n, i));     }     cout << endl;     {       int _;       cin >> _;     }     return 0;   }
#include <bits/stdc++.h>   int x[100010];   int main() {     int a, b, c, i;     scanf( %d%d%d , &a, &b, &c);     for (i = 1; i <= a; i++) scanf( %d , &x[i]);     int s = 0, t = 1;     long long int count = 0;     while (1) {       if (t > a && s == 0) {         printf( %I64d , count);         return 0;       }       while (t <= a && s + x[t] <= b) s += x[t], t++;       if (s < c) {         count++;         s = 0;       } else {         count += (s / c);         s = s % c;       }     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int n, t;     cin >> n >> t;     string s;     cin >> s;     for (long long int i = 0; i < t; i++) {       for (long long int j = 0; j < n - 1; j++) {         if (s[j] ==  B  && s[j + 1] ==  G ) {           s[j] =  G ;           s[j + 1] =  B ;           j = j + 1;         }       }     }     for (long long int i = 0; i < n; i++) {       cout << s[i];     }     cout << endl;     return 0;   }
#include <bits/stdc++.h>   const int inf = 0xfffffff;   const long long INF = 1ll << 61;   using namespace std;   int n, s, k;   int aa[100 + 55][100 + 55];   int ans;   void init() { memset(aa, 0, sizeof(aa)); }   bool input() {     while (scanf( %d %d %d , &n, &s, &k) == 3) {       for (int i = 0; i < n; i++)         for (int j = 0; j < s; j++) scanf( %d , &aa[i][j]);       return false;     }     return true;   }   void cal() {     ans = 11;     if (n < s) {       for (int i = 0; i < s; i++)         for (int j = i + 1; j < s; j++) swap(aa[i][j], aa[j][i]);       swap(n, s);     }     if (n <= k) {       for (int i = 0; i < (1 << s); i++) {         int sum = 0;         for (int j = 0; j < n; j++) {           int now = 0;           for (int l = 0; l < s; l++) {             if (i & (1 << l)) {               if (!aa[j][l]) now++;             } else {               if (aa[j][l]) now++;             }           }           sum += min(now, s - now);         }         ans = min(ans, sum);       }     } else {       for (int i = 0; i < n; i++) {         int sum = 0;         for (int j = 0; j < n; j++) {           int now = 0;           for (int l = 0; l < s; l++) {             if (aa[i][l] != aa[j][l]) now++;           }           sum += min(now, s - now);         }         ans = min(ans, sum);       }     }   }   void output() {     if (ans <= k)       cout << ans << endl;     else       puts( -1 );   }   int main() {     while (true) {       init();       if (input()) return 0;       cal();       output();     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int number;     cin >> number;     long long ans = number;     while (1) {       int x = 100000000;       for (int i = 2; i <= sqrt(number); i++) {         if (number % i == 0) {           x = min(x, i);         }       }       if (x == 100000000) break;       ans += number / x;       number = number / x;     }     cout << ans + 1;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int n, sum;     cin >> n;     long long int arr[n];     sum = 0;     for (long long int i = 0; i < n; i++) {       cin >> arr[i];       sum += arr[i];     }     sort(arr, arr + n);     long long int curr = 0;     long long int cnt = 0;     long long int ind = n - 1;     while (curr <= sum) {       ++cnt;       curr += arr[ind];       sum -= arr[ind];       --ind;     }     cout << cnt <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, s[1000005], t[1000005];   int bef[1000005][2];   long long ss, st, cs, ct;   bool sw;   int main() {     memset(bef, -1, sizeof(bef));     bef[0][0] = bef[0][1] = 0;     scanf( %d , &n);     for (int i = (1); i <= (n); i++) scanf( %d , &s[i]), ss += s[i];     for (int i = (1); i <= (n); i++) scanf( %d , &t[i]), st += t[i];     if (ss < st) {       swap(ss, st);       for (int i = (1); i <= (n); i++) swap(s[i], t[i]);       sw = true;     }     int p = 0;     for (int i = (1); i <= (n); i++) {       ct += t[i];       while (p < n && cs + s[p + 1] <= ct) cs += s[++p];       long long d = ct - cs;       assert(d >= 0 && d < n);       if (bef[d][0] == -1) {         bef[d][0] = p;         bef[d][1] = i;       } else {         if (sw) {           printf( %d n , i - bef[d][1]);           for (int j = (bef[d][1] + 1); j <= (i); j++)             printf( %d%c , j, j == i ?   n  :    );         }         printf( %d n , p - bef[d][0]);         for (int j = (bef[d][0] + 1); j <= (p); j++)           printf( %d%c , j, j == p ?   n  :    );         if (!sw) {           printf( %d n , i - bef[d][1]);           for (int j = (bef[d][1] + 1); j <= (i); j++)             printf( %d%c , j, j == i ?   n  :    );         }         return 0;       }     }   }
#include <bits/stdc++.h>   using namespace std;   const int M = 998244353;   int main() {     long long n;     cin >> n;     map<long long, long long> mp;     long long a[200005];     for (long long i = 0; i < n; i++) {       cin >> a[i];       mp[a[i]] = i;     }     long long ans = 1, w = mp[a[0]];     for (int i = 0; i < n; i++) {       if (i > w) {         ans = (ans * 2) % M;       }       w = max(w, mp[a[i]]);     }     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     int n;     cin >> n;     int ans = 0;     while (n % 3 == 0 || n % 6 == 0) {       if (n % 6 == 0) {         n /= 6;         ans++;       } else if (n % 3 == 0) {         n /= 3;         ans += 2;       }     }     if (n != 1) {       cout << -1 << endl;       return;     }     cout << ans << endl;   }   int main() {     int t = 1, i = 1;     cin >> t;     while (t--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long N = 1e5 + 9, inf = 1e18, mod = 1e9 + 7;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     int t;     cin >> t;     while (t--) {       int a, b, c, d, k;       cin >> a >> b >> c >> d >> k;       int x = (a + c - 1) / c;       int y = k - x;       if (y * d >= b)         cout << x <<     << y <<   n ;       else         cout << -1 <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       string str;       int j = 0;       cin >> str;       int len = str.length();       for (int i = 0; i < len - 1; i = i + 2) {         cout << str[i];       }       cout << str[len - 1];       cout << endl;     }     return 0;   }
#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);   }   long long mod = 1000000007;   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     long long t;     cin >> t;     while (t--) {       long long p, q;       cin >> p >> q;       std::vector<long long> factors;       long long r = p;       while (r % q == 0) {         r /= q;       }       long long Q = q;       long long i = 2;       while (q > 1 and i * i <= Q) {         if (q % i == 0) {           factors.push_back(i);           while (q % i == 0) {             q /= i;           }         }         i++;       }       if (q != 1) {         factors.push_back(q);       }       std::vector<long long> v;       for (auto it : factors) {         long long P = p;         while (P % Q == 0) {           P /= it;         }         v.push_back(P);       }       std::cout << *max_element(v.begin(), v.end()) <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int i, n, moves = 0, flag = 1, gears;     cin >> n;     cin >> gears;     moves = n - gears;     for (i = 1; i < n; i++) {       cin >> gears;       if (i % 2 == 1)         gears = (gears + (n - moves)) % n;       else         gears = (gears + moves) % n;       if (gears != i) {         cout <<  No  << endl;         return 0;       }     }     cout <<  Yes  << endl;     return 0;   }