func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 1e6 + 7;   const int inf = INT_MAX;   const long long inff = 1e18;   const long long mod = 1e9 + 7;   vector<int> dx = {0, 1, 1, 1, 0, -1, -1, -1};   vector<int> dy = {1, 1, 0, -1, -1, -1, 0, 1};   int can[507][507];   set<pair<int, int> > second[32][9];   int32_t main() {     ios::sync_with_stdio(0);     cin.tie(0);     int n;     int a[35];     cin >> n;     for (int i = 1; i <= n; i++) cin >> a[i];     for (int j = 250; j <= 250 + a[1] - 1; j++) can[250][j] = 1;     second[1][0].insert(make_pair(250, 250 + a[1] - 1));     for (int i = 1; i < n; i++) {       for (int j = 0; j < 8; j++) {         for (pair<int, int> k : second[i][j]) {           for (int l = 1; l <= a[i + 1]; l++) {             can[k.first + dx[(j + 1) % 8] * l][k.second + dy[(j + 1) % 8] * l] =                 1;             can[k.first + dx[(j + 7) % 8] * l][k.second + dy[(j + 7) % 8] * l] =                 1;           }           second[i + 1][(j + 1) % 8].insert(               make_pair(k.first + dx[(j + 1) % 8] * a[i + 1],                         k.second + dy[(j + 1) % 8] * a[i + 1]));           second[i + 1][(j + 7) % 8].insert(               make_pair(k.first + dx[(j + 7) % 8] * a[i + 1],                         k.second + dy[(j + 7) % 8] * a[i + 1]));         }       }     }     int ans = 0;     for (int i = 0; i <= 500; i++)       for (int j = 0; j <= 500; j++) ans += can[i][j];     cout << ans <<   n ;   }   