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

#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int n,k;
  	cin >> n >> k;
  	int jump[n];
  	vector<int> dp (n, INF);
  	for(int i=0;i<n;i++)
    	cin >> jump[i];
  	for(int i=0;i<n;i++)
      for(int j=i+1;j<=k;j++)
      	dp[j]=min(dp[j],dp[i]+jump[j]-jump[i];
    cout << dp[n-1];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'vector' was not declared in this scope
    9 |         vector<int> dp (n, INF);
      |         ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include<algorithm>
  +++ |+#include <vector>
    3 | using namespace std;
a.cc:9:16: error: expected primary-expression before 'int'
    9 |         vector<int> dp (n, INF);
      |                ^~~
a.cc:14:9: error: 'dp' was not declared in this scope
   14 |         dp[j]=min(dp[j],dp[i]+jump[j]-jump[i];
      |         ^~
a.cc:15:13: error: 'dp' was not declared in this scope
   15 |     cout << dp[n-1];
      |             ^~
Language: C++



	int pos=0;
	vector<int> cost(N,INF);
	cost[0] = 0;
	while(pos < N-1){
		for(int i=1; i<=K; i++){
			if(pos+i > N-1) break;
			cost[pos+i] = min(cost[pos]+abs(h[pos+i]-h[pos]), cost[pos+i]);
		}
		pos++;
	}
	cout << cost[N-1] << endl;

	return 0;
}


Compiler output:
a.cc:4:9: error: 'vector' does not name a type
    4 |         vector<int> cost(N,INF);
      |         ^~~~~~
a.cc:5:9: error: 'cost' does not name a type; did you mean 'const'?
    5 |         cost[0] = 0;
      |         ^~~~
      |         const
a.cc:6:9: error: expected unqualified-id before 'while'
    6 |         while(pos < N-1){
      |         ^~~~~
a.cc:13:9: error: 'cout' does not name a type
   13 |         cout << cost[N-1] << endl;
      |         ^~~~
a.cc:15:9: error: expected unqualified-id before 'return'
   15 |         return 0;
      |         ^~~~~~
a.cc:16:1: error: expected declaration before '}' token
   16 | }
      | ^
Language: C++

#include<bits/stdc++.h>
#define int long long int
using namespace std;
int dp[100010],n,k,a[100010];
int solve(int i)
{
  if(i==0)
    return 0;
  if(dp[i]!=-1)
    return dp[i];
  int m=INT_MAX;
  for(int j=1;j<=i&&j<=k;j++)
  m=min(m,abs(a[i]-a[i-j])+solve(i-j));
  return dp[i]=m;
}
int main()
{
  memset(dp,-1,sizeof(dp));
  cin>>n>>k;
  for(int i=0;i<n;i++)
    cin>>a[i];
  cout<<solve(n-1)<<"\n";
  // cout<<dp[n-1]<<"\n";
  return 0;
}

Compiler output:
a.cc:2:23: error: '::main' must return 'int'
    2 | #define int long long int
      |                       ^~~
a.cc:16:1: note: in expansion of macro 'int'
   16 | int main()
      | ^~~
Language: C++

#include<iostream>
#include<algoritm>
using namespace std;
int main()
{
  	//5 3
	//10 30 40 50 20
  	//0  20 30 40 30
  	int n,k;
  	cin >> n >> k;
  	int jump[n], dp[n]={INF};
  	for(int i=0;i<n;i++)
      cin >> jump[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(dp[j], dp[i]+abs(jump[j]-jump[i]));
  	cout << dp[n-1];
}

Compiler output:
a.cc:2:9: fatal error: algoritm: No such file or directory
    2 | #include<algoritm>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<vector>

using namespace std;


int main(){


	int N,K;

	cin >> N >> K;

	vector<int> DP(N,0);
	vector<int> A(N,0);

	for(int i=0;i<N;i++){
		cin >> A[i];
	}

	DP[1] = abs(A[1]-A[0]);

	for(int i=2;i<N;i++){
		int best_jump = INT_MAX;
		for(int j=1;(j<=K)&&(j<=i);j++){
			best_jump = min(best_jump,abs(A[i]-A[i-j])+DP[i-j]);
		}
		DP[i] = best_jump;
	}

	cout << DP[N-1] << endl;

	system("pause");

	return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:33: error: 'INT_MAX' was not declared in this scope
   24 |                 int best_jump = 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<bits/stdc++.h>
using namespace std;

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

int main()
{
	int n, k;
	cin >> n >> k;
	int h[n];
	for(int i=0; i<n; i++)
		cin >> h[i];
	int ans = frog(n, h, k);
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int frog(int, int*, int)':
a.cc:6:27: error: expected '}' before ';' token
    6 |         int dp[n]={INT_MAX;
      |                   ~       ^
Language: C++

#include<stdio.h>
#include<iostream>
#include<bits/stdc++.h>

using namespace std;
int main()
{
  long long n;
  cin>>n;
  long long h[n+1],dp[n+1];
  for(long long i=1;i<=n;i++)
    cin>>h[i];
  dp[0]=0;
  h[0]=0;
  dp[1]=0;
  dp[2]=abs(h[2]-h[1]);
  for(long long i=3;i<=n;i++)
  {
    int result=INT_MAX;
    for(int j=1;j<=min(k,i-1);j++)
    {
      if(dp[i-j]+abs(h[i]-h[i-j])<result)
        result=dp[i-j]+abs(h[i]-h[i-j]);
    }
    dp[i]=result;
  }
  cout<<dp[n];
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:24: error: 'k' was not declared in this scope
   20 |     for(int j=1;j<=min(k,i-1);j++)
      |                        ^
Language: C++

#include <iostream>

using namespace std;

int mod(int x,int y){
    if(x>=y)return x-y;
    else return y-x;
}

int main(int argc, const char * argv[]) {
    int n,k;
    cin>>n>>k;
    int arr[n];
    for(int i=0;i<n;i++)cin>>arr[i];
    
    int bp[n];
    bp[0] = 0;
    for(int i=1;i<n;i++){
        int least=INT_MAX;
        int j=1;
        while(j<=k && i-j>=0){
            least = min(least,bp[i-j] + mod(arr[i],arr[i-j]));
            j++;
        }
        bp[i] = least;
    }
    
    cout<<bp[n-1]<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:19:19: error: 'INT_MAX' was not declared in this scope
   19 |         int least=INT_MAX;
      |                   ^~~~~~~
a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include <iostream>
  +++ |+#include <climits>
    2 |
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define f(a, b) for (ll i = a; i <= b; i++)
#define pb push_back
#define pf push_front
#define mp make_pair
using namespace std;
#define N 100005
const int INF = 1000000001;
const int MOD = 998244353 ; //1e9+7;

//vector< vector<ll> > g(N);
//vector< pair<ll, pair< ll, ll > > > g(N);
//ll vis[N] = {0}, par[N] = {0}, child[N] = {0}, cnt = 0;
ll dp[N] = {0}, n, k, a[N] = {0};

void solve(){
    cin >> n >> k;
    f(0,n-1) cin >> a[i];
    dp[0] = 0; dp[1] = abs(a[0] - a[1]);
    f(2,n-1){
        ll cnt= 0, mn = INF;
        for(ll j = i-1; j >= 0 and cnt < k; j--, cnt++){
            mn = min(mn, dp[j] + abs(a[i] - a[j])) ;
        }
        dp[i] = mn;
    }
    cout << dp[n-1] << "\n";c
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    //freopen("input.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    //ll t;cin >> t;for(ll index=1; index<=t; index++){
        //cout << "Case #" << index << ": " ;
        solve();
   // }
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:29:29: error: 'c' was not declared in this scope
   29 |     cout << dp[n-1] << "\n";c
      |                             ^
Language: C++

#include<bits/stdc++.h>

using namespace std;

const int INF = 1e9 + 5;

int main()
{
	int n, k;
	scanf_s("%d %d", &n, &k);
	vector <int> h(n);
	for (int &x : h)
	{
		scanf_s("%d", &h);
	}
	vector <int> dp(n, 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]));
			}
		}
	}
	printf("%d\n", dp[n - 1]);
	cin.get();
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   10 |         scanf_s("%d %d", &n, &k);
      |         ^~~~~~~
      |         scanf
Language: C++

#include<bits/stdc++.h>

using namespace std;

const int INF = 1e9 + 5;

int main()
{
	int n, k;
	scanf_s("%d %d", &n, &k);
	vector <int> h(n);
	for (auto i = 0; i < h.size(); i++)
	{
		cin >> h[i];
	}
	vector <int> dp(n, 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]));
			}
		}
	}
	printf("%d\n", dp[n - 1]);
	cin.get();
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   10 |         scanf_s("%d %d", &n, &k);
      |         ^~~~~~~
      |         scanf
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int n,i,m[600000],k,j;
vector <int> v(300000)(1e9 + 5);
int main(){
	cin>>n>>k;
  	for (i=0; i<n; i++) cin>>m[i];
  	for (i=0; i<n; i++){
      for (j = i+1; j<i+k+1; j++){
        if (j<n)
      	v[j]=min(v[j], v[i] + abs(m[i]- m[j]));
      }
    }
    cout<<v[n-1];
}


