malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   namespace scanfuck {   const int L = (1 << 21) + 1;   struct io {     char ibuf[L], *iS, *iT, obuf[L], *oS, *oT, c, st[55];     int f, tp;     void flush() {       fwrite(obuf, 1, oS - obuf, stdout);       oS = obuf;     }     void putc(char x) {       *oS++ = x;       if (oS == oT) flush();     }     template <class T>     T rd() {       register T x = 0;       for (f = 1, c = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, L, stdin),                                   (iS == iT ? EOF : *iS++))                                 : *iS++);            !isdigit(c);            c = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, L, stdin),                            (iS == iT ? EOF : *iS++))                          : *iS++))         if (c ==  - ) f = -1;       for (x = 0; isdigit(c);            c = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, L, stdin),                            (iS == iT ? EOF : *iS++))                          : *iS++))         x = x * 10 + (c & 15);       return x * f;     }     template <class T>     void print(T x) {       if (!x)         putc( 0 );       else {         if (x < 0) putc( - ), x = -x;         for (tp = 0; x; st[tp++] = x % 10 + 48, x /= 10)           ;         for (tp--; ~tp; putc(st[tp--]))           ;       }     }     void gs(char* s, int& l) {       for (c = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, L, stdin),                            (iS == iT ? EOF : *iS++))                          : *iS++);            !isalpha(c);            c = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, L, stdin),                            (iS == iT ? EOF : *iS++))                          : *iS++))         ;       for (l = 0; isalpha(c);            c = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, L, stdin),                            (iS == iT ? EOF : *iS++))                          : *iS++))         s[l++] = c;     }     void ps(const char* s) {       for (tp = 0; tp < strlen(s); ++tp) putc(s[tp]);     }     io() : oS(obuf), oT(obuf + L - 1) {}     ~io() { flush(); }   } ip;   }  // namespace scanfuck   int n = scanfuck::ip.rd<int>(), m = scanfuck::ip.rd<int>(),       k = scanfuck::ip.rd<int>();   inline bool judge() {     if (!(n & 1)) return 1;     int t = sqrt(m);     for (register int i = 1; i <= t; ++i)       if (m % i == 0 && (i >= k && m / i > 1 || i > 1 && m / i >= k)) return 0;     return 1;   }   int main() { scanfuck::ip.ps(judge() ?  Marsel  :  Timur ); }
#include <bits/stdc++.h>   const int a[250] = {0,   1,  1, 1, 2,  1, 2,  1, 5,  2, 2,  1, 5,  1, 2, 1,                       14,  1,  5, 1, 5,  2, 2,  1, 15, 2, 2,  5, 4,  1, 4, 1,                       51,  1,  2, 1, 14, 1, 2,  2, 14, 1, 6,  1, 4,  2, 2, 1,                       52,  2,  5, 1, 5,  1, 15, 2, 13, 2, 2,  1, 13, 1, 2, 4,                       267, 1,  4, 1, 5,  1, 4,  1, 50, 1, 2,  3, 4,  1, 6, 1,                       52,  15, 2, 1, 15, 1, 2,  1, 12, 1, 10, 1, 4,  2};   int main() {     int n;     scanf( %d , &n);     printf( %d , a[n]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const double PI = acos(-1.0);   const double eps = 1e-9;   int n, m, k;   long long dp[35][35][100];   long long dfs(int l, int r, int t) {     if (l * r < t) return 999999999;     if (l > r) swap(l, r);     if (dp[l][r][t] != -1) return dp[l][r][t];     if (t == 0) {       dp[l][r][t] = 0;       return 0;     }     if (l * r == t) return 0;     long long ans1 = 9999999999999LL;     for (int i = 1; i < l; i++)       for (int j = 0; j <= t; j++)         ans1 = min(ans1, dfs(i, r, j) + dfs(l - i, r, t - j) + r * r);     for (int i = 1; i < r; i++)       for (int j = 0; j <= t; j++)         ans1 = min(ans1, dfs(l, i, j) + dfs(l, r - i, t - j) + l * l);     if (dp[l][r][t] != -1)       dp[l][r][t] = min(dp[l][r][t], ans1);     else       dp[l][r][t] = ans1;     return dp[l][r][t];   }   int main() {     int t;     scanf( %d , &t);     memset(dp, -1, sizeof(dp));     while (t--) {       scanf( %d%d%d , &n, &m, &k);       printf( %I64d n , dfs(n, m, k));     }   }
#include <bits/stdc++.h>   using namespace std;   const double pi = acos(-1.0);   const double eps = 1e-8;   int main() {     ios_base::sync_with_stdio(0);     map<long long, bool> mapa;     long long in[200009];     long long n, len, x, y;     cin >> n >> len >> x >> y;     for (int i = 0; i < n; i++) {       cin >> in[i];       mapa[in[i]] = true;     }     bool x_mila = false, y_mila = false;     for (int i = 0; i < n; i++) {       if (mapa[in[i] - x] == true) x_mila = true;       if (mapa[in[i] + x] == true) x_mila = true;       if (mapa[in[i] - y] == true) y_mila = true;       if (mapa[in[i] + y] == true) y_mila = true;     }     if (x_mila && y_mila) {       cout <<  0  << endl;       return 0;     }     vector<int> opt;     for (int i = 0; i < n; i++) {       if (in[i] - x >= 0) opt.push_back(in[i] - x);       if (in[i] + x <= len) opt.push_back(in[i] + x);       if (in[i] - y >= 0) opt.push_back(in[i] - y);       if (in[i] + y <= len) opt.push_back(in[i] + y);     }     for (int i = 0; i < ((int)(opt.size())); i++) {       bool xm = false, ym = false;       int curr = opt[i];       if (mapa[curr - x] || mapa[curr + x]) xm = true;       if (mapa[curr - y] || mapa[curr + y]) ym = true;       if ((xm && ym) || (x_mila && ym) || (xm && y_mila)) {         cout <<  1  << endl;         cout << curr << endl;         return 0;       }     }     cout <<  2  << endl;     cout << x <<     << y << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const double pi = acos(-1.0);   long long l, r;   long long g(long long x) {     long long t = 1;     while (t <= x) t *= 10;     return (t - 1 - x) * x;   }   int n, m;   const char let[] =  ACGT ;   char buf[1600];   int len[16];   int a[16][16];   vector<int> st;   struct Node {     Node* ch[4];     Node* next[4];     int end;     Node() {       memset(a, 0, sizeof a);       ;     }     void mark(Node* root) {       end = 0;       for (int i = 0, _n = (m); i < _n; i++)         if (len[i] <= (int)(st).size()) {           bool eq = true;           for (int k = 0, _n = (len[i]); k < _n; k++)             if (st[(int)(st).size() - len[i] + k] != a[i][k]) {               eq = false;               break;             }           if (eq) {             end = max(end, len[i]);           }         }       for (int i = 0, _n = (4); i < _n; i++)         if (ch[i]) {           st.push_back(i);           ch[i]->mark(root);           st.pop_back();           next[i] = ch[i];         } else {           st.push_back(i);           next[i] = 0;           for (int j = 0, _n = ((int)(st).size() + 1); j < _n; j++)             if (j > 0) {               Node* v = root;               for (int jj = j; jj < (int)(st).size() && v; jj++)                 v = v->ch[st[jj]];               if (v) {                 next[i] = v;                 break;               }             }           st.pop_back();         }     }   };   Node nodes[1024];   int w;   int d[1024][128][11];   int main() {     gets(buf);     sscanf(buf,  %d%d , &n, &m);     for (int i = 0, _n = (m); i < _n; i++) {       gets(buf);       len[i] = strlen(buf);       for (int j = 0, _n = (len[i]); j < _n; j++)         a[i][j] = strchr(let, buf[j]) - let;     }     w = 1;     for (int i = 0, _n = (m); i < _n; i++) {       Node* v = &nodes[0];       for (int j = 0, _n = (len[i]); j < _n; j++) {         if (v->ch[a[i][j]] == 0) v->ch[a[i][j]] = &nodes[w++];         v = v->ch[a[i][j]];       }     }     nodes[0].mark(&nodes[0]);     memset(d, 0, sizeof d);     ;     d[0][0][0] = 1;     for (int i = 0, _n = (n); i < _n; i++)       for (int j = 0, _n = (w); j < _n; j++)         for (int c = 0, _n = (11); c < _n; c++)           if (d[i][j][c])             for (int add = 0, _n = (4); add < _n; add++) {               int nc = c + 1;               Node* v = nodes[j].next[add];               if (v->end >= nc) nc = 0;               if (nc == 10) continue;               d[i + 1][v - nodes][nc] =                   (d[i + 1][v - nodes][nc] + d[i][j][c]) % 1000000009;             }     long long res = 0;     for (int j = 0, _n = (w); j < _n; j++) res = (res + d[n][j][0]) % 1000000009;     cout << res << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int mul(long long int a, long long int b) {     return ((a % int(1e9 + 7)) * (b % int(1e9 + 7))) % int(1e9 + 7);   }   long long int add(long long int a, long long int b) {     return ((a % int(1e9 + 7)) + (b % int(1e9 + 7))) % int(1e9 + 7);   }   long long int sub(long long int a, long long int b) {     long long int ans = ((a % int(1e9 + 7)) - (b % int(1e9 + 7))) % int(1e9 + 7);     ans %= int(1e9 + 7);     ans = (ans + int(1e9 + 7)) % int(1e9 + 7);     return ans;   }   long long int mpow(long long int a, long long int b) {     long long int ans = 1;     long long int po = a;     while (b != 0) {       if (b % 2) {         ans = ((ans % int(1e9 + 7)) * (po % int(1e9 + 7))) % int(1e9 + 7);       }       po = ((po % int(1e9 + 7)) * (po % int(1e9 + 7))) % int(1e9 + 7);       b /= 2;     }     return ans;   }   void solve() {     long long int h, w;     cin >> h >> w;     long long int ans = 0, ffh, ffw;     for (int i = 0; i < 2; i++) {       if (i) swap(w, h);       if (i) swap(ffw, ffh);       long long int fh = 1LL << (long long int)floor(log2(h) + 1e-6);       while (w < fh / 1.25) {         fh /= 2;       }       long long int fw = min(w, (long long int)(fh / .8 + 1e-6));       if (ans < fh * fw) {         ans = fh * fw;         ffh = fh;         ffw = fw;       } else if (ans == fh * fw) {         if (i == 0 and fh > ffh) {           ffh = fh;           ffw = fw;         } else if (i == 1 and fw > ffw) {           ffh = fh;           ffw = fw;         }       }       if (i) {         swap(w, h);         swap(ffw, ffh);       }     }     cout << ffh <<     << ffw <<   n ;   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long int t;     solve();   }
#include <bits/stdc++.h>   using namespace std;   long long read() {     long long x = 0, F = 1;     char c = getchar();     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;   }   int n, s, m, k;   int a[2000 + 5], b[2000 + 5], Nxt[2000 + 5];   int dp[2000 + 5][2000 + 5], sum[2000 + 5];   bool check(int val) {     for (int i = 1; i <= n; i++) sum[i] = sum[i - 1] + (a[i] <= val);     for (int i = 0; i <= m; i++)       for (int j = 0; j <= n; j++) dp[i][j] = 0;     for (int i = 1; i <= m; i++) {       for (int j = 1; j <= n; j++) dp[i][j] = max(dp[i][j], dp[i - 1][j]);       for (int j = 1; j <= n; j++)         if (Nxt[j])           dp[i][Nxt[j]] =               max(dp[i][Nxt[j]], dp[i - 1][j - 1] + sum[Nxt[j]] - sum[j - 1]);       for (int j = 1; j <= n; j++) dp[i][j] = max(dp[i][j], dp[i][j - 1]);     }     return dp[m][n] >= k;   }   int main() {     n = read(), s = read(), m = read(), k = read();     for (int i = 1; i <= n; i++) b[i] = a[i] = read();     for (int i = 1; i <= s; i++) {       int l = read(), r = read();       for (int j = l; j <= r; j++) Nxt[j] = max(Nxt[j], r);     }     sort(b + 1, b + n + 1);     int l = 1, r = n, ans = -1;     while (l <= r) {       int mid = (l + r) >> 1;       if (check(b[mid]))         ans = b[mid], r = mid - 1;       else         l = mid + 1;     }     printf( %d , ans);   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 300005;   int N, K, val[maxn], prime[30000], cnt, limit, ans;   bool del[maxn];   void pre() {     for (int i = 2; i <= N; i++) {       if (!val[i]) prime[++cnt] = i;       val[i]++;       for (int j = i + i; j <= N; j += i) val[j]++;     }   }   int main() {     scanf( %d%d , &N, &K);     pre();     long long tot = 0;     for (int i = 1; i <= N; i++) {       tot += val[i];       if (tot >= K) {         ans = limit = i;         break;       }     }     if (tot > K)       for (int i = 1; i <= cnt; i++) {         if (tot == K) break;         if (tot - K >= limit / prime[i]) {           del[prime[i]] = 1;           tot -= limit / prime[i];           ans--;         }       }     if (tot != K)       printf( No n );     else {       printf( Yes n );       printf( %d n , ans);       for (int i = 1; i <= limit; i++)         if (!del[i]) printf( %d  , i);       puts(  );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int get(int l, int n) {     int v1, v2;     cout <<  ?   << l << endl;     fflush(stdout);     cin >> v1;     cout <<  ?   << (l + n / 2 - 1) % n + 1 << endl;     fflush(stdout);     cin >> v2;     return v2 - v1;   }   int main() {     int n;     cin >> n;     int l, r;     r = (n / 2 + 2) / 2;     l = 1;     int v_r, v_l;     v_r = get(r, n);     v_l = get(l, n);     if (v_r == 0) {       cout <<  !   << r << endl;       return 0;     }     if (v_l == 0) {       cout <<  !   << l << endl;       return 0;     }     if (((v_r > 0) - (v_r < 0)) * ((v_l > 0) - (v_l < 0)) == 1) {       int tmp = r;       r = l + n / 2;       l = tmp;     }     int m, v_m;     while (r - l > 1) {       m = (r + l) / 2;       v_m = get(m, n);       if (v_m == 0) {         cout <<  !   << m << endl;         return 0;       }       if (((v_m > 0) - (v_m < 0)) * ((v_l > 0) - (v_l < 0)) == 1) {         l = m;         v_l = v_m;       } else {         r = m;         v_r = v_m;       }     }     cout <<  !   << -1 << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int dp[2010][2010];   int main() {     int n, h, i;     scanf( %d%d , &n, &h);     dp[0][0] = 1;     for (i = 1; i <= n; i++) {       int x;       scanf( %d , &x);       x = h - x;       if (x < 0) {         printf( 0 n );         return 0;       }       if (x >= 1) {         dp[i][x] = (dp[i - 1][x] + dp[i - 1][x - 1]) % 1000000007;         dp[i][x - 1] = 1LL * dp[i][x] * x % 1000000007;       } else {         dp[i][0] = dp[i - 1][0];       }     }     printf( %d n , dp[n][0]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   unordered_map<char, long long> s, p;   bool check() {     long long any = s[ ? ];     long long sub = 0;     for (auto it = p.begin(); it != p.end(); it++) {       if (s[it->first] > p[it->first])         return false;       else if (s[it->first] < p[it->first])         sub += (p[it->first] - s[it->first]);     }     if (any >= sub) return true;     return false;   }   long long solve(string s1, string s2) {     long long ans = 0;     for (long long i = 0; i < s2.size(); i++) {       s[s1[i]]++;     }     if (check()) ans++;     long long start = 0;     for (long long i = s2.size(); i < s1.size(); i++) {       s[s1[start]]--;       s[s1[i]]++;       if (check()) ans++;       start++;     }     return ans;   }   int main() {     string s1, s2;     cin >> s1 >> s2;     for (long long i = 0; i < s2.length(); i++) p[s2[i]]++;     if (s2.length() > s1.length())       cout <<  0 n ;     else       cout << solve(s1, s2) << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<pair<int, int> > a[100010];   vector<int> ans;   string s, s1, s2;   int n, m;   int v, e, p, q;   int main() {     cin >> n;     if (n == 2) {       cout << 0;       return 0;     }     int ans = n / 2 - 1;     if (n % 2) ans++;     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 100008;   int a[N];   int b[N];   int main() {     int n = 0;     int x = 0;     scanf( %d %d , &n, &x);     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);     int cnt = 0;     int j = 1;     for (int i = n; i > 0; --i) {       while (j <= n && a[j] + b[i] < x) ++j;       if (j <= n)         ++cnt;       else         break;       ++j;     }     printf( %d %d n , 1, cnt);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long n, ans, l;   bool flag = 0;   inline long long getLen(long long x) {     long long cnt = 0;     while (x) {       cnt++;       x /= 10;     }     return cnt;   }   inline long long getSum(long long x) {     long long cnt = 0;     while (x) {       cnt += x % 10;       x /= 10;     }     return cnt;   }   int main() {     cin >> n;     long long sqn = sqrt(n);     for (l = sqn; l > 0; l--) {       if (l * l + 9 * l * getLen(l) < n) break;     }     for (ans = l; ans <= sqn; ans++) {       if (ans * ans + ans * getSum(ans) == n) {         flag = 1;         break;       }     }     printf( %lld n , flag ? ans : -1);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   int a[100010];   int isIn[1000010];   int inCount;   std::vector<int> ans;   std::vector<int> inNums;   int main() {     scanf( %d , &n);     for (int i = 0; i < n; i++) {       scanf( %d , &(a[i]));       if (a[i] > 0) isIn[a[i]] = 0;     }     inCount = 0;     bool inEnd = true;     int p = 0;     int total = 0;     while (p < n) {       if (a[p] > 0) {         if (isIn[a[p]] == 0) {           isIn[a[p]] = 1;           inCount++;         } else {           printf( -1 n );           return 0;         }       } else {         int num = -a[p];         if (isIn[num] == 1) {           isIn[num] = -1;           inCount--;           inNums.push_back(num);         } else {           printf( -1 n );           return 0;         }       }       total++;       if (inCount == 0) {         ans.push_back(total);         total = 0;         for (int i = 0; i < inNums.size(); i++) isIn[inNums[i]] = 0;         inNums.clear();       }       p++;     }     if (inCount != 0) {       printf( -1 n );       return 0;     }     printf( %d n , ans.size());     printf( %d , ans[0]);     for (int i = 1; i < ans.size(); i++) printf(  %d , ans[i]);     printf(  n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 100005;   double p[maxn], dp[maxn];   int n;   int main() {     int i;     while (scanf( %d , &n) != EOF) {       double ans = 0;       for (i = 1; i <= n; i++) {         scanf( %lf , &p[i]);         ans += p[i];       }       dp[0] = 0;       for (i = 1; i <= n; i++) {         dp[i] = dp[i - 1] * p[i] + p[i];         ans += (dp[i] - p[i]) * 2;       }       printf( %.7f n , ans);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   map<string, int> m;   string s, c, a;   int n, i, p;   int main() {     for (cin >> n >> s; i < n - 1; i++) {       c += s[i];       c += s[i + 1];       m[c]++;       if (p < m[c]) p = m[c], a = c;       c.clear();     }     cout << a;   }
#include <bits/stdc++.h>   using namespace std;   int a[100000], s[100000];   void qs(int q, int w) {     int e = q, r = w, t = a[q + (rand() % (w - q + 1))], y;     do {       while (a[e] < t) e++;       while (a[r] > t) r--;       if (e <= r) {         y = a[e];         a[e] = a[r];         a[r] = y;         y = s[e];         s[e] = s[r];         s[r] = y;         e++;         r--;       }     } while (e <= r);     if (q < r) qs(q, r);     if (e < w) qs(e, w);   }   int main() {     int q, w, e, r, t;     cin >> q;     for (w = 0; w < q; w++) {       cin >> a[w];       s[w] = w + 1;     }     qs(0, q - 1);     cout << (q + 1) / 2 <<   n ;     for (w = 0; w < q; w += 2) cout << s[w] <<    ;     cout <<   n  << q / 2 <<   n ;     for (w = 1; w < q; w += 2) cout << s[w] <<    ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, temp;   int first = -1, sec = -1;   int ifirst = -1, isec = -1;   int main() {     cin >> n;     for (int i = 0; i < n; i++) {       cin >> temp;       if (temp > first) {         sec = first;         isec = ifirst;         first = temp;         ifirst = i + 1;       } else if (temp > sec) {         sec = temp;         isec = i + 1;       }     }     cout << ifirst <<     << sec << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long INF = 1e9;   const long long MOD = 1e9;   const long long N = 100100 * 5;   char a[N], b[N], c[N];   long long n, f[33][33], ans;   bool flag;   void floyd(int n) {     for (int k = 0; k <= n; k++)       for (int i = 0; i <= n; i++)         for (int j = 0; j <= n; j++) f[i][j] = min(f[i][j], f[i][k] + f[k][j]);   }   int main() {     ios::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     cin >> a >> b >> n;     int n1 = strlen(a);     int n2 = strlen(b);     for (int i = 0; i <= 27; i++)       for (int j = 0; j <= 27; j++)         if (i == j)           f[i][j] = 0;         else           f[i][j] = INF;     while (n--) {       char x, y;       long long w;       cin >> x >> y >> w;       f[x - 97][y - 97] = min(f[x - 97][y - 97], w);     }     if (n1 != n2) {       cout <<  -1  << endl;       return 0;     }     floyd(25);     for (int i = 0; i < n1; i++) {       long long mini = INF;       for (int j = 0; j < 26; j++) {         long long c1 = f[a[i] - 97][j];         long long c2 = f[b[i] - 97][j];         if (c1 != INF && c2 != INF && mini > c1 + c2) {           mini = c1 + c2;           c[i] = j + 97;         }       }       if (mini == INF) {         flag = 1;         break;       }       ans += mini;     }     if (flag) {       cout <<  -1  << endl;       return 0;     }     c[n1] =   0 ;     cout << ans << endl << c << endl;   }
#include <bits/stdc++.h>   using namespace std;   const int maxN = 2 * 1000 * 100 + 100;   const int maxS = 4 * maxN;   vector<int> seg[maxS];   int f[maxS], toxor[maxS];   int n;   inline vector<int> merge(vector<int> a, vector<int> b) {     for (auto x : b) {       for (auto y : a)         if (x & (y & -y)) x ^= y;       if (x) {         for (auto& y : a)           if (y & (x & -x)) y ^= x;         a.push_back(x);       }     }     return a;   }   inline void handle(int ind, int qv) {     f[ind] ^= qv;     toxor[ind] ^= qv;   }   inline void shift(int ind) {     handle(ind * 2, toxor[ind]);     handle(ind * 2 + 1, toxor[ind]);     toxor[ind] = 0;   }   inline vector<int> val(int ind) {     vector<int> tmp;     tmp.push_back(f[ind]);     return merge(seg[ind], tmp);   }   void add(int ql, int qr, int qv, int xl = 0, int xr = n, int ind = 1) {     if (xr <= ql || qr <= xl) return;     if (ql <= xl && xr <= qr) {       handle(ind, qv);       return;     }     int xm = (xl + xr) / 2;     shift(ind);     add(ql, qr, qv, xl, xm, ind * 2);     add(ql, qr, qv, xm, xr, ind * 2 + 1);     f[ind] = f[ind * 2];     vector<int> tmp;     tmp.push_back(f[ind * 2 + 1] ^ f[ind * 2]);     seg[ind] = merge(merge(seg[ind * 2], seg[ind * 2 + 1]), tmp);   }   vector<int> get(int ql, int qr, int xl = 0, int xr = n, int ind = 1) {     if (xr <= ql || qr <= xl) return vector<int>();     if (ql <= xl && xr <= qr) return val(ind);     int xm = (xl + xr) / 2;     shift(ind);     return merge(get(ql, qr, xl, xm, ind * 2), get(ql, qr, xm, xr, ind * 2 + 1));   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int q;     cin >> n >> q;     for (int i = 0; i < n; i++) {       int x;       cin >> x;       add(i, i + 1, x);     }     for (int i = 0; i < q; i++) {       int t;       cin >> t;       if (t == 1) {         int l, r, k;         cin >> l >> r >> k;         add(l - 1, r, k);       } else {         int l, r;         cin >> l >> r;         cout << (1 << get(l - 1, r).size()) <<   n ;       }     }   }