func_code_string: #include <bits/stdc++.h>   using namespace std;   const int INF = 0x3f3f3f3f, N = 5050;   int dp[N][N / 2][2], a[N];   int main() {     int n;     scanf( %d , &n), a[0] = a[n + 1] = -INF;     for (int i = 1; i <= n; i++) scanf( %d , a + i);     memset(dp, INF, sizeof dp);     for (int i = 1; i <= n; i++) dp[i][0][0] = 0;     dp[1][1][1] = (a[1] > a[2]) ? 0 : a[2] - a[1] + 1;     dp[2][1][1] = max(0, a[1] - a[2] + 1) + max(0, a[3] - a[2] + 1),     dp[2][1][0] = dp[1][1][1];     for (int i = 3; i <= n; i++)       for (int j = 1; j <= (i + 1) / 2; j++) {         dp[i][j][0] = min(dp[i - 1][j][0], dp[i - 1][j][1]);         dp[i][j][1] = min(dp[i - 2][j - 1][0] + max(0, a[i - 1] - a[i] + 1),                           dp[i - 2][j - 1][1] +                               max(0, min(a[i - 2] - a[i], a[i - 1] - a[i] + 1))) +                       max(0, (a[i + 1] - a[i] + 1));       }     for (int i = 1; i <= (n + 1) / 2; i++)       printf( %d  , min(dp[n][i][0], dp[n][i][1]));     return 0;   }   