Compiler output:
a.cc:6:23: error: expected ',' or ';' before '(' token
    6 | vector <int> v(300000)(1e9 + 5);
      |                       ^
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int n,i,m[600000],k,j;
vector <int> v(600000)(INT_MAX);
int main(){
	cin>>n>>k;
  	for (i=0; i<n; i++) cin>>m[i];
  	for (i=0; i<n; i++){
      for (j = i+1; j<1+i+k; j++){
        if (j<n)
      	v[j]=min(v[j], v[i] + abs(m[i]- m[j]));
      }
    }
    cout<<v[n-1];
}


Compiler output:
a.cc:6:23: error: expected ',' or ';' before '(' token
    6 | vector <int> v(600000)(INT_MAX);
      |                       ^
Language: Java

import java.util.*;
import java.io.*;

public class HelloWorld{

     public static void main(String []args){
        FastReader sc = new FastReader();
        
        int n = sc.nextInt(), k = sc.nextInt();
        int [] heights = new int [n];
        for (int i = 0; i < n; i++) {
            heights[i] = sc.nextInt();
        }
        int [] dp = new int [n];
        
        for (int i = 1; i < n; i++) {
            dp[i] = dp[i - 1] + Math.abs(heights[i] - heights[i - 1]);
            for (int j = i - 2; j >= Math.max(0, i - k); j--) {
                dp[i] = Math.min(dp[i], dp[j] + Math.abs(heights[i] - heights[j]));
            }
        }
        
        System.out.println(dp[n - 1]);
     }
     
     static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    } 
  
}

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

#include <bits/stdc++.h> 
using namespace std; 
#define ll long long
const ll mod = 1e9+7;
const ll INF = 1LL<<60;
const double pi=3.1415926536;
#define fo(i,n) for( ll int i=0;i<n;++i)
#define fos(j,i,n) for(ll int j=i;j<n;++j)
#define N 100004
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define abs(x) ((x)<0?(-(x)):(x))
#define dis(k) cout << k << endl
#define forr(i,n) for( ll int i= n-1;i>=0;--i)
#define dbg(vari) cerr<<#vari<<" = "<<(vari)<<endl;
#define ve vector
#define fi first
#define se second
#define setzero(a) memset(a,0,sizeof(a))
#define setinf(a) memset(a,0x7F,sizeof(a))
typedef ve< ll > vi;
typedef ve< vi > vvi;
typedef pair< ll ,ll > ii;


