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

#include<bits/stdc++.h>
#include<iostream>
#include<bitset>
using namespace std;
 
 
#define all(x) (x).begin(),(x).end()
 
#define FOR(i,x) for(int i=0;i<(int)(x);i++)
#define FOR_S(i,x) for(int i=1;i<=(int)(x);i++)
#define FOR_R(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define FOR_SR(i,x) for(int i=((int)(x));i>0;i--)
 
using ll = long long;
typedef long long ll;
typedef long long int64;
typedef long long lint;
typedef long long lli;
 
 
 
//bit
 
const unsigned int BIT_FLAG_0 = (1 << 0); // 0000 0000 0000 0001
const unsigned int BIT_FLAG_1 = (1 << 1); // 0000 0000 0000 0010
const unsigned int BIT_FLAG_2 = (1 << 2); // 0000 0000 0000 0100
const unsigned int BIT_FLAG_3 = (1 << 3); // 0000 0000 0000 1000
const unsigned int BIT_FLAG_4 = (1 << 4); // 0000 0000 0001 0000
const unsigned int BIT_FLAG_5 = (1 << 5); // 0000 0000 0010 0000
const unsigned int BIT_FLAG_6 = (1 << 6); // 0000 0000 0100 0000
const unsigned int BIT_FLAG_7 = (1 << 7); // 0000 0000 1000 0000
 
 
//variables
 
int N=0;
int M=0;
 
const int INF = 100000000;
int ans=0;
 
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
 
#include<bits/stdc++.h>
define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
////////////////////////////////////////////////////////////////
	 
int main(){
 
  	cin >> N;
	vector<int> data(INF);
    rep(i,0, N) cin >> data[i];
    
  	vector<int> dp(INF);
    rep(i,0, N) dp[i] = INF;
    dp[0] = 0;
 
    rep(i,0, N) {
        chmin(dp[i + 1], dp[i] + abs(data[i] - data[i + 1]));
        chmin(dp[i + 2], dp[i] + abs(data[i] - data[i + 2]));
    }
 
    cout << dp[N - 1] << endl;
}

Compiler output:
a.cc:46:1: error: 'define' does not name a type
   46 | define rep(i,a,b) for(int i=a;i<b;i++)
      | ^~~~~~
a.cc:46:31: error: 'i' does not name a type
   46 | define rep(i,a,b) for(int i=a;i<b;i++)
      |                               ^
a.cc:46:35: error: 'i' does not name a type
   46 | define rep(i,a,b) for(int i=a;i<b;i++)
      |                                   ^
a.cc: In function 'int main()':
a.cc:60:9: error: 'i' was not declared in this scope
   60 |     rep(i,0, N) cin >> data[i];
      |         ^
a.cc:60:5: error: 'rep' was not declared in this scope; did you mean 'rrep'?
   60 |     rep(i,0, N) cin >> data[i];
      |     ^~~
      |     rrep
Language: C++

#include<bits/stdc++.h>
#include<iostream>
#include<bitset>
using namespace std;
 
 
#define all(x) (x).begin(),(x).end()
 
#define FOR(i,x) for(int i=0;i<(int)(x);i++)
#define FOR_S(i,x) for(int i=1;i<=(int)(x);i++)
#define FOR_R(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define FOR_SR(i,x) for(int i=((int)(x));i>0;i--)
 
using ll = long long;
typedef long long ll;
typedef long long int64;
typedef long long lint;
typedef long long lli;
 
 
 
//bit
 
const unsigned int BIT_FLAG_0 = (1 << 0); // 0000 0000 0000 0001
const unsigned int BIT_FLAG_1 = (1 << 1); // 0000 0000 0000 0010
const unsigned int BIT_FLAG_2 = (1 << 2); // 0000 0000 0000 0100
const unsigned int BIT_FLAG_3 = (1 << 3); // 0000 0000 0000 1000
const unsigned int BIT_FLAG_4 = (1 << 4); // 0000 0000 0001 0000
const unsigned int BIT_FLAG_5 = (1 << 5); // 0000 0000 0010 0000
const unsigned int BIT_FLAG_6 = (1 << 6); // 0000 0000 0100 0000
const unsigned int BIT_FLAG_7 = (1 << 7); // 0000 0000 1000 0000
 
 
//variables
 
int N=0;
int M=0;
 
const int INF = 100000000;
int ans=0;
 
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
 
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
////////////////////////////////////////////////////////////////
	 
int main(){
 
  	cin >> N;
	vector<int> data(INF);
    FOR(i, N) cin >> data[i];
    
  	vector<int> dp(INF);
    FOR(i, N) dp[i] = INF;
    dp[0] = 0;
 
    FOR(i, N) {
        chmin(dp[i + 1], dp[i] + abs(data[i] - data[i + 1]));
        chmin(dp[i + 2], dp[i] + abs(data[i] - data[i + 2]));
    }
 
    cout << dp[N - 1] << endl;
}

Compiler output:
a.cc:57:5: error: redefinition of 'int main()'
   57 | int main(){
      |     ^~~~
a.cc:51:40: note: 'int main()' previously defined here
   51 | using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
      |                                        ^~~~
Language: C++

#include<bits/stdc++.h>
#include<iostream>
#include<bitset>
using namespace std;
 
 
#define all(x) (x).begin(),(x).end()
 
#define FOR(i,x) for(int i=0;i<(int)(x);i++)
#define FOR_S(i,x) for(int i=1;i<=(int)(x);i++)
#define FOR_R(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define FOR_SR(i,x) for(int i=((int)(x));i>0;i--)
 
using ll = long long;
typedef long long ll;
typedef long long int64;
typedef long long lint;
typedef long long lli;
 
 
 
//bit
 
const unsigned int BIT_FLAG_0 = (1 << 0); // 0000 0000 0000 0001
const unsigned int BIT_FLAG_1 = (1 << 1); // 0000 0000 0000 0010
const unsigned int BIT_FLAG_2 = (1 << 2); // 0000 0000 0000 0100
const unsigned int BIT_FLAG_3 = (1 << 3); // 0000 0000 0000 1000
const unsigned int BIT_FLAG_4 = (1 << 4); // 0000 0000 0001 0000
const unsigned int BIT_FLAG_5 = (1 << 5); // 0000 0000 0010 0000
const unsigned int BIT_FLAG_6 = (1 << 6); // 0000 0000 0100 0000
const unsigned int BIT_FLAG_7 = (1 << 7); // 0000 0000 1000 0000
 
 
//variables
 
int N=0;
int M=0;
 
const int INF = 100000000;
int ans=0;
 
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
 
////////////////////////////////////////////////////////////////
	 
int main(){
 
	cin >> N;
 
	vector<int> data(N+2);
	FOR(i,N) cin >> data[i+2];
 
	vector<int> dp(N+2);
  	FOR(i,N+2)dp[i] = INF;
  	dp[0] = 0;
  
  	FOR(i,N+1){ if(i=0 || i=1) dp[i]=0;
              	else dp[i] = min(dp[i-1]+abs(data[i]-data[i-1]),dp[i-2]+abs(data[i+1]-data[i-2]));
              }
	cout << dp[N+2] << endl;
	return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:28: error: lvalue required as left operand of assignment
   58 |         FOR(i,N+1){ if(i=0 || i=1) dp[i]=0;
      |                          ~~^~~~
Language: C++

#include<bits/stdc++.h>
#include<iostream>
#include<bitset>
using namespace std;
 
 
#define all(x) (x).begin(),(x).end()
 
#define FOR(i,x) for(int i=0;i<(int)(x);i++)
#define FOR_S(i,x) for(int i=1;i<=(int)(x);i++)
#define FOR_R(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define FOR_SR(i,x) for(int i=((int)(x));i>0;i--)
 
using ll = long long;
typedef long long ll;
typedef long long int64;
typedef long long lint;
typedef long long lli;
 
 
 
//bit
 
const unsigned int BIT_FLAG_0 = (1 << 0); // 0000 0000 0000 0001
const unsigned int BIT_FLAG_1 = (1 << 1); // 0000 0000 0000 0010
const unsigned int BIT_FLAG_2 = (1 << 2); // 0000 0000 0000 0100
const unsigned int BIT_FLAG_3 = (1 << 3); // 0000 0000 0000 1000
const unsigned int BIT_FLAG_4 = (1 << 4); // 0000 0000 0001 0000
const unsigned int BIT_FLAG_5 = (1 << 5); // 0000 0000 0010 0000
const unsigned int BIT_FLAG_6 = (1 << 6); // 0000 0000 0100 0000
const unsigned int BIT_FLAG_7 = (1 << 7); // 0000 0000 1000 0000
 
 
//variables
 
int N=0;
int M=0;
 
const int INF = 100000000;
int ans=0;
 
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
 
////////////////////////////////////////////////////////////////
	 
int main(){
 
	cin >> N;
 
	vector<int> data(N+2);
	FOR(i,N) cin >> data[i+2];
 
	vector<int> dp(N+2);
  	FOR(i,N+2)dp[i] = INF;
  	dp[0] = 0;
  
  	FOR(i,N+1){ if(i=0||i=1) dp[i]=0;
              	else dp[i] = min(dp[i-1]+abs(data[i]-data[i-1]),dp[i-2]+abs(data[i+1]-data[i-2]));
              }
	cout << dp[N+2] << endl;
	return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:27: error: lvalue required as left operand of assignment
   58 |         FOR(i,N+1){ if(i=0||i=1) dp[i]=0;
      |                          ~^~~
Language: C++

#include<bits/stdc++.h>
#include<iostream>
#include<bitset>
using namespace std;
 
 
#define all(x) (x).begin(),(x).end()
 
#define FOR(i,x) for(int i=0;i<(int)(x);i++)
#define FOR_S(i,x) for(int i=1;i<=(int)(x);i++)
#define FOR_R(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define FOR_SR(i,x) for(int i=((int)(x));i>0;i--)
 
using ll = long long;
typedef long long ll;
typedef long long int64;
typedef long long lint;
typedef long long lli;
 
 
 
//bit
 
const unsigned int BIT_FLAG_0 = (1 << 0); // 0000 0000 0000 0001
const unsigned int BIT_FLAG_1 = (1 << 1); // 0000 0000 0000 0010
const unsigned int BIT_FLAG_2 = (1 << 2); // 0000 0000 0000 0100
const unsigned int BIT_FLAG_3 = (1 << 3); // 0000 0000 0000 1000
const unsigned int BIT_FLAG_4 = (1 << 4); // 0000 0000 0001 0000
const unsigned int BIT_FLAG_5 = (1 << 5); // 0000 0000 0010 0000
const unsigned int BIT_FLAG_6 = (1 << 6); // 0000 0000 0100 0000
const unsigned int BIT_FLAG_7 = (1 << 7); // 0000 0000 1000 0000
 
 
//variables
 
int N=0;
int M=0;
 
const int INF = 100000000;
int ans=0;
 
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
 
////////////////////////////////////////////////////////////////
	 
int main(){
 
	cin >> N;
 
	vector<int> data(N+2);
	FOR(i,N) cin >> data[i+2];
 
	vector<int> dp(N+2);
  	FOR(i,N+2)dp[i] = INF;
  	dp[0] = 0;
  
  	REP(i,N+1){ if(i=0||i=1)dp[i]=0;
              	else dp[i] = min(dp[i-1]+abs(data[i]-data[i-1]),dp[i-2]+abs(data[i+1]-data[i-2]));
              }
	cout << dp[N+2] << endl;
	return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:13: error: 'i' was not declared in this scope
   58 |         REP(i,N+1){ if(i=0||i=1)dp[i]=0;
      |             ^
a.cc:58:9: error: 'REP' was not declared in this scope
   58 |         REP(i,N+1){ if(i=0||i=1)dp[i]=0;
      |         ^~~
Language: C++

#include<bits/stdc++.h>
#include<iostream>
#include<bitset>
using namespace std;
 
 
#define all(x) (x).begin(),(x).end()
 
#define FOR(i,x) for(int i=0;i<(int)(x);i++)
#define FOR_S(i,x) for(int i=1;i<=(int)(x);i++)
#define FOR_R(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define FOR_SR(i,x) for(int i=((int)(x));i>0;i--)
 
using ll = long long;
typedef long long ll;
typedef long long int64;
typedef long long lint;
typedef long long lli;
 
 
 
//bit
 
const unsigned int BIT_FLAG_0 = (1 << 0); // 0000 0000 0000 0001
const unsigned int BIT_FLAG_1 = (1 << 1); // 0000 0000 0000 0010
const unsigned int BIT_FLAG_2 = (1 << 2); // 0000 0000 0000 0100
const unsigned int BIT_FLAG_3 = (1 << 3); // 0000 0000 0000 1000
const unsigned int BIT_FLAG_4 = (1 << 4); // 0000 0000 0001 0000
const unsigned int BIT_FLAG_5 = (1 << 5); // 0000 0000 0010 0000
const unsigned int BIT_FLAG_6 = (1 << 6); // 0000 0000 0100 0000
const unsigned int BIT_FLAG_7 = (1 << 7); // 0000 0000 1000 0000
 
 
//variables
 
int N=0;
int M=0;
 
const int INF = 100000000;
int ans=0;
 
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
 
////////////////////////////////////////////////////////////////
	 
int main(){
 
	cin >> N;
 
	vector<int> data(N);
	FOR(i,N) cin >> data[i];
 
	vector<int> dp(N+1);
  	FOR(i,N+1)dp[i] = INF;
  	dp[0] = 0;
  
  	REP(i,N+1){ if(i = 0)dp[1]=0;
              	else dp[i+1] = min(dp[i]+abs(data[i]-data[i-1]),dp[i-1]+abs(data[i+1]-data[i-1]));
              }
	cout << dp[N+1] << endl;
	return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:13: error: 'i' was not declared in this scope
   58 |         REP(i,N+1){ if(i = 0)dp[1]=0;
      |             ^
a.cc:58:9: error: 'REP' was not declared in this scope
   58 |         REP(i,N+1){ if(i = 0)dp[1]=0;
      |         ^~~
Language: C++

#include<bits/stdc++.h>
#include<iostream>
#include<bitset>
using namespace std;
 
 
#define all(x) (x).begin(),(x).end()
 
#define FOR(i,x) for(int i=0;i<(int)(x);i++)
#define FOR_S(i,x) for(int i=1;i<=(int)(x);i++)
#define FOR_R(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define FOR_SR(i,x) for(int i=((int)(x));i>0;i--)
 
using ll = long long;
typedef long long ll;
typedef long long int64;
typedef long long lint;
typedef long long lli;
 
 
 
//bit
 
const unsigned int BIT_FLAG_0 = (1 << 0); // 0000 0000 0000 0001
const unsigned int BIT_FLAG_1 = (1 << 1); // 0000 0000 0000 0010
const unsigned int BIT_FLAG_2 = (1 << 2); // 0000 0000 0000 0100
const unsigned int BIT_FLAG_3 = (1 << 3); // 0000 0000 0000 1000
const unsigned int BIT_FLAG_4 = (1 << 4); // 0000 0000 0001 0000
const unsigned int BIT_FLAG_5 = (1 << 5); // 0000 0000 0010 0000
const unsigned int BIT_FLAG_6 = (1 << 6); // 0000 0000 0100 0000
const unsigned int BIT_FLAG_7 = (1 << 7); // 0000 0000 1000 0000
 
 
//variables
 
int N=0;
int M=0;
 
const int INF = 100000000;
int ans=0;
 
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
 
////////////////////////////////////////////////////////////////
	 
int main(){
 
	cin >> N;
 
	vector<int> data(N);
	FOR(i,N) cin >> data[i];
 
	vector<int> dp(N+1) = INF;
  	dp[0] = 0;
  
  	FOR(i,N+1){ if(i = 0)dp[1]=0;
              	else dp[i+1] = min(dp[i]+abs(data[i]-data[i-1]),dp[i-1]+abs(data[i+1]-data[i-1]));
              }
	cout << dp[N+1] << endl;
	return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:29: error: expected ',' or ';' before '=' token
   54 |         vector<int> dp(N+1) = INF;
      |                             ^
Language: C++

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


#define all(x) (x).begin(),(x).end()

#define FOR(i,x) for(int i=0;i<(int)(x);i++)
#define FOR_S(i,x) for(int i=1;i<=(int)(x);i++)
#define FOR_R(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define FOR_SR(i,x) for(int i=((int)(x));i>0;i--)

using ll = long long;
typedef long long ll;
typedef long long int64;
typedef long long lint;
typedef long long lli;



//bit

const unsigned int BIT_FLAG_0 = (1 << 0); // 0000 0000 0000 0001
const unsigned int BIT_FLAG_1 = (1 << 1); // 0000 0000 0000 0010
const unsigned int BIT_FLAG_2 = (1 << 2); // 0000 0000 0000 0100
const unsigned int BIT_FLAG_3 = (1 << 3); // 0000 0000 0000 1000
const unsigned int BIT_FLAG_4 = (1 << 4); // 0000 0000 0001 0000
const unsigned int BIT_FLAG_5 = (1 << 5); // 0000 0000 0010 0000
const unsigned int BIT_FLAG_6 = (1 << 6); // 0000 0000 0100 0000
const unsigned int BIT_FLAG_7 = (1 << 7); // 0000 0000 1000 0000


//variables

int N=0;
int M=0;

const int INF = 100000000;
int ans=0;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

////////////////////////////////////////////////////////////////
	 
int main(){

	cin >> N;

	vector<int> data(N);
	FOR(i,N) cin >> data[i];

	vector<int> dp(N+1) = INF;
  	dp[0] = 0;
  
  	REP(i,N+1){ if(i = 0)dp[1]=0;
              	else dp[i+1] = min(dp[i]+abs(data[i]-data[i-1]),dp[i-1]+abs(data[i+1]-data[i-1]));
              }
	cout << dp[N+1] << endl;
	return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:29: error: expected ',' or ';' before '=' token
   54 |         vector<int> dp(N+1) = INF;
      |                             ^
a.cc:57:13: error: 'i' was not declared in this scope
   57 |         REP(i,N+1){ if(i = 0)dp[1]=0;
      |             ^
a.cc:57:9: error: 'REP' was not declared in this scope
   57 |         REP(i,N+1){ if(i = 0)dp[1]=0;
      |         ^~~
Language: C++

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

int main(){
    int len; cin>>len;
    
    int arr[10000007];
    for(int i=0;i<len;i++) cin>>arr[i];
    
    vector<int> dp(len, 100000007);

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

Compiler output:
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:16:20:   required from here
   16 |         dp[i] = min(dp[i-2] + abs(arr[i]-arr[i-2]),dp[i], dp[i-1] + abs(arr[i]-arr[i-1]));
      |                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function
  284 |       if (__comp(__b, __a))
      |           ~~~~~~^~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pi acos(-1)
#define cross(a,b) (conj(a)*(b)).imag()
#define dot(a,b) (conj(a)*(b)).real()
#define vec(a,b) b-a
#define Reka ios_base::sync_with_stdio(0); cin.tie(0);
using namespace std;
int n;
int cost[1e5];
int ans;
int c[1e5];
int jump(int ind)
{
    if(ind == n-1)
        return c[ind] = 0 ;
    if(c[ind]!=-1)
        return c[ind];
    int r=1e9,r2=1e9;
    if(ind+1 <n ){
     r = jump(ind+1)+abs(cost[ind]-cost[ind+1]);
    }
    if(ind+2<n){
     r2 =jump(ind+2)+abs(cost[ind]-cost[ind+2]);
    }
     ans = min(r,r2);

    return c[ind] = ans;
}

int main()
{
    Reka
    memset(c,-1,sizeof(c));
   cin>>n;
   for(int i=0;i<n;i++)
   {
       cin>>cost[i];
   }
cout<<jump(0);
   return 0;
}


Compiler output:
a.cc:11:10: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
   11 | int cost[1e5];
      |          ^~~
a.cc:11:10: error: could not convert '1.0e+5' from 'double' to 'long unsigned int'
   11 | int cost[1e5];
      |          ^~~
      |          |
      |          double
a.cc:11:10: error: size of array 'cost' has non-integral type 'double'
a.cc:13:7: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
   13 | int c[1e5];
      |       ^~~
a.cc:13:7: error: could not convert '1.0e+5' from 'double' to 'long unsigned int'
   13 | int c[1e5];
      |       ^~~
      |       |
      |       double
a.cc:13:7: error: size of array 'c' has non-integral type 'double'
Language: C++

// #include "knapsack_1.h"
#include <iostream>
// #include <iterator>

#include <vector>

struct Item {
    int weight;
    int value;

    Item(int w, int v)
        : weight{w}
        , v{v}
    {
    }
};

using Memo = std::vector<std::vector<long long>>;

long long helper(const std::vector<Item>& items,
                 int capacity,
                 size_t pos,
                 long long value,
                 Memo& memo)
{
    if (capacity < 0)
        return 0;
    if (pos >= items.size())
        return value;

    auto& cached = memo[pos][capacity];
    if (cached != -1) {
        return cached;
    }

    long long skipping{helper(items, capacity, pos + 1, value, memo)};
    if (items[pos].weight > capacity)
        return skipping;
    long long taking{helper(items,
                            capacity - items[pos].weight,
                            pos + 1,
                            value + items[pos].value,
                            memo)};
    cached = std::max(skipping, taking);
    return cached;
}

long long max_value(const std::vector<Item>& items, int capacity)
{
    Memo memo(items.size(), std::vector<long long>(capacity + 1, -1));
    auto ans = helper(items, capacity, 0, 0, memo);
    return ans;
}

int main(int argc, char *argv[])
{
    int n, capacity;
    std::cin >> n >> capacity;
    std::vector<Item> items;
    items.reserve(n);

    for (int i = 0; i < n; ++i) {
        int weight, value;
        std::cin >> weight, value;
        items.emplace_back(weight, value);
    }
    std::cout << max_value(items, capacity) << std::endl;
    return 0;
}


Compiler output:
a.cc: In constructor 'Item::Item(int, int)':
a.cc:13:11: error: class 'Item' does not have any field named 'v'
   13 |         , v{v}
      |           ^
Language: C++

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


using namespace std;

const int INF = 1e9 + 5;

int main(){

    int n;
    scanf("%d", &n);
    vector<int> h(n);
    for(int&x : h){
        scanf("%d", &x);
    }

    vector<int> dp(n, INF); 
    for(int i = 0; i < n; ++i){
        for(int j :{i+1, i+2}){
            if(j< n){
                dp[j] = min(dp[j], dp[j] + abs(h[i]-h[j]);
            }
        }
    }
    printf("%d", dp[n-1]);

    return 0;
}

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

// #include "frog_1.h"
#include <cmath>
#include <limits>

#include <iostream>

using Memo = std::vector<int>;

int min_jump_cost(const std::vector<int>& stones)
{
    std::vector<int> dp(stones.size(), 0);
    dp[1] = std::abs(stones[1] - stones[0]);

    for (size_t i = 2; i < stones.size(); ++i) {
        dp[i] = std::min(std::abs(stones[i - 1] - stones[i]) + dp[i - 1],
                         std::abs(stones[i - 2] - stones[i]) + dp[i - 2]);
    }
    return dp.back();
}

int main(int argc, char* argv[])
{
    size_t n;
    std::cin >> n;
    std::vector<int> stones(n);
    for (size_t i = 0; i < n; ++i) {
        int height;
        std::cin >> height;
        stones[i] = height;
    }
    std::cout << min_jump_cost(stones) << std::endl;
    return 0;
}


Compiler output:
a.cc:7:19: error: 'vector' in namespace 'std' does not name a template type
    7 | using Memo = std::vector<int>;
      |                   ^~~~~~
a.cc:6:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    5 | #include <iostream>
  +++ |+#include <vector>
    6 | 
a.cc:9:30: error: 'vector' in namespace 'std' does not name a template type
    9 | int min_jump_cost(const std::vector<int>& stones)
      |                              ^~~~~~
a.cc:9:25: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    9 | int min_jump_cost(const std::vector<int>& stones)
      |                         ^~~
a.cc:9:36: error: expected ',' or '...' before '<' token
    9 | int min_jump_cost(const std::vector<int>& stones)
      |                                    ^
a.cc: In function 'int min_jump_cost(int)':
a.cc:11:10: error: 'vector' is not a member of 'std'
   11 |     std::vector<int> dp(stones.size(), 0);
      |          ^~~~~~
a.cc:11:10: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:11:17: error: expected primary-expression before 'int'
   11 |     std::vector<int> dp(stones.size(), 0);
      |                 ^~~
a.cc:12:5: error: 'dp' was not declared in this scope
   12 |     dp[1] = std::abs(stones[1] - stones[0]);
      |     ^~
a.cc:12:22: error: 'stones' was not declared in this scope
   12 |     dp[1] = std::abs(stones[1] - stones[0]);
      |                      ^~~~~~
a.cc: In function 'int main(int, char**)':
a.cc:25:10: error: 'vector' is not a member of 'std'
   25 |     std::vector<int> stones(n);
      |          ^~~~~~
a.cc:25:10: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:25:17: error: expected primary-expression before 'int'
   25 |     std::vector<int> stones(n);
      |                 ^~~
a.cc:29:9: error: 'stones' was not declared in this scope
   29 |         stones[i] = height;
      |         ^~~~~~
a.cc:31:32: error: 'stones' was not declared in this scope
   31 |     std::cout << min_jump_cost(stones) << std::endl;
      |                                ^~~~~~
Language: C++

#include<iostream>
#include<vector>
#include<string>
#include<stack>
#include<math.h>
#include<utility>

using namespace std;

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

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

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

const long long int INF=1000000000000000000;

int main(){
	int N,W;
	cin>>N>>W;
	vector<int>Value(N+10);
	vector<int>Weight(N+10);
	for(i=1;i<=N;i++){
		cin>>Weight[i]>>Value[i];
	}
	vector<vector<long long int>>DP(N+10,vector<long long int>(100005,INF));
	dp[0][0]=0LL;
	for(i=0;i<N;i++){
		for(j=0;j<100005;j++){
			if(j-Value[i]<0){
				DP[i+1][j]=min(DP[i][j],Weight[i]);
			}
			else{
				DP[i+1][j]=min(DP[i][j],DP[i][j-Value[i]]+Weight[i]);
			}
		}
	}
	int result=0;
	for(j=0;j<100005;j++){
		if(DP[N][j]<=W){
			result=max(result,j);
		}
	}
	cout<<result;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:13: error: 'i' was not declared in this scope
   13 |         for(i=1;i<=N;i++){
      |             ^
a.cc:17:9: error: 'dp' was not declared in this scope; did you mean 'DP'?
   17 |         dp[0][0]=0LL;
      |         ^~
      |         DP
a.cc:18:13: error: 'i' was not declared in this scope
   18 |         for(i=0;i<N;i++){
      |             ^
a.cc:19:21: error: 'j' was not declared in this scope
   19 |                 for(j=0;j<100005;j++){
      |                     ^
a.cc:29:13: error: 'j' was not declared in this scope
   29 |         for(j=0;j<100005;j++){
      |             ^
Language: C++

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

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

#include<iostream>
#include<vector>

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

	std::vector<long long>h;
	for(int i = 0; i < n; i++)
	{
		int value;
		std:: cin >> value;
		h.push_back(value);
	}

	std::vector<long long>dp(n+1);
	dp[1] = abs(h[1]-h[0]);
	dp[2] = std::min(abs(h[2]-h[0]), dp[1]+h[2]-h[0]);

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

	std::cout << dp[n-1];
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:25: error: no matching function for call to 'min(int, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)'
   19 |         dp[2] = std::min(abs(h[2]-h[0]), dp[1]+h[2]-h[0]);
      |                 ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:19:25: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'})
   19 |         dp[2] = std::min(abs(h[2]-h[0]), dp[1]+h[2]-h[0]);
      |                 ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
Language: C++


#include <algorithm>
#include <cmath>
#include <iostream>
int main()
{
    int n = 0;
    std::cin >> n;
    std::vector<int> scaffoldCost(n);
    int inputCost = 0;
    for(int i = 0; i < n; ++i)
    {
        std::cin >> inputCost;
        scaffoldCost.at(i) = inputCost;
    }
    
    std::vector<long long> minCosts(n);
    minCosts.at(1) = std::abs(scaffoldCost.at(0) - scaffoldCost.at(1));
    for(int index = 2; index < n; ++index)
    {
        minCosts.at(index)= std::min(
            minCosts.at(index - 2) + std::abs(scaffoldCost.at(index) - scaffoldCost.at(index - 2))
            ,minCosts.at(index - 1) + std::abs(scaffoldCost.at(index) - scaffoldCost.at(index - 1)));
    }
    std::cout << minCosts.back() << std::endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:10: error: 'vector' is not a member of 'std'
    9 |     std::vector<int> scaffoldCost(n);
      |          ^~~~~~
a.cc:5:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    4 | #include <iostream>
  +++ |+#include <vector>
    5 | int main()
a.cc:9:17: error: expected primary-expression before 'int'
    9 |     std::vector<int> scaffoldCost(n);
      |                 ^~~
a.cc:14:9: error: 'scaffoldCost' was not declared in this scope
   14 |         scaffoldCost.at(i) = inputCost;
      |         ^~~~~~~~~~~~
a.cc:17:10: error: 'vector' is not a member of 'std'
   17 |     std::vector<long long> minCosts(n);
      |          ^~~~~~
a.cc:17:10: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:17:17: error: expected primary-expression before 'long'
   17 |     std::vector<long long> minCosts(n);
      |                 ^~~~
a.cc:18:5: error: 'minCosts' was not declared in this scope
   18 |     minCosts.at(1) = std::abs(scaffoldCost.at(0) - scaffoldCost.at(1));
      |     ^~~~~~~~
a.cc:18:31: error: 'scaffoldCost' was not declared in this scope
   18 |     minCosts.at(1) = std::abs(scaffoldCost.at(0) - scaffoldCost.at(1));
      |                               ^~~~~~~~~~~~
Language: Java

import java.uti.Scanner;
public class Main
{
	public static void main(String[] args) {
	    Scanner s = new Scanner(System.in);
	    int N = s.nextInt();
	    int[] h = new int[N];
	    for(int i = 0; i < N; i++) h[i] = s.nextInt();
	    System.out.println(calculateCost(h));
	}
	
	private static int calculateCost(int[] h) {
	    int cost[] = new int[h.length]; //cost[0] = h[0];
	    cost[1] = Math.abs(h[1] - h[0]); // 0, 20 
	    for(int i = 2; i < cost.length; i++) {
	        
	        int p1 = Math.abs(h[i - 1] - h[i]), p2 = Math.abs(h[i - 2] - h[i]);
	        cost[i] = (p1 < p2 ? (p1 + cost[i - 1]) : (cost[i - 2] + p2));
	    }
	    return cost[h.length - 1];
	}
}

Compiler output:
Main.java:1: error: package java.uti does not exist
import java.uti.Scanner;
               ^
Main.java:5: error: cannot find symbol
	    Scanner s = new Scanner(System.in);
	    ^
  symbol:   class Scanner
  location: class Main
Main.java:5: error: cannot find symbol
	    Scanner s = new Scanner(System.in);
	                    ^
  symbol:   class Scanner
  location: class Main
3 errors
Language: Java

public class Main
{
	public static void main(String[] args) {
	    Scanner s = new Scanner(System.in);
	    int N = s.nextInt();
	    int[] h = new int[N];
	    for(int i = 0; i < N; i++) h[i] = s.nextInt();
	    System.out.println(calculateCost(h));
	}
	
	private static int calculateCost(int[] h) {
	    int cost[] = new int[h.length]; //cost[0] = h[0];
	    cost[1] = Math.abs(h[1] - h[0]); // 0, 20 
	    for(int i = 2; i < cost.length; i++) {
	        
	        int p1 = Math.abs(h[i - 1] - h[i]), p2 = Math.abs(h[i - 2] - h[i]);
	        cost[i] = (p1 < p2 ? (p1 + cost[i - 1]) : (cost[i - 2] + p2));
	    }
	    return cost[h.length - 1];
	}
}

Compiler output:
Main.java:4: error: cannot find symbol
	    Scanner s = new Scanner(System.in);
	    ^
  symbol:   class Scanner
  location: class Main
Main.java:4: error: cannot find symbol
	    Scanner s = new Scanner(System.in);
	                    ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: C++

#include<iostream>
#include<vector>
using namespace std;
int main()
{
  int n;
  vector<int> h;
  vector<int> cost(n,0);
  cin>>n;
  for(int i=0;i<n;i++)
  {
     int a;
     cin>>a;
     h.push_back(a);
  }
  cost[0]=0;
    cost[1]=abs(h[1]-h[0]);
    while(i<n)
    {
        if(abs(h[i]-h[i-1])+cost[i-1]>(abs(h[i]-h[i-2]))+cost[i-2]){
            cost[i]=(abs(h[i]-h[i-2]))+cost[i-2];
            i++;
        }
        else if(abs(h[i]-h[i-1])+cost[i-1]<=(abs(h[i]-h[i-2]))+cost[i-2]){
            cost[i]=(abs(h[i]-h[i-1]))+cost[i-1];
            i++;
        }
    }
   
        cout << cost[n-1] << endl;
    
  

Compiler output:
a.cc: In function 'int main()':
a.cc:18:11: error: 'i' was not declared in this scope
   18 |     while(i<n)
      |           ^
a.cc:30:35: error: expected '}' at end of input
   30 |         cout << cost[n-1] << endl;
      |                                   ^
a.cc:5:1: note: to match this '{'
    5 | {
      | ^
Language: C++

#include<iostream>
#include<vector>
#include<cstdlib>

using namespace std;

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

}

int main()
{
    int n;
    cin >> n;
    int *h = new int(n);
    for(int  i = 0 ; i < n ; i++ )
    {
        cin >> h[i];
    }

    vector<int> dp;
    dp.push_back(0);

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


    cout<<"cost"<<dp[n-1];
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:9: error: 'current' was not declared in this scope
   31 |         current = min(abs(h[i] - h[i-1]) + dp[i-1] , abs(h[i] - h[i-2]) + dp[i-2]);
      |         ^~~~~~~
a.cc: In function 'int min(int, int)':
a.cc:14:1: warning: control reaches end of non-void function [-Wreturn-type]
   14 | }
      | ^
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'i' was not declared in this scope
    7 |   int h[i];
      |         ^
a.cc:9:12: error: 'h' was not declared in this scope
    9 |     cin >> h[i];
      |            ^
a.cc:11:17: error: 'h' was not declared in this scope
   11 |   cost[1] = abs(h[0] - h[1]);
      |                 ^
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'i' was not declared in this scope
    7 |   int h[i];
      |         ^
a.cc:9:12: error: 'h' was not declared in this scope
    9 |     cin >> h[n];
      |            ^
a.cc:11:17: error: 'h' was not declared in this scope
   11 |   cost[1] = abs(h[0] - h[1]);
      |                 ^
Language: C++

#include<iostream>
#include<vector>
#include<cstdlib>

using namespace std;

pair<int,int> min(int a, int b)
{
    if(a <= b)
        return make_pair(a,1);
    if(b < a)
        return make_pair(b,2);

}

int main()
{
    int n;
    cin >> n;
   vector<int> h;
    for(int  i = 0 ; i < n ; i++ )
    {
      	int l;
        cin >> l;
      	h.push_back(l);
    }

    vector<int> dp;
    dp.push_back(0);

    for(int i = 1 ; i < n ; i++)
    {
        pair<int,int> current;
      int sum;
      if(i==1)
      {
        current = make_pair(abs(h[i] - h[i-1]),1);
       	sum = current.first;
      }
      else
      {
        current = min(abs(h[i] - h[i-1]) , abs(h[i] - h[i-2]));
        
      	if(current.second == 1)
        	sum = current.first + dp[i-1];
        else
          sum = current.first + dp[i-2];
      }
        dp.push_back(sum);
    }

/*
    for(int i = 0 ; i < n ; i++)
    {
        cout << dp[i].first << "," << dp[i].second <<endl;
    }

    int  cost = 0;
    cost += dp[n-1].first;
    int x = dp[n-1].second;n-=1;
 //cout<<"c"<<cost<<"n"<<x;
    while((n - x) >= 1)
    {
        n = n - x ;
        cost += dp[n].first;
        x = dp[n].second;
  //      cout<<"c"<<cost<<"n"<<x;
    }*/
    cout<<cost;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:69:11: error: 'cost' was not declared in this scope; did you mean 'const'?
   69 |     cout<<cost;
      |           ^~~~
      |           const
a.cc: In function 'std::pair<int, int> min(int, int)':
a.cc:14:1: warning: control reaches end of non-void function [-Wreturn-type]
   14 | }
      | ^
Language: C++

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

int min(int a,int b)
{
    return a>=b?b:a;
}

int solve(int start,int a[],int n,int ans,unordered_map<int,int> dp)
{
    if(dp[start]==-1)
    {
        if(start==n-1)
            return 0;
        if(start==n-2)
        {
            int ans1=abs(a[start]-a[start+1]);
            //return ans1/*+solve(start+1,a,n,ans1)*/;

            dp[start]=ans1+solve(start+1,a,n,ans1);
            return(dp[start]);
        }
        int ans1=abs(a[start]-a[start+1]);
        int ans2=abs(a[start]-a[start+2]);

        dp[start]=min(ans1+solve(start+1,a,n,ans1),ans2+solve(start+2,a,n,ans2));
        return(dp[start]);
    }
    else
    {
        return(dp[start]);
    }
}
int main()
{
    //cout<<"Enter number of stones: ";
    int n;
    cin>>n;
    //cout<<"\nEnter the height of the stones:";
    int a[n],x[n];
    for(int i=0;i<n;i++)
    {
      	x[i]=-1;
        cin>>a[i];
    }
    
    int start=0,ans=0;
    ans=solve(start,a,n,ans,x);
    cout/*<<"\n Minimum dist:"*/<<ans;

    return 0;
}


Compiler output:
a.cc: In function 'int solve(int, int*, int, int, std::unordered_map<int, int>)':
a.cc:20:33: error: too few arguments to function 'int solve(int, int*, int, int, std::unordered_map<int, int>)'
   20 |             dp[start]=ans1+solve(start+1,a,n,ans1);
      |                            ~~~~~^~~~~~~~~~~~~~~~~~
a.cc:9:5: note: declared here
    9 | int solve(int start,int a[],int n,int ans,unordered_map<int,int> dp)
      |     ^~~~~
a.cc:26:33: error: too few arguments to function 'int solve(int, int*, int, int, std::unordered_map<int, int>)'
   26 |         dp[start]=min(ans1+solve(start+1,a,n,ans1),ans2+solve(start+2,a,n,ans2));
      |                            ~~~~~^~~~~~~~~~~~~~~~~~
a.cc:9:5: note: declared here
    9 | int solve(int start,int a[],int n,int ans,unordered_map<int,int> dp)
      |     ^~~~~
a.cc:26:62: error: too few arguments to function 'int solve(int, int*, int, int, std::unordered_map<int, int>)'
   26 |         dp[start]=min(ans1+solve(start+1,a,n,ans1),ans2+solve(start+2,a,n,ans2));
      |                                                         ~~~~~^~~~~~~~~~~~~~~~~~
a.cc:9:5: note: declared here
    9 | int solve(int start,int a[],int n,int ans,unordered_map<int,int> dp)
      |     ^~~~~
a.cc: In function 'int main()':
a.cc:48:29: error: could not convert '(int*)(& x)' from 'int*' to 'std::unordered_map<int, int>'
   48 |     ans=solve(start,a,n,ans,x);
      |                             ^
      |                             |
      |                             int*
Language: C++

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

int min(int a,int b)
{
    return a>=b?b:a;
}

int solve(int start,int a[],int n,int ans,unordered_map<int,int> dp)
{
    if(dp.count(start)==0)
    {
        if(start==n-1)
            return 0;
        if(start==n-2)
        {
            int ans1=abs(a[start]-a[start+1]);
            //return ans1/*+solve(start+1,a,n,ans1)*/;

            dp[start]=ans1+solve(start+1,a,n,ans1);
            return(dp[start]);
        }
        int ans1=abs(a[start]-a[start+1]);
        int ans2=abs(a[start]-a[start+2]);

        dp[start]=min(ans1+solve(start+1,a,n,ans1),ans2+solve(start+2,a,n,ans2));
        return(dp[start]);
    }
    else
    {
        return(dp[start]);
    }
}
int main()
{
    //cout<<"Enter number of stones: ";
    int n;
    cin>>n;
    //cout<<"\nEnter the height of the stones:";
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    unordered_map<int,int> x;
    int start=0,ans=0;
    ans=solve(start,a,n,ans,x);
    cout/*<<"\n Minimum dist:"*/<<ans;

    return 0;
}


Compiler output:
a.cc: In function 'int solve(int, int*, int, int, std::unordered_map<int, int>)':
a.cc:21:33: error: too few arguments to function 'int solve(int, int*, int, int, std::unordered_map<int, int>)'
   21 |             dp[start]=ans1+solve(start+1,a,n,ans1);
      |                            ~~~~~^~~~~~~~~~~~~~~~~~
a.cc:10:5: note: declared here
   10 | int solve(int start,int a[],int n,int ans,unordered_map<int,int> dp)
      |     ^~~~~
a.cc:27:33: error: too few arguments to function 'int solve(int, int*, int, int, std::unordered_map<int, int>)'
   27 |         dp[start]=min(ans1+solve(start+1,a,n,ans1),ans2+solve(start+2,a,n,ans2));
      |                            ~~~~~^~~~~~~~~~~~~~~~~~
a.cc:10:5: note: declared here
   10 | int solve(int start,int a[],int n,int ans,unordered_map<int,int> dp)
      |     ^~~~~
a.cc:27:62: error: too few arguments to function 'int solve(int, int*, int, int, std::unordered_map<int, int>)'
   27 |         dp[start]=min(ans1+solve(start+1,a,n,ans1),ans2+solve(start+2,a,n,ans2));
      |                                                         ~~~~~^~~~~~~~~~~~~~~~~~
a.cc:10:5: note: declared here
   10 | int solve(int start,int a[],int n,int ans,unordered_map<int,int> dp)
      |     ^~~~~
Language: C++

#include<iostream>
#include<vector>
#include<cstdlib>

using namespace std;

pair<int,int> min(int a, int b)
{
    if(a <= b)
        return make_pair(a,1);
    if(b < a)
        return make_pair(b,2);

}

int main()
{
    int n;
    cin >> n;
   vector<int> h;
    for(int  i = 0 ; i < n ; i++ )
    {
      	int l;
        cin >> l;
      	h[i].push_back(l);
    }

    vector<pair<int,int> > dp;
    dp.push_back(make_pair(0,0));

    for(int i = 1 ; i < n ; i++)
    {
        pair<int,int> current;
        current = min(abs(h[i] - h[i-1]) , abs(h[i] - h[i-2]));
        dp.push_back(current);
    }

/*
    for(int i = 0 ; i < n ; i++)
    {
        cout << dp[i].first << "," << dp[i].second <<endl;
    }
*/
    int  cost = 0;
    cost += dp[n-1].first;
    int x = dp[n-1].second;n-=1;
 //cout<<"c"<<cost<<"n"<<x;
    while((n - x) >= 1)
    {
        n = n - x ;
        cost += dp[n].first;
        x = dp[n].second;
  //      cout<<"c"<<cost<<"n"<<x;
    }
    cout<<cost;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:14: error: request for member 'push_back' in 'h.std::vector<int>::operator[](((std::vector<int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   25 |         h[i].push_back(l);
      |              ^~~~~~~~~
a.cc: In function 'std::pair<int, int> min(int, int)':
a.cc:14:1: warning: control reaches end of non-void function [-Wreturn-type]
   14 | }
      | ^
Language: C++

#include <iostream>
#include <cstdlib>
#include <algorithm>
using namespace std;
 
int solve( int* v, int n){
    int m[n];
  	m[n-1] = 0;
  	m[n-2] = abs(v[n-1] - v[n-2]);
  	for (int i = n-3; i >= 0; i--){
    	m[i] = min( m[i+1] + abs(v[i] - v[i+1]), m[i+2] + abs( v[i] - v[i+2]); 
    }
    return m[0];
}
 
int main(){
    int n, min, temp;
    cin >> n;
    int arr[n];
    for(int i = 0; i < n; i++){
        cin >> temp;
        arr[i] = temp;
    }
    return solve(arr, n);
 
}

Compiler output:
a.cc: In function 'int solve(int*, int)':
a.cc:11:78: error: expected ')' before ';' token
   11 |         m[i] = min( m[i+1] + abs(v[i] - v[i+1]), m[i+2] + abs( v[i] - v[i+2]);
      |                   ~                                                          ^
      |                                                                              )
Language: C++

#include <iostream>
#include <cstdlib>
#include <algorithm>
using namespace std;
 
int solve( int* v, int n){
    int m[n];
  	m[n-1] = 0;
  	m[n-2] = abs(v[n-1] - v[n-2]);
  	for (int i = n-3; i >= 0; i--){
    	m[i] = min( m[i+1] + abs(v[i] - v[i+1]), m[i+2] + abs( v[i] - v[i+2]); 
    }
    return m[0];
}
 
int main(){
    int n, min, temp;
    cin >> n;
    int arr[n];
    for(int i = 0; i < n; i++){
        cin >> temp;
        arr[i] = temp;
    }
    return solve(arr, 0, n);
 
}

Compiler output:
a.cc: In function 'int solve(int*, int)':
a.cc:11:78: error: expected ')' before ';' token
   11 |         m[i] = min( m[i+1] + abs(v[i] - v[i+1]), m[i+2] + abs( v[i] - v[i+2]);
      |                   ~                                                          ^
      |                                                                              )
a.cc: In function 'int main()':
a.cc:24:17: error: too many arguments to function 'int solve(int*, int)'
   24 |     return solve(arr, 0, n);
      |            ~~~~~^~~~~~~~~~~
a.cc:6:5: note: declared here
    6 | int solve( int* v, int n){
      |     ^~~~~
Language: C++

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

#define N (int)1e5 
#define pb push_back
#define ll long long
#define all(a) a.begin(),a.end()
#define fri(a) freopen(a,"r",stdin);
#define fro(a) freopen(a,"w",stdout);

ll dizi[N],dp[N],n;

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

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


Compiler output:
a.cc: In function 'int main()':
a.cc:10:14: error: 'k' was not declared in this scope
   10 |     int d[n][k],,i;
      |              ^
a.cc:10:17: error: expected unqualified-id before ',' token
   10 |     int d[n][k],,i;
      |                 ^
a.cc:11:5: error: 'd' was not declared in this scope
   11 |     d[0][0]=0;
      |     ^
a.cc:17:9: error: expected primary-expression before '=' token
   17 |         =d[i-1]+abs(a[i]-a[i-1]);
      |         ^
a.cc:18:9: error: 'y' was not declared in this scope
   18 |         y=d[i-2]+abs(a[i]-a[i-2]);
      |         ^
a.cc:19:18: error: 'x' was not declared in this scope
   19 |         d[i]=min(x,y);
      |                  ^