func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = (1 << 18) + 100;   const int maxnode = maxn << 2;   int n, ai[maxn + 5];   int ls[maxnode + 5], rs[maxnode + 5];   int re[maxnode + 5], sp[maxnode + 5];   long long sum[maxnode + 5];   void Build(int x, int l, int r) {     re[x] = sp[x] = 0;     ls[x] = x << 1, rs[x] = x << 1 | 1;     if (l == r) {       sum[x] = ai[l];       return;     }     int &lson = ls[x], &rson = rs[x], mid = (l + r) >> 1;     Build(lson, l, mid);     Build(rson, mid + 1, r);     sum[x] = sum[lson] + sum[rson];   }   void Replace(int d, int x, int l, int r, int p, int v) {     if (l == r) {       sum[x] = v;       return;     }     int &lson = ls[x], &rson = rs[x], mid = (l + r) >> 1;     if (re[x] >> d & 1) {       re[x] ^= (1 << d), sp[x] ^= (1 << d), re[lson] ^= (1 << (d + 1)),           re[rson] ^= (1 << (d + 1));     }     if (sp[x] >> d & 1) {       sp[x] ^= (1 << d), swap(lson, rson);     }     re[lson] ^= re[x], re[rson] ^= re[x], re[x] = 0;     sp[lson] ^= sp[x], sp[rson] ^= sp[x], sp[x] = 0;     if (p <= mid)       Replace(d + 1, lson, l, mid, p, v);     else       Replace(d + 1, rson, mid + 1, r, p, v);     sum[x] = sum[lson] + sum[rson];   }   long long Sum(int d, int x, int l, int r, int ll, int rr) {     if (ll <= l && r <= rr) return sum[x];     int &lson = ls[x], &rson = rs[x], mid = (l + r) >> 1;     long long res = 0;     if (re[x] >> d & 1) {       re[x] ^= (1 << d), sp[x] ^= (1 << d), re[lson] ^= (1 << (d + 1)),           re[rson] ^= (1 << (d + 1));     }     if (sp[x] >> d & 1) {       sp[x] ^= (1 << d), swap(lson, rson);     }     re[lson] ^= re[x], re[rson] ^= re[x], re[x] = 0;     sp[lson] ^= sp[x], sp[rson] ^= sp[x], sp[x] = 0;     if (ll <= mid) res += Sum(d + 1, lson, l, mid, ll, rr);     if (mid < rr) res += Sum(d + 1, rson, mid + 1, r, ll, rr);     return res;   }   int main() {     int _;     scanf( %d%d , &n, &_);     int pn = n;     n = (1 << n);     for (int i = 1; i <= n; ++i) scanf( %d , ai + i);     Build(1, 1, n);     while (_--) {       int o, x, k, l, r;       scanf( %d , &o);       if (o == 1) {         scanf( %d%d , &x, &k);         Replace(0, 1, 1, n, x, k);       } else if (o == 2) {         scanf( %d , &k);         k = pn - k;         re[1] ^= (1 << k);       } else if (o == 3) {         scanf( %d , &k);         k = pn - 1 - k;         sp[1] ^= (1 << k);       } else {         scanf( %d%d , &l, &r);         long long ans = Sum(0, 1, 1, n, l, r);         printf( %lld n , ans);       }     }     return 0;   }   