func_code_string: #include <bits/stdc++.h>   using namespace std;   int32_t main() {     ios::sync_with_stdio(0);     int64_t n, m, d;     cin >> n >> m >> d;     vector<pair<int64_t, int64_t> > a1(n), a2(m);     for (auto &e : a1) {       cin >> e.first >> e.second;       e.second = -e.second;     }     for (auto &e : a2) {       cin >> e.first >> e.second;       e.second = -e.second;     }     sort(a1.begin(), a1.end());     sort(a2.begin(), a2.end());     reverse(a1.begin(), a1.end());     reverse(a2.begin(), a2.end());     vector<int64_t> p2c(m), p2w(m);     int64_t ans = 0;     for (int64_t i = 0; i < m; i++) {       p2c[i] = a2[i].first;       p2w[i] = -a2[i].second;       if (i > 0) {         p2c[i] += p2c[i - 1];         p2w[i] += p2w[i - 1];       }     }     int64_t Len = 0, C = 0;     for (int64_t i = 0; i < n; i++) {       C += a1[i].first;       d += a1[i].second;       int64_t idx = upper_bound(p2w.begin(), p2w.end(), d) - p2w.begin();       if (idx == 0) break;       ans = max(ans, C + p2c[idx - 1]);     }     cout << ans;     return 0;   }   