func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, m, x, ans, h[5010], a[5010][5010], b[5010][5010];   int main() {     scanf( %d , &n);     m = (n + 1) / 2;     for (int i = (1); i <= (n); i++) scanf( %d , &h[i]);     for (int i = (0); i <= (n); i++)       for (int j = (0); j <= (m); j++) a[i][j] = b[i][j] = 1000000000;     for (int i = (0); i <= (n); i++) b[i][0] = 0;     for (int i = (2); i <= (n + 1); i++)       for (int j = (1); j <= (m); j++) {         x = ((h[i] - h[i - 1] + 1) > (0) ? (h[i] - h[i - 1] + 1) : (0));         a[i][j] =             x +             ((((h[i - 3] - 1) < (h[i - 2]) ? (h[i - 3] - 1) : (h[i - 2])) -               h[i - 1] + 1) > (0)                  ? (((h[i - 3] - 1) < (h[i - 2]) ? (h[i - 3] - 1) : (h[i - 2])) -                     h[i - 1] + 1)                  : (0)) +             a[i - 2][j - 1];         a[i][j] =             ((a[i][j]) <                      (x +                       ((h[i - 2] - h[i - 1] + 1) > (0) ? (h[i - 2] - h[i - 1] + 1)                                                        : (0)) +                       b[i - 2][j - 1])                  ? (a[i][j])                  : (x +                     ((h[i - 2] - h[i - 1] + 1) > (0) ? (h[i - 2] - h[i - 1] + 1)                                                      : (0)) +                     b[i - 2][j - 1]));         b[i][j] = ((a[i - 1][j]) < (b[i - 1][j]) ? (a[i - 1][j]) : (b[i - 1][j]));       }     for (int i = (1); i <= (m); i++) {       ans = 1000000000;       for (int j = (1); j <= (n + 1); j++)         ans = ((ans) < (((a[j][i]) < (b[j][i]) ? (a[j][i]) : (b[j][i])))                    ? (ans)                    : (((a[j][i]) < (b[j][i]) ? (a[j][i]) : (b[j][i]))));       printf( %d  , ans);     }   }   