//weird debugging stuff
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #_VA_ARGS_ ": " << (_VA_ARGS_) << "] "


/*Don't just sit and hope that God will solve this
fucking do something, try to observe or solve it a different way.
Use that pen and paper.
If nothing works take a deep breath and start again.*/


void solve(){
	ll n,k;
	cin >> n >> k;
	vi a(n);
	vi dp(n,INF);
	dp[0]=0;
	fo(i,n) cin >> a[i];
	fo(i,n) {
		for(ll j=i-1;j>=max(i-k,0ll);--j)
			dp[i]=min(dp[i],dp[j]+abs(a[i]-a[j]));
	}
	dis(dp[n-1]);
	
}

int main(){
	fast;
	int t=1;
	int tt=1;
	//cin >> t;

	while(t--){
		//cout << "Case #" << tt << ": " ;
		tt++;
		solve();
	}
	return 0;
}

Compiler output:
a.cc:56:17: error: '#' is not followed by a macro parameter
   56 | #define imie(...) " [" << #_VA_ARGS_ ": " << (_VA_ARGS_) << "] "
      |                 ^
Language: Java

import java.util.*;
public class Main {
  
 public static void main(String args[]){
   int N=0;
   Scanner obj=new Scanner(System.in);
   N=obj.nextInt();
   int h[]=new int[N];
   for(int i=0;i<N;i++){
    h[i]=obj.nextInt();
   }
   int dp[]=new int[N];
	if(N==0)
      {
System.out.println(0);
return;
}
   if(N==1)
{     	
System.out.println(0);
return;
}
   if(N<=k+1)
     {
System.out.println(Math.abs(h[0]-h[N-1]));
return;
}
   dp[0]=0;
 //  dp[1]=Math.abs(h[0]-h[1]);
   for(int i=1;i<N;i++){
dp[i]=Integer.MAX_VALUE;
   for(int j =1;j<=i && j <=k;j++){
    dp[i]= Math.min(Math.abs(h[i]-h[i-j])+dp[i-j],dp[i]);
}
   }
   System.out.println(dp[N-1]);
 }
}


Compiler output:
Main.java:23: error: cannot find symbol
   if(N<=k+1)
         ^
  symbol:   variable k
  location: class Main
