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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:20:51: error: expected ')' before ';' token
   20 |       sol[i]=min(sol[i-count]+abs(a[i]-a[i-count]);
      |                 ~                                 ^
      |                                                   )
a.cc:25:18: error: expected '}' at end of input
   25 |   cout<<sol[n-1];
      |                  ^
a.cc:5:1: note: to match this '{'
    5 | {
      | ^
Language: C++

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

Compiler output:
a.cc:1:1: error: 'clude' does not name a type
    1 | clude<bits/stdc++.h>
      | ^~~~~
a.cc: In function 'int main()':
a.cc:7:3: error: 'cin' was not declared in this scope
    7 |   cin>>n;
      |   ^~~
a.cc:14:10: error: 'abs' was not declared in this scope
   14 |   sol[1]=abs(a[1]-a[0])
      |          ^~~
a.cc:15:18: error: expected ';' before ')' token
   15 |   for(i=2;i<n;i++)
      |                  ^
      |                  ;
a.cc:17:3: error: 'cout' was not declared in this scope
   17 |   cout<<sol[n];
      |   ^~~~
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:14:24: error: expected ';' before 'for'
   14 |   sol[1]=abs(a[1]-a[0])
      |                        ^
      |                        ;
   15 |   for(i=2;i<n;i++)
      |   ~~~                   
a.cc:15:18: error: expected ';' before ')' token
   15 |   for(i=2;i<n;i++)
      |                  ^
      |                  ;
Language: C++

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

Compiler output:
a.cc:1:1: error: 'clude' does not name a type
    1 | clude<bits/stdc++.h>
      | ^~~~~
a.cc: In function 'int main()':
a.cc:7:3: error: 'cin' was not declared in this scope
    7 |   cin>>n;
      |   ^~~
a.cc:14:10: error: 'abs' was not declared in this scope
   14 |   sol[1]=abs(a[1]-a[0])
      |          ^~~
a.cc:15:18: error: expected ';' before ')' token
   15 |   for(i=2;i<n;i++)
      |                  ^
      |                  ;
a.cc:17:3: error: 'cout' was not declared in this scope
   17 |   cout<<sol[n];
      |   ^~~~
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:14:24: error: expected ';' before 'for'
   14 |   sol[1]=abs(a[1]-a[0])
      |                        ^
      |                        ;
   15 |   for(i=2;i<n;i++)
      |   ~~~                   
a.cc:15:18: error: expected ';' before ')' token
   15 |   for(i=2;i<n;i++)
      |                  ^
      |                  ;
a.cc:17:16: error: expected '}' at end of input
   17 |   cout<<sol[n];
      |                ^
a.cc:5:1: note: to match this '{'
    5 | {
      | ^
Language: C++

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0; i<n; i++)

const int INF = 1001001001;

using namespace std;

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

    int n; cin >> n;
    vector<int> h(n); rep(i,n) cin >> h[i];

    vector<int> dp(n,INF);

    dp[0] = 0;
    dp[1] = abs(h[0]-h[1]);

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

    cout << dp[n-1] << "\n";

    return 0;
}

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

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0; i<n; i++)

const int INF = 1001001001;

using namespace std;

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

    int n; cin >> n;
    vector<int> h(n); rep(i,n) cin >> h[i];

    vector<int> dp(n,INF);

    dp[0] = 0;
    dp[1] = abs(h[0]-h[1]);

    /*for(int i=2; i<n; i++) {
        for (int j=0; j<j; j++) {



        }
        dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));

    }*/

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

    cout << dp[n-1] << "\n";

    return 0;
}

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

#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REP(a, b, m) for (ll a = (ll)(b); a < (ll)(m); a++)

