malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   template <class T>   bool chmax(T &a, const T &b) {     if (a < b) {       a = b;       return 1;     }     return 0;   }   template <class T>   bool chmin(T &a, const T &b) {     if (a > b) {       a = b;       return 1;     }     return 0;   }   template <class T>   ostream &operator<<(ostream &os, const vector<T> &t) {     os <<  [ ;     for (__typeof((t).begin()) it = (t).begin(); it != (t).end(); it++) {       if (it != t.begin()) os <<  , ;       os << *it;     }     os <<  ] ;     return os;   }   template <class T>   ostream &operator<<(ostream &os, const set<T> &t) {     os <<  { ;     for (__typeof((t).begin()) it = (t).begin(); it != (t).end(); it++) {       if (it != t.begin()) os <<  , ;       os << *it;     }     os <<  } ;     return os;   }   template <class S, class T>   ostream &operator<<(ostream &os, const pair<S, T> &t) {     return os <<  (  << t.first <<  ,  << t.second <<  ) ;   }   const int INF = 1 << 28;   const double EPS = 1e-8;   const int MOD = 1000000007;   long long int t, a, b;   long double x[2][60];   long long int dfs(int co, long long int re1, long long int re2) {     if (co == 1) {       if (t == a || (re1 - re2) % (t - a)) return 0;       long long int i = (re1 - re2) / (t - a);       return !(re1 - i * t < 0 || re2 - i * a < 0 || i < 0);     }     long long int ans = 0;     while (re1 >= 0 && re2 >= 0) {       ans += dfs(co - 1, re1, re2);       re1 -= x[0][co];       re2 -= x[1][co];     }     return ans;   }   int main() {     cin >> t >> a >> b;     if (t == 1 && a == 1 && b == 1) {       puts( inf );       return 0;     }     if (t == a && a == b) {       puts( 2 );       return 0;     }     if (t == a) {       puts( 0 );       return 0;     }     for (long long int i = 0; i < (long long int)(60); i++) {       x[0][i] = powl(t, i);       x[1][i] = powl(a, i);     }     cout << dfs(59, a, b) << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 100005;   int n;   long long a[N], b[N];   int f[N][2];   long long WIN(long long x, long long y) {     assert(x <= y);     if (y & 1) return !(x & 1);     if (x * 2 > y) return x & 1;     if (x * 4 > y) return 1;     return WIN(x, y / 4);   }   long long LOSE(long long x, long long y) {     assert(x <= y);     if (x * 2 > y) return 1;     return WIN(x, y / 2);   }   int main() {     scanf( %d , &n);     for (int i = (int)(1); i <= (int)(n); i++) scanf( %lld%lld , &a[i], &b[i]);     f[n][0] = WIN(a[n], b[n]);     f[n][1] = LOSE(a[n], b[n]);     for (int i = (int)(n - 1); i >= (int)(1); i--) {       if (f[i + 1][0] == 0 && WIN(a[i], b[i])) f[i][0] = 1;       if (f[i + 1][0] == 1 && LOSE(a[i], b[i])) f[i][0] = 1;       if (f[i + 1][1] == 0 && WIN(a[i], b[i])) f[i][1] = 1;       if (f[i + 1][1] == 1 && LOSE(a[i], b[i])) f[i][1] = 1;     }     cout << f[1][0] <<     << f[1][1] << endl;   }
#include <bits/stdc++.h>   int main() {     char str[120];     gets(str);     int len = strlen(str) - 1;     int i;     int count = 0;     int reversed = 0;     for (i = 0; i < len; i++) {       if (str[i] ==  V  && str[i + 1] ==  K ) {         str[i] =  c ;         str[i + 1] =  c ;         ++count;       }     }     for (i = 0; i < len; i++) {       if ((str[i] ==  V  && str[i + 1] ==  V ) ||           (str[i] ==  K  && str[i + 1] ==  K ))         reversed = 1;     }     printf( %d , count + reversed);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e6 + 7;   const int M = 22;   const long long mod = 1e9 + 7;   mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long n;     cin >> n;     long long s = 0;     while (s * 10 + 9 <= n + n - 1) {       s = s * 10 + 9;     }     if (s == n + n - 1) {       cout << 1;     } else {       long long len = 1;       while (len * 1ll * 10 <= 1ll * n + n - 1ll) {         len *= 10;       }       long long i = s;       long long ans = 0;       for (; i <= n + n - 1; i += len) {         if (i <= n + 1) {           ans += (i - 1) / 2;         } else {           long long x = i - n;           x = n - x + 1;           ans += x / 2;         }       }       cout << ans;     }   }
#include<bits/stdc++.h>   #define rep(i,a,b)    for(int i=a;i<b;i++)   #define ret(x) return cout<<x,0;   #define rety return cout<< YES ,0;   #define retn return cout<< NO ,0;   typedef long long ll;   typedef double db;   typedef long double ld;   #define stt string   #define ve vector<ll>   #define se set<ll>   #define ar array   ll mod=1e9+7,mod2=998244353;   using namespace std;   ll fac[10000000];   ll gcd(ll x, ll y)   {      if(y==0)          return x;      return gcd(y,x%y);   }   ll fexp(ll a,ll b,ll m){ll ans = 1;while(b){if(b&1)ans=ans*a%m; b/=2;a=a*a%m;}return ans;}   ll inverse(ll a, ll p){return fexp(a, p-2,p);}   ll ncr(ll n, ll r,ll p)   {      if (r==0) return 1;      return (fac[n]*inverse(fac[n-r],p)%p*inverse(fac[r],p)%p)%p;   }   // ____Z-Algorithm_____   vector<ll> za(string s)   {     ll n = s.size();      vector<ll> z(n);      ll x = 0, y = 0,p=0;             for(ll i= 1; i < n; i++)            {             z[i] = max(p,min(z[i-x],y-i+1));           while(i+z[i] < n && s[z[i]] == s[i+z[i]])                {                 x = i; y = i+z[i]; z[i]++;                }            }   return z;   }   void subset(ll a[],ll k)   {      for (int i = 1; i < pow(2, k); i++)      {          for (int j = 0; j < k; j++)          {              if (i & 1 << j)              {                   cout<<a[j]<<   ;              }          }          cout<<endl;      }   }   vector<ll> pr(string s)   {      ll n = s.length();      vector<ll> pi(n);      for (int i = 1; i < n; i++)      {          int j = pi[i-1];          while (j > 0 && s[i] != s[j])              j = pi[j-1];          if (s[i] == s[j])              j++;          pi[i] = j;      }      return pi;   }   //---------------------------------------------------------------------/   int main()   {     ios::sync_with_stdio(0);     cin.tie(0);     ll t;     cin>>t;     while(t--)     {       int n;   cin >> n;   vector<int> a(n);   for(int i = 0; i < n; i++) {       cin >> a[i];   }   cout << 3*n << endl;    for(int i = 1; i <= n; i+=2)    {       cout << 1 <<     << i <<     << i+1 << endl;       cout << 2 <<     << i <<     << i+1 << endl;       cout << 2 <<     << i <<     << i+1 << endl;       cout << 1 <<     << i <<     << i+1 << endl;       cout << 2 <<     << i <<     << i+1 << endl;       cout << 2 <<     << i <<     << i+1 << endl;    }    }   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   bool umin(T& a, T b) {     if (a > b) {       a = b;       return 1;     }     return 0;   }   template <class T>   bool umax(T& a, T b) {     if (a < b) {       a = b;       return 1;     }     return 0;   }   long long F[2][2][1009][1009];   void upd(int x, int y, long long v) {     for (int i = x; i < 1009; i += i & (-i))       for (int j = y; j < 1009; j += j & (-j))         F[x & 1][y & 1][i][j] = F[x & 1][y & 1][i][j] xor v;   }   long long tap(int x, int y) {     long long res = 0;     for (int i = x; i; i -= i & (-i))       for (int j = y; j; j -= j & (-j)) res = res xor F[x & 1][y & 1][i][j];     return res;   }   int main() {     int n, q;     scanf( %d%d , &n, &q);     while (q--) {       int type, x, x1, y1, y;       long long v;       scanf( %d%d%d%d%d , &type, &x, &y, &x1, &y1);       if (type == 2) {         scanf( %lld , &v);         upd(x, y, v);         upd(x1 + 1, y, v);         upd(x, y1 + 1, v);         upd(x1 + 1, y1 + 1, v);       } else         printf( %lld n , tap(x1, y1) xor tap(x1, y - 1) xor tap(x - 1, y1) xor                              tap(x - 1, y - 1));     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e6 + 10;   int pref[N];   vector<int> v;   int fsoma(int l, int r) {     l--;     int ans = pref[r];     if (l >= 0) ans -= pref[l];     return ans;   }   long long n, k, l;   void rbest(pair<int, int> &a, pair<int, int> b) {     if (b.first > a.first or (a.first == b.first and b.second < a.second)) a = b;   }   pair<int, int> comb(pair<int, int> a, pair<int, int> b) {     return {a.first + b.first, a.second + b.second};   }   vector<pair<int, int>> dp(n);   pair<int, int> rec(int i) {     if (i >= 0) return dp[i];     return {0, 0};   }   pair<int, int> f(int c) {     dp = vector<pair<int, int>>(n);     for (int i = 0; i < n; i++) {       rbest(dp[i], rec(i - 1));       rbest(dp[i], comb(rec(i - l), {fsoma(i - (l - 1), i) - c, 1}));     }     return dp[n - 1];   }   long long solve(vector<int> &_v) {     v = _v;     for (int i = 0; i < (int)(v.size()); i++) {       pref[i] = v[i];       if (i) pref[i] += pref[i - 1];     }     int lo = 0, hi = l + 1;     while (lo < hi) {       int mid = (lo + hi) / 2;       if (f(mid).second <= k)         hi = mid;       else         lo = mid + 1;     }     auto par = f(lo);     return pref[(int)(v.size()) - 1] - (par.first + lo * k);   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cin >> n >> k >> l;     string s;     cin >> s;     vector<int> v1((int)(s.size())), v2((int)(s.size()));     for (int i = 0; i < (int)(s.size()); i++) {       if (s[i] >=  A  and s[i] <=  Z ) {         v1[i] = 1;       } else {         v2[i] = 1;       }     }     cout << min(solve(v1), solve(v2)) <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   void fast() {     std::ios_base::sync_with_stdio(0);     cin.tie(NULL);     cout.tie(NULL);     cerr.tie(NULL);   }   int main() {     fast();     unsigned long long over = pow(2, 32);     string s;     int i;     unsigned long long num = 0;     stack<unsigned long long> loop;     loop.push(1);     int n;     cin >> n;     while (n--) {       cin >> s;       if (s ==  add ) {         num += loop.top();         if (num >= over) {           cout <<  OVERFLOW!!! ;           return 0;         }       } else if (s ==  for ) {         cin >> i;         loop.push(min(over, loop.top() * i));       } else {         loop.pop();       }     }     cout << num;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long n, m;   char A[1020304], B[1020304];   int data[1020304][27], vis[1020304];   int main() {     cin >> n >> m;     scanf( %s%s , A + 1, B + 1);     int la = strlen(A + 1), lb = strlen(B + 1);     memset(vis, 0, sizeof(vis));     int len = 0;     int Tot = 0;     for (int i = 1; i <= lb; ++i)       if (!vis[i]) {         ++Tot;         vis[i] = Tot;         memset(data[Tot], 0, sizeof(data[Tot]));         ++data[Tot][B[i] -  a ];         len = 1;         for (int z = (i - 1 + la) % lb + 1; !vis[z]; z = (z - 1 + la) % lb + 1) {           vis[z] = Tot;           ++data[Tot][B[z] -  a ];           ++len;         }       }     long long ans = 0;     for (int i = 1; i <= la; ++i) {       for (int j = 0; j <= 25; ++j)         if ( a  + j != A[i]) {           long long pos = (i - 1 + lb) % lb + 1;           ans += (long long)data[vis[pos]][j] * n / len;         }     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, t, k;   long long l[10005], r[10005];   int x[10005];   char s1[10005][11], s2[10005][11];   int main() {     scanf( %d , &n);     long long lx = -2 * 1000000000, ly = 2 * 1000000000;     l[0] = -2 * 1000000000;     r[0] = 2 * 1000000000;     int flag = 1;     for (int i = 1; i <= n; i++) {       scanf( %s%d%s , s1[i], &x[i], s2[i]);       if (s2[i][0] ==  N ) {         if (s1[i][0] ==  < ) {           s1[i][0] =  > ;           if (s1[i][1] ==  = )             s1[i][1] =   0 ;           else             s1[i][1] =  = ;         } else {           if (s1[i][0] ==  > ) {             s1[i][0] =  < ;             if (s1[i][1] ==  = )               s1[i][1] =   0 ;             else               s1[i][1] =  = ;           }         }       }       if (s1[i][0] ==  <  && s1[i][1] ==  = ) {         l[i] = l[i - 1];         r[i] = x[i];       }       if (s1[i][0] ==  <  && s1[i][1] !=  = ) {         l[i] = l[i - 1];         r[i] = x[i] - 1;       }       if (s1[i][0] ==  >  && s1[i][1] ==  = ) {         r[i] = r[i - 1];         l[i] = x[i];       }       if (s1[i][0] ==  >  && s1[i][1] !=  = ) {         r[i] = r[i - 1];         l[i] = x[i] + 1;       }       if (l[i] > r[i]) flag = 0;       lx = max(lx, l[i]);       ly = min(ly, r[i]);     }     if (lx > ly) flag = 0;     if (flag) {       printf( %I64d n , lx);     } else       printf( Impossible n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long n, m, k;   long long calc(long long nk, long long mk) {     return (n / (nk + 1)) * (m / (mk + 1));   }   int main() {     cin >> n >> m >> k;     if (k > n + m - 2) {       cout << -1;       return 0;     }     long long nk = min(k, n - 1);     long long mk = min(k, m - 1);     long long a = calc(nk, k - nk);     long long b = calc(k - mk, mk);     cout << max(a, b);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main(int argc, char* argv[]) {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int n;     cin >> n;     int minr = 1e9 + 2;     int maxl = 0;     for (int i = 0; i < n; i++) {       int l, r;       cin >> l >> r;       if (l > maxl) {         maxl = l;       }       if (r < minr) {         minr = r;       }     }     int m;     cin >> m;     int minr2 = 1e9 + 2;     int maxl2 = 0;     for (int i = 0; i < m; i++) {       int l, r;       cin >> l >> r;       if (l > maxl2) {         maxl2 = l;       }       if (r < minr2) {         minr2 = r;       }     }     int diff1 = maxl - minr2;     int diff2 = maxl2 - minr;     int sol = max(max(diff1, diff2), 0);     cout << sol <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     vector<int> report(n);     int posCount = 0;     int negCount = 0;     for (int i = 0; i < n; i++) {       cin >> report[i];       if (report[i] >= 0) {         posCount++;       } else {         negCount++;       }     }     if (posCount == n) {       cout << 1 << endl;       cout << n << endl;       return 0;     }     if (negCount <= 2) {       cout << 1 << endl;       cout << n << endl;       return 0;     }     int neg = 0;     int folders = 0;     int partitions = 0;     vector<int> item;     for (int i = 0; i < report.size(); i++) {       folders++;       if (report[i] < 0) {         neg++;         if (neg == 3) {           item.push_back(--folders);           i--;           partitions++;           folders = 0;           neg = 0;         }       }     }     if (folders != 0) {       item.push_back(folders);     }     cout << ++partitions << endl;     for (auto x : item) {       cout << x <<    ;     }     cout << endl;   }
#include <bits/stdc++.h>   using namespace std;   int b[105];   int vis[105];   int main() {     int n;     scanf( %d , &n);     int a[105];     for (int i = 0; i < n; i++) {       scanf( %d , &a[i]);       b[a[i]]++;     }     int ans1 = 0;     int ans2 = 0;     int jo = 1;     int mm = 0;     for (int i = 0; i < n; i++) {       int x = a[i];       if (b[x] > 0) {         if (b[x] <= 2) {           if (jo == 1) {             vis[i] = 1;             jo = -1;             ans1++;             if (b[x] == 2) {               for (int j = i + 1; j <= n; j++) {                 if (a[i] == x) {                   vis[i] = -1;                   jo = 1;                   ans2++;                   break;                 }               }             }           } else {             vis[i] = -1;             jo = 1;             ans2++;             if (b[x] == 2) {               for (int j = i + 1; j <= n; j++) {                 if (a[i] == x) {                   vis[i] = 1;                   jo = -1;                   ans1++;                   break;                 }               }             }           }           b[x] = 0;         } else {           mm++;         }       }     }     if (ans1 == ans2) {       cout <<  YES  << endl;       for (int i = 0; i < n; i++) {         if (vis[i] == 1) {           cout <<  B ;         } else {           cout <<  A ;         }       }     } else {       if (mm == 0) {         cout <<  NO  << endl;       } else {         if (ans1 > ans2) {           for (int i = 0; i < n; i++) {             if (b[a[i]] > 2) {               vis[i] = -1;               break;             }           }           cout <<  YES  << endl;           for (int i = 0; i < n; i++) {             if (vis[i] == 1 || vis[i] == 0) {               cout <<  B ;             } else {               cout <<  A ;             }           }         } else {           for (int i = 0; i < n; i++) {             if (b[a[i]] > 2) {               vis[i] = 1;               break;             }           }           cout <<  YES  << endl;           for (int i = 0; i < n; i++) {             if (vis[i] == 1) {               cout <<  B ;             } else {               cout <<  A ;             }           }         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string s1;     string s2;     while (cin >> s1 >> s2) {       int n = s1.length(), m = s2.length();       int dp[n + 1][m + 1];       for (int i = 0; i < n + 1; i++) dp[i][0] = i;       for (int i = 0; i < m + 1; i++) dp[0][i] = i;       for (int i = 1; i < n + 1; i++) {         for (int j = 1; j < m + 1; j++) {           if (s1[i - 1] == s2[j - 1])             dp[i][j] = dp[i - 1][j - 1];           else             dp[i][j] = min(min(dp[i - 1][j], dp[i][j - 1]), dp[i - 1][j - 1]) + 1;         }       }       cout << dp[n][m] << endl;       int i = n, j = m;       while (i >= 0 && j >= 0) {         if (dp[i][j - 1] == dp[i][j] - 1) {           cout <<  INSERT   + to_string(i + 1) +     + s2[j - 1] << endl;           j--;         } else if (dp[i - 1][j] == dp[i][j] - 1) {           cout <<  DELETE   + to_string(i) << endl;           i--;         } else if (dp[i - 1][j - 1] == dp[i][j] - 1 && s1[i - 1] != s2[j - 1]) {           cout <<  REPLACE   + to_string(i) +     + s2[j - 1] << endl;           i--, j--;         } else           i--, j--;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct Trie {     struct Node {       char c;       vector<pair<int, int> > n;       Node* ch[26];       Node(char ch) {         this->c = ch;         for (int i = 0; i < 26; i++) this->ch[i] = NULL;       }     };     Node* root;     vector<pair<int, int> > res;     int sum;     Trie() {       root = new Node(   );       sum = 0;     }     void create(string s, int t, int ind) {       Node* now = root;       for (int i = 0; i < s.size(); i++) {         if (now->ch[s[i] -  a ] == NULL)           now = now->ch[s[i] -  a ] = new Node(s[i]);         else           now = now->ch[s[i] -  a ];       }       (now->n).push_back(make_pair(ind, t));     }     pair<vector<int>, vector<int> > dfs(Node* now, int depth) {       vector<int> O, P;       for (int i = 0; i < 26; i++)         if (now->ch[i] != NULL) {           pair<vector<int>, vector<int> > t = dfs(now->ch[i], depth + 1);           O.insert(O.end(), t.first.begin(), t.first.end());           P.insert(P.end(), t.second.begin(), t.second.end());         }       vector<pair<int, int> > t = now->n;       for (int i = 0; i < t.size(); i++)         if (t[i].second == 1)           O.push_back(t[i].first);         else if (t[i].second == 2)           P.push_back(t[i].first);       while (O.size() && P.size()) {         sum += depth;         res.push_back(make_pair(O[0], P[0]));         O.erase(O.begin());         P.erase(P.begin());       }       return make_pair(O, P);     }     void doit() {       dfs(root, 0);       printf( %d n , sum);       for (int i = 0; i < res.size(); i++)         printf( %d %d n , res[i].first, res[i].second);     }   };   int main() {     Trie trie;     string s;     int n;     scanf( %d n , &n);     for (int i = 1; i <= 2; i++)       for (int j = 1; j <= n; j++) {         cin >> s;         trie.create(s, i, j);       }     trie.doit();   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1E5 + 5;   int t[N], n, a[N], f[N], b[N], k, x, mid;   vector<int> G[N];   long long ans;   bool O = 0;   int work() {     memset(f, 0, sizeof(f));     for (int i = k; i <= n - k + 1; i++) f[b[i]]++;     int o = 0;     for (int i = 1; i <= n; i++)       if (f[i] & 1) {         if (o) return n - k + 1;         o = i;       }     if (((n & 1) ^ (o > 0))) return n - k + 1;     memset(f, 0, sizeof(f));     for (int i = 1; i <= n; i++) G[i].clear();     for (int i = k; i <= n - k + 1; i++) {       x = b[i];       t[x]++;       G[x].push_back(i);     }     int mini = k;     if (o && o != b[mid]) mini = mid;     O = 1;     for (int i = n - k + 1; i >= mini; i--)       if (i > mid) {         f[x = b[i]]++;         if (f[x] > t[x] || G[x][f[x] - 1] >= i) return i - 1;         if (b[i] != b[n - i + 1]) mini = max(mini, G[x][f[x] - 1]);       } else if (b[i] != b[n - i + 1])         return i - 1;     return mini - 1;   }   int main() {     cin >> n;     mid = n / 2 + (n & 1);     for (int i = 1; i <= n; i++) scanf( %d , &a[i]);     for (k = 1; k <= mid && a[k] == a[n - k + 1]; k++)       ;     if (k > mid) {       cout << (long long)n * (n + 1) / 2;       return 0;     }     for (int i = k; i <= n - k + 1; i++) b[i] = a[i];     ans = n - k + 1 - work();     for (int i = k; i <= n - k + 1; i++) b[n - i + 1] = a[i];     ans += n - k + 1 - work();     ans = ans * k;     if (ans) ans += (long long)(k - 1) * (k - 1);     if (O) ans--;     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   const long long INF = 0x3f3f3f3f;   const int N = 2e5 + 10;   const long long mod = 1e9 + 7;   const bool debug = false;   int F[N], Finv[N], inv[N];   void init() {     inv[1] = 1, F[0] = Finv[0] = 1;     for (int i = 2; i < N; i++)       inv[i] = (mod - mod / i) * 1ll * inv[mod % i] % mod;     for (int i = 1; i < N; i++) {       F[i] = F[i - 1] * 1ll * i % mod;       Finv[i] = Finv[i - 1] * 1ll * inv[i] % mod;     }   }   int comb(int n, int m) {     if (m < 0 || m > n) return 0;     return F[n] * 1ll * Finv[n - m] % mod * Finv[m] % mod;   }   int main() {     init();     int n;     long long T;     scanf( %d%lld , &n, &T);     long long pre = 1, r = 0, ans = 0, gg = 1;     for (int i = 1, x; i <= n; ++i) {       scanf( %d , &x);       T -= x;       if (T < 0) break;       pre = (pre * 2 - comb(i - 1, r) + mod) % mod;       while (r < min(i * 1ll, T)) {         pre += comb(i, ++r);       }       while (r > min(i * 1ll, T)) {         pre -= comb(i, r--);       }       pre %= mod;       if (pre < 0) pre += mod;       gg = gg * (mod + 1) / 2 % mod;       ans = (ans + pre * gg) % mod;     }     printf( %lld n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   long long a[1010];   int main() {     cin >> n;     for (int i = 0; i < n; i++) {       cin >> a[i];     }     long long k;     cin >> k;     cin >> k;     cin >> k;     long long x = (long long)a[2] * a[1] / k;     long double dx = x;     long long ans = (long long)(sqrt(x) + 0.005);     cout << ans <<    ;     for (int i = 1; i < n; i++) {       cout << a[i] / ans <<    ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long gcd(long long a, long long b) {     if (b == 0) return a;     return gcd(b, a % b);   }   long long _pow(long long a, long long b) {     long long x = 1;     for (long long j = 0; j < b; j++) {       x *= a;     }     return x;   }   bool test(int a, int n, int m) {     if (a <= 0)       return true;     else if (m == 0 && n == 0)       return false;     else {       if (n > 0 && (a > (a / 2) + 10)) return test(a / 2 + 10, n - 1, m);       if (m > 0) return test(a - 10, n, m - 1);       if (n > 0) return false;     }   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int t;     cin >> t;     for (int h = 0; h < t; h++) {       int a, n, m;       cin >> a >> n >> m;       cout << (test(a, n, m) ?  YES  :  NO ) <<   n ;     }   }