func_code_string: #include <bits/stdc++.h>   namespace FastIO {   bool IOerror = 0;   inline char nc() {     static char buf[100000], *p1 = buf + 100000, *pend = buf + 100000;     if (p1 == pend) {       p1 = buf;       pend = buf + fread(buf, 1, 100000, stdin);       if (pend == p1) {         IOerror = 1;         return -1;       }     }     return *p1++;   }   inline bool blank(char ch) {     return ch ==     || ch ==   n  || ch ==   r  || ch ==   t ;   }   template <class T>   inline bool read(T &x) {     bool sign = 0;     char ch = nc();     x = 0;     for (; blank(ch); ch = nc())       ;     if (IOerror) return false;     if (ch ==  - ) sign = 1, ch = nc();     for (; ch >=  0  && ch <=  9 ; ch = nc()) x = x * 10 + ch -  0 ;     if (sign) x = -x;     return true;   }   template <class T, class... U>   bool read(T &h, U &...t) {     return read(h) && read(t...);   }   };  // namespace FastIO   using namespace std;   using namespace FastIO;   mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());   const int INF = 0x3f3f3f3f;   const int N = 1e5 + 10;   struct node {     int l, r, sum;     bitset<1010> f;   } tree[N * 15];   int root[N], cnt;   int n, m, q;   bitset<1010> base;   void ins(int &x, int pre, int l, int r, int i, int j, int op) {     x = ++cnt;     tree[x] = tree[pre];     if (l == r) {       if (op == 1) tree[x].f.set(j);       if (op == 2) tree[x].f.reset(j);       if (op == 3) tree[x].f ^= base;       tree[x].sum = tree[x].f.count();       return;     }     int mid = (l + r) / 2;     if (i <= mid)       ins(tree[x].l, tree[pre].l, l, mid, i, j, op);     else       ins(tree[x].r, tree[pre].r, mid + 1, r, i, j, op);     tree[x].sum = tree[tree[x].l].sum + tree[tree[x].r].sum;     return;   }   signed main() {     read(n, m, q);     for (int i = 1; i <= m; i++) base.set(i);     for (int i = 1; i <= q; i++) {       int op, x, y;       read(op);       if (op <= 2) {         read(x, y);         ins(root[i], root[i - 1], 1, n, x, y, op);       }       if (op == 3) {         read(x);         ins(root[i], root[i - 1], 1, n, x, 0, op);       }       if (op == 4) {         read(x);         root[i] = root[x];       }       printf( %d n , tree[root[i]].sum);     }     return 0;   }   