func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int n;     priority_queue<pair<int, int> > neg;     priority_queue<pair<int, int>, vector<pair<int, int> >,                    greater<pair<int, int> > >         pos;     cin >> n;     int x, a;     pair<int, int> temp;     for (int i = 0; i < n; i++) {       cin >> x >> a;       temp = make_pair(x, a);       if (x < 0) {         neg.push(temp);       } else {         pos.push(temp);       }     }     int ans = 0;     if (pos.size() >= neg.size()) {       while (1) {         if (pos.empty())           break;         else {           ans += pos.top().second;           pos.pop();         }         if (neg.empty())           break;         else {           ans += neg.top().second;           neg.pop();         }       }     } else {       while (1) {         if (neg.empty())           break;         else {           ans += neg.top().second;           neg.pop();         }         if (pos.empty())           break;         else {           ans += pos.top().second;           pos.pop();         }       }     }     printf( %d , ans);     return 0;   }   