Language: C++

int main()
{
    ll n, k;
    cin >> n >> k;
    vector<ll> h(n, 0);
    vector<ll> dp(n, numeric_limits<ll>::max());
    for (ll i = 0; (i < n); ++i) {
        cin >> h[i];
    }
    dp[0] = 0;
    for (ll i = 1; (i < n); ++i) {
        for (ll j = 1; (j <= k); ++j) {
            ll prev = i - j;
            if (prev < 0) continue;
            dp[i] = min(dp[i], dp[prev] + abs(h[i] - h[prev]));
        }
    }
    cout << dp[n-1] << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:3:5: error: 'll' was not declared in this scope
    3 |     ll n, k;
      |     ^~
a.cc:4:5: error: 'cin' was not declared in this scope
    4 |     cin >> n >> k;
      |     ^~~
a.cc:4:12: error: 'n' was not declared in this scope
    4 |     cin >> n >> k;
      |            ^
a.cc:4:17: error: 'k' was not declared in this scope
    4 |     cin >> n >> k;
      |                 ^
a.cc:5:5: error: 'vector' was not declared in this scope
    5 |     vector<ll> h(n, 0);
      |     ^~~~~~
a.cc:5:16: error: 'h' was not declared in this scope
    5 |     vector<ll> h(n, 0);
      |                ^
a.cc:6:22: error: 'numeric_limits' was not declared in this scope
    6 |     vector<ll> dp(n, numeric_limits<ll>::max());
      |                      ^~~~~~~~~~~~~~
a.cc:6:42: error: '::max' has not been declared
    6 |     vector<ll> dp(n, numeric_limits<ll>::max());
      |                                          ^~~
a.cc:6:16: error: 'dp' was not declared in this scope
    6 |     vector<ll> dp(n, numeric_limits<ll>::max());
      |                ^~
a.cc:7:12: error: expected ';' before 'i'
    7 |     for (ll i = 0; (i < n); ++i) {
      |            ^~
      |            ;
a.cc:7:21: error: 'i' was not declared in this scope
    7 |     for (ll i = 0; (i < n); ++i) {
      |                     ^
a.cc:11:12: error: expected ';' before 'i'
   11 |     for (ll i = 1; (i < n); ++i) {
      |            ^~
      |            ;
a.cc:11:21: error: 'i' was not declared in this scope
   11 |     for (ll i = 1; (i < n); ++i) {
      |                     ^
a.cc:12:16: error: expected ';' before 'j'
   12 |         for (ll j = 1; (j <= k); ++j) {
      |                ^~
      |                ;
a.cc:12:25: error: 'j' was not declared in this scope
   12 |         for (ll j = 1; (j <= k); ++j) {
      |                         ^
a.cc:13:15: error: expected ';' before 'prev'
   13 |             ll prev = i - j;
      |               ^~~~~
      |               ;
a.cc:14:17: error: 'prev' was not declared in this scope
   14 |             if (prev < 0) continue;
      |                 ^~~~
a.cc:15:35: error: 'prev' was not declared in this scope
   15 |             dp[i] = min(dp[i], dp[prev] + abs(h[i] - h[prev]));
      |                                   ^~~~
a.cc:15:43: error: 'abs' was not declared in this scope
   15 |             dp[i] = min(dp[i], dp[prev] + abs(h[i] - h[prev]));
      |                                           ^~~
a.cc:15:21: error: 'min' was not declared in this scope; did you mean 'main'?
   15 |             dp[i] = min(dp[i], dp[prev] + abs(h[i] - h[prev]));
      |                     ^~~
      |                     main
a.cc:18:5: error: 'cout' was not declared in this scope
   18 |     cout << dp[n-1] << endl;
      |     ^~~~
a.cc:18:24: error: 'endl' was not declared in this scope
   18 |     cout << dp[n-1] << endl;
      |                        ^~~~