malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   int days[200][12];   int v[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};   void swap(int &a, int &b) {     int t = a;     a = b;     b = t;   }   struct year {     int y;     int m;     int d;     bool operator>(year &next) {       if (this->y > next.y)         return true;       else if (this->y < next.y)         return false;       if (this->m > next.m)         return true;       else if (this->m < next.m)         return false;       return this->d > next.d;     }     void inc() {       if (++this->d >= days[this->y][this->m]) {         this->d = 0;         if (++this->m >= 12) {           this->m = 0;           ++this->y;         }       }     }   };   int main() {     for (int i = 0; i < 139; i++)       for (int j = 0; j < 12; j++) {         days[i][j] = v[j];         if (j == 1 && i % 4 == 0) days[i][1] = 29;       }     days[0][1] = 28;     year y[2];     for (int i = 0; i < 2; i++) {       scanf( %d:%d:%d , &y[i].y, &y[i].m, &y[i].d);       y[i].y -= 1900;       y[i].m--;       y[i].d--;     }     year *a, *b;     if (y[0] > y[1]) {       a = &y[1];       b = &y[0];     } else {       a = &y[0];       b = &y[1];     }     int cnt = 0;     while (a->y != b->y || a->m != b->m || a->d != b->d) {       a->inc();       cnt++;     }     printf( %d n , cnt);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, arr[100005], diff[100005], prv[100005];   bool flag[100005];   vector<int> a, d;   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; ++i) {       scanf( %d , arr + i);       flag[arr[i]] = 1;     }     for (int i = 1; i <= n; ++i) {       if (!flag[arr[i]]) continue;       if (prv[arr[i]] && !diff[arr[i]])         diff[arr[i]] = i - prv[arr[i]];       else if (prv[arr[i]] && diff[arr[i]] != i - prv[arr[i]])         flag[arr[i]] = 0;       prv[arr[i]] = i;     }     for (int i = 0; i < 100005; ++i)       if (flag[i]) a.push_back(i), d.push_back(diff[i]);     printf( %d n , a.size());     for (int i = 0; i < a.size(); ++i) printf( %d %d n , a[i], d[i]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long t, n, m;   long long pre[405][405], a[405][405], sum[405];   long long get(long long a, long long b, long long c) {     return pre[b][c] - pre[a - 1][c];   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     cin >> t;     while (t--) {       cin >> n >> m;       for (long long i = 1; i <= n; i++) {         for (long long j = 1; j <= m; j++) {           char f;           cin >> f;           a[i][j] = f -  0 ;           pre[i][j] = pre[i - 1][j] + a[i][j];         }       }       long long res = 1000000000000000000;       for (long long l = 1; l <= n - 4; l++) {         for (long long r = l + 4; r <= n; r++) {           long long mx = -1000000000000000000;           for (long long k = 1; k <= 3; k++)             sum[k] = sum[k - 1] + get(l + 1, r - 1, k) + (2 - a[l][k] - a[r][k]);           for (long long k = 4; k <= m; k++) {             sum[k] = sum[k - 1] + get(l + 1, r - 1, k) + (2 - a[l][k] - a[r][k]);             mx = max(mx, sum[k - 3] - (r - l - 1) + get(l + 1, r - 1, k - 3));             res = min(res, sum[k - 1] + (r - l - 1) - get(l + 1, r - 1, k) - mx);           }         }       }       cout << res <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   int read() {     int x = 0, f = 1;     char ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) {       x = x * 10 + ch - 48, ch = getchar();     }     return x * f;   }   bool vis[1000100];   int c[100];   int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }   int main() {     srand(time(0));     int n = read(), que = 60;     int l = 0, r = 1e9, op;     while (l <= r) {       int mid = (l + r) / 2;       que--;       printf( > %d n , mid);       fflush(stdout);       scanf( %d , &op);       if (op)         l = mid + 1;       else         r = mid - 1;     }     int mx = l;     for (int i = 1; i <= que && i <= n; i++) {       int p = rand() * rand() % n + 1;       while (vis[p]) p = rand() * rand() % n + 1;       vis[p] = 1;       printf( ? %d n , p);       fflush(stdout);       scanf( %d , &c[i]);     }     int N = min(que, n);     sort(c + 1, c + N + 1);     int g = mx - c[1];     for (int i = 2; i <= N; i++) {       if (c[i] == mx) continue;       g = gcd(g, mx - c[i]);       g = gcd(g, c[i] - c[i - 1]);     }     printf( ! %d %d n , mx - (n - 1) * g, g);     fflush(stdout);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int a[100002], b[100000];   int main() {     int n;     cin >> n;     set<pair<int, int> > c;     c.clear();     for (int i = 1; i <= n; i++) {       int x, y;       cin >> x >> y;       pair<int, int> a = make_pair(x, y);       c.insert(a);     }     n = 0;     set<pair<int, int> >::iterator j;     for (j = c.begin(); j != c.end(); j++) {       n++;       a[n] = (*j).first;       b[n] = (*j).second;     }     int ans = 0, max = -2000000000;     for (int i = 1; i <= n; i++) {       if (b[i] < max) ans++;       if (b[i] > max) max = b[i];     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   double x[1010], y[1010];   bool vis[1010];   int main() {     int n, cnt = 0;     double x0, y0;     scanf( %d%lf%lf , &n, &x0, &y0);     for (int i = 0; i < n; i++) {       scanf( %lf%lf , &x[i], &y[i]);     }     for (int i = 0; i < n; i++) {       double x1 = x[i], y1 = y[i];       if (vis[i])         continue;       else         cnt++;       vis[i] = 1;       for (int j = 0; j < n; j++) {         if (vis[j]) continue;         if (x1 == x0 && x[j] == x0)           vis[j] = 1;         else if (y1 == y0 && y[j] == y0)           vis[j] = 1;         else if (fabs((y[j] - y0) / (y1 - y0) - (x[j] - x0) / (x1 - x0)) < 1e-9)           vis[j] = 1;       }     }     printf( %d n , cnt);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int arr[2], x;     cin >> arr[0] >> arr[1] >> x;     vector<int> v;     int curr = 1;     if (x % 2 == 1) {       v.push_back(curr);       arr[curr]--;       curr ^= 1;       for (int i = 0; i < x; i++) {         v.push_back(curr);         arr[curr]--;         curr ^= 1;       }       if (arr[1] > 0) {         while (arr[1]--) {           cout <<  1 ;         }       }       for (int i = 0; i < v.size(); i++) cout << v[i];       if (arr[0] > 0) {         while (arr[0]--) cout <<  0 ;       }     } else {       if (arr[0] <= arr[1]) {         v.push_back(curr);         arr[curr]--;         curr ^= 1;         for (int i = 0; i < x; i++) {           v.push_back(curr);           arr[curr]--;           curr ^= 1;         }         if (arr[1] > 0) {           while (arr[1]--) cout <<  1 ;         }         for (int i = 0; i < v.size() - 1; i++) cout << v[i];         if (arr[0] > 0) {           while (arr[0]--) cout <<  0 ;         }         cout <<  1 ;       } else {         curr = 0;         v.push_back(curr);         arr[curr]--;         curr ^= 1;         for (int i = 0; i < x; i++) {           v.push_back(curr);           arr[curr]--;           curr ^= 1;         }         if (arr[0] > 0) {           while (arr[0]--) cout <<  0 ;         }         for (int i = 0; i < v.size() - 1; i++) cout << v[i];         if (arr[1] > 0) {           while (arr[1]--) cout <<  1 ;         }         cout <<  0 ;       }     }     cout << endl;   }
#include <bits/stdc++.h>      using namespace std;      #define ll long long   #define ld long double   #define pii pair <ll, ll>   #define mp make_pair      // const int inf = 1e9 + 111;   const int NMAX = 200111;   const int inf = 1e9 + 7;   const ld eps = 0.00000000001;   const ll mod = 1e9 + 7;      constexpr int64_t MOD = 998244353;      int main() {    cin.tie(0);    cout.tie(0);    cin.sync_with_stdio(0);    cout.sync_with_stdio(0);    cout << setprecision(20) << fixed;       int t;       cin >> t;       for (int i = 0; i < t; ++i) {           int n, k;           cin >> n >> k;           if (k < n) {               if (n % k == 0) {                   cout << 1 << endl;               } else {                   cout << 2 << endl;               }           } else {               cout << (k + n - 1) / n << endl;           }       }       return 0;   }
#include <bits/stdc++.h>   using namespace std;   char s[100050];   bool vis;   int main() {     scanf( %s , s + 1);     int len = strlen(s + 1);     if (len <= 2) {       printf( No n );       return 0;     }     for (int i = 1; i <= len - 2; i++) {       if (s[i] != s[i + 1] && s[i + 1] != s[i + 2] && s[i] != s[i + 2] &&           s[i] !=  .  && s[i + 1] !=  .  && s[i + 2] !=  . ) {         vis = 1;         break;       }     }     if (vis == 1)       printf( Yes n );     else       printf( No n );   }
#include <bits/stdc++.h>   using namespace std;   string s;   long long x;   long long mp[1 << 20];   vector<long long> vec;   long long trans[1 << 20][10];   long long dp[1005][12005];   int main(void) {     ios::sync_with_stdio(0);     cin.tie(0);     cin >> s;     long long n = s.size();     s =  #  + s;     cin >> x;     if (x == 1) {       long long ans = 0;       for (int i = 1; i <= n; i++) {         if (s[i] ==  1 ) ans++;       }       cout << ans << endl;       return 0;     }     long long X = 1 << x;     for (int i = 0; i < X; i++) {       mp[i] = -1;       if (!(i & 1)) continue;       for (int d = 1; d < x; d++) {         if (x % d) continue;         for (int j = 0; j < x; j++) {           if ((i & (1 << j)) && (i & (1 << (j + d)))) goto pass;         }       }       vec.push_back(i);       mp[i] = (int)vec.size() - 1;     pass:;     }     long long m = vec.size();     for (int i = 0; i < m; i++) {       for (int j = 1; j <= 9; j++) {         long long b = vec[i];         b <<= j;         for (int d = 1; d < x; d++) {           if (x % d) continue;           if (b & (1 << d)) {             b %= (1 << d);             break;           }         }         if (b & (1 << x)) {           trans[i][j] = -1;           continue;         }         b %= X;         b |= 1;         trans[i][j] = mp[b];       }     }     for (int i = 0; i <= n; i++) {       for (int j = 0; j < m; j++) {         dp[i][j] = 1e18;       }     }     dp[0][mp[1]] = 0;     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         (dp[i + 1][j]) = min((dp[i + 1][j]), (dp[i][j] + 1));         if (trans[j][s[i + 1] -  0 ] != -1)           (dp[i + 1][trans[j][s[i + 1] -  0 ]]) =               min((dp[i + 1][trans[j][s[i + 1] -  0 ]]), (dp[i][j]));       }     }     long long ans = 1e18;     for (int j = 0; j < m; j++) ans = min(ans, dp[n][j]);     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     std::ios_base::sync_with_stdio(false);     std::cin.tie(0);     std::cout.tie(0);     int t;     cin >> t;     while (t--) {       int n;       cin >> n;       vector<int> a(n), b(2 * n);       multiset<int> m;       for (size_t i = 0; i < 2 * n; ++i) m.insert(i + 1);       for (auto& i : a) {         cin >> i;         m.erase(i);       }       bool flg = true;       for (size_t i = 0; i < n; ++i) {         b[2 * i] = a[i];         auto it = upper_bound(m.begin(), m.end(), a[i]);         if (it == m.end()) {           flg = false;           cout << -1 << endl;           break;         }         b[2 * i + 1] = *it;         m.erase(*it);       }       if (!flg) continue;       for (auto& i : b) cout << i <<    ;       cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const double pi = acos(-1.0);   void solve() {     long long n;     cin >> n;     n = 2 * n;     long double dist, ang;     ang = (360 * 1.0) / (n * 1.0);     ang = ang / 2.0;     long double rad = ang / 180.0;     rad = rad * pi;     dist = tan(rad);     dist = 1.0 / dist;     cout << fixed << setprecision(10) << dist;     cout << endl;   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     long long t = 1;     cin >> t;     while (t--) solve();   }
#include <bits/stdc++.h>   using namespace std;   long long arr[100005], ans[2];   int main() {     int n, m;     scanf( %d%d , &n, &m);     for (int i = 0; i < n; i++) {       scanf( %lld , arr + i);     }     for (int sum = 1; sum <= m << 1; sum++) {       vector<int> vec = {0};       for (int i = 0; i < n; i++) {         vec.push_back(arr[i] % sum);       }       vec.push_back(sum - 1);       sort(vec.begin(), vec.end());       for (int i = n + 1, t = 0; i; i--, t ^= 1) {         int x = max(vec[i - 1], vec[n - t] / 2) + 1, y = min(vec[i], m);         int a = max(x, sum - y), b = min(y, sum - x);         if (a <= b) ans[t] += b - a + 1;       }     }     long long x = ((long long)m * m - ans[0] - ans[1]) / 2;     printf( %lld %lld %lld %lld n , x, x, ans[1], ans[0]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int BLOCK = 250;   const int N = 200100;   const int NB = BLOCK * N;   long long ans = 0ll;   int sm[NB + N], pf[N], n, pr[N];   string s;   int calc(int len, int kol) { return len / kol; }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cin >> s;     n = ((int)s.size());     pf[0] = 0;     for (int i = 1; i <= n; i++) pf[i] = pf[i - 1] + (s[i - 1] ==  1  ? 1 : 0);     for (int k = 1; k < BLOCK; k++) {       for (int i = 0; i <= n; i++) sm[k * pf[i] - i + N] = 0;       for (int i = 0; i <= n; i++) {         int cv = k * pf[i] - i + N;         ans += sm[cv];         sm[cv]++;       }     }     pr[0] = -1;     for (int i = 1; i <= n; i++) {       pr[i] = pr[i - 1];       if (s[i - 1] ==  1 ) pr[i] = i;     }     for (int r = 1; r <= n; r++) {       int i = r;       for (int it = 1; it <= 2 * BLOCK; it++) {         int nw = pr[i];         if (nw < 0) break;         i = nw - 1;         int l = max(0, pr[i]);         int cans = calc(r - l, it) - calc(r - i - 1, it);         int mn = (r - i) / it + bool((r - i) % it > 0);         int mx = (r - l) / it;         mx = min(mx, BLOCK - 1);         cans -= max(0, mx - mn + 1);         ans += cans;       }     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     if (n % 2) {       cout <<  YES  << endl;       for (int i = 1; i <= n; i++) {         if (i % 2)           cout << 2 * i - 1 <<    ;         else           cout << 2 * i <<    ;       }       for (int i = 1; i <= n; i++) {         if (i % 2)           cout << 2 * i <<    ;         else           cout << 2 * i - 1 <<    ;       }       cout << endl;     } else       cout <<  NO  << endl;     return 0;   }
#include <bits/stdc++.h>   inline long long read() {     long long x = 0, f = 1;     char c = getchar();     for (; c >  9  || c <  0 ; c = getchar()) {       if (c ==  - ) f = -1;     }     for (; c >=  0  && c <=  9 ; c = getchar()) {       x = x * 10 + c -  0 ;     }     return x * f;   }   int dp[200005];   int a[85], r[85];   inline void work() {     int n = read(), m = read();     dp[m + 1] = 0;     for (int i = 1; i <= n; i++) a[i] = read(), r[i] = read();     for (int i = m; i; i--) {       dp[i] = dp[i + 1] + 1;       for (int j = 1; j <= n; j++) {         if (a[j] >= i) {           if (a[j] - r[j] <= i) {             dp[i] = std::min(dp[i], dp[std::min(m + 1, a[j] + r[j] + 1)]);           } else {             dp[i] = std::min(                 dp[i], a[j] - r[j] - i + dp[std::min(m + 1, 2 * a[j] - i + 1)]);           }         } else {           if (a[j] + r[j] >= i) {             dp[i] = std::min(dp[i], dp[std::min(m + 1, a[j] + r[j] + 1)]);           }         }       }     }     printf( %d n , dp[1]);   }   int main() {     work();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 2e5 + 10, INF = 1e9;   struct event {     int pos, start, end, val, t, i;     event(int a, int b, int c, int d, int e, int f)         : pos(a), start(b), end(c), val(d), t(e), i(f){};   };   bool comp(event a, event b) {     if (a.pos != b.pos)       return a.pos < b.pos;     else       return a.t < b.t;   }   vector<event> vx, vy;   bool ok[MAXN];   int minx[MAXN], miny[MAXN];   int seg[4 * MAXN];   void clear(int i, int ini, int fim) {     seg[i] = 0;     if (ini == fim)       return;     else {       int mid = (ini + fim) / 2;       clear(i * 2, ini, mid);       clear(i * 2 + 1, mid + 1, fim);     }   }   void update(int i, int ini, int fim, int pos, int val) {     if (pos < ini || pos > fim)       return;     else {       if (ini == fim)         seg[i] = val;       else {         int mid = (ini + fim) / 2;         update(i * 2, ini, mid, pos, val);         update(i * 2 + 1, mid + 1, fim, pos, val);         seg[i] = min(seg[i * 2], seg[i * 2 + 1]);       }     }   }   int query(int i, int ini, int fim, int p, int q) {     if (ini >= p && fim <= q) return seg[i];     if (q < ini || p > fim)       return INF;     else {       int mid = (ini + fim) / 2;       return min(query(i * 2, ini, mid, p, q),                  query(i * 2 + 1, mid + 1, fim, p, q));     }   }   void print(int i, int ini, int fim) {     printf( i %d ini %d fim %d seg %d n , i, ini, fim, seg[i]);     if (ini != fim) {       int mid = (ini + fim) / 2;       print(i * 2, ini, mid);       print(i * 2 + 1, mid + 1, fim);     }   }   int main() {     int n, m, p, q;     scanf( %d %d %d %d , &n, &m, &p, &q);     for (int i = 0, a, b; i < p; i++) {       scanf( %d %d , &a, &b);       vx.push_back(event(a, 0, 0, b, 1, i));       vy.push_back(event(b, 0, 0, a, 1, i));     }     for (int i = 0, a, b, c, d; i < q; i++) {       scanf( %d %d %d %d , &a, &b, &c, &d);       vx.push_back(event(c, b, d, 0, 2, i));       vy.push_back(event(d, a, c, 0, 2, i));       minx[i] = a;       miny[i] = b;     }     sort(vx.begin(), vx.end(), comp);     sort(vy.begin(), vy.end(), comp);     clear(1, 1, max(m, n));     for (int i = 0; i < vx.size(); i++) {       if (vx[i].t == 1) {         update(1, 1, m, vx[i].val, vx[i].pos);       } else {         if (query(1, 1, m, vx[i].start, vx[i].end) >= minx[vx[i].i])           ok[vx[i].i] = 1;       }     }     clear(1, 1, max(m, n));     for (int i = 0; i < vy.size(); i++) {       if (vy[i].t == 1) {         update(1, 1, n, vy[i].val, vy[i].pos);       } else {         if (query(1, 1, n, vy[i].start, vy[i].end) >= miny[vy[i].i])           ok[vy[i].i] = 1;       }     }     for (int i = 0; i < q; i++) {       if (ok[i])         printf( YES n );       else         printf( NO n );     }   }
#include <bits/stdc++.h>   //---------------------------------------------------   #define l_int                       long long int   #define double                      long double   #define inf                         INT64_MAX   #define mod                         100000   #define fo(i,a,b)                   for(l_int i=a;i<b;i++)   //---------------------------------------------------   using namespace std;      int factorial(int n)   {       int ans=1;       while(n!=1)       {           ans*=n;           n--;       }       return ans;   }      int main()   {       ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);       int t,n,k;       cin >> t;       while(t--)       {           int n;           cin >> n;           int c=0;           char s[n];           for(int i=0 ; i< n ;i++)           {               cin >> s[i];           }           if(s[0]== 2  && s[1]== 0  && s[2]== 2  && s[3]== 0 )           {               c=1;           }           if(s[n-1]== 0  && s[n-2]== 2  && s[n-3]== 0  && s[n-4]== 2 )           {               c=1;           }           if(s[0]== 2  && s[n-3]== 0  && s[n-2]== 2  && s[n-1]== 0 )           {               c=1;           }           if(s[0]== 2  && s[1]== 0  && s[n-2]== 2  && s[n-1]== 0 )           {               c=1;           }           if(s[0]== 2  && s[1]== 0  && s[2]== 2  && s[n-1]== 0 )           {               c=1;           }           if(c==1)           {               cout <<  YES  << endl;           }else if(c==0)           {               cout <<  NO  << endl;           }       }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string s;     cin >> s;     int i = 0;     for (i = 0; i < s.length(); i++) {       if (s[i] ==  0 ) break;     }     if (i < s.length() - 1)       s = s.substr(0, i) + s.substr(i + 1);     else       s = s.substr(0, s.length() - 1);     cout << s << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const double eps = 1e-6;   int n, ans;   double a[2000];   struct Line {     double x, y, vx, vy;     void read() {       double t1, t2;       scanf( %lf%lf%lf%lf%lf%lf , &t1, &x, &y, &t2, &vx, &vy);       vx -= x;       vy -= y;       vx /= t2 - t1;       vy /= t2 - t1;       x -= t1 * vx;       y -= t1 * vy;     }   } line[2000];   struct point {     double x, y;     point() {}     point(double x, double y) : x(x), y(y) {}     double det(point res) { return x * res.y - y * res.x; }     bool operator<(const point& rhs) const {       if (abs(x * rhs.y - y * rhs.x) < eps) {         if (abs(x - rhs.x) < eps) return y < rhs.y;         return x < rhs.x;       } else         return x * rhs.y - y * rhs.x < 0;     }   } b[2000];   int main() {     scanf( %d , &n);     if (n) ans = 1;     for (int i = 1; i <= n; i++) line[i].read();     for (int id = 1; id <= n; id++) {       int tot = 0;       for (int j = 1; j <= n; j++)         if (id != j) {           double vx = line[j].vx - line[id].vx, vy = line[j].vy - line[id].vy;           double t = fabs(vx) > eps   ? (line[j].x - line[id].x) / vx                      : fabs(vy) > eps ? (line[j].y - line[id].y) / vy                                       : 0;           if (fabs(line[j].x - line[id].x - t * vx) <= eps &&               fabs(line[j].y - line[id].y - t * vy) <= eps)             a[++tot] = t, b[tot] = point(vx, vy);         }       sort(a + 1, a + 1 + tot);       int cnt = 0;       for (int i = 1; i <= tot; i++) {         if (i == 1 || a[i] - a[i - 1] >= eps)           cnt = 1;         else           cnt++;         ans = max(ans, cnt + 1);       }       sort(b + 1, b + tot + 1);       cnt = 0;       for (int i = 1; i <= tot; i++) {         if (i == 1 || fabs(b[i].det(b[i - 1])) > eps)           cnt = 1;         else if (fabs(b[i].x - b[i - 1].x) > eps ||                  fabs(b[i].y - b[i - 1].y) > eps)           cnt++;         ans = max(ans, cnt + 1);       }     }     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     string s;     cin >> s;     int cnt = 0;     for (int i = 0; i < n; i += 2) {       if (s[i] == s[i + 1]) {         cnt++;         if (s[i] ==  a )           s[i] =  b ;         else           s[i] =  a ;       }     }     cout << cnt << endl << s;     return 0;   }