func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long oo = 1e18;   struct Data {     long long v;     int x, y;     Data() {}     Data(long long tv, int tx, int ty) {       v = tv;       x = tx;       y = ty;     }   };   int a[2010], b[2010];   Data mp1[4000010], mp2[4000010];   long long gabs(long long x) { return x < 0 ? -x : x; }   bool operator<(Data a, Data b) { return a.v < b.v; }   int main() {     int n;     scanf( %d , &n);     long long sa = 0;     for (int i = 1; i <= n; i++) {       scanf( %d , &a[i]);       sa += a[i];     }     int m;     scanf( %d , &m);     long long sb = 0;     for (int i = 1; i <= m; i++) {       scanf( %d , &b[i]);       sb += b[i];     }     long long t0 = gabs(sa - sb);     long long t1 = oo;     int tx, ty;     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++)         if (gabs(sa - sb - 2ll * (a[i] - b[j])) < t1) {           t1 = gabs(sa - sb - 2ll * (a[i] - b[j]));           tx = i;           ty = j;         }     if (n == 1 || m == 1) {       if (t0 <= t1)         printf( %lld n0 n , t0);       else         printf( %lld n1 n%d %d n , t1, tx, ty);       return 0;     }     long long t2 = oo;     int tx1, ty1, tx2, ty2;     int tot;     for (int i = 1; i < m; i++)       for (int j = i + 1; j <= m; j++) {         mp1[++tot] = Data(2ll * (b[i] + b[j]), i, j);         mp2[tot] = Data(-2ll * (b[i] + b[j]), i, j);       }     sort(mp1 + 1, mp1 + tot + 1);     sort(mp2 + 1, mp2 + tot + 1);     for (int i = 1; i < n; i++)       for (int j = i + 1; j <= n; j++) {         Data tmp1 =             *lower_bound(mp1 + 1, mp1 + tot + 1,                          Data(-(sa - sb - 2ll * a[i] - 2ll * a[j]), 0, 0));         int pl1 = lower_bound(mp1 + 1, mp1 + tot + 1,                               Data(-(sa - sb - 2ll * a[i] - 2ll * a[j]), 0, 0)) -                   mp1;         Data tmp2 = *lower_bound(mp2 + 1, mp2 + tot + 1,                                  Data(sa - sb - 2ll * a[i] - 2ll * a[j], 0, 0));         int pl2 = lower_bound(mp2 + 1, mp2 + tot + 1,                               Data(sa - sb - 2ll * a[i] - 2ll * a[j], 0, 0)) -                   mp2;         tmp2.v = -tmp2.v;         Data tmp;         if (pl1 <= tot && gabs(sa - sb - 2ll * a[i] - 2ll * a[j] + tmp1.v) < t2) {           t2 = gabs(sa - sb - 2ll * a[i] - 2ll * a[j] + tmp1.v);           tx1 = i;           tx2 = j;           ty1 = tmp1.x;           ty2 = tmp1.y;         }         if (pl2 <= tot && gabs(sa - sb - 2ll * a[i] - 2ll * a[j] + tmp2.v) < t2) {           t2 = gabs(sa - sb - 2ll * a[i] - 2ll * a[j] + tmp2.v);           tx1 = i;           tx2 = j;           ty1 = tmp2.x;           ty2 = tmp2.y;         }       }     if (t0 <= t1 && t0 <= t2)       printf( %lld n0 n , t0);     else if (t1 <= t2)       printf( %lld n1 n%d %d n , t1, tx, ty);     else       printf( %lld n2 n%d %d n%d %d n , t2, tx1, ty1, tx2, ty2);     return 0;   }   