func_code_string: #include <bits/stdc++.h>   using namespace std;   struct Expr {     char a[1010], b[1010];     int v;     int op;   };   Expr exps[5010];   char ansMin[1010], ansMax[1010];   char buf[10010];   map<string, int> varIndex;   int calc(int a, int b, int op) {     if (op == 1)       return a & b;     else if (op == 2)       return a | b;     else if (op == 3)       return a ^ b;   }   int work(int bit, int n, int v) {     int ans = 0;     for (int i = 0; i < n; i++) {       if (exps[i].op) {         int a, b;         if (isdigit(exps[i].a[0]))           a = exps[i].a[bit] -  0 ;         else if (exps[i].a[0] ==  ? )           a = v;         else {           string _var;           _var.assign(exps[i].a);           a = varIndex[_var];           a = exps[a].v;         }         if (isdigit(exps[i].b[0]))           b = exps[i].b[bit] -  0 ;         else if (exps[i].b[0] ==  ? )           b = v;         else {           string _var;           _var.assign(exps[i].b);           b = varIndex[_var];           b = exps[b].v;         }         exps[i].v = calc(a, b, exps[i].op);         ans += exps[i].v;       } else {         exps[i].v = exps[i].a[bit] -  0 ;         ans += exps[i].v;       }     }     return ans;   }   int main() {     int n, m;     char op[16], var[16];     scanf( %d%d , &n, &m);     getchar();     for (int i = 0; i < n; i++) {       gets(buf);       if (sscanf(buf,  %s := %s %s %s , var, exps[i].a, op, exps[i].b) == 4) {         if (op[0] ==  A )           exps[i].op = 1;         else if (op[0] ==  O )           exps[i].op = 2;         else if (op[0] ==  X )           exps[i].op = 3;       } else {         sscanf(buf,  %s := %s , var, exps[i].a);         exps[i].op = 0;       }       string _var;       _var.assign(var);       varIndex[var] = i;     }     for (int i = 0; i < m; i++) {       int a = work(i, n, 0);       int b = work(i, n, 1);       if (a > b)         ansMin[i] =  1 , ansMax[i] =  0 ;       else if (a < b)         ansMin[i] =  0 , ansMax[i] =  1 ;       else         ansMin[i] =  0 , ansMax[i] =  0 ;     }     puts(ansMin);     puts(ansMax);     return 0;   }   