Language: C++

#include <stdio.h>

#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

using namespace std;

void __prlong long(long long x) { cerr << x; }
void __prlong long(long x) { cerr << x; }
void __prlong long(long long x) { cerr << x; }
void __prlong long(unsigned x) { cerr << x; }
void __prlong long(unsigned long x) { cerr << x; }
void __prlong long(unsigned long long x) { cerr << x; }
void __prlong long(float x) { cerr << x; }
void __prlong long(double x) { cerr << x; }
void __prlong long(long double x) { cerr << x; }
void __prlong long(char x) { cerr << '\'' << x << '\''; }
void __prlong long(const char *x) { cerr << '\"' << x << '\"'; }
void __prlong long(const string &x) { cerr << '\"' << x << '\"'; }
void __prlong long(bool x) { cerr << (x ? "true" : "false"); }

template <typename T, typename V>
void __prlong long(const pair<T, V> &x) {
    cerr << '{';
    __prlong long(x.first);
    cerr << ',';
    __prlong long(x.second);
    cerr << '}';
}
template <typename T>
void __prlong long(const T &x) {
    long long f = 0;
    cerr << '{';
    for (auto &i : x) cerr << (f++ ? "," : ""), __prlong long(i);
    cerr << "}";
}
void _prlong long() { cerr << "]\n"; }
template <typename T, typename... V>
void _prlong long(T t, V... v) {
    __prlong long(t);
    if (sizeof...(v)) cerr << ", ";
    _prlong long(v...);
}
#ifdef LOCAL
#define debug(x...)               \
    cerr << "[" << #x << "] = ["; \
    _prlong long(x)
#else
#define debug(x...)
#endif

long long return_min(vector<long long> dp, vector<long long> h, long long K, long long index) {
    long long tmp;
    long long min_val = 10001;
    for (long long hohaba = 1; hohaba <= K; hohaba++) {
        if (hohaba > index) {
            tmp = 10001;
        } else {
            tmp = dp[index - hohaba] + abs(h[index] - h[index - hohaba]);
        }
        if (min_val > tmp) {
            min_val = tmp;
        }
    }
    return min_val;
}

long long main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    long long N, K;
    cin >> N >> K;
    vector<long long> h(N);
    for (long long i = 0; i < N; i++) {
        long long tmp;
        cin >> tmp;
        h[i] = tmp;
    }

    vector<long long> dp(N);
    for (long long i = 1; i < N; i++) {
        // dp[i] = return_min(dp, h, K, i);
        long long tmp;
        long long min_val = 10001;
        for (long long hohaba = 1; hohaba <= K; hohaba++) {
            if (hohaba > i) {
                tmp = 10001;
            } else {
                tmp = dp[i - hohaba] + abs(h[i] - h[i - hohaba]);
            }
            if (min_val > tmp) {
                min_val = tmp;
            }
            dp[i] = min_val;
        }
    }
    cout << dp[N - 1] << endl;

    return 0;
}


Compiler output:
a.cc:13:15: error: expected initializer before 'long'
   13 | void __prlong long(long long x) { cerr << x; }
      |               ^~~~
a.cc:14:15: error: expected initializer before 'long'
   14 | void __prlong long(long x) { cerr << x; }
      |               ^~~~
a.cc:15:15: error: expected initializer before 'long'
   15 | void __prlong long(long long x) { cerr << x; }
      |               ^~~~
a.cc:16:15: error: expected initializer before 'long'
   16 | void __prlong long(unsigned x) { cerr << x; }
      |               ^~~~
a.cc:17:15: error: expected initializer before 'long'
   17 | void __prlong long(unsigned long x) { cerr << x; }
      |               ^~~~
a.cc:18:15: error: expected initializer before 'long'
   18 | void __prlong long(unsigned long long x) { cerr << x; }
      |               ^~~~
a.cc:19:15: error: expected initializer before 'long'
   19 | void __prlong long(float x) { cerr << x; }
      |               ^~~~
a.cc:20:15: error: expected initializer before 'long'
   20 | void __prlong long(double x) { cerr << x; }
      |               ^~~~
a.cc:21:15: error: expected initializer before 'long'
   21 | void __prlong long(long double x) { cerr << x; }
      |               ^~~~
a.cc:22:15: error: expected initializer before 'long'
   22 | void __prlong long(char x) { cerr << '\'' << x << '\''; }
      |               ^~~~
a.cc:23:15: error: expected initializer before 'long'
   23 | void __prlong long(const char *x) { cerr << '\"' << x << '\"'; }
      |               ^~~~
a.cc:24:15: error: expected initializer before 'long'
   24 | void __prlong long(const string &x) { cerr << '\"' << x << '\"'; }
      |               ^~~~
a.cc:25:15: error: expected initializer before 'long'
   25 | void __prlong long(bool x) { cerr << (x ? "true" : "false"); }
      |               ^~~~
a.cc:28:15: error: expected initializer before 'long'
   28 | void __prlong long(const pair<T, V> &x) {
      |               ^~~~
a.cc:36:15: error: expected initializer before 'long'
   36 | void __prlong long(const T &x) {
      |               ^~~~
a.cc:42:14: error: expected initializer before 'long'
   42 | void _prlong long() { cerr << "]\n"; }
      |              ^~~~
a.cc:44:14: error: expected initializer before 'long'
   44 | void _prlong long(T t, V... v) {
      |              ^~~~
cc1plus: error: '::main' must return 'int'