malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long n, i, j;     cin >> n;     map<long long, long long> mp, cp;     vector<long long> v(n);     for (i = 0; i < n; i++) {       cin >> v[i];       mp[v[i]]++;     }     map<long long, long long>::iterator it;     for (it = mp.begin(); it != mp.end(); it++) {       cp[it->second]++;     }     if (cp.find(1) == cp.end() || cp[1] % 2 == 0) {       long long cnt = 0;       cout <<  YES  << endl;       for (i = 0; i < n; i++) {         if (mp[v[i]] == 1) {           if (cnt < cp[1] / 2) {             cout <<  A ;           } else             cout <<  B ;           cnt++;         } else           cout <<  A ;       }     } else {       if (cp[1] + 2 * cp[2] == n) {         cout <<  NO ;       } else {         cout <<  YES  << endl;         long long cnt = 0, t = 1;         for (i = 0; i < n; i++) {           if (mp[v[i]] == 1) {             if (cnt < (cp[1] + 1) / 2) {               cout <<  A ;             } else {               cout <<  B ;             }             cnt++;           } else if (mp[v[i]] == 2) {             cout <<  A ;           } else {             if (t == 1) {               cout <<  B ;               t++;             } else {               cout <<  A ;             }           }         }       }     }   }
#include <bits/stdc++.h>   using namespace std;   int a[10][10], b[5010], c[51];   string s[110][110];   int main() {     int maxx = 0;     int summ = 0;     for (int i = 0; i < 3; i++) {       for (int j = 0; j < 3; j++) {         cin >> a[i][j];         summ = summ + a[i][j];       }     }     a[1][1] = summ / 6;     int x = a[1][1] + a[1][0] + a[1][2];     a[2][2] = abs(x - a[0][2] - a[1][2]);     a[0][0] = abs(x - a[2][2] - a[1][1]);     cout << endl;     for (int i = 0; i < 3; i++) {       for (int j = 0; j < 3; j++) {         cout << a[i][j] <<    ;       }       cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MOD = 1E9 + 9;   int n, m, ans, cntNode(1),       root(1), f[200], dp[1005][105][13], vis[1005][105][13];   string s;   struct Trie {     int son[4], fail, len;     Trie() {       for (int i = 0; i < 4; i++) son[i] = 0;       fail = len = 0;     }   } tr[105];   void add(int& a, int b) { a = (a + b) % MOD; }   void insert(string& s) {     int cur = root;     for (int i = 0; i < s.size(); i++) {       if (!tr[cur].son[f[s[i]]]) tr[cur].son[f[s[i]]] = ++cntNode;       cur = tr[cur].son[f[s[i]]];     }     tr[cur].len = s.size();   }   void getFail() {     queue<int> Q;     Q.push(root);     tr[root].fail = root;     while (!Q.empty()) {       int now = Q.front();       Q.pop();       tr[now].len = max(tr[now].len, tr[tr[now].fail].len);       for (int i = 0; i < 4; i++) {         if (tr[now].son[i]) {           tr[tr[now].son[i]].fail = now != root ? tr[tr[now].fail].son[i] : root;           Q.push(tr[now].son[i]);         } else           tr[now].son[i] =               tr[tr[now].fail].son[i] ? tr[tr[now].fail].son[i] : root;       }     }   }   void DP() {     queue<tuple<int, int, int> > Q;     dp[0][1][0] = 1;     Q.push(make_tuple(0, 1, 0));     while (!Q.empty()) {       int len = get<0>(Q.front());       int node = get<1>(Q.front());       int last = get<2>(Q.front());       Q.pop();       if (len == n) {         if (!last) add(ans, dp[len][node][last]);         continue;       }       vis[len][node][last] = 0;       for (int i = 0; i < 4; i++) {         int to = tr[node].son[i];         int tmp = tr[to].len > last ? 0 : last + 1;         if (tmp > 10) continue;         add(dp[len + 1][to][tmp], dp[len][node][last]);         if (!vis[len + 1][to][tmp]) {           vis[len + 1][to][tmp] = 1;           Q.push(make_tuple(len + 1, to, tmp));         }       }     }     return;   }   signed main() {     ios::sync_with_stdio(false);     cin >> n >> m;     f[ A ] = 0, f[ T ] = 1, f[ C ] = 2, f[ G ] = 3;     for (int i = 1; i <= m; i++) cin >> s, insert(s);     getFail();     DP();     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T, typename U>   T pow_mod(T a, U b, int mod) {     T r = 1;     for (; b > 0; b >>= 1) {       if (b & 1) r = (long long)r * a % mod;       a = (long long)a * a % mod;     }     return r;   }   namespace combinatorics {   const int mod = 1e9 + 7, N = 2e3 + 5;   int fac[N], ifac[N];   void init() {     fac[0] = ifac[0] = 1;     for (int i = 1; i < N; ++i) {       fac[i] = (long long)fac[i - 1] * i % mod;       ifac[i] = pow_mod(fac[i], mod - 2, mod);     }   }   int comb(int n, int k) {     return (long long)fac[n] * ifac[n - k] % mod * ifac[k] % mod;   }   }  // namespace combinatorics   using namespace combinatorics;   int main() {     ios_base::sync_with_stdio(0), cin.tie(0);     init();     int t = 1;     while (t--) {       int n, x, p;       cin >> n >> x >> p;       vector<int> a(n), c(2);       a[p] = 1;       auto f = [&]() {         int l = 0, r = n;         while (l < r) {           int m = (l + r) >> 1;           if (m <= p) {             c[0] += a[m] == 0;             a[m] = -1;             l = m + 1;           } else {             c[1] += a[m] == 0;             a[m] = +1;             r = m;           }         }       };       f();       int ans = 0;       if (n - x >= c[1] && x - 1 >= c[0])         ans = (long long)comb(n - x, c[1]) * comb(x - 1, c[0]) % mod *               fac[n - 1 - c[0] - c[1]] % mod * fac[c[0]] % mod * fac[c[1]] % mod;       cout << ans <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   char opt;   long long a, b, c, ansa, ansb, ansc, anslen = 15;   void dfs(long long a, long long b, long long c, long long nowa, long long nowb,            int pre, long long len, long long step) {     if (len >= anslen) return;     if (!a && !b && !c && !pre) {       ansa = nowa, ansb = nowb, anslen = len;       return;     }     if (!c) {       long long tmp = a + b + pre;       int cnt = 0;       while (tmp) cnt++, tmp /= 10;       dfs(0, 0, 0, nowa + step * a, nowb + step * b, 0, len + cnt, step);       return;     }     if ((a + b + pre) % 10 == c % 10) {       dfs(a / 10, b / 10, c / 10, nowa + step * (a % 10), nowb + step * (b % 10),           (a % 10 + b % 10 + pre) / 10, len, step * 10);       return;     }     dfs(a * 10 + (c + 10 - b % 10 - pre) % 10, b, c, nowa, nowb, pre, len + 1,         step);     dfs(a, b * 10 + (c + 10 - a % 10 - pre) % 10, c, nowa, nowb, pre, len + 1,         step);     dfs(a, b, c * 10 + (a + b + pre) % 10, nowa, nowb, pre, len + 1, step);   }   int main() {     cin >> a >> opt >> b >> opt >> c;     dfs(a, b, c, 0, 0, 0, 0, 1);     cout << ansa <<  +  << ansb <<  =  << ansa + ansb << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   constexpr int mod = 998244353;   int x[5], y[5];   int px[32], nx[32], py[32], ny[32];   int dp[32][20][20][20][20][2][2];   void add(int& x, const int& y) {     x += y;     if (x >= mod) x -= mod;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(nullptr);     cout.tie(nullptr);     int n, m;     cin >> n >> m;     for (int i = 0; i < n; i += 1) cin >> x[i] >> y[i];     for (int mask = 0; mask < (1 << n); mask += 1)       for (int i = 0; i < n; i += 1)         if ((mask >> i) & 1) {           (x[i] > 0 ? px : nx)[mask] += abs(x[i]);           (y[i] > 0 ? py : ny)[mask] += abs(y[i]);         }     dp[0][0][0][0][0][0][0] = 1;     for (int i = 0; i < (30); i += 1)       for (int cpx = 0; cpx < (20); cpx += 1)         for (int cnx = 0; cnx < (20); cnx += 1)           for (int cpy = 0; cpy < (20); cpy += 1)             for (int cny = 0; cny < (20); cny += 1)               for (int bx = 0; bx < (2); bx += 1)                 for (int by = 0; by < (2); by += 1)                   for (int mask = 0; mask < (1 << n); mask += 1)                     if (dp[i][cpx][cnx][cpy][cny][bx][by]) {                       if (0)                         cout << i <<     << cpx <<     << cny <<     << cpy <<                                  << cny <<     << bx <<     << by <<                                  << dp[i][cpx][cnx][cpy][cny][bx][by] << endl;                       int npx = cpx + px[mask], nnx = cnx + nx[mask],                           npy = cpy + py[mask], nny = cny + ny[mask];                       if ((npx ^ nnx) & 1) continue;                       if ((npy ^ nny) & 1) continue;                       int cx = npx & 1, mx = (m >> i) & 1;                       int cy = npy & 1, my = (m >> i) & 1;                       add(dp[i + 1][npx >> 1][nnx >> 1][npy >> 1][nny >> 1]                             [cx != mx ? (cx > mx) : bx]                             [cy != my ? (cy > my) : by],                           dp[i][cpx][cnx][cpy][cny][bx][by]);                     }     cout << (dp[30][0][0][0][0][0][0] + mod - 1) % mod;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool qo(bool x) { return (x ? 0 : qo(!x)); }   const int mnx = 1e5 + 9;   const int mod = 1e9 + 7;   long long n, sum;   long long a[mnx];   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0), cout.tie(0);     cin >> n;     for (int i = 0; i < n; i++) {       cin >> a[i];     }     for (int m = 0; m < (1 << n); m++) {       for (int j = 0; j < n; j++) {         if (m & (1 << j))           sum += a[j];         else           sum -= a[j];       }       if (sum % 360 == 0) {         cout <<  YES n ;         exit(0);         ;       }       sum = 0;     }     cout <<  NO n ;     exit(0);     ;   }
#include <bits/stdc++.h>   #pragma comment(linker,  /STACK:256000000 )   using namespace std;   const int INF = 1000001000;   const int mod = 1000 * 1000 * 1000 + 7;   const int mod9 = 1000 * 1000 * 1000 + 9;   const double PI = 3.1415926535897932;   double sqr(double first) { return first * first; };   long double sqr(long double first) { return first * first; };   long long sqr(long long first) { return first * first; };   long long sqr(int first) { return first * 1LL * first; };   long long gcd(long long a, long long b) {     while (b) a %= b, swap(a, b);     return a;   }   long long bpm(long long a, long long n = -2, long long m = mod) {     n = n >= 0 ? n : m + n;     long long r = 1;     while (n) {       if (n & 1) r = (r * a) % m;       a = (a * a) % m;       n >>= 1;     }     return r;   }   long long dist(long long x1, long long y1, long long x2, long long y2) {     return sqr(x1 - x2) + sqr(y1 - y2);   }   std::ostream& operator<<(std::ostream& os, pair<int, int> p) {     return os <<  {  << p.first <<     << p.second <<  } ;   }   const int N = 200005;   long long a[N];   pair<long long, long long> b[N];   int main() {     ios::sync_with_stdio(false);     long long n, m, s, d;     cin >> n >> m >> s >> d;     for (int i = 0; i < n; i++) {       cin >> a[i];     }     sort(a, a + n);     int nwn = -1;     for (int i = 0; i < n; i++) {       b[i] = {a[i], a[i]};       if (i && a[i] - a[i - 1] < s + 2) {         b[nwn].second = b[i].first;       } else {         b[++nwn] = b[i];       }     }     n = nwn + 1;     vector<pair<long long, long long> > res;     long long pos = 0;     for (int i = 0; i < n; i++) {       long long next = b[i].first;       long long runD = next - 1 - pos;       bool err = false;       if (runD < s) {         err = true;       }       res.push_back({1, runD});       pos += runD;       long long fin = b[i].second + 1;       if (fin > m || fin - pos > d) {         err = true;       }       res.push_back({0, fin - pos});       pos = fin;       if (err) {         pos = m;         res.clear();         res.push_back({-1, 0});         break;       }     }     if (pos != m) {       res.push_back({1, m - pos});     }     for (pair<int, int> d : res) {       switch (d.first) {         case -1:           cout <<  IMPOSSIBLE n ;           break;         case 0:           cout <<  JUMP   << d.second <<   n ;           break;         case 1:           cout <<  RUN   << d.second <<   n ;           break;       }     }     return 0;   }
#include <bits/stdc++.h>   const double EPS = 1e-10;   const double PI = acos(-1.0);   using namespace std;   int main(void) {     int n;     cin >> n;     vector<pair<int, int> > e;     for (int i = (0); i < (n); ++i) {       int a, b;       cin >> a >> b;       e.push_back(make_pair(a, b));     }     sort((e).begin(), (e).end());     int answer = 0;     for (int i = (0); i < (n); ++i) {       if (answer <= e[i].second)         answer = e[i].second;       else         answer = e[i].first;     }     cout << answer << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<long long> AE[1000005];   long long par[1000005];   enum LG { AND = 1, OR = 2, XOR = 3, NOT = 4, IN = 5 };   long long type[1000005], inp[1000005];   inline void nedge(long long a, long long b) { AE[a].push_back(b), par[b] = a; }   bool oans[1000005];   bool dfs(long long p) {     if (AE[p].size()) {       volatile bool A = dfs(AE[p][0]), B = AE[p].size() > 1 ? dfs(AE[p][1]) : 0;       if (type[p] == AND)         oans[p] = (A and B);       else if (type[p] == OR)         oans[p] = (A or B);       else if (type[p] == XOR)         oans[p] = (A xor B);       else if (type[p] == NOT)         oans[p] = (not A);     } else       oans[p] = inp[p];     return oans[p];   }   bool ans[1000005];   int32_t main() {     ios::sync_with_stdio(0);     cin.tie(0);     ;     long long n;     cin >> n;     for (long long i = 1; i <= n; i++) {       string x;       cin >> x;       long long a, b;       if (x ==  AND ) cin >> a >> b, nedge(i, a), nedge(i, b), type[i] = AND;       if (x ==  OR ) cin >> a >> b, nedge(i, a), nedge(i, b), type[i] = OR;       if (x ==  XOR ) cin >> a >> b, nedge(i, a), nedge(i, b), type[i] = XOR;       if (x ==  NOT ) cin >> a, nedge(i, a), type[i] = NOT;       if (x ==  IN ) cin >> a, inp[i] = a, type[i] = IN;     }     dfs(1);     queue<long long> q;     q.push(1);     while (!q.empty()) {       long long p = q.front(), pa = par[p];       q.pop();       bool nans = 0;       if (p == 1)         ans[p] = !oans[p];       else {         long long a = AE[pa][0], b = AE[pa].size() > 1 ? AE[pa][1] : -1;         if (type[pa] == AND)           nans = ((oans[a] ^ (p == a)) and (oans[b] ^ (p == b)));         else if (type[pa] == OR)           nans = ((oans[a] ^ (p == a)) or (oans[b] ^ (p == b)));         else if (type[pa] == XOR)           nans = ((oans[a] ^ (p == a)) xor (oans[b] ^ (p == b)));         else if (type[pa] == NOT)           nans = (not(oans[a] ^ (p == a)));         ans[p] = (nans != oans[pa]) ? ans[pa] : oans[1];       }       for (long long x : AE[p]) q.push(x);     }     for (long long i = 1; i <= n; i++)       if (type[i] == IN) cout << ans[i];     cout <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   struct osoba {     string ime, prezime;   };   int main() {     int n;     cin >> n;     vector<osoba> osobe(n);     vector<int> redoslijed(n);     vector<string> minori(n);     bool trigger = true;     for (int i = 0; i < n; i++) cin >> osobe[i].ime >> osobe[i].prezime;     for (int i = 0; i < n; i++) cin >> redoslijed[i];     if (strcmp(osobe[redoslijed[0] - 1].ime.c_str(),                osobe[redoslijed[0] - 1].prezime.c_str()) < 0)       minori[0] = osobe[redoslijed[0] - 1].ime;     else       minori[0] = osobe[redoslijed[0] - 1].prezime;     for (int i = 1; i < n; i++) {       if (strcmp(minori[i - 1].c_str(), osobe[redoslijed[i] - 1].ime.c_str()) >               0 &&           strcmp(minori[i - 1].c_str(),                  osobe[redoslijed[i] - 1].prezime.c_str()) <= 0)         minori[i] = osobe[redoslijed[i] - 1].prezime;       else if (strcmp(minori[i - 1].c_str(),                       osobe[redoslijed[i] - 1].ime.c_str()) <= 0 &&                strcmp(minori[i - 1].c_str(),                       osobe[redoslijed[i] - 1].prezime.c_str()) > 0)         minori[i] = osobe[redoslijed[i] - 1].ime;       else if (strcmp(minori[i - 1].c_str(),                       osobe[redoslijed[i] - 1].ime.c_str()) <= 0 &&                strcmp(minori[i - 1].c_str(),                       osobe[redoslijed[i] - 1].prezime.c_str()) <= 0) {         if (strcmp(osobe[redoslijed[i] - 1].ime.c_str(),                    osobe[redoslijed[i] - 1].prezime.c_str()) < 0)           minori[i] = osobe[redoslijed[i] - 1].ime;         else           minori[i] = osobe[redoslijed[i] - 1].prezime;       } else {         cout <<  NO  << endl;         trigger = false;         break;       }     }     if (trigger) cout <<  YES  << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void CyBerForCe() {     long long n, k, x;     cin >> n >> k >> x;     vector<long long> v, u1, u2;     long long f[1024] = {0}, temp[1024];     for (long long i = 0; i < n; i++) {       long long a;       cin >> a;       v.push_back(a);       f[a]++;     }     for (long long i = 0; i < k; i++) {       for (long long j = 0; j < 1024; j++) temp[j] = 0;       long long c = 0;       for (long long j = 0; j < 1024; j++) {         temp[j] += ((f[j] + c) / 2);         temp[j ^ x] += ((f[j] + 1 - c) / 2);         c = (c + f[j]) & 1;       }       for (long long j = 0; j < 1024; j++) f[j] = temp[j];     }     long long mi = 1026, ma = -1;     for (long long i = 0; i < 1024; i++) {       if (f[i] > 0) {         mi = min(mi, i);         ma = max(ma, i);       }     }     cout << ma <<     << mi <<   n ;   }   signed main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     CyBerForCe();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 2e3 + 2;   bitset<N> equa[N], value[N];   int ans[N], hehe[N];   signed main() {     ios::sync_with_stdio(0);     cin.tie(0);     int n, m, i, j, k, l, num = 0;     cin >> n >> m;     for (i = 0; i < n; i++) {       value[2 * i][2 * i] = 1;       value[2 * i + 1][2 * i + 1] = 1;     }     for (i = 0; i < m; i++) {       string s;       char x;       cin >> s;       if (s ==  mix ) {         cin >> j;         for (k = 0; k < j; k++) {           cin >> l;           l--;           equa[num] ^= value[2 * l];           equa[num + 1] ^= value[2 * l + 1];         }         cin >> x;         if (x ==  R ) {           ans[num + 1] = 1;         }         if (x ==  Y ) {           ans[num] = 1;         }         if (x ==  B ) {           ans[num] = ans[num + 1] = 1;         }         num += 2;       }       if (s ==  RB ) {         cin >> j;         for (k = 0; k < j; k++) {           cin >> l;           l--;           value[2 * l] ^= value[2 * l + 1];         }       }       if (s ==  RY ) {         cin >> j;         for (k = 0; k < j; k++) {           cin >> l;           l--;           swap(value[2 * n], value[2 * l]);           swap(value[2 * l], value[2 * l + 1]);           swap(value[2 * l + 1], value[2 * n]);         }       }       if (s ==  YB ) {         cin >> j;         for (k = 0; k < j; k++) {           cin >> l;           l--;           value[2 * l + 1] ^= value[2 * l];         }       }     }     int now = -1;     for (i = 0; i < 2 * n; i++) {       for (j = now + 1; j < num; j++) {         if (equa[j][i]) {           now++;           swap(equa[j], equa[now]);           swap(ans[j], ans[now]);           for (k = 0; k < num; k++) {             if (equa[k][i] && k != now) {               equa[k] ^= equa[now];               ans[k] ^= ans[now];             }           }           break;         }       }     }     for (i = now + 1; i < num; i++) {       assert(!equa[i].count());       if (ans[i] == 1) {         cout <<  NO ;         return 0;       }     }     for (i = now; i > -1; i--) {       for (j = 2 * n - 1; j > -1; j--) {         if (equa[i][j]) {           if (equa[i].count() == 1) {             equa[i][j] = 0;             hehe[j] = ans[i];           } else {             equa[i][j] = 0;             for (k = j; k > -1; k--) {               if (equa[i][k]) {                 break;               }             }             for (l = 0; l < i; l++) {               if (equa[l][k]) {                 equa[l] ^= equa[i];                 ans[l] ^= ans[i];               }             }           }         }       }     }     cout <<  YES n ;     for (i = 0; i < n; i++) {       if (hehe[2 * i] && hehe[2 * i + 1]) {         cout <<  B ;       }       if (hehe[2 * i] && !hehe[2 * i + 1]) {         cout <<  Y ;       }       if (!hehe[2 * i] && hehe[2 * i + 1]) {         cout <<  R ;       }       if (!hehe[2 * i] && !hehe[2 * i + 1]) {         cout <<  . ;       }     }   }
#include <bits/stdc++.h>   using namespace std;   int ans, t, p, q, i, j, n, m, k, l, r, br1, br0;   bool b[36][36];   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     cin >> t;     while (t--) {       cin >> n >> m;       ans = 0;       vector<pair<int, int> > v;       for (i = 1; i <= n; i++) {         for (j = 1; j <= m; j++) {           cin >> b[i][j];         }       }       for (i = 1; i <= m; i++) {         p = 1;         q = i;         br1 = br0 = 0;         while (p <= n && q > 0) {           if (b[p][q] == 1)             br1++;           else             br0++;           p++;           q--;         }         v.push_back({br0, br1});       }       for (i = 2; i <= n; i++) {         p = i;         q = m;         br1 = br0 = 0;         while (p <= n && q > 0) {           if (b[p][q] == 1)             br1++;           else             br0++;           p++;           q--;         }         v.push_back({br0, br1});       }       for (i = 0; i < v.size() / 2; i++) {         pair<int, int> pr = v[i];         pair<int, int> pr1 = v[v.size() - i - 1];         ans += min(pr.first + pr1.first, pr.second + pr1.second);       }       cout << ans <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     long long n;     cin >> n;     vector<long long> a(n), t(n);     vector<pair<long long, long long> > vp;     for (int i = 0; i < n; i++) {       cin >> a[i];       vp.push_back({a[i], i});     }     for (int i = 0; i < n; i++) cin >> t[i];     long long ans = 0;     sort(vp.begin(), vp.end());     long long sum = 0;     priority_queue<long long> pq;     int i = 0;     while (i < n) {       int j;       for (j = i; j < n; j++) {         if (vp[i].first == vp[j].first) {           sum += t[vp[j].second];           pq.push(t[vp[j].second]);         } else           break;       }       long long num = vp[i].first;       while (j < n && pq.empty() == 0 && num < vp[j].first) {         sum -= pq.top();         pq.pop();         ans += sum;         num++;       }       i = j;     }     while (pq.empty() == 0) {       sum -= pq.top();       pq.pop();       ans += sum;     }     cout << ans <<   n ;   }   int main(void) {     ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);     int t = 1;     while (t--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   map<char, int> m;   bool judge(string str) {     int count = 0;     for (int i = 0; i < 3; i++) {       if (str[i] ==  . ) break;       if (str[i] ==  A  && m[ A ] == 0) {         m[ A ] = 1;         count++;       } else if (str[i] ==  B  && m[ B ] == 0) {         m[ B ] = 1;         count++;       } else if (str[i] ==  C  && m[ C ] == 0) {         m[ C ] = 1;         count++;       }       if (count >= 3) return true;     }     return false;   }   int main() {     string str;     cin >> str;     int siz = str.size();     int count = 0;     for (int i = 0; i <= siz - 3; i++) {       m[ A ] = 0;       m[ B ] = 0;       m[ C ] = 0;       string sstr = str.substr(i, 3);       if (judge(sstr)) {         cout <<  Yes  << endl;         return 0;       }     }     cout <<  No  << endl;     return 0;   }
#include <bits/stdc++.h>   const int MaxN = 1e6 + 255;   const long long INF = 1e18 + 7;   const int Mod = 1e9 + 7;   using namespace std;   long long n, a, f[MaxN], ans;   int main() {     scanf( %lld , &n);     for (int i = 1; i <= n; ++i) {       scanf( %lld , &a);       ++f[a];     }     for (int i = 0; i < MaxN; ++i) {       if (f[i]) {         f[i + 1] += f[i] / 2;         f[i] %= 2;       }     }     for (int i = 0; i < MaxN; ++i)       if (f[i]) ++ans;     printf( %lld , ans);     return 0;   }