func_code_string: #include <bits/stdc++.h>   using namespace std;   const int inf = 0x7fffffff;   long long a[510][510], n;   int main() {     while (~scanf( %I64d , &n)) {       if (n == 1) {         scanf( %I64d , &n);         printf( 1 n );         continue;       }       for (int i = 1; i <= n; ++i) {         for (int j = 1; j <= n; ++j) scanf( %I64d , &a[i][j]);       }       int zr = 0, zc;       for (int i = 1; i <= n && !zr; ++i) {         for (int j = 1; j <= n && !zr; ++j) {           if (a[i][j] == 0) {             zr = i;             zc = j;           }         }       }       long long zv, sum = 0, zsum = 0;       for (int i = 1; i <= n; ++i) zsum += a[zr][i];       if (zr == 1) {         for (int i = 1; i <= n; ++i) sum += a[n][i];         zv = sum - zsum;       } else {         for (int i = 1; i <= n; ++i) sum += a[1][i];         zv = sum - zsum;       }       if (zv <= 0) {         printf( -1 n );         continue;       }       a[zr][zc] = zv;       bool ok = true;       for (int i = 1; i <= n; ++i) {         long long tmpsum = 0;         for (int j = 1; j <= n; ++j) tmpsum += a[i][j];         if (tmpsum != sum) {           ok = false;           break;         }         tmpsum = 0;         for (int j = 1; j <= n; ++j) tmpsum += a[j][i];         if (tmpsum != sum) {           ok = false;           break;         }       }       long long tmpsum = 0;       for (int i = 1; i <= n; ++i) tmpsum += a[i][i];       if (tmpsum != sum) ok = false;       tmpsum = 0;       for (int i = n; i >= 1; --i) tmpsum += a[i][n + 1 - i];       if (tmpsum != sum) ok = false;       if (ok) {         printf( %I64d n , zv);       } else         printf( -1 n );     }     return 0;   }   