func_code_string: #include <bits/stdc++.h>   using namespace std;   int a[40][40];   int f[40][40];   int main() {     int i, j, k, l, o, n, nn, best, ans, tot, sum, better, tmp;     scanf( %d , &n);     for (i = 0; i < n; i++)       for (j = 0; j < n; j++) scanf( %d , &a[i][j]);     nn = (n + 1) / 2;     ans = -2000000000;     for (i = 0; i < (1 << nn); i++) {       for (j = 0; j < nn; j++)         if (((1 << j) & i) == 0)           f[j][nn - 1] = 0;         else           f[j][nn - 1] = 1;       for (j = nn; j < n; j++)         f[j][nn - 1] = f[j - nn][nn - 1] ^ f[nn - 1][nn - 1];       tot = 0;       for (j = 0; j < nn - 1; j++) {         best = -2000000000;         for (k = 0; k < 2; k++) {           f[nn - 1][j] = k;           f[nn - 1][j + nn] = f[nn - 1][j] ^ f[nn - 1][nn - 1];           sum = 0;           for (l = 0; l < nn - 1; l++) {             better = -2000000000;             for (o = 0; o < 2; o++) {               f[l][j] = o;               f[l + nn][j] = f[l][j] ^ f[nn - 1][j];               f[l][j + nn] = f[l][j] ^ f[l][nn - 1];               f[l + nn][j + nn] = f[l + nn][j] ^ f[l + nn][nn - 1];               tmp = 0;               tmp += (f[l][j] == 0 ? a[l][j] : -a[l][j]);               tmp += (f[l + nn][j] == 0 ? a[l + nn][j] : -a[l + nn][j]);               tmp += (f[l][j + nn] == 0 ? a[l][j + nn] : -a[l][j + nn]);               tmp += (f[l + nn][j + nn] == 0 ? a[l + nn][j + nn]                                              : -a[l + nn][j + nn]);               if (tmp > better) better = tmp;             }             sum += better;           }           sum += (f[nn - 1][j] == 0 ? a[nn - 1][j] : -a[nn - 1][j]);           sum +=               (f[nn - 1][j + nn] == 0 ? a[nn - 1][j + nn] : -a[nn - 1][j + nn]);           if (sum > best) best = sum;         }         tot += best;       }       for (j = 0; j < n; j++)         tot += (f[j][nn - 1] == 0 ? a[j][nn - 1] : -a[j][nn - 1]);       if (tot > ans) ans = tot;     }     printf( %d n , ans);   }   