Main.java:32: error: cannot find symbol
   for(int j =1;j<=i && j <=k;j++){
                            ^
  symbol:   variable k
  location: class Main
2 errors
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int n,i,m[600000],k;
vector <int> v(200000);
int main(){
	cin>>n>>k;
  	for (i=0; i<n; i++) cin>>m[i];
  	v[1] = abs(m[1]-m[0]);
  	for (i=2; i<n; i++){
      int mini = INT_MAX;
      for (int j = i; j>=i-k && j>=1; j--){
      	mini = min(v[i-j] + abs(m[i] - m[i-j]), mini );
      }
      v[i]=mini;
    }
    cout<<v[n-1];
}

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

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int n,i,m[600000],k;
vector <int> v(200000);
int main(){
	cin>>n>>k;
  	for (i=0; i<n; i++) cin>>m[i];
  	v[1] = abs(m[1]-m[0]);
  	for (i=2; i<n; i++){
      	if (i<k)
    	v[i] = min(v[i-1] + abs(m[i] - m[i-1]), v[i-2] + abs(m[i] - m[i-2]) );
      	else v[i] =  min(v[i-1] + abs(m[i] - m[i-1]),min( v[i-2] + abs(m[i] - m[i-2]),v[i-k] + abs(m[i] - m[i-k]) ));
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:15:6: error: expected '}' at end of input
   15 |     }
      |      ^
a.cc:7:11: note: to match this '{'
    7 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int n,i,m[600000],k;
vector <int> v(200000);
int main(){
	cin>>n>>k;
  	for (i=0; i<n; i++) cin>>m[i];
  	v[1] = abs(m[1]-m[0]);
  	for (i=2; i<n; i++){
      	if (i<k)
    	v[i] = min(v[i-1] + abs(m[i] - m[i-1]), v[i-2] + abs(m[i] - m[i-2]) );
      	else v[i] =  min(v[i-1] + abs(m[i] - m[i-1]),min( v[i-2] + abs(m[i] - m[i-2]),v[i-k] + abs(m[i] - m[i-k]) );
    }
                         }

Compiler output:
a.cc: In function 'int main()':
a.cc:14:116: error: expected ')' before ';' token
   14 |         else v[i] =  min(v[i-1] + abs(m[i] - m[i-1]),min( v[i-2] + abs(m[i] - m[i-2]),v[i-k] + abs(m[i] - m[i-k]) );
      |                         ~                                                                                          ^
      |                                                                                                                    )
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int n,i,m[600000],k;
vector <int> v(200000);
int main(){
	cin>>n>>k;
  	for (i=0; i<n; i++) cin>>m[i];
  	v[1] = abs(m[1]-m[0]);
  	for (i=2; i<n; i++){
      	if (i<k)
    	v[i] = min(v[i-1] + abs(m[i] - m[i-1]), v[i-2] + abs(m[i] - m[i-2]) );
      	else v[i] =  min(v[i-1] + abs(m[i] - m[i-1]),min( v[i-2] + abs(m[i] - m[i-2]),v[i-k] + abs(m[i] - m[i-k]) );
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:14:116: error: expected ')' before ';' token
   14 |         else v[i] =  min(v[i-1] + abs(m[i] - m[i-1]),min( v[i-2] + abs(m[i] - m[i-2]),v[i-k] + abs(m[i] - m[i-k]) );
      |                         ~                                                                                          ^
      |                                                                                                                    )
a.cc:15:6: error: expected '}' at end of input
   15 |     }
      |      ^
a.cc:7:11: note: to match this '{'
    7 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int n,i,m[600000],k;
vector <int> v(200000);
int main(){
	cin>>n,k;
  	for (i=0; i<n; i++) cin>>m[i];
  	v[1] = abs(m[1]-m[0]);
  	for (i=2; i<n; i++){
      	if (i<k)
    	v[i] = min(v[i-1] + abs(m[i] - m[i-1]), v[i-2] + abs(m[i] - m[i-2]) );
      	else v[i] =  min(v[i-1] + abs(m[i] - m[i-1]),min( v[i-2] + abs(m[i] - m[i-2]),v[i-k] + abs(m[i] - m[i-k]) );
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:14:116: error: expected ')' before ';' token
   14 |         else v[i] =  min(v[i-1] + abs(m[i] - m[i-1]),min( v[i-2] + abs(m[i] - m[i-2]),v[i-k] + abs(m[i] - m[i-k]) );
      |                         ~                                                                                          ^
      |                                                                                                                    )
a.cc:15:6: error: expected '}' at end of input
   15 |     }
      |      ^
a.cc:7:11: note: to match this '{'
    7 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int n,i,m[600000],k;
vector <int> v(200000);
int main(){
	cin>>n,k;
  	for (i=0; i<n; i++) cin>>m[i];
  	v[1] = abs(m[1]-m[0]);
  	for (i=2; i<n; i++){
      	if (i<k)
    	v[i] = min(v[i-1] + abs(m[i] - m[i-1]), v[i-2] + abs(m[i] - m[i-2]) );
      	else v[i] =  min(v[i-1] + abs(m[i] - m[i-1]),min( v[i-2] + abs(m[i] - m[i-2]),v[i-k] + abs(m[i] - m[i-k]) )
    }
  	cout<<v[n-1];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:116: error: expected ')' before '}' token
   14 |         else v[i] =  min(v[i-1] + abs(m[i] - m[i-1]),min( v[i-2] + abs(m[i] - m[i-2]),v[i-k] + abs(m[i] - m[i-k]) )
      |                         ~                                                                                          ^
      |                                                                                                                    )
   15 |     }
      |     ~
Language: C++

#include <bits/stdc++.h> 
#define ll long long
using namespace std;
int main() 
{ 
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n,k;
    cin>>n>>k;
    int h[n];
    for(int i=0;i<n;i++)
    {
        cin>>h[i];
    }
    ll dp[n];
    for(int i=0;i<n;i++)
    {
        dp[i]=1e12;
    }
    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[j]-h[i]));
            }
        }
    }
    /*for(int i=0;i<n;i++)
    {
        cout<<dp[i]<<" ";
    }*/
    cout<<dp[n-1]
} 


Compiler output:
a.cc: In function 'int main()':
a.cc:35:18: error: expected ';' before '}' token
   35 |     cout<<dp[n-1]
      |                  ^
      |                  ;
   36 | }
      | ~
Language: C++

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

const int nxx=1e5+5;
int arr[nxx],dp[nxx];
int n;

/*long long cost(int i){
	if(i==n) return 0;

	else if(i>n) return (long long)1e18;
	if(dp[i]!=-1) return dp[i];
	long long ans=min((cost(i+1)+abs(arr[i+1]-arr[i])),(cost(i+2)+abs(arr[i+2]-arr[i])));

	return dp[i]=ans;
}*/
int main(){
	cin>>n;
	int k;
	cin>>k;
	for(int i=1;i<=n;i++){
		cin>>arr[i];
	}
	memset(dp,-1,sizeof(dp));
	int min1=1e5+5;
	dp[n]=0;
	for(int i=n-1;i>=1;i--){
		if(i==n-1)dp[i]=dp[i+1]+abs(arr[i+1]-arr[i]);
		else{
		 	for(int j=1;j<=k;j++d){
		 		dp[i]=min(dp[i+k]+abs(arr[i+k]-arr[i]),min1);
		 	}
		}
	}
	cout<<dp[1];
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:45: error: expected ')' before 'd'
   30 |                         for(int j=1;j<=k;j++d){
      |                            ~                ^
      |                                             )
a.cc:30:45: error: 'd' was not declared in this scope
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define intl long long
int main()
{
	intl n;
	cin>>n;
	intl a[n+1];
	for(intl i=0;i<n;i++)
	{
		cin>>a[i];
	}
	intl dp[n+1];
	dp[0]=0;
	for(intl i=1;i<n;i++)
	{
		int t=1;
		int m=INT_MAX;
		int x=0;
		while(i<=k)
		{
			if(i-t>=0)
			{
			x=abs(a[i-t]-a[i])+dp[i-t];
			m=min(x,m);
		}else{
			break;
		}
		t++;
		}
		dp[i]=m;
	}
	cout<<dp[n-1];
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:26: error: 'k' was not declared in this scope
   21 |                 while(i<=k)
      |                          ^
Language: C++

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

int main(){
    LL n,k;cin>>n>>k;
    LL a[n];
    for (LL i=0;i<n;i++)
        cin>>a[i];
    LL dp[n]={0};
    for (LL i=1;i<n;i++){
        LL mn=LL_MAX;
        for (LL j=i-1;j>=0 && j>=i-k;j--){
            LL x=abs(a[i]-a[j]);
            if (i-k>=0)x+=dp[j];
            mn=min(mn,x);
        }
        dp[i]=mn;
    }
    cout<<dp[n-1];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:15: error: 'LL_MAX' was not declared in this scope; did you mean 'NL_NMAX'?
   13 |         LL mn=LL_MAX;
      |               ^~~~~~
      |               NL_NMAX
Language: C++

#include<iostream>
#include<cstring>
using namespace std;
typedef long long ll;
ll h[100001],dp[100001];
ll frog(ll n, ll k)
{
    if(n == 0) return 0;
    if(n == 1) return abs(h[0] - h[1]);

    if(dp[n] != -1)
        return dp[n];

    ll cost = INT_MAX;
    for(int i=1;i<=k && i<=n;i++)
    {
        cost = min(cost, frog(n-i, k) + abs(h[n-i] - h[n]));
    }
    dp[n] = cost;
    return dp[n];
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,i,k;
    cin >> n >> k;
    for(i=0;i<n;i++) cin >> h[i];
    memset(dp,-1,sizeof(dp));
    cout << frog(n-1, k) << endl;
    return 0;
}

Compiler output:
a.cc: In function 'll frog(ll, ll)':
a.cc:14:15: error: 'INT_MAX' was not declared in this scope
   14 |     ll cost = 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 | using namespace std;
Language: C++

        #include<iostream>
        #include<vector>
        #include<climits>
        using namespace std;
        int frog(vector<int>& v, int k){
          if(v.size()==1)
            return v[0];
          vector<int> dp(v.size());
          dp[0]=0;
          dp[1]=abs(v[1]-v[0]);
          for(int i=2; i<int(v.size()); i++){
          	dp[i] = abs(v[i-1]-v[i])+dp[i-1];
            for(int j=2;j<=k && i-j>=0;j++){
            	dp[i] = min(dp[i], abs(v[i-j]-v[i])+dp[i-j];)
            }
            
          }
          return dp[v.size()-1];
        }
        int main(){
        	int n,k, tmp;
         	cin>>n>>k;
          	vector<int> v;
          	for(int i=0;i<n;i++){
              cin>>tmp;
              v.push_back(tmp);
            }
          cout<<frog(v, k);
        	return 0;
        }

Compiler output:
a.cc: In function 'int frog(std::vector<int>&, int)':
a.cc:14:60: error: expected ')' before ';' token
   14 |                 dp[i] = min(dp[i], abs(v[i-j]-v[i])+dp[i-j];)
      |                            ~                               ^
      |                                                            )
a.cc:14:61: error: expected primary-expression before ')' token
   14 |                 dp[i] = min(dp[i], abs(v[i-j]-v[i])+dp[i-j];)
      |                                                             ^
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<unordered_set>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<string>
#include<cmath>
using namespace std;

int main() {
    int n,K;
    cin>>n>>K;
    vector<int> ht(n+1,0);
    for(int i=1;i<=n;i++)
        cin>>ht[i];
    
    vector<int> dp(n+1,INT_MAX);
    dp[0]=0;
    dp[1]=0;
    for(int i=1;i<=K;i++)   
        dp[i] = abs(ht[i]-ht[1]);
    for(int i=2;i<=n;i++) {
        for(int k=1;k<=K;k++) 
            dp[i] = min(abs(ht[i]-ht[i-k])+dp[i-k], dp[i]);
    }
    cout<<dp[n];
}


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

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

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


Compiler output:
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:23:2: error: expected '}' at end of input
   23 | }
      |  ^
a.cc:4:7: note: to match this '{'
    4 | main(){
      |       ^
Language: C++

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

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

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

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> h(N);
    for (int i = 0; i < N; i++) {
        cin >> h[i];
    }
    vector<int> score(N);
    score[0] = 0;
    score[1] = score[0] + abs(h[1]-h[0]);
    for (int i = 2; i < K; i++) {
        for (int j = 0; j < i-1; j++) {
            score[i] = min(score[j] + abs(h[j]-h[i]), score[j+1] + abs(h[j+1]-h[i]));
        }
    }
    if (N > K) {
        for (int i = K; i < N; i++) {
            for (int j = i-K; j < i-1; j++) {
                score[i] = min(score[j] + abc(h[i]-h[j]), score[j+1] + abs(h[i]-h[j+1]));
            }
        }
    }
    
    cout << score[N-1] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:43: error: 'abc' was not declared in this scope; did you mean 'abs'?
   22 |                 score[i] = min(score[j] + abc(h[i]-h[j]), score[j+1] + abs(h[i]-h[j+1]));
      |                                           ^~~
      |                                           abs
Language: Java

import java.util.*;
 
public class Main {
	public static void main (String[] args) {
      Scanner sc = new Scanner(System.in);
      
      int t = sc.nextInt();
      int k = sc.nextInt();
      
      int[] arr = new int[t];
      for(int i =0;i<t;i++){
        arr[i]= sc.nextInt();
      }
      int[] dp = new int[t];
      dp[0] = 0;

      for(int i =1;i<t;i++){
        int min = Intger.MAX_VALUE;
        for(int j =1;i<=k;i++){
          if(i-j>=0){
            min = Math.min(dp[i-j]+ Math.abs(arr[i]-arr[i-j]),min);
          }
        }
        dp[i]= min;
      }
      System.out.println(dp[dp.length-1]);
    }
  
}


Compiler output:
Main.java:18: error: cannot find symbol
        int min = Intger.MAX_VALUE;
                  ^
  symbol:   variable Intger
  location: class Main
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int INF=10000*100000;
int main(){
    int n,k,i,j; cin>>n>>k;
    vector<int> h(n), dp(n,INF);
    for(i=0;i<n;i++) cin>>h[i];
    dp[0]=0;
    for(i=1;i<n;i++){
        for(j=1;j<=k&&i+j<n;j++){
            chmin(dp[i+j], dp[i]+abs(h[i]-h[i+j]));
        }
    }
    cout<<dp[n-1]<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:13: error: 'chmin' was not declared in this scope
   11 |             chmin(dp[i+j], dp[i]+abs(h[i]-h[i+j]));
      |             ^~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

const int INF = 10000;

int main()
{
    int n, k;

    cin>>n>>k;

    int stones[n];

    for(int i = 0; i < n; i++)
    {
        cin>>stones[i];
    }

    int dp[n];

    dp[0] = 0;

    for(int i = 1; i < n; i++)
    {
        dp[i] = INF;
    }

    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(stones[j] - stones[i]));
            }
        }
    }

    cout<<dp[n-1];

    return 0;
}#include <bits/stdc++.h>

using namespace std;

const int INF = 10000;

int main()
{
    int n, k;

    cin>>n>>k;

    int stones[n];

    for(int i = 0; i < n; i++)
    {
        cin>>stones[i];
    }

    int dp[n];

    dp[0] = 0;

    for(int i = 1; i < n; i++)
    {
        dp[i] = INF;
    }

    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(stones[j] - stones[i]));
            }
        }
    }

    cout<<dp[n-1];

    return 0;
}

