malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int mx[8] = {-1, 0, 1, -1, 1, -1, 0, 1}, my[8] = {-1, -1, -1, 0, 0, 1, 1, 1};   int main() {     ios::sync_with_stdio(false);     int n, m;     cin >> n >> m;     char a[n + 2][m + 2];     memset(a, 0, sizeof a);     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++) {         cin >> a[i][j];       }     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++) {         if (a[i][j] !=  * ) {           int cnt = 0;           for (int k = 0; k <= 7; k++) {             if (a[i + mx[k]][j + my[k]] ==  * ) cnt++;           }           if (!(cnt == 0 && a[i][j] ==  .  || cnt > 0 && a[i][j] -  0  == cnt)) {             cout <<  NO  << endl;             return 0;           }         }       }     cout <<  YES  << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   #pragma GCC optimize( Ofast )   #pragma GCC optimize( unroll-loops )   const long long maxn = 1e5 + 10, LG = 30, mod = 1e9 + 7, inf = 1e18;   long long n, m, f[maxn];   vector<long long> in[maxn], out[maxn];   bool mk[maxn], km[maxn];   void dfs(long long v) {     mk[v] = 1;     for (auto u : out[v])       if (!mk[u] && f[u] != 1) dfs(u);   }   void sfd(long long v) {     km[v] = 1;     if (f[v] == 1) return;     for (auto u : in[v])       if (!km[u] && f[u] != 2) sfd(u);   }   int main() {     ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);     cin >> n >> m;     for (int i = 1; i <= n; i++) cin >> f[i];     while (m--) {       long long v, u;       cin >> v >> u;       out[v].push_back(u);       in[u].push_back(v);     }     for (int i = 1; i <= n; i++)       if (f[i] == 1) dfs(i);     for (int i = 1; i <= n; i++)       if (f[i] == 2) sfd(i);     for (int i = 1; i <= n; i++) cout << (mk[i] && km[i]) << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     int n, x;     scanf( %d%d , &n, &x);     if (n < 2) n = 2;     int ans = ((n - 2) + x - 1) / x + 1;     printf( %d n , ans);   }   int main() {     int t;     scanf( %d , &t);     while (t--) solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   string a, b;   int main() {     cin >> a >> b;     int l1 = a.size();     int l2 = b.size();     int maxx = 0;     for (int i = 0; i < l1; ++i) {       for (int j = i; j < l1; ++j) {         int p = 0;         for (int k = 0; k < i; ++k) {           if (p < l2) {             if (a[k] == b[p]) {               p++;             }           }         }         for (int k = j + 1; k < l1; ++k) {           if (p < l2) {             if (a[k] == b[p]) {               p++;             }           }         }         if (p == l2) {           maxx = max(maxx, j - i + 1);         }       }     }     cout << maxx;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long n;     cin >> n;     array<long, 2> a[n], b[n];     long i;     for (i = 0; i < n; i++) {       cin >> a[i][0] >> a[i][1];     }     for (i = 0; i < n; i++) {       if (a[i][0] != a[i][1]) {         cout <<  rated ;         return 0;       }     }     for (i = 0; i < n - 1; i++) {       if (a[i][0] < a[i + 1][0]) {         cout <<  unrated ;         return 0;       }     }     cout <<  maybe ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     long long n, m, k, t;     cin >> n >> m >> k >> t;     pair<long long, long long> p[k];     string s[3] = { Carrots ,  Kiwis ,  Grapes };     for (int i = 0; i < k; i++) {       cin >> p[i].first >> p[i].second;     }     sort(p, p + k);     for (int i = 0; i < t; i++) {       long long a, b;       cin >> a >> b;       bool f = 1;       long long x = (a - 1) * m + b - 1;       long long y = 0;       for (int j = 0; j < k; j++) {         if (p[j].first == a && p[j].second == b) {           cout <<  Waste  << endl;           f = 0;           break;         }         if (p[j].first < a) {           y++;         } else if (p[j].first == a) {           if (p[j].second < b) {             y++;           }         }       }       if (f) {         cout << s[(x - y) % 3] << endl;       }     }   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.precision(8);     long long t(1);     while (t--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   vector<pair<pair<int, int>, int> > v;   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cin >> n;     for (int i = 1; i <= n; i++) {       int x, y;       cin >> x >> y;       v.push_back(pair<pair<int, int>, int>(pair<int, int>(x / 2012, y), i));     }     sort(v.begin(), v.end());     for (int i = 0; i < v.size(); i++) cout << v[i].second <<    ;   }
#include <bits/stdc++.h>   using namespace std;   int m[200001], k, cd;   int val[2000001];   void inp() {     cin >> cd >> k;     for (int i = 1; i <= cd; i++) {       cin >> m[i];       val[m[i]]++;     }     sort(m + 1, m + 1 + cd);   }   bool check(int i) {     if (m[i] <= m[i - 1] + k && m[i] > m[i - 1]) return true;     return false;   }   void calc() {     int kq = cd;     for (int i = 2; i <= cd; i++) {       if (check(i)) kq -= val[m[i - 1]];     }     cout << kq << endl;   }   int main() {     inp();     calc();   }
#include <bits/stdc++.h>   using namespace std;   const int mod = 1e9 + 7;   const int inf = 0x3f3f3f3f;   long long gcd(long long x, long long y) {     if (y == 0)       return x;     else       return gcd(y, x % y);   }   long long ksm(long long a, long long b) {     long long r = 1;     while (b) {       if (b & 1) r = (r * a) % mod;       a = a * a % mod;       b >>= 1;     }     return r;   }   void exgcd(long long a, long long b, long long& d, long long& x, long long& y) {     if (!b) {       d = a;       x = 1;       y = 0;     } else {       exgcd(b, a % b, d, y, x);       y -= x * (a / b);     }   }   long long inv(long long a, long long p) {     long long d, x, y;     exgcd(a, p, d, x, y);     return d == 1 ? (x + p) % p : -1;   }   inline int read() {     char c = getchar();     int x = 0, f = 1;     while (c <  0  || c >  9 ) {       if (c ==  - ) f = -1;       c = getchar();     }     while (c >=  0  && c <=  9 ) {       x = x * 10 + c -  0 ;       c = getchar();     }     return x * f;   }   const int maxn = 1e5 + 100;   int n, m, k, t, a[1005][1005];   int r[1005], c[1005];   int main() {     int x, y;     cin >> x >> y;     for (int i = 1; i <= x; i++) cin >> r[i];     for (int i = 1; i <= y; i++) cin >> c[i];     memset(a, 0, sizeof(a));     for (int i = 1; i <= x; i++) {       if (r[i] == 0)         a[i][1] = -1;       else {         for (int j = 1; j <= r[i]; j++) a[i][j] = 1;         a[i][r[i] + 1] = -1;       }     }     int flag = 1;     for (int i = 1; i <= y; i++) {       if (c[i] == 0) {         if (a[1][i] == 1) flag = 0;         a[1][i] = -1;       } else {         for (int j = 1; j <= c[i]; j++) {           if (a[j][i] == -1) flag = 0;           a[j][i] = 1;         }         if (a[c[i] + 1][i] == 1) flag = 0;         a[c[i] + 1][i] = -1;       }     }     if (!flag) {       cout <<  0 n ;       return 0;     }     long long ans = 1;     for (int i = 1; i <= x; i++)       for (int j = 1; j <= y; j++) {         if (a[i][j] == 0) ans = ans * 2ll % mod;       }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long MOD = (long long)(1e9 + 7);   const long long INF = (long long)(1e9 + 10);   const int MAXN = (int)(2e5 + 5);   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     string caso;     cin >> caso;     while (caso ==  start ) {       int a = 0, b = 1;       cout <<  ?   << a <<     << b << endl;       char aux;       cin >> aux;       while (aux ==  y ) {         a = b;         b = a * 2;         cout <<  ?   << a <<     << b << endl;         cin >> aux;       }       int x = a, y = b;       while (y - x > 1) {         int med = (x + y) / 2;         cout <<  ?   << med <<     << b << endl;         cin >> aux;         if (aux ==  y )           y = med;         else           x = med;       }       cout <<  !   << y << endl;       cin >> caso;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int t, n, freq[201][212345];   int main() {     scanf( %d , &t);     while (t--) {       scanf( %d , &n);       vector<int> pos[201];       for (int i = 0; i < 201; ++i)         for (int j = 0; j <= n; ++j) freq[i][j] = 0;       for (int x, i = 1; i <= n; ++i)         scanf( %d , &x), freq[x][i] = 1, pos[x].push_back(i);       map<pair<int, int>, int> mp;       for (int i = 1; i < 201; ++i) {         int ctr = 0;         for (int j = n; j > 0; --j)           if (freq[i][j]) mp[{i, ++ctr}] = j;         for (int j = 1; j <= n; ++j) freq[i][j] += freq[i][j - 1];       }       int ans = 1;       for (int i = 1; i < 201; ++i)         for (int j = 1; j < 201; ++j)           if (i == j)             ans = max(ans, freq[i][n]);           else if (freq[i][n] > 1) {             for (int idx1, idx2, p = 0; p < pos[i].size(); ++p) {               idx1 = pos[i][p];               idx2 = mp[{i, freq[i][idx1]}];               if (idx1 >= idx2) break;               ans =                   max(ans, 2 * freq[i][idx1] + freq[j][idx2 - 1] - freq[j][idx1]);             }           }       printf( %d n , ans);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const double INF = 1e100;   int N, T, P[200000], L[200000], S[200000];   struct AddChange {     int id;     double dif;     AddChange(const int i) : id(i) {       if (S[i] == L[i])         dif = -INF;       else         dif = P[i] * ((double)(S[i] + 1) / (S[i] + 1 + L[i]) -                       (double)S[i] / (S[i] + L[i]));     }     bool operator<(const AddChange &c) const {       return dif != c.dif ? dif > c.dif : id < c.id;     }   };   struct RevChange {     int id;     double dif;     RevChange(const int i) : id(i) {       if (S[i] == 0)         dif = -INF;       else         dif = P[i] * ((double)(S[i] - 1) / (S[i] - 1 + L[i]) -                       (double)S[i] / (S[i] + L[i]));     }     bool operator<(const RevChange &c) const {       return dif != c.dif ? dif > c.dif : id < c.id;     }   };   set<AddChange> AC;   set<RevChange> RC;   double ANS;   double ExpEarn(const int id) { return P[id] * (double)S[id] / (S[id] + L[id]); }   void ModifyS(const int id, const int val) {     AC.erase(AddChange(id)), RC.erase(RevChange(id)), ANS -= ExpEarn(id);     S[id] += val, T -= val;     AC.insert(AddChange(id)), RC.insert(RevChange(id)), ANS += ExpEarn(id);   }   void ModifyL(const int id, const int val) {     AC.erase(AddChange(id)), RC.erase(RevChange(id)), ANS -= ExpEarn(id);     L[id] += val;     AC.insert(AddChange(id)), RC.insert(RevChange(id)), ANS += ExpEarn(id);   }   int main() {     for (int querycount; scanf( %d%d%d , &N, &T, &querycount) == 3;) {       for (int i = 0; i < N; i++) scanf( %d , &P[i]);       for (int i = 0; i < N; i++) scanf( %d , &L[i]);       for (int i = 0; i < N; i++) S[i] = 0;       AC.clear(), RC.clear();       for (int i = 0; i < N; i++)         AC.insert(AddChange(i)), RC.insert(RevChange(i));       ANS = 0.0;       while (T > 0 && AC.begin()->dif > 0.0) ModifyS(AC.begin()->id, 1);       for (int t, r; querycount--;) {         scanf( %d%d , &t, &r), r--;         if (t == 1)           ModifyL(r, 1);         else if (t == 2) {           if (S[r] > L[r] - 1) ModifyS(r, -1);           ModifyL(r, -1);         } else           assert(0);         for (bool changed = true; changed;) {           changed = false;           if (T > 0 && AC.begin()->dif > 0.0)             ModifyS(AC.begin()->id, 1), changed = true;           if (AC.begin()->dif + RC.begin()->dif > 0.0) {             const int a = RC.begin()->id, b = AC.begin()->id;             ModifyS(a, -1), ModifyS(b, 1);             changed = true;           }         }         printf( %.9f n , ANS);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     cin.tie(0);     cout.tie(0);     ios_base::sync_with_stdio(0);     int n, m, q;     cin >> n >> m >> q;     int grid[n][m];     for (int i = 0; i < n; i++)       for (int j = 0; j < m; j++) grid[i][j] = 0;     vector<vector<int>> instr(q);     for (int i = 0; i < q; i++) {       int t;       cin >> t;       instr[q - 1 - i].push_back(t);       int u = 1;       if (t == 3) u = 3;       for (int j = 0; j < u; j++) {         int x;         cin >> x;         instr[q - 1 - i].push_back(x);       }     }     for (int i = 0; i < q; i++) {       auto cur = instr[i];       if (cur[0] == 1) {         int r = cur[1] - 1;         vector<int> v(m);         for (int j = 0; j < m; j++) v[j] = grid[r][(j + m - 1) % m];         for (int j = 0; j < m; j++) grid[r][j] = v[j];       } else if (cur[0] == 2) {         int c = cur[1] - 1;         vector<int> v(n);         for (int j = 0; j < n; j++) v[j] = grid[(j + n - 1) % n][c];         for (int j = 0; j < n; j++) grid[j][c] = v[j];       } else         grid[cur[1] - 1][cur[2] - 1] = cur[3];     }     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         if (j) cout <<    ;         cout << grid[i][j];       }       cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 300001;   int n, a, b, c, d, start, len;   vector<int> T;   long long dp[2][N + 2], seg[4 * N];   void build(int p, int s, int e) {     if (s == e) {       seg[p] = dp[1][s];       return;     }     build(2 * p, s, (s + e) / 2);     build(2 * p + 1, (s + e) / 2 + 1, e);     seg[p] = min(seg[2 * p], seg[2 * p + 1]);   }   long long get(int p, int s, int e, int a, int b) {     if (s >= a && e <= b) return seg[p];     if (s > b || e < a) return 1e15;     return min(get(2 * p, s, (s + e) / 2, a, b),                get(2 * p + 1, (s + e) / 2 + 1, e, a, b));   }   int main() {     scanf( %d%d%d%d%d%d%d , &n, &a, &b, &c, &d, &start, &len);     dp[0][0] = start;     dp[1][0] = start;     T.push_back(0);     for (int i = 1, t, q; i <= n; i++) {       scanf( %d%d , &t, &q);       dp[0][i] = dp[0][i - 1], dp[1][i] = dp[1][i - 1];       if (q)         dp[0][i] += a, dp[1][i] += c;       else         dp[0][i] -= b, dp[1][i] -= d;       T.push_back(t);     }     build(1, 0, n);     int j = n, c = 0;     auto it = lower_bound(T.begin(), T.end(), c + len);     if (it != T.end()) j = *it - 1;     if (get(1, 0, n, 0, j) >= 0) {       printf( %d n , c);       return 0;     }     for (int i = 0; i < T.size(); i++) {       if (dp[0][i] < 0) break;       c = T[i] + 1;       j = lower_bound(T.begin(), T.end(), c + len) - T.begin() - 1;       if (i == n || j < i + 1 ||           get(1, 0, n, i + 1, j) - dp[1][i] + dp[0][i] >= 0) {         printf( %d n , c);         return 0;       }     }     puts( -1 );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 200005;   struct Node {     int pos, id;     Node(int p = 0, int i = 0) : pos(p), id(i) {}     bool operator<(const Node& rhs) const { return pos < rhs.pos; }   } a[MAXN], b[MAXN];   int m, n;   long long c[3 * MAXN];   int ans[MAXN];   void add(int x, int y, int k) { c[x + n] += k, c[y + n] -= k; }   int main() {     scanf( %d%d , &m, &n);     for (int i = 0; i < n; i++) {       scanf( %d , &a[i].pos);       a[i].pos--, a[i].id = i + 1;     }     for (int i = 0; i < n; i++) {       scanf( %d , &b[i].pos);       b[i].pos--, b[i].id = i + 1;     }     sort(a, a + n);     sort(b, b + n);     for (int i = 0; i < n; i++) {       int j = lower_bound(b, b + n, a[i]) - b - i;       int p = a[i].pos + (m + 1) / 2;       if (p < m) {         int k = lower_bound(b, b + n, Node(p)) - b - i;         add(j, k, -a[i].pos);         add(k, n - i, a[i].pos + m);         add(n - i, j + n, a[i].pos);       } else {         int k = lower_bound(b, b + n, Node(p - m)) - b - i;         add(j, n - i, -a[i].pos);         add(n - i, k + n, m - a[i].pos);         add(k + n, j + n, a[i].pos);       }     }     for (int i = 0; i < n; i++) {       int j = i - (upper_bound(a, a + n, b[i]) - a - 1);       int p = b[i].pos - (m + 1) / 2;       if (p >= 0) {         int k = i - (upper_bound(a, a + n, Node(p)) - a - 1);         add(j, k, b[i].pos);         add(k, j + n, -b[i].pos);       } else {         int k = i - (upper_bound(a, a + n, Node(p + m)) - a - 1);         add(j, k + n, b[i].pos);         add(k + n, j + n, -b[i].pos);       }     }     for (int i = 1; i < 3 * n; i++) c[i] += c[i - 1];     for (int i = 0; i < n; i++) c[i] += c[i + n] + c[i + 2 * n];     int p = min_element(c, c + n) - c;     printf( %lld n , c[p]);     for (int i = 0; i < n; i++) ans[a[i].id] = b[(i + p) % n].id;     for (int i = 1; i <= n; i++) printf( %d  , ans[i]);     putchar(  n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int Maxn = 1e5 + 1, Mod = 1e9 + 7;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     ;     long long n, k;     cin >> n >> k;     std::vector<int> v(n);     for (auto &x : v) cin >> x;     multiset<int> s;     int pos = -1;     long long count = 0;     for (int i = 0; i < n; i++) {       if (v[i] < 0) {         count++;         if (pos != -1) {           s.insert(i - pos - 1);         }         pos = i;       }     }     int fx;     if (pos != -1) fx = n - 1 - pos;     if (count > k) {       cout <<  -1 n ;       return 0;     }     long long ans = 0;     int flag = 0;     for (int i = 0; i < n; i++) {       if (!flag) {         if (v[i] >= 0)           continue;         else {           ans++;           flag = flag ^ 1;         }       } else {         if (v[i] < 0)           continue;         else {           ans++;           flag = flag ^ 1;         }       }     }     k -= count;     int fl = 0;     for (auto x : s) {       if (x == 0) continue;       if (k < x) {         fl = 1;         if (fx != 0 && x > fx && fx <= k) {           k -= fx;           ans -= 1;         }         break;       }       ans -= 2;       k -= x;     }     if (!fl && fx != 0 && fx <= k) ans -= 1;     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   const unsigned int Mod1 = 1000000009, Mod2 = 1000000007;   const unsigned int Bas1 = 12232, Bas2 = 14124;   struct mybit {     unsigned long long b[16];     mybit() { memset(b, 0, sizeof b); }     void clear() { memset(b, 0, sizeof b); }     void flip(int z) { b[z >> 6] ^= 1llu << (z & 63); }     unsigned int cnt() {       unsigned int ret = 0;       for (unsigned int j = 0u; j < 16u; ++j) ret += __builtin_popcount(b[j]);       return ret;     }     unsigned long long calc() {       unsigned int z1 = 0, z2 = 0;       for (unsigned int j = 0u; j < 16u; ++j)         z1 = (z1 + b[j] % Mod1 * Bas1) % Mod1,         z2 = (z2 + b[j] % Mod2 * Bas2) % Mod2;       return (unsigned long long)z1 << 32 | z2;     }     void operator^=(const mybit &p2) {       for (unsigned int j = 0u; j < 16u; ++j) b[j] ^= p2.b[j];     }   };   int N, S, Z, Q;   mybit bits[31], now;   std::unordered_map<unsigned long long, int> mp;   void DFS1(int st, int k) {     if (st > S) {       unsigned long long z = now.calc();       if (mp.find(z) != mp.end())         mp[z] = std::min(mp[z], k);       else         mp[z] = k;       return;     }     DFS1(st + 1, k);     now ^= bits[st];     DFS1(st + 1, k + 1);     now ^= bits[st];   }   int Ans;   void DFS2(int st, int k) {     if (st > Z) {       unsigned long long z = now.calc();       if (mp.find(z) != mp.end()) Ans = std::min(Ans, k + mp[z]);       return;     }     DFS2(st + 1, k);     now ^= bits[st];     DFS2(st + 1, k + 1);     now ^= bits[st];   }   int main() {     scanf( %d%d%d , &N, &S, &Q), Z = S / 3;     for (int i = 1; i <= S; ++i) {       unsigned int c, x;       scanf( %u , &c);       while (c--) {         scanf( %u , &x);         bits[i].flip(x - 1);       }     }     now.clear();     DFS1(Z + 1, 0);     while (Q--) {       now.clear();       unsigned int c, x;       scanf( %u , &c);       while (c--) {         scanf( %u , &x);         now.flip(x - 1);       }       Ans = S + 1;       DFS2(1, 0);       printf( %d n , Ans == S + 1 ? -1 : Ans);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long mod = 1000000007LL;   const long long mod2 = 998244353LL;   int n;   int a[100005], b[100005];   int main() {     cin >> n;     for (int i = 1; i <= n; ++i) {       scanf( %d , &a[i]);     }     for (int i = 1; i <= n; ++i) {       scanf( %d , &b[i]);     }     sort(a + 1, a + n + 1);     sort(b + 1, b + n + 1);     long long det = 0;     int i = n, j = n;     bool cur = false;     while (i >= 1 || j >= 1) {       if (!cur) {         if (i < 1) {           j--;         } else {           if (j < 1) {             det += a[i];             i--;           } else {             if (a[i] >= b[j]) {               det += a[i];               i--;             } else {               j--;             }           }         }       } else {         if (j < 1) {           i--;         } else {           if (i < 1) {             det -= b[j];             j--;           } else {             if (b[j] >= a[i]) {               det -= b[j];               j--;             } else {               i--;             }           }         }       }       cur = !cur;     }     cout << det << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int i, j, n, m, k, dist, min_count, num;     vector<int> len_jumps, mosqs, mosq_count, result;     cin >> n >> m >> k;     len_jumps.resize(m);     mosqs.resize(k);     mosq_count.resize(m);     for (i = 0; i < m; i++) {       cin >> len_jumps[i];       mosq_count[i] = 0;     }     for (i = 0; i < k; i++) {       cin >> mosqs[i];     }     for (i = 0; i < m; i++) {       for (j = 0; j < k; j++) {         if (mosqs[j] % len_jumps[i] == 0) {           mosq_count[i]++;         }       }     }     min_count = n;     for (i = 0; i < m; i++) {       if (mosq_count[i] < min_count) {         min_count = mosq_count[i];       }     }     num = 0;     for (i = 0; i < m; i++) {       if (mosq_count[i] == min_count) {         num++;         result.push_back(i + 1);       }     }     cout << num << endl;     for (i = 0; i < result.size() - 1; i++) {       cout << result[i] <<    ;     }     cout << result[result.size() - 1] << endl;     return 0;   }
#include <bits/stdc++.h>   const int mod = 1051131, inv2 = (mod + 1) / 2, phi = 700752;   using namespace std;   int n, T, s;   long long w;   int a[33554440];   void qmo(int &x) { x += (x >> 31) & mod; }   int ksm(int a, int k) {     int res = 1;     for (; k; k >>= 1, a = 1ll * a * a % mod)       if (k & 1) res = 1ll * res * a % mod;     return res;   }   void calc(int m, int p, int q) {     if (!m) return a[0] = 1ll * a[0] * ksm(p + q, T) % mod, void();     for (int i = 0; i < m; i++) {       int x = a[i], y = a[i + m];       qmo(a[i] = x + y - mod), qmo(a[i + m] = x - y);     }     calc(m >> 1, (p << 1) % mod, (q + 1ll * (m - 1) * p) % mod);     int w = ksm(q - 1ll * (m - 1) * p % mod + mod, T);     for (int i = 0; i < m; i++) {       int x = a[i], y = 1ll * a[i + m] * w % mod;       a[i] = 1ll * (x + y) * inv2 % mod,       a[i + m] = 1ll * (x - y + mod) * inv2 % mod;     }   }   int main() {     scanf( %d%lld%d , &n, &w, &s);     if (w > phi)       T = w % phi + phi;     else       T = w;     for (int i = 0; i < s; i++) scanf( %d , &a[i]);     for (int i = s; i < (1 << n); i++) a[i] = (a[i - s] * 101 + 10007) % mod;     calc((1 << n) / 2, 1, 0);     int res = 0;     for (int i = 0; i < (1 << n); i++) res ^= a[i];     printf( %d n , res);   }