func_code_string: #include <bits/stdc++.h>   using namespace std;   long long ara[100010];   int segtree[20][100010 * 4];   int lazy[20][100010 * 4];   void build(int node, int l, int r, int po) {     if (l == r) {       segtree[po][node] = 0;       if ((ara[l] & (1 << po))) {         segtree[po][node] = 1;       }       return;     }     int mid = (l + r) >> 1;     int left = node << 1;     int right = left | 1;     build(left, l, mid, po);     build(right, mid + 1, r, po);     segtree[po][node] = segtree[po][left] + segtree[po][right];     return;   }   int query(int node, int l, int r, int ql, int qr, int po) {     if (lazy[po][node]) {       segtree[po][node] = (r - l + 1) - segtree[po][node];       if (l != r) {         lazy[po][(node << 1)] ^= 1;         lazy[po][1 + (node << 1)] ^= 1;       }       lazy[po][node] = 0;     }     if (l >= ql && qr >= r) {       return segtree[po][node];     }     if (l > qr || ql > r) return 0;     int mid = (l + r) >> 1;     int left = node << 1;     int right = left | 1;     int p = query(left, l, mid, ql, qr, po);     int q = query(right, mid + 1, r, ql, qr, po);     return p + q;   }   void update(int node, int l, int r, int ql, int qr, int po) {     if (lazy[po][node]) {       segtree[po][node] = (r - l + 1) - segtree[po][node];       if (l != r) {         lazy[po][node << 1] ^= 1;         lazy[po][1 + (node << 1)] ^= 1;       }       lazy[po][node] = 0;     }     if (l >= ql && qr >= r) {       segtree[po][node] = (r - l + 1) - segtree[po][node];       if (l != r) {         lazy[po][node << 1] ^= 1;         lazy[po][1 + (node << 1)] ^= 1;       }       lazy[po][node] = 0;       return;     }     if (l > qr || r < ql) return;     int mid = (l + r) >> 1;     int left = node << 1;     int right = left | 1;     update(left, l, mid, ql, qr, po);     update(right, mid + 1, r, ql, qr, po);     segtree[po][node] = segtree[po][left] + segtree[po][right];     return;   }   int main() {     long long n;     scanf( %lld , &n);     for (int i = 1; i <= n; i++) {       scanf( %lld , &ara[i]);     }     for (int i = 0; i < 20; i++) {       build(1, 1, n, i);     }     long long m;     scanf( %lld , &m);     while (m--) {       long long x;       scanf( %lld , &x);       if (x == 1) {         long long a, b;         scanf( %lld%lld , &a, &b);         long long sum = 0;         for (int i = 0; i < 20; i++) {           int y = query(1, 1, n, a, b, i);           sum += y * (1LL << i);         }         printf( %lld n , sum);       } else {         long long a, b, c;         scanf( %lld%lld , &a, &b);         scanf( %lld , &c);         for (int i = 0; i < 20; i++) {           if (c & (1 << i)) {             update(1, 1, n, a, b, i);           }         }       }     }   }   