func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     pair<int, int> p[n];     int t = 0;     for (int i = 0; i < n; i++) {       cin >> p[i].first >> p[i].second;     }     sort(p, p + n);     int start = 0, l = 0, r = 0, s = 0;     for (int i = 0; i < 2 * n; i++) {       if (i < n && p[i].first > 0) {         start = 1;       }       if (start) {         l = i - 1;         r = i;         while (1) {           if (l < 0 && r == n) break;           if (l < 0) {             s += p[r].second;             break;           } else if (r == n) {             s += p[l].second;             break;           }           s += p[l--].second + p[r++].second;         }         return cout << s, 0;       }     }     cout << p[n - 1].second << endl;     return 0;   }   