func_code_string: #include <bits/stdc++.h>   using namespace std;   pair<long long, long long> sn[100005], sp[100005];   bool myfunction(pair<long long, long long> i, pair<long long, long long> j) {     return (i.first > j.first);   }   int main() {     int n, p, a, first = 0, second = 0;     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %d%d , &p, &a);       if (p < 0) {         first++;         sn[first] = make_pair(p, a);       } else {         second++;         sp[second] = make_pair(p, a);       }     }     sort(sn, sn + first + 1, myfunction);     sort(sp, sp + second + 1);     for (int i = 1; i <= first; i++) sn[i].second += sn[i - 1].second;     for (int i = 1; i <= second; i++) sp[i].second += sp[i - 1].second;     sn[first + 1] = sn[first];     sp[second + 1] = sp[second];     int m = min(first, second);     long long ans = sp[m + 1].second + sn[m].second;     ans = max(ans, sp[m].second + sn[m + 1].second);     printf( %I64d n , ans);     return 0;   }   