func_code_string: #include <bits/stdc++.h>   using namespace std;   int a[1000006], g[1000006];   char str[1000006];   int sum1 = 0, sum2 = 0;   int main() {     int n, i;     scanf(  %d , &n);     for (i = 0; i < n; i++) {       scanf(  %d %d , &a[i], &g[i]);     }     for (i = 0; i < n; i++) {       int c = sum2 - (sum1 + a[i]);       int d = sum1 - (sum2 + g[i]);       if (c < 0) c = -c;       if (d < 0) d = -d;       if (c < d) {         str[i] =  A ;         sum1 = sum1 + a[i];       } else {         str[i] =  G ;         sum2 = sum2 + g[i];       }     }     str[i] =   n ;     printf( %s n , str);     return 0;   }   