const long long INF = 1e9;
int main()
{
    int n;
    cin >> n;
    vector<int> h(n);
    ll dp(n, 1e9);
    rep(i, n)
    {
        cin >> h[i];
    }
    rep(i, n)
    {
        dp[0] = 0;
        rep(i, n)
        {
           
            else if (i == 1)
            {
                dp[1] = abs(h[1] - h[0]);
            }
            dp[i] = min((dp[i - 1] + abs(h[i] - h[i - 1])), (dp[i - 2] + abs(h[i - 2])));
        }
    }
    cout << dp[n - 1] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:17: error: expression list treated as compound expression in initializer [-fpermissive]
   16 |     ll dp(n, 1e9);
      |                 ^
a.cc:23:11: error: invalid types 'll {aka long long int}[int]' for array subscript
   23 |         dp[0] = 0;
      |           ^
a.cc:27:13: error: 'else' without a previous 'if'
   27 |             else if (i == 1)
      |             ^~~~
a.cc:29:19: error: invalid types 'll {aka long long int}[int]' for array subscript
   29 |                 dp[1] = abs(h[1] - h[0]);
      |                   ^
a.cc:31:15: error: invalid types 'll {aka long long int}[ll {aka long long int}]' for array subscript
   31 |             dp[i] = min((dp[i - 1] + abs(h[i] - h[i - 1])), (dp[i - 2] + abs(h[i - 2])));
      |               ^
a.cc:31:28: error: invalid types 'll {aka long long int}[ll {aka long long int}]' for array subscript
   31 |             dp[i] = min((dp[i - 1] + abs(h[i] - h[i - 1])), (dp[i - 2] + abs(h[i - 2])));
      |                            ^
a.cc:31:64: error: invalid types 'll {aka long long int}[ll {aka long long int}]' for array subscript
   31 |             dp[i] = min((dp[i - 1] + abs(h[i] - h[i - 1])), (dp[i - 2] + abs(h[i - 2])));
      |                                                                ^
a.cc:34:15: error: invalid types 'll {aka long long int}[int]' for array subscript
   34 |     cout << dp[n - 1] << endl;
      |               ^
Language: C++

size = int(input())
array =  list(map(int, input().split()))
dp = [0]* size
for jump in range(1,size):
	z= [1,2]
	for i in range(len(z)):
		dp[jump] = min(dp[jump],dp[i] + dp[jump] )

print(dp[-1])

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

#include<bits/stdc++.h>
using namespace std;
typdef long long ll;
int main()
{
  ll n;
  cin>>n;
  ll a,b,c;
  cin>>a>>b>>c;
  for(ll i=1;i<n;i++)
  {
    ll e,f,g;
    cin>>e>>f>>g;
    ll x,y,z;
    x=a;
    y=b;
    z=c;
    a=e+max(y,z);
    b=f+max(x,z);
    c=g+max(x,y);
  }
  cout<<max(max(a,b),c);
  return 0;
}

Compiler output:
a.cc:3:1: error: 'typdef' does not name a type; did you mean 'typedef'?
    3 | typdef long long ll;
      | ^~~~~~
      | typedef
a.cc: In function 'int main()':
a.cc:6:3: error: 'll' was not declared in this scope
    6 |   ll n;
      |   ^~
a.cc:7:8: error: 'n' was not declared in this scope; did you mean 'yn'?
    7 |   cin>>n;
      |        ^
      |        yn
a.cc:8:5: error: expected ';' before 'a'
    8 |   ll a,b,c;
      |     ^~
      |     ;
a.cc:9:8: error: 'a' was not declared in this scope
    9 |   cin>>a>>b>>c;
      |        ^
a.cc:9:11: error: 'b' was not declared in this scope
    9 |   cin>>a>>b>>c;
      |           ^
a.cc:9:14: error: 'c' was not declared in this scope
    9 |   cin>>a>>b>>c;
      |              ^
a.cc:10:9: error: expected ';' before 'i'
   10 |   for(ll i=1;i<n;i++)
      |         ^~
      |         ;
a.cc:10:14: error: 'i' was not declared in this scope
   10 |   for(ll i=1;i<n;i++)
      |              ^
a.cc:12:7: error: expected ';' before 'e'
   12 |     ll e,f,g;
      |       ^~
      |       ;
a.cc:13:10: error: 'e' was not declared in this scope
   13 |     cin>>e>>f>>g;
      |          ^
a.cc:13:13: error: 'f' was not declared in this scope
   13 |     cin>>e>>f>>g;
      |             ^
a.cc:13:16: error: 'g' was not declared in this scope
   13 |     cin>>e>>f>>g;
      |                ^
a.cc:14:7: error: expected ';' before 'x'
   14 |     ll x,y,z;
      |       ^~
      |       ;
a.cc:15:5: error: 'x' was not declared in this scope
   15 |     x=a;
      |     ^
a.cc:16:5: error: 'y' was not declared in this scope; did you mean 'yn'?
   16 |     y=b;
      |     ^
      |     yn
a.cc:17:5: error: 'z' was not declared in this scope
   17 |     z=c;
      |     ^
Language: C++

#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const int INF = 2147483647;

ll  main() {
    ll n;
    cin >> n;
    vector<ll> h(n);
    for (ll i=0;i<n;++i){
        cin >> h.at(i);
    }
    vector<ll> dp(n);
    dp.at(0) = 0;
    for (ll i=1;i<n;++i){
        dp.at(i) = INF;
    }
    for (ll i=0;i<n-2;++i){
        ll cost1,cost2;
        cost1 = abs(h.at(i+1)-h.at(i))+dp.at(i);
        cost2 = abs(h.at(i+2)-h.at(i))+dp.at(i);
        dp.at(i+1) = min(dp.at(i+1),cost1);
        dp.at(i+2) = min(dp.at(i+2),cost2);
    }
    // cost1はもう一回求められる
    ll cost1 = abs(h.at(n-1)-h.at(n-2))+dp.at(n-2);
    dp.at(n-1) = min(dp.at(n-1),cost1);

    cout << dp.at(n-1) << endl;
    return 0;
}


Compiler output:
a.cc:6:1: error: '::main' must return 'int'
    6 | ll  main() {
      | ^~
Language: C++

#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const ll INF = 2147483647;

ll  main() {
    ll n;
    cin >> n;
    vector<ll> h(n);
    for (ll i=0;i<n;++i){
        cin >> h.at(i);
    }
    vector<ll> dp(n);
    dp.at(0) = 0;
    for (ll i=1;i<n;++i){
        dp.at(i) = INF;
    }
    for (ll i=0;i<n-2;++i){
        ll cost1,cost2;
        cost1 = abs(h.at(i+1)-h.at(i))+dp.at(i);
        cost2 = abs(h.at(i+2)-h.at(i))+dp.at(i);
        dp.at(i+1) = min(dp.at(i+1),cost1);
        dp.at(i+2) = min(dp.at(i+2),cost2);
    }
    // cost1はもう一回求められる
    ll cost1 = abs(h.at(n-1)-h.at(n-2))+dp.at(n-2);
    dp.at(n-1) = min(dp.at(n-1),cost1);

    cout << dp.at(n-1) << endl;
    return 0;
}


Compiler output:
a.cc:6:1: error: '::main' must return 'int'
    6 | ll  main() {
      | ^~
Language: C++

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:7:12: error: 'n' was not declared in this scope; did you mean 'yn'?
    7 |     cin >> n;
      |            ^
      |            yn
a.cc:10:16: error: 'a' was not declared in this scope
   10 |         cin >> a[i];
      |                ^
a.cc:12:5: error: 'dp' was not declared in this scope; did you mean 'dup'?
   12 |     dp[0] = 0;
      |     ^~
      |     dup
a.cc:13:17: error: 'a' was not declared in this scope
   13 |     dp[1] = abs(a[1] - a[0]);
      |                 ^
Language: C++

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


Compiler output:
a.cc: In function 'int main()':
a.cc:7:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    7 |     for(int i=0;i<h;i++)cin >> h[i];
      |                 ~^~
Language: Java

import java.util.*;
public class frog1 {
	
	public static void main(String[] args) {
		Scanner kb = new Scanner(System.in);
		int n = kb.nextInt();
		int[] h = new int[n];
		for(int i = 0; i < n; i++) {
			h[i] = kb.nextInt();
		}
		int[] dp = new int[n];
		dp[0] = 0;
		dp[1] = Math.abs(h[0]-h[1]);
		for(int i =2; i < n; i++) {
			int one = dp[i-1] + Math.abs(h[i-1] - h[i]);
			int two = dp[i-2] + Math.abs(h[i-2] - h[i]);
			dp[i] = Math.min(one, two);
		}
		System.out.println(dp[n-1]);
		//System.out.println(Arrays.toString(dp));
	}
	
}


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: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:13:6: error: lvalue required as left operand of assignment
   13 |   dp[1=abs(h[0]-h[1]);
      |      ^
a.cc:13:22: error: expected ']' before ';' token
   13 |   dp[1=abs(h[0]-h[1]);
      |                      ^
      |                      ]
a.cc:16:67: error: expected ')' before ';' token
   16 |        dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]);
      |                 ~                                                 ^
      |                                                                   )
Language: C++

#include<bits/stdc++.h>
using namespace std;
int dp[200005];
int a[200005];
int main()
{
    int n;
    cin>>n;

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


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

#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>

using namespace std;

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(a) (a).begin(),(a).end()
#define PI 3.141592653589793238
#define INF 1050000000

using vi = vector<int>;


long long dp[110000];

long long dfs(int k,int N,vi h) 
{
	if (k >=N)return INF;
	if (k == N - 1)return 0;

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

	long long step1 = dfs(k+ 1, N, h) + abs(h[k + 1] - h[k]);
	long long step2 = dfs(k + 2, N, h) + abs(h[k + 2] - h[k]);

	
	return dp[k] = min(step1, step2);
}

int main() {

	int N;

	cin >> N;

	vector<long long> h(N+1);

	REP(i, N) {
		cin >> h[i];
	}

	REP(i, 110000) {
		dp[i] = -1;
	}


	cout << dfs(0,N,h) << endl;



	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:25: error: could not convert 'h' from 'vector<long long int>' to 'vector<int>'
   51 |         cout << dfs(0,N,h) << endl;
      |                         ^
      |                         |
      |                         vector<long long int>
Language: C++

#include<algorithm>
#include<string>
#include<vector>
#include<iostream>
# define ll int64_t
# define rep(i,n) for(ll i=0;i<n;i++)
# define rrep(i,n) for(ll i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define mod 1000000007
# define vec vector
#define dump(x) cerr<<#x<<"="<<x<<endl
using namespace std;

bool compare_by_b(pair<string,ll> a,pair<string,ll> b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

bool my_compare(pair<string,ll> a,pair<string,ll> b){
    
    if(a.first != b.first) return a.first<b.first;
    if(a.second != b.second) return a.second>b.second;
    else return true;
}

ll factorial(ll n){
    ll x=1;
    rrep(i,n) (x*=i)%=mod;
    return x;
}

ll gcd(ll a,ll b)
{
   if (a%b == 0) return(b);
   else return(gcd(b,a%b));
}

ll lcm(ll a,ll b)
{
   return a/gcd(a,b)*b;
}

//累乗だってさ
ll modpow(ll a,ll n,ll mod1) {
    ll res=1;
    while(n>0){
        if(n&1) res=res*a%mod1;
        a = a*a%mod1;
        n >>= 1;
    }
    return res;
}
//逆元だってさ
ll modinv(ll a,ll mod1) {
    return modpow(a, mod1 - 2, mod1);
}

const ll MAX = 1000000;
const ll MOD = 1000000007;

ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n;
    cin>>n;
    vector<ll> a(n),dp(n+10,mod);
    rep(i,n) cin>>a[i];
    dp[0]=0;
    
    rep(i,n+1)　dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
    cout<<dp[n-1]<<endl;
    return 0;
}

Compiler output:
a.cc:96:15: error: extended character 　 is not valid in an identifier
   96 |     rep(i,n+1)　dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
      |               ^
a.cc: In function 'int main()':
a.cc:96:15: error: '\U00003000dp' was not declared in this scope
   96 |     rep(i,n+1)　dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
      |               ^~~~
Language: C++

#include <iostream>
#include <vector>
#include <map>
#include <iostream>
#include <algorithm>
#include <string>
#include <memory>
#define MX 2147483647
using namespace std;

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


int solve(int index){
	if (index >= n)
		return MX;
	if (index == n - 1)
		return 0;
	if (dp[index] != -1)
		return dp[index];
	int minimum_answer = MX;
	minimum_answer = min(minimum_answer, abs(arr[index + 1] - arr[index]) + solve(index + 1));
	if (index + 2 < n)
		minimum_answer = min(minimum_answer, abs(arr[index + 2] - arr[index]) + solve(index + 2));
	return dp[index] = minimum_answer;
}

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

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

#include <iostream>
#include <vector>
#include <map>
#include <iostream>
#include <algorithm>
#include <string>
#define MX 2147483647
using namespace std;

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


int solve(int index){
	if (index >= n)
		return MX;
	if (index == n - 1)
		return 0;
	if (dp[index] != -1)
		return dp[index];
	int minimum_answer = MX;
	minimum_answer = min(minimum_answer, abs(arr[index + 1] - arr[index]) + solve(index + 1));
	if (index + 2 < n)
		minimum_answer = min(minimum_answer, abs(arr[index + 2] - arr[index]) + solve(index + 2));
	return dp[index] = minimum_answer;
}

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

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

#include <iostream>
#include <vector>
#include <map>
#include <iostream>
#include <algorithm>
#define MX 2147483647
using namespace std;

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


int solve(int index){
	if (index >= n)
		return MX;
	if (index == n - 1)
		return 0;
	if (dp[index] != -1)
		return dp[index];
	int minimum_answer = MX;
	minimum_answer = min(minimum_answer, abs(arr[index + 1] - arr[index]) + solve(index + 1));
	if (index + 2 < n)
		minimum_answer = min(minimum_answer, abs(arr[index + 2] - arr[index]) + solve(index + 2));
	return dp[index] = minimum_answer;
}

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

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

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

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


int solve(int index){
	if (index >= n)
		return INT_MAX;
	if (index == n - 1)
		return 0;
	if (dp[index] != -1)
		return dp[index];
	int minimum_answer = INT_MAX;
	minimum_answer = min(minimum_answer, abs(arr[index + 1] - arr[index]) + solve(index + 1));
	if (index + 2 < n)
		minimum_answer = min(minimum_answer, abs(arr[index + 2] - arr[index]) + solve(index + 2));
	return dp[index] = minimum_answer;
}

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

Compiler output:
a.cc: In function 'int solve(int)':
a.cc:14:24: error: 'INT_MAX' was not declared in this scope
   14 |                 return INT_MAX;
      |                        ^~~~~~~
a.cc:6:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    5 | #include <algorithm>
  +++ |+#include <climits>
    6 | using namespace std;
a.cc:19:30: error: 'INT_MAX' was not declared in this scope
   19 |         int minimum_answer = INT_MAX;
      |                              ^~~~~~~
a.cc:19:30: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
a.cc: In function 'int main()':
a.cc:27:9: error: 'memset' was not declared in this scope
   27 |         memset(dp, -1, sizeof dp);
      |         ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include <algorithm>
  +++ |+#include <cstring>
    6 | using namespace std;
Language: Java

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

public class A {

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

        int[] h = new int[n];
        int[] dp = new int[n];

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

        sc.close();

        Arrays.fill(dp, (int)2e9);
        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(h[i] - h[i+1]));
            } 
            if (i + 2 < n) {
                dp[i+2] = Math.min(dp[i+2], dp[i] + Math.abs(h[i] - h[i+2]));
            }
        }

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

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

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

public class A {


    public static void solve() {
        int n = in.nextInt();

        int[] stones = new int[n];

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


        int[] store = new int[n];
        
        for(int i = 1; i < n; i += 1) {
            for(int j = 0; j < i; j += 1) {
                store[i] = Math.min(store[i], store[j] + Math.abs(stones[j]-stones[i]));
            }
        }
        
        out.println(store[n-1]);
    }


    public static InputReader in = new InputReader();
    public static PrintWriter out;

    public static void main(String[] args) {
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }


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

        public InputReader() {
            reader = new BufferedReader(new InputStreamReader(System.in));
            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 double nextDouble() {
            return Double.parseDouble(next());
        }

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

        /**
         * When you call next(), that entire line will be skipped.
         * No flushing buffers.
         * Doesn't work when you want to scan the remaining line.
         *
         * @return entire line
         */
        public String nextLine() {
            String str = "";
            try {
                str = reader.readLine();
                tokenizer = null;
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            return str;
        }
    }
}

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

#include<bits/stdc++.h>
using namespace std;
vector<int> g[100005];
int vis[100005];
int dp[100005];
void dfs(int v)
{
vis[v]=1;
//dp[v]=0;
for(auto j:g[v])
{
    dfs(j);
    dp[v]=1+max(dp[j],dp[v]);
}
}
 int main()
 {
     int n,m;
     cin>>n>>m;
     for(int i=0;i<m;i++)
     {
         int u,v;
         cin>>u>>v;
         g[u].push_back(v);
     }
     fill(dp,dp+100005,0);
     dfs(0);
     for(int i=0;i<n;i++)
     {
         ans=max(ans,dp[i]);
     }
     cout<<ans<<endl;
     
 }

Compiler output:
a.cc: In function 'int main()':
a.cc:30:10: error: 'ans' was not declared in this scope; did you mean 'abs'?
   30 |          ans=max(ans,dp[i]);
      |          ^~~
      |          abs
a.cc:32:12: error: 'ans' was not declared in this scope; did you mean 'abs'?
   32 |      cout<<ans<<endl;
      |            ^~~
      |            abs
Language: C++

#pragma GCC optimize("Ofast","unroll-loops")
#pragma GCC target("avx2,fma")
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (__typeof(a) i=(a); i<(b); ++i)
#define iter(it,c) for (__typeof((c).begin()) \
  it = (c).begin(); it != (c).end(); ++it)
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long long ll;
const int INF = ~(1<<31);

const double EPS = 1e-9;
const double pi = acos(-1);
typedef unsigned long long ull;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
template <class T> T smod(T a, T b) {
  return (a % b + b) % b; }

int n, k;
vi stones;
int memo[100050];

int dp(int at) {
  if (at >= n-1) return 0;
  if (memo[at] != -1) return memo[at];
  int bst = dp(at+1) + abs(stones[at]-stones[at+1]);
  for (int i = at+1; i <= at+k; i++) {
    if (i < n) {
      bst = min(bst, dp(i)+abs(stones[at]-stones[i]));
    }
  }
  return memo[bst] = bst;
}

int main() {
  cin >> n >> k;
  stones = vi(n);
  memset(memo, -1, sizeof(memo));
  rep(i,0,n) cin >> stones[i]
  cout << dp(0) << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:30: error: expected ';' before 'cout'
   42 |   rep(i,0,n) cin >> stones[i]
      |                              ^
      |                              ;
   43 |   cout << dp(0) << endl;
      |   ~~~~
Language: Java

import java.util.scanner;

public class Main {
	
	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();
		 }
		 System.out.println(0);
	}
}

