func_code_string: #include <bits/stdc++.h>   using namespace std;   using ll = long long;   using pii = pair<int, int>;   using pll = pair<ll, ll>;   template <class T>   using vv = vector<vector<T>>;   template <class T>   inline bool MX(T &l, const T &r) {     return l < r ? l = r, 1 : 0;   }   template <class T>   inline bool MN(T &l, const T &r) {     return l > r ? l = r, 1 : 0;   }   const ll MOD = 1e9 + 7;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout << fixed << setprecision(0);     int n;     cin >> n;     string opes(n,  . );     vector<pii> clds(n);     for (int(i) = 0; (i) < (n); ++(i)) {       string s;       cin >> s >> clds[i].first;       if (s ==  IN ) {         opes[i] =  > ;         continue;       }       --clds[i].first;       if (s ==  NOT ) {         opes[i] =  ~ ;         continue;       }       cin >> clds[i].second;       --clds[i].second;       if (s ==  AND ) {         opes[i] =  & ;       } else if (s ==  OR ) {         opes[i] =  | ;       } else if (s ==  XOR ) {         opes[i] =  ^ ;       } else         return 1;     };     vector<int> vals(n);     {       function<int(int)> dfs = [&](int v) {         if (opes[v] ==  & ) {           vals[v] = dfs(clds[v].first) & dfs(clds[v].second);         } else if (opes[v] ==  | ) {           vals[v] = dfs(clds[v].first) | dfs(clds[v].second);         } else if (opes[v] ==  ^ ) {           vals[v] = dfs(clds[v].first) ^ dfs(clds[v].second);         } else if (opes[v] ==  ~ ) {           vals[v] = 1 - dfs(clds[v].first);         } else           vals[v] = clds[v].first;         return vals[v];       };       dfs(0);     };     string re(n, vals[0] +  0 );     ;     {       function<void(int)> dfs = [&](int v) {         if (opes[v] ==  & ) {           if (vals[clds[v].first]) dfs(clds[v].second);           if (vals[clds[v].second]) dfs(clds[v].first);         } else if (opes[v] ==  | ) {           if (!vals[clds[v].first]) dfs(clds[v].second);           if (!vals[clds[v].second]) dfs(clds[v].first);         } else if (opes[v] ==  ^ ) {           dfs(clds[v].first);           dfs(clds[v].second);         } else if (opes[v] ==  ~ ) {           dfs(clds[v].first);         } else           re[v] ^= 1;       };       dfs(0);     }     for (int(i) = 0; (i) < (n); ++(i))       if (opes[i] ==  > ) cout << re[i];     cout <<   n ;     return 0;   }   