criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <bits/stdc++.h>
#include <cmath>
using namespace std;

int main() {
  const long long INF = 1LL << 60;
  int N,K,M;
  cin>>N>>K;
  vector<int> high(N);
  for(int i=0;i<N;i++){
    cin>>high.at(i);
  }
  
  vector<int> cost(N);
  cost.at(0)=0;
  cost.at(1)=abs(high.at(1)-high.at(0));
    for(int i=2;i<N;i++){
      
      for(int j=1;j<=min(i,K);j++){
        INF=min(INF,cost.at(i-j)+abs(high.at(i)-high.at(i-j)));
      }
      cost.at(i)=INF;
    }
  
  cout<<cost.at(N-1);
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:16: error: no matching function for call to 'min(const long long int&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type)'
   20 |         INF=min(INF,cost.at(i-j)+abs(high.at(i)-high.at(i-j)));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:20:16: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   20 |         INF=min(INF,cost.at(i-j)+abs(high.at(i)-high.at(i-j)));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:20:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   20 |         INF=min(INF,cost.at(i-j)+abs(high.at(i)-high.at(i-j)));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:22:18: warning: overflow in conversion from 'long long int' to '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} changes value from '1152921504606846976' to '0' [-Woverflow]
   22 |       cost.at(i)=INF;
      |                  ^~~
Language: C++

#include <iostream>
#include <cstring>

using namespace std;

const int cap = 1e5 + 1;
int N, K;
int H[cap], dp[cap];

int main() {
    scanf("%d %d", &N, &K);
    for (int i = 1; i <= N; ++i)
        scanf(" %d", &H[i]);
    fill(dp, dp + N + 1, INT_MAX);
    dp[1] = 0;
    for (int i = 1; i < N; ++i) {
        for (int j = i + 1; j <= min(i + K, N); ++j)
            dp[j] = min(dp[j], dp[i] + abs(H[i] - H[j]));
    }
    printf("%d\n", dp[N]);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:26: error: 'INT_MAX' was not declared in this scope
   14 |     fill(dp, dp + N + 1, INT_MAX);
      |                          ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <cstring>
  +++ |+#include <climits>
    3 |
Language: C++

int main()
{
    int no_of_stones, no_of_steps;
    cin >> no_of_stones >> no_of_steps;

    vector <int> height(no_of_stones + 1, 0);
    for(int i = 1; i <= no_of_stones; i++)
        cin >> height[i];

    const int oo = 1e9;
    vector <int> minimum_cost(no_of_stones + 1, oo);
    minimum_cost[1] = 0;

    for(int i = 2; i <= no_of_stones; i++)
    {
        for(int j = i - 1; j >= max(1, i - no_of_steps); j--)
        {
            minimum_cost[i] = min(minimum_cost[i], minimum_cost[j] + abs(height[i] - height[j]));
        }
    }

    cout << minimum_cost[no_of_stones];
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:5: error: 'cin' was not declared in this scope
    4 |     cin >> no_of_stones >> no_of_steps;
      |     ^~~
a.cc:6:5: error: 'vector' was not declared in this scope
    6 |     vector <int> height(no_of_stones + 1, 0);
      |     ^~~~~~
a.cc:6:13: error: expected primary-expression before 'int'
    6 |     vector <int> height(no_of_stones + 1, 0);
      |             ^~~
a.cc:8:16: error: 'height' was not declared in this scope
    8 |         cin >> height[i];
      |                ^~~~~~
a.cc:11:13: error: expected primary-expression before 'int'
   11 |     vector <int> minimum_cost(no_of_stones + 1, oo);
      |             ^~~
a.cc:12:5: error: 'minimum_cost' was not declared in this scope
   12 |     minimum_cost[1] = 0;
      |     ^~~~~~~~~~~~
a.cc:16:33: error: 'max' was not declared in this scope
   16 |         for(int j = i - 1; j >= max(1, i - no_of_steps); j--)
      |                                 ^~~
a.cc:18:74: error: 'height' was not declared in this scope
   18 |             minimum_cost[i] = min(minimum_cost[i], minimum_cost[j] + abs(height[i] - height[j]));
      |                                                                          ^~~~~~
a.cc:18:70: error: 'abs' was not declared in this scope
   18 |             minimum_cost[i] = min(minimum_cost[i], minimum_cost[j] + abs(height[i] - height[j]));
      |                                                                      ^~~
a.cc:18:31: error: 'min' was not declared in this scope; did you mean 'main'?
   18 |             minimum_cost[i] = min(minimum_cost[i], minimum_cost[j] + abs(height[i] - height[j]));
      |                               ^~~
      |                               main
a.cc:22:5: error: 'cout' was not declared in this scope
   22 |     cout << minimum_cost[no_of_stones];
      |     ^~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main()
{
  int N, K;
  vector<int> h;
  cin >> N >> K;

  for(int i = 0; i < N; i++)
  {
    int he;
    cin >> he;
    h.push_back(he);
  }

  vector<int> dp(N, 0);
  //dp[1] = abs(h[0] - h[1]);

  for(int i = 1; i < N; i++)
  {
    	int min_val = INT_MAX;
      for(int j = 1; j <= K; j++)
      {
        if(i - j >= 0)
        	min_val = min(min_val, dp[i-j] + abs(h[i] - h[i-j]);
      }
      dp[i] = min_val;
  }

  cout << dp[N-1] << '\n';

  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:27:68: error: expected ')' before ';' token
   27 |                 min_val = min(min_val, dp[i-j] + abs(h[i] - h[i-j]);
      |                              ~                                     ^
      |                                                                    )
Language: Java

import me.nettee.algorithm.interval.Interval;

import java.util.Arrays;
import java.util.Scanner;

public class Main {

    private static int frog1(int N, int K, int[] h) {
        // subproblem:
        // f(j) = cost when standing on stone j (0 <= j < N)
        // f(N-1)

        // f(0) = 0
        // f(j) = min:
        //        f(j-1) + abs(h[j], h[j-1])
        //        f(j-2) + abs(h[j], h[j-2])
        //        ...
        //        f(j-K) + abs(h[j], h[j-K])

        int[] dp = new int[N];
        Arrays.fill(dp, Integer.MAX_VALUE);
        dp[0] = 0;
        for (int j = 1; j < N; j++) {
            for (int i = Math.max(0, j-K); i < j; i++) {
                dp[j] = Math.min(dp[j], dp[i] + Math.abs(h[j] - h[i]));
            }
        }
        return dp[N-1];
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int K = scanner.nextInt();
        int[] h = new int[N];
        for (int i = 0; i < N; i++) {
            h[i] = scanner.nextInt();
        }
        int res = frog1(N, K, h);
        System.out.println(res);
    }
}


Compiler output:
Main.java:1: error: package me.nettee.algorithm.interval does not exist
import me.nettee.algorithm.interval.Interval;
                                   ^
1 error
Language: C++

#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <unordered_map>
#include <queue>
// g++ -std=c++11 -o2 -Wall filename.cpp -o filename
#define hell 1000000009
#define bug1(x) cout<<"$ "<<x<<" $"<<endl
#define bug2(x) cout<<"% "<<x<<" %"<<endl
#define bug3(x) cout<<"# "<<x<<" #"<<endl
#define ll long long
#define pb push_back
#define mp make_pair
#define tr(z) for(auto it=z.begin(); it!=z.end(); it++)
#define rloop(i,a,b) for(long long i=a; i>=b;i--)
#define loop(i,a,b) for(long long i=a; i<b; i++)
#define vbool vector< bool >
#define vvbool  vector< vector<bool> >
#define vchar vector<char>
#define vi vector<int>
#define vvi vector< vector<int> >
#define pll pair<long long, long long>
#define vll vector<long long>
#define vvl vector< vector<long long> >
#define ninf numeric_limits<long long>::min()
#define pinf numeric_limits<long long>::max()
#define comp(a,b) (abs(a-b)<1e-9) // to compare doubles
using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int N,K;
    cin >> N >> K;
    vi stones(N);
    loop(i, 0, N) {
        int n;
        cin >> stones[i];
    }

    vector<int> dp(N, INT_MAX);
    dp[0] = 0;
    dp[1] = abs(stones[1] - stones[0]);
    for (int i = 2; i < N; ++i) {
        for (int step = 1; step <= K; ++step) {
            if (step <= i) {
                dp[i] = min(dp[i], dp[i - step] + abs(stones[i] - stones[i - step]));
            }
        }
    }
    cout << dp[N - 1] << "\n";
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:23: error: 'INT_MAX' was not declared in this scope
   42 |     vector<int> dp(N, INT_MAX);
      |                       ^~~~~~~
a.cc:7:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    6 | #include <queue>
  +++ |+#include <climits>
    7 | // g++ -std=c++11 -o2 -Wall filename.cpp -o filename
Language: C++

#include <bits/stdc++.h>
#define ll long long int
#define endl "\n"
#define f(i, a, b) for(ll i=a; i<b; i++)
#define fb(i, a, b) for(ll i=a; i>=b; i--)
using namespace std;

int main()
{
	int n, k;
	cin>>n>>k;
	int h[n], dp[n];
	f(i, 0, n) cin>>h[i];
	if(k >= n-1)
	{
		cout<<abs(h[n-1]-h[0]);
		return;
	}
	dp[0] = 0; dp[1] = abs(h[1] - h[0]);
	f(i, 2, k)
	{
		dp[i] = INT_MAX;
		fb(j, i-1, 0) dp[i] = min(dp[i], dp[j] + abs(h[i] - h[j]));
	}
	f(i, k, n)
	{
		dp[i] = INT_MAX;
		f(j, 1, k+1) dp[i] = min(dp[i], dp[i-j] + abs(h[i] - h[i-j]));
	}
	cout<<dp[n-1];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:17: error: return-statement with no value, in function returning 'int' [-fpermissive]
   17 |                 return;
      |                 ^~~~~~
Language: C++

//Author: Fuadul Hasan(fuadul202@gmail.com)
//BSMRSTU,Gopalganj
#include<bits/stdc++.h>
using namespace std;int tc = 1;
#define happy ios::sync_with_stdio(false);
#define coding  cin.tie(0);
#define mp make_pair
#define ll long long
#define Pi atan(1)*4
#define pb  push_back
#define vpr vector<pr> 
#define pr pair<int, int> 
#define vi std::vector<int>
#define vll std::vector<ll>
#define YES printf("YES\n");
#define NO printf("NO\n");
#define Yes printf("Yes\n");
#define No printf("No\n");
#define all(n) n.begin(),n.end()
#define point(x) setprecision(x)
#define Test printf("Case %d: ",tc++);
#define Unique(c) (c).resize(unique(all(c))-(c).begin())

const int M = 1e9 + 7;
const ll  Inf = (ll)2e18 + 5;
const int N   = 2e5 + 5;

int solve() 
{
	//happy coding

	int n;
		cin>>n;
		int a[N+1];
		for(int i=1;i<=n;i++){
			cin>>a[i];
		}

		dp[1] = 0;
		dp[2] = abs(a[2]-a[1]);
		///cout<<dp[2]<<endl;
		for(int i=3;i<=n;i++){
			//cout<<dp[i-1]+(abs(a[i-1]))<<" "<<dp[i-2]+(abs(a[i-2]-a[i]))<<endl;
			dp[i] = min(dp[i-1]+(abs(a[i-1]-a[i])),dp[i-2]+(abs(a[i-2]-a[i])));
			//cout<<dp[i]<<" ";
		}

		cout<<dp[n]<<endl;


	
	return 0;
}
int main(){
	int test = 1;
	//scanf("%d", &test);
	while (test--)solve();return 0;
}

Compiler output:
a.cc: In function 'int solve()':
a.cc:39:17: error: 'dp' was not declared in this scope; did you mean 'dup'?
   39 |                 dp[1] = 0;
      |                 ^~
      |                 dup
Language: Java

import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;

public class B {

    static class Task {

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int k = in.nextInt();
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = in.nextInt();
            }

            int[] dp = new int[n];
            dp[0] = 0;
            for (int i = 1; i < n; i++) {
                int min = Integer.MAX_VALUE;
                for (int j = Math.max(0, i - k); j < i; j++) {
                    min = Math.min(min, dp[j] + Math.abs(arr[j] - arr[i]));
                }
                dp[i] = min;
            }

            out.println(dp[n - 1]);
        }
    }

    private static void sort(double[] arr) {
        Double[] objArr = Arrays.stream(arr).boxed().toArray(Double[]::new);
        Arrays.sort(objArr);
        for (int i = 0; i < arr.length; i++) {
            arr[i] = objArr[i];
        }
    }

    private static void sort(int[] arr) {
        Integer[] objArr = Arrays.stream(arr).boxed().toArray(Integer[]::new);
        Arrays.sort(objArr);
        for (int i = 0; i < arr.length; i++) {
            arr[i] = objArr[i];
        }
    }

    private static void sort(long[] arr) {
        Long[] objArr = Arrays.stream(arr).boxed().toArray(Long[]::new);
        Arrays.sort(objArr);
        for (int i = 0; i < arr.length; i++) {
            arr[i] = objArr[i];
        }
    }

    private static void solve() {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task task = new Task();
        task.solve(1, in, out);
        out.close();
    }

    public static void main(String[] args) {
        new Thread(null, () -> solve(), "1", 1 << 26).start();
    }

    static class InputReader {

        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

    }

}

Compiler output:
Main.java:5: error: class B is public, should be declared in a file named B.java
public class B {
       ^
1 error
Language: C++

#include<iostream>
#include<vector>
#include<cmath>
using namespace std;
int main()
{
  int n;
  int k;
  cin>>n>>k;
  vector<int>h(n+1,0);
  for(int i=1;i<n+1;i++)
  {
    cin>>h[i];
  }
  vector<int>dp(n+1,INT_MAX);
  dp[0]=0;
  dp[1]=0;
  
  for(int i=2;i<n+1;i++)
  {
    for(int j=1;j<=k;j++)
    {
      if(i>j)
      dp[i]=fmin(dp[i-j]+abs(h[j]-h[i]),dp[i]);
      
    }
    
    
    
  }
  cout<<dp[n]<<endl;
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:21: error: 'INT_MAX' was not declared in this scope
   15 |   vector<int>dp(n+1,INT_MAX);
      |                     ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include<cmath>
  +++ |+#include <climits>
    4 | using namespace std;
Language: C++

#include<iostream>
#include<vector>
#include<cmath>
using namespace std;
int main()
{
  int n;
  int k;
  cin>>n>>k;
  vector<int>h(n+1,0);
  for(int i=1;i<n+1;i++)
  {
    cin>>h[i];
  }
  vector<int>dp(n+1,INT_MAX);
  dp[0]=0;
  dp[1]=0;
  
  for(int i=2;i<n+1;i++)
  {
    for(int j=1;j<=k;j++)
    {
      if(i>j)
      dp[i]=min(dp[i-j]+abs(h[j]-h[i]),dp[i]);
      
    }
    
    
    
  }
  cout<<dp[n]<<endl;
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:21: error: 'INT_MAX' was not declared in this scope
   15 |   vector<int>dp(n+1,INT_MAX);
      |                     ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include<cmath>
  +++ |+#include <climits>
    4 | using namespace std;
Language: Java

import java.util.*;

public class Frog2 {

    int[] stones;

    private int getDist(int i, int j) {
        return Math.abs(stones[i] - stones[j]);
    }

    private void run() {
        
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int K = sc.nextInt();
        stones = new int[N];
        int[] dp = new int[N];

        for (int i = 0; i < N; i++) stones[i] = sc.nextInt();
        
        dp[N-1] = 0;
        dp[N-2] = getDist(N-1, N-2);

        for (int i = N-3; i >= 0; i--) {
            int min = 100000;
            for (int j = 1; j <= K; j++) {
                if (i + j >= N) break;
                int dist = dp[i+j] + getDist(i,i+j);
                if (dist < min) min = dist;
            }
            dp[i] = min;
        }
        System.out.println(dp[0]);
    }
    public static void main(String[] args) {
        Frog2 solver = new Frog2();
        solver.run();
    }
}


Compiler output:
Main.java:3: error: class Frog2 is public, should be declared in a file named Frog2.java
public class Frog2 {
       ^
1 error
Language: C++

include <bits/stdc++.h>
using namespace std;
using ll= long long ;
using P = pair<ll,ll>;
#define rep(i,n) for (ll i = 0; i<(ll)(n); i++)
#define mod 1000000007

ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a, ll b){
    ll g=gcd(a,b);
    return a/g*b;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t =rep_jijo(n,x/2);
        return t*t%mod;
  }
  return n*rep_jijo(n,x-1)%mod;
}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
const long long INF =1LL << 60;
ll N;
ll h[100100];
//DP テーブル
ll dp[100100];

int main() {
   ll N,K; 
   cin >> N>>K;
   rep(i,N){
       cin>>h[i];
   }

// DP テーブル全体を初期化 (最小化問題なので INF に初期化)
for (int i = 0; i < 100100; ++i) {
    dp[i] = INF;
    }

// 初期条件
dp[0] = 0;

// ループ
for (ll i = 0; i < N; ++i) {

        for(ll j=1;j<=K;j++){
         chmin(dp[i+j], dp[i] + abs(h[i]-h[i+j]));
    
}}
    
// 解を得て出力
cout << dp[N-1] << endl;
return 0 ;

}



Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
a.cc:4:11: error: 'pair' does not name a type
    4 | using P = pair<ll,ll>;
      |           ^~~~
a.cc: In function 'll gcd(ll, ll)':
a.cc:9:13: error: 'swap' was not declared in this scope
    9 |     if(b>a) swap(a,b);
      |             ^~~~
a.cc: In function 'int main()':
a.cc:47:4: error: 'cin' was not declared in this scope
   47 |    cin >> N>>K;
      |    ^~~
a.cc:64:33: error: 'abs' was not declared in this scope
   64 |          chmin(dp[i+j], dp[i] + abs(h[i]-h[i+j]));
      |                                 ^~~
a.cc:69:1: error: 'cout' was not declared in this scope
   69 | cout << dp[N-1] << endl;
      | ^~~~
a.cc:69:20: error: 'endl' was not declared in this scope
   69 | cout << dp[N-1] << endl;
      |                    ^~~~
Language: C++

#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const long long INF = 1LL << 60;

// 入力
int N;
long long h[110000];

// DP テーブル
long long dp[110000];

int main(){
  int N,K;
  cin>>N>>K;
  int [100010];
  long long dp[101000];
  for (int i=0; i<N; i++) cin>>h[i];
  
  for (int i=0; i<N; i++) dp[i]=INF;
  
 dp[0]=0;
  
  for (int i=0; i<N-1; i++){
    for (int j=1;j<=K; j++){
  
  chmin(dp[i+j],dp[i]+abs(h[i+j]-h[i]));
    }
  }
  cout<<dp[N-1]<<endl;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:20:8: error: expected identifier before numeric constant
   20 |   int [100010];
      |        ^~~~~~
a.cc:20:8: error: expected ']' before numeric constant
   20 |   int [100010];
      |        ^~~~~~
      |        ]
a.cc:20:7: error: structured binding declaration cannot have type 'int'
   20 |   int [100010];
      |       ^
a.cc:20:7: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:20:7: error: empty structured binding declaration
a.cc:20:15: error: expected initializer before ';' token
   20 |   int [100010];
      |               ^
Language: C++

#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const long long INF = 1LL << 60;

// 入力
int N;
long long h[110000];

// DP テーブル
long long dp[110000];

int main(){
  int N,K;
  cin>>N>>K;
  int h[100010];
  int dp[100010];
  for (int i=0; i<N; i++) cin>>h[i];
  
  for (int i=0; i<N; i++) dp[i]=INF;
  
 dp[0]=0;
  
  for (int i=0; i<N-1; i++){
    for (int j=1;j<=K; j++){
  
  chmin(dp[i+j],dp[i]+abs(h[i+j]-h[i]))
    }
  }
  cout<<dp[N-1]<<endl;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:24:33: warning: overflow in conversion from 'long long int' to 'int' changes value from '1152921504606846976' to '0' [-Woverflow]
   24 |   for (int i=0; i<N; i++) dp[i]=INF;
      |                                 ^~~
a.cc:31:40: error: expected ';' before '}' token
   31 |   chmin(dp[i+j],dp[i]+abs(h[i+j]-h[i]))
      |                                        ^
      |                                        ;
   32 |     }
      |     ~
Language: C++

#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const long long INF = 1LL << 60;

// 入力
int N;
long long h[110000];

// DP テーブル
long long dp[110000];

int main(){
  int N,K;
  cin>>N>>K;
  int h[100010];
  int dp[100010];
  for (int i=0; i<N; i++) cin>>h[i];
  
  for (int i=0; i<N; i++) dp[i]=INF;
  
 dp[0]=0;
  
  for (int i=0; i<N-1; i++){
    for (int j=1,j<=K; j++){
  
  chmin(dp[i+j],dp[i]+abs(h[i+j]-h[i]))
    }
  }
  cout<<dp[N-1]<<endl;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:24:33: warning: overflow in conversion from 'long long int' to 'int' changes value from '1152921504606846976' to '0' [-Woverflow]
   24 |   for (int i=0; i<N; i++) dp[i]=INF;
      |                                 ^~~
a.cc:29:19: error: expected ';' before '<=' token
   29 |     for (int j=1,j<=K; j++){
      |                   ^~
      |                   ;
a.cc:29:19: error: expected primary-expression before '<=' token
   29 |     for (int j=1,j<=K; j++){
      |                   ^~
a.cc:31:40: error: expected ';' before '}' token
   31 |   chmin(dp[i+j],dp[i]+abs(h[i+j]-h[i]))
      |                                        ^
      |                                        ;
   32 |     }
      |     ~
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int helper(vector<int> a, int n,int k)
{
    vector<int>dp(n,INT_MAX);
    dp[0]=0;
    for(int i=1;i<n;i++)
    {
        for(int j=0;j<k;j++)
        {
            if((i-j-1)>=0)
                dp[i]=min(dp[i],dp[i-j-1]+abs(a[i-j-1]-a[i]));
        }
    }
    return dp.back();
}

int main()
{
    int n;
    int k;
    cin>>n>>k;
    vector<int> a(n,0);
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    int res=helper(a,n,k);
    cout<<res<<endl;
    
    
//     vector<int>a={40,10,20,70,80,10,20,70,80,60};
//     int res=helper(a,10,4);
//     cout<<res<<endl;
    
}

Compiler output:
a.cc: In function 'int helper(std::vector<int>, int, int)':
a.cc:8:21: error: 'INT_MAX' was not declared in this scope
    8 |     vector<int>dp(n,INT_MAX);
      |                     ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <vector>
  +++ |+#include <climits>
    3 |
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int helper(vector<int> a, int n,int k)
{
    vector<int>dp(n,INT_MAX);
    dp[0]=0;
    for(int i=1;i<n;i++)
    {
        for(int j=0;j<k;j++)
        {
            if((i-j-1)>=0)
                dp[i]=min(dp[i],dp[i-j-1]+abs(a[i-j-1]-a[i]));
        }
    }
    return dp.back();
}

int main()
{
     int n;
     int k;
     cin>>n>>k;
     vector<int> a(n,0);
     for(int i=0;i<n;i++)
     {
         cin>>a[i];
     }
     int res=helper(a,n,k);
     cout<<res<<endl;
    
    
    //vector<int>a={40,10,20,70,80,10,20,70,80,60};
    //int res=helper(a,10,4);
    //cout<<res<<endl;
    
}

Compiler output:
a.cc: In function 'int helper(std::vector<int>, int, int)':
a.cc:8:21: error: 'INT_MAX' was not declared in this scope
    8 |     vector<int>dp(n,INT_MAX);
      |                     ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <vector>
  +++ |+#include <climits>
    3 |
Language: C++

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;

int move(int n, int k, int* a){
  if(n==1||n==2){
    //cout << abs(a[n] - a[0]) << endl;
    return abs(a[n]-a[0]);
  }else{
    int ans[k-1];
    int ans=10000000;
    for(int i=0;i<k-1;i++){
      ans[i] = abs(a[n]-a[n-i+1]) + move(n-i+1,k,a);
      if(ans>ans[i]){
        ans = ans[i];
      }
    }
    return ans;
  }
}
int main(){
  int n, k;
  cin >> n >> k;
  int a[n];
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  cout << move(n-1,k,a) << endl;
  
}

Compiler output:
a.cc: In function 'int move(int, int, int*)':
a.cc:12:9: error: conflicting declaration 'int ans'
   12 |     int ans=10000000;
      |         ^~~
a.cc:11:9: note: previous declaration as 'int ans [(k + -1)]'
   11 |     int ans[k-1];
      |         ^~~
a.cc:15:13: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   15 |       if(ans>ans[i]){
      |          ~~~^~~~~~~
a.cc:16:13: error: incompatible types in assignment of 'int' to 'int [(k + -1)]'
   16 |         ans = ans[i];
      |         ~~~~^~~~~~~~
a.cc:19:12: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   19 |     return ans;
      |            ^~~
      |            |
      |            int*
Language: C++

#include <iostream>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <unordered_map>
#include <iomanip>
#include <sstream>
#include <numeric>
using namespace std;
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vvi vector<vi>
#define vs vector<string>
#define pi pair<ll,ll>
#define pb push_back
#define pf push_front
#define eb emplace_back
#define mp make_pair
#define fs first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
int main() {
    ll n,k;
    cin>>n>>k;
    vi v(n);
    for(ll i=0;i<n;i++){
        cin>>v[i];
    }
    vi a(n,INT_MAX);
    a[0] = 0;

    for(ll i=0;i<n;i++){
        for(ll j=(i+1);j<=(i+k) && j<n;j++){
            a[j] = min(a[j],a[i]+abs(v[i]-v[j]));
        }
    }

    cout<<a[n-1]<<endl;

}




Compiler output:
a.cc: In function 'int main()':
a.cc:37:12: error: 'INT_MAX' was not declared in this scope
   37 |     vi a(n,INT_MAX);
      |            ^~~~~~~
a.cc:14:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   13 | #include <numeric>
  +++ |+#include <climits>
   14 | using namespace std;
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
#define ll long long
ll n, k, h[100009], dp[100009];
ll solve(ll ind)
{
	if (ind == n - 1)
		return 0;
	ll jump = abs(h[ind] - h[ind + 1]) + solve(ind + 1);
	if (dp[ind] != -1)
		return dp[ind];
	else
	for (int i = 2; i <= k; i++)
	{
		if (i + ind < n)
			jump = min(jump, abs(h[ind] - h[ind + i]) + solve(ind + i));
	}
	return dp[ind] = jump;
}
int main()
{
	cin >> n >> k;
	for (int i = 0; i < n; i++)
		cin >> h[i];
	memset(dp, -1, sizeof(dp));
	cout << solve(0);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:9: error: 'memset' was not declared in this scope
   26 |         memset(dp, -1, sizeof(dp));
      |         ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <algorithm>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

#include <bits\stdc++.h>
using namespace std;
#define ll long long
ll n, k, h[100009], dp[100009];
ll solve(ll ind)
{
	if (ind == n - 1)
		return 0;
	ll jump = abs(h[ind] - h[ind + 1]) + solve(ind + 1);
	if (dp[ind] != -1)
		return dp[ind];
	else
	for (int i = 2; i <= k; i++)
	{
		if (i + ind < n)
			jump = min(jump, abs(h[ind] - h[ind + i]) + solve(ind + i));
	}
	return dp[ind] = jump;
}
int main()
{
	cin >> n >> k;
	for (int i = 0; i < n; i++)
		cin >> h[i];
	memset(dp, -1, sizeof(dp));
	cout << solve(0);
}

Compiler output:
a.cc:1:10: fatal error: bits\stdc++.h: No such file or directory
    1 | #include <bits\stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long 
int main()
{
  ll n,k;
  cin>>n>>k;
  ll i;
  for(i=0;i<n;i++)
    cin>>a[i];
  ll sol[n];
  sol[0]=0;
  sol[1]=abs(a[1]-a[0]);
  for(i=2;i<n;i++)
  {
    ll count=1;
    while((i-count)>=0&&count<=k)
    {
      sol[i]=min(sol[i-count]+abs(a[i]-a[i-count]);
      count++;
     }
                 
  }
  cout<<sol[n-1];
                
  

Compiler output:
a.cc: In function 'int main()':
a.cc:10:10: error: 'a' was not declared in this scope
   10 |     cin>>a[i];
      |          ^
a.cc:13:14: error: 'a' was not declared in this scope
   13 |   sol[1]=abs(a[1]-a[0]);
      |              ^
a.cc:24:18: error: expected '}' at end of input
   24 |   cout<<sol[n-1];
      |                  ^
a.cc:5:1: note: to match this '{'
    5 | {
      | ^
Language: C++

# @oj:atcoder
# @id: hitwanyang
# @email: 296866643@qq.com
# @date: 2020-04-20 10:31
# @url:https://atcoder.jp/contests/dp/tasks/dp_b
nk=list(map(int,input().split()))
h=list(map(int,input().split()))
n=nk[0]
k=nk[1]
dp=[10**9]*n
dp[0]=0
dp[1]=abs(h[1]-h[0])
for i in range(2,n):
    for j in range(i-k,i):
        if j>=0:
            dp[i]=min(dp[j]+abs(h[i]-h[j]),dp[i])

print (dp[-1])

Compiler output:
a.cc:1:3: error: invalid preprocessing directive #@
    1 | # @oj:atcoder
      |   ^
a.cc:2:3: error: invalid preprocessing directive #@
    2 | # @id: hitwanyang
      |   ^
a.cc:3:3: error: invalid preprocessing directive #@
    3 | # @email: 296866643@qq.com
      |   ^
a.cc:4:3: error: invalid preprocessing directive #@
    4 | # @date: 2020-04-20 10:31
      |   ^
a.cc:5:3: error: invalid preprocessing directive #@
    5 | # @url:https://atcoder.jp/contests/dp/tasks/dp_b
      |   ^
a.cc:6:1: error: 'nk' does not name a type
    6 | nk=list(map(int,input().split()))
      | ^~
Language: C++


#include <bits/stdc++.h>
#include "ConsoleApplication61.h"
#define ReadFile freopen("input.txt","r",stdin)
#define WriteFile freopen("output.txt","w",stdout)
#define MEGA_MIND ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define M_PI 3.14159265358979323846
#define mod 1000000007
#define endl "\n"
using namespace std;
using ll = long long;
using lli = long long int;
using ld = long double;


const int N = 5e5 + 6, inf = 2e9;
int n,k;
int arr[N], dp[N];
int main()
{
	MEGA_MIND

		cin >> n >>k;
	for (int i = 0; i < n; i++)
	{
		dp[i] = inf;
		cin >> arr[i];
	}

	dp[0] = 0;
	for (int i = 0; i < n; i++)
	{
		for (int j = i+1; j <= i + k; j++)
		{
			if(j<n)
				dp[j] = min(abs(arr[i] - arr[j]) + dp[i], dp[j]);
		}
	}
	cout << dp[n - 1] << endl;
	return 0;
}

Compiler output:
a.cc:3:10: fatal error: ConsoleApplication61.h: No such file or directory
    3 | #include "ConsoleApplication61.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <algorithm>
#define ll long long

using namespace std;

int n, k, arr[100005];
int dp[100005];

int solve(int i)
{
	if (i == n - 1)return 0;
	if (dp[i] != -1)return dp[i];
	dp[i] = abs(arr[i] - arr[i + 1]) + solve(i + 1);
	for (int j = i + 2; j <= i + k && j < n; j++)
	{
		dp[i] = min(dp[i], abs(arr[i] - arr[j]) + solve(j));
	}
	return dp[i];
}

int main()
{
	memset(dp, -1, sizeof dp);
	cin >> n >> k;
	for (int i = 0; i < n; i++)cin >> arr[i];
	cout << solve(0) << '\n';
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:9: error: 'memset' was not declared in this scope
   29 |         memset(dp, -1, sizeof dp);
      |         ^~~~~~
a.cc:8:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    7 | #include <algorithm>
  +++ |+#include <cstring>
    8 | #define ll long long
Language: C++

#include <iostream>
#include<algorithm>
#include<vector>
using namespace std;
int n, k ,h[100005],dp[100005];
int solve(int index)
{
  int  ans = 1e9;
    if (index == n)
        return 0;
    if (dp[index] != -1)
        return dp[index];
    for (int i = 1; i <= k; i++)
    {
        if(index+i<=n)
        ans = min(ans, abs(h[index+i]-h[index])+solve(index + i));
    }
    return dp[index]=ans;
}
int main()
{
    ios::sync_with_stdio(0); cin.tie(0); ios_base::sync_with_stdio(0);
    cin >> n >> k;
    memset(dp, -1, sizeof dp);
    for (int i = 1; i <= n; i++)
        cin >> h[i];
    cout << solve(1);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:5: error: 'memset' was not declared in this scope
   24 |     memset(dp, -1, sizeof dp);
      |     ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include<vector>
  +++ |+#include <cstring>
    4 | using namespace std;
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define INF=1e9+5;


int main()
{
	
	int n ; 
	 cin>>n;
	 int k ;
	  cin>>k;
	 vector<int> h ;
	 for(int i  =0;i<n;i++)
	 {
	 	int a;
	 	cin>>a;
	 	
	 	h.push_back(a);
	 	
	 }
	 
	 
	 vector<int>dp(n+1,INF);
	dp[0]=0;

	for(int i =0;i<n;i++)
	{
		for (int j  = i+1;j<=i+k;j++)
		{
			if(j<n)
			{
				dp[j]=min(dp[j],dp[i]+abs(h[i]-h[j]))
			}
		}
	}
	
	cout<<dp[n-1];
	 return 0 ;
}


Compiler output:
a.cc:3:9: warning: ISO C++11 requires whitespace after the macro name
    3 | #define INF=1e9+5;
      |         ^~~
a.cc: In function 'int main()':
a.cc:3:12: error: expected primary-expression before '=' token
    3 | #define INF=1e9+5;
      |            ^
a.cc:24:28: note: in expansion of macro 'INF'
   24 |          vector<int>dp(n+1,INF);
      |                            ^~~
a.cc:24:31: error: expected primary-expression before ')' token
   24 |          vector<int>dp(n+1,INF);
      |                               ^
a.cc:33:70: error: expected ';' before '}' token
   33 |                                 dp[j]=min(dp[j],dp[i]+abs(h[i]-h[j]))
      |                                                                      ^
      |                                                                      ;
   34 |                         }
      |                         ~
Language: C++


#include <cmath>
#include <functional>
#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>
#include <sstream>
#include <chrono>
#include <cstring>
using namespace std; 
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define vii             vector<pii> 
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define f(i,x,n)        for(int i=x;i<n;i++)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count()); 

int32_t main(){

     
	  ios::sync_with_stdio(0);
      cin.tie(0);

      int n,k; 
      cin>>n>>k; 
      mk(a,n,int) ; 
      f(i,0,n){ 
      	cin>>a[i];
        dp[i]=-1; 

      }
     //  cout<<fun(a,n-1,k,n) ;

     int dp[n] ; 
     dp[0]= 0 ; 
     dp[1]= abs(a[1]-a[0]) ; 

     f(i,2,n){
         int q1=inf ;
     	 for(int j=1;j<=k;j++){
              
              if(i >= j ) {
     	 	  q1 = min(q1,dp[i-j] + abs(a[i]-a[i-j])) ; 
     	 	  dp[i] = q1 ;

     	 	  }
     	 	  else
     	 	  break ;  
     	 }
     } 
     cout<<dp[n-1] ; 
 }





 
 
 
        

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:58:9: error: 'dp' was not declared in this scope; did you mean 'mp'?
   58 |         dp[i]=-1;
      |         ^~
      |         mp
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main() 
{
  	int n,k;
    cin >> n >> k;
    int a[n+1];
    for(int i=0;i<n;i++)
    	cin >> a[i];
  	int start;
  	int dp[n]=0;
  	for(int i=0;i<n;i++)
      dp[i]=INT_MAX;
  	dp[0]=0;
    for (int i = 1; i < n; i++) 
    {
      	start = i-k;
      	if(start<0)
          start=0;
      	for(int j=start;j<k;j++)
        {
        	dp[i] = min(dp[j] + abs(a[i] - a[j]),dp[i]);
        }
    }
  
    cout << dp[n - 1] << "\n";
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:19: error: array must be initialized with a brace-enclosed initializer
   13 |         int dp[n]=0;
      |                   ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main() 
{
  	int n,k;
    cin >> n >> k;
    int a[n+1];
    for(int i=0;i<n;i++)
    	cin >> a[i];
  	int start;
  	for(int i=0;i<n;i++)
      dp[i]=INT_MAX;
    int dp[n]=0;
    for (int i = 1; i < n; i++) 
    {
      	start = i-k;
      	if(start<0)
          start=0;
      	for(int j=start;j<k;j++)
        {
        	dp[i] = min(dp[j] + abs(a[i] - a[j]),dp[i]);
        }
    }
  
    cout << dp[n - 1] << "\n";
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:7: error: 'dp' was not declared in this scope; did you mean 'dup'?
   14 |       dp[i]=INT_MAX;
      |       ^~
      |       dup
a.cc:15:15: error: array must be initialized with a brace-enclosed initializer
   15 |     int dp[n]=0;
      |               ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main() 
{
  	int n,k;
    cin >> n >> k;
    int a[n+1];
    for(int i=0;i<n;i++)
    	cin >> a[i];
  	int start;
    int dp[n]={0};
    for (int i = 1; i < n; i++) 
    {
      	start = i-k;
      	if(start<0)
          start=0;
      	for(int j=;j<k;j++)
        {
        	dp[i] = min(dp[i - k] + abs(a[i] - a[i - k]),dp[i]);
        }
    }
  
    cout << dp[n - 1] << "\n";
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:19: error: expected primary-expression before ';' token
   19 |         for(int j=;j<k;j++)
      |                   ^
Language: Java

#include <stdio.h>
#include <stdlib.h>
#include <limits.h>

#define L 10000

#define MIN(a,b) ((a) < (b) ? (a) : (b)) 

int main()
{
    int N, K;

    scanf("%d%d",&N,&K);

    int h[N], dp[L];
    
    for (int i = 0; i < N; i++) {
        scanf("%d", &h[i]);
        dp[i] = INT_MAX;
    }

    dp[0] = 0;
    

    for (int i = 0; i < N; i++) {
        for (int j = 1; j <= K; j++) {
            if (i + j < N) {
                dp[i+j] = MIN(dp[i+j], dp[i] + abs(h[i] - h[i+j]));
            }
        }
    }

    printf("%d", dp[N-1]);

    return 0;
    

}

Compiler output:
Main.java:1: error: illegal character: '#'
#include <stdio.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include <stdio.h>
         ^
Main.java:2: error: illegal character: '#'
#include <stdlib.h>
^
Main.java:3: error: illegal character: '#'
#include <limits.h>
^
Main.java:5: error: illegal character: '#'
#define L 10000
^
Main.java:7: error: illegal character: '#'
#define MIN(a,b) ((a) < (b) ? (a) : (b)) 
^
Main.java:13: error: class, interface, enum, or record expected
    scanf("%d%d",&N,&K);
    ^
Main.java:15: error: class, interface, enum, or record expected
    int h[N], dp[L];
    ^
Main.java:17: error: class, interface, enum, or record expected
    for (int i = 0; i < N; i++) {
    ^
Main.java:17: error: class, interface, enum, or record expected
    for (int i = 0; i < N; i++) {
                    ^
Main.java:17: error: class, interface, enum, or record expected
    for (int i = 0; i < N; i++) {
                           ^
Main.java:19: error: class, interface, enum, or record expected
        dp[i] = INT_MAX;
        ^
Main.java:20: error: class, interface, enum, or record expected
    }
    ^
Main.java:25: error: class, interface, enum, or record expected
    for (int i = 0; i < N; i++) {
    ^
Main.java:25: error: class, interface, enum, or record expected
    for (int i = 0; i < N; i++) {
                    ^
Main.java:25: error: class, interface, enum, or record expected
    for (int i = 0; i < N; i++) {
                           ^
Main.java:26: error: class, interface, enum, or record expected
        for (int j = 1; j <= K; j++) {
                        ^
Main.java:26: error: class, interface, enum, or record expected
        for (int j = 1; j <= K; j++) {
                                ^
Main.java:29: error: class, interface, enum, or record expected
            }
            ^
Main.java:35: error: class, interface, enum, or record expected
    return 0;
    ^
Main.java:38: error: class, interface, enum, or record expected
}
^
21 errors
Language: C++

// #include <boost/multiprecision/cpp_int.hpp> 
// using namespace boost::multiprecision; 
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define f first
#define s second
#define pb push_back
#define REP(i,a,b) for(long long int i=a ; i<b ; i++)
#define mp make_pair
#define INF 1000000000000000000
#define mod 1000000007
#define pi pair<ll,ll>
#define pd pair<ld,ld>
#define vi vector<ll>
#define vd vector<ld>
#define vvi vector<vi>
#define vvd vector<vd>
#define vpi vector<pi>
#define vpd vector<pd>
#define us unordered_set<ll>
#define um unordered_map<ll,ll>
#define sortA(a) sort(a.begin(),a.end())
#define sortD(a) sort(a.begin(),a.end(),greater<ll>())
#define all(a) a.begin(),a.end()
#define N 100005


#include <ext/pb_ds/assoc_container.hpp> 
using namespace __gnu_pbds; 
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> new_data_set; 
#define in insert
#define fbo find_by_order
#define ook order_of_key


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

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

ll powmod(ll x,ll y)
{
	if(x==0)
		return 0;
	if(y==0 || x==1)
		return 1;
	if(y%2==0)
		return powmod((x*x)%mod,y/2)%mod;
	return (x*powmod(x,y-1)%mod)%mod;
}
void print1D(vi a)
{
	for(ll i=0;i<a.size();++i)
	{
		cout<<a[i]<<" ";
	}
	cout<<endl;
}
void print2D(vector<vi> a)
{
	for(ll i=0;i<a.size();++i)
	{
		for(ll j=0;j<a[i].size();++j)
		{
			cout<<a[i][j]<<" ";
		}
		cout<<endl;
	}
}
void solve()
{
	ll n;
	cin>>n;
	vi a(n);
	for(ll i=0;i<n;++i)
	{
		cin>>a[i];
	}
	vi c(n);
	c[0]=0;
	c[1]=abs(a[1]-a[0]);
	for(ll i=2;i<n;++i)
	{
		c[i]=INF;
		for(ll j=i-1;j>=0 && j>=(i-k);--j)
		{
			c[i]=min(c[i],c[j]+abs(a[j]-a[i]));
		}
	}
	cout<<c[n-1]<<endl;
}
int main()
{
	ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
	ll t=1;
	// cin>>t;
	while(t--)
	{
		solve();
	}
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:109:44: error: 'k' was not declared in this scope
  109 |                 for(ll j=i-1;j>=0 && j>=(i-k);--j)
      |                                            ^