func_code_string: #include <bits/stdc++.h>   using namespace std;   long long n, m;   long long a[201];   char s[30];   long long b[30];   long long dp[2000000];   long long f(long long mask) {     if (mask == (1 << m) - 1) return 0;     if (dp[mask] != -1) return dp[mask];     long long count = __builtin_popcount(mask);     char ch = s[count];     long long move = b[count];     long long ans = -1e8;     long long sign = 1;     if (move == 2) sign = -1;     ans *= sign;     for (long long i = 0; i < m; i++) {       if ((mask) & (1 << i)) continue;       if (ch ==  p ) {         if (sign == 1)           ans = max(ans, f((mask | (1 << i))) + sign * a[i]);         else           ans = min(ans, f((mask | (1 << i))) + sign * a[i]);       } else {         if (sign == 1)           ans = max(ans, f((mask | (1 << i))));         else           ans = min(ans, f((mask | (1 << i))));       }     }     return dp[mask] = ans;   }   int32_t main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     cin >> n;     for (long long i = 0; i < n; i++) cin >> a[i];     sort(a, a + n);     reverse(a, a + n);     cin >> m;     for (long long i = 0; i < m; i++) cin >> s[i] >> b[i];     memset(dp, -1, sizeof(dp));     cout << f(0);   }   