func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 1e6 + 60;   const int IN = 0;   const int AND = 1;   const int OR = 2;   const int XOR = 3;   const int NOT = 4;   struct Node {     int val, p1, p2;     int op;   } node[maxn];   int n, p1, p2;   string op;   bool change[maxn];   int eval(int cur) {     if (node[cur].op == IN) {       return node[cur].val;     }     if (node[cur].op == AND) {       return node[cur].val = (eval(node[cur].p1) & eval(node[cur].p2));     }     if (node[cur].op == OR) {       return node[cur].val = (eval(node[cur].p1) | eval(node[cur].p2));     }     if (node[cur].op == XOR) {       return node[cur].val = (eval(node[cur].p1) ^ eval(node[cur].p2));     }     if (node[cur].op == NOT) {       return node[cur].val = (!eval(node[cur].p1));     }   }   void process(int cur, int now) {     int l = node[cur].p1;     int r = node[cur].p2;     int vl = node[l].val;     int vr = node[r].val;     if (node[cur].op == IN) {       return;     } else if (node[cur].op == AND) {       if (vl == 0 && vr == 0) {         process(l, change[l] = 0);         process(r, change[r] = 0);       } else if (vl == 0 && vr == 1) {         process(l, change[l] = (now & 1));         process(r, change[r] = 0);       } else if (vl == 1 && vr == 0) {         process(l, change[l] = 0);         process(r, change[r] = (now & 1));       } else if (vl == 1 && vr == 1) {         process(l, change[l] = (now & 1));         process(r, change[r] = (now & 1));       }     } else if (node[cur].op == OR) {       if (vl == 0 && vr == 0) {         process(l, change[l] = (now & 1));         process(r, change[r] = (now & 1));       } else if (vl == 0 && vr == 1) {         process(l, change[l] = 0);         process(r, change[r] = (now & 1));       } else if (vl == 1 && vr == 0) {         process(l, change[l] = (now & 1));         process(r, change[r] = 0);       } else if (vl == 1 && vr == 1) {         process(l, change[l] = 0);         process(r, change[r] = 0);       }     } else if (node[cur].op == XOR) {       process(l, change[l] = (now & 1));       process(r, change[r] = (now & 1));     } else if (node[cur].op == NOT) {       process(l, change[l] = (now & 1));     }   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       cin >> op;       if (op ==  IN ) {         scanf( %d , &p1);         node[i] = {p1, 0, 0, IN};       } else if (op ==  NOT ) {         scanf( %d , &p1);         node[i] = {0, p1, 0, NOT};       } else if (op ==  AND ) {         scanf( %d%d , &p1, &p2);         node[i] = {0, p1, p2, AND};       } else if (op ==  OR ) {         scanf( %d%d , &p1, &p2);         node[i] = {0, p1, p2, OR};       } else if (op ==  XOR ) {         scanf( %d%d , &p1, &p2);         node[i] = {0, p1, p2, XOR};       }     }     eval(1);     process(1, 1);     for (int i = 1; i <= n; i++) {       if (node[i].op == IN) printf( %d , change[i] ^ node[1].val);     }   }   