func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAX = 100010;   string nick[MAX];   int ara[MAX], ord[MAX], b[MAX];   int save[MAX];   bool cmp(int a, int b) {     if (ara[a] == ara[b]) return nick[a] < nick[b];     return ara[a] > ara[b];   }   deque<int> D;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     int n, m;     cin >> n;     if (n == 0) {       cout << 0 <<     << 0 << endl;       return 0;     }     for (int i = 1; i <= n; i++) {       cin >> nick[i] >> ara[i];       save[i] = ara[i];     }     cin >> m;     for (int i = 1; i <= m; i++) cin >> b[i], D.push_back(b[i]);     sort(D.begin(), D.end());     string s;     cin >> s;     int id = -1;     for (int i = 1; i <= n; i++) {       if (s == nick[i]) {         if (id == -1)           id = i;         else           assert(false);       }     }     for (int i = 1; i <= n; i++) ord[i] = i;     sort(ord + 1, ord + n + 1, cmp);     int ans1, ans2;     if (m == 0) {       for (int i = 1; i <= n; i++)         if (ord[i] == id) {           ans2 = ans1 = i;           break;         }       cout << ans1 <<     << ans2 << endl;       return 0;     }     int cur;     for (int i = 1; i <= n; i++)       if (ord[i] == id) cur = i;     if (n == m) {       ara[id] += D.front();       D.pop_front();     }     int parbo = n - cur;     int bad = D.size() - parbo;     for (int i = cur - 1; i >= 1 and bad > 0; i--, bad--) {       ara[ord[i]] += D.front();       D.pop_front();     }     int need;     for (int i = cur + 1; i <= n; i++) {       need = (ara[id] + 1) - ara[ord[i]];       int paic = 0;       while (D.size() > 0) {         if (D.front() >= need) {           paic = D.front();           D.pop_front();           break;         } else           D.pop_front();       }       ara[ord[i]] += paic;     }     sort(ord + 1, ord + n + 1, cmp);     for (int i = 1; i <= n; i++)       if (ord[i] == id) ans2 = i;     for (int i = 1; i <= n; i++) ara[i] = save[i];     D.clear();     for (int i = 1; i <= m; i++) D.push_back(b[i]);     sort(D.begin(), D.end());     ara[id] += D.back();     D.pop_back();     sort(ord + 1, ord + n + 1, cmp);     for (int i = n; i >= 1 and D.size() > 0; i--) {       if (ord[i] == id) continue;       ara[ord[i]] += D.back();       D.pop_back();     }     sort(ord + 1, ord + n + 1, cmp);     for (int i = 1; i <= n; i++)       if (ord[i] == id) ans1 = i;     cout << ans1 <<     << ans2 << endl;     return 0;   }   