func_code_string: #include <bits/stdc++.h>   using namespace std;   const int fx[8] = {0, -1, -1, -1, 0, 1, 1, 1};   const int fy[8] = {1, 1, 0, -1, -1, -1, 0, 1};   const int maxn = 310;   int vis[maxn][maxn][8][30];   int v[maxn][maxn];   int step[40];   queue<pair<int, int> > q;   pair<int, int> mkstate(int x, int y, int d, int t) {     return make_pair(x * 10000 + y, d * 10000 + t);   }   int main() {     int n;     cin >> n;     for (int i = 0; i < n; i++) cin >> step[i];     while (!q.empty()) q.pop();     q.push(mkstate(155, 155, 0, 0));     vis[155][155][0][0] = true;     while (!q.empty()) {       pair<int, int> t = q.front();       q.pop();       int x = t.first / 10000;       int y = t.first % 10000;       int d = t.second / 10000;       int th = t.second % 10000;       for (int i = 0; i < step[th]; i++) {         v[x + fx[d] * i][y + fy[d] * i] = 1;       }       int nx = x + fx[d] * (step[th] - 1);       int ny = y + fy[d] * (step[th] - 1);       int d1 = (d + 1) % 8;       int x1 = nx + fx[d1];       int y1 = ny + fy[d1];       int d2 = (d - 1 + 8) % 8;       int x2 = nx + fx[d2];       int y2 = ny + fy[d2];       pair<int, int> t1 = mkstate(x1, y1, d1, th + 1);       pair<int, int> t2 = mkstate(x2, y2, d2, th + 1);       if (th + 1 < n && !vis[x1][y1][d1][th + 1]) {         q.push(t1);         vis[x1][y1][d1][th + 1] = true;       }       if (th + 1 < n && !vis[x2][y2][d2][th + 1]) {         q.push(t2);         vis[x2][y2][d2][th + 1] = true;       }     }     int ans = 0;     for (int i = 0; i < maxn; i++) {       for (int j = 0; j < maxn; j++) {         if (v[i][j]) ans++;       }     }     cout << ans;     return 0;   }   