func_code_string: #include <bits/stdc++.h>   using namespace std;   static const double EPS = 1e-10;   template <typename T, typename S>   vector<T>& operator<<(vector<T>& a, S b) {     a.push_back(b);     return a;   }   template <typename T>   void operator>>(vector<T>& a, int b) {     while (b--)       if (!a.empty()) a.pop_back();   }   bool isprime(int n) {     if (n < 2) return false;     for (int i = 2; i * i <= n; i++)       if (n % i == 0) return false;     return true;   }   long long b_pow(long long x, long long n) {     return n ? b_pow(x * x, n / 2) * (n % 2 ? x : 1) : 1ll;   }   string itos(int n) {     stringstream ss;     ss << n;     return ss.str();   }   int main() {     int n, m;     cin >> n >> m;     vector<int> atk, def, ciel;     for (int i = 0; i < n; i++) {       string x;       int y;       cin >> x >> y;       if (x ==  DEF )         def.push_back(y);       else         atk.push_back(y);     }     for (int i = 0; i < m; i++) {       int x;       cin >> x;       ciel.push_back(x);     }     sort(atk.begin(), atk.end());     sort(def.begin(), def.end());     sort(ciel.rbegin(), ciel.rend());     int answer1 = 0;     for (int i = 0; i < min(atk.size(), ciel.size()); i++) {       if (atk[i] < ciel[i]) {         answer1 += ciel[i] - atk[i];       }     }     int bad = 0;     int answer2 = 0;     sort(ciel.begin(), ciel.end());     int u[100] = {};     for (int j = 0; j < def.size(); j++) {       int ok = 0;       for (int i = 0; i < ciel.size(); i++) {         if (!u[i] && def[j] < ciel[i]) {           ok = 1;           u[i] = true;           break;         }       }       if (!ok) bad = true;     }     for (int j = 0; j < atk.size(); j++) {       int ok = 0;       for (int i = 0; i < ciel.size(); i++) {         if (!u[i] && atk[j] <= ciel[i]) {           answer2 += ciel[i] - atk[j];           ok = 1;           u[i] = true;           break;         }       }       if (!ok) bad = true;     }     for (int i = 0; i < m; i++) {       if (!u[i]) {         answer2 += ciel[i];       }     }     if (!bad) answer1 = max(answer1, answer2);     cout << answer1 << endl;   }   