func_code_string: #include <bits/stdc++.h>   using namespace std;   void solve() {     int n;     cin >> n;     int arr[n * n + 1], cnt[1001] = {0}, a[n + 1][n + 1];     vector<int> q4, q2, q1;     for (int i = 1; i <= n * n; i++) {       cin >> arr[i];       cnt[arr[i]]++;     }     for (int i = 1; i <= n * n; i++) {       int d = cnt[arr[i]];       for (int j = 1; j <= d / 4; j++) q4.push_back(arr[i]);       d %= 4;       for (int j = 1; j <= d / 2; j++) q2.push_back(arr[i]);       d %= 2;       if (d == 1) q1.push_back(arr[i]);       cnt[arr[i]] = 0;     }     if (n % 2 == 0) {       if (q2.size() || q1.size()) {         cout <<  NO ;         return;       }       cout <<  YES n ;       for (int i = 1; i <= n / 2; i++)         for (int j = 1; j <= n / 2; j++) {           int d = q4.back();           q4.pop_back();           a[i][j] = d;           a[i][n - j + 1] = d;           a[n - i + 1][j] = d;           a[n - i + 1][n - j + 1] = d;         }       for (int i = 1; i <= n; i++) {         for (int j = 1; j <= n; j++) cout << a[i][j] <<    ;         cout << endl;       }       return;     }     if (q1.size() != 1 || q4.size() < (n / 2) * (n / 2)) {       cout <<  NO ;       return;     }     cout <<  YES n ;     for (int i = 1; i <= n / 2; i++)       for (int j = 1; j <= n / 2; j++) {         int d = q4.back();         q4.pop_back();         a[i][j] = d;         a[i][n - j + 1] = d;         a[n - i + 1][j] = d;         a[n - i + 1][n - j + 1] = d;       }     while (q4.size()) {       int d = q4.back();       q2.push_back(d);       q2.push_back(d);       q4.pop_back();     }     for (int i = 1; i <= n / 2; i++) {       int d = q2.back();       q2.pop_back();       a[n / 2 + 1][i] = d;       a[n / 2 + 1][n + 1 - i] = d;       d = q2.back();       q2.pop_back();       a[i][n / 2 + 1] = d;       a[n + 1 - i][n / 2 + 1] = d;     }     a[n / 2 + 1][n / 2 + 1] = q1[0];     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= n; j++) cout << a[i][j] <<    ;       cout << endl;     }     return;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     solve();   }   