criyle/codenet-compile-errors huggingface dataset:
Language: Java

        import java.util.*;
        public class Main {
        	public static void main(String[] args) {
        		Scanner s = new Scanner(System.in);
        		int n = s.nextInt();
        		int[] h = new int[n];
        		for (int i = 0; i < n  ; i++ ) {
        			h[i] = s.nextInt();
        		}
              int[] dp = new int[n];
              Arrays.fill(dp, -1);
              System.out.println(calc(h, 0, dp));
        	}
        	public static int calc(int[] h, int pos, int[] dp) {
        		if(pos > h.length){
                  return 0;
                }
              if(dp[pos] != -1){
                return dp[pos];
              }
              return dp[pos]= Math.min( calc(h, pos+1) + Math.abs(h[pos] - h[pos+1]),
                              calc(h, pos+2) + Math.abs(h[pos] - h[pos+2]));
              
        	}
        }

Compiler output:
Main.java:21: error: method calc in class Main cannot be applied to given types;
              return dp[pos]= Math.min( calc(h, pos+1) + Math.abs(h[pos] - h[pos+1]),
                                        ^
  required: int[],int,int[]
  found:    int[],int
  reason: actual and formal argument lists differ in length
Main.java:22: error: method calc in class Main cannot be applied to given types;
                              calc(h, pos+2) + Math.abs(h[pos] - h[pos+2]));
                              ^
  required: int[],int,int[]
  found:    int[],int
  reason: actual and formal argument lists differ in length
2 errors
Language: Java

    import java.util.*;
    public class Main {
    	public static void main(String[] args) {
    		Scanner s = new Scanner(System.in);
    		int n = s.nextInt();
    		int[] h = new int[n];
    		for (int i = 0; i < n  ; i++ ) {
    			h[i] = s.nextInt();
    		}
          int[] dp = new int[n];
          Arrays.fill(dp, -1);
          System.out.println(calc(h, 0, dp));
    	}
    	public static int calc(int[] h, int pos, int[] dp) {
    		if(pos > h.length){
              return 0
            }
          if(dp[pos] != -1){
            return dp[pos];
          }
          return dp[pos]= Math.min( calc(h, pos+1) + Math.abs(h[pos] - h[pos+1]),
                          calc(h, pos+2) + Math.abs(h[pos] - h[pos+2]));
          
    	}
    }

Compiler output:
Main.java:16: error: ';' expected
              return 0
                      ^
1 error
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] h = new int[n];
		for (int i = 0; i < n  ; i++ ) {
			h[i] = s.nextInt();
		}
		System.out.println(calc(h, 0));
	}
	public static int calc(int[] h, int pos) {
		if(pos > h.length){
          return 0
        }
      return Math.min( calc(h, pos+1) + Math.abs(h[pos] - h[pos+1]),
                      calc(h, pos+2) + Math.abs(h[pos] - h[pos+2]));
      
	}
}

Compiler output:
Main.java:14: error: ';' expected
          return 0
                  ^
1 error
Language: C++

n = int(input())
h = list(map(int, input().split()))

dp = [10 ** 4] * n
dp[0] = 0

for i in range(1, n):
    dp[i] = min(dp[i], dp[i-1] + abs(h[i] - h[i-1]))
    if i > 1:
        dp[i] = min(dp[i], dp[i-2] + abs(h[i] - h[i-2]))

print(dp[-1])

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
Language: C++

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

int min_frog1(vector<int>A, int n)
{
  if(n==0)return 0;
  vector<int>d(n+1);
  d[0]=0;
  d[1]=abs(A[2]-A[1]);
  
  for(int i=2;i<n;i++)
  {
 
   
    d[i]=min((abs(A[i]-A[i+1])+d[i-1]),(abs(A[i+1]-A[i-1])+d[i-2]);
  }
 	return d[n-1];
}
              

int main()
{
   int n;
    cin>>n;
    vector<int> A(n);
    for(int i=1;i<=n;i++)cin>>A[i];
    cout<<min_frog1(A,n)<<endl;
    
  
  
  return 0;
}


Compiler output:
a.cc: In function 'int min_frog1(std::vector<int>, int)':
a.cc:15:67: error: expected ')' before ';' token
   15 |     d[i]=min((abs(A[i]-A[i+1])+d[i-1]),(abs(A[i+1]-A[i-1])+d[i-2]);
      |             ~                                                     ^
      |                                                                   )
Language: C++

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

int min_frog1(vector<int>A, int n)
{
  if(n==0)return 0;
  vector<int>d(n+1);
  d[0]=0;
  d[1]=abs(A[2]-A[1]);
  
  for(int i=2;i<n;i++)
  {
    dp[i]=(abs(A[i]-A[i+1])+d[i-1]);
   
    d[i]=min(d[i],(abs(A[i+1]-A[i-1])+d[i-2]);
  }
 	return d[n-1];
}
              

int main()
{
   int n;
    cin>>n;
    vector<int> A(n);
    for(int i=1;i<=n;i++)cin>>A[i];
    cout<<min_frog1(A,n)<<endl;
    
  
  
  return 0;
}


Compiler output:
a.cc: In function 'int min_frog1(std::vector<int>, int)':
a.cc:13:5: error: 'dp' was not declared in this scope; did you mean 'd'?
   13 |     dp[i]=(abs(A[i]-A[i+1])+d[i-1]);
      |     ^~
      |     d
a.cc:15:46: error: expected ')' before ';' token
   15 |     d[i]=min(d[i],(abs(A[i+1]-A[i-1])+d[i-2]);
      |             ~                                ^
      |                                              )
Language: C++

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

int min_frog1(vector<int>A, int n)
{
  if(n==0)return 0;
  vector<int>d(n+1);
  d[0]=0;
  d[1]=abs(A[1]-A[0]);
  
  for(int i=2;i<n;i++)
  {
    dp[i]=(abs(A[i]-A[i-1])+d[i-1]);
   
    d[i]=min(d[i],(abs(A[i]-A[i-2])+d[i-2]);
  }
 	return d[n-1];
}
              

int main()
{
   int n;
    cin>>n;
    vector<int> A(n);
    for(int i=0;i<n;i++)cin>>A[i];
    cout<<min_frog1(A,n)<<endl;
    
  
  
  return 0;
}


Compiler output:
a.cc: In function 'int min_frog1(std::vector<int>, int)':
a.cc:13:5: error: 'dp' was not declared in this scope; did you mean 'd'?
   13 |     dp[i]=(abs(A[i]-A[i-1])+d[i-1]);
      |     ^~
      |     d
a.cc:15:44: error: expected ')' before ';' token
   15 |     d[i]=min(d[i],(abs(A[i]-A[i-2])+d[i-2]);
      |             ~                              ^
      |                                            )
Language: C++

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

int min_frog1(vector<int>A, int n)
{
  if(n==0)return 0;
  vector<int>d(n);
  d[0]=0;
  d[1]=abs(A[1]-A[0]);
  
  for(int i=2;i<n;i++)
  {
    dp[i]=(abs(A[i]-A[i-1])+d[i-1]);
   
    d[i]=min(d[i],(abs(A[i]-A[i-2])+d[i-2]);
  }
 	return d[n-1];
}
              

int main()
{
   int n;
    cin>>n;
    vector<int> A(n);
    for(int i=0;i<n;i++)cin>>A[i];
    cout<<min_frog1(A,n)<<endl;
    
  
  
  return 0;
}


Compiler output:
a.cc: In function 'int min_frog1(std::vector<int>, int)':
a.cc:13:5: error: 'dp' was not declared in this scope; did you mean 'd'?
   13 |     dp[i]=(abs(A[i]-A[i-1])+d[i-1]);
      |     ^~
      |     d
a.cc:15:44: error: expected ')' before ';' token
   15 |     d[i]=min(d[i],(abs(A[i]-A[i-2])+d[i-2]);
      |             ~                              ^
      |                                            )
Language: C++

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

int min_frog1(vector<int>A, int n)
{
  if(n==0)return 0;
  vector<int>d(n);
  d[0]=0;
  d[1]=abs(A[1]-A[0]);
  
  for(int i=2;i<n;i++)
  {
    dp[i]=(abs(A[i]-A[i-1])+d[i-1]);
   
    d[i]=min(d[i],(abs(A[i]-A[i-2])+d[i-2]);
  }
 	return d[n-1];
}
              

int main()
{
  int m,n;
  cin>>m;
  while(m--)
  {
    cin>>n;
    vector<int> A(n);
    for(int i=0;i<n;i++)cin>>A[i];
    cout<<min_frog1(A,n)<<endl;
    
  }
  
  return 0;
}


Compiler output:
a.cc: In function 'int min_frog1(std::vector<int>, int)':
a.cc:13:5: error: 'dp' was not declared in this scope; did you mean 'd'?
   13 |     dp[i]=(abs(A[i]-A[i-1])+d[i-1]);
      |     ^~
      |     d
a.cc:15:44: error: expected ')' before ';' token
   15 |     d[i]=min(d[i],(abs(A[i]-A[i-2])+d[i-2]);
      |             ~                              ^
      |                                            )
Language: C++

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

int min_frog1(vector<int>A, int n)
{
  if(n==0)return 0;
  vector<int>d(n);
  d[0]=0;
  d[1]=abs(A[1]-A[0]);
  int sum;
  for(int i=2;i<n;i++)
  {
   
    d[i]=min((abs(A[i]-A[i-1])+d[i-1]),(abs(A[i]-A[i-2])+d[i-2]);
  }
 	return d[n-1];
}
              

int main()
{
  int m,n;
  cin>>m;
  while(m--)
  {
    cin>>n;
    vector<int> A(n);
    for(int i=0;i<n;i++)cin>>A[i];
    cout<<min_frog1(A,n)<<endl;
    
  }
  
  return 0;
}

Compiler output:
a.cc: In function 'int min_frog1(std::vector<int>, int)':
a.cc:14:65: error: expected ')' before ';' token
   14 |     d[i]=min((abs(A[i]-A[i-1])+d[i-1]),(abs(A[i]-A[i-2])+d[i-2]);
      |             ~                                                   ^
      |                                                                 )
Language: C++

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


}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:46: error: invalid types 'int [100010][int*]' for array subscript
   18 |         dp[i+1] = min(dp[i+1], abs(h[i+1] - h[h-1]));
      |                                              ^
Language: Java

import java.util.*;
public class codeforces{


public static void main (String []args)
{
	Scanner scan=new Scanner(System.in);
	//long t=scan.nextLong();
	//long ways[]=new long[1000000000];
	//ways[1]=1;
	//ways[i]=ways[i-1]*2;
	
	//while(t-->0){
         int n=scan.nextInt();
         
         int a[]=new int[n];
        // int dp[]=new int[n];
        for(int i=0;i<n;i++)
        a[i]=scan.nextInt();
       
	int dp[]=new int[n];
	for(int i=1;i<n;i++)
        dp[i]=Integer.MAX_VALUE;
	
	dp[0]=0;
	for(int i=0;i<n;i++)
	{
		if(i+1<n)
		dp[i+1]=Math.min(dp[i+1],dp[i]+Math.abs(a[i+1]-a[i]));
		if(i+2<n)
		dp[i+2]=Math.min(dp[i+2],dp[i]+ Math.abs(a[i+2]-a[i]));
		}
         
         System.out.println(dp[n-1]);
//}//
}
}


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

 #include <iostream>
#include <vector>

using namespace std;

const int INF = 1e9 + 5;
int main(){
	int N;
    cin >> N;
    vector<int> heights(N); 
    vector<int> dp(N, INF);
  for(int i = 0 ;i < N; i++){
  	cin >> heights[i];
  }
  dp[0] = 0;
  for(int i = 0; i < N - 2; i++){
  	
        	 dp[j] = min(abs(heights[i] - heights[i + 1]) + dp[i], abs(heights[i] - heights[i + 2]) + dp[i]);
        }
    }
   
    
    
  }
  
  cout << dp[N-1] << endl;
  
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:21: error: 'j' was not declared in this scope
   18 |                  dp[j] = min(abs(heights[i] - heights[i + 1]) + dp[i], abs(heights[i] - heights[i + 2]) + dp[i]);
      |                     ^
a.cc: At global scope:
a.cc:24:3: error: expected declaration before '}' token
   24 |   }
      |   ^
a.cc:26:3: error: 'cout' does not name a type
   26 |   cout << dp[N-1] << endl;
      |   ^~~~
a.cc:29:1: error: expected declaration before '}' token
   29 | }
      | ^
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main(){
	int N;
    cin >> N;
    vector<int> heights(N); 
    vector<int> dp(N, 0);
  for(int i = 0 ;i < N; i++){
  	cin >> heights[i];
  }
  
  for(int i = 0; i < N - 2; i++){
  	dp[i] = min(dp[i], abs(heights[i] - heights[i+1] + dp[i]);
    dp[i] = min(dp[i], abs(heights[i] - heights[i+2]) + dp[i]);
  }
  
  cout << dp[N-1] << endl;
  
  
}


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

#include <iostream>
#include <vector>

using namespace std;

int main(){
	int N;
    cin >> N;
    vector<int> heights(N); 
    vector<int> dp(N, 0);
  for(int i = 0 ;i < N; i++){
  	cin >> heights[i];
  }
  
  for(int i = 2; i < N; i++){
  	dp[i] = min( abs(heights[i-1] - heights[i-2], abs(heights[i] - heights[i-2]) + dp[i-1];
  }
  
  cout << dp[N-1] << endl;
  
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:95: error: expected ')' before ';' token
   16 |         dp[i] = min( abs(heights[i-1] - heights[i-2], abs(heights[i] - heights[i-2]) + dp[i-1];
      |                         ~                                                                     ^
      |                                                                                               )
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main(){
	int N;
    cin >> N;
    vector<int> heights(N); 
    vector<int> dp(N, 0);
  for(int i = 0 ;i < N; i++){
  	cin >> heights[i];
  }
  
  for(int i = 2; i < N; i++){
  	dp[i] = min( abs(heights[i-1] - heights[i-2], abs(heights[i] - heights[i-2]) + dp[i-1];
  }
  
  cout << dp[i] << endl;
  
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:95: error: expected ')' before ';' token
   16 |         dp[i] = min( abs(heights[i-1] - heights[i-2], abs(heights[i] - heights[i-2]) + dp[i-1];
      |                         ~                                                                     ^
      |                                                                                               )
a.cc:19:14: error: 'i' was not declared in this scope
   19 |   cout << dp[i] << endl;
      |              ^
Language: C++


int minCost(vector<int> heights, int frog_ind)
{
	if (heights.size() == frog_ind + 1) {
		return 0;
	}
	int smaller, larger = INT32_MAX;
	if (frog_ind + 1 < heights.size()) {
		smaller = minCost(heights, frog_ind + 1) + abs(heights[frog_ind] - heights[frog_ind + 1]);
	}
	if (frog_ind + 2 < heights.size()) {
		larger = minCost(heights, frog_ind + 2) + abs(heights[frog_ind] - heights[frog_ind + 2]);
	}

	return min(smaller, larger);

}
int N;
cin >> N;
vector<int> heights(N);
for (int i = 0; i < N; i++) {
	cin >> heights[i];
}
cout << minCost(heights, 0);

Compiler output:
a.cc:2:13: error: 'vector' was not declared in this scope
    2 | int minCost(vector<int> heights, int frog_ind)
      |             ^~~~~~
a.cc:2:20: error: expected primary-expression before 'int'
    2 | int minCost(vector<int> heights, int frog_ind)
      |                    ^~~
a.cc:2:34: error: expected primary-expression before 'int'
    2 | int minCost(vector<int> heights, int frog_ind)
      |                                  ^~~
a.cc:2:46: error: expression list treated as compound expression in initializer [-fpermissive]
    2 | int minCost(vector<int> heights, int frog_ind)
      |                                              ^
a.cc:19:1: error: 'cin' does not name a type
   19 | cin >> N;
      | ^~~
a.cc:20:1: error: 'vector' does not name a type
   20 | vector<int> heights(N);
      | ^~~~~~
a.cc:21:1: error: expected unqualified-id before 'for'
   21 | for (int i = 0; i < N; i++) {
      | ^~~
a.cc:21:17: error: 'i' does not name a type
   21 | for (int i = 0; i < N; i++) {
      |                 ^
a.cc:21:24: error: 'i' does not name a type
   21 | for (int i = 0; i < N; i++) {
      |                        ^
a.cc:24:1: error: 'cout' does not name a type
   24 | cout << minCost(heights, 0);
      | ^~~~
Language: C++

int N << cin;
vector<int> heights(N);
for(int i = 0; i < N; i++){
  heights[i] << cin;
}
cout << minCost(heights, 0);
int minCost(vector<int> heights, int frog_ind)
{
	if (heights.size() == frog_ind + 1) {
		return 0;
	}
	int smaller, larger = INT32_MAX;
	if (frog_ind + 1 < heights.size()) {
		smaller = minCost(heights, frog_ind + 1) + abs(heights[frog_ind] - heights[frog_ind + 1]);
	}
	if (frog_ind + 2 < heights.size()) {
		larger = minCost(heights, frog_ind + 2) + abs(heights[frog_ind] - heights[frog_ind + 2]);
	}

	return min(smaller, larger);

}

Compiler output:
a.cc:1:7: error: expected initializer before '<<' token
    1 | int N << cin;
      |       ^~
a.cc:2:1: error: 'vector' does not name a type
    2 | vector<int> heights(N);
      | ^~~~~~
a.cc:3:1: error: expected unqualified-id before 'for'
    3 | for(int i = 0; i < N; i++){
      | ^~~
a.cc:3:16: error: 'i' does not name a type
    3 | for(int i = 0; i < N; i++){
      |                ^
a.cc:3:23: error: 'i' does not name a type
    3 | for(int i = 0; i < N; i++){
      |                       ^
a.cc:6:1: error: 'cout' does not name a type
    6 | cout << minCost(heights, 0);
      | ^~~~
a.cc:7:13: error: 'vector' was not declared in this scope
    7 | int minCost(vector<int> heights, int frog_ind)
      |             ^~~~~~
a.cc:7:20: error: expected primary-expression before 'int'
    7 | int minCost(vector<int> heights, int frog_ind)
      |                    ^~~
a.cc:7:34: error: expected primary-expression before 'int'
    7 | int minCost(vector<int> heights, int frog_ind)
      |                                  ^~~
a.cc:7:46: error: expression list treated as compound expression in initializer [-fpermissive]
    7 | int minCost(vector<int> heights, int frog_ind)
      |                                              ^
Language: Java

import java.util.*;
import java.io.*;
public class Solution
{
    static int solve(int h,int height[])
    {
        if(h == 1)
        return 0;
        int dp[] = new int[h];
        dp[0]=0;
        dp[1]=getAbsoluteValue(height[0],height[1]);
        for(int i=2;i<h;i++)
        {
            dp[i]=Math.min(dp[i-1]+getAbsoluteValue(height[i],height[i-1]),dp[i-2]+getAbsoluteValue(height[i],height[i-2]));
        }
        return dp[h-1];
   }
    static int getAbsoluteValue(int a,int b)
    {
        return Math.abs(a-b);
    }
    public static void main(String []args)throws Exception
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(System.out));
        int h = Integer.parseInt(br.readLine());
        int height[] = Arrays.stream(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
        bw.write(Integer.toString(solve(h,height)));
        br.close();
        bw.close();
    }
}


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

#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include<stacK>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) for(auto r:v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define pc() pop_back()
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
using namespace std;
#define ll long long
#define endl '\n'
#define st stack<int>
#define vi vector<int>
#define vb vector<bool>
#define pii pair<int,int>
#define mod 1000000007
#define ss second
#define ff first> 
#define vpii vector<pii>
#define vvi vector<vi>
#define vs vector<string>
#define mii map<int,int>

int power(int a, int b) {
    int res = 1;
    while (b != 0) {
        if (b & 1) {
            res *= a;
        }
        a = (a * a);
        b = (b / 2);
    }
    return res;
}
template<typename T, typename U> inline void amin(T& x, U y) { if (y < x) x = y; }
template<typename T, typename U> inline void amax(T& x, U y) {
    if (x < y) x = y;
}
bool comp(int n) {
    vi v(4);
    int i = 0;
    while (n) {
        v[i] = n % 10;
        n /= 10;
        i++;


    }
    set<int> s(all(v));
    if (s.size() != 4) return false;
    else return true;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin >> n;
    vi v(n);
    rep(i, n) cin >> v[i];
    vi dp(n, 0);
    dp[1]=abs(v[1] - v[0]);
    reu(i, 2, n) {
        dp[i] = min(dp[i-2]+abs(v[i] - v[i - 2]), dp[i - 1] + abs(v[i] - v[i - 1]));

    }
    cout << dp[n - 1];



}

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

#include <bits/stdc++.h>

using namespace std;

#define INF 1e9 + 5;

typedef long long ll;

int main(){
	int n;
	cin >> n;
	vector<int> v(n);
	for(int i = 0;i<n;i++)
		cin >> v[i];
		
	vector<int> dp(n + 1,INF);	
	dp[0] = 0;
	for(int i = 0;i<n - 1;i++){
		dp[i + 1] = min(dp[i] + abs(v[i] - v[i + 1]), dp[i + 1]);
		dp[i + 2] = min(dp[i] + abs(v[i] - v[i + 2]), dp[i + 2]);
	}
	cout << dp[n - 1] << "\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:20: error: expected ')' before ';' token
    5 | #define INF 1e9 + 5;
      |                    ^
a.cc:16:30: note: in expansion of macro 'INF'
   16 |         vector<int> dp(n + 1,INF);
      |                              ^~~
a.cc:16:23: note: to match this '('
   16 |         vector<int> dp(n + 1,INF);
      |                       ^
a.cc:16:33: error: expected primary-expression before ')' token
   16 |         vector<int> dp(n + 1,INF);
      |                                 ^
Language: C++

#include<iostream>
#include <bits/stdc++.h>
#include <string>
#include <cstring>
#include <algorithm>
using namespace std;

long long INF = 1LL << 60 ;

int main() {
	
    int n ;    
    cin >> n ;
    int h[n];
    for(int i=0;i<n;i++) cin >> h[i];
  //dp table 
    long long dp[10010] ;
  //initialize
    for(int i=0;i<n;i++){
        dp[i] = INF ;
    }
    dp[0] = 0 ;
    dp[1] = abs(h[i]-h[i-1]) ;

    for(int i=2;i<n;i++){
        long long tmp = dp[i-1]+abs(h[i]-h[i-1]) ;
        if(tmp>(dp[i-2]+abs(h[i]-h[i-2]))){
            dp[i] = dp[i-2]+abs(h[i]-h[i-2]) ;
        }
    }

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

  
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:19: error: 'i' was not declared in this scope
   23 |     dp[1] = abs(h[i]-h[i-1]) ;
      |                   ^
Language: C++

#include<iostream>
#include <bits/stdc++.h>
#include <string>
#include <cstring>
#include <algorithm>
using namespace std;

void cmax(int& a, int b){
    if(a<b){
        a = b ;
        return 1 ;
    }
        return 0 ;
}

void cmin(int& a, int b){
    if(a>b){
        a = b ;
        return 1 ;
    }
        return 0 ;
}

long long INF = 1LL << 60 ;

int main() {
	
    int n, ;    
    cin >> n ;
    int h[n];
    for(int i=0;i<n;i++) cin >> h[i];
  //dp table 
    long long dp[10010] ;
  //initialize
    for(int i=0;i<n;i++){
        dp[i] = INF ;
    }
    dp[0] = 0 ;

    for(int i=1;i<n;i++){
        cmin(dp[i],dp[i-1]+abs(dp[i]-dp[i-1])) ;
        if(i>1) cmin(dp[i],dp[i-2]+abs(dp[i]-dp[i-2])) ;
    }

    cout << dp[i-1] << endl ;

  
	return 0;
}


Compiler output:
a.cc: In function 'void cmax(int&, int)':
a.cc:11:16: error: return-statement with a value, in function returning 'void' [-fpermissive]
   11 |         return 1 ;
      |                ^
a.cc:13:16: error: return-statement with a value, in function returning 'void' [-fpermissive]
   13 |         return 0 ;
      |                ^
a.cc: In function 'void cmin(int&, int)':
a.cc:19:16: error: return-statement with a value, in function returning 'void' [-fpermissive]
   19 |         return 1 ;
      |                ^
a.cc:21:16: error: return-statement with a value, in function returning 'void' [-fpermissive]
   21 |         return 0 ;
      |                ^
a.cc: In function 'int main()':
a.cc:28:12: error: expected unqualified-id before ';' token
   28 |     int n, ;
      |            ^
a.cc:41:18: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'long long int'
   41 |         cmin(dp[i],dp[i-1]+abs(dp[i]-dp[i-1])) ;
      |              ~~~~^
a.cc:16:16: note:   initializing argument 1 of 'void cmin(int&, int)'
   16 | void cmin(int& a, int b){
      |           ~~~~~^
a.cc:42:26: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'long long int'
   42 |         if(i>1) cmin(dp[i],dp[i-2]+abs(dp[i]-dp[i-2])) ;
      |                      ~~~~^
a.cc:16:16: note:   initializing argument 1 of 'void cmin(int&, int)'
   16 | void cmin(int& a, int b){
      |           ~~~~~^
a.cc:45:16: error: 'i' was not declared in this scope
   45 |     cout << dp[i-1] << endl ;
      |                ^
Language: C++

#include<iostream>
#include <bits/stdc++.h>
#include <string>
#include <cstring>
#include <algorithm>
using namespace std;

void cmax(int* a, int b){
    if(a<b){
        a = b ;
        return 1 ;
    }
        return 0 ;
}

void cmin(int* a, int b){
    if(a>b){
        a = b ;
        return 1 ;
    }
        return 0 ;
}

long long INF = 1LL << 60 ;

int main() {
	
    int n, ;    
    cin >> n ;
    int h[n];
    for(int i=0;i<n;i++) cin >> h[i];
  //dp table 
    long long dp[10010] ;
  //initialize
    for(int i=0;i<n;i++){
        dp[i] = INF ;
    }
    dp[0] = 0 ;

    for(int i=1;i<n;i++){
        cmin(dp[i],dp[i-1]+abs(dp[i]-dp[i-1])) ;
        if(i>1) cmin(dp[i],dp[i-2]+abs(dp[i]-dp[i-2])) ;
    }

    cout << dp[i-1] << endl ;

  
	return 0;
}


Compiler output:
a.cc: In function 'void cmax(int*, int)':
a.cc:9:9: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    9 |     if(a<b){
      |        ~^~
a.cc:10:13: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   10 |         a = b ;
      |             ^
      |             |
      |             int
a.cc:11:16: error: return-statement with a value, in function returning 'void' [-fpermissive]
   11 |         return 1 ;
      |                ^
a.cc:13:16: error: return-statement with a value, in function returning 'void' [-fpermissive]
   13 |         return 0 ;
      |                ^
a.cc: In function 'void cmin(int*, int)':
a.cc:17:9: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   17 |     if(a>b){
      |        ~^~
a.cc:18:13: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   18 |         a = b ;
      |             ^
      |             |
      |             int
a.cc:19:16: error: return-statement with a value, in function returning 'void' [-fpermissive]
   19 |         return 1 ;
      |                ^
a.cc:21:16: error: return-statement with a value, in function returning 'void' [-fpermissive]
   21 |         return 0 ;
      |                ^
a.cc: In function 'int main()':
a.cc:28:12: error: expected unqualified-id before ';' token
   28 |     int n, ;
      |            ^
a.cc:41:18: error: invalid conversion from 'long long int' to 'int*' [-fpermissive]
   41 |         cmin(dp[i],dp[i-1]+abs(dp[i]-dp[i-1])) ;
      |              ~~~~^
      |                  |
      |                  long long int
a.cc:16:16: note:   initializing argument 1 of 'void cmin(int*, int)'
   16 | void cmin(int* a, int b){
      |           ~~~~~^
a.cc:42:26: error: invalid conversion from 'long long int' to 'int*' [-fpermissive]
   42 |         if(i>1) cmin(dp[i],dp[i-2]+abs(dp[i]-dp[i-2])) ;
      |                      ~~~~^
      |                          |
      |                          long long int
a.cc:16:16: note:   initializing argument 1 of 'void cmin(int*, int)'
   16 | void cmin(int* a, int b){
      |           ~~~~~^
a.cc:45:16: error: 'i' was not declared in this scope
   45 |     cout << dp[i-1] << endl ;
      |                ^
Language: C++

#include <bits/stdc++.h >
#define ll long long
#define s second
#define f first
using namespace std;
const int N = 2e5 , Mod = 1e9+7 ;
int cost[N], n , a[N];
int main()
{
    cin >> n ;
    for ( int i = 0 ; i < n ; i++) cin >> a[i] ;
    cost[0] = 0 ;
    cost[1] = abs(a[1]-a[0]);
    for ( int i = 2 ; i < n ; i++) {
        cost[i] = min(cost[i-1]+abs(a[i]-a[i-1]),cost[i-2]+abs(a[i]-a[i-2]));
    }
    cout << cost[n-1] ;
}


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

#include <bits/stdc++.h >
#define ll long long
#define s second
#define f first
using namespace std;
const int N = 2e5 , mod = 1e9+7 ;
int cost[N], n , a[N];
int main()
{
    cin >> n ;
    for ( int i = 0 ; i < n ; i++) cin >> a[i] ;
    cost[0] = 0 ;
    cost[1] = abs(a[1]-a[0]);
    for ( int i = 2 ; i < n ; i++) {
        cost[i] = min(cost[i-1]+abs(a[i]-a[i-1]),cost[i-2]+abs(a[i]-a[i-2]));
    }
    cout << cost[n-1] ;
}


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 <algorithm>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <utility>
#include <iterator>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
using namespace std; 
  
typedef long long ll; 
typedef pair<int, int> pii; 
typedef pair<ll, ll> pll; 
typedef pair<string, string> pss; 
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef vector<pii> vii; 
typedef vector<ll> vl; 
typedef vector<vl> vvl; 

#define IOS ios_base::sync_with_stdio(false);\
        cin.tie(0);\
        cout.tie(0);
#define endl "\n"  
#define FOR(a, b, c) for (int(a) = (b); (a) < (c); ++(a)) 
#define FORN(a, b, c) for (int(a) = (b); (a) <= (c); ++(a)) 
#define FOREACH(a, b) for (auto&(a) : (b)) 
#define rep(i, n) FOR(i, 0, n) 
#define repn(i, n) FORN(i, 1, n) 
#define RESET(a, b) memset(a, b, sizeof(a)) 
#define fi first 
#define se second 
#define mp make_pair 
#define pb push_back 
#define ALLA(arr, sz) arr, arr + sz 
#define all(c) c.begin(),c.end()
#define SORT(v) sort(all(v)) 
#define REVERSE(v) reverse(all(v)) 
#define SORTA(arr, sz) sort(ALLA(arr, sz)) 
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz)) 
#define PERMUTE next_permutation 
#define present(container, element) (container.find(element) != container.end())
#define cpresent(container, element) (find(all(container),element) != container.end())
#define w(x)   int x; cin>>x; while(x--)
#define sz(a) int((a).size())
#define ps(x,y)         fixed<<setprecision(y)<<x
int main()
{
	IOS;
	int n;
	cin>>n;
	vi v(n);
	rep(i,n)
	{
		cin>>v[i];
	}
	vi dp(n,INT_MAX);
	dp[0]=0;
	for(int i=1;i<n;i++)
	{
		for(int x:{i-1,i-2})
		{
			if(x>=0)
			{
				dp[i]=min(dp[i],dp[x]+abs(v[x]-v[i]));
			}
		}
	}
	cout<<dp[n-1];
	return 0;
}


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

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


int dp[100001];

int minCost(int i,int N, vector<int> vec){
    if(i>=N)
        return 0;
    
    if(i+2 <= N){
        if(dp[i] == -1){
            dp[i] = min( 
                ( abs( vec.at(i) - vec.at(i+2)  ) + minCost(i+2,N,vec)   ), //jump 2 steps
                ( abs( vec.at(i) - vec.at(i+1)  ) + minCost(i+1,N,vec)   )   //jump 1 step
            );
        }
        return dp[i];
    }else{
        if(dp[i] == -1){
            dp[i] = abs( vec.at(i) - vec.at(i+1)  ) + minCost(i+1,N,vec); // jump 1 step
        }
        return dp[i];
    }
}

int main(){
    memset(dp, -1, sizeof dp);
    int N;
    cin >> N;

    vector<int> vec;

    while(N){
        int height;
        cin >> height;

        vec.push_back(height);
    
        N--;
    }

    int result = minCost(0,vec.size()-1,vec);
    cout << result << endl;
    return 0;
}

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

import java.util.Scanner;
 
public class Main {
 
	public int knapSack(int[] weight, int[] value, int capacity, int items) {
		
		int[][] table = new int[items+1][capacity+1];		
		
		for (int i = 0; i <=items; i++) {
			table[i][0] = 0;
		}
		
		for (int i = 0; i <= capacity; i++) {
			table[0][i] = 0;
		}
		
		for (int i = 1; i <= items; i++) {
			for (int j = 1; j <= capacity; j++) {
				
				if(weight[i-1]<=j) {
					int x = j-weight[i-1];
					table[i][j] = Math.max(table[i-1] [j], value[i]+table[i-1][x]);
				}else {
					table[i][j] = table[i-1][j];
				}
			}
		}
		return table[items][capacity];
	}
	
	public static void main(String[] args) {
 
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int W = sc.nextInt();
		int[] weight = new int[N];
		int[] value = new int[N];
		for (int i = 0; i < N; i++) {
			weight[i] = sc.nextInt();
			value[i] = sc.nextInt();
		}
		Main obj = new Main();
		int result = obj.knapSack(weight, value, W, N);
		System.out.println(result);
	}
}
import java.util.Scanner;

public class Main {

	public int knapSack(int[] weight, int[] value, int capacity, int items) {
		
		int[][] table = new int[items+1][capacity+1];		
		
		for (int i = 0; i <=items; i++) {
			table[i][0] = 0;
		}
		
		for (int i = 0; i <= capacity; i++) {
			table[0][i] = 0;
		}
		
		for (int i = 1; i <= items; i++) {
			for (int j = 1; j <= capacity; j++) {
				
				if(weight[i-1]<=j) {
					int x = j-weight[i-1];
					table[i][j] = Math.max(table[i-1] [j], value[i-1]+table[i-1][x]);
				}else {
					table[i][j] = table[i-1][j];
				}
			}
		}
		return table[items][capacity];
	}
	
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int W = sc.nextInt();
		int[] weight = new int[N];
		int[] value = new int[N];
		for (int i = 0; i < N; i++) {
			weight[i] = sc.nextInt();
			value[i] = sc.nextInt();
		}
		Main obj = new Main();
		int result = obj.knapSack(weight, value, W, N);
		System.out.println(result);
	}
}

Compiler output:
Main.java:47: error: class, interface, enum, or record expected
import java.util.Scanner;
^
1 error
Language: Java

import java.io.*;
//import javafx.util.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;
import java.util.*;
import java.lang.*;
import java.io.*;
public class Solution
{
	public static void main (String[] args)
	 {
	 //code
	 Scanner sc =new Scanner(System.in);
	 int n=sc.nextInt();
	 int a[]=new int[n];
	 int dp[]=new int[n];
	 for(int i=0;i<n;i++) {
		 a[i]=sc.nextInt();
	 }
	 dp[0]=0;
	 dp[1]=Math.abs(a[1]-a[0]);
	 for(int i=2;i<n;i++) {
		 dp[i]=Math.min(Math.abs(a[i]-a[i-2])+dp[i-2],Math.abs(a[i]-a[i-1])+dp[i-1] );
	 }
	 System.out.println(dp[n-1]);
	}
}

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

#include<iostream>
using namespace std;

int findminimumcost(){
  return 0;
}
int main(){
  
  int N;
  cin>>N;
  
  vector<int>e;
  for(int i=0;i<N;i++)
  {
    int x;
    cin >> x; 
    e.push_back(x);
    count << x<< endl;
  }
  
  
  int mincost=findminimumcost();  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:3: error: 'vector' was not declared in this scope
   12 |   vector<int>e;
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include<iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:12:10: error: expected primary-expression before 'int'
   12 |   vector<int>e;
      |          ^~~
a.cc:17:5: error: 'e' was not declared in this scope
   17 |     e.push_back(x);
      |     ^
a.cc:18:5: error: 'count' was not declared in this scope
   18 |     count << x<< endl;
      |     ^~~~~
Language: C++

#include <sstream>
#include <fstream>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <bitset>
#include <cstdlib>
#include <ctime>
#include <cstdio>


#include <stdlib.h>
#include <iostream>
#include <chrono> //clock
#include <vector>
#include <string>
#include <iomanip>  //setprecision function
#include <cmath>	//math
#include <cstdio>
#include <vector>	//vector array
#include <algorithm>	//STL algorithm
#include <set> //STL library set
#include <sstream> // for stringstream


using namespace std;
using namespace std::chrono; 


int main() {
	stringstream ss;
	//ss<<"akhil";
	//cout<<ss.str()<<endl;
	cout<<setprecision(16);
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	
	 // TESTCASE KO DEKH KA BHAUT SARA CONDITION GENERATE MAT KRO 
	 // PAPER PD CONFIRM HO JAO THORA JADA TIME HI KYU NA LGA

	int N;
	cin>>N;
	deque<int> vec;
	fo(i,N){
		int a;cin>>a;
		vec.push_back(a);
	}
	
	vec.push_front(0);
	vector<int> dp(N,1e9+5);
	dp[0]=0;
	dp[1]=0;
	for(int i=2;i<N;i++){
		for(int j : {i-1,i-2}){
			dp[i]=min(dp[i],dp[j]+abs(vec[i]-vec[j]));
		}
	}

	
	cout<<dp[N-1]<<endl;
	
	return 0;
}








Compiler output:
a.cc: In function 'int main()':
a.cc:51:12: error: 'i' was not declared in this scope
   51 |         fo(i,N){
      |            ^
a.cc:51:9: error: 'fo' was not declared in this scope
   51 |         fo(i,N){
      |         ^~
Language: C

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define S second
#define F first
#define ii pair <int,int>
#define IOS std::ios_base::sync_with_stdio(false)
#define pb push_back

const ll inf = 1e18;
int q = 1 ;
const int N = 1e5+10 ;
ll n , a[N], mem[N];
ll dp(int i)
{
    if(i == n-1)
        return 0ll;
    ll &ret =mem[i];
    if(ret != -1)
        return ret;
    ll p1 = dp(i+1) + abs(a[i+1] - a[i]);
    ll p2 = inf;
    if(i < n-2)
        p2 = dp(i+2) + abs(a[i+2] - a[i]);
    return ret = min(p1,p2);
}
void solve()
{
    cin>>n;
    for(int i = 0 ; i < n;i++ )
        cin>>a[i];
    memset(mem,-1,sizeof mem);
    cout<<dp(0);
}


int main()
{
    IOS;
//    cin>>;
    while(q--)
    {
         solve();
    }

}


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

package com.atcoder.dp;

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

public class Main {

	public int minCost(int N, int[] height) {
		
		if(N<=1) return 0;
		
		int[] dp = new int[N+1];

		dp[0] = 0;
		dp[1] = Math.abs(height[1]-height[0]);
		
		for(int i=2; i<N; i++) {
			dp[i] = Math.min(dp[i-2]+Math.abs(height[i]-height[i-2]), dp[i-1]+Math.abs(height[i]-height[i-1]));
		}
		return dp[N-1];
	}
	
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] arr = new int[N];
        for (int i = 0; i < N; i++) {
            arr[i] = sc.nextInt();
        }
         
		Frog1 obj = new Frog1();
		int result = obj.minCost(N, arr);
		System.out.println(result);
	}
}


Compiler output:
Main.java:32: error: cannot find symbol
		Frog1 obj = new Frog1();
		^
  symbol:   class Frog1
  location: class Main
Main.java:32: error: cannot find symbol
		Frog1 obj = new Frog1();
		                ^
  symbol:   class Frog1
  location: class Main
2 errors
Language: Java

import java.util.Scanner;

public class Frog1 {

	public int minCost(int N, int[] height) {
		
		if(N<=1) return 0;
		
		int[] dp = new int[N+1];

		dp[0] = 0;
		dp[1] = Math.abs(height[1]-height[0]);
		
		for(int i=2; i<N; i++) {
			dp[i] = Math.min(dp[i-2]+Math.abs(height[i]-height[i-2]), dp[i-1]+Math.abs(height[i]-height[i-1]));
		}
		return dp[N-1];
	}
	
	public static void main(String[] args) {

		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();
        }
         
		Frog1 obj = new Frog1();
		int result = obj.minCost(N, arr);
		System.out.println(result);
	}
}


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: Java

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

public class Frog1 {

	public int minCost(int[] height) {
		
		int N = height.length;
		
		if(N<=1) return 0;
		
		int[] dp = new int[N+1];

		dp[0] = 0;
		dp[1] = Math.abs(height[1]-height[0]);
		
		for(int i=2; i<N; i++) {
			dp[i] = Math.min(dp[i-2]+Math.abs(height[i]-height[i-2]), dp[i-1]+Math.abs(height[i]-height[i-1]));
		}
		return dp[N-1];
	}
	
	public static void main(String[] args) throws IOException {

		//Enter data using BufferReader 
        BufferedReader reader =  
                   new BufferedReader(new InputStreamReader(System.in)); 
         
        // Reading data using readLine 
        int N = Integer.parseInt(reader.readLine()); 
		
		int[] heights = new int[N];
		String[] input = reader.readLine().split(" ");
		for (int i = 0; i < input.length; i++) {
			heights[i] = Integer.parseInt(input[i]);
		}
		Frog1 obj = new Frog1();
		int result = obj.minCost(heights);
		System.out.println(result);
	}
}


Compiler output:
Main.java:5: 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>

int main()
{
	int n;
	cin>>n;
  	int a[n+1],count[n+1];
  	for(int i=1;i<=n;i++)
      	cin>>a[i];
  	count[1]=0;
  	for(int i=2;i<=n;i++)
    {
      count[i]=count[i-1]+abs(a[i]-a[i-1]);
      if(i>2)
        count[i]=min(count[i],count[i-2]+abs(a[i]-a[i-2]));      
    }
  	cout<<a[n]<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 |         cin>>n;
      |         ^~~
      |         std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:15:18: error: 'min' was not declared in this scope; did you mean 'std::min'?
   15 |         count[i]=min(count[i],count[i-2]+abs(a[i]-a[i-2]));
      |                  ^~~
      |                  std::min
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:17:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   17 |         cout<<a[n]<<endl;
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:17:21: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   17 |         cout<<a[n]<<endl;
      |                     ^~~~
      |                     std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

N=110000
dp=[0]*N

n=int(input()) 
h=list(map(int,input().split()))
now=[0,0,0]
for i in range(1,n):
    if i==1:
        dp[i]=dp[i-1]+abs(h[i]-h[i-1])
    else:
        now=[i,i-1,i-2]
        dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))

print(dp[n-1])

Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N=110000
      | ^
Language: C++

#include <bits/stdc++.h>

int main() {
    int N;
	cin >> N;
  	int arr[N];
  
  	for (int i = 0; i < N; i++) {
  		cin >> arr[i];  	 
    }
  
  	int dp[N];
  
  	dp[0] = 0;
  	dp[1] = abs(arr[1] - arr[0]);
  	//dp[2] = min(dp[1] + abs(arr[2] - arr[1]), abs(arr[2] - 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;
  
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    5 |         cin >> N;
      |         ^~~
      |         std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:18:17: error: 'min' was not declared in this scope; did you mean 'std::min'?
   18 |         dp[i] = min(dp[i - 1] + abs(arr[i] - arr[i - 1]), dp[i - 2] + abs(arr[i] - arr[i - 2]));
      |                 ^~~
      |                 std::min
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:21:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   21 |         cout << dp[N - 1] << endl;
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:21:30: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   21 |         cout << dp[N - 1] << endl;
      |                              ^~~~
      |                              std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~