malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   const int MN = 1e3 + 10;   const int K = 20;   int N, M, T, id[MN], t[MN], ctr, m[1 << K];   bool conn[MN][MN];   char s[10];   std::vector<int> a[MN], on[K + 1];   struct Mod {    public:     char c;     int a, b;     void out() const { printf( %c %d %d n , c, a, b); }   };   std::vector<Mod> f;   void flip(int a, int b) {     f.push_back({conn[a][b] ?  -  :  + , a, b});     conn[a][b] ^= 1;   }   void dfs(int n) {     for (int x : a[n])       if (!~id[x]) dfs(x);     id[n] = ctr;     t[ctr] = n;     ++ctr;   }   int main() {     memset(id, -1, sizeof id);     scanf( %d%d%d , &N, &M, &T);     for (int i = 0, u, v; i < M; ++i)       scanf( %d%d , &u, &v), a[u].push_back(v), conn[u][v] = 1;     ctr = 0;     for (int i = 1; i <= N; ++i)       if (!~id[i]) dfs(i);     for (int i = std::min(N, K) - 1; i; --i)       for (int j = i - 1; j >= 0; --j)         if (!conn[t[i]][t[j]]) {           a[t[i]].push_back(t[j]);           conn[t[i]][t[j]] = 1;           f.push_back({ + , t[i], t[j]});         }     for (int i = 0; i < 1 << K; ++i)       if (__builtin_popcount(i) <= 3) on[__builtin_popcount(i)].push_back(i);     memset(m, -1, sizeof m);     for (int i = K; i < N; ++i) {       f.push_back({ + , t[i], t[i]});       int n = t[i], v = 0;       for (int x : a[n])         if (id[x] < K) v |= 1 << id[x];       bool ok = 0;       for (int j = 0; !ok; ++j) {         assert(j <= 3);         for (int k : on[j])           if (!~m[v ^ k]) {             m[v ^ k] = n;             for (int b = 0; b < K; ++b)               if (k >> b & 1) flip(n, t[b]);             ok = 1;             break;           }       }     }     printf( %u n , f.size());     for (int i = 0; i < f.size(); ++i) f[i].out();     fflush(stdout);     for (int i = 0; i < T; ++i) {       int v = 0;       bool lose = 0;       for (int j = 0; j < std::min(N, K); ++j) {         printf( ? 1 %d n , t[j]);         fflush(stdout);         scanf(  %s , s);         if (s[0] ==  S ) return 0;         if (s[0] ==  W ) v |= 1 << j;         if (s[0] ==  L ) {           lose = 1, v = j;           break;         }       }       if (lose)         printf( ! %d n , t[v]);       else         printf( ! %d n , m[v]);       fflush(stdout);       scanf(  %s , s);       if (s[0] ==  W ) return 0;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long n;   long long b[500010], a[500010];   void solve() {     cin >> n;     for (int i = 0; i < n; i++) cin >> b[i];     long long sum = 0, flag = 1;     for (int i = 0; i < n; i++) sum += b[i];     if (sum % (n * (n + 1) / 2)) flag = 0;     sum /= n * (n + 1) / 2;     for (int i = 0; i < n; i++) {       long long dx = sum - b[(i + 1) % n] + b[i];       if (dx % n || dx <= 0)         flag = 0;       else         a[(i + 1) % n] = dx / n;     }     if (flag) {       cout <<  YES  <<   n ;       for (int i = 0; i < n; i++) cout << a[i] <<    ;       cout <<   n ;     } else       cout <<  NO  <<   n ;   }   int main() {     std::ios::sync_with_stdio(false);     std::cin.tie(0);     std::cout.tie(0);     int _;     cin >> _;     while (_--) solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 3e5;   const int INF = 1e9;   int n;   int ct[MAXN][2];   vector<int> ok(int d) {     vector<int> bad(2, -1);     int loX = 0, hiX = INF;     int loY = 0, hiY = INF;     int loD = -INF, hiD = INF;     for (int i = 0; i < n; i++) {       int x = ct[i][0], y = ct[i][1];       loX = max(loX, x - d);       hiX = min(hiX, x + d);       loY = max(loY, y - d);       hiY = min(hiY, y + d);       loD = max(loD, y - x - d);       hiD = min(hiD, y - x + d);     }     if (loX > hiX || loY > hiY || loD > hiD) return bad;     auto check1 = [&](int x) {       int lo = max(loY, loD + x), hi = min(hiY, hiD + x);       if (lo > hi) return bad;       if (x || hi) return vector<int>{x, hi};       return bad;     };     auto check2 = [&](int y) {       int lo = max(loX, y - hiD), hi = min(hiX, y - loD);       if (lo > hi) return bad;       if (y || hi) return vector<int>{hi, y};       return bad;     };     if (bad != check1(loX)) return check1(loX);     if (bad != check1(hiX)) return check1(hiX);     if (bad != check2(loY)) return check2(loY);     if (bad != check2(hiY)) return check2(hiY);     return bad;   }   void run_case() {     cin >> n;     for (int i = 0; i < n; i++) {       string s;       cin >> s;       for (char &j : s) {         ct[i][j ==  N ]++;       }     }     int lo = -1;     int hi = 1e6;     while (lo + 1 < hi) {       int mid = (lo + hi) / 2;       if (ok(mid)[0] != -1) {         hi = mid;       } else {         lo = mid;       }     }     vector<int> res;     res = ok(hi);     cout << hi <<   n ;     string ans = string(res[0],  B ) + string(res[1],  N );     cout << ans <<   n ;   }   int main() {     ios::sync_with_stdio(false), cin.tie(0);     if (fopen( input.in ,  r ))       freopen( input.in ,  r , stdin), freopen( output.out ,  w , stdout);     int t;     t = 1;     while (t--) {       run_case();     }   }
#include <bits/stdc++.h>   using namespace std;   const int N = 205, M = N * N;   using ll = long long;   int n, a[N][N];   struct Edge {     int v, nxt;     ll w, cw;   } e[M << 2];   int head[M], ptr;   void add_edge(int uu, int vv) {     e[ptr] = {vv, head[uu], 1, 0};     head[uu] = ptr++;     e[ptr] = {uu, head[vv], 1, 0};     head[vv] = ptr++;   }   int ss[M], tt[M];   bool vis[M];   bool push(int pos, int fl) {     if (tt[pos] && fl == 1) return 1;     if (ss[pos] && fl == -1) return 1;     vis[pos] = 1;     for (int i = head[pos]; i != -1; i = e[i].nxt) {       int v = e[i].v;       if (fl == 1 && e[i].cw == 1) continue;       if (fl == -1 && e[i].cw != -1) continue;       if (vis[v]) continue;       if (push(v, fl)) {         ++e[i].cw;         --e[i ^ 1].cw;         return 1;       }     }     return 0;   }   inline int id(int x, int y) { return (x - 1) * n + y; }   vector<pair<int, int>> v;   int main() {     ios::sync_with_stdio(false);     cin >> n;     memset(head, -1, sizeof(head));     for (int i = 1; i <= n; i++)       for (int j = 1; j <= n; j++) cin >> a[i][j];     for (int i = 1; i <= n; i++)       for (int j = 1; j <= n; j++) {         if (a[i][j] == -1) continue;         if (i + 1 <= n && a[i + 1][j] >= 0) add_edge(id(i, j), id(i + 1, j));         if (j + 1 <= n && a[i][j + 1] >= 0) add_edge(id(i, j), id(i, j + 1));         if (a[i][j] > 0) {           tt[id(i, j)] = 1;           v.push_back({a[i][j], id(i, j)});         }       }     sort(v.begin(), v.end());     int flow = 0;     ll ans = 0;     for (int i = 0; i < int(v.size()) - 1; i++) {       int pos = v[i].second;       memset(vis, 0, sizeof(vis));       while (push(pos, -1)) --flow, memset(vis, 0, sizeof(vis));       tt[pos] = 0;       ss[pos] = 1;       memset(vis, 0, sizeof(vis));       for (int j = 0; j <= i; j++)         if (!vis[v[j].second])           while (push(v[j].second, 1)) ++flow, memset(vis, 0, sizeof(vis));       ans += ll(v[i + 1].first - v[i].first) * flow;     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string A, B;     int ma = 0;     cin >> A >> B;     for (char &ch : A) ma = max(ma, ch -  0 );     for (char &ch : B) ma = max(ma, ch -  0 );     ma++;     int a = 0, b = 0;     for (char &ch : A) {       a = a * ma + ch -  0 ;     }     for (char &ch : B) {       b = b * ma + ch -  0 ;     }     a += b;     int ans = 0;     while (a) ans++, a /= ma;     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, ar[11][100005];   int rev[11][100005];   long long mx(int start) {     int val = ar[0][start];     for (int tmp = 0; tmp < n; ++tmp) {       for (int row = 1; row < m; ++row) {         int col = rev[row][val];         if (col + tmp >= n) {           return tmp;         }         int curVal = ar[row][col + tmp];         int val2 = ar[0][start + tmp];         if (curVal != val2) {           return tmp;         }       }     }     return n;   }   int main() {     scanf( %d%d , &n, &m);     for (int i = 0; i < m; ++i) {       for (int j = 0; j < n; ++j) {         scanf( %d , ar[i] + j);         rev[i][ar[i][j]] = j;       }     }     long long ans = 0;     for (int i = 0; i < n;) {       long long mxi = mx(i);       ans += (mxi * (mxi + 1) / 2ll);       i += mxi;     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 6e5 + 5, mod = 998244353;   vector<int> num;   long long A[N];   int a[N];   long long sumup = 0, sumdown = 0;   long long qpow(long long a, long long b) {     long long c = 1;     while (b) {       if (b & 1) c = (a * c) % mod;       b >>= 1;       a = (a * a) % mod;     }     return c;   }   long long inv(long long x) { return qpow(x, mod - 2); }   int main() {     int n;     cin >> n;     n <<= 1;     A[0] = 1;     for (int i = 1; i <= n; i++) A[i] = (A[i - 1] * i) % mod;     for (int i = 1; i <= n; i++) cin >> a[i];     long long ans = 0;     sort(a + 1, a + n + 1);     for (int i = 1; i <= n / 2; i++) ans -= a[i];     for (int i = n / 2 + 1; i <= n; i++) ans += a[i];     ans = (ans % mod * A[n] % mod * inv(A[n / 2]) % mod * inv(A[n / 2])) % mod;     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   inline void read(int &x) {     x = 0;     char c = getchar();     int f = 1;     while (!isdigit(c)) {       if (c ==  - ) f = -1;       c = getchar();     }     while (isdigit(c)) {       x = x * 10 + c -  0 ;       c = getchar();     }     x *= f;   }   const int N = 6666;   const double eps = 1e-9;   int n, m, a[N], b[N];   void Get(double &x, int y) { x -= (double)(x / y); }   int main() {     read(n);     read(m);     for (register int i = 1; i <= n; i++) read(a[i]);     for (register int i = 1; i <= n; i++) read(b[i]);     double l = 0, r = 1e9, res = 2e9;     for (register int t = 70; t >= 1; t--) {       double mid = (l + r) / 2, now = m + mid;       for (register int i = 1; i <= n; i++)         Get(now, a[i]), Get(now, b[i < n ? i + 1 : 1]);       if (now > m - eps)         res = mid, r = mid;       else         l = mid;     }     if (res > 1e9 + eps)       puts( -1 );     else       printf( %.9lf , res);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long INF = 1e18;   int n, m, q;   long long add[510], a[510][510], dp[510][510], gox[510][510], goy[510][510];   vector<pair<int, int> > vx[510][510], vy[510][510];   int main() {     scanf( %d%d%d , &n, &m, &q);     for (int i = 0; i < q; i++) {       int x, y, t, d, e;       scanf( %d%d%d%d%d , &x, &y, &d, &t, &e);       if (x + y >= t && (x + y - t) % 4 == 0) {         a[x][y] += e;         if (x + y + d >= t && (x + y + d - t) % 4 == 2)           vx[x][y].push_back({x + d, e});         else           vx[x][y].push_back({n, e});         if (x + y + d >= t && (x + y + d - t) % 4 == 3)           vy[x][y].push_back({y + d, e});         else           vy[x][y].push_back({m, e});       }       if (x + y >= t && (x + y - t) % 4 == 1) {         a[x + d][y - d] += e;         vx[x + d][y - d].push_back({n, e});         if (x + y + d >= t && (x + y + d - t) % 4 == 2)           vy[x + d][y - d].push_back({y, e});         else           vy[x + d][y - d].push_back({m, e});       }       if (x + y + d >= t && (x + y + d - t) % 4 == 2) {         a[x + d][y] += e;         vx[x + d][y].push_back({n, e});         vy[x + d][y].push_back({m, e});       }       if (x + y + d >= t && (x + y + d - t) % 4 == 3) {         a[x][y + d] += e;         vx[x][y + d].push_back({n, e});         vy[x][y + d].push_back({m, e});       }     }     for (int x = 0; x < n; x++) {       for (int y = 0; y < m; y++) {         dp[x][y] = INF;         {           long long cur = 0;           for (auto it : vx[x][y]) {             cur += it.second;             add[it.first] += it.second;           }           for (int k = x; k <= n; k++) {             cur -= add[k];             gox[y][k] += cur;             add[k] = 0;           }         }         {           long long cur = 0;           for (auto it : vy[x][y]) {             cur += it.second;             add[it.first] += it.second;           }           for (int k = y; k <= m; k++) {             cur -= add[k];             goy[k][x] += cur;             add[k] = 0;           }         }       }     }     dp[0][0] = a[0][0];     for (int x = 0; x < n; x++) {       for (int y = 0; y < m; y++) {         dp[x][y] -= a[x][y];         for (int k = x + 1; k < n; k++)           dp[k][y] = min(dp[k][y], dp[x][y] + gox[y][k]);         for (int k = y + 1; k < m; k++)           dp[x][k] = min(dp[x][k], dp[x][y] + goy[k][x]);         {           long long cur = 0;           for (auto it : vx[x][y]) {             cur += it.second;             add[it.first] += it.second;           }           for (int k = x; k <= n; k++) {             cur -= add[k];             gox[y][k] -= cur;             add[k] = 0;           }         }         {           long long cur = 0;           for (auto it : vy[x][y]) {             cur += it.second;             add[it.first] += it.second;           }           for (int k = y; k <= m; k++) {             cur -= add[k];             goy[k][x] -= cur;             add[k] = 0;           }         }       }     }     printf( %lld , dp[n - 1][m - 1]);     return 0;   }
#include <bits/stdc++.h>   int main() {     int h, w, bh, bw, th, tw;     long long ar, ba;     bh = bw = ba = 0;     scanf( %d %d , &h, &w);     int tmp;     for (int i = 30; i >= 0; i--) {       tmp = (1 << i);       if (tmp <= w) {         long long x = (long long)tmp * 8;         long long y = (long long)tmp * 125;         if (x % 10 != 0)           x = x / 10 + 1;         else           x = x / 10;         y /= 100;         if (y <= h) {           th = y;           tw = tmp;           ar = (long long)th * (long long)tw;           if (ar > ba || ar == ba && th > bh) {             bh = th;             bw = tw;             ba = (long long)bh * (long long)bw;           }         } else if (x <= h) {           th = h;           tw = tmp;           ar = (long long)th * (long long)tw;           if (ar > ba || ar == ba && th > bh) {             bh = th;             bw = tw;             ba = (long long)bh * (long long)bw;           }         }       }     }     for (int i = 30; i >= 0; i--) {       tmp = (1 << i);       if (tmp <= h) {         int x = (int)((double)tmp / 1.25);         int y = (int)((double)tmp / 0.8);         if ((double)y * 0.8 < (double)tmp) y++;         if ((double)x * 1.25 > (double)tmp) x--;         if (y <= w) {           th = tmp;           tw = y;           ar = (long long)th * (long long)tw;           if (ar > ba || ar == ba && th > bh) {             bh = th;             bw = tw;             ba = (long long)bh * (long long)bw;           }         } else if (x < w) {           th = tmp;           tw = w;           ar = (long long)th * (long long)tw;           if (ar > ba || ar == ba && th > bh) {             bh = th;             bw = tw;             ba = (long long)bh * (long long)bw;           }         }       }     }     if (bw > bh && bw <= h) std::swap(bw, bh);     printf( %d %d n , bh, bw);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int r1, r2, c1, c2, d1, d2;   int main() {     scanf( %d%d%d%d%d%d , &r1, &r2, &c1, &c2, &d1, &d2);     for (int i = 1; i <= 9; ++i)       for (int j = 1; j <= 9; ++j)         for (int ii = 1; ii <= 9; ++ii)           for (int jj = 1; jj <= 9; ++jj) {             if (i != j && i != ii && i != jj && j != ii && j != jj && ii != jj)               if (i + j == r1 && jj + ii == r2 && i + ii == c1 && j + jj == c2 &&                   i + jj == d1 && j + ii == d2) {                 printf( %d %d n%d %d , i, j, ii, jj);                 return 0;               }           }     printf( -1 );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   double a[100010], ans1, ans2;   int n, n1, n2;   bool cmp(double a, double b) { return a > b; }   int main() {     scanf( %d%d%d , &n, &n1, &n2);     if (n1 > n2) swap(n1, n2);     for (int i = 1; i <= n; i++) scanf( %lf , &a[i]);     sort(a + 1, a + n + 1, cmp);     for (int i = 1; i <= n1; i++) ans1 += a[i];     for (int i = n1 + 1; i <= n1 + n2; i++) ans2 += a[i];     printf( %.8f n , ans1 / n1 + ans2 / n2);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   map<long long, long long> bismarck, dp;   long long n;   void factorization(long long x) {     for (long long i = 2; i * i <= x; i++) {       if (x % i == 0) {         long long c = 0;         while (x % i == 0) {           c++;           x /= i;         }         dp[i] |= 1 << (c - 1);       }     }     if (x > 1) {       dp[x] |= 1;     }   }   long long grundy(long long x) {     if (x == 0) return 0;     if (bismarck.count(x)) return bismarck[x];     unordered_set<long long> s;     for (long long i = 0; x >> i; i++) {       s.insert(grundy(x >> i + 1 | (x & (1 << i) - 1)));     }     long long mex = 0;     while (s.count(mex)) mex++;     return bismarck[x] = mex;   }   int main() {     long long x, ans = 0;     cin >> n;     while (n--) {       cin >> x;       factorization(x);     }     for (auto t : dp) {       ans ^= grundy(t.second);     }     if (ans)       cout <<  Mojtaba ;     else       cout <<  Arpa ;   }
#include <bits/stdc++.h>   using namespace std;   inline long long read() {     long long res = 0, f = 1;     char c = getchar();     while (c <  0  || c >  9 ) {       if (c ==  - ) f = -1;       c = getchar();     }     while (c >=  0  && c <=  9 ) {       res = res * 10 + c - 48;       c = getchar();     }     return res * f;   }   const long long N = 610;   long long f[N][N];   long long a[N][N];   long long n, m, mod;   long long in[N], o[N], s[N], t[N], tots, tott, tot;   long long head[N], to[N * N], nxt[N * N], res;   queue<long long> q;   long long id[N];   long long qpow(long long a, long long b) {     long long res = 1;     while (b) {       if (b & 1) res = res * a % mod;       a = a * a % mod;       b >>= 1;     }     return res;   }   void add(long long x, long long y) {     nxt[++tot] = head[x];     head[x] = tot;     to[tot] = y;   }   void guess(long long n) {     res = 1;     for (long long i = 1; i <= n; ++i) {       for (long long j = i + 1; j <= n; ++j) {         while (a[j][i]) {           long long v = a[i][i] * qpow(a[j][i], mod - 2) % mod;           for (long long k = i; k <= n; ++k)             a[i][k] = ((a[i][k] - 1LL * v * a[j][k] % mod) + mod) % mod;           swap(a[i], a[j]), res = -res;         }       }     }     for (long long i = 1; i <= n; ++i) {       res = (1ll * res * a[i][i] % mod + mod) % mod;     }   }   signed main() {     n = read(), m = read(), mod = read();     for (long long i = 1; i <= m; ++i) {       long long x = read(), y = read();       in[y]++, o[x]++;       add(x, y);     }     for (long long i = 1; i <= n; ++i) {       if (in[i] == 0) s[++tots] = i;       if (o[i] == 0) t[++tott] = i;     }     for (long long i = 1; i <= n; ++i)       if (!in[i]) q.push(i);     tot = 0;     while (q.size()) {       long long u = q.front();       q.pop();       id[++tot] = u;       for (long long i = head[u]; i; i = nxt[i]) {         long long v = to[i];         --in[v];         if (!in[v]) q.push(v);       }     }     for (long long i = 1; i <= n; ++i) {       long long u = id[i];       f[u][u] = 1;       for (long long j = i; j <= n; ++j) {         long long v = id[j];         for (long long k = head[v]; k; k = nxt[k]) {           long long vv = to[k];           f[u][vv] = (f[u][vv] + f[u][v]) % mod;         }       }     }     for (long long i = 1; i <= tots; ++i) {       for (long long j = 1; j <= tott; ++j) {         a[i][j] = f[s[i]][t[j]];       }     }     guess(tots);     cout << res << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   int main() {     int A, B;     cin >> A >> B;     string a, b;     cin >> a >> b;     int p = 0, m = a.size();     for (int i = 0; i + a.size() <= b.size(); i++) {       int k = 0;       for (int j = 0; j < a.size(); j++) {         if (a[j] != b[i + j]) k++;       }       if (k < m) {         m = k;         p = i;       }     }     vector<int> v;     for (int i = 0; i < a.size(); i++) {       if (a[i] != b[i + p]) v.push_back(i);     }     cout << v.size() << endl;     for (int i = 0; i < v.size(); i++) {       cout << v[i] + 1 <<    ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long a, b, n, m, k, l;   int main() {     ios_base::sync_with_stdio(false);     cin.tie();     cin >> n >> m >> k >> l;     if ((n / m) * m < k + l) {       cout <<  -1 n ;       return 0;     }     cout << (k + l) / m + ((k + l) % m != 0) << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int temp, sum = 0;     int size, counter = 0;     cin >> size;     for (int i = 0; i < size; i++) cin >> temp, sum += temp;     if (sum % size == 0)       cout << size << endl;     else       cout << size - 1 << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct __s {     __s() {       if (1) {         ios_base::Init i;         cin.sync_with_stdio(0);         cin.tie(0);       }     }     ~__s() {       if (!1)         fprintf(stderr,  Execution time: %.3lf s. n ,                 (double)clock() / CLOCKS_PER_SEC);       long long n;       cin >> n;     }   } __S;   int main(void) {     long long n, m;     cin >> n;     vector<long long> a(n);     for (long long i = 0; i < (long long)(n); i++) {       cin >> a[i];     }     cin >> m;     long long b = 0;     for (long long i = 0; i < (long long)(m); i++) {       long long x;       cin >> x;       b += x - 1;     }     vector<long long> c;     while (c.size() < 3 * max(m, n)) {       for (long long i = 0; i < (long long)(n - 1); i++) {         c.push_back(i);       }       for (long long i = 0; i < (long long)(n - 1); i++) {         c.push_back(n - 1 - i);       }     }     long long d = 0;     for (long long i = 0; i < (long long)(m); i++) {       b -= c[i];       if (i) d += abs(a[c[i]] - a[c[i - 1]]);     }     set<long long> ans;     for (long long i = m; i < c.size(); i++) {       if (b == 0) {         ans.insert(d);       }       b -= c[i];       b += c[i - m];       d -= abs(a[c[i - m]] - a[c[i - m + 1]]);       d += abs(a[c[i]] - a[c[i - 1]]);     }     if (ans.size() != 1)       cout << -1 <<   n ;     else       cout << *ans.begin() <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 100 * 1000;   int n, m;   int ar1[maxn];   int ar2[maxn];   void read();   int main() {     read();     int i, j;     int s1, s2;     int file;     i = j = s1 = s2 = file = 0;     while (i < n) {       if (s1 == 0)         s1 += ar1[i++];       else {         if (s1 < s2)           s1 += ar1[i++];         else if (s1 == s2) {           s1 = s2 = 0;           file++;         } else           s2 += ar2[j++];       }     }     if (s1 > 0) file++;     cout << file << endl;     return 0;   }   void read() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cin >> n >> m;     for (int i = 0; i < n; i++) cin >> ar1[i];     for (int j = 0; j < m; j++) cin >> ar2[j];   }
#include <bits/stdc++.h>   using namespace std;   long long qpow(long long a, long long k) {     long long b = 1LL;     while (k) {       if (k % 2 == 1) b = (b * a) % 1000000007;       a = (a * a) % 1000000007;       k = k / 2;     }     return b;   }   int main() {     char s[105] = {0};     scanf( %s , s);     int len = strlen(s);     long long ans = 0;     for (int i = len - 1; i >= 0; i--) {       ans = ans * 2;       ans = ans % 1000000007;       if (s[i] ==  1 ) {         ans = ans + qpow(4LL, (long long)(len - 1 - i));         ans = ans % 1000000007;       }     }     printf( %I64d , ans);     return 0;   }