Compiler output:
Main.java:1: error: cannot find symbol
import java.util.scanner;
                ^
  symbol:   class scanner
  location: package java.util
Main.java:6: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:6: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
3 errors
Language: Java

import java.util.Scanner;

public class Frog1 {
    public static void main(String[] args){
        Scanner sc= new Scanner(System.in);
        int N= sc.nextInt();
        int cur=N-1;
        int[] arr= new int[N];
        for (int x=0; x<N; x++){
            arr[x]= sc.nextInt();
        }
        int total=0;
        while (cur>=2){
            int temp=arr[cur];
            int first= arr[cur-1];
            int second= arr[cur-2];
            if (Math.abs(first-temp) >= Math.abs(second-temp)){
                total+= Math.abs(second-temp);
                cur-=2;
            }
            else{
                total+= Math.abs(first-temp);
                cur-=1;
            }
        }
        System.out.println(total);
    }
}


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,k;
  cin>>n>>k;
  int a[n];
  int sum;
  for(int i=0;i<n;i++)
    cin>>a[i];
  
  int dp[n];
  dp[0]=0;
  if(n==1)
    {cout<<"0";
    return 0;}
  dp[1]=abs(a[1]-a[0]);
  for(int i=2;i<n;i++)
  {
    
    for(int j=1;j<=k;j++)
    {
      
      
      if(j>i)
        break;
      
      
       
      dp[i]=min(dp[i],dp[i-k]+abs(a[i])-a[k]));
      
      
      
    }
    
  }
                
                cout<<dp[n-1];
  
  return 0;
}

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