Compiler output:
a.cc:43:2: error: stray '#' in program
   43 | }#include <bits/stdc++.h>
      |  ^
a.cc:43:3: error: 'include' does not name a type
   43 | }#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc:47:11: error: redefinition of 'const int INF'
   47 | const int INF = 10000;
      |           ^~~
a.cc:5:11: note: 'const int INF' previously defined here
    5 | const int INF = 10000;
      |           ^~~
a.cc:49:5: error: redefinition of 'int main()'
   49 | int main()
      |     ^~~~
a.cc:7:5: note: 'int main()' previously defined here
    7 | int main()
      |     ^~~~
Language: Java

import java.util.*;
import java.io.*;
public class frogs_2{
	
	public static void main(String[] args)
	{
		FastScanner fs=new FastScanner();
		int n=fs.nextInt();
		int k=fs.nextInt();
		int arr[]=fs.readArray(n);
		int dp[]=new int[n];
		Arrays.fill(dp,(int)1e9);
		dp[0]=0;
		for(int i=1;i<n;i++)
		{
			for(int j=i>=k ? i-k:0;j<i;j++)
			{
				dp[i]=Math.min(dp[i],dp[j]+Math.abs(arr[j]-arr[i]));
			}
		}
//		System.out.println(Arrays.toString(dp));
		System.out.println(dp[n-1]);
	}
}
class FastScanner 
{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		
		public String next() 
		{
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
			
		}
		long pow(long x,long n)
		{
			long res=1;
			while(n>0)
			{
			   	if(n%2!=0)
			   	{
			   		res=(res*x);n--;
			   	}
			   	else
			   	{
			   		x=(x*x);n/=2;
			   	}
			}
			return res;
		}
		int gcd(int a,int b)
		{
			if(b==0)
			{
				return a;
			}
			return gcd(b,a%b);
		}
		long longgcd(long a,long b)
		{
			if(b==0)
			{
				return a;
			}
			return longgcd(b,a%b);
		}
		int[] sort(int arr[])
		{
			ArrayList<Integer> list = new ArrayList<Integer>();
			for(int i:arr)list.add(i);
			Collections.sort(list);
			for(int i=0;i<arr.length;i++)
			{
				arr[i]=list.get(i);
			}
			return arr;
		}
		char[] charsort(char arr[])
	        {
	    	ArrayList<Character> list = new ArrayList<>();
	    	for(char c:arr)list.add(c);
	    	Collections.sort(list);
	    	for(int i=0;i<list.size();i++)
	    	{
	    		arr[i]=list.get(i);
	    	}
	    	return arr;
	        }
		long[] longsort(long arr[])
		{
			ArrayList<Long> list = new ArrayList<Long>();
			for(long i:arr)list.add(i);
			Collections.sort(list);
			for(int i=0;i<arr.length;i++)
			{
				arr[i]=list.get(i);
			}
			return arr;
		}
		public int nextInt() 
		{
			return Integer.parseInt(next());
		}
		public int[] readArray(int n)
		{
			int[] arr=new int[n];
			for (int i=0; i<n; i++) arr[i]=nextInt();
			return arr;
		}	
		public long nextLong()
		{
			return Long.parseLong(next());
		}
		public double nextDouble()
		{
			return Double.parseDouble(next());
		}
		public long[] longreadArray(int n) 
		{
			long[] a=new long[n];
			for (int i=0; i<n; i++) a[i]=nextLong();
			return a;
		}
}

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

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n, k;
  cin>>n>>k;
  vector<int> v(n);
  for(int i=0;i<n;i++)
    cin>>v[i];
  vector<int> dp(n, 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(v[j]-v[i]));
    }
  }
  cout<<dp[n-1]<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:21: error: 'INF' was not declared in this scope
    9 |   vector<int> dp(n, INF);
      |                     ^~~
