malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int maxn = 100010, inf = 1e9;   int n, ty, l, r, x;   bitset<maxn> v[26], ans;   char s[maxn], s2[maxn], c;   inline void read(int &k) {     int f = 1;     k = 0;     char c = getchar();     while (c <  0  || c >  9 ) c ==  -  && (f = -1), c = getchar();     while (c <=  9  && c >=  0 ) k = k * 10 + c -  0 , c = getchar();     k *= f;   }   int main() {     scanf( %s , s + 1);     int len = strlen(s + 1);     for (int i = 1; i <= len; i++) v[s[i] -  a ][i] = 1;     read(n);     for (int i = 1; i <= n; i++) {       read(ty);       if (ty == 1) {         read(x);         scanf( %c , &c);         v[s[x] -  a ][x] = 0;         v[(s[x] = c) -  a ][x] = 1;       } else {         read(l);         read(r);         scanf( %s , s2);         int m = strlen(s2);         if (r - l + 1 < m) {           puts( 0 );           continue;         }         ans.set();         for (int j = 0; j < m; j++) ans &= (v[s2[j] -  a ] >> j);         printf( %d n ,                (int)(ans >> (l)).count() - (int)(ans >> (r - m + 2)).count());       }     }   }
#include <bits/stdc++.h>   using namespace std;   int arr[500005], brr[500005];   vector<int> vv[500005], ans;   int Now[500005];   int total[500005];   int tree[500005 * 4];   void update(int node, int b, int e, int i, int v) {     if (i < b || i > e) return;     if (b == e && b == i) {       tree[node] = v;       return;     }     int left = 2 * node, right = left + 1, mid = (b + e) / 2;     update(left, b, mid, i, v);     update(right, mid + 1, e, i, v);     tree[node] = tree[left] + tree[right];   }   int query(int node, int b, int e, int v) {     if (b == e) return b;     int left = 2 * node, right = left + 1, mid = (b + e) / 2;     int ret;     if (tree[left] >= v)       ret = query(left, b, mid, v);     else       ret = query(right, mid + 1, e, v - tree[left]);     return ret;   }   int main() {     int n, k, m, s;     scanf( %d %d %d %d , &n, &k, &m, &s);     for (int i = 1; i <= n; i++) {       scanf( %d , &arr[i]);       vv[arr[i]].push_back(i);     }     for (int i = 1; i <= s; i++) {       int x;       scanf( %d , &x);       brr[x]++;     }     if (k < s) {       cout <<  -1 ;       return 0;     }     for (int i = 1; i <= n; i++) {       if (total[arr[i]] == brr[arr[i]]) continue;       Now[arr[i]] = i;       update(1, 1, n, i, 1);       total[arr[i]]++;     }     if (tree[1] < s) {       cout <<  -1 ;       return 0;     }     bool flag = 0;     int id = 0, id2 = 0;     for (int i = 1; i <= n; i++) {       int pp = query(1, 1, n, s);       int z = 0;       z = i / k;       if (i % k == 0) z--;       int ppp = max(pp, i + k - 1);       z++;       z += ((n - ppp) / k);       if (z >= m) {         flag = 1;         id = i;         id2 = pp;         break;       }       update(1, 1, n, i, 0);       int idd = upper_bound(vv[arr[i]].begin(), vv[arr[i]].end(), Now[arr[i]]) -                 vv[arr[i]].begin();       if (idd == vv[arr[i]].size() && brr[arr[i]]) break;       if (brr[arr[i]]) {         update(1, 1, n, vv[arr[i]][idd], 1);         Now[arr[i]] = vv[arr[i]][idd];       }     }     if (flag == 0) {       printf( -1 n );     } else {       for (int i = 1; i <= 500000; i++) total[i] = 0;       for (int i = 1; i < id; i++) {         if ((id - i) % k)           ans.push_back(i);         else           break;       }       if (id2 - id + 1 > k) {         int tt = id2 - id + 1;         for (int i = id; i <= id2 && tt > k; i++) {           if (total[arr[i]] >= brr[arr[i]]) {             tt--;             ans.push_back(i);           } else             total[arr[i]]++;         }       }       printf( %d n , ans.size());       for (int i = 0; i < ans.size(); i++) printf( %d  , ans[i]);     }   }
#include <bits/stdc++.h>   #pragma GCC target( avx2 )   #pragma GCC optimization( O3 )   #pragma GCC optimization( unroll-loops )   const long long INF = 0x3f3f3f3f3f3f3f3f;   const long long llinf = (1LL << 62);   const int inf = (1 << 30);   const long long nmax = 3e5 + 50;   const int mod = 1e9 + 7;   const int lim = 1e6;   using namespace std;   int n, m, a[nmax], b[nmax], st[4 * lim + 50], i, t, x, lzy[4 * lim + 50], q;   void push(int nod, int l, int r) {     if (l > r) return;     if (!lzy[nod]) return;     st[nod] += lzy[nod];     if (l != r) {       lzy[nod * 2] += lzy[nod];       lzy[nod * 2 + 1] += lzy[nod];     }     lzy[nod] = 0;   }   void upd(int nod, int l, int r, int tl, int tr, int v) {     push(nod, l, r);     if (tl <= l && r <= tr) {       lzy[nod] += v;       push(nod, l, r);       return;     }     int mid = (l + r) / 2;     if (tl <= mid) upd(nod * 2, l, mid, tl, tr, v);     if (mid < tr) upd(nod * 2 + 1, mid + 1, r, tl, tr, v);     push(nod * 2, l, mid);     push(nod * 2 + 1, mid + 1, r);     st[nod] = max(st[nod * 2], st[nod * 2 + 1]);   }   int qry(int nod, int l, int r) {     push(nod, l, r);     if (l == r) return l;     int mid = (l + r) / 2;     push(2 * nod, l, mid);     push(2 * nod + 1, mid + 1, r);     if (st[2 * nod + 1] > 0) return qry(2 * nod + 1, mid + 1, r);     return qry(2 * nod, l, mid);   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cerr.tie(0);     cout.tie(0);     cin >> n >> m;     for (i = 1; i <= n; i++) {       cin >> a[i];       upd(1, 1, lim, 1, a[i], 1);     }     for (i = 1; i <= m; i++) {       cin >> b[i];       upd(1, 1, lim, 1, b[i], -1);     }     cin >> q;     while (q--) {       cin >> t >> i >> x;       if (t == 1) {         upd(1, 1, lim, 1, a[i], -1);         a[i] = x;         upd(1, 1, lim, 1, a[i], 1);       } else {         upd(1, 1, lim, 1, b[i], 1);         b[i] = x;         upd(1, 1, lim, 1, b[i], -1);       }       if (st[1] <= 0)         cout << -1 <<   n ;       else         cout << qry(1, 1, lim) <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   string s, s1, s2;   bool fn() {     int i, j, k, flag = 0;     int len = s.size();     int len1 = s1.size();     int len2 = s2.size();     for (i = 0; i < len; i++) {       for (j = i, k = 0; k < len1; j++, k++) {         if (s[j] != s1[k] || j >= len) break;       }       if (k == len1) {         flag++;         break;       }     }     for (i = j; i < len; i++) {       for (j = i, k = 0; k < len2; j++, k++) {         if (s[j] != s2[k] || i >= len) break;       }       if (k == len2) {         flag++;         break;       }     }     if (flag == 2)       return true;     else       return false;   }   int main() {     cin >> s >> s1 >> s2;     bool Forward = false;     if (fn() == true) Forward = true;     reverse(s.begin(), s.end());     bool Backward = false;     if (fn() == true) Backward = true;     if (Forward && Backward)       cout <<  both  << endl;     else if (Forward)       cout <<  forward  << endl;     else if (Backward)       cout <<  backward  << endl;     else       cout <<  fantasy  << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 200005, MOD = 1e9 + 7;   long long fact[N], inv[N];   long long qpow(long long a, int b) {     long long ans = 1;     do {       if (b & 1) ans = ans * a % MOD;       a = a * a % MOD;     } while (b /= 2);     return ans;   }   int main() {     int n;     cin >> n;     fact[0] = 1;     for (int i = 1; i <= n * 2; i++) fact[i] = fact[i - 1] * i % MOD;     inv[n * 2] = qpow(fact[n * 2], MOD - 2);     for (int i = n * 2 - 1; i >= 0; i--) inv[i] = inv[i + 1] * (i + 1) % MOD;     long long ans = 0;     for (int i = 0; i < n; i++)       ans += fact[n - 1 + i] * inv[n - 1] % MOD * inv[i] % MOD;     cout << (ans * 2 - n) % MOD << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, d[100005], g[100005];   bool vis[100005];   char str[100005];   void get() {     bool sign = 1;     int cur = 1;     while (cur >= 1 && cur <= n) {       if (vis[cur]) {         sign = 0;         break;       }       vis[cur] = 1;       cur += g[cur] * d[cur];     }     if (!sign)       cout <<  INFINITE  << endl;     else       cout <<  FINITE  << endl;   }   int main() {     cin >> n >> str + 1;     for (int i = 1; i <= n; i++) cin >> d[i];     for (int i = 1; i <= n; i++) g[i] = str[i] ==  >  ? 1 : -1;     get();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, k;   vector<char> s;   int main() {     cin >> n >> k;     if (k > n) {       cout << -1;       cin >> n;       return 0;     }     if (k == 1 && n > 1) {       cout << -1;       cin >> n;       return 0;     }     for (int i = 0; i < n; i++) {       if (i % 2 == 0) {         s.push_back( a );       } else {         s.push_back( b );       }     }     int x = 98 + k - 2;     for (int i = n - 1; i >= n - k + 2; i--) {       s[i] = (char)x;       x--;     }     for (int i = 0; i < n; i++) {       cout << s[i];     }     cin >> n;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 0x7fffffff;   inline int reint() {     int d;     scanf( %d , &d);     return d;   }   inline long relong() {     long l;     scanf( %ld , &l);     return l;   }   inline char rechar() {     scanf(   );     return getchar();   }   inline double redouble() {     double d;     scanf( %lf , &d);     return d;   }   inline string restring() {     string s;     cin >> s;     return s;   }   int mask(int a) {     char str[10];     sprintf(str,  %d , a);     char ans[10];     int j = 0;     for (int i = (0); i < (strlen(str)); i++) {       if (str[i] ==  4  || str[i] ==  7 ) {         ans[j++] = str[i];       }     }     int res = 0;     for (int i = (0); i < (j); i++) {       res += ans[i] -  0 ;       if (i != j - 1) {         res *= 10;       }     }     return res;   }   int c, b;   int main(void) {     cin >> c >> b;     c++;     while (mask(c) != b) {       c++;     }     cout << c << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   #define int long long   void solve()   {       int n;       cin >> n;       int a[n];              for(int i = 0; i < n; i++) cin >> a[i];       cout<<(n/2)*6<<endl;       for(int i = 1; i <= n; i+=2){           int j = i + 1;           cout<<1<<   <<i<<   <<j<<endl;           cout<<2<<   <<i<<   <<j<<endl;           cout<<2<<   <<i<<   <<j<<endl;           cout<<1<<   <<i<<   <<j<<endl;           cout<<2<<   <<i<<   <<j<<endl;           cout<<2<<   <<i<<   <<j<<endl;       }   }      int32_t main()   {       ios_base::sync_with_stdio(false);       cin.tie(0);       cout.tie(0);       int t;       cin>> t;       while(t--)solve();       return 0;   }
#include <bits/stdc++.h>   using namespace std;   using LL = long long;   const int N = 2.5e5;   vector<int> adj[N];   int dep[N], par[N];   bool leaf[N];   bool dfs(int u, int p = -1, int d = 1) {     if (dep[u] > 0) return false;     dep[u] = d;     par[u] = p;     leaf[u] = true;     for (int v : adj[u]) {       if (dfs(v, u, d + 1)) leaf[u] = false;     }     return true;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int n, m, k;     cin >> n >> m >> k;     for (int i = 0; i < m; i++) {       int u, v;       cin >> u >> v;       u--, v--;       adj[u].push_back(v);       adj[v].push_back(u);     }     dfs(0);     int r = 0;     for (int u = 0; u < n; u++) {       if (dep[u] > dep[r]) r = u;     }     dfs(r);     const int plen = ((n + k - 1) / k);     int leaves = 0;     for (int u = 0; u < n; u++) {       if (dep[u] >= plen) {         cout <<  PATH n  << dep[u] <<   n ;         while (u != -1) {           cout << (u + 1) <<    ;           u = par[u];         }         cout <<   n ;         return 0;       }       if (leaf[u]) leaves++;     }     assert(leaves >= k);     cout <<  CYCLES n ;     int values[3];     vector<int> cy;     cy.reserve(N);     for (int u = 0; u < n && k > 0; u++) {       if (!leaf[u]) continue;       int top = -1;       int id = 0;       for (int v : adj[u]) {         if (v == par[u]) continue;         if ((dep[u] - dep[v]) >= 3 && (dep[u] - dep[v] + 1) % 3 != 0) {           top = v;           break;         }         values[id++] = v;         if (id == 2) break;       }       if (top >= 0) {         for (int v = u; v != top; v = par[v]) {           cy.push_back(v);         }         cy.push_back(top);       } else {         cy.push_back(u);         if (dep[values[0]] < dep[values[1]]) swap(values[0], values[1]);         for (int v = values[0]; v != values[1]; v = par[v]) {           cy.push_back(v);         }         cy.push_back(values[1]);       }       cout << cy.size() <<   n ;       for (int u : cy) cout << (u + 1) <<    ;       cout <<   n ;       cy.clear();       k--;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   char s[1000010], a[1000010], b[1000010];   char perm[300];   char used[300];   char savedPerm[300];   char savedUsed[300];   int k;   bool fit(char from, char to) {     if (perm[from] != 0) {       if (perm[from] != to) return false;     } else {       if (used[to] != 0) return false;       used[to] = 1;       perm[from] = to;     }     return true;   }   void fillUnused() {     char i, j =  a ;     for (i =  a ; i <  a  + k; i++) {       if (perm[i] == 0) {         while (used[j] == 1) j++;         perm[i] = j;         j++;       }     }   }   void solve() {     scanf( %d%s%s%s , &k, s, a, b);     memset(perm, 0, sizeof(perm));     memset(used, 0, sizeof(used));     int n = strlen(s);     int state = 0;     int conflict = -1;     for (int i = 0; i < n; i++) {       switch (state) {         case 0:           if (a[i] == b[i]) {             if (!fit(s[i], a[i])) {               printf( NO n );               return;             }           } else {             for (char ch = a[i] + 1; ch < b[i]; ch++) {               if (fit(s[i], ch)) {                 state = -1;                 break;               }             }             if (state != -1) {               memcpy(savedPerm, perm, sizeof(perm));               memcpy(savedUsed, used, sizeof(used));               if (conflict == -1) {                 if (fit(s[i], a[i])) {                   conflict = i;                   state = 1;                 } else if (fit(s[i], b[i]))                   state = 2;                 else {                   printf( NO n );                   return;                 }               } else if (fit(s[i], b[i]))                 state = 2;               else {                 printf( NO n );                 return;               }             }           }           break;         case 1:           for (char ch = a[i] + 1; ch <  a  + k; ch++) {             if (fit(s[i], ch)) {               state = -1;               break;             }           }           if (state != -1) {             if (!fit(s[i], a[i])) {               state = 0;               i = conflict - 1;               memcpy(perm, savedPerm, sizeof(perm));               memcpy(used, savedUsed, sizeof(used));               break;             }           }           break;         case 2:           for (char ch =  a ; ch < b[i]; ch++) {             if (fit(s[i], ch)) {               state = -1;               break;             }           }           if (state != -1) {             if (!fit(s[i], b[i])) {               printf( NO n );               return;             }           }           break;       }       if (state == -1) break;     }     fillUnused();     printf( YES n );     for (int i =  a ; i <  a  + k; i++) printf( %c , perm[i]);     printf(  n );   }   int main() {     int t;     scanf( %d , &t);     while (t--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int B = 20;   const int N = 1e5 + 7;   int n, m, a[N];   struct ND {     int l0, r0;     ND() {}     ND(int l0, int r0) : l0(l0), r0(r0) {}     void init(int p, int v) {       l0 = v == 0 ? p : n + 1;       r0 = v == 0 ? p : 0;     }     void merge(const ND &a, const ND &b) {       l0 = min(a.l0, b.l0);       r0 = max(a.r0, b.r0);     }   };   struct Tree {     static const int N = ::N << 2;     ND nd[N];     void chg(int o, int l, int r, int qx, int qv) {       if (l == r) {         nd[o].init(qx, qv);         return;       }       int mid = l + r >> 1;       if (qx <= mid)         chg(o << 1, l, mid, qx, qv);       else         chg(o << 1 | 1, mid + 1, r, qx, qv);       nd[o].merge(nd[o << 1], nd[o << 1 | 1]);     }     ND qry(int o, int l, int r, int ql, int qr) {       if (ql <= l && qr >= r) return nd[o];       int mid = l + r >> 1;       ND qryl(n + 1, 0);       if (ql <= mid) qryl = qry(o << 1, l, mid, ql, qr);       ND qryr(n + 1, 0);       if (qr > mid) qryr = qry(o << 1 | 1, mid + 1, r, ql, qr);       ND ret;       ret.merge(qryl, qryr);       return ret;     }   } tree[B];   long long dc(int len) { return 1ll * (len + 1) * len / 2; }   long long getv(int p, int vv) {     long long ret = 0;     for (int b = (0); b < (B); ++b) {       int v = vv >> b & 1;       int lenl = p - 1 - (p > 1 ? tree[b].qry(1, 1, n, 1, p - 1).r0 : 0);       int lenr = (p < n ? tree[b].qry(1, 1, n, p + 1, n).l0 : n + 1) - p - 1;       long long tmp = v == 0 ? dc(lenl) + dc(lenr) : dc(lenl + lenr + 1);       ret += tmp * (1 << b);     }     return ret;   }   void solve() {     for (int i = (1); i < (n + 1); ++i) scanf( %d , &a[i]);     for (int i = (1); i < (n + 1); ++i)       for (int b = (0); b < (B); ++b) tree[b].chg(1, 1, n, i, a[i] >> b & 1);     long long ans = 0;     for (int b = (0); b < (B); ++b) {       int tmp = 0;       for (int i = (1); i < (n + 2); ++i)         if (a[i] >> b & 1)           tmp++;         else {           ans += dc(tmp) * (1 << b);           tmp = 0;         }     }     while (m--) {       int p, v;       scanf( %d%d , &p, &v);       ans += -getv(p, a[p]) + getv(p, v);       a[p] = v;       for (int b = (0); b < (B); ++b) tree[b].chg(1, 1, n, p, a[p] >> b & 1);       printf( %lld n , ans);     }   }   int main() {     while (~scanf( %d%d , &n, &m)) solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long a[200010];   int main() {     int n;     long long sum = 0, MAX = 0;     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %I64d , a + i);       sum += a[i];       MAX = max(a[i], MAX);     }     long long ans;     if (sum % (n - 1) == 0)       ans = sum / (n - 1);     else       ans = sum / (n - 1) + 1;     ans = max(MAX, ans);     printf( %I64d n , ans);   }
#include <bits/stdc++.h>   using namespace std;   long long n, d, b;   int nl[100100], nr[100100];   int find(int *next, int x) {     if (next[x] == x) return x;     return next[x] = find(next, next[x]);   }   long long bit[100100];   inline int lowbit(int x) { return x & -x; }   void add(int x, long long y) {     while (x <= n) {       bit[x] += y;       x += lowbit(x);     }   }   long long sum(int x) {     long long res = 0;     while (x > 0) {       res += bit[x];       x -= lowbit(x);     }     return res;   }   long long get(int x) { return sum(x) - sum(x - 1); }   int make(int x, int t) {     int nx = 0;     int l = max(1ll, x - t * d), r = min(n, x + t * d);     if (sum(r) - sum(l - 1) < b) return 1;     if (x == t) {       for (int i = l; i <= r; i = find(nl, i)) {         int gi = get(i);         nx += gi;         if (nx < b) {           add(i, -get(i));           nl[i] = i + 1;           nr[i] = i - 1;         } else {           add(i, nx - gi - b);           break;         }       }     } else {       for (int i = r; i >= l; i = find(nr, i)) {         int gi = get(i);         nx += gi;         if (nx < b) {           add(i, -get(i));           nl[i] = i + 1;           nr[i] = i - 1;         } else {           add(i, nx - gi - b);           break;         }       }     }     return 0;   }   int main() {     scanf( %d%d%d , &n, &d, &b);     memset(nl, 0, sizeof(nl));     memset(nr, 0, sizeof(nr));     for (int i = 1; i <= n; i++) {       int a;       scanf( %d , &a);       add(i, a);       if (a != 0) {         nl[i] = i;         nr[i] = i;       } else {         nl[i] = i + 1;         nr[i] = i - 1;       }     }     int x1 = 0, x2 = 0, l = 1, r = n;     while (l <= r) {       if (l == r)         x1 += make(l, l);       else if (x1 > x2) {         x1 += make(l, l);         x2 += make(r, l);       } else {         x2 += make(r, l);         x1 += make(l, l);       }       l++;       r--;     }     printf( %d n , max(x1, x2));     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int cmp(char a, char b) { return a > b; }   int main() {     char s[300050];     char str[300050];     char ans[300050];     scanf( %s%s , s, str);     int len = strlen(s);     sort(s, s + len);     sort(str, str + len, cmp);     if (len == 1) {       printf( %s n , s);       return 0;     }     int l, r, L, R;     l = L = 0;     r = (len + 1) / 2 - 1;     if (len & 1) {       R = len / 2 - 1;     } else       R = r;     int sum = 0;     int i = 0;     int j = len - 1;     while (i <= j) {       if ((sum & 1) == 0) {         if (s[l] < str[L]) {           ans[i++] = s[l++];         } else {           ans[j--] = s[r--];         }         sum++;       } else {         if (s[l] >= str[L]) {           ans[j--] = str[R--];         } else {           ans[i++] = str[L++];         }         sum++;       }     }     ans[len] =   0 ;     printf( %s n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int l[50000];   int p[50000];   pair<pair<double, int>, int> prod[50000];   int main() {     std::ios_base::sync_with_stdio(false);     int n;     cin >> n;     for (int i = 0; i < n; i++) {       cin >> l[i] >> p[i];       if (p[i] == 100)         prod[i].first.first = -1000000000;       else         prod[i].first.first = -l[i] * p[i] * 1.0 / (100 - p[i]);       prod[i].first.second = p[i];       prod[i].second = i;     }     sort(prod, prod + n);     double F = l[prod[0].second] * p[prod[0].second] / 100.0;     double E = l[prod[0].second];     for (int i = 1; i < n; i++) {       E = E + l[prod[i].second] + (1 - p[prod[i].second] / 100.0) * F;       F += p[prod[i].second] / 100.0 * l[prod[i].second];     }     cout << setprecision(25) << E << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool sip;   char A[100005], B[100005];   int C[35], D[35], tam1, tam2, res = 0, puede = 0, quedan;   int main() {     scanf( %s%s , A, B);     for (tam1 = 0; A[tam1] !=   0 ; tam1++)       ;     for (tam2 = 0; B[tam2] !=   0 ; tam2++)       ;     if (tam2 > tam1) {       printf( 0 n );       return 0;     }     for (int i = 0; i < tam2; i++) {       ++D[B[i] -  a ];     }     for (int i = 0; i < tam2; i++) {       if (A[i] !=  ? ) {         ++C[A[i] -  a ];       } else {         ++puede;       }     }     for (int i = 0; i <= tam1 - tam2; i++) {       quedan = puede;       sip = true;       for (int e = 0; e < 26; e++) {         if (C[e] > D[e] or D[e] - C[e] > quedan) {           sip = false;           break;         } else {           quedan -= (D[e] - C[e]);         }       }       if (sip) {         ++res;       }       if (i == tam1 - tam2) {         continue;       }       if (A[i] ==  ? ) {         --puede;       } else {         --C[A[i] -  a ];       }       if (A[i + tam2] ==  ? ) {         ++puede;       } else {         ++C[A[i + tam2] -  a ];       }     }     printf( %d n , res);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int t;     cin >> t;     while (t--) {       int a, b;       cin >> a >> b;       if (b < a) swap(a, b);       if (b - a > 10) {         cout << fixed << (int)ceil((double)(b - a) / 10) <<   n ;       } else if (a != b)         cout <<  1 n ;       else         cout <<  0 n ;     }   }
#include <bits/stdc++.h>   using namespace std;   void sprint(string s) {     for (int i = 0; i < (int)s.size(); ++i) printf( %c , s[i]);     printf(  n );   }   long long f(long long n, long long r) {     long long ans = 1;     for (long long i = 0; i < r; ++i) {       ans = (ans * (n - i)) / (i + 1);     }     return ans;   }   int main() {     long long n;     cin >> n;     long long ans = f(n + 4, 5) * f(n + 2, 3);     cout << ans << endl;     return 0;   }