#include<bits/stdc++.h>

using namespace std;
main(){
  
 int n;
  cin>>n;
  int a[n];
  int sum;
  for(int i=0;i<n;i++)
    cin>>a[i];
  
  int dp[n];
  dp[0]=0;
  if(n==1)
    return 0;
  dp[1]=abs(a[1]-a[0]);
  for(int i=1;i<n;i++)
  {
       
      dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]);
    
  }
                
                cout<<dp[n-1];
  
}

Compiler output:
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:21:66: error: expected ')' before ';' token
   21 |       dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]);
      |                ~                                                 ^
      |                                                                  )
Language: C++

def get_min(a,b):
    a = int(a)
    b = int(b)
    if(a < b):
        return a
    else:
        return b

N = int(input())
hn = [int(x) for x in input().split()]

dp = [float('inf')] * N

#一番最初の足場にいるときはコスト0
dp[0] = 0
dp[1] = dp[0] + abs(hn[1]-hn[0])

#dp[i]が足場iにいくのにかかるコスト
for i in range(2, N):
    double_step = dp[i-2] + abs(hn[i] - hn[i-2])
    single_step = dp[i-1] + abs(hn[i] - hn[i-1])
    dp[i] = get_min(single_step, double_step)

print(dp[N-1])

Compiler output:
a.cc:12:13: warning: multi-character character constant [-Wmultichar]
   12 | dp = [float('inf')] * N
      |             ^~~~~