Language: C++


#include<bits/stdc++.h>

using namespace std;

const int INF=1e9+5;

int main()
{
    int n,k;
    cin>>n>>k;
    vector<int>h(n);
    for(int i=0;i<n;i++)
        cin>>h[i];

    vector<int>dp(n,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]<<"\n";
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:25: error: expected ';' before '<=' token
   20 |          for(int j=i+1,j<=i+k;j++)
      |                         ^~
      |                         ;
a.cc:20:25: error: expected primary-expression before '<=' token
   20 |          for(int j=i+1,j<=i+k;j++)
      |                         ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> inline bool chmax(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;

const long long INF = 1LL<<60;

long long h[100010];

long long dp[100010];

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

  return 0;
}

Compiler output:
a.cc:5:31: error: redefinition of 'template<class T> bool chmax(T&, T)'
    5 | template<class T> inline bool chmax(T& a, T b) { if (a > b) { a = b; return true; } return false; }
      |                               ^~~~~
a.cc:4:31: note: 'template<class T> bool chmax(T&, T)' previously declared here
    4 | template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
      |                               ^~~~~
a.cc:8:17: error: redefinition of 'const long long int INF'
    8 | const long long INF = 1LL<<60;
      |                 ^~~
a.cc:6:17: note: 'const long long int INF' previously defined here
    6 | const long long INF = 1LL<<60;
      |                 ^~~
a.cc: In function 'int main()':
a.cc:25:7: error: 'chmin' was not declared in this scope
   25 |       chmin(dp[i], dp[i-j] + abs(h[i] - h[i - j]));
      |       ^~~~~
Language: C++

#include<iostream>
#include<cmath>
#include<vector>
using namespace std;



int go(int *a,int n,int k){
  vector<int> dp(n,INT_MAX);
  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(a[i]-a[j]));
  return dp[n-1];
}

