func_code_string: #include <bits/stdc++.h>   using namespace std;   namespace {   void Solve(int) {     const set<string> bins = { AND ,  OR ,  XOR };     int n;     cin >> n;     vector<string> type(n);     vector<int> lef(n, -1), rig(n, -1);     for (int i = 0, __i = n; i < __i; ++i) {       cin >> type[i] >> lef[i];       if (type[i] !=  IN ) --lef[i];       if (bins.count(type[i])) {         cin >> rig[i];         --rig[i];       }     }     auto eval = [](const string& t, bool a, bool b) {       if (t ==  AND )         return a and b;       else if (t ==  OR )         return a or b;       else         return (bool)(a ^ b);     };     vector<bool> val(n), flip(n);     function<void(int)> dfs1 = [&](int at) {       if (type[at] ==  IN ) {         val[at] = lef[at];       } else {         dfs1(lef[at]);         if (bins.count(type[at])) {           dfs1(rig[at]);           val[at] = eval(type[at], val[lef[at]], val[rig[at]]);         } else {           val[at] = !val[lef[at]];         }       }     };     dfs1(0);     function<void(int)> dfs2 = [&](int at) {       if (type[at] ==  IN )         flip[at] = true;       else if (type[at] ==  NOT ) {         flip[at] = true;         dfs2(lef[at]);       } else {         if (val[at] != eval(type[at], val[lef[at]] ^ 1, val[rig[at]])) {           flip[at] = true;           dfs2(lef[at]);         }         if (val[at] != eval(type[at], val[lef[at]], val[rig[at]] ^ 1)) {           flip[at] = true;           dfs2(rig[at]);         }       }     };     dfs2(0);     for (int i = 0, __i = n; i < __i; ++i)       if (type[i] ==  IN ) cout << (val[0] ^ flip[i]);     cout <<   n ;   }   void Init() {     ios::sync_with_stdio(false);     cin.tie(nullptr);   }   }  // namespace   int32_t main() {     Init();     int tests = 1;     for (int test = 1, __test = tests + 1; test < __test; ++test) Solve(test);     return 0;   }   