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

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

using namespace std;
# define int long long 
int n;
int a[100005];
int dp[100005];

int fun(int ind) {
	if(ind==(n-1)) return 0; 
	if(ind>=n) return INT_MAX; 
 
	if(dp[ind]!=-1) return dp[ind]; 
    
	int left = abs(a[ind]-a[ind+1]) + fun(ind+1); 
	int right = INT_MAX; 
	if(ind+2<n) {
		right = abs(a[ind] - a[ind+2]) + fun(ind+2); 
	}
 
	return dp[ind] = min(left, right); 
}


int main(){
  cin>>n;
  for(int i=0; i<n; i++){
   cin>>a[i]; 
  }
  
  memset(dp,-1,n);
  
 cout<<fun(0);
  
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

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

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]);
  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] );
                
            cout<<dp[n-1]<<endl;
}

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

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

public class Frog_1 {
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;
        public FastReader()
        {
            br=new BufferedReader(new InputStreamReader(System.in));
        }
        String next()
        {
            while(st==null || !st.hasMoreElements())
            {
                try {
                    st=new StringTokenizer(br.readLine());
                } catch(IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt()
        {
            return(Integer.parseInt(next()));
        }
        long nextLong()
        {
            return(Long.parseLong(next()));
        }
        String nextLine(){
            String s="";
            try{
                s=br.readLine();
            }catch (IOException e){
                e.printStackTrace();
            }
            return s;
        }
    }

    public static void main(String[] args) {
        FastReader in = new FastReader();
        int n=in.nextInt();
        int a[]=new int[n];
        for(int i=0;i<n;i++){
            a[i]=in.nextInt();
        }
        System.out.println(min_val(a,n-1,0));
    }
    static int min_val(int a[],int ind,int cost){
        if(ind==0){
            return cost;
        }
        if(ind-2>=0){
            return (Math.min(min_val(a,ind-2,cost+Math.abs(a[ind]-a[ind-2])),min_val(a,ind-1,cost+Math.abs(a[ind]-a[ind-1]))));
        }else{
            return (min_val(a,ind-1,cost+Math.abs(a[ind]-a[ind-1])));
        }
    }
}


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

#include <bits/stdc++.h>
#define fastIO ios::sync_with_stdio(NULL); cin.tie(NULL);

using namespace std;
const int N = 1E6+7;

long long f[N];
long long a[N];
int n;

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

 	f[2] = abs(a[i-2]-a[i-1]);
    for (int i = 3;i <= n;++i)
        f[i] = min(f[i-1]+abs(a[i]-a[i-1]),f[i-2]+abs(a[i]-a[i-2]));

    cout<<f[n];
}

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

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

vector <int> dp(100005);

// int solve(vector <int> arr,int i)
// {

// 	if(i==2)return arr[2]-arr[1];
// 	if(i==3)return arr[3]-arr[1];
// 	if(dp[i]!=-1)return dp[i];
// 	return dp[i]=min(   ( abs(arr[i]-arr[i-1])+solve(arr,(i-1))) , (abs(arr[i]-arr[i-2])+solve(arr,(i-2)) )   );
// 	for(int i=)
// }

int main()
{
	int n;
	cin>>n;
	vector <int> arr(n+1);
	for(int i=1;i<=n;i++)
	{
		cin>>arr[i];
	}
	arr[1]=0;
	arr[2]=abs(arr[2]-arr[1]);
	for(int i=3;i<=n;i++)
	{
		dp[i]=min(   ( abs(arr[i]-arr[i-1])+dp(i-1)) , (abs(arr[i]-arr[i-2])+dp(i-2)) )   );
	}


	cout<<arr[n]<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:55: error: no match for call to '(std::vector<int>) (int)'
   29 |                 dp[i]=min(   ( abs(arr[i]-arr[i-1])+dp(i-1)) , (abs(arr[i]-arr[i-2])+dp(i-2)) )   );
      |                                                     ~~^~~~~
a.cc:29:88: error: no match for call to '(std::vector<int>) (int)'
   29 |                 dp[i]=min(   ( abs(arr[i]-arr[i-1])+dp(i-1)) , (abs(arr[i]-arr[i-2])+dp(i-2)) )   );
      |                                                                                      ~~^~~~~
Language: C++

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

vector <int> dp(n+1,-1);

int solve(vector <int> arr,int i)
{

	if(i==2)return arr[2]-arr[1];
	if(i==3)return arr[3]-arr[1];
	if(dp[i]!=-1)return dp[i];
	return dp[i]=min(   ( abs(arr[i]-arr[i-1])+solve(arr,(i-1))) , (abs(arr[i]-arr[i-2])+solve(arr,(i-2)) )   );
}

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


Compiler output:
a.cc:4:17: error: 'n' was not declared in this scope; did you mean 'yn'?
    4 | vector <int> dp(n+1,-1);
      |                 ^
      |                 yn
Language: C++

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

int solve(vector <int> arr,i)
{
	if(i==2)return arr[2]-arr[1];
	if(i==1)return 0;
	return min( (abs(arr[i]-arr[i-1])+solve(i-1)) , (abs(arr[i]-arr[i-2])+solve(i-2)) );
}

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

Compiler output:
a.cc:4:28: error: 'i' has not been declared
    4 | int solve(vector <int> arr,i)
      |                            ^
a.cc: In function 'int solve(std::vector<int>, int)':
a.cc:6:12: error: 'i' was not declared in this scope
    6 |         if(i==2)return arr[2]-arr[1];
      |            ^
a.cc:7:12: error: 'i' was not declared in this scope
    7 |         if(i==1)return 0;
      |            ^
