func_code_string: #include <bits/stdc++.h>   using namespace std;   long long a[3000], b[3000];   map<long long, pair<long long, long long> > mymap;   pair<long long, long long> p1, p2;   int main() {     std::ios::sync_with_stdio(false);     long long n, m, sa = 0, sb = 0;     p1.first = p1.second = p2.first = p2.second = -1;     mymap.clear();     cin >> n;     for (long long i = (long long)(1); i <= (long long)(n); i++) {       cin >> a[i];       sa += a[i];     }     cin >> m;     for (long long i = (long long)(1); i <= (long long)(m); i++) {       cin >> b[i];       sb += b[i];     }     long long curdiff = abs(sa - sb);     for (long long i = (long long)(1); i <= (long long)(n); i++) {       for (long long j = (long long)(1); j <= (long long)(m); j++) {         long long tmpsa, tmpsb;         tmpsa = sa - a[i] + b[j];         tmpsb = sb + a[i] - b[j];         if (abs(tmpsa - tmpsb) < curdiff) {           curdiff = abs(tmpsa - tmpsb);           p1.first = i;           p1.second = j;         }       }     }     for (long long i = (long long)(1); i <= (long long)(n - 1); i++) {       for (long long j = (long long)(i + 1); j <= (long long)(n); j++) {         long long val = a[i] + a[j];         val = val * 2ll;         mymap[val] = make_pair(i, j);       }     }     map<long long, pair<long long, long long> >::iterator it;     for (long long i = (long long)(1); i <= (long long)(m - 1); i++) {       for (long long j = (long long)(i + 1); j <= (long long)(m); j++) {         long long val = sa - sb + 2 * (b[i] + b[j]);         it = mymap.lower_bound(val);         if (it != mymap.begin()) it--;         if (it == mymap.end()) continue;         long long temp = val;         temp = abs(val - it->first);         if (temp < curdiff) {           curdiff = temp;           p1.first = (it->second).first;           p1.second = i;           p2.first = (it->second).second;           p2.second = j;         }         it++;         if (it != mymap.end()) {           temp = abs(val - it->first);           if (temp < curdiff) {             curdiff = temp;             p1.first = (it->second).first;             p1.second = i;             p2.first = (it->second).second;             p2.second = j;           }         }       }     }     cout << curdiff << endl;     if (p2.first != -1) {       cout <<  2  << endl;       cout << p1.first <<     << p1.second << endl;       cout << p2.first <<     << p2.second << endl;     } else if (p1.first != -1) {       cout <<  1  << endl;       cout << p1.first <<     << p1.second << endl;     } else {       cout <<  0  << endl;     }     return 0;   }   