func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 305;   int n;   int f[N][N], dp[2][N][N];   int main() {     std::ios::sync_with_stdio(false);     cin >> n;     for (int i = 0; i < n; ++i) {       for (int j = 0; j < n; ++j) {         cin >> f[i][j];       }     }     memset(dp, -1, sizeof(dp));     dp[0][0][0] = f[0][0];     for (int d = 1; d < 2 * n; ++d) {       for (int i = 0; i < n; ++i) {         for (int j = 0; j < n; ++j) {           int x1 = i, y1 = d - i;           int x2 = j, y2 = d - j;           if (y1 < 0 || y2 < 0 || y1 > n - 1 || y2 > n - 1) continue;           int add;           if (x1 == x2 && y1 == y2)             add = f[x1][y1];           else             add = f[x1][y1] + f[x2][y2];           int &res = dp[d % 2][x1][x2] = -1000 * 1000 * 1000;           if (x1 > 0 && x2 > 0)             res = max(res, dp[(d - 1) % 2][x1 - 1][x2 - 1] + add);           if (x1 > 0 && y2 > 0) res = max(res, dp[(d - 1) % 2][x1 - 1][x2] + add);           if (y1 > 0 && y2 > 0) res = max(res, dp[(d - 1) % 2][x1][x2] + add);           if (y1 > 0 && x2 > 0) res = max(res, dp[(d - 1) % 2][x1][x2 - 1] + add);         }       }     }     cout << dp[(2 * n - 2) % 2][n - 1][n - 1] << endl;     return 0;   }   