malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int maxn = 2e5 + 5;   const int inf = 0x3f3f3f3f;   long long dp[maxn];   int n, m;   struct node {     int lb, lu;     long long w;   };   vector<node> ve[maxn];   int lb, lu;   long long w, cost[maxn];   struct seg {     long long ma, lazy;   } tr[maxn << 2];   void build(int o, int l, int r) {     tr[o].ma = 0;     tr[o].lazy = 0;     if (l == r) {       return;     }     int mid = (l + r) >> 1;     build(o << 1, l, mid);     build(o << 1 | 1, mid + 1, r);   }   void pushup(int o) { tr[o].ma = max(tr[o << 1].ma, tr[o << 1 | 1].ma); }   void pushdown(int o) {     if (tr[o].lazy) {       tr[o << 1].ma += tr[o].lazy;       tr[o << 1 | 1].ma += tr[o].lazy;       tr[o << 1].lazy += tr[o].lazy;       tr[o << 1 | 1].lazy += tr[o].lazy;       tr[o].lazy = 0;     }   }   void update(int o, int l, int r, int ql, int qr, long long val) {     if (ql <= l && qr >= r) {       tr[o].ma += val;       tr[o].lazy += val;       return;     }     pushdown(o);     int mid = (l + r) >> 1;     if (ql <= mid) update(o << 1, l, mid, ql, qr, val);     if (qr > mid) update(o << 1 | 1, mid + 1, r, ql, qr, val);     pushup(o);   }   long long query(int o, int l, int r, int ql, int qr) {     if (ql <= l && qr >= r) {       return tr[o].ma;     }     pushdown(o);     int mid = (l + r) >> 1;     long long maxx = 0;     if (ql <= mid) maxx = max(maxx, query(o << 1, l, mid, ql, qr));     if (qr > mid) maxx = max(maxx, query(o << 1 | 1, mid + 1, r, ql, qr));     return maxx;   }   int main() {     while (cin >> n >> m) {       for (int i = 1; i <= n; i++) {         scanf( %lld , &cost[i]);       }       for (int i = 1; i <= m; i++) {         scanf( %d%d%lld , &lb, &lu, &w);         ve[lu].push_back({lb, lu, w});       }       build(1, 0, n + 1);       long long maxx = 0;       for (int i = 1; i <= n + 1; i++) {         dp[i] = dp[i - 1];         update(1, 0, n + 1, 0, i - 1, -cost[i]);         for (int j = 0; j < ve[i].size(); j++) {           lb = ve[i][j].lb, w = ve[i][j].w;           update(1, 0, n + 1, 0, lb - 1, w);         }         dp[i] = max(dp[i], query(1, 0, n + 1, 0, i - 1));         update(1, 0, n + 1, i, i, dp[i]);         maxx = max(maxx, dp[i]);       }       printf( %lld n , maxx);     }   }
#include <bits/stdc++.h>   using namespace std;   int n, m;   int cntrow[21];   int cntcol[6];   vector<int> sol;   vector<int> allmasks[6];   bool DP[20][11][11][11][11][11][(1 << 5) + 1];   bool solve(int row, int c1, int c2, int c3, int c4, int c5, int mask) {     if (row == m) {       int tmp = c1 + c2 + c3 + c4 + c5;       if (tmp == 0) return true;       return false;     }     bool &temp = DP[row][c1][c2][c3][c4][c5][mask];     if (temp) return false;     temp = true;     for (int i = 0; i < allmasks[cntrow[row]].size(); i++) {       int tmp = allmasks[cntrow[row]][i];       int nc1 = c1;       int nc2 = c2;       int nc3 = c3;       int nc4 = c4;       int nc5 = c5;       if ((mask & (1 << 0)) == 0 && (tmp & (1 << 0)) != 0) nc1--;       if ((mask & (1 << 1)) == 0 && (tmp & (1 << 1)) != 0) nc2--;       if ((mask & (1 << 2)) == 0 && (tmp & (1 << 2)) != 0) nc3--;       if ((mask & (1 << 3)) == 0 && (tmp & (1 << 3)) != 0) nc4--;       if ((mask & (1 << 4)) == 0 && (tmp & (1 << 4)) != 0) nc5--;       if (nc1 < 0 || nc2 < 0 || nc3 < 0 || nc4 < 0 || nc5 < 0) continue;       if (solve(row + 1, nc1, nc2, nc3, nc4, nc5, tmp)) {         sol.push_back(tmp);         return true;       }     }     return false;   }   int main() {     ios_base::sync_with_stdio(0);     cin >> n >> m;     for (int i = 0; i < n; i++) cin >> cntcol[i];     for (int i = 0; i < m; i++) cin >> cntrow[i];     for (int i = 0; i < (1 << n); i++) {       int cnt = 0;       for (int j = 0; j < n; j++) {         if (j == 0 || ((i & (1 << (j - 1))) == 0))           if ((i & (1 << j)) != 0) cnt++;       }       allmasks[cnt].push_back(i);     }     solve(0, cntcol[0], cntcol[1], cntcol[2], cntcol[3], cntcol[4], 0);     reverse(sol.begin(), sol.end());     for (int j = 0; j < n; j++) {       for (int i = 0; i < sol.size(); i++) {         if (sol[i] & (1 << j))           cout <<  * ;         else           cout <<  . ;       }       cout <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void f(int& r, int& g, int& b) {     if (r >= 3 && g % 3 == 2 && b % 3 == 2) {       r += 4;       g -= 2;       b -= 2;     }   }   int main(void) {     int r, g, b;     cin >> r >> g >> b;     f(r, g, b);     f(g, r, b);     f(b, r, g);     cout << r / 3 + g / 3 + b / 3 + min(r % 3, min(g % 3, b % 3)) << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cout.setf(ios::fixed);     cout.precision(20);     int T;     cin >> T;     while (T--) {       int n;       cin >> n;       n *= 2;       vector<int> a(n);       for (int &x : a) {         cin >> x;       }       map<int, int> left, right;       map<int, bool> was;       int red = 0, blue = 0;       int res = n;       for (int i = n - 1; i >= n / 2; i--) {         int toEat = n / 2 - (n - i);         red += (a[i] == 1);         blue += (a[i] == 2);         right[red - blue] = toEat;         was[red - blue] = true;         if (i == n / 2 && red == blue) {           res = min(res, n / 2);         }         if (red == blue) {           res = min(res, n / 2 + toEat);         }       }       red = blue = 0;       for (int i = 0; i < n / 2; i++) {         int toEat = n / 2 - i - 1;         red += (a[i] == 1);         blue += (a[i] == 2);         if (red == blue) {           res = min(res, n / 2 + toEat);         }         if (was[blue - red]) {           res = min(res, toEat + right[blue - red]);         }         if (i == n / 2 - 1 && red == blue) {           res = min(res, n / 2);         }       }       cout << res <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string str;     cin >> str;     int n = str.size();     int fl = 1;     vector<char> v;     for (int i = 0; i < str.size(); i++) {       if (str[i] ==  / ) {         while (str[i] ==  / ) {           i++;         }         i--;         v.push_back( / );       } else {         v.push_back(str[i]);       }     }     for (int i = 0; i < v.size(); i++) {       if (v[i] !=  / ) {         fl = 0;         break;       }     }     if (fl == 1) {       cout <<  /  << endl;     } else {       int t = v.size();       for (int i = 0; i < t; i++) {         if (i == t - 1 && v[i] ==  / ) {           continue;         } else {           cout << v[i];         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     int k;     cin >> k;     string s;     cin >> s;     long long tot = 0;     int av[11];     memset(av, 0, sizeof(av));     int ans = 0;     for (char a : s) tot += a -  0 , av[9 - (a -  0 )]++;     for (int i = 10; i; i--) {       if (tot >= k) break;       if (k - av[i] * i < tot) {         while (k > tot) {           k -= i;           ans++;         }         break;       } else {         k -= av[i] * i;         ans += av[i];       }     }     cout << ans <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, i, j;     scanf( %d , &n);     if (n == 1)       printf( 1 n1 n );     else if (n == 2)       printf( 1 n1 n );     else if (n == 3)       printf( 2 n1 3 n );     else if (n == 4)       printf( 4 n2 4 1 3 n );     else {       printf( %d n , n);       for (j = 2; j <= n; j += 2) printf( %d  , j);       for (j = 1; j <= n; j += 2) printf( %d  , j);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int ar[11000111];   int el[5100];   int q, x, k, n;   long long t;   int min(int a, int b) {     if (a < b) {       return a;     }     return b;   }   int main() {     scanf( %d , &n);     scanf( %d , &k);     for (int i = 0; i < n; ++i) {       scanf( %d , &x);       ar[x] = 1;       el[i] = x;     }     scanf( %d , &q);     for (int qq = 0; qq < q; ++qq) {       scanf( %I64d , &t);       int ans = 100;       for (int i = 0; i < n; ++i) {         for (int j = 0; j < k + 1; ++j) {           long long temp = t - el[i] * j;           if (temp > 0) {             for (int l = 1; l <= k - l + 1; ++l) {               if (temp % l == 0 && temp / l <= 10111000 && ar[temp / l] == 1) {                 ans = min(ans, l + j);               }             }           }         }       }       if (ans <= k) {         printf( %d n , ans);       } else {         printf( -1 n );       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(0), cin.tie(0), cin.tie(0), cout.tie(0),         cout.precision(15);     int t;     cin >> t;     while (t--) {       int n, x;       set<int> s;       cin >> n;       for (int i = int(0); i < int(n); i++) {         cin >> x;         s.insert(x);       }       cout << s.size() <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int a[10000000], b[10000000], memo[10000000], pos[10000000];   int min(int l, int r) {     if (l <= r) {       return l;     }     return r;   }   int main() {     int n, m, i, j, k, ind, p, l, x;     fscanf(stdin,  %d %d , &n, &m);     for (i = 1; i <= n; i++) {       fscanf(stdin,  %d , &a[i]);     }     i = 1;     ind = 1;     while (i <= n) {       j = i;       k = a[i];       memo[ind] = k;       pos[ind] = i;       while (j <= n && a[j] == k) {         b[j] = ind;         j++;       }       i = j;       ind++;     }     for (i = 1; i <= m; i++) {       fscanf(stdin,  %d %d %d , &p, &l, &x);       if (b[p] == b[l]) {         if (x == a[p]) {           cout <<  -1  << endl;         } else {           cout << p << endl;         }       } else {         ind = b[p];         if (memo[b[p]] != x) {           cout << p << endl;         } else {           ind = 1;           while (pos[b[p] + ind] == x) {             ind++;           }           cout << pos[b[p] + ind] << endl;         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   char s[1005];   long long t, ans = 0;   int x, l;   int main() {     scanf( %s , s);     int len = strlen(s);     for (int i = 0; i < len; i++) {       if (isalpha(s[i])) {         if (t) {           if (l == 2)             ans += t;           else             ans += t * 100;         }         t = 0;         x = 0;         l = 0;       } else {         if (isdigit(s[i])) {           t = t * 10 + s[i] -  0 ;           if (x) {             l++;           }         } else {           x = 1;           l = 0;         }       }     }     if (t) {       if (l == 2) {         ans += t;       } else         ans += t * 100;     }     long long temp = ans / 100;     long long temp1 = ans % 100;     len = 0;     string A =   ;     if (temp == 0) A = A +  0 ;     while (temp) {       if (len && len % 3 == 0) {         A = A +  . ;       }       char c =  0  + temp % 10;       A = A + c;       temp /= 10;       len++;     }     reverse(A.begin(), A.end());     cout << A;     if (temp1) {       printf( .%.2I64d , temp1);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<int> g[1000010];   int n, k;   bool r[1000010];   int s[1000010];   int m[1000010];   int main() {     scanf( %d %d , &n, &k);     for (int i = 0; i < k; i++) {       int x, y;       scanf( %d %d , &x, &y);       g[x].push_back(y);     }     int v = 0;     for (int i = 1; i <= n; i++) {       if (r[i]) continue;       s[v++] = i;       r[i] = true;       for (int j = 0; j < (int)g[i].size(); j++) r[g[i][j]] = true;     }     int sz = 0;     for (int i = 1; i <= n; i++) r[i] = false;     for (int i = v - 1; i >= 0; i--) {       if (!r[s[i]]) {         m[sz++] = s[i];         for (int j = 0; j < (int)g[s[i]].size(); j++) r[g[s[i]][j]] = true;       }     }     printf( %d n , sz);     for (int i = 0; i < sz; i++) printf( %d  , m[i]);     printf(  n );     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize( Ofast )   using namespace std;   int n, k, a[1010][1010];   vector<pair<int, int>> ans;   int main() {     int is = 0;     ans.clear();     memset(a, 0, sizeof(a));     cin >> n >> k;     for (int i = 1; i <= n; ++i) {       int cnt = 0;       for (int j = 1; j <= n; ++j) {         if (i == j) continue;         if (cnt == k) break;         if (a[j][i] == 0) {           a[i][j] = 1;           ++cnt;           ans.push_back({i, j});         }       }       if (cnt != k) {         cout <<  -1 ;         return 0;       }     }     if (!is) {       cout << ans.size() <<   n ;       for (auto i : ans) {         cout << i.first <<     << i.second <<   n ;       }     }   }
#include <bits/stdc++.h>   using namespace std;   int n, m;   vector<int> adjs[510];   char type[510];   bool visited[510];   int dfs(int v, int adj, char c) {     visited[v] = true;     type[v] = c;     int totV = 1;     for (int i = 0; i < (adj); i++) {       int adjV = adjs[v][i];       if (!visited[adjV] && adjs[adjV].size() == adj) totV += dfs(adjV, adj, c);     }     return totV;   }   int main(int argc, char **argv) {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cin >> n >> m;     for (int var = 0; var < (n); var++) type[var] = ( x );     for (int var = 0; var < (n); var++) visited[var] = (false);     for (int i = 0; i < (m); i++) {       int u, v;       cin >> u >> v;       u--;       v--;       adjs[u].push_back(v);       adjs[v].push_back(u);     }     int adja = -1, adjb = n - 1, adjc = -1;     int na = 0, nb = 0, nc = 0;     bool pos = true;     for (int i = 0; i < (n); i++) {       int k = adjs[i].size();       if (k == adjb) {         nb++;         type[i] =  b ;         visited[i] = true;       } else if (!visited[i]) {         if (na == 0) {           adja = adjs[i].size();           na = dfs(i, adja,  a );         } else if (nc == 0) {           adjc = adjs[i].size();           nc = dfs(i, adjc,  c );         } else           pos = false;       }     }     type[n] =   0 ;     if (pos && na + nb + nc == n && (adja == -1 || adja == na + nb - 1) &&         (adjc == -1 || adjc == nb + nc - 1)) {       cout << ( Yes ) <<   n ;       cout << (type) <<   n ;     } else {       cout << ( No ) <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 2e5 + 9;   const int L = 301;   const int INF = 1e9 + 239;   int n;   int a[N];   int cnt[N];   vector<int> pos[N];   int mn[2 * N];   void solve(vector<pair<int, int>> v, int &ans) {     v.push_back({n - 1, 0});     int prev = -1;     int c = 0;     mn[N] = 0;     for (auto [pos, val] : v) {       if (abs(prev) < 2) ans = max(ans, (pos - 1) - mn[c + N] + 1);       c += val;       ans = max(ans, pos - mn[c + N] + 1);       mn[c + N] = min(mn[c + N], pos + 1);       prev = val;     }     c = 0;     mn[0] = INF;     for (auto [pos, val] : v) {       c += val;       mn[c + N] = INF;     }   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     fill(mn, mn + 2 * N, INF);     cin >> n;     for (int i = 0; i < n; i++) {       cin >> a[i];       cnt[a[i]]++;       pos[a[i]].push_back(i);     }     int ans = 0;     int mx = max_element(cnt, cnt + N) - cnt;     int pnt = -1;     int sz = -1;     vector<pair<int, int>> vplus, vminus;     auto add = [&](int p) {       int imx = lower_bound(pos[mx].begin(), pos[mx].end(), p) - pos[mx].begin();       int l = max(pnt + 1, imx - (sz + 3));       if (pnt + 1 < imx - (sz + 3)) {         vplus.push_back({pos[mx][pnt + 1], imx - (sz + 3) - (pnt + 1)});       }       for (int i = l; i <= imx + (sz + 3) && i < (int)pos[mx].size(); i++) {         vplus.push_back({pos[mx][i], 1});         pnt = i;       }     };     auto relax_small = [&](int s) {       if (pos[s].empty()) {         return;       }       vplus.clear();       vminus.clear();       sz = (int)pos[s].size();       pnt = -1;       { add(0); }       for (auto p : pos[s]) {         add(p);         vminus.push_back({p, -1});       }       { add(n - 1); }       vector<pair<int, int>> vall(vplus.size() + vminus.size());       merge(vplus.begin(), vplus.end(), vminus.begin(), vminus.end(),             vall.begin());       solve(vall, ans);     };     auto relax_big = [&](int s) {       if (pos[s].empty()) {         return;       }       vplus.clear();       vminus.clear();       for (auto p : pos[mx]) {         vplus.push_back({p, 1});       }       for (auto p : pos[s]) {         vminus.push_back({p, -1});       }       vector<pair<int, int>> vall(vplus.size() + vminus.size());       merge(vplus.begin(), vplus.end(), vminus.begin(), vminus.end(),             vall.begin());       solve(vall, ans);     };     for (int other = 0; other < N; other++) {       if (other == mx) {         continue;       }       if (pos[other].size() > L) {         relax_big(other);       } else {         relax_small(other);       }     }     cout << ans <<   n ;   }
#pragma GCC optimize ( O3 )   #pragma GCC target ( sse4 )   #include <bits/stdc++.h>   using namespace std;   typedef long long ll;   typedef long double ld;   typedef vector<int> vi;   typedef pair<int, int> pi;   #define debug(x) cerr << #x <<  :   << x <<   n    #define debug2(x, y) debug(x), debug(y)   #define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)   #define rep(i, a) for(int i = 0; i < (int)(a); i++)   #define all(v) v.begin(), v.end()   #define mp make_pair   #define pb push_back   #define lb lower_bound   #define ub upper_bound   #define fi first   #define se second   #define sq(x) ((x) * (x))   const int MOD = 1e9 + 7;   const int mxN = 205;      template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }      vi g[mxN];   int up[mxN][10];   ll p[mxN][mxN];   int st[mxN], en[mxN], d[mxN];   int cnt = 0;      void dfs(int cur, int prev, int di = 0){    st[cur] = cnt++;    d[cur] = di;    up[cur][0] = prev;    repn(i, 1, 10) up[cur][i] = up[up[cur][i - 1]][i - 1];    for(int x : g[cur]) if(x != prev) dfs(x, cur, di + 1);    en[cur] = cnt++;   }      bool upper(int a, int b){    return st[a] <= st[b] && en[a] >= en[b];   }      int lca(int a, int b){    if(upper(a, b)) return a;    if(upper(b, a)) return b;    for(int i = 9; i >= 0; i--) if(!upper(up[a][i], b)) a = up[a][i];    return up[a][0];   }      ll mypow(ll a, ll p){    if(p == 0) return 1;    if(p == 1) return (a % MOD);    if(p & 1) return ((a % MOD) * (mypow(a, p - 1) % MOD)) % MOD;    ll x = mypow(a, p / 2) % MOD;    return (x * x) % MOD;   }      ll inv(ll base){    return mypow(base, MOD - 2);   }      int main(){    ios_base::sync_with_stdio(false);    cin.tie(0);    //freopen( input.in ,  r , stdin);    //freopen( output.out ,  w , stdout);    ll n;    cin >> n;    rep(i, n - 1){     int x, y;     cin >> x >> y;     x--, y--;     g[x].pb(y);     g[y].pb(x);    }    p[0][0] = 1LL;    rep(i, mxN - 1){     rep(j, i + 1){      int k = i - j;      (p[j + 1][k] += (p[j][k] * inv(2)) % MOD) %= MOD;      (p[j][k + 1] += (p[j][k] * inv(2)) % MOD) %= MOD;     }    }    rep(k, n) repn(j, 1, n) (p[j][k] += p[j - 1][k]) %= MOD;    ll ans = 0LL;    rep(i, n){     cnt = 0;     dfs(i, i);     rep(j, n) repn(k, j + 1, n){      if(upper(k, j)) ans++;      else if(!upper(j, k)){       int c = lca(j, k);       int a = d[j] - d[c], b = d[k] - d[c];       (ans += (p[a - 1][b - 1] * inv(2)) % MOD) %= MOD;      }     }    }    cout << (ans * inv(n)) % MOD <<   n ;    return 0;   }   /*   Things to look out for:    - Integer overflows    - Make sure that max is large enough (2e9, 4e18)    - Special cases   Be careful!   */
#include <bits/stdc++.h>   using namespace std;   clock_t __stt;   inline void TStart() { __stt = clock(); }   inline void TReport() {     printf(  nTaken Time : %.3lf sec n ,            (double)(clock() - __stt) / CLOCKS_PER_SEC);   }   template <typename T>   T MIN(T a, T b) {     return a < b ? a : b;   }   template <typename T>   T MAX(T a, T b) {     return a > b ? a : b;   }   template <typename T>   T ABS(T a) {     return a > 0 ? a : (-a);   }   template <typename T>   void UMIN(T &a, T b) {     if (b < a) a = b;   }   template <typename T>   void UMAX(T &a, T b) {     if (b > a) a = b;   }   const int bc = 6, mc = 64;   int n, m, subcnt[mc], chcnt[mc], avai[100005];   char s[100005], tmp[10];   int main() {     int i, j, k;     scanf( %s , s);     n = strlen(s);     scanf( %d , &m);     fill(avai, avai + n, mc - 1);     while (m--) {       scanf( %d%s , &j, tmp);       k = strlen(tmp);       avai[--j] = 0;       for (i = 0; i < k; ++i) {         avai[j] += (1 << (tmp[i] -  a ));       }     }     for (i = 0; i < n; ++i) {       for (j = 0; j < mc; ++j) {         if ((avai[i] & j) == avai[i]) {           ++subcnt[j];         }         if ((1 << (s[i] -  a )) & j) {           ++chcnt[j];         }       }     }     for (i = 0; i < n; ++i) {       for (j = 0; j < bc; ++j) {         if (!(avai[i] & (1 << j))) continue;         s[i] =  a  + j;         for (k = 0; k < mc; ++k) {           if ((avai[i] & k) == avai[i]) {             --subcnt[k];           }           if ((1 << j) & k) {             --chcnt[k];           }         }         for (k = 0; k < mc; ++k) {           if (chcnt[k] < subcnt[k]) break;         }         if (k == mc) break;         for (k = 0; k < mc; ++k) {           if ((avai[i] & k) == avai[i]) {             ++subcnt[k];           }           if ((1 << j) & k) {             ++chcnt[k];           }         }       }       if (j == bc) {         printf( Impossible n );         return 0;       }     }     printf( %s n , s);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int lastr, lastc;   int n, m, a, b;   int row1[10], rcnt, ans;   int main() {     int i, j, k;     while (scanf( %d%d%d%d , &n, &m, &a, &b) != EOF) {       if (m == 1) {         printf( 1 n );         continue;       }       lastr = (n + m - 1) / m;       lastc = n % m;       lastc = lastc == 0 ? m : lastc;       ans = 0, rcnt = 0;       row1[++rcnt] = (a + m - 1) / m;       if ((b + m - 1) / m != (a + m - 1) / m) {         if ((b + m - 1) / m == (a + m - 1) / m + 1)           row1[++rcnt] = (b + m - 1) / m;         else           row1[++rcnt] = row1[1] + 1, row1[++rcnt] = (b + m - 1) / m;       }       int ta = a % m, tb = b % m;       if (ta == 0) ta = m;       if (tb == 0) tb = m;       if (rcnt == 1)         printf( 1 n );       else if (rcnt == 2) {         if (ta == 1 &&             (row1[2] != lastr && tb == m || row1[2] == lastr && tb == lastc))           printf( 1 n );         else           printf( 2 n );       } else {         if (ta == 1 &&             (row1[3] != lastr && tb == m || row1[3] == lastr && tb == lastc))           printf( 1 n );         else if (ta == 1 || tb == m || ta - 1 == tb ||                  (lastr == row1[3] && lastc == tb))           printf( 2 n );         else           printf( 3 n );       }     }   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   void solve() {     int n;     cin >> n;     string s = string(n,  ( ) + string(n,  ) );     cout << s <<   n ;     for (int i = 0; i + 1 < n; ++i) {       s[i + 1] =  ) ;       s[2 * n - 2] =  ( ;       cout << s <<   n ;       s[2 * n - 2] =  ) ;       s[i + 1] =  ( ;     }   }   int main() {     ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr),         cout.precision(12);     int t;     cin >> t;     while (t--) solve();   }
#include <bits/stdc++.h>   long long minus(long long k) { return (1000000009LL - 1 + k) % 1000000009LL; }   long long multiply(long long k) { return (k * 2) % 1000000009LL; }   long long multiply(long long a, long long b) { return (a * b) % 1000000009LL; }   int main() {     int n, m;     scanf( %d %d , &n, &m);     long long p = 1;     for (int i = 0; i < m; i++) p = multiply(p);     if (m < 20 && p < n) {       printf( 0 n );       return 0;     }     long long ans = 1;     for (int i = 0; i < n; i++) {       p = minus(p);       ans = multiply(ans, p);     }     printf( %I64d n , ans);   }