int main(){
 int n,k;
 cin>>n>>k;
 int a[n];
 for(int i=0;i<n;i++) cin>>a[i];
 cout<<go(a,n,k)<<endl;
 return 0; 
}

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

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    int k;
    cin>>n>>k;
    int h[n];
    for(int i = 0; i<n; i++)
        cin>>h[i];
    vector<int> dp(n, 1000000000)
    dp[0] = 0;
    dp[1] = abs(h[0] - h[1]);
    for(int i = 2; 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]<<"\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: expected ',' or ';' before 'dp'
   11 |     dp[0] = 0;
      |     ^~
Language: C

	#include <bits/stdc++.h>

	using namespace std;

	#define ff first
	#define ss second
	#define ll long long
	#define pb push_back
	#define mp make_pair
	#define pii pair<int,int>
	#define vi vector<int>
	#define vb vector<bool>
	#define mii map<int,int>
	#define swap(a,b) int c=a;a=b;b=c;
	// min max heap
	#define pqb priority_queue<int>
	#define pqs priority_queue<int,vi,greater<int> >

	#define gcd(x,y) __gcd(x,y)

	#define setbits(x) __builtin_popcountll(x)
	#define zrobits(x) __builtin_ctzll(x) // count zeros before first one
	#define mod 1000000007
	#define inf 1e18
	#define fl(i,start,end) for(int i=start;i<=end;i++)
	#define input(arr,start,end) for(int i=start;i<=end;i++) cin>>arr[i];
	#define printArray(arr,start,last) for(int i=start;i<=last;i++) cout<<arr[i]<<" ";cout<<endl;
	// set precesion
	#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--)
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	const long int  N = 1000007;
	vector<ll> primes;
	const long int modl = 1e9 + 7;
	vi graph[1000];

	pii ext_eucl(int a, int b) {
		if (b == 0)
			return make_pair(1, b);

		pii pr = ext_eucl(b, a % b);
		return make_pair(pr.ss, pr.ff - (a / b) * pr.ss);
	}

	ll power(ll x, ll y, ll p = modl) {
		ll res = 1;
		x = x % p;
		while (y > 0) {
			if (y & 1)
				res = (res * x) % p;
			y = y >> 1;
			x = (x * x) % p;
		}
		return res;
	}

	// shuffle(arr,arr+n,rng)
	// shuffler
	// w(t) {

	// 	mk(arr, 5, int);
	// 	for (int i = 0; i < 5; ++i)
	// 	{
	// 		cin >> arr[i];
	// 	}

	// 	shuffle(arr, arr + 5, rng);

	// 	for (int i = 0; i < 5; ++i)
	// 	{
	// 		/* code */
	// 		cout << arr[i] << " ";
	// 	}
	// }


	void c_p_c() {
		ios_base::sync_with_stdio(0);
		cin.tie(0);
		cout.tie(0);

	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif

	}


	void printAdjacencyList(int n) {
		for (int i = 1; i <= n; i++) {
			cout << i << " : ";
			for (int child : graph[i]) {
				cout << child << " ";
			}
			cout << endl;
		}
	}

	void solve() {
		int n, k;

		cin >> n >> k;

		vi v(n);
		vi frog(n, INT_MAX);
		for (int i = 0; i < n; i++) {
			cin >> v[i];

			for (int j = i - 1; ((j >= 0) && ((i - j) <= k)); j--) {
				frog[i] = min(frog[i], abs(v[i] - v[j]) + frog[j]);
			}

			if (i == 0)
				frog[i] = 0;

		}

		cout << frog[n - 1] << endl;
	}

	int32_t main() {
	
		solve();

		return 0;
	}

Compiler output:
main.c:1:18: fatal error: bits/stdc++.h: No such file or directory
    1 |         #include <bits/stdc++.h>
      |                  ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include <vector>
using namespace std;
// int n, k, heights[100000] = {40, 10, 20, 70, 80, 10, 20, 70, 80, 60};
int n, k, heights[100000];
std::vector<int> dp(100,-1);

