func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 5010;   int n, k;   int a[N];   int dp[N][N / 2][2];   int solve(int r, int num, int sub) {     if (num == 0) return 0;     int& res = dp[r][num][sub];     if (res != 1000000000) return res;     if (sub == 1) {       res = solve(r - 2, num - 1, (a[r - 1] < a[r] ? 0 : 1)) +             (a[r - 1] < a[r] ? 0 : (a[r - 1] - a[r] + 1)) +             (a[r + 2] - 1 < a[r] ? 0 : (a[r + 2] - 1 - a[r] + 1));       if (num * 2 <= r) {         res = min(res, solve(r - 1, num, 0));       }     } else {       res = solve(r - 2, num - 1, (a[r - 1] < a[r] ? 0 : 1)) +             (a[r - 1] < a[r] ? 0 : (a[r - 1] - a[r] + 1)) +             (a[r + 1] < a[r] ? 0 : (a[r + 1] - a[r] + 1));       if (num * 2 <= r) {         res = min(solve(r - 1, num, 0), res);       }     }     return res;   }   int main() {     ios::sync_with_stdio(false);     cin >> n;     k = (n + 1) / 2;     for (int i = 0; i < n; i++) {       cin >> a[i + 1];     }     a[0] = -100;     a[n + 1] = -100;     for (int i = 0; i < N; i++) {       for (int j = 0; j < N / 2; j++) {         for (int k = 0; k < 2; k++) {           dp[i][j][k] = 1000000000;         }       }     }     cout << solve(n, 1, 0);     for (int i = 2; i < k + 1; i++) {       cout <<     << solve(n, i, 0);     }     return 0;   }   