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

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define inf 1e9+10
int main(){
    int n;
    ll w;
    int v[n+1];
    ll w[n+1];
    cin>>n>>w;
    ll max=n*1000+1;
    ll a[n+1][max];
    for(int i=1;i<=n;i++)
    cin>>w[i]>>v[i];
    for(int i=0;i<max;i++)
    a[1][i]=inf;
    a[i][v[1]]=w[1];
    a[1][0]=0;
    for(int i=2;i<=n;i++){
        for(int j=0;j<max;j++){
            if(v[i]>j)
            a[i][j]=a[i-1][j];
            else
            a[i][j]=min(a[i-1][j],w[i]+a[i-1][j-v[i]]);
        }
    }
    for(int i=1;i<max;i++){
        if(a[n][i]<=W)
        ans=i;
    }
    cout<<ans;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:8: error: conflicting declaration 'long long int w [(n + 1)]'
    9 |     ll w[n+1];
      |        ^
a.cc:7:8: note: previous declaration as 'long long int w'
    7 |     ll w;
      |        ^
a.cc:14:11: error: invalid types 'long long int[int]' for array subscript
   14 |     cin>>w[i]>>v[i];
      |           ^
a.cc:17:7: error: 'i' was not declared in this scope
   17 |     a[i][v[1]]=w[1];
      |       ^
a.cc:17:17: error: invalid types 'long long int[int]' for array subscript
   17 |     a[i][v[1]]=w[1];
      |                 ^
a.cc:24:36: error: invalid types 'long long int[int]' for array subscript
   24 |             a[i][j]=min(a[i-1][j],w[i]+a[i-1][j-v[i]]);
      |                                    ^
a.cc:28:21: error: 'W' was not declared in this scope
   28 |         if(a[n][i]<=W)
      |                     ^
a.cc:29:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   29 |         ans=i;
      |         ^~~
      |         abs
a.cc:31:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   31 |     cout<<ans;
      |           ^~~
      |           abs
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
	int length;
    int temp;
    int min;
    cin >> length;
    vector<int> inp;
    for(int i=0;i<length;i++){
    	
        cin >> temp;
        inp.push_back(temp);
    	
      
    }
    //int dp[(int)inp.size()][(int)inp.size()];
    int dp[(int)inp.size()*(int)inp.size()];
    int counter_1=0;
    int counter_2 = 0;
    int counter = 0;
    while(counter<(int)inp.size()){
    	if(counter_1==counter_2) dp[counter_1*(int)inp.size()+counter_2]=0;
        if(counter_2-counter_1==1) dp[counter_1*(int)inp.size()+counter_2]=abs(inp[counter_2]-inp[counter_1]);
        if(counter_2-counter_1==2){
            if(dp[counter_1*(int)inp.size()+counter_2-1]+dp[(counter_2-1)*(int)inp.size()+counter_2]>abs(inp[counter_2]-inp[counter_1])) dp[counter_1*(int)inp.size()+counter_2]=abs(inp[counter_2]-inp[counter_1]);
            else dp[counter_1*(int)inp.size()+counter_2] = dp[counter_1*(int)inp.size()+counter_2-1]+dp[(counter_2-1)*(int)inp.size()+counter_2];
        	
            
        }
        if(counter_2-counter_1>2){
        	min = INT_MAX;
            for(int i=counter_1+1;i<counter_2;i++){
            	temp = dp[counter_1*(int)inp.size()+i]+dp[(i)*(int)inp.size()+counter_2];
                if(temp<min) min = temp;
            }
            dp[counter_1*(int)inp.size()+counter_2] = min;
        }
        if(counter_2==((int)inp.size()-1)){
        	counter++;
            counter_1 = 0;
            counter_2 = counter;
            continue;
        }
        counter_1++;
        counter_2++;
    }
    cout << dp[0][inp.size()-1];
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:18: error: invalid types 'int[std::vector<int>::size_type {aka long unsigned int}]' for array subscript
   47 |     cout << dp[0][inp.size()-1];
      |                  ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
	int length;
    cin >> length;
    vector<int> inp;
    for(int i=0;i<length;i++){
    	int temp;
        cin >> temp;
        inp.push_back(temp);
    	
      
    }
    int dp[inp.size()][inp.size()];
    int counter_1=0;
    int counter_2 = 0;
    counter = 0;
    while(counter<inp.size()){
    	if(counter_1==counter_2) dp[counter_1][counter_2]=0;
        if(counter_2-counter_1==1) dp[counter_1][counter_2]=abs(inp[counter_2]-inp[counter_1]);
        if(counter_2-counter_1==2){
            if(dp[counter_1][counter_2-1]+dp[counter_2-1][counter_2]>abs(inp[counter_2]-inp[counter_1])) dp[counter_1][counter_2]=abs(inp[counter_2]-inp[counter_1]);
            else dp[counter_1][counter_2] = dp[counter_1][counter_2-1]+dp[counter_2-1][counter_2];
        	
            
        }
        if(counter_2-counter_1>2){
        	int min = INT_MAX;
            for(int i=counter_1+1;i<counter_2;i++){
            	temp = dp[counter_1][i]+dp[i][counter_2];
                if(temp<min) min = temp;
            }
            dp[counter_1][counter_2] = min;
        }
        if(counter_2==inp.size()-1){
        	counter++;
            counter_1 = 0;
            counter_2 = counter;
            continue;
        }
        counter_1++;
        counter_2++;
    }
    cout << dp[0][inp.size()-1];
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:5: error: 'counter' was not declared in this scope; did you mean 'counter_2'?
   17 |     counter = 0;
      |     ^~~~~~~
      |     counter_2
a.cc:30:17: error: 'temp' was not declared in this scope; did you mean 'tm'?
   30 |                 temp = dp[counter_1][i]+dp[i][counter_2];
      |                 ^~~~
      |                 tm
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define inp(arr,n) ll arr[n];for(ll i=0;i<n;i++)cin>>arr[i]
#define f(i,a,b) for(ll i=a;i<b;i++)
#define no cout<<"NO\n"
#define yes cout<<"YES\n"
#define maxi(a,n) *max_element(a,a+n)
#define mini(a,n) *min_element(a,a+n)
#define print(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" "
#define PI 3.1415926535897932

int gcd(int A, int B) {if(B == 0) return A; else return gcd(B, A % B);}

int main() {
    ll n;
    cin>>n;
    
    ll b[n];
    inp(a,n);
    
    b[0]=0;
    b[1]=abs(a[0]-a[1])
    
    f(i,2,n)
    {
        b[i] = min(b[i-1] + abs(a[i]-a[i-1]), b[i-2] + abs(a[i]-a[i-2]));
    }
    
    cout<<b[n-1]<<endl;

return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:24: error: expected ';' before 'for'
   23 |     b[1]=abs(a[0]-a[1])
      |                        ^
      |                        ;
a.cc:25:7: error: 'i' was not declared in this scope
   25 |     f(i,2,n)
      |       ^
a.cc:5:29: note: in definition of macro 'f'
    5 | #define f(i,a,b) for(ll i=a;i<b;i++)
      |                             ^
Language: C++

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

//for loop
#define rep(i,a,n) for(int i=(a);i<(n);++i)
#define repe(i,a,n) for(int i=(a);i<=(n);++i)
#define rrep(i,n,a) for(int i=(n);n>(a);--i)
#define rrepe(i,n,a) for(int i=(n);n>=(a);--i)

//abbreviati
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define ENDL << "\n"

using ll = long long;
using P = pair<int,int>;
using itn = int;

//constant
const int INF = 1<<30;
const ll MOD = 1000000007;
const long double PI =(acos(-1));

/***Snippet**************************************
ifelse, isprime, torad, todeg, lcm, bfs,chmin
************************************************/

//adjacency list
vector<int> to[100005];

template<class T>inline bool chmin(T &a,T b){ if(a>b){a=b; return1;} return 0;}
template<class T>inline bool chmax(T &a,T b){ if(a<b){a=b; return1;} return 0;}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n; cin >> n;
    vector<ll> h(100006);
    rep(i,0,n) cin >> h[i];
    vector<ll> dp(100006);
    //vector<ll> cost(1000006);
    // rep(i,1,n){
    //     if(i==1) cost[i]=abs(h[i]-h[i-1]);
    //     else if(cost[i-1]+abs(h[i]-h[i-1])>cost[i-2]+abs(h[i]-h[i-2])){
    //         cost[i]=cost[i-2]+abs(h[i]-h[i-2]);
    //     }else{
    //         cost[i]=cost[i-1]+abs(h[i]-h[i-1]);
    //     }
    // }

    rep(i,1,n){
        chmin(dp[i],dp[i-1]+abs(h[i]-h[i-1]));
        if(i>1){
            chmin(dp[i],dp[i-2]+abs(h[i]-h[i-2]));
        }
    }


    cout << dp[n-1] ENDL;



    
    return 0;
}

Compiler output:
a.cc: In function 'bool chmin(T&, T)':
a.cc:34:60: error: 'return1' was not declared in this scope
   34 | template<class T>inline bool chmin(T &a,T b){ if(a>b){a=b; return1;} return 0;}
      |                                                            ^~~~~~~
a.cc: In function 'bool chmax(T&, T)':
a.cc:35:60: error: 'return1' was not declared in this scope
   35 | template<class T>inline bool chmax(T &a,T b){ if(a<b){a=b; return1;} return 0;}
      |                                                            ^~~~~~~
Language: C++

#include <bits/stdc++.h>
const int INF = 1e9 + 5;
using namespace std;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >>  n;
	vector<int> h(n);
	for(int& x : h) {
		scanf("%d", &x);	
	}
	vector<int> dp(n, INF);
	dp[0] = 0;
	for(int i = 0;i<n;i++) {
		for(int j : {i+1, i+2}) {
			if(j < n) 
				dp[j] = min(dp[j], dp[i] + abs(h[i] - h[j]));
			}
		}
	}
	cout <<  dp[n];
}

