func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     int n;     while (cin >> n) {       int pos, val;       multimap<int, int> mp1, mp2;       while (n--) {         cin >> pos >> val;         pos < 0 ? mp1.insert(pair<int, int>(pos, val))                 : mp2.insert(pair<int, int>(pos, val));       }       int min_size = min(mp1.size(), mp2.size());       multimap<int, int>::reverse_iterator it1 = mp1.rbegin();       multimap<int, int>::iterator it2 = mp2.begin();       long long ans = 0;       for (int i = 0; i < min_size; ++i, ++it1, ++it2)         ans += ((it1->second) + (it2->second));       if (mp1.size() > mp2.size()) ans += (it1->second);       if (mp1.size() < mp2.size()) ans += (it2->second);       cout << ans << endl;     }     return 0;   }   