a.cc:14:2: error: invalid preprocessing directive #\U00004e00\U0000756a\U00006700\U0000521d\U0000306e\U00008db3\U00005834\U0000306b\U00003044\U0000308b\U00003068\U0000304d\U0000306f\U000030b3\U000030b9\U000030c80
   14 | #一番最初の足場にいるときはコスト0
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:18:2: error: invalid preprocessing directive #dp
   18 | #dp[i]が足場iにいくのにかかるコスト
      |  ^~
a.cc:1:1: error: 'def' does not name a type
    1 | def get_min(a,b):
      | ^~~
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:15:36: error: expected ';' before ')' token
   15 |               dp[1]= abs(v[1]-v[0]));
      |                                    ^
      |                                    ;
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:10:14: error: 'temp' was not declared in this scope; did you mean 'tm'?
   10 |         cin>>temp;
      |              ^~~~
      |              tm
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:11:7: error: 'i' was not declared in this scope
   11 |   for(i=1;i<=n;i++)cin>>a[i];
      |       ^
a.cc:12:9: error: expected ';' before 'v'
   12 |   v[0]=0
      |         ^
      |         ;
   13 |     v[1]=0;
      |     ~    
a.cc:15:7: error: 'i' was not declared in this scope
   15 |   for(i=2;i<=n;i++)
      |       ^