Compiler output:
a.cc:22:9: error: 'cout' does not name a type
   22 |         cout <<  dp[n];
      |         ^~~~
a.cc:23:1: error: expected declaration before '}' token
   23 | }
      | ^
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Frog_dp {
	public static void main(String[] args) throws IOException {
		Reader.init(System.in);

		int n=Reader.nextInt();
		int[] h= new int[n+1];
		for(int i=1; i<=n; i++) {
			h[i]=Reader.nextInt();
		}
		
		int[] dp= new int[n+1];
		dp[1]=0;
		dp[2]= Math.abs(h[2]-h[1]);
		
		for(int i=3; i<=n; i++) {
			dp[i]= Math.min(dp[i-1]+ Math.abs(h[i]-h[i-1]),
					dp[i-2]+ Math.abs(h[i]-h[i-2]));
		}
		System.out.println(dp[n]);
}
}

class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;
    static void init(InputStream input) {
        reader = new BufferedReader(
                     new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }

    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {

        	tokenizer = new StringTokenizer(
                   reader.readLine() );
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt( next() );
    }
	
    static double nextDouble() throws IOException {
        return Double.parseDouble( next() );
    }
    static long nextLong() throws IOException {
        return Long.parseLong( next() );
    }
    

}

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

//g++ t.cpp -o t && t < p.txt
//d>p.txt&&t<p.txt&&t2<p.txt

#include <iostream> // プログラムの耳と口
#include <vector> // 超有能配列秘書
#include <algorithm> // みんな大好きソートと二分探索
#include <queue> // きゅーちゃん、だいすき
#include <string> // to_string
#include <functional> // 関数を変数に入れる子
#include <set> // 値の取得・挿入・削除を高速に
#include <map> // setの妹 これまた優秀
#include <random> // 乱択さん
#include <cassert>

#define DB cerr<<"D"<<endl
using namespace std; using ll=long long; using ld=long double; const int INF=1e9; const ll LINF=1e18; const double dINF = 1e18; const ld ldINF = 1e18; const double EPS = 1e-6;
template<typename T, typename U, typename O> void caut(T a, U b, O c){cout<<"("<<a<<","<<b<<","<<c<<") ";} template<typename T, typename U> void caut(T a, U b){cout<<"("<<a<<","<<b<<") ";} template<typename T> void caut(T a){cout<<"("<<a<<") ";};
using P=pair<ll,ll>;
const ll M = 1e9+7;
ll mod_pow(ll x, ll a) { ll an = 1; while(a > 0) { if (a&1) an = an * x % M; x = x * x % M; a >>= 1;} return an;}
void add(ll& x, ll y) {x+=y; x%=M;}; void mul(ll& x, ll y) {x*=y; x%=M;}; template<typename T, typename U> void chmax(T& x, U y) {if (x<y) x=y;}; template<typename T, typename U> void chmin(T& x, U y) {if (x>y) x=y;}
bool vaild(int x, int y, int hh, int ww){return 0<=x&&x<hh&&0<=y&&y<ww;}
int keta(ll a) {int res=0; while(a>0) res+=(a%10/5)+(a%5), a/=10; return res;}

