func_code_string: #include <bits/stdc++.h>   using namespace std;   const int INF = 0x3f3f3f3f;   int h[5005];   int dp[5005][2505][2];   void test_case() {     int n;     scanf( %d , &n);     for (int i = 1; i <= n; ++i) scanf( %d , &h[i]);     memset(dp, INF, sizeof(dp));     dp[0][0][0] = 0;     dp[1][0][0] = 0;     dp[1][1][1] = 0;     for (int i = 2; i <= n; ++i) {       for (int j = 0, c = (i + 1) / 2; j <= c; ++j)         dp[i][j][0] =             min(dp[i - 1][j][0], dp[i - 1][j][1] + max(0, h[i] - (h[i - 1] - 1)));       for (int j = 1, c = (i + 1) / 2; j <= c; ++j)         dp[i][j][1] = min(             dp[i - 2][j - 1][0] + max(0, h[i - 1] - (h[i] - 1)),             dp[i - 2][j - 1][1] +                 max(0, max(h[i - 1] - (h[i] - 1), h[i - 1] - (h[i - 2] - 1))));     }     for (int k = 1, c = (n + 1) / 2; k <= c; ++k)       printf( %d%c , min(dp[n][k][0], dp[n][k][1]),    n [k == c]);   }   int main() {     int t = 1;     for (int ti = 1; ti <= t; ++ti) {       test_case();     }   }   