func_code_string: #include <bits/stdc++.h>   using namespace std;   int V = 0;   struct Node {     int id;     long long num, sum;     Node *l, *r;     Node() {       num = -1;       sum = 0;       l = r = nullptr;       id = V++;     }   };   int N;   string s;   Node* build(int& n) {     Node* node = new Node();     if (s[n] ==  ( ) {       n++;       node->l = build(n);       n++;       node->r = build(n);       n++;       node->sum += node->l->sum + node->r->sum + 1;     } else {       node->num = s[n] -  0 ;       n++;     }     return node;   }   const long long INF = 1 << 25;   int P, M;   bool remplus;   long long mi[10000][210];   long long ma[10000][210];   pair<long long, long long> f(Node* node, int rem) {     if (node->num != -1) {       if (rem) return {INF, INF};       return {node->num, node->num};     }     int id = node->id;     if (mi[id][rem] != INF) return {mi[id][rem], ma[id][rem]};     if (rem > node->sum) return {INF, INF};     pair<long long, long long> ret = {INF, -INF};     for (int i = 0; i < 2; i++) {       int nrem = rem - (remplus && !i || !remplus && i);       if (nrem < 0) continue;       for (int j = 0; j <= nrem; j++) {         auto res1 = f(node->l, j);         auto res2 = f(node->r, nrem - j);         if (res1.first == INF || res2.first == INF) continue;         if (i == 0) {           ret.first = min(ret.first, res1.first + res2.first);           ret.second = max(ret.second, res1.second + res2.second);         } else {           ret.first = min(ret.first, res1.first - res2.second);           ret.second = max(ret.second, res1.second - res2.first);         }       }     }     mi[id][rem] = ret.first;     ma[id][rem] = ret.second;     return ret;   }   int main() {     cin.tie(0);     ios::sync_with_stdio(false);     cin >> s >> P >> M;     N = s.size();     int n = 0;     Node* root = build(n);     fill((long long*)begin(mi), (long long*)end(mi), INF);     fill((long long*)begin(ma), (long long*)end(ma), INF);     remplus = P <= M;     int rem = remplus ? P : M;     cout << f(root, rem).second << endl;   }   