malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int INF = 1e9;   const int MX = 1e6 + 5;   long long MD = 1e9 + 7;   const int MDL = 99824453;   auto time0 = chrono::high_resolution_clock::now();   long long a[MX], LPF[MX];   long long bin_power(long long a, long long b, long long md) {     long long res = 1;     while (b) {       if (b & 1) res = (res * a) % md;       a = (a * a) % md;       b >>= 1;     }     return res;   }   long long lcm(long long n) {     map<long long, long long> mp;     for (long long i = 1; i <= n; i++) {       long long cur = a[i], curf = LPF[cur], cnt = 0;       while (cur > 1) {         cur /= LPF[cur];         cnt++;         if (LPF[cur] != curf) {           mp[curf] = max(mp[curf], cnt);           curf = LPF[cur];           cnt = 0;         }       }     }     long long ans = 1;     for (auto x : mp) ans = (ans * bin_power(x.first, x.second, MD)) % MD;     return ans;   }   void solve() {     long long n, k;     cin >> n >> k;     if (k == 1) {       cout <<  Yes ;       return;     }     bool flag = false;     for (long long i = 1; i <= n; i++) cin >> a[i];     MD = k;     long long L = lcm(n);     if (L != 0)       cout <<  No ;     else       cout <<  Yes ;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     srand(time(0));     time0 = chrono::high_resolution_clock::now();     for (long long i = 1; i <= MX - 1; i++) LPF[i] = i;     for (long long i = 2; i <= MX - 1; i++) {       if (LPF[i] == i) {         for (int j = 2 * i; j < MX; j += i)           if (LPF[j] == j) LPF[j] = i;       }     }     solve();     cerr <<  Execution Time:            << chrono::duration_cast<chrono::nanoseconds>(                 chrono::high_resolution_clock::now() - time0)                     .count() *                 1e-9          <<   sec n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     char no[20];     cin >> no;     int len = strlen(no);     int ans = (1 << len) - 2;     for (int i = (len - 1), pos = 0; i >= 0; i--, pos++) {       if (no[i] ==  7 ) ans += (1 << pos);     }     cout << ans + 1 << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   inline void Read(int &x) {     int f = 1;     char c = getchar();     x = 0;     while (c <  0  || c >  9 ) {       if (c ==  - ) f = -1;       c = getchar();     }     while (c >=  0  && c <=  9 ) {       x = (x << 3) + (x << 1) + c -  0 ;       c = getchar();     }     x *= f;   }   const int p = 1000000007;   int n, m;   inline int Pow(int a, int b) {     int res = 1;     while (b) {       if (b & 1) res = 1ll * a * res % p;       a = 1ll * a * a % p, b >>= 1;     }     return res;   }   int main() {     Read(n), Read(m);     cout << 1ll * Pow(2, m) * Pow(n + 1, m - 1) % p * (n - m + 1) % p << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int t;     cin >> t;     while (t--) {       long long int minu = 1, temp = 0, n, ans = 0;       cin >> n;       ans = ((n) * (n + 1)) / 2;       while (minu <= n) {         temp += minu;         minu *= 2;       }       ans -= (2 * temp);       cout << ans <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T>   void dbg(T t) {     cerr << t << endl;   }   template <typename T, typename... Args>   void dbg(T t, Args... args) {     cerr << t <<    ;     dbg(args...);   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     int n, a, spec = 3;     int t[2] = {1, 2};     cin >> n;     for (int i = 0; i < n; i++) {       cin >> a;       if (spec == a) {         cout <<  NO  << endl;         return 0;       }       for (int j = 0; j < 2; j++)         if (t[j] != a) swap(t[j], spec);     }     cout <<  YES  << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   int main() {     ios::sync_with_stdio(false);     cin.tie(nullptr);     cout.tie(nullptr);     string str;     cin >> str;     int n = str.size();     vector<int> arr(26, 1e8);     for (int i = 0; i < n; i++) {       arr[str[i] -  0  - 49] = min(arr[str[i] -  0  - 49], i);     }     cout <<  Mike n ;     bool ch = true;     for (int i = 1; i < n; i++) {       for (int j = 0; j < str[i] -  0  - 49; j++) {         ch = false;         if (arr[j] < i) {           cout <<  Ann n ;           break;         }         if (j == str[i] -  0  - 50) {           cout <<  Mike n ;         }       }       if (ch) {         cout <<  Mike n ;       }       ch = true;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long power(long long b, long long e) {     long long p = 1;     while (e > 0) {       if (e & 1) {         p = (p * b) % 1000000007;       }       e = e >> 1;       b = (b * b) % 1000000007;     }     return p;   }   vector<string> num;   string s, s1;   int main() {     long long n, i, t, x = 0, j, m, c, q, ans = 0, l;     scanf( %lld , &n);     cin >> s;     for (i = 0; i < 10; i++) {       for (j = 0; j < n; j++) {         s1 = s;         for (l = 0; l < n; l++) {           s1[l] = (char)((s[(l + j) % n] - 48 + i) % 10 + 48);         }         num.push_back(s1);       }     }     sort((num).begin(), (num).end());     cout << num[0] <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<long long> ydidicreate;   int dontknowy[100000];   int main() {     int tt;     cin >> tt;     while (tt--) {       int n, k;       cin >> n >> k;       int a[n];       for (int i = 0; i < n; i++) cin >> a[i];       ;       sort(a, a + n);       int f[k];       for (int i = 0; i < k; i++) cin >> f[i];       ;       sort(f, f + k);       long long ans = 0;       int l = n - 1, m = 0;       int pos;       for (int i = 0; i < k; i++) {         if (f[i] == 1) {           ans += (2 * a[l]);           l--;         } else {           pos = i;           break;         }       }       for (int i = k - 1; i >= 0; i--) {         if (f[i] == 1) break;         ans += a[l];         l--;         ans += a[m];         m++;         f[i] -= 2;         while (f[i]--) {           m++;         }       }       cout << ans <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e6 + 10;   const long long mm = 1e9 + 7;   int ch[maxn][27], fail[maxn];   long long cnt[maxn];   long long s[maxn], len[maxn];   int slink[maxn];   int dif[maxn];   char sp[maxn];   long long g[maxn];   int last, sz, n;   int newnode(int x) {     for (int i = 0; i < 26; ++i) {       ch[sz][i] = 0;     }     cnt[sz] = 0;     len[sz] = x;     return sz++;   }   void init() {     sz = 0;     newnode(0);     newnode(-1);     last = 0, n = 0;     fail[0] = 1;     fail[1] = 0;     s[0] = -1;   }   int getfail(int u) {     while (s[n - len[u] - 1] != s[n]) u = fail[u];     return u;   }   int pos[maxn];   void add(int c) {     s[++n] = c;     int u = getfail(last);     if (!ch[u][c]) {       int np = newnode(len[u] + 2);       fail[np] = ch[getfail(fail[u])][c];       ch[u][c] = np;       dif[np] = len[np] - len[fail[np]];       if (dif[np] == dif[fail[np]]) {         slink[np] = slink[fail[np]];       } else         slink[np] = fail[np];     }     last = ch[u][c];     pos[last] = n;     cnt[last]++;   }   void count() {     for (int i = sz - 1; i >= 0; --i) {       cnt[fail[i]] += cnt[i];     }   }   long long dp[maxn];   char dsp[maxn];   int main() {     init();     dsp[0] =  a ;     scanf( %s , dsp + 1);     int le = strlen(dsp + 1);     int j = 0;     for (int i = 1; i <= le; ++i) {       sp[++j] = dsp[i];       sp[++j] = dsp[le - i + 1];     }     dp[0] = 1;     for (int i = 1; i <= le; ++i) {       add(sp[i] -  a );       for (int j = last; j >= 2; j = slink[j]) {         g[j] = dp[i - len[slink[j]] - dif[j]];         if (dif[j] == dif[fail[j]]) g[j] = (g[j] % mm + g[fail[j]] % mm) % mm;         if (i % 2 == 0) dp[i] = (dp[i] % mm + g[j] % mm) % mm;       }     }     cout << dp[n] << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     vector<vector<long long>> a;     bool tr = true;     for (long long l, r, i = 0; i < n; i++) {       cin >> l >> r;       a.push_back({l, r});     }     sort(a.begin(), a.end(),          [](const vector<long long>& a, const vector<long long>& b) -> bool {            if (a[0] == b[0]) {              return a[1] < b[1];            } else {              return a[0] < b[0];            }          });     long long f = -1, s = -1;     for (long long i = 0; i < n; i++) {       if (tr && a[i][0] > f) {         f = a[i][1];       } else if (tr && a[i][0] > s) {         s = a[i][1];       } else {         tr = false;       }     }     if (tr) {       cout <<  YES  << endl;     } else {       cout <<  NO  << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long cdiv(long long a, long long b) {     return a / b + ((a ^ b) > 0 && a % b);   }   long long fdiv(long long a, long long b) {     return a / b - ((a ^ b) < 0 && a % b);   }   void solve() {     long long int n;     cin >> n;     vector<long long int> v(n);     map<long long int, long long int> mp;     for (long long int i = 0; i < n; i++) {       long long int x;       cin >> x;       v[i] = x % 3;       mp[v[i]]++;     }     long long int ans = mp[0];     long long int c = min(mp[1], mp[2]);     ans = ans + c;     mp[1] = mp[1] - c;     mp[2] = mp[2] - c;     ans = ans + mp[1] / 3 + mp[2] / 3;     cout << ans;     cout << endl;   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long int t = 1;     cin >> t;     while (t--) solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 100005;   int a[N];   int main() {     int n;     long long sum = 0;     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %d , &a[i]);       sum += a[i] - 1;       if (sum % 2 == 1)         printf( 1 n );       else         printf( 2 n );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int OO = 1e8 + 10;   const int MOD = 1e9 + 7;   const int MAX = 2e5 + 1;   const double EPS = (1e-9);   map<int, bool> mp;   int main() {     int n, x, y, l, last, ans;     bool f1 = 0, f2 = 0, f3 = 0;     cin >> n >> l >> x >> y;     for (int i = 0; i < n; i++) {       int a;       cin >> a;       mp[a] = 1;     }     for (auto it = mp.begin(); it != mp.end(); it++) {       if (mp.count(it->first + (x - y)) && it->first + x <= l)         f3 = 1, ans = it->first + x;       if (mp.count(it->first - (x - y)) && it->first - x >= 0)         f3 = 1, ans = it->first - x;       if (mp.count(it->first + x + y)) f3 = 1, ans = it->first + x;       if (mp.count(it->first + x)) f1 = 1;       if (mp.count(it->first + y)) f2 = 1;     }     if (f1 && f2) return cout <<  0 n , 0;     if (f3) return cout <<  1 n  << ans <<   n , 0;     if (f1) return cout <<  1 n  << y <<   n , 0;     if (f2) return cout <<  1 n  << x <<   n , 0;     return cout <<  2 n  << x <<     << y <<   n , 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e6 + 100;   int vis[N];   int p[N];   int sum[N];   int main() {     int t = 0;     for (int i = 2; i <= 1000010; i++) {       if (vis[i] == 0) p[++t] = i;       for (int j = 1; j <= t && (i * p[j] <= 1000010); j++) {         vis[i * p[j]] = 1;         if (i % p[j] == 0) {           break;         }       }     }     for (int i = 1; i <= 1000010; i++) {       if (vis[i] == 0) {         sum[i] = 1 + sum[i - 1];       } else {         sum[i] = sum[i - 1];       }     }     int k;     scanf( %d , &k);     while (k--) {       double n;       scanf( %lf , &n);       int q = (int)n;       int w = (int)sqrt(n);       printf( %d n , sum[q] - sum[w] + 1);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int a[110000], b[110000];   struct Node {     int a, b;   } node[110000];   int main() {     int i, j, h;     int n, m, T;     int cas = 1;     int x, y;     while (scanf( %d%d%d%d , &n, &m, &x, &y) != EOF) {       for (i = 1; i <= n; i++) {         scanf( %d , &a[i]);       }       for (j = 1; j <= m; j++) {         scanf( %d , &b[j]);       }       int k = 0;       for (i = 1, j = 1; i <= n && j <= m; i++) {         if (b[j] - y > a[i]) continue;         while (b[j] + x < a[i] && j <= m) {           j++;         }         if (j > m) break;         if (b[j] - y <= a[i]) {           k++;           node[k].a = i;           node[k].b = j;           j++;         }       }       printf( %d n , k);       for (i = 1; i <= k; i++) {         printf( %d %d n , node[i].a, node[i].b);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long MOD = 1e9 + 7;   const long long N = 2e5 + 5;   const long long INF = (1LL << 62);   const long double pi = 3.14159265359;   void SRAND() {     auto duration = std::chrono::system_clock::now().time_since_epoch();     auto millis =         std::chrono::duration_cast<std::chrono::milliseconds>(duration).count();     srand(millis);   }   long long n, k, u[N], p[N], ans, x, y;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cin >> n >> k;     for (long long i = 1; i <= n; i++) cin >> u[i];     for (long long i = n; i >= 1; i--) {       p[i] = (u[i] == 1 ? p[i + 1] + 1 : 0);     }     for (long long i = 1; i <= n; i++) {       x = u[i];       y = u[i];       if (x == y * k) ans++;       for (long long j = i + 1; j <= n; j++) {         if (u[j] == 1) {           if (x % k == 0 && (x - k * y) / k >= 1 && (x - k * y) / k <= p[j])             ans++;           y += p[j];           j += p[j] - 1;           continue;         }         if (x >= INF / u[j]) break;         x *= u[j];         y += u[j];         if (x == y * k) ans++;       }     }     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long f(vector<int> x, int k) {     long long ret = 0;     sort(x.begin(), x.end());     for (int i = x.size() - 1; i >= 0; i -= k) {       ret += x[i] * 2;     }     return ret;   }   void solve() {     int n, k, mx = 0;     cin >> n >> k;     vector<int> x(n), a, b;     for (int i = 0; i < n; i++) {       cin >> x[i];       mx = max(mx, abs(x[i]));       if (x[i] < 0)         a.push_back(-x[i]);       else         b.push_back(x[i]);     }     cout << f(a, k) + f(b, k) - mx << endl;   }   int main() {     int tt = 1;     cin >> tt;     while (tt--) solve();   }
#include <bits/stdc++.h>   using namespace std;   struct cube {     int ind, val, h;   };   int rcount[101];   int compare1(cube a, cube b) { return a.val < b.val; }   int compare2(cube a, cube b) { return a.ind < b.ind; }   int main() {     int n;     scanf( %d , &n);     vector<cube> v;     vector<int> one, two;     for (int i = 0; i < n * 2; i++) {       cube c;       c.ind = i;       c.h = 0;       scanf( %d , &c.val);       v.push_back(c);     }     sort(v.begin(), v.end(), compare1);     int size1 = 0, size2 = 0, color = 1, repeat = 0, repeatcount = 0;     for (int i = 0; i < n * 2; i++) {       v[i].h = 0;       if (repeatcount >= 2 && repeat == v[i].val)         rcount[v[i].val]++;       else {         if (repeat == v[i].val)           repeatcount++;         else           repeatcount = 1;         repeat = v[i].val;         color *= -1;         v[i].h = color;         if (color < 0)           size1++;         else           size2++;       }     }     printf( %d n , size1 * size2);     sort(v.begin(), v.end(), compare2);     for (int i = 0; i < n * 2; i++) {       if (v[i].h == 0) {         if (size1 > size2) {           v[i].h = 1;           size2++;         } else {           v[i].h = -1;           size1++;         }       }       printf( %d  , (v[i].h < 0) ? 1 : 2);     }     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize( fast-math )   #pragma GCC optimize( Ofast )   #pragma GCC optimize( unroll-loops )   #pragma GCC diagnostic ignored  -Woverflow    using namespace std;   const short INF16 = ~(1 << 15);   const int INF32 = 2e9 + 11;   const int SZ = 4e5 + 11;   const int SZ2 = int(1e6 + 11);   const int mod = 998244353;   const int mod2 = 998244353;   const int PIVO = 2e5 + 11;   const long long INF64 = 8e18;   const long long P1 = 53;   const long long P2 = 47;   const long double eps = 1e-10;   const long double PI = acosl(-1);   inline long long MOD(long long x) {     x %= mod, x += mod;     return x % mod;   }   inline long long MOD(long long x, long long m) {     x %= m, x += m;     return x % m;   }   inline long long T(int x) { return 1ll * x * (x + 1) >> 1; }   inline long long TT(int x) { return 1ll * x * (x + 1) * (x + 2) / 6; }   inline long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }   inline long long lcm(long long a, long long b) { return a * b / gcd(a, b); }   long long fpow(long long a, long long b, long long mod) {     if (!b) return 1;     if (b == 1) return a % mod;     if (b & 1) return fpow(a, b ^ 1, mod) * a % mod;     long long d = fpow(a, b >> 1, mod);     return d * d % mod;   }   long long fpow(long long a, long long b) {     if (!b) return 1;     if (b == 1) return a;     if (b & 1) return fpow(a, b ^ 1) * a;     long long d = fpow(a, b >> 1);     return d * d;   }   void Solve(int num_test) {     int n, m;     cin >> n >> m;     vector<int> a(n), b(m);     vector<vector<int>> kek(n);     for (int &i : a) cin >> i;     for (int &i : b) cin >> i;     for (int i = 0; i < n; i++)       for (int j : b) kek[i].push_back(a[i] & j);     for (int mask = 0; mask < (1 << 9); mask++) {       bool ny = 1;       for (int i = 0; i < n; i++) {         bool loc = 0;         for (int x : kek[i])           if ((mask | x) == mask) {             loc = 1;             break;           }         if (!loc) {           ny = 0;           break;         }       }       if (ny) {         cout << mask << endl;         return;       }     }   }   signed main() {     ios_base::sync_with_stdio(NULL);     cin.tie(NULL);     cout.tie(NULL);     cout << fixed << setprecision(10);     srand(time(NULL));     int test = 1;     for (int i = 1; i <= test; i++) Solve(i);   }
#include <bits/stdc++.h>   namespace chtholly {   char buf[1 << 23], *p1 = buf, *p2 = buf;   inline int read() {     int x = 0, f = 1;     char c = getchar();     for (; !isdigit(c); c = getchar()) f ^= c ==  - ;     for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + (c ^  0 );     return f ? x : -x;   }   template <typename mitsuha>   inline bool read(mitsuha &x) {     x = 0;     int f = 1;     char c = getchar();     for (; !isdigit(c) && ~c; c = getchar()) f ^= c ==  - ;     if (!~c) return 0;     for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + (c ^  0 );     return x = f ? x : -x, 1;   }   template <typename mitsuha>   inline int write(mitsuha x) {     if (!x) return 0 & putchar(48);     if (x < 0) putchar( - ), x = -x;     int bit[20], i, p = 0;     for (; x; x /= 10) bit[++p] = x % 10;     for (i = p; i; --i) putchar(bit[i] + 48);     return 0;   }   inline char fuhao() {     char c = getchar();     for (; isspace(c); c = getchar())       ;     return c;   }   }  // namespace chtholly   using namespace chtholly;   using namespace std;   const int yuzu = 2e5, mod = 1e9 + 7;   typedef long long rize[yuzu | 10];   rize a[115], jic = {1}, inv;   namespace quick {   long long kasumi(long long a, long long b = mod - 2) {     long long s = 1;     for (; b; b >>= 1, a = a * a % mod)       if (b & 1) s = s * a % mod;     return s;   }   void add(long long &a, long long b) {     if ((a += b) >= mod) a -= mod;   }   void sub(long long &a, long long b) {     if ((a -= b) < 0) a += mod;   }   long long zuhe(int n, int m) {     return jic[n] * inv[m] % mod * inv[n - m] % mod;   }   }  // namespace quick   using namespace quick;   void preget(int n, int i = 1) {     for (; i <= n; ++i) jic[i] = jic[i - 1] * i % mod;     inv[n] = kasumi(jic[n]);     for (i = n - 1; ~i; --i) inv[i] = inv[i + 1] * (i + 1) % mod;   }   int main() {     int i, j, n, m, l, r, k;     read(n), read(m), preget(yuzu);     static rize p;     for (i = 1; i <= n; ++i) p[i] = read();     for (i = 1; i <= m; ++i) {       l = read(), r = read(), k = read();       add(a[k][l], 1);       for (j = 0; j <= k; ++j) sub(a[j][r + 1], zuhe(k - j + r - l, k - j));     }     for (i = 100; ~i; --i)       for (j = 1; j <= n; ++j)         a[i][j] = (a[i][j] + a[i + 1][j] + a[i][j - 1]) % mod;     for (i = 1; i <= n; ++i) write((a[0][i] + p[i]) % mod), putchar(   );   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 102;   int ar[maxn], ans;   int main() {     int n;     cin >> n;     n = 2 * n;     for (int i = 1; i <= n; i++) cin >> ar[i];     for (int i = 1; i <= n; i++)       if (ar[i - 1] != ar[i] && ar[i + 1] != ar[i]) {         int j = i + 1;         while (ar[j] != ar[i] && j <= n) j++;         for (int o = j; o > i + 1; o--) swap(ar[o], ar[o - 1]), ans++;       }     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     string s;     cin >> s;     char mn =  z ;     for (auto c : s) {       if (c <= mn)         cout <<  Mike n ;       else         cout <<  Ann n ;       mn = min(mn, c);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, k;   int main() {     scanf( %d %d , &n, &k);     int w = 240 - k;     int ans = 0;     for (int i = 1; i <= n; i++) {       if (i * 5 <= w) {         w -= i * 5;         ans++;       }     }     printf( %d n , ans);   }
#include <bits/stdc++.h>   using namespace std;   int v[26];   int main() {     int n;     int i;     int j;     scanf( %d , &n);     char s[1005];     getchar();     gets(s);     char t[30];     memset(v, 0, sizeof(v));     int len = strlen(s);     if (len % n != 0)       cout << -1 << endl;     else {       for (i = 0; i < len; i++) {         v[s[i] -  a ]++;       }       for (i = 0; i < 26; i++) {         if (v[i] % n != 0) break;       }       int pp = n;       int kk;       if (i == 26) {         while (pp--) {           for (i = 0; i < 26; i++) {             if (v[i] != 0) {               kk = v[i] / n;               while (kk--) printf( %c , i +  a );             }           }         }         cout << endl;       } else         cout << -1 << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   long long arr[1001], ans;   string s;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> s;     for (int i = 0; i < s.size(); i++) {       if (s[i] ==  0 ) arr[i]++;     }     cin >> s;     for (int i = 0; i < s.size(); i++) {       if (s[i] ==  0 ) arr[i]++;     }     for (int i = 0; i < s.size(); i++) {       if (arr[i] == 2) {         if (arr[i + 1] > 0) {           arr[i + 1]--;           arr[i] = 0;           ans++;         }       } else if (arr[i] == 1) {         if (arr[i + 1] == 2) {           arr[i + 1] = 0;           arr[i] = 0;           ans++;         }       }     }     printf( %I64d , ans);   }
#include <bits/stdc++.h>   using namespace std;   string minEqui(string s) {     int n = s.size();     if (n % 2 == 1)       return s;     else {       string s1 = minEqui(s.substr(0, n / 2)),              s2 = minEqui(s.substr(n / 2, n / 2));       if (s1 < s2)         return s1 + s2;       else         return s2 + s1;     }   }   int main() {     string s1, s2;     cin >> s1;     cin >> s2;     if (minEqui(s1) == minEqui(s2))       cout <<  YES n ;     else       cout <<  NO n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, i;     cin >> n;     string s;     cin >> s;     if (n == 24) {       if (s[0] ==  2  && s[1] >  3 ) {         s[0] =  1 ;       } else if (s[0] >  2 ) {         s[0] =  1 ;       }     } else {       if (s[0] ==  1  && s[1] >  2 ) {         s[0] =  0 ;       } else if (s[0] ==  0  && s[1] ==  0 ) {         s[1] =  1 ;       } else if (s[0] >  1 ) {         if (s[1] ==  0 )           s[0] =  1 ;         else           s[0] =  0 ;       }     }     if (s[3] >  5 ) {       s[3] =  1 ;     }     cout << s;     return 0;   }