int main() {
  int n; cin>>n;
  int h[n]; for(int i=0;i<n;i++) cin>>h[i];
  int dp[n]; fill(dp,dp+n,1e9); dp[0]=0;
  for(int i=0;i<n;i++) {
    if (i+2<n) chmin(dp[i+2],dp[i]+abs(h[i]-h[i+2]);
    if (i+1<n) chmin(dp[i+1],dp[i]+abs(h[i]-h[i+1]);
  }
  cout<<dp[n-1]<<endl;
}
// ・配列の大きさok？　・priority_queueはgreater？　・debug消した？
// ・落ち着いて。提出まで4分待ってね……WJ……1/10……2/10……

// Thank you for making problems and running the contest

Compiler output:
a.cc: In function 'int main()':
a.cc:30:52: error: expected ')' before ';' token
   30 |     if (i+2<n) chmin(dp[i+2],dp[i]+abs(h[i]-h[i+2]);
      |                     ~                              ^
      |                                                    )
a.cc:31:52: error: expected ')' before ';' token
   31 |     if (i+1<n) chmin(dp[i+1],dp[i]+abs(h[i]-h[i+1]);
      |                     ~                              ^
      |                                                    )
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:15:3: error: expected primary-expression before 'for'
   15 |   for(int i=2;i<n;i++){
      |   ^~~
a.cc:14:6: error: expected ']' before 'for'
   14 |   dp[
      |      ^
      |      ]
   15 |   for(int i=2;i<n;i++){
      |   ~~~ 
a.cc:15:15: error: 'i' was not declared in this scope
   15 |   for(int i=2;i<n;i++){
      |               ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vec vector<int>
#define f(i,o,n) for(int i=o;i<n;i++)

int main()
{
    ll n;
    cin>>n;
    vec h(n);
    f(i,0,n)
        cin>>h[i];
    vec a(n+1);
    a[1] = 0;
    a[2]= abs(h[1]-h[0]);
    f(i,2,n)
    {
        a[i+1] = min((a[i-1]+abs(h[i]-h[i-1])), a[i-2]+abs(h[i]-h[i-2]))
    }
    cout<<a[n];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:73: error: expected ';' before '}' token
   19 |         a[i+1] = min((a[i-1]+abs(h[i]-h[i-1])), a[i-2]+abs(h[i]-h[i-2]))
      |                                                                         ^
      |                                                                         ;
   20 |     }
      |     ~
Language: C++

#include<iostream>
using namespace std;

int main()
{
  int n;
  cin>>n;
  int * arr = new int[n];
  int * dp = new int [n+1];
  memset(dp,-1,sizeof(dp));
  
  for(int i=0;i<n;i++)
    cin>>arr[i];
  
  dp[0]=arr[0];
  dp[1]=abs(arr[1]-arr[0]);

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

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


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.StringTokenizer;

public class Frog1 {

	@SuppressWarnings("unused")
	public static void main(String[] args) {
		FastScanner in = new FastScanner();
//		int T = in.nextInt();
//		outer: for (int tt = 0; tt < T; tt++) {
//		}
		int n = in.nextInt();
		int a[] = in.readArray(n);
		int dp[] = new int[n + 1];
		Arrays.fill(dp, -1);
		System.out.println(frog1(dp, a, n - 1));
	}

	public static int frog1(int dp[], int a[], int N) {
		if (N == 0)
			return 0;

		if (dp[N] != -1)
			return dp[N];
		int ans = 0, ans1 = Integer.MAX_VALUE, ans2 = Integer.MAX_VALUE;
		if (N - 1 >= 0) {
			ans1 = (Math.abs(a[N] - a[N - 1]) + frog1(dp, a, N - 1));
		}
		if (N - 2 >= 0) {
			ans2 = (Math.abs(a[N] - a[N - 2]) + frog1(dp, a, N - 2));
		}
		ans = Math.min(ans1, ans2);
		dp[N] = ans;
		return ans;

	}

	static void sort(int[] a) {
		ArrayList<Integer> l = new ArrayList<>();
		for (int i : a)
			l.add(i);
		Collections.sort(l);
		for (int i = 0; i < a.length; i++)
			a[i] = l.get(i);
	}

	static class FastScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String next() {
			while (!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

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

		int[] readArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

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

}

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

#include<bits/stdc++.h>
#define ll long long
#define endl '/n'
using namespace std;
int main()
{
vector<ll>arr;
  ll n,k,cost=0;
  cin>>n;
  for(ll i=0;i<n;i++)
  {
    cin>>k;
    arr.push_back(k);
  }
  i=0;
  while(i<=n-1)
  {
    if(i<=n-3)
    {cost=cost+min(mod(arr[i]-arr[i+1]),mod(arr[i]-arr[i+2]));
    i=(mod(arr[i]-arr[i+1])>mod(arr[i]-arr[i+2])?i+2:i+1;}
    else if(i==n-2){cost=cost+arr[n-1]};
  }
       cout<<cost<<endl;

Compiler output:
a.cc:23:20: warning: multi-character character constant [-Wmultichar]
   23 |        cout<<cost<<endl;
      |                    ^~~~
a.cc: In function 'int main()':
a.cc:15:3: error: 'i' was not declared in this scope
   15 |   i=0;
      |   ^
a.cc:19:20: error: 'mod' was not declared in this scope; did you mean 'modf'?
   19 |     {cost=cost+min(mod(arr[i]-arr[i+1]),mod(arr[i]-arr[i+2]));
      |                    ^~~
      |                    modf
a.cc:20:57: error: expected ')' before ';' token
   20 |     i=(mod(arr[i]-arr[i+1])>mod(arr[i]-arr[i+2])?i+2:i+1;}
      |       ~                                                 ^
      |                                                         )
a.cc:21:39: error: expected ';' before '}' token
   21 |     else if(i==n-2){cost=cost+arr[n-1]};
      |                                       ^
      |                                       ;
a.cc:23:25: error: expected '}' at end of input
   23 |        cout<<cost<<endl;
      |                         ^
a.cc:6:1: note: to match this '{'
    6 | {
      | ^
Language: Java


import java.util.*;



import java.io.*;
public class A {

	public static void main(String[] args) {
	FastScanner sc=new FastScanner();
	int n=sc.nextInt();
	int a[]=sc.readArray(n);
	if(n<=1)
		System.out.println("0");
	else {
		int dp[]=new int[n];
		dp[0]=0;
		dp[1]=Math.abs(a[1]-a[0]);
		
		for(int i=2;i<n;i++)
		{
			dp[i]=Math.min(dp[i-1]+Math.abs(a[i]-a[i-1]), dp[i-2]+Math.abs(a[i]-a[i-2]));
		}
		System.out.println(dp[n-1]);
		
	}

	}
	static class FastScanner{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		
		String next() {
			while (!st.hasMoreTokens())
				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());
		}
		int [] readArray(int n) {
			int a[]=new int[n];
			for(int i=0;i<n;i++) a[i]=nextInt();
			return a;
		}
		
		
	}
	

}


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

#include<bits/stdc++.h>
using namespace std;
#define flp(i,x,y) for( int i=x;i<y;i++)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int main()
	{
		//#ifndef ONLINE_JUDGE
		//freopen("input.txt","r",stdin);
		//freopen("ou.txt","w",stdout);
		//#endif
		fastio 
		//long long int T,i,r,c0=0,c1=0,c2=0,ctr,m,n,a,b,c,d,u,v,t,mx=1,g,f,l1,l2,sum=0,o,m1,m2,x,x2,y1,y2,x1,y,k,p,num=1,step,l,z;
	//long	double ar;
	int k1,k2,k3,p1=-1,p2=-1,p3=-1,p5=-1,p4=-1,j,pd=0,U=-1e9;
	T=1;
		//cin>>T;
		bool res=false;
		while(T--)
		{
			res=false;
			int n;
			cin>>n;
			ll h[n+1];
			int f[n+1];
			f[0]=0;
			flp(i,1,n+1)
			cin>>h[i];
			f[1]=0;
			flp(i,2,n+1)
			{
				f[i]=min((abs(h[i]-h[i-1])+f[i-1]),(abs(h[i]-h[i-2])+f[i-2]));
			}
			cout<<f[n]<<"\n";

								

				}
		return 0;
			}
			

Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: 'T' was not declared in this scope
   15 |         T=1;
      |         ^
a.cc:23:25: error: 'll' was not declared in this scope
   23 |                         ll h[n+1];
      |                         ^~
a.cc:27:30: error: 'h' was not declared in this scope
   27 |                         cin>>h[i];
      |                              ^
a.cc:31:47: error: 'h' was not declared in this scope
   31 |                                 f[i]=min((abs(h[i]-h[i-1])+f[i-1]),(abs(h[i]-h[i-2])+f[i-2]));
      |                                               ^
Language: Java

// package div2658.dpatcoder;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Frog1 {
    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; 
        } 

    }

    public static void main(String[] args) {
        FastReader fs = new FastReader();
        int n = fs.nextInt();
        int[] h = new int[n];
        
        for (int i = 0; i < n; i++) {
            h[i] = fs.nextInt();
        }

        int[] dp = new int[n];

        dp[n-1] = 0;

        for (int i = n-2; i >= 0; i--) {
            int curr = Integer.MAX_VALUE;
            for (int k = 1; k <= 2; k++) {
                if (i+k < dp.length) {
                    curr = Math.min(curr, Math.abs(h[i] - h[i+k]) + dp[i+k]);
                }
            }
            dp[i] = curr;
        }

        System.out.println(dp[0]);

    }




}


Compiler output:
Main.java:8: error: class Frog1 is public, should be declared in a file named Frog1.java
public class Frog1 {
       ^
1 error
Language: Java

/*
https://atcoder.jp/contests/dp/tasks/dp_a

*/
import java.util.*;
public class Main
{
	public static void main(String[] args)
	{
	
		int N;
		Scanner sc=new Scanner(System.in);
		N =sc.nextInt();
		
		int arr[] =new int[N];
		
		for(int i=0;i<N;i++)
		{	
			arr[i]=sc.nextInt();
		}
	
		//logic
		int dp[]=new int[N+1];
		Arrays.fill(dp,Integer.MAX_VALUE);
		dp[0]=0;
		dp[1]=cost[1]-cost[0];
		
		for(int i=2;i<N;i++)
		{
			 
			else
				dp[i]=Math.min(dp[i],Math.min( dp[i-1]+Math.abs(arr[i]-arr[i-1]), dp[i-2]+Math.abs(arr[i]-arr[i-2])));
				//System.out.println(dp[i]);
		}
		
		System.out.println(dp[N-1]);
	}
	
}

Compiler output:
Main.java:31: error: 'else' without 'if'
			else
			^
1 error
Language: Java

/*
https://atcoder.jp/contests/dp/tasks/dp_a

*/
import java.util.*;
public class Solution
{
	public static void main(String[] args)
	{
	
		int N;
		Scanner sc=new Scanner(System.in);
		N =sc.nextInt();
		
		int arr[] =new int[N];
		
		for(int i=0;i<N;i++)
		{	
			arr[i]=sc.nextInt();
		}
	
		//logic
		int dp[]=new int[N+1];
		Arrays.fill(dp,Integer.MAX_VALUE);
		dp[0]=0;
		 
		
		for(int i=1;i<N;i++)
		{
			if(i==1) dp[i]=Math.min(arr[i],dp[i-1]+ Math.abs(arr[i]-arr[i-1]));
			else
				dp[i]=Math.min(dp[i],Math.min( dp[i-1]+Math.abs(arr[i]-arr[i-1]), dp[i-2]+Math.abs(arr[i]-arr[i-2])));
				//System.out.println(dp[i]);
		}
		
		System.out.println(dp[N-1]);
	}
	
}

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

//author:satwik_bhv1
#include<bits/stdc++.h>
//datatypes
#define ll long long 
#define ld long double
//loops
#define fr(i,z,n) for(ll i=z;i<n;i++)
#define br(i,z,n) for(ll i=z;i>n;i--)
//operations
#define mp  make_pair
#define ff  first
#define ss  second
#define pub push_back
#define all(v) v.begin(),v.end()
//map
#define mi map<ll,ll>
//vectors
#define vi vector<ll>
#define vpi vector<pair<ll,ll> >
//constants
#define pi 3.1415926535897932384626
#define mod 1000000007 
#define MAXN 100001
/*notes
    Don't use inbuilt fun for power
    Range of longlong=(-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 )
    INT_MAX = 2147483647(aprox 2*10^10)
    INT_MIN = -2147483648
    LLONG_MAX = 9223372036854775807 
    LLONG_MIN = -9223372036854775808
    __gcd is the function in built for hcf
    priority queue is max heap by default
    topological sort -> khan's algo use bfs and indegree of node  
    sssp(positive weighted edges) -> Dijkstras
    apsp -> Floydwarshall
    MST -> kruskal(DSU)
*/
using namespace std;
//functions
ll power(ll x,ll y){ll res=1;while(y){if(y%2){res*=x;}y/=2;x*=x;} return res;}
ll power(ll x,ll y,ll z){ll res=1;while(y){if(y%2){res=(res*x)%z;}y/=2;x=(x*x)%z;} return res;}
void fast() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); }
bool sortbysec(const pair<ll, ll>& a, const pair<ll, ll>& b) { return (a.second > b.second); }
ll ceil(ll x,ll y){return (x/y)+(x%y!=0);}
vi dp;
ll n;
//vi v;
ll fun(ll ind,vi v)
{
    if(ind==n-1)
    {
        return dp[ind]=0;
    }
    if(ind>n-1)
    {
        return -1;
    }
    if(dp[ind]!=-1)
    {
        return dp[ind];
    }
    ll l=LLONG_MAX,r=LLONG_MAX;
    if(fun(ind+1,v)!=-1)
    {
        l=abs(v[ind]-v[ind+1])+dp[ind+1];
    }
    if(fun(ind+2,v)!=-1)
    {
        r=abs(v[ind]-v[ind+2])+dp[ind+2];
    }
    return dp[ind]=min(l,r);
}
void solve()
{
    ll n;
    cin>>n;
    fr(i,0,n)
    {
        ll o;
        cin>>o;
        v.pub(o);
        dp.pub(-1);
    }
    cout<<fun(0,v);
}
int main()
{
    fast();
    ll t;
    t=1;
    //cin>>t;
    fr(i,0,t)
    {
        solve();
    }
}
/*





























*/


Compiler output:
a.cc: In function 'void solve()':
a.cc:81:9: error: 'v' was not declared in this scope
   81 |         v.pub(o);
      |         ^
a.cc:84:17: error: 'v' was not declared in this scope
   84 |     cout<<fun(0,v);
      |                 ^
Language: Java

import java.util.*; 
  
public class Frog1{

    public static int n;

    public static int [] arr = new int[100000];

    public static int minCostJump(int i){

        if(i == n-1) return 0;

        if(i > n) return Integer.MAX_VALUE;

        if(i+2 < n)
        return Math.min(minCostJump(i + 1) + Math.abs(arr[i] - arr[i+1]), minCostJump(i + 2) + Math.abs(arr[i] - arr[i+2]));

        return minCostJump(i + 1) + Math.abs(arr[i] - arr[i+1]);
    } 

    public static void main(String args[]) 
    { 
        Scanner in = new Scanner(System.in); 
  
        n = in.nextInt();

        for(int i = 0; i < n; i++){
            arr[i] = in.nextInt();
        }

        int jumps = minCostJump(0);

        System.out.println(jumps);
    }

} 

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

#include <bits/stdc++.h>

using namespace std;

int N,h[100001],cost[100001];

int main()
{
    cin>>N;
    for(ull i = 1; i<=N; i++){
        cin>>h[i];
    }

    cost[1] = 0;
    cost[2] = abs(h[2] - h[1]);

    for (ull i = 3; i<=N; i++){
        cost[i] = min(cost[i-1] + abs(h[i] - h[i-1]), cost[i-2] + abs(h[i] - h[i-2]));
    }

    cout<<cost[N]<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'ull' was not declared in this scope
   10 |     for(ull i = 1; i<=N; i++){
      |         ^~~
a.cc:10:20: error: 'i' was not declared in this scope
   10 |     for(ull i = 1; i<=N; i++){
      |                    ^
a.cc:17:10: error: 'ull' was not declared in this scope
   17 |     for (ull i = 3; i<=N; i++){
      |          ^~~
a.cc:17:21: error: 'i' was not declared in this scope
   17 |     for (ull i = 3; i<=N; i++){
      |                     ^
Language: C++

#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
#define el "\n" ;
vector<ll> dp(100000  + 2 , -1 ) ;
vector<long> v(100000 + 1) ;
ll f(ll n ){
    if(n <= 1){
        return 0 ;
    }
    if(dp[n] >= 0 ){
        return dp[n] ;
    }
    else
    {
        dp[n] = min(f(n-1,v,dp) + abs(v[n] - v[n-1]) ,f(n-2 , v, dp) + abs(v[n] - v[n-2]) ) ;

    }
    return dp[n] ;
    
}
int main(){
    ios_base::sync_with_stdio(0) ;
    cin.tie(0) ;
    ll  n ; 
    cin >> n  ; 
    
    for( ll i = 1 ; i <= n ; i++){
        cin >> v[i] ;
    }
    v[0] = v[1] ;
    cout << f( n ) << el ;
    return 0 ;
}


/*#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<math.h>
#include<map> 
#include<bits/stdc++.h> 
typedef long long ll ; 
#define el '\n' 
#define fr(n) for(ll i =0 ; i<n ; i++) 
using namespace std ;
ll a[100005] ; ll dp[100005] ;
ll k  ; 
ll solve(ll n){
    if (n < 1 ) return 0 ; 
    if (dp[n] != -1 )
    {
        return dp[n] ; 
    }

    ll left , right ;
    left = solve(n-1) + abs(a[n] - a[n-1])  ;
    right = INT64_MAX ;
    if(n - 2 >= 0 ){
        right = solve(n-2) + abs(a[n]  - a[n-2]) ; 
    }
    return dp[n] =  min(right , left ) ; 
    
}
int main() 
{ 
    ios_base::sync_with_stdio(0) ;
    cin.tie(0) ;
    cin >> k ;
    dp[0] = - 1  ;
    fr(k){
        cin >> a[i+1] ;
        dp[i + 1 ] = - 1 ; 
    }
    a[0] = a[1] ;
    cout << solve(k) << el ;
    return 0; 
} */

Compiler output:
a.cc: In function 'll f(ll)':
a.cc:16:22: error: too many arguments to function 'll f(ll)'
   16 |         dp[n] = min(f(n-1,v,dp) + abs(v[n] - v[n-1]) ,f(n-2 , v, dp) + abs(v[n] - v[n-2]) ) ;
      |                     ~^~~~~~~~~~
a.cc:7:4: note: declared here
    7 | ll f(ll n ){
      |    ^
a.cc:16:56: error: too many arguments to function 'll f(ll)'
   16 |         dp[n] = min(f(n-1,v,dp) + abs(v[n] - v[n-1]) ,f(n-2 , v, dp) + abs(v[n] - v[n-2]) ) ;
      |                                                       ~^~~~~~~~~~~~~
a.cc:7:4: note: declared here
    7 | ll f(ll n ){
      |    ^
Language: Java

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

public class Main{
  public static void main(String[] args) throws IOException{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String[] s = br.readLine().split(" ");
    int n = Integer.parseInt(s[0]);
    int k = Integer.parseInt(s[1]);
    int[] arr = new int[n];
    //int sum = 0;
    String[] str = br.readLine().split(" ");
    for(int i=0;i<n;i++){
      arr[i] = Integer.parseInt(str[i]);
      //sum += arr[i];
    }
    boolean[] dp = new boolean[k+1];
    for(int i=0;i<=k;i++){
      for(int j=0;j<n;j++){
        if(i-arr[j]<0)
          break;
        else if(dp[i-arr[j]]==true){
          dp[i] = true;
          break;
        }
      }
         if(dp[k]==true)
    System.out.println("First");
  else
    System.out.println("Second");
    }
    }
 
  }
}


Compiler output:
Main.java:35: error: class, interface, enum, or record expected
}
^
1 error
Language: Java

// package cp;
import java.io.*;
import java.math.*;
import java.util.*;
public class Solution{
	long gcd(long a,long b) {if(b==0)return a;else return gcd(b,a%b);}
	void swap(long a,long b) {long temp=a;a=b;b=temp;}
	StringBuilder sb=new StringBuilder();
	Integer[] ARR=new Integer[5];
	//Integer sort-TLE-Initialize object elements i.e a[0].
	void divisor(long n,int start) {
		int cnt=0;for(int i=start;i<=Math.sqrt(n);i++) {
		if(n%i==0) {if(i==n/i)cnt++;else cnt+=2;}}}
	
	public static void main(String[] args) throws IOException {	
		PrintWriter out = new PrintWriter(System.out);
		Readers.init(System.in);
		Solution obj=new Solution();
		int n=Readers.nextInt();
		long[] a=new long[n+1];
		for (int i = 1; i < a.length; i++) {
			a[i]=Readers.nextLong();
		}
		long[] dp=new long[n+1];
		dp[1]=0;
		dp[2]=Math.abs(a[2]-a[1]);
		
		for (int i = 3; i <=n; i++) {
			long minn=Math.min(dp[i-1]+Math.abs(a[i]-a[i-1]),dp[i-2]+Math.abs(a[i]-a[i-2]));
			dp[i]=minn;
		}
		System.out.println(dp[n]);
		out.flush();
	}
}
class Readers {
 
    static BufferedReader reader;
 
    static StringTokenizer tokenizer;
 
 
 
    /** call this method to initialize reader for InputStream */
 
    static void init(InputStream input) {
 
        reader = new BufferedReader(
 
                     new InputStreamReader(input) );
 
        tokenizer = new StringTokenizer("");
 
    }
 
 
 
    /** get next word */
 
    static String next() throws IOException {
 
        while ( ! tokenizer.hasMoreTokens() ) {
 
            //TODO add check for eof if necessary
 
            tokenizer = new StringTokenizer(
 
                   reader.readLine() );
 
        }
 
        return tokenizer.nextToken();
 
    }
 
 
 
    static int nextInt() throws IOException {
 
        return Integer.parseInt( next() );
 
    }
 
	
 
    static double nextDouble() throws IOException {
 
        return Double.parseDouble( next() );
 
    }
    
    
    static long nextLong() throws IOException{
    	
		return Long.parseLong(next());
	}
 
}

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

#include <bits/stdc++.h>
using namespace std;
#define int long long
main()
{
  int n;
  cin>>n;
  int jumps[n];
  for(int i=0;i<n;i++)
    cin>>jumps[i];
  vector<int> dp(n,0);
  dp[0]=0;
  dp[1]=abs(jumps[1]-jumps[0];
  for(int i=2;i<n;i++)
            {
              dp[i]=min(dp[i-1]+abs(jumps[i]-jumps[i-1]),dp[i-2]+abs(jumps[i]-jumps[i-2]));
            }
            cout<<dp[n-1]<<endl;
            }

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:13:30: error: expected ')' before ';' token
   13 |   dp[1]=abs(jumps[1]-jumps[0];
      |            ~                 ^
      |                              )
Language: C++

#include<iostream>

using namespace std;
int main()
{
  int n,ans=0;
  cin>>n;
  
  int a[n];
  
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
  }
  
  int x=0;
  
  while(x!=n-1)
  {
    if(fabs(a[x+1]-a[x]) - fabs(a[x+2]-a[x])>=0)
    {
      ans+=fabs(a[x+2]-a[x]);
      x+=2;
    }
    else
    {
      ans+=fabs(a[x+1]-a[x]);
      x+=1;
    }
  }
  
  cout<<ans;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:8: error: 'fabs' was not declared in this scope; did you mean 'labs'?
   20 |     if(fabs(a[x+1]-a[x]) - fabs(a[x+2]-a[x])>=0)
      |        ^~~~
      |        labs
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n, arr[1000000];
long dp[1000000];

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

int main() {
	cin >> n;

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

	return 0;
}


Compiler output:
a.cc: In function 'long int solve(int)':
a.cc:18:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   18 | int main() {
      |         ^~
a.cc:18:9: note: remove parentheses to default-initialize a variable
   18 | int main() {
      |         ^~
      |         --
a.cc:18:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:18:12: error: a function-definition is not allowed here before '{' token
   18 | int main() {
      |            ^
a.cc:28:2: error: expected '}' at end of input
   28 | }
      |  ^
a.cc:6:19: note: to match this '{'
    6 | long solve(int i) {
      |                   ^
a.cc:28:2: warning: control reaches end of non-void function [-Wreturn-type]
   28 | }
      |  ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n,arr[1000000];
long dp[1000000];

long solve(int i){
  
  if(i>=n){
    return 0;
  }
  
  if(dp[i]!=-1)
    return dp[i];
  
  dp[i] = max(abs(arr[i]-arr[i+1)+solve(i+1),abs(arr[i]-arr[i+2])+solve(i+2));
  return dp[i];
 }

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

Compiler output:
a.cc: In function 'long int solve(int)':
a.cc:15:33: error: expected ']' before ')' token
   15 |   dp[i] = max(abs(arr[i]-arr[i+1)+solve(i+1),abs(arr[i]-arr[i+2])+solve(i+2));
      |                                 ^
      |                                 ]
Language: Java

import java.io.*;
import java.util.*;
public class Main{
  	/*public int minRec(int a[],int dp[],int i,int j)
    {
      if(i==n && j==n)
        	return dp[n][n];
      if(
        return Math.min( Math.abs(a[]
    }*/
	public static void main(String args[]) throws IOException{
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int k = sc.nextInt();
      int arr[]=new int[n];
      for(int i=0;i<n;i++)
        arr[i]=sc.nextInt();
      
      int dp[] =  new int[n];
      Arrays.fill(dp, Integer.MAX_VALUE);
      
      return minCost(arr, 0, dp, k);
      
    }
  
  public static int minCost(int arr[], int pos, int dp[], int k){
  	if(pos >= arr.length)
      return Integer.MAX_VALUE;
    
     if(pos == arr.length -1)
      return 0;
    
    if(dp[pos] != Integer.MAX_VALUE)
      	return dp[pos];
    
    for(int i = pos+1; i<=pos+k; i++){
    if(i < arr.length)
      dp[pos] = Math.min(dp[pos], Math.abs(arr[pos] - arr[i]) + minCost(arr, i,dp, k));
    }
   
      return dp[pos];
    
  }
}


Compiler output:
Main.java:22: error: incompatible types: unexpected return value
      return minCost(arr, 0, dp, k);
                    ^
1 error
Language: Java

import java.io.*;
import java.util.*;
public class Main{
  	/*public int minRec(int a[],int dp[],int i,int j)
    {
      if(i==n && j==n)
        	return dp[n][n];
      if(
        return Math.min( Math.abs(a[]
    }*/
	public static void main(String args[]) throws IOException{
      BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
      int n=Integer.parseInt(br.readLine().trim());
      String s[]=br.readLine().trim().split("\\s+");
      int size=s.length;
      int arr[]=new int[size];
      for(int i=0;i<size;i++)
        arr[i]=Integer.parseInt(s[i]);
      
      int dp[] =  new int[size];
      Arrays.fill(dp, -1);
      
      return minCost(arr, 0, dp);
      
    }
  
  public static int minCost(int arr[], int pos, int dp[]){
  	if(pos >= arr.length)
      return Integer.MAX_VALUE;
    
     if(pos == arr.length -1)
      return 0;
    
    if(dp[pos] != -1)
      	return dp[pos];
    
    if(pos+1 < arr.length)
      dp[pos] = Math.abs(arr[pos] - arr[pos+1]) + minCost(arr, pos+1,dp);
    
    if(pos+2 < arr.length)
     dp[pos] = Math.min(dp[pos], Math.abs(arr[pos] - arr[pos+2]) + minCost(arr, pos+2,dp));
    
      return dp[pos];
    
  }
}

Compiler output:
Main.java:23: error: incompatible types: unexpected return value
      return minCost(arr, 0, dp);
                    ^
1 error
Language: C++

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


#define ll long long
#define mod 1000000007;


int solve(vector<int>& v,int n,int k){


    ll dp[n+2][k+2];

    for(int j=0;j<=k;j++){
        dp[1][j]=(j>v[1])?0:1;
    }

    for(int i=2;i<=n;i++){
       for(int j=0;j<=k;j++){
           if(j==0){
              dp[i][j]=dp[i-1][j];
           }
           else{
               dp[i][j]=(mod+ dp[i][j-1]+dp[i-1][j]-((j-v[i]-1>=0)?dp[i-1][j-v[i]-1] :0))% mod;
           }
       }
    }
    return dp[n][k];
}




int main() {
  
  #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
  #endif
  int n,k;
  cin>>n>>k;
  vector<int> v(n+1);
  for(int i=1;i<=n;i++){
    cin>>v[i];
  }
  cout<<solve(v,n,k);
  return 0;
}    

Compiler output:
a.cc: In function 'int solve(std::vector<int>&, int, int)':
a.cc:6:23: error: expected ')' before ';' token
    6 | #define mod 1000000007;
      |                       ^
a.cc:24:26: note: in expansion of macro 'mod'
   24 |                dp[i][j]=(mod+ dp[i][j-1]+dp[i-1][j]-((j-v[i]-1>=0)?dp[i-1][j-v[i]-1] :0))% mod;
      |                          ^~~
a.cc:24:25: note: to match this '('
   24 |                dp[i][j]=(mod+ dp[i][j-1]+dp[i-1][j]-((j-v[i]-1>=0)?dp[i-1][j-v[i]-1] :0))% mod;
      |                         ^
a.cc:24:89: error: expected ';' before ')' token
   24 |                dp[i][j]=(mod+ dp[i][j-1]+dp[i-1][j]-((j-v[i]-1>=0)?dp[i-1][j-v[i]-1] :0))% mod;
      |                                                                                         ^
      |                                                                                         ;
Language: C++

#include<bits/stdc++.h>
#define REP(i, n) for(int i=0; i<n; i++)
using namespace std;
using ll = long long;
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 ll INF = 1LL << 60;

int main() {
    int N;
    cin >> N;
    vector<int> h(N);
    vector<ll> dp(N+10, INF);
    dp[0] = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> h[i];
    }
    for (int i = 0; i < N; i++)
    {
        int c1 = dp[i] + abs(h[i+1]-h[i]);
        chmin(dp[i+1], c1);
        int c2 = dp[i] + abs(h[i+2]-h[i]);
        chmin(dp[i+2], c2);
    }
    cout << dp[N-1] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:14: error: no matching function for call to 'chmin(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&, int&)'
   34 |         chmin(dp[i+1], c1);
      |         ~~~~~^~~~~~~~~~~~~
a.cc:5:31: note: candidate: 'template<class T> bool chmin(T&, T)'
    5 | template<class T> inline bool chmin(T& a, T b) {
      |                               ^~~~~
a.cc:5:31: note:   template argument deduction/substitution failed:
a.cc:34:14: note:   deduced conflicting types for parameter 'T' ('long long int' and 'int')
   34 |         chmin(dp[i+1], c1);
      |         ~~~~~^~~~~~~~~~~~~
a.cc:36:14: error: no matching function for call to 'chmin(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&, int&)'
   36 |         chmin(dp[i+2], c2);
      |         ~~~~~^~~~~~~~~~~~~
a.cc:5:31: note: candidate: 'template<class T> bool chmin(T&, T)'
    5 | template<class T> inline bool chmin(T& a, T b) {
      |                               ^~~~~
a.cc:5:31: note:   template argument deduction/substitution failed:
a.cc:36:14: note:   deduced conflicting types for parameter 'T' ('long long int' and 'int')
   36 |         chmin(dp[i+2], c2);
      |         ~~~~~^~~~~~~~~~~~~
Language: C++

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

ll dampode (int n, ll dp[], int ht[])
{
    if(n==0) return INT_MAX;
    if(n==1) return 0;
    
    if(dp[n] == -1)
    {
        ll ans = min(dampode(n-1, dp,ht)+abs(ht[n]-ht[n-1]), dampode(n-2, dp,ht)+abs(ht[n]-ht[n-2]));
        dp[n] = ans;
        return ans;
    }
    else return dp[n];
}

int main()
{
    int n;
    cin>>n; 

    /*for(int i=1;i<=n;i++)
    {
        int a;
        cin>>a;
        ht.push_back(a);
    }
    ht.insert(ht.begin(),INT_MAX);
    vector<ll> dp (-1, n+1);
    //memset(dp, -1, sizeof(dp));
    for(int i=0;i<=n;i++)
    {
        cout<<ht[i]<<" ";
    }*/
    
    int ht[n+1];
    for(int i=1;i<=n;i++)
    {
        cin>>ht[i];
    }
    ll dp[n+1];
    for(int i=0;i<=n;i++)
    {
        dp[i]=-1;
    }
    cout<<dampode(n, dp, ht)<<endl;
    
}

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 <iostream>
#include <limits.h>
#define ll long long
using namespace std ;

ll dampode (int n, ll dp[], int ht[])
{
    if(n==0) return INT_MAX;
    if(n==1) return 0;
    
    if(dp[n] == -1)
    {
        ll ans = min(dampode(n-1, dp,ht)+abs(ht[n]-ht[n-1]), dampode(n-2, dp,ht)+abs(ht[n]-ht[n-2]));
        dp[n] = ans;
        return ans;
    }
    else return dp[n];
}

int main()
{
    int n;
    cin>>n; 

    /*for(int i=1;i<=n;i++)
    {
        int a;
        cin>>a;
        ht.push_back(a);
    }
    ht.insert(ht.begin(),INT_MAX);
    vector<ll> dp (-1, n+1);
    //memset(dp, -1, sizeof(dp));
    for(int i=0;i<=n;i++)
    {
        cout<<ht[i]<<" ";
    }*/
    
    int ht[n+1];
    for(int i=1;i<=n;i++)
    {
        cin>>ht[i];
    }
    ll dp[n+1];
    for(int i=0;i<=n;i++)
    {
        dp[i]=-1;
    }
    cout<<dampode(n, dp, ht)<<endl;
    
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

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

ll dampode (int n, ll dp[], int ht[])
{
    if(n==0) return INT_MAX;
    if(n==1) return 0;
    
    if(dp[n] == -1)
    {
        ll ans = min(dampode(n-1, dp,ht)+abs(ht[n]-ht[n-1]), dampode(n-2, dp,ht)+abs(ht[n]-ht[n-2]));
        dp[n] = ans;
        return ans;
    }
    else return dp[n];
}

int main()
{
    int n;
    cin>>n; 

    /*for(int i=1;i<=n;i++)
    {
        int a;
        cin>>a;
        ht.push_back(a);
    }
    ht.insert(ht.begin(),INT_MAX);
    vector<ll> dp (-1, n+1);
    //memset(dp, -1, sizeof(dp));
    for(int i=0;i<=n;i++)
    {
        cout<<ht[i]<<" ";
    }*/
    
    int ht[n+1];
    for(int i=1;i<=n;i++)
    {
        cin>>ht[i];
    }
    ll dp[n+1];
    for(int i=0;i<=n;i++)
    {
        dp[i]=-1;
    }
    cout<<dampode(n, dp, ht)<<endl;
    
}

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

import java.util.Scanner;

public class atCoder {
    
    public static void main(String[] args) {
        Scanner scn = new Scanner(System.in);
        int num = scn.nextInt();

        int[] arr = new int[num];
        for(int i = 0; i < num;i++) arr[i] =scn.nextInt();

        System.out.println(frogJmp(arr,0,0));
    }

    public static int frogJmp(int[] arr,int idx,int sum) {

        if(idx>=arr.length-1){
            //System.out.println(sum);
            return sum;
        }
        int cSum1 = 0;
        int cSum2 = 0;
       if(idx==0){
         cSum1 =  frogJmp(arr,idx+1,sum+arr[idx]);
       }else{
         cSum1 =  frogJmp(arr,idx+1,sum+(int)Math.abs(arr[idx]-arr[idx-1]));
       }
       //int cSum1 =  frogJmp(arr,idx+1,sum+arr[idx]-arr[idx-1]);

       if(idx<=1){
         cSum2 =  frogJmp(arr,idx+2,sum+arr[idx]);
       }else{
         cSum2 =  frogJmp(arr,idx+2,sum+(int)Math.abs(arr[idx]-arr[idx-2]));
       }

    //    int cSum2 =  frogJmp(arr,idx+2,sum+arr[idx]-arr[idx-2]);

        return Math.min(cSum1,cSum2);
    }
}

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