func_code_string: #include <bits/stdc++.h>   using namespace std;   int A, D, C;   vector<int> atk, def, ciel;   bool used[110];   int partial(void) {     int N = min(A, C), i, ans = 0;     for ((i) = 0; (i) < (int)(N); (i)++)       if (atk[i] < ciel[C - 1 - i]) ans += ciel[C - 1 - i] - atk[i];     return ans;   }   int search(int x) {     int i;     for ((i) = 0; (i) < (int)(C); (i)++)       if (ciel[i] >= x && !used[i]) {         used[i] = true;         return i;       }     return -1;   }   int all(void) {     int i, defsum = 0;     for ((i) = 0; (i) < (int)(D); (i)++) {       int x = search(def[i] + 1);       if (x == -1) return 0;       defsum += ciel[x];     }     for ((i) = 0; (i) < (int)(A); (i)++) {       int x = search(atk[i]);       if (x == -1) return 0;     }     int ans = 0;     for ((i) = 0; (i) < (int)(C); (i)++) ans += ciel[i];     for ((i) = 0; (i) < (int)(A); (i)++) ans -= atk[i];     ans -= defsum;     return ans;   }   int main(void) {     int N, i, x;     cin >> N >> C;     for ((i) = 0; (i) < (int)(N); (i)++) {       string type;       cin >> type >> x;       if (type ==  ATK )         atk.push_back(x);       else         def.push_back(x);     }     for ((i) = 0; (i) < (int)(C); (i)++) {       cin >> x;       ciel.push_back(x);     }     sort(atk.begin(), atk.end());     sort(def.begin(), def.end());     sort(ciel.begin(), ciel.end());     A = atk.size();     D = def.size();     int ans1 = partial();     int ans2 = all();     cout << max(ans1, ans2) << endl;     return 0;   }   