func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int n;     cin >> n;     map<int, int> mp1, mp2;     map<int, int>::iterator it;     for (int i = 0; i < n; i++) {       int a, b;       cin >> a >> b;       mp1[a] = b;     }     int m;     cin >> m;     for (int i = 0; i < m; i++) {       int a, b;       cin >> a >> b;       if (mp1.find(a) != mp1.end()) {         it = mp1.find(a);         if (it->second > b) {           continue;         } else {           mp1.erase(it);           mp2[a] = b;         }       } else {         mp2[a] = b;       }     }     long long sum = 0;     it = mp1.begin();     while (it != mp1.end()) {       sum += it->second;       it++;     }     it = mp2.begin();     while (it != mp2.end()) {       sum += it->second;       it++;     }     cout << sum <<   n ;     return 0;   }   