int min_cost(int ind)
{
	int branch_cost[k];
	if(dp.at(ind) != -1)
		return dp.at(ind);
	if(ind == n-1)
		return 0;
	if(ind >= n)
		return INT_MAX;

	for(int i=0; i<k; i++)
	{
		// cout<<"\n"<<heights[ind]<<"\t"<<heights[ind+1]<<"\t"<<heights[ind+2]<<endl;
		if(ind+i+1 < n)
		{
			// cout<<"\n i that passes : "<<ind;
			// cout<<"\n diff: "<<abs(heights[ind] - heights[ind+i+1]);
			branch_cost[i] = abs(heights[ind] - heights[ind+i+1]) + min_cost(ind+i+1);
			// cout<<"\nbranch cost for branch "<<i<<" "<<branch_cost[i];
		}
	}

	int min = INT_MAX;
	for(int i=0; i<k; i++)
	{
		if(branch_cost[i] < min && ind+i+1 < n)
			min = branch_cost[i];
	}

	dp.at(ind) = min;
	return min;
}

int main()
{
	// cout<<"Enter no of stones:";
	cin>>n;
	// n = 10;
	// cout<<"\nEnter K:";
	cin>>k;
	// k = 4;
	// cout<<"\nEnter heights:";
	for(int i=0; i<n; i++)
		cin>>heights[i];
	// heights = {10, 30, 40, 50, 20};

	// cout<<"\nmin_cost:"<<min_cost(0);
	cout<<min_cost(0);
}

Compiler output:
a.cc: In function 'int min_cost(int)':
a.cc:16:24: error: 'INT_MAX' was not declared in this scope
   16 |                 return 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 | using namespace std;
a.cc:30:19: error: 'INT_MAX' was not declared in this scope
   30 |         int min = INT_MAX;
      |                   ^~~~~~~
a.cc:30:19: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

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

int main() {
    long int n,v,pos;
    cin>>n>>v;
    long int b[n],c[n];
   for(int i=0;i<n;i++){
       cin>>b[i];
   }
   c[0]=0;
   c[1]=abs(b[0]-b[1]);
   for(int i=2;i<n;i++){
       c[i]=9999999999;
       for(int k=1;k<=v&&k<=i;k++){
       
         c[i]=min(abs(b[i]-b[i-k])+c[i-k],c[i]);
      
   }
   cout<<c[n-1];
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:2: error: expected '}' at end of input
   22 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

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

int main() {
    long int n,v,sum=0,pos;
    cin>>n>>v;
    long int b[n],c[n];
   for(int i=0;i<n;i++){
       cin>>b[i];
   }
   c[0]=0;
   c[1]=abs(b[0]-b[1]);
   for(int i=2;i<n;i++){
       long int min=999999;
       for(int k=1;k<=v&&k<=i;k++){
       if(abs(b[i-k]-b[i])<min){
           min=abs(b[i]-b[i-k]);
           pos=i-k;
       }
       else if(abs(b[i-k]-b[i])==min){
           pos=c[pos]<c[i-k]?pos:i-k;
       }
       
       }
       
       c[i]=c[pos]+min;
       
   }

Compiler output:
a.cc: In function 'int main()':
a.cc:28:5: error: expected '}' at end of input
   28 |    }
      |     ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

{
    long int n,v,sum=0,pos;
    cin>>n>>v;
    long int b[n],c[n];
   for(int i=0;i<n;i++){
       cin>>b[i];
   }
   c[0]=b[0];
   c[1]=abs(b[0]-b[1]);
   for(int i=2;i<n;i++){
       long int min=999999;
       for(int k=1;k<=v&&k<=i;k++){
       if(abs(b[i-k]-b[i])<min){
           min=abs(b[i]-b[i-k]);
           pos=i-k;
       }
       else if(abs(b[i-k]-b[i])==min){
           if(i>0)
           pos=c[pos]<c[i-k]?pos:i-k;
           else if(i==0)
           pos=0;
           
       }
       
       }
       if(pos==0)
       c[i]=min;
       else
       c[i]=c[pos]+min;
       
   }
  
   cout<<c[n-1];
	return 0;
}

Compiler output:
a.cc:1:1: error: expected unqualified-id before '{' token
    1 | {
      | ^
Language: C++

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

#define FOR(i,a,b)    for (int i=(a)  ;i<(b) ;i++)
#define RFOR(i,a,b)   for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)      for (int i=0    ;i<(n) ;i++)
#define RREP(i,n)     for (int i=(n)-1;i>=0  ;i--)
#define EACH(i,a,b)   for (int i=(a)  ;i<=(b);i++)
#define REACH(i,a,b)  for (int i=(b)  ;i>=(a);i--)
#define ALL(a)        (a).begin(),  (a).end()
#define RALL(a)       (a).rbegin(), (a).rend()

const int MOD = 1e9 + 7;
const int INF = 1 << 29;
const double EPS = 1e-10;

using ll = long long;
using P = pair<int,int>;
template<class T = int> using V = vector<T>;

template<class T> bool inline chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool inline chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T = int> T inline input() { T x; cin >> x; return (x); }
template<class T> void inline print(T& x) { cout << x << '\n'; }
#define debug(x) cerr << #x << ": " << x << endl;

int dp[100100];

signed main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);

  int N,K;
  cin >> N >> K;
  int h[N];
  REP(i,N) cin >> h[i];

  REP(i,N) dp[i] = MOD;
  dp[0] = 0;

  REP(i,N) {
    EACH(k,1,K) {
      if (i-k < 0) breayuu;
      chmin(dp[i], dp[i-k] + abs(h[i] - h[i-k]));
    }
  }

  print(dp[N-1]);

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:20: error: 'breayuu' was not declared in this scope
   43 |       if (i-k < 0) breayuu;
      |                    ^~~~~~~