func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long N = 2e3 + 10, INF = 1e9 + 10;   long long dp[N][2], a[N], n, k;   inline bool check(long long x) {     for (long long i = 1; i <= n; i++) dp[i][0] = i - 1;     for (long long i = 1; i <= n; i++)       for (long long j = i - 1; j; --j) {         if (a[i] + (i - j) * x < a[j] || a[i] - (i - j) * x > a[j]) continue;         dp[i][0] = min(dp[i][0], dp[j][0] + i - j - 1);       }     for (long long i = n; i; i--) dp[i][1] = n - i;     for (long long i = n; i; i--)       for (long long j = i + 1; j <= n; ++j) {         if (a[i] + (j - i) * x < a[j] || a[i] - (j - i) * x > a[j]) continue;         dp[i][1] = min(dp[i][1], dp[j][1] + j - i - 1);       }     for (long long i = 1; i <= n; i++)       if (dp[i][0] + dp[i][1] <= k) return 1;     return 0;   }   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cin >> n >> k;     if (k == n) return cout <<  0 , 0;     for (long long i = 1; i <= n; i++) cin >> a[i];     long long lo = 0, hi = 2e9 + 5;     while (hi - lo > 0) {       long long mid = (hi + lo) / 2;       if (check(mid))         hi = mid;       else         lo = mid + 1;     }     cout << lo;     return 0;   }   