func_code_string: #include <bits/stdc++.h>   using namespace std;   int a[111111], b[111111];   vector<int> v;   long long t[555][555];   int main() {     int n;     cin >> n;     int r, c;     for (int i = 0; i < n; i++) {       for (int j = 0; j < n; j++) {         cin >> t[i][j];         if (t[i][j] == 0) {           r = i;           c = j;         }       }     }     if (n == 1) {       cout <<  1  << endl;       return 0;     }     long long sum = 0;     if (r == 0) {       for (int i = 0; i < n; i++) sum += t[1][i];     } else {       for (int i = 0; i < n; i++) sum += t[0][i];     }     long long lel = 0;     for (int i = 0; i < n; i++) {       lel += t[r][i];     }     if (lel >= sum) {       cout <<  -1 ;       return 0;     }     t[r][c] = sum - lel;     for (int i = 0; i < n; i++) {       long long cur = 0;       for (int j = 0; j < n; j++) {         cur += t[i][j];       }       if (cur != sum) {         cout <<  -1 ;         return 0;       }     }     for (int i = 0; i < n; i++) {       long long cur = 0;       for (int j = 0; j < n; j++) {         cur += t[j][i];       }       if (cur != sum) {         cout <<  -1 ;         return 0;       }     }     long long cur = 0;     for (int i = 0; i < n; i++) {       cur += t[i][i];     }     if (cur != sum) {       cout <<  -1 ;       return 0;     }     cur = 0;     for (int i = 0; i < n; i++) {       cur += t[i][n - 1 - i];     }     if (cur != sum) {       cout <<  -1 ;       return 0;     }     cout << t[r][c];     return 0;   }   