Language: C++

#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int dist(int& x, int& y) {
	return abs(x - y);
}
int minCost(int n, int k, vector <int>& h) {
	vector <int> dp(n + 1, 0);
	dp[2] = dist(h[0], h[1]);
	for (int i = 3; i <= n; ++i) {
      dp[i] = INT_MAX;
      for (int j = k; j >= 1; --j) {
        if (i - k > 0)
			dp[i] = min(dp[i], dp[i - k] + dist(h[i - 1], h[i - k - 1]));
      }
}
	return dp[n];
}


int main() {
	int n, x, k;
  	cin >> n >> k;
  	vector <int> v;
  	for(int i = 0; i < n; ++i) 
      cin >> x, v.push_back(x);
  	cout << minCost(n, k, v) << endl;
}



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

#include <iostream>
#include <vector>

using namespace std;

int dist(int& x, int& y) {
	return abs(x - y);
}
int minCost(int n, vector <int>& h) {
	vector <int> dp(n + 1, 0);
	dp[2] = dist(h[0], h[1]);
	for (int i = 3; i <= n; ++i) {
		dp[i] = min(dist(h[i - 1], h[i - 2]) + dp[i - 1], 
dist(h[i - 1], h[i - 3]) + dp[i - 2]);
}
	return dp[n]
}


