func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int n, k, sumk;     cin >> n >> k;     k--;     int out[500][500];     sumk = 0;     int current = n * n;     for (int i = 0; i < n; ++i) {       for (int j = n - 1; j >= k; --j) {         out[i][j] = current;         if (j == k) {           sumk += current;         }         current--;       }     }     for (int i = 0; i < n; ++i) {       for (int j = k - 1; j >= 0; --j) {         out[i][j] = current;         current--;       }     }     cout << sumk << endl;     for (int i = 0; i < n; ++i) {       for (int j = 0; j < n; ++j) {         cout << out[i][j] <<    ;       }       cout << endl;     }     return 0;   }   