func_code_string: #include <bits/stdc++.h>   using namespace std;   void err(istream_iterator<string> it) {}   template <typename T, typename... Args>   void err(istream_iterator<string> it, T a, Args... args) {     cerr << *it <<   =   << a <<   n ;     err(++it, args...);   }   template <class T1, class T2>   ostream &operator<<(ostream &os, const pair<T1, T2> &a) {     return os <<  (  << a.first <<  ,   << a.second <<  ) ;   }   template <class T>   ostream &operator<<(ostream &os, const vector<T> &a) {     os <<  [ ;     for (unsigned long long i = 0; i < a.size(); i++)       os << a[i] << (i < a.size() - 1 ?  ,   :   );     os <<  ] ;     return os;   }   template <class T>   ostream &operator<<(ostream &os, const set<T> &a) {     os <<  { ;     for (typename set<T>::iterator it = a.begin(); it != a.end(); it++) {       typename set<T>::iterator jt = it;       os << *it << (++jt != a.end() ?  ,   :   );     }     os <<  } ;     return os;   }   template <class T1, class T2>   ostream &operator<<(ostream &os, map<T1, T2> &a) {     os <<  { n ;     for (typename map<T1, T2>::iterator it = a.begin(); it != a.end(); it++) {       typename map<T1, T2>::iterator jt = it;       os <<      << it->first <<  :   << it->second          << (++jt != a.end() ?  , n  :   n );     }     os <<  } ;     return os;   }   long long n, m;   long long a[2005];   long long dp[2005][2];   bool check(long long lim) {     memset(dp, 127, sizeof(dp));     dp[0][0] = dp[0][1] = 0;     for (long long i = 1; i <= n; i++) {       dp[i][0] = min(dp[i - 1][0], dp[i - 1][1]) + 1;       dp[i][1] = min(dp[i][1], i - 1);       for (long long j = 1; j < i; j++) {         long long diff = abs(a[i] - a[j]);         if (diff > lim * (i - j)) continue;         dp[i][1] = min(dp[i][1], dp[j][1] + (i - j - 1));       }     }     if (min(dp[n][0], dp[n][1]) <= m) return true;     return false;   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cin >> n >> m;     for (long long i = 1; i <= n; i++) cin >> a[i];     long long l = 0, r = 2e9;     while (l != r) {       long long mid = (l + r) / 2;       if (check(mid))         r = mid;       else         l = mid + 1;     }     cout << l <<   n ;   }   