int main() {
	int n, x;
  	cin >> n;
  	vector <int> v;
  	for(int i = 0; i < n; ++i) 
      cin >> x, v.push_back(x);
  	cout << minCost(n, v) << endl;
}



Compiler output:
a.cc: In function 'int minCost(int, std::vector<int>&)':
a.cc:16:21: error: expected ';' before '}' token
   16 |         return dp[n]
      |                     ^
      |                     ;
   17 | }
      | ~
Language: C++

#include <iostream>

using namespace std;

int dist(int& x, int& y) {
	return abs(x - y);
}
int minCost(int n, vector <int>& h) {
	vector <int> dp(n + 1, 0);
	dp[2] = dist(h[0], h[1]);
	for (int i = 3; i <= n; ++i) {
		dp[i] = min(dist(h[i - 1], h[i - 2]) + dp[i - 1], 
dist(h[i - 1], h[i - 3]) + dp[i - 2]);
}
	return dp[n]
}


int main() {
	int n, x;
  	cin >> n;
  	vector <int> v;
  	for(int i = 0; i < n; ++i) 
      cin >> x, v.push_back(x);
  	cout << minCost(n, v) << endl;
}



Compiler output:
a.cc:8:20: error: 'vector' has not been declared
    8 | int minCost(int n, vector <int>& h) {
      |                    ^~~~~~
a.cc:8:27: error: expected ',' or '...' before '<' token
    8 | int minCost(int n, vector <int>& h) {
      |                           ^
a.cc: In function 'int minCost(int, int)':
a.cc:9:9: error: 'vector' was not declared in this scope
    9 |         vector <int> dp(n + 1, 0);
      |         ^~~~~~
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 | 
a.cc:9:17: error: expected primary-expression before 'int'
    9 |         vector <int> dp(n + 1, 0);
      |                 ^~~
a.cc:10:9: error: 'dp' was not declared in this scope
   10 |         dp[2] = dist(h[0], h[1]);
      |         ^~
a.cc:10:22: error: 'h' was not declared in this scope
   10 |         dp[2] = dist(h[0], h[1]);
      |                      ^
a.cc:15:21: error: expected ';' before '}' token
   15 |         return dp[n]
      |                     ^
      |                     ;
   16 | }
      | ~                    
a.cc: In function 'int main()':
a.cc:22:9: error: 'vector' was not declared in this scope
   22 |         vector <int> v;
      |         ^~~~~~
a.cc:22:9: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:22:17: error: expected primary-expression before 'int'
   22 |         vector <int> v;
      |                 ^~~
a.cc:24:17: error: 'v' was not declared in this scope
   24 |       cin >> x, v.push_back(x);
      |                 ^
a.cc:25:28: error: 'v' was not declared in this scope
   25 |         cout << minCost(n, v) << endl;
      |                            ^
Language: Java

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

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

import java.util.*;
public class Solution{
  public static void main(String[] args){
    Scanner s=new Scanner(System.in);
    int n=s.nextInt();
    int[] arr=new int[n];
    for(int i=0;i<n;i++){
      arr[i]=s.nextInt();
    }
    int[] dp=new int[n];
    dp[0]=0;
    dp[1]=arr[1]-dp[0];
    for(int i=2;i<n;i++){
      dp[i]=Math.min(arr[i]-dp[i-1],arr[i]-dp[i-2]);
    }
    System.out.println(dp[n-1]);
  }
    
}


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

import java.util.*;
public class Solution{
  public static void main(String[] args){
    Scanner s=new Scanner(System.in);
    int n=s.nextInt();
    int[] arr=new int[n];
    for(int i=0;i<n;i++){
      arr[i]=s.nextInt();
    }
    int[] dp=new int[n];
    dp[0]=0;
    dp[1]=arr[1]-dp[0];
    for(int i=2;i<n;i++){
      dp[i]=Math.min(arr[i]-dp[i-1],arr[i]-dp[i-2]);
    }
    System.out.println(dp[n-1]);
  }
    
}

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

import java.util.*;
public class Solution{
  public static void main(String[] args){
    Scanner s=new Scanner(System.in);
    int n=s.nextInt();
    int[] arr=new int[n];
    for(int i=0;i<n;i++){
      arr[i]=s.nextInt();
    }
    int[] dp=new int[n];
    dp[0]=0;
    dp[1]=arr[1]-dp[0];
    for(int i=2;i<n;i++){
      dp[i]=Math.min(arr[i]-dp[i-1],arr[i]-dp[i-2]);
    }
    System.out.println(dp[n-1]);
  }
    
  
    

Compiler output:
Main.java:17: error: reached end of file while parsing
  }
   ^
1 error
Language: C++

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

int cost(ary,i1,i2) {
  return abs(ary.at(i1) - ary.at(i2));
}

int main() {
  int n;
  int t;
  cin >> n;
  vector<int> h(n);
  for(int i = 0; i < n; i++) {
    cin >> t;
    h[i] = t;
  }
  dp.at(1) = cost(h,0,1);
  vector<int> dp[n];
  for(int i = 1; i < n; i++) {
      dp.at(i) = min(dp.at(i-2) + cost(h,i-2,i), dp.at(i-1) + cost(h,i-1,i));
  }
  cout << dp.at(n-1) << endl;
}


Compiler output:
a.cc:4:10: error: 'ary' was not declared in this scope
    4 | int cost(ary,i1,i2) {
      |          ^~~
a.cc:4:14: error: 'i1' was not declared in this scope; did you mean 'y1'?
    4 | int cost(ary,i1,i2) {
      |              ^~
      |              y1
a.cc:4:17: error: 'i2' was not declared in this scope
    4 | int cost(ary,i1,i2) {
      |                 ^~
a.cc:4:19: error: expression list treated as compound expression in initializer [-fpermissive]
    4 | int cost(ary,i1,i2) {
      |                   ^
a.cc: In function 'int main()':
a.cc:17:3: error: 'dp' was not declared in this scope; did you mean 'dup'?
   17 |   dp.at(1) = cost(h,0,1);
      |   ^~
      |   dup
a.cc:17:18: error: 'cost' cannot be used as a function
   17 |   dp.at(1) = cost(h,0,1);
      |              ~~~~^~~~~~~
a.cc:20:39: error: 'cost' cannot be used as a function
   20 |       dp.at(i) = min(dp.at(i-2) + cost(h,i-2,i), dp.at(i-1) + cost(h,i-1,i));
      |                                   ~~~~^~~~~~~~~
a.cc:20:67: error: 'cost' cannot be used as a function
   20 |       dp.at(i) = min(dp.at(i-2) + cost(h,i-2,i), dp.at(i-1) + cost(h,i-1,i));
      |                                                               ~~~~^~~~~~~~~
Language: C++

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

Compiler output:
a.cc:1:1: error: 'clude' does not name a type
    1 | clude <bits/stdc++.h>
      | ^~~~~
a.cc: In function 'int main()':
a.cc:7:9: error: 'cin' was not declared in this scope
    7 |         cin>>n;
      |         ^~~
a.cc:11:25: error: 'abs' was not declared in this scope
   11 |         dp[0]=0;dp[1] = abs(h[0]-h[1]);
      |                         ^~~
a.cc:13:17: error: 'min' was not declared in this scope; did you mean 'main'?
   13 |         dp[i] = min(dp[i-2]+abs(h[i-2]-h[i]), dp[i-1]+abs(h[i-1]-h[i]));
      |                 ^~~
      |                 main
a.cc:15:9: error: 'cout' was not declared in this scope
   15 |         cout<<dp[n]<<endl;
      |         ^~~~
a.cc:15:22: error: 'endl' was not declared in this scope
   15 |         cout<<dp[n]<<endl;
      |                      ^~~~
Language: C++

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

int main() {
	int n;
  	cin>>n;
	int h[n];
  	for(int i=0;i<n;i++) cin>>h[i];
  	ll dp[n];
 	dp[0]=0;dp[1] = mod(h[0]-h[1]);
  	for(int i=2;i<n;i++) {
    	dp[i] = min(dp[i-2]+mod(h[i-2]-h[i]), dp[i-1]+mod(h[i-1]-h[i]));
    }
	cout<<dp[n]<<endl;
 }  

Compiler output:
a.cc: In function 'int main()':
a.cc:11:25: error: 'mod' was not declared in this scope; did you mean 'modf'?
   11 |         dp[0]=0;dp[1] = mod(h[0]-h[1]);
      |                         ^~~
      |                         modf
Language: C++

#include<bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second

typedef long long ll;
typedef pair<int, int> pii;

const int N = 1e5+20;
const int oo = 1e9;

ll n, k, l, a[N], dp[N][N], b[N];

int main() {

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

    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif // LOCAL

    cin>>n>>k;

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


    return 0;
}


Compiler output:
/tmp/ccBOv0Ym.o: in function `main':
a.cc:(.text+0x99): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccBOv0Ym.o
collect2: error: ld returned 1 exit status
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,dp) + Math.abs(h[pos] - h[pos+1]),
                              calc(h, pos+2,dp) + Math.abs(h[pos] - h[pos+2]));
              
        	}
        }

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