func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long inf = 1e18;   const int maxn = 3000 + 10;   int n, m, A[maxn], B[maxn];   long long f[maxn][maxn];   void init() {     scanf( %d , &n);     for (int i = 1; i <= n; ++i) {       scanf( %d , &A[i]);       A[i] -= i;       B[i] = A[i];     }   }   void solve() {     sort(B + 1, B + n + 1);     m = 1;     for (int i = 2; i <= n; ++i)       if (B[m] != B[i]) B[++m] = B[i];     for (int i = 1; i <= n; ++i)       for (int j = 0; j <= m; ++j) f[i][j] = inf;     for (int i = 1; i <= n; ++i)       for (int j = 1; j <= m; ++j)         f[i][j] = min(f[i][j - 1], f[i - 1][j] + abs(A[i] - B[j]));     long long ans = inf;     for (int i = 1; i <= m; ++i) ans = min(ans, f[n][i]);     printf( %I64d n , ans);   }   int main() {     init();     solve();     return 0;   }   