a.cc:8:30: error: 'i' was not declared in this scope
    8 |         return min( (abs(arr[i]-arr[i-1])+solve(i-1)) , (abs(arr[i]-arr[i-2])+solve(i-2)) );
      |                              ^
Language: C++

#include<iostream>
using namespace std;

int solve(vector <int> arr,i)
{
	if(i==2)return arr[2]-arr[1];
	if(i==1)return 0;
	return min( (abs(arr[i]-arr[i-1])+solve(i-1)) , (abs(arr[i]-arr[i-2])+solve(i-2)) );
}

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

Compiler output:
a.cc:4:11: error: 'vector' was not declared in this scope
    4 | int solve(vector <int> arr,i)
      |           ^~~~~~
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:4:19: error: expected primary-expression before 'int'
    4 | int solve(vector <int> arr,i)
      |                   ^~~
a.cc:4:28: error: 'i' was not declared in this scope
    4 | int solve(vector <int> arr,i)
      |                            ^
a.cc:4:29: error: expression list treated as compound expression in initializer [-fpermissive]
    4 | int solve(vector <int> arr,i)
      |                             ^
a.cc: In function 'int main()':
a.cc:15:9: error: 'vector' was not declared in this scope
   15 |         vector <int> arr(n+1);
      |         ^~~~~~
a.cc:15:9: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:15:17: error: expected primary-expression before 'int'
   15 |         vector <int> arr(n+1);
      |                 ^~~
a.cc:18:22: error: 'arr' was not declared in this scope
   18 |                 cin>>arr[i];
      |                      ^~~
a.cc:20:21: error: 'arr' was not declared in this scope
   20 |         cout<<solve(arr,n)<<endl;
      |                     ^~~
a.cc:20:20: error: 'solve' cannot be used as a function
   20 |         cout<<solve(arr,n)<<endl;
      |               ~~~~~^~~~~~~
Language: C++

// stones atcoder
const long long c {1e10 + 7};
#include<bits/stdc++.h>
using namespace std;
bool true_if_p1_wins(bool true_if_p1_plays, int stones_left,int min,vector<int>&v) {
	if (stones_left < min) {
		return !true_if_p1_plays;
	}
	else if (true_if_p1_plays) {
		bool or_of_all{false};
		for (auto x : v) {
			if (x <= stones_left) {
				or_of_all = or_of_all || true_if_p1_wins(false, stones_left - x,min,v);
			}
		}
		return or_of_all;
	}
	else {
		bool and_of_all{true};
		for (auto x : v) {
			if (x < stones_left) {
				and_of_all = and_of_all && true_if_p1_wins(true, stones_left - x,min,v);
			}
		}
		return and_of_all;
	}
}
int main() {
	int n, initial_stones;
	cin >> n >> initial_stones;
	vector<int> v(n);
	for (int i{}; i < n; i++) {
		cin >> v[i];
	}
	int min{*min_element(v.begin(), v.end())};
	if (true_if_p1_wins(true, initial_stones, min,v)) {
		cout << "p1 wins" << endl;
	}
	else {
		cout << "p2 wins" << endl;
	}
}

Compiler output:
a.cc:2:25: error: narrowing conversion of '1.0000000007e+10' from 'double' to 'long long int' [-Wnarrowing]
    2 | const long long c {1e10 + 7};
      |                    ~~~~~^~~
Language: C++

#include<iostream.h>
using namespace std;

int main()
{
  int N;
  cin>>N;
  int A[N];
  for(int i=0;i<N;i++)
  {
    cin>>A[i];
  }
  
  int C[N];
  C[N-2]=abs(A[N-1]-A[N-2]);
  C[N-3]=min(abs(A[N-1]-A[N-2])+abs(A[N-3]-A[N-2]),abs(A[N-1]-A[N-3]));
  for(int i=N-4;i>=0;i--)
  {
    C[i]=min(abs(A[i]-A[i+1])+C[i+1],abs(A[i]-A[i+2])+C[i+2]);
  }
  cout<<C[0]<<endl;
  
  
}

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

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

