func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int n, m;     scanf( %d %d , &n, &m);     vector<int> att, def, my(m);     for (int i = 0; i < n; i++) {       char a, b, c;       int s;       scanf(  %c%c%c %d , &a, &b, &c, &s);       if (a ==  A )         att.push_back(s);       else         def.push_back(s);     }     for (int i = 0; i < m; i++) {       scanf( %d , &my[i]);     }     sort(att.begin(), att.end());     sort(def.begin(), def.end());     sort(my.begin(), my.end());     int res = 0;     vector<int> used(m, 0);     int pres = 0;     int cm = 0;     for (int i = 0; i < def.size(); i++) {       while (my[cm] <= def[i] || used[cm]) {         cm++;         if (cm >= m) {           pres = -1023456789;           break;         }       }       if (cm < m) {         used[cm] = 1;       } else         break;     }     if (pres > -1023456789) {       cm = 0;       for (int i = 0; i < att.size(); i++) {         while (my[cm] < att[i] || used[cm]) {           cm++;           if (cm >= m) {             pres = -1023456789;             break;           }         }         if (cm < m) {           used[cm] = 1;           pres += my[cm] - att[i];         } else           break;       }     }     if (pres > -1023456789) {       for (int i = 0; i < m; i++)         if (!used[i]) pres += my[i];     }     res = max(res, pres);     for (int i = 1; i <= min(m, (int)(att.size())); i++) {       int suc = 0;       for (int j = 0; j < i; j++) {         if (my[m - i + j] >= att[j]) {           suc += my[m - i + j] - att[j];         } else           suc = -1023456789;       }       res = max(res, suc);     }     printf( %d n , res);     return 0;   }   