func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<pair<long long, long long> > v;   bool cmp(pair<long long, long long> &a, pair<long long, long long> &b) {     if (a.first == b.first) return a.second < b.second;     return b.first < a.first;   }   long long func(pair<long long, long long> &a, pair<long long, long long> &b,                  long long d) {}   int main() {     long long n;     long long m, d;     scanf( %lld %lld %lld , &n, &m, &d);     pair<long long, long long> a[n];     pair<long long, long long> b[m];     for (long long i = 0; i < n; i++) {       cin >> a[i].first >> a[i].second;     }     sort(a, a + n, cmp);     for (long long i = 0; i < m; i++) {       cin >> b[i].first >> b[i].second;     }     sort(b, b + m, cmp);     long long posi = 1, totalw = 0, posj = 1, totals = 0;     totalw = a[0].second + b[0].second;     totals = a[0].first + b[0].first;     if (totalw > d) return cout << 0, 0;     while (posj < m && totalw + b[posj].second <= d) {       totalw += b[posj].second;       totals += b[posj].first;       posj++;     }     long long mx = totals;     while (posi < n) {       totalw += a[posi].second;       totals += a[posi].first;       posi++;       while (totalw > d) {         if (posj <= 1) return cout << mx, 0;         posj--;         totals -= b[posj].first;         totalw -= b[posj].second;       }       mx = max(mx, totals);     }     cout << mx << endl;   }   