int main() {
  int N,i;
  cin >> N;
  vector<int> h(N);
  vector<int> d(N,-1);
  
  for(auto& x:h)
    cin >> x;
  
  d[0] = 0;
  d[1] = abs(h[1] - h[0]);
  for (i=2;i<N;i++)
    d[i] = min(d[i-1]+abs(h[i]-h[i-1]),d[i-2]+abs(h[i]-h[i-2]));
  cout << d[N-1] << 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: C++


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
#define mod 1000000007
#define dd double
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,b) for(int i=1;i<=b;i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
int dp[100001];
int knap(int &arr[],int n,int size){
	if(n==1)
		return 0; 
	if(dp[n])
		return dp[n];
	int one_step;
	if(n>1){
		
		if(dp[n-1])
			one_step = dp[n-1];
		else
			one_step = knap(arr,n-1,size);
	}
	else{
		one_step = 1e5;
	}		 
	int two_step;
	if(n>2){
		
		if(dp[n-2])
			two_step = dp[n-2];
		else
			two_step = knap(arr,n-2,size);
	}
	else{
		two_step = 1e5;
	}
	//cout<<n<<" "<<one_step<<" "<<two_step<<endl;

	return dp[n] = min(one_step+abs(arr[size-n]-arr[size-n+1]),two_step+abs(arr[size-n]-arr[size-n+2]));
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
#ifndef ONLINE_JUDGE    
    freopen("input.txt", "r", stdin);     
    freopen("output.txt", "w", stdout);
#endif
 memset(dp,0,sizeof(dp));
	int n;
	cin>>n;
	int arr[n];
	for(int i = 0;i<n;i++){
		cin>>arr[i];
	}	
	int size = n;
	cout<<knap(arr,n,size)<<endl;







#ifndef ONLINE_JUDGE
    cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
#endif

return 0;
}

Compiler output:
a.cc:16:15: error: declaration of 'arr' as array of references
   16 | int knap(int &arr[],int n,int size){
      |               ^~~
a.cc:16:20: error: expected ')' before ',' token
   16 | int knap(int &arr[],int n,int size){
      |         ~          ^
      |                    )
a.cc:16:21: error: expected unqualified-id before 'int'
   16 | int knap(int &arr[],int n,int size){
      |                     ^~~
Language: C++


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
#define mod 1000000007
#define dd double
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,b) for(int i=1;i<=b;i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
int dp[100001];

int knap(int arr[],int n,int size){
	if(n==1)
		return 0; 
	if(dp[n])
		return dp[n];
	int one_step = (n>1)?knap(arr,n-1,size):1e5;
	int two_step = (n>2)?knap(arr,n-2,size):1e5;
	//cout<<n<<" "<<one_step<<" "<<two_step<<endl;

	return dp[n] = min(one_step+abs(arr[size-n]-arr[size-n+1]),two_step+abs(arr[size-n]-arr[size-n+2]));
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
#ifndef ONLINE_JUDGE    
    freopen("input.txt", "r", stdin);     
    freopen("output.txt", "w", stdout);
#endif
memset<dp,0,sizeof(dp)>;
  

	int n;
	cin>>n;
	int arr[n];
	for(int i = 0;i<n;i++){
		cin>>arr[i];
	}	
	int size = n;
	cout<<knap(arr,n,size)<<endl;







#ifndef ONLINE_JUDGE
    cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
#endif

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:7: error: comparison between distinct pointer types 'void* (*)(void*, int, size_t) noexcept' {aka 'void* (*)(void*, int, long unsigned int) noexcept'} and 'int*' lacks a cast
   35 | memset<dp,0,sizeof(dp)>;
      | ~~~~~~^~~
a.cc:35:24: error: expected primary-expression before ';' token
   35 | memset<dp,0,sizeof(dp)>;
      |                        ^
Language: C++

#include <iostream>
#include <c
using namespace std;

int dist(int arr[], int n){
    int dp[n+1], op1=0, op2=0;
    dp[1] = 0;
    for(int i=2;i<=n;i++){
         op1 = abs(arr[i]- arr[i-1]) + dp[i-1];
        if(i!=2){
            op2 = abs(arr[i]- arr[i-2]) + dp[i-2];
        }
        dp[i] = min(op1, op2);
    }
    return dp[n];
}

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

Compiler output:
a.cc:2:12: error: missing terminating > character
    2 | #include <c
      |            ^
a.cc:2:10: fatal error: c: No such file or directory
    2 | #include <c
      |          ^
compilation terminated.
Language: Java

import java.io.*;
import java.lang.*;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.math.BigInteger;
//0/26 done
public class AtCoderDP { //CHANGE TO MAIN WHEN SUBMITTING
    static InputReader in = new InputReader(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int n = in.nextInt();
        int[] a = new int[n];
        for(int i = 0; i<n; i++) a[i] = in.nextInt();
        int[] dp = new int[n];
        Arrays.fill(dp,(int)1e5);
        dp[0] = 0;
        if(dp.length==1){
            out.print(0);
        }
        else{
            dp[1] = Math.abs(a[1]-a[0]);
            for(int i = 2; i<n; i++){
                for(int j = 0; j<2; j++){
                    dp[i] = Math.min(dp[i],Math.abs(a[i]-a[i-j-1])+dp[i-j-1]);
                }
            }
            out.print(dp[n-1]);
        }
        out.close();
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

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

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

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

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

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

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (Exception e) {
                e.printStackTrace();
            }
            return null;
        }

        public boolean hasNext() {
            String next = null;
            try {
                next = reader.readLine();
            } catch (Exception e) {
            }
            if (next == null) {
                return false;
            }
            tokenizer = new StringTokenizer(next);
            return true;
        }

        public BigInteger nextBigInteger() {
            return new BigInteger(next());
        }
    }
}



Compiler output:
Main.java:13: error: class AtCoderDP is public, should be declared in a file named AtCoderDP.java
public class AtCoderDP { //CHANGE TO MAIN WHEN SUBMITTING
       ^
1 error
Language: C

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

#define F                   first
#define S                   second
#define int                 long long int
#define pb                  push_back
#define mp                  make_pair
#define pii                 pair<int,int>
#define vi                  vector<int>
#define mii                 map<int,int>
#define pqb                 priority_queue<int>
#define pqs                 priority_queue<int,vi,greater<int> >
#define mod                 1000000007
#define endl                '\n'
#define rep(i,a,b)            for(int i=a;i<b;i++)
void c_p_c()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

int32_t main()
{
    c_p_c();
    int n;
    cin >> n;
    int a[n];
    rep(i, 0, n) {
        cin >> a[i];
    }
    vi dp(n + 1, 0);
    dp[0] = 0;
    dp[1] = abs(a[1] - a[0]);
    for (int i = 2; i < n; i++) {
        dp[i] = min(abs(a[i - 1] - a[i]) + dp[i - 1], abs(a[i - 2] - a[i]) + dp[i - 2]);
    }

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

    return 0;
}

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

#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define speed                   \
  ios_base::sync_with_stdio(0); \
  cin.tie(0);                   \
  cout.tie(0);
#define oprecision    \
  cout.precision(30); \
  cerr.precision(7);
#define ll long long
#define ld long double
#define dd double
#define ss string
#define pii pair<int, int>
#define pll pair<ll, ll>
#define forn(n) for (int i = 1; i <= n; i++)
#define forlr(l, r) \
  for (int i = l; (l > r ? i >= r : i <= r); (l > r ? i-- : i++))
#define pb push_back
#define pc builtin_popcount
#define pcll builtin_popcountll
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
using namespace std;
ll n, c, h[500005], dp[500005];
vector<pll> lines;
ld cross(pll a, pll b) { return (b.S - a.S + 0.0) / (a.F - b.F + 0.0); }
void add(pll new_line) {
  while (lines.size() > 1) {
    int last = lines.size() - 1;
    if (cross(lines[last], lines[last - 1]) < cross(new_line, lines[last - 1]))
      break;
    lines.pop_back();
  }
  lines.pb(new_line);
}
ll get(ll x) {
  ll ans = -1e9;
  for(auto it : lines)
    ans = max(ans, it.F * x + it.S);
  return ans;
}
int main() {
  speed;
  oprecision;
  // code
  cin >> n >> c;
  forn(n) cin >> h[i];
  add({-2 * h[1], h[1] * h[1]});
  for (int i = 2; i <= n; i++) {
    dp[i] = get(h[i]) + h[i] * h[i] + c;
    add({-2 * h[i], dp[i] + h[i] * h[i]});
  }
  cout << dp[n];
  // endl
#ifndef ONLINE_JUDGE
  cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
  return 0;
}

Compiler output:
In file included from /usr/include/c++/14/string:43,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:3:
/usr/include/c++/14/bits/allocator.h: In destructor 'std::_Vector_base<std::pair<long long int, long long int>, std::allocator<std::pair<long long int, long long int> > >::_Vector_impl::~_Vector_impl()':
/usr/include/c++/14/bits/allocator.h:182:7: error: inlining failed in call to 'always_inline' 'std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = std::pair<long long int, long long int>]': target specific option mismatch
  182 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53:
/usr/include/c++/14/bits/stl_vector.h:132:14: note: called from here
  132 |       struct _Vector_impl
      |              ^~~~~~~~~~~~
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:20:17: error: 'cuot' was not declared in this scope
   20 |                 cuot<<dp[n-1];
      |                 ^~~~
Language: C++

#include<bits/stdc++.h>
#include<iostream>
#include<vector>
int main() {
	int n;
  	cin>>n;
  	vector<int> h;
  	for(int i=0; i<n; i++) {
      	int temp;
      	cin>>temp;
      	h.push_back(temp);
    }
  	vector<int> dp(n,0);
  	dp[0] = h[0];
  	dp[1] = abs(dp[0]-h[1]);
  	for(int i=2; i<n; i++) {
      dp[i] += min(abs(h[i]-h[i-1])+dp[i-1],abs(h[i]-h[i-2]+dp[i-2]));
    }
  		cuot<<dp[n-1];
}

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:7:9: error: 'vector' was not declared in this scope
    7 |         vector<int> h;
      |         ^~~~~~
a.cc:7:9: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:7:16: error: expected primary-expression before 'int'
    7 |         vector<int> h;
      |                ^~~
a.cc:11:9: error: 'h' was not declared in this scope
   11 |         h.push_back(temp);
      |         ^
a.cc:13:16: error: expected primary-expression before 'int'
   13 |         vector<int> dp(n,0);
      |                ^~~
a.cc:14:9: error: 'dp' was not declared in this scope; did you mean 'dup'?
   14 |         dp[0] = h[0];
      |         ^~
      |         dup
a.cc:14:17: error: 'h' was not declared in this scope
   14 |         dp[0] = h[0];
      |                 ^
a.cc:17:16: error: 'min' was not declared in this scope; did you mean 'std::min'?
   17 |       dp[i] += min(abs(h[i]-h[i-1])+dp[i-1],abs(h[i]-h[i-2]+dp[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:19:17: error: 'cuot' was not declared in this scope
   19 |                 cuot<<dp[n-1];
      |                 ^~~~
Language: C++

#include<bits/stdc++.h>
int main() {
	int n;
  	cin>>n;
  	vector<int> h;
  	for(int i=0; i<n; i++) {
      	int temp;
      	cin>>temp;
      	h.push_back(temp);
    }
  	vector<int> dp(n,0);
  	dp[0] = h[0];
  	dp[1] = abs(dp[0]-h[1]);
  	for(int i=2; i<n; i++) {
      dp[i] += min(abs(h[i]-h[i-1])+dp[i-1],abs(h[i]-h[i-2]+dp[i-2]));
    }
  		return dp[n-1];
}
      	

Compiler output:
a.cc: In function 'int main()':
a.cc:4:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    4 |         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:5:9: error: 'vector' was not declared in this scope
    5 |         vector<int> h;
      |         ^~~~~~
a.cc:5:9: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:5:16: error: expected primary-expression before 'int'
    5 |         vector<int> h;
      |                ^~~
a.cc:9:9: error: 'h' was not declared in this scope
    9 |         h.push_back(temp);
      |         ^
a.cc:11:16: error: expected primary-expression before 'int'
   11 |         vector<int> dp(n,0);
      |                ^~~
a.cc:12:9: error: 'dp' was not declared in this scope; did you mean 'dup'?
   12 |         dp[0] = h[0];
      |         ^~
      |         dup
a.cc:12:17: error: 'h' was not declared in this scope
   12 |         dp[0] = h[0];
      |                 ^
a.cc:15:16: error: 'min' was not declared in this scope; did you mean 'std::min'?
   15 |       dp[i] += min(abs(h[i]-h[i-1])+dp[i-1],abs(h[i]-h[i-2]+dp[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)
      |     ^~~
Language: Java

import java.util.*;
public class frog1 {

	public static void main(String[] args)
	{
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int arr[]=new int[n];
		int dp[]=new int[n+1];
		for(int i=0;i<n;i++)
		{
			arr[i]=sc.nextInt();
		}
		dp[1]=Math.abs(arr[0]-arr[1]);
		for(int i=2;i<n;i++)
		{
			int opt1=dp[i-2]+Math.abs(arr[i-2]-arr[i]);
			int opt2=dp[i-1]+Math.abs(arr[i]-arr[i-1]);
		//	System.out.println(opt1+" "+opt2);
			dp[i]=Math.min(opt1, opt2);
		}
		System.out.println(dp[n-1]);
	}
}


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

import java.util.*;
public class main {

	public static void main(String[] args)
	{
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int arr[]=new int[n];
		int dp[]=new int[n+1];
		for(int i=0;i<n;i++)
		{
			arr[i]=sc.nextInt();
		}
		dp[1]=Math.abs(arr[0]-arr[1]);
		for(int i=2;i<n;i++)
		{
			int opt1=dp[i-2]+Math.abs(arr[i-2]-arr[i]);
			int opt2=dp[i-1]+Math.abs(arr[i]-arr[i-1]);
		//	System.out.println(opt1+" "+opt2);
			dp[i]=Math.min(opt1, opt2);
		}
		System.out.println(dp[n-1]);
	}
}


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

import java.util.*;
public class HelloWorld{

     public static void main(String []args){
        Scanner in=new Scanner(System.in);
        
        int n=in.nextInt();
        int A[]=new int[n];
        for(int i=0;i<n;i++)
        {
            A[i]=in.nextInt();
        }
        int dp[]=new int[n+1];
        dp[1]=0;
        dp[2]=Math.abs(A[1]-A[0]);
        for(int i=3;i<=n;i++)
        {
            dp[i]=Math.min(dp[i-2]+Math.abs(A[i-1]-A[i-3]),dp[i-1]+Math.abs(A[i-1]-A[i-2]));
        }
        System.out.println(dp[n]);
     }
}

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

#include <iostream>
using namespace std;
int main() {
    int n;
    cin>>n;
    int arr[n];

    int i;
    for(i=0;i<n;i++) cin>>arr[i];

    int dp[n];
    memset(dp,10000,sizeof(dp));
    dp[0]=0;
    dp[1]=abs(arr[1]-arr[0]);
    for(i=2;i<n;i++)
    {
        int a=dp[i-1]+abs(arr[i]-arr[i-1]);
        int b=dp[i-2]+abs(arr[i]-arr[i-2]);

        dp[i]=min(a,b);


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


Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'memset' was not declared in this scope
   12 |     memset(dp,10000,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

package practice;
import java.util.*;
public class frog1 {

	public static void main(String[] args)
	{
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int arr[]=new int[n];
		int dp[]=new int[n+1];
		for(int i=0;i<n;i++)
		{
			arr[i]=sc.nextInt();
		}
		dp[1]=Math.abs(arr[0]-arr[1]);
		for(int i=2;i<n;i++)
		{
			int opt1=dp[i-2]+Math.abs(arr[i-2]-arr[i]);
			int opt2=dp[i-1]+Math.abs(arr[i]-arr[i-1]);
		//	System.out.println(opt1+" "+opt2);
			dp[i]=Math.min(opt1, opt2);
		}
		System.out.println(dp[n-1]);
	}
}


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 main(){
	int N, W;
	cin >> N >> W;
	
	long long * dp;
	dp = new long long [W + 1];
	memset(dp, 0, sizeof dp);
	long w, v;
  
	while(N--){
		cin >> w >> v;
		for(int weight = W - w; weight >= 0; weight--){
			dp[weight + w] = max(dp[weight + w], dp[weight] + v);
		}	
	}
	long long ans = 0;
	for(int i = 0; i < W + 1; i++){
		ans = max(dp[i], ans);
	}
	cout << ans;


Compiler output:
a.cc: In function 'int main()':
a.cc:24:21: error: expected '}' at end of input
   24 |         cout << ans;
      |                     ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

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

#define ll long long
#define endl "\n"

ll a[10000005],dp[10000005],n;


ll solve(ll a[], ll i){
  	if(i==n-1)
      return 0;
    if(i>=n)
      	return INT_MAX;
    ll left=abs(a[i]-a[i+1])+solve(a,i+1);
  	ll right=INT_MAX;
  	if(i+2<n){
      right=abs(a[i]-a[i+2])+solve(a,i+2);
    }
  return min(right,less);
}

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

Compiler output:
a.cc: In function 'long long int solve(long long int*, long long int)':
a.cc:20:24: error: missing template arguments before ')' token
   20 |   return min(right,less);
      |                        ^
Language: C

#include<stdio.h>
#include <math.h>
#include <algorithm>
int min(int a,int b)
{
  if(a>b)
    return b;
  else 
    return a;
}
 
int main()
{
    int n,k;
    scanf("%d %d",&n,&k);
    int h[n];
    for(int i=0;i<n;i++)
    {
        scanf("%d",&h[i]);
    }
    int dp[n];
  for(int i=0;i<n;i++)
    dp[i]=(int) INFINITY;
  dp[0]=0;
    dp[1]= abs(h[1]-h[0]);
    for(int i=2;i<n;i++)
    {
      for(int j=1;j<=k;j++)
      {
        
        dp[i]=min(dp[i], abs(h[i-j]-h[i])+dp[i-j]);
    }
    }
    printf("%d",dp[n-1]);
    return 0;
}


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

#include<stdio.h>
#include <math.h>
int min(int a,int b)
{
  if(a>b)
    return b;
  else 
    return a;
}
 
int main()
{
    int n,k;
    scanf("%d %d",&n,&k);
    int h[n];
    for(int i=0;i<n;i++)
    {
        scanf("%d",&h[i]);
    }
    int dp[n];
  for(int i=0;i<n;i++)
    dp[i]=(int) INFINITY;
  dp[0]=0;
    dp[1]= abs(h[1]-h[0]);
    for(int i=2;i<n;i++)
    {
      for(int j=1;j<=k;j++)
      {
        
        dp[i]=min(dp[i], abs(h[i-j]-h[i])+dp[i-j]);
    }
    }
    printf("%d",d[n-1]);
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:24:12: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
   24 |     dp[1]= abs(h[1]-h[0]);
      |            ^~~
main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
    2 | #include <math.h>
  +++ |+#include <stdlib.h>
    3 | int min(int a,int b)
main.c:33:17: error: 'd' undeclared (first use in this function); did you mean 'dp'?
   33 |     printf("%d",d[n-1]);
      |                 ^
      |                 dp
main.c:33:17: note: each undeclared identifier is reported only once for each function it appears in
Language: C

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

const long long INF = 1LL << 60;

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

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

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

    // 初期化 (最小化問題なので INF に初期化)
    for (int i = 0; i < 100010; ++i) dp[i] = INF;

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

    // ループ
    for (int i = 1; i < N; ++i) {
        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;
}

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

#include<iostream>
#include<vector>

using namespace std;
int frog_001(vector<int>&arr,int n,vector<int>&dp)
{
  dp[1] = 0;
  for(int i=2;i<=n;i++)
  {
    int option1 = abs(arr[i] - arr[i-1])+dp[i-1];
    int option2 = (i==2)?inf : abs(arr[i] - arr[i-2])+dp[i-2];
    dp[i] = min(option1,option2);
  }
  return dp[n];
}
void frog1()
{
    int n;
    cin>>n;
  
    vector<int>arr(n+1,0) ;
  for(int i=1;i<n;i++)cin>>arr[i];
    vector<int>dp(n+1,0);
   // cout<<frog_01(arr,1,n,dp)<<endl;
    cout<<frog_001(arr,n,dp);
 
}
int main()
{
  frog1();
}


Compiler output:
a.cc: In function 'int frog_001(std::vector<int>&, int, std::vector<int>&)':
a.cc:11:26: error: 'inf' was not declared in this scope; did you mean 'int'?
   11 |     int option2 = (i==2)?inf : abs(arr[i] - arr[i-2])+dp[i-2];
      |                          ^~~
      |                          int
Language: C

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/* 
 * File:   main.c
 * Author: debian
 *
 * Created on July 28, 2020, 7:23 PM
 */

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


int min(int a, int b){
    if(a<b)
        return a;
    else
        return b;
}

/*
 * 
 */
int main(int argc, char** argv) {

    int size, v1, v2;
    
    scanf("%d",&size);
    
    int arr [size];
    int arr2 [size];
    
    
    if(size == 2){
        int a, b;
        scanf("%d %d", &a, &b);
        printf("%d", abs(a-b));
        return (EXIT_SUCCESS);
    }
    
    
    for (int i = 0; i < size; i++) {
        scanf("%d", &arr[i]);
    }
    
    arr2[0] = 0;
    arr2[1] = abs(arr[1] - arr[0]);
    
    for (int i = 2; i < size; i++) {
        arr2[i] = min(arr2[i-1]+abs(arr[i]-arr[i-1]),arr2[i-2]+abs(arr[i]-arr[i-2]));
    }
    
    printf("%d",arr2[i]);
    
    
    return (EXIT_SUCCESS);
}



Compiler output:
main.c: In function 'main':
main.c:58:22: error: 'i' undeclared (first use in this function)
   58 |     printf("%d",arr2[i]);
      |                      ^
main.c:58:22: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX;
int solve(int a[],int n){
	int dp[n+1];
  	dp[1]=0;
    for(int i=2;i<=n;i++){
      int option1=abs(a[i]-a[i-1])+dp[i-1];
      int option2=(i==2)?inf:abs(a[i]-a[i-2])+dp[i-2];
      dp[i]=min(option1,option2);
    }
    return dp[n];
}
int main(){
	int n;
  	cin>>n;
    int a[n+1];
  	for(int i=1;i<=n;i++)cin>>a[i];
  	cout<<solve(a,n)<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int solve(int*, int)':
a.cc:3:20: error: expected ':' before ';' token
    3 | #define inf INT_MAX;
      |                    ^
a.cc:9:26: note: in expansion of macro 'inf'
    9 |       int option2=(i==2)?inf:abs(a[i]-a[i-2])+dp[i-2];
      |                          ^~~
a.cc:3:20: error: expected primary-expression before ';' token
    3 | #define inf INT_MAX;
      |                    ^
a.cc:9:26: note: in expansion of macro 'inf'
    9 |       int option2=(i==2)?inf:abs(a[i]-a[i-2])+dp[i-2];
      |                          ^~~
a.cc:9:29: error: expected primary-expression before ':' token
    9 |       int option2=(i==2)?inf:abs(a[i]-a[i-2])+dp[i-2];
      |                             ^
Language: Java

import java.util.*;
public class EducationalDp1 {
	public static void main(String[] args) {
		Scanner scn=new Scanner(System.in);
		int n=scn.nextInt();
		int[] arr=new int[n];
		for(int i=0;i<n;i++) {
			arr[i]=scn.nextInt();
		}
		System.out.println(frog1(arr));
		
		
	}
	public static int frog1(int[] heights) {
		
		int[] dp=new int[heights.length];
		dp[0]=0;
		dp[1]=Math.abs(heights[0]-heights[1]);
		for(int vidx=2;vidx<heights.length;vidx++) {
		
		
		dp[vidx]=Math.min(Math.abs(heights[vidx]-heights[vidx-1])+dp[vidx-1], Math.abs(heights[vidx]-heights[vidx-2])+dp[vidx-2]);
			
		}
		int len=heights.length;
		return dp[len-1];
			
	}

}


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

#include<bits/stdc++.h>
using namespace std;
long long int n;
const long long int x=100000;
long long int a[x];
long long int dp[x+10];
int frog_jump(int i)
{
  long long int left=INT_MAX,right=INT_MAX,ans;
  if(i+1==n)
    return 0;
  if(dp[i]!=-1)
    return dp[i];
  if(i+1<=n-1)
  {
    left=abs(a[i]-a[i+1])+frog_jump(i+1);
  }
  if(i+2<=n-1)
    right=abs(a[i]-a[i+2])+frog_jump(i+2);
  dp[i]=min(left,right);
  return dp[i];
  
}
int main()
{
  long long int result;
  memset(dp,-1,sizeOf(dp));
  cin>>n;
  for(int i=0;i<n;i++)
  	cin>>a[i];
  result=frog_jump(0);
  cout<<result<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:16: error: 'sizeOf' was not declared in this scope; did you mean 'size_t'?
   27 |   memset(dp,-1,sizeOf(dp));
      |                ^~~~~~
      |                size_t
Language: C++

#include<bits/stdc++.h>
using namespace std;
long long int ans,n;
long long int x=1000000;
long long int a[x];
int frog_jump(int i)
{
  long long int left,right;
  if(i+1>=0)
    return 0;
  else
  {
    left=abs(a[i]-a[i])+frog_jump(i+1);
    right=abs(a[i]-a[i+2])+frog_jump(i+2);
    ans=min(left,right);
  }
  return ans;
}
int main()
{
  long long int result;
  cin>>n;
  for(int i=0;i<n;i++)
  	cin>>a[i];
  result=frog_jump(1);
  cout<<result<<endl;
}

Compiler output:
a.cc:5:17: error: size of array 'a' is not an integral constant-expression
    5 | long long int a[x];
      |                 ^
Language: Java

/**
 * 
 */
//package AtCoder;
import java.util.*;
/**
 * @author Shivansh Singh
 *
 */
public class dp_a {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc=new Scanner(System.in);
		int n,i;
		n=sc.nextInt();
		int []arr=new int[n];
		for (i=0;i<n;i++)
			arr[i]=sc.nextInt();
		int []dp=new int[n+1];
		dp[0]=dp[1]=0;
		dp[2]=(int)Math.abs(arr[1]-arr[0]);
		for (i=3;i<=n;i++)
			dp[i]=(int)Math.min(dp[i-1]+Math.abs(arr[i-1]-arr[i-2]),dp[i-2]+Math.abs(arr[i-1]-arr[i-3]));
		System.out.println(dp[n]);
		sc.close();
	}

}


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

#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long
int mod=1e9+7;

signed main()
{

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
	
  	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

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


}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:5: error: expected ',' or ';' before 'for'
   21 |     for (int i=0;i<n;++i)
      |     ^~~
a.cc:21:18: error: 'i' was not declared in this scope
   21 |     for (int i=0;i<n;++i)
      |                  ^
a.cc:28:64: error: expected ')' before ';' token
   28 |     dp[i]=min(abs(v[i]-v[i-1])+dp[i-1],abs(v[i]-v[i-2]+dp[i-2]);
      |              ~                                                 ^
      |                                                                )
Language: C++

vector <vector<int> > inp;
 
int dp[(int)pow(10,5)][3];
 
int find(int n,int A){
  if(n==1) return inp[n-1][A];
  if(dp[n-1][A]!=0){
    return dp[n-1][A] ;
  }
  else{
  	dp[n-1][A] = max(inp[n-1][A]+find(n-1,(A+1)%3), inp[n-1][A]+find(n-1,(A+2)%3));
    return dp[n-1][A] ;
  }
	  
}
 
int main(){
    int N,temp;
    cin >> N;
    for(int i=0;i<N;i++){
      vector<int>  temp1;
      for(int j=0;j<3;j++){
        cin >> temp;
        temp1.push_back(temp);
 
      }  
      inp.push_back(temp1);
    }	
    for(int i=0;i<N;i++){
      for(int j=0;j<3;j++){
        dp[i][j]=0;
      }
    }    
 
    
    int happ = max(find(3,0),find(3,1));
    int final_happ = max(happ,find(3,2));
    cout << happ;
    return 0;
  
}

Compiler output:
a.cc:1:1: error: 'vector' does not name a type
    1 | vector <vector<int> > inp;
      | ^~~~~~
a.cc:3:13: error: 'pow' was not declared in this scope
    3 | int dp[(int)pow(10,5)][3];
      |             ^~~
a.cc: In function 'int find(int, int)':
a.cc:6:19: error: 'inp' was not declared in this scope; did you mean 'int'?
    6 |   if(n==1) return inp[n-1][A];
      |                   ^~~
      |                   int
a.cc:7:6: error: 'dp' was not declared in this scope
    7 |   if(dp[n-1][A]!=0){
      |      ^~
a.cc:11:26: error: 'inp' was not declared in this scope; did you mean 'int'?
   11 |         dp[n-1][A] = max(inp[n-1][A]+find(n-1,(A+1)%3), inp[n-1][A]+find(n-1,(A+2)%3));
      |                          ^~~
      |                          int
a.cc:11:22: error: 'max' was not declared in this scope
   11 |         dp[n-1][A] = max(inp[n-1][A]+find(n-1,(A+1)%3), inp[n-1][A]+find(n-1,(A+2)%3));
      |                      ^~~
a.cc: In function 'int main()':
a.cc:19:5: error: 'cin' was not declared in this scope
   19 |     cin >> N;
      |     ^~~
a.cc:21:7: error: 'vector' was not declared in this scope
   21 |       vector<int>  temp1;
      |       ^~~~~~
a.cc:21:14: error: expected primary-expression before 'int'
   21 |       vector<int>  temp1;
      |              ^~~
a.cc:24:9: error: 'temp1' was not declared in this scope; did you mean 'temp'?
   24 |         temp1.push_back(temp);
      |         ^~~~~
      |         temp
a.cc:27:7: error: 'inp' was not declared in this scope; did you mean 'int'?
   27 |       inp.push_back(temp1);
      |       ^~~
      |       int
a.cc:27:21: error: 'temp1' was not declared in this scope; did you mean 'temp'?
   27 |       inp.push_back(temp1);
      |                     ^~~~~
      |                     temp
a.cc:31:9: error: 'dp' was not declared in this scope
   31 |         dp[i][j]=0;
      |         ^~
a.cc:36:16: error: 'max' was not declared in this scope
   36 |     int happ = max(find(3,0),find(3,1));
      |                ^~~
a.cc:38:5: error: 'cout' was not declared in this scope
   38 |     cout << happ;
      |     ^~~~
Language: C++

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

int dp[pow(10,5)][3];

int find(int n,int A){
  if(dp[n-1][A]!=0){
    return dp[n-1][A] ;
  }
  else{
  	dp[n-1][A] = max(inp[n-1][A]+find(n-1,(A+1)%3), inp[n-1][A]+find(n-1,(A+2)%3));
    return dp[n-1][A] ;
  }
	  
}
 
int main(){
    int N,temp;
    cin >> N;
    for(int i=0;i<N;i++){
      vector<int>  temp1;
      for(int j=0;j<3;j++){
        cin >> temp;
        temp1.push_back(temp);

      }  
      inp.push_back(temp1);
    }	
    for(int i=0;i<N;i++){
      for(int j=0;j<3;j++){
        dp[i][j]=0;
      }
    }    
 
    
    int happ = max(find(3,0),find(3,1));
    int final_happ = max(happ,find(3,2));
    cout << final_happ;
    return 0;
  
}

Compiler output:
a.cc:6:11: error: conversion from '__gnu_cxx::__promote<double>::__type' {aka 'double'} to 'long unsigned int' in a converted constant expression
    6 | int dp[pow(10,5)][3];
      |        ~~~^~~~~~
a.cc:6:11: error: could not convert 'std::pow<int, int>(10, 5)' from '__gnu_cxx::__promote<double>::__type' {aka 'double'} to 'long unsigned int'
    6 | int dp[pow(10,5)][3];
      |        ~~~^~~~~~
      |           |
      |           __gnu_cxx::__promote<double>::__type {aka double}
a.cc:6:11: error: size of array 'dp' has non-integral type '__gnu_cxx::__promote<double>::__type' {aka 'double'}
Language: C++

#include<bits/stdc++.h>
using namespace std;
 
vector <vector<int> > inp;
int N,temp;
cin >> N;
for(int i=0;i<N;i++){
  vector<int>  temp1;
  for(int j=0;j<3;j++){
    cin >> temp;
    temp1.push_back(temp);
 
  }  
  inp.push_back(temp1);
}
int dp[inp.size()][3];
for(int i=0;i<N;i++){
  for(int j=0;j<3;j++){
    dp[i][j]=0;
  }
}
int find(int n,int A){
  if(dp[n-1][A]!=0){
    return dp[n-1][A] ;
  }
  else{
  	dp[n-1][A] = max(inp[n-1][A]+find(n-1,(A+1)%3), inp[n-1][A]+find(n-1,(A+2)%3));
    return dp[n-1][A] ;
  }
	  
}
 
int main(){
	
    
 
    
    int happ = max(find(3,0),find(3,1));
    int final_happ = max(happ,find(3,2));
    cout << final_happ;
    return 0;
  
}

Compiler output:
a.cc:6:1: error: 'cin' does not name a type
    6 | cin >> N;
      | ^~~
a.cc:7:1: error: expected unqualified-id before 'for'
    7 | for(int i=0;i<N;i++){
      | ^~~
a.cc:7:13: error: 'i' does not name a type
    7 | for(int i=0;i<N;i++){
      |             ^
a.cc:7:17: error: 'i' does not name a type
    7 | for(int i=0;i<N;i++){
      |                 ^
a.cc:16:16: error: size of array 'dp' is not an integral constant-expression
   16 | int dp[inp.size()][3];
      |        ~~~~~~~~^~
a.cc:17:1: error: expected unqualified-id before 'for'
   17 | for(int i=0;i<N;i++){
      | ^~~
a.cc:17:13: error: 'i' does not name a type
   17 | for(int i=0;i<N;i++){
      |             ^
a.cc:17:17: error: 'i' does not name a type
   17 | for(int i=0;i<N;i++){
      |                 ^