func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 123456;   const int mod = 1e9 + 7;   class table {    public:     int id;     int size;   };   class group {    public:     int id;     int size;     int income;   };   bool byIncome(const group &r1, const group &r2) {     return r1.income > r2.income;   }   bool bySize(const table &t1, const table &t2) { return t1.size < t2.size; }   bool canFit(table &t, const group &g) { return t.size < g.size; }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int n;     cin >> n;     vector<group> groups(n);     for (int i = 0; i < n; i++) {       groups[i].id = i + 1;       cin >> groups[i].size >> groups[i].income;     }     int k;     cin >> k;     vector<table> tables(k);     for (int i = 0; i < k; i++) {       tables[i].id = i + 1;       cin >> tables[i].size;     }     sort(groups.begin(), groups.end(), byIncome);     sort(tables.begin(), tables.end(), bySize);     int sum = 0;     vector<pair<int, int> > v;     for (int i = 0; i < n; i++) {       group g = groups[i];       vector<table>::iterator t =           lower_bound(tables.begin(), tables.end(), g, canFit);       if (t == tables.end()) {         continue;       }       sum += g.income;       v.push_back(make_pair(g.id, t->id));       tables.erase(t);     }     cout << v.size() <<     << sum << endl;     for (int i = 0; i < v.size(); i++) {       cout << v[i].first <<     << v[i].second << endl;     }     return 0;   }   