func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 4005;   int n, a[N], sum[N], f[50000005];   int h(int l, int r, int k, int now) {     return ((((l * 4000) + r) * 100 + k) * 2 + now) % 50000000;   }   int dfs(int l, int r, int k, int now) {     if (r - l + 1 < k) return 0;     if (r - l + 1 == k) {       if (now == 0)         return sum[r] - sum[l - 1];       else         return sum[l - 1] - sum[r];     }     if (f[h(l, r, k, now)] != -0x3f3f3f3f) {       return f[h(l, r, k, now)];     }     if (now == 0) {       int count = dfs(l + k, r, k, 1) + sum[l + k - 1] - sum[l - 1];       if (l + k <= r)         count =             max(count, dfs(l + k + 1, r, k + 1, 1) + (sum[l + k] - sum[l - 1]));       f[h(l, r, k, now)] = count;       return count;     } else if (now == 1) {       int count = dfs(l, r - k, k, 0) - (sum[r] - sum[r - k]);       if (l + k <= r)         count =             min(count, dfs(l, r - k - 1, k + 1, 0) - (sum[r] - sum[r - k - 1]));       f[h(l, r, k, now)] = count;       return count;     }   }   signed main() {     cin >> n;     for (register int i = 1; i <= n; i++) cin >> a[i];     for (register int i = 1; i <= n; i++) sum[i] = sum[i - 1] + a[i];     for (register int i = 1; i <= 50000000; i++) f[i] = -0x3f3f3f3f;     cout << dfs(1, n, 1, 0);     return 0;   }   