func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long N = 105;   vector<long long> a, b, v;   string s;   long long n, m, x;   long long killAll() {     vector<long long> hlp;     long long i = 0;     for (long long x : b) {       while (i < v.size() and v[i] <= x) {         hlp.push_back(v[i]);         i++;       }       if (i == v.size())         return 0;       else         i++;     }     while (i < v.size()) {       hlp.push_back(v[i]);       i++;     }     long long ans = 0;     long long j = hlp.size() - 1;     for (__typeof(((long long)a.size() - 1)) i = ((long long)a.size() - 1);          i >= (0); i--) {       long long x = a[i];       if (j < i) return 0;       if (hlp[j] >= x)         ans += (hlp[j] - x);       else         return 0;       j--;     }     while (j >= 0) {       ans += hlp[j];       j--;     }     return ans;   }   long long killExact(long long k) {     if (k > a.size()) return 0;     long long i = k - 1;     long long j = v.size() - 1;     long long ans = 0;     while (i >= 0 and j >= 0) {       if (v[j] >= a[i])         ans += (v[j] - a[i]);       else         return 0;       j--;       i--;     }     return ans;   }   long long killFew() {     long long ans = 0;     for (long long i = 1; i <= m; i++) ans = max(ans, killExact(i));     return ans;   }   long long solve() {     cin >> n >> m;     for (__typeof((n)) i = (1); i <= (n); i++) {       cin >> s >> x;       if (s ==  ATK )         a.push_back(x);       else         b.push_back(x);     }     for (__typeof((m)) i = (1); i <= (m); i++) {       cin >> x;       v.push_back(x);     }     sort((v).begin(), (v).end());     sort((a).begin(), (a).end());     sort((b).begin(), (b).end());     cout << max(killAll(), killFew()) <<   n ;     return 0;   }   signed main() {     long long t;     ios_base::sync_with_stdio(false);     t = 1;     while (t--) solve();     return 0;   }   