func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, x;   bool X[26];   int mat[6][6];   int niz[26];   int sum;   bool check() {     sum = 0;     for (int i = 0; i < n; i++) sum += mat[i][0];     for (int j = 1; j < n; j++) {       int st = 0;       for (int i = 0; i < n; i++) st += mat[i][j];       if (st != sum) return false;     }     for (int i = 0; i < n; i++) {       int st = 0;       for (int j = 0; j < n; j++) st += mat[i][j];       if (st != sum) return false;     }     int sz = 0;     for (int i = 0; i < n; i++) {       sz += mat[i][i];     }     if (sz != sum) return false;     sz = 0;     for (int i = 0; i < n; i++) {       sz += mat[i][n - i - 1];     }     if (sz != sum) return false;     return true;   }   vector<pair<int, int> > pos;   vector<int> vals;   int empty_cnt = 0;   int main() {     scanf( %d , &n);     for (int i = 0; i < n * n; i++) {       scanf( %d , &niz[i]);       vals.push_back(i);       pos.push_back(make_pair(i / n, i % n));     }     do {       for (int i = 0; i < pos.size(); i++) {         mat[pos[i].first][pos[i].second] = niz[vals[i]];       }       if (check()) {         break;       }     } while (next_permutation(vals.begin(), vals.end()));     printf( %d n , sum);     for (int i = 0; i < n; i++) {       for (int j = 0; j < n; j++) {         printf( %d  , mat[i][j]);       }       printf(  n );     }     return 0;   }   