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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:7:15: error: array must be initialized with a brace-enclosed initializer
    7 |     int dp[i]=2000000000;
      |               ^~~~~~~~~~
a.cc:8:62: error: expected ';' before '}' token
    8 |     for(int j=0;j<i;j++)dp[i]=min(dp[i],dp[j]+abs(h[i]-h[j]))
      |                                                              ^
      |                                                              ;
    9 |   }
      |   ~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int sa(int a, int b) {
  return max(a - b, b - a);
}
int main () {
  int N;
  cin >> N;
  vector<int>he(N);
  for (int i = 0; i < N; i ++) cin >> he[i];
  vector<int>dp(N);
  dp[0] = 0;
  dp[1] = ze(he[0], he[1]);
  for (int i = 2; i < N; i ++) {
    int ku = dp[i - 1] + ze(he[i], he[i - 1]);
    int ma = dp[i - 2] + ze(he[i], he[i - 2]);
    dp[i] = min(ku, ma);
  }
  cout << dp[N - 1] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:11: error: 'ze' was not declared in this scope; did you mean 'he'?
   13 |   dp[1] = ze(he[0], he[1]);
      |           ^~
      |           he
Language: Java

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

public class Test {

    public void solve() throws IOException {
        int n = nextInt();
        int[] h = new int[n];
        for (int i = 0; i < n; i++) {
            h[i] = nextInt();
        }
        int[] dp = new int[n];
        dp[0] = 0;
        dp[1] = Math.abs(h[0] - h[1]);
        for (int i = 2; i < n; i++) {
            dp[i] = Math.min(dp[i - 1] + Math.abs(h[i] - h[i - 1]), dp[i - 2] + Math.abs(h[i] - h[i - 2]));
        }
        out.print(dp[n - 1]);
    }

    public void run() {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
            out.close();
        } catch (IOException e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    BufferedReader br;
    StringTokenizer in;
    PrintWriter out;

    class Pair implements Comparable<Pair> {
        int f;
        int s;

        public Pair(int f, int s) {
            this.f = f;
            this.s = s;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            Pair pair = (Pair) o;
            return f == pair.f &&
                    s == pair.s;
        }

        @Override
        public int hashCode() {
            return Objects.hash(f, s);
        }

        @Override
        public int compareTo(Pair o) {
            if (f == o.f) {
                return s - o.s;
            }
            return f - o.f;
        }
    }

    public String nextToken() throws IOException {
        while (in == null || !in.hasMoreTokens()) {
            in = new StringTokenizer(br.readLine());
        }
        return in.nextToken();
    }

    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    public int[] nextArr(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = nextInt();
        }
        return res;
    }

    public static void main(String[] args) throws IOException {
        Locale.setDefault(Locale.US);
        new Test().run();
    }
}

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

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



int cost(int x);

int main() {
  
  int N;
  cin>> N;
  vector<int> h(N);
  for (int i=0; i<N; i++){
    cin >> h.at(i);
  }
  
 
  vector<int> cost(N);
  cost.at(0)=0;
  cost.at(1)=abs(h.at(1)-h.at(0));
  for (int i=2;i<N;i++){
  	cost.at(i)=min(cost(i-1)+abs(h.at(i-1)-h.at(i)),cost(i-2)+abs(h.at(i-2)-h.at(i)));
  }
  cout << cost(N-1) << endl;

  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:28: error: no match for call to '(std::vector<int>) (int)'
   22 |         cost.at(i)=min(cost(i-1)+abs(h.at(i-1)-h.at(i)),cost(i-2)+abs(h.at(i-2)-h.at(i)));
      |                        ~~~~^~~~~
a.cc:22:61: error: no match for call to '(std::vector<int>) (int)'
   22 |         cost.at(i)=min(cost(i-1)+abs(h.at(i-1)-h.at(i)),cost(i-2)+abs(h.at(i-2)-h.at(i)));
      |                                                         ~~~~^~~~~
a.cc:24:15: error: no match for call to '(std::vector<int>) (int)'
   24 |   cout << cost(N-1) << endl;
      |           ~~~~^~~~~
Language: C++

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



int cost(int x);

int main() {
  
  int N;
  cin>> N;
  vector<int> h(N);
  for (int i=0; i<N; i++){
    cin >> h.at(i);
  }
  cout << cost(N-1) << endl;
  
	
}

 
int cost(int x){
	if (x == 0){
    	return 0;
    } else if (x == 1){
      	return abs(h.at(1)-h.at(0));
    } else {
    	int nextcost=min(cost(x-1)+abs(h.at(x-1)-h.at(x)),cost(x-2)+abs(h.at(x-2)-h.at(x)));
        return nextcost;
    }
}

Compiler output:
a.cc: In function 'int cost(int)':
a.cc:26:20: error: 'h' was not declared in this scope
   26 |         return abs(h.at(1)-h.at(0));
      |                    ^
a.cc:28:40: error: 'h' was not declared in this scope
   28 |         int nextcost=min(cost(x-1)+abs(h.at(x-1)-h.at(x)),cost(x-2)+abs(h.at(x-2)-h.at(x)));
      |                                        ^
Language: C++

#include <iostream>
#include <algorithm>
#include <math.h>
#define int long long
using namespace std;
int n;
int main()
{
    cin >> n;
    int a[n + 2], total[n + 2];
    total[0] = 0;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    for (int i = 1; i < n; i++)
    {
        total[i] = total[i - 1] + abs(a[i] - a[i - 1]);
        if (i > 1)
            total[i] = min(total[i], total[i - 2] + abs(a[i] - a[i - 2]));
    }
    cout << total[n - 1] << endl;
    return 0;
}

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

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

Compiler output:
a.cc:3:23: error: '::main' must return 'int'
    3 | #define int long long int
      |                       ^~~
a.cc:4:1: note: in expansion of macro 'int'
    4 | int main()
      | ^~~
Language: C++

#include<bits/stdc++.h>
#define H 10001
using namespace std;
int main(){
    int n;
    scanf("%d",&n);
    vector<int> h(n);
    for(int i=0;i<n;i++){
        scanf("%d",&h[i]);
    }
    vector<int> dp(n,H);
    dp[0] = 0;
    dp[1] = abs(h[1]-h[0]);
    for(int i=2;i<n;i++){
      	dp[i] = min(dp[i],dp[i-1]+abs(h[i]-h[i-1]))
        dp[i] = min(dp[i-2]+abs(h[i]-h[i-2]),dp[i]);
    }
    printf("%d\n",dp[n-1]);
    return 0;
}

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

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

int n;
int posicao[10099];
int dp[10099];
int pd (int pos, int pulos)
{

long long (dp[pos]!=-1){return dp[pos];}
    if(dp[pos]==n+1){return 0;}
    if (pulos==n-1){return 0;}

    long long pula1=abs(posicao[pos]-posicao[pos+1])+pd(pos+1,pulos+1);

    long long pula2=abs(posicao[pos]-posicao[pos+2])+pd(pos+2,pulos+2);
    return dp[pos]=min(pula1,pula2);




}




int main()
{

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




return 0
;}



Compiler output:
a.cc: In function 'int pd(int, int)':
a.cc:10:1: error: expected primary-expression before 'long'
   10 | long long (dp[pos]!=-1){return dp[pos];}
      | ^~~~
Language: C++

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

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

const long long INF = 1LL << 60;

vector<int> vec(100000);
vector<int> memo(100000);

int solve(i){
  if(memo[i]) return memo[i];
  if(i == 0) return 0;
  memo[i] = solve(i-1) + abs(vec.at(i) - vec.at(i-1));
  if(i > 1) chmin(memo[i], solve(i-2) + abs(vec.at(i) - vec.at(i-2)));
  return memo[i];
}

int main(){
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) {
      cin >> vec.at(i);
  }
  cout << memo.at(N-1) << endl;
}

Compiler output:
a.cc:12:11: error: 'i' was not declared in this scope
   12 | int solve(i){
      |           ^
Language: C++

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

int main()
{
  int n; cin>>n;
  vector <int> h(n);
  for(auto &it : x) cin>>it;
  vector<int> dp(n);
  dp[0]=0;
  dp[1]=abs(h[0]-h[1]);
  for(int i=2; i<n; i++)
  {
    dp[i]=min(dp[i-1]+abs(dp[i-1]-dp[i]),dp[i-2]+abs(dp[i-2]-dp[i]));
  }
  cout<<dp[n-1];
  return 0;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:8:18: error: 'x' was not declared in this scope
    8 |   for(auto &it : x) cin>>it;
      |                  ^
Language: C++

#include<iostream>
using namespace std;
 int main()
   {
   long int n,s=0,b,c,j=2,i;
     cin>>n;
     long int a[n];
     for(i=0;i<n;i++)
       cin>>a[i];
   long int dp[n];
   dp[0]=0;
   dp[1]=abs(a[0]-a[1]);
     for(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];
     return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:18:15: error: expected '}' at end of input
   18 |      return 0;
      |               ^
a.cc:4:4: note: to match this '{'
    4 |    {
      |    ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int n;
  cin >> n;
  vector<int> h(n);
  rep(i,n) cin >> h[i];
  vector<int> d(n);
  d[0] = 0;
  d[1] = (h[0] >= h[1])? h[0] - h[1] : h[1] - h[0];
  rep(i,n-2) {
    d[i+2] = min(d[i+1] + (h[i+2] >= h[i+1]) h[i+2] - h[i+1] : h[i+1] - h[i+2],
                 d[i] + (h[i+2] >= h[i]) h[i+2] - h[i] : h[i] - h[i+2]);
  }
  cout << d[n-1];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:45: error: expected ')' before 'h'
   16 |     d[i+2] = min(d[i+1] + (h[i+2] >= h[i+1]) h[i+2] - h[i+1] : h[i+1] - h[i+2],
      |                 ~                           ^~
      |                                             )
a.cc:17:41: error: expected ')' before 'h'
   17 |                  d[i] + (h[i+2] >= h[i]) h[i+2] - h[i] : h[i] - h[i+2]);
      |                                         ^~
      |                                         )
a.cc:16:17: note: to match this '('
   16 |     d[i+2] = min(d[i+1] + (h[i+2] >= h[i+1]) h[i+2] - h[i+1] : h[i+1] - h[i+2],
      |                 ^
Language: C++

//Bismillahir Rahmanir Raheem
//#include<bits/stdc++.h>
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
using namespace std;
#define pb push_back
#define inf 1e9
#define all(x) (x).begin(), (x).end()
vector<int> h;
int dp[100002];
int n;

int main()
{
    memset(dp, -1, sizeof(dp));
    cin >> n;
    for(int i = 0; i < n; i++) {
        int x;
        cin >> x;
        h.pb(x);
    }
    h.pb(1e9);
    dp[n - 1] = 0, dp[n] = 1e9;
    for(int i = n - 2; ~i; i--)
        dp[i] = min(dp[i + 1] + abs(h[i] - h[i + 1]), dp[i + 2] + abs(h[i] - h[i + 2]));
    cout << dp[0] << endl;

}






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

#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); 
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
;
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;

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);
    dp[0] = 0;
    for(int i = 0; i < n; ++i) {
        for(int j : {i + 1, i + 2}) {
            if(j < n) {
                dp[j] = min(dp[j], dp[i] + abs(h[i] - h[j]));
            }
        }
    }
    printf("%d\n", dp[n-1]);
}

Compiler output:
a.cc:53:2: error: expected '}' at end of input
   53 | }
      |  ^
a.cc:12:14: note: to match this '{'
   12 | struct debug {
      |              ^
a.cc: In member function 'int debug::main()':
a.cc:53:1: warning: no return statement in function returning non-void [-Wreturn-type]
   53 | }
      | ^
a.cc: At global scope:
a.cc:53:2: error: expected unqualified-id at end of input
   53 | }
      |  ^
Language: C++

#include <cstdlib>
#include <cstdio>
#include <iostream>
using namespace std;
int main(){
   int N;
    cin >> N;
    string num;
   vector<int> input;
  while(getline(cin, num, ' ')){
       cout << num << endl;
}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:4: error: 'vector' was not declared in this scope
    9 |    vector<int> input;
      |    ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include <iostream>
  +++ |+#include <vector>
    4 | using namespace std;
a.cc:9:11: error: expected primary-expression before 'int'
    9 |    vector<int> input;
      |           ^~~
Language: C++

#include <cstdlib>
#include <cstdio>
using namespace std;
int main(){
   int N;
    cin << N;
    string num;
   vector<int> input;
  while(getline(cin, num, ' ')){
       cout << num << endl;
}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:5: error: 'cin' was not declared in this scope
    6 |     cin << N;
      |     ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <cstdio>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:7:5: error: 'string' was not declared in this scope
    7 |     string num;
      |     ^~~~~~
a.cc:3:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
    2 | #include <cstdio>
  +++ |+#include <string>
    3 | using namespace std;
a.cc:8:4: error: 'vector' was not declared in this scope
    8 |    vector<int> input;
      |    ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include <cstdio>
  +++ |+#include <vector>
    3 | using namespace std;
a.cc:8:11: error: expected primary-expression before 'int'
    8 |    vector<int> input;
      |           ^~~
a.cc:9:22: error: 'num' was not declared in this scope; did you mean 'enum'?
    9 |   while(getline(cin, num, ' ')){
      |                      ^~~
      |                      enum
a.cc:10:8: error: 'cout' was not declared in this scope
   10 |        cout << num << endl;
      |        ^~~~
a.cc:10:8: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:10:23: error: 'endl' was not declared in this scope
   10 |        cout << num << endl;
      |                       ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include <cstdio>
  +++ |+#include <ostream>
    3 | using namespace std;
Language: C++

#include <cstdlib>
#include <cstdio>
using std;
int main(){
   int N;
    cin << N;
    string num;
   vector<int> input;
  while(getline(cin, num, ' ')){
       cout << num << endl;
}
}

Compiler output:
a.cc:3:7: error: expected nested-name-specifier before 'std'
    3 | using std;
      |       ^~~
a.cc: In function 'int main()':
a.cc:6:5: error: 'cin' was not declared in this scope
    6 |     cin << N;
      |     ^~~
a.cc:7:5: error: 'string' was not declared in this scope; did you mean 'stdin'?
    7 |     string num;
      |     ^~~~~~
      |     stdin
a.cc:8:4: error: 'vector' was not declared in this scope
    8 |    vector<int> input;
      |    ^~~~~~
a.cc:8:11: error: expected primary-expression before 'int'
    8 |    vector<int> input;
      |           ^~~
a.cc:9:22: error: 'num' was not declared in this scope; did you mean 'enum'?
    9 |   while(getline(cin, num, ' ')){
      |                      ^~~
      |                      enum
a.cc:10:8: error: 'cout' was not declared in this scope
   10 |        cout << num << endl;
      |        ^~~~
a.cc:10:23: error: 'endl' was not declared in this scope
   10 |        cout << num << endl;
      |                       ^~~~
Language: Java

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

public class A {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] x = new int[n];
		for (int i = 0; i < n; i++) x[i] = sc.nextInt();
		long cost = 0;
		long[] dp = new long[n];
		dp[0] = 0; dp[1] = Math.abs(x[1] - x[0]);
		for (int i = 2; i < n; i++) {
			dp[i] = Math.min(dp[i - 1] + Math.abs(x[i] - x[i - 1]), dp[i - 2] + Math.abs(x[i] - x[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.util.*;
import java.io.*;

//A - Frog 1

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

 
    public static void main(String[] args) throws IOException {
  
        int N = nextInt();
        int dp[] = new int[N+1];

        int input[] = new int[N+1];


        for (int i=1; i<=N;  i++) {
            input[i] = nextInt();
        }

        // now dp time
        Arrays.fill(dp, Integer.MAX_VALUE);
        dp[1] = 0;
        for (int i=1; i<=N;  i++) {
            if(i+1<=N){
                dp[i+1] = Math.min(dp[i+1], dp[i] + Math.abs(input[i+1]- input[i]));
            }
            if(i+2<=N){
                dp[i+2] = Math.min(dp[i+2], dp[i] + Math.abs(input[i+2]- input[i]));
            }
        }

        System.out.println(dp[N]);
    }
    

    public static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    public static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

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

    static String next() throws IOException {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine().trim());
        return st.nextToken();
    }
}

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:20:4: error: expected '}' at end of input
   20 |   }
      |    ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
	int n,w,a[1002],v[1002],c[1002],m,val;
	cin>>n>>w;
	for (int i=0;i<n;i++) cin>>a[i]>>v[i];
	int dp[w+7];
	memset(dp,0,sizeof(dp));
	for (int i=0;i<n;i++)
	{
		cin>>m>>val;
		for (int j=w;j>=m;j--) dp[j]=max(dp[j],val+dp[j-m]);
	}
	cout<<dp[k]<<"\n";
	
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:18: error: 'k' was not declared in this scope
   16 |         cout<<dp[k]<<"\n";
      |                  ^
Language: Java

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

public class GDP {
    public static void main(String[] args) throws IOException{
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer tokenizer;

        tokenizer = new StringTokenizer(reader.readLine());
        int N = Integer.parseInt(tokenizer.nextToken());

        tokenizer = new StringTokenizer(reader.readLine());
        int i = 0;
        int[] arr = new int[N];

        while (tokenizer.hasMoreTokens()) {
            arr[i] = Integer.parseInt(tokenizer.nextToken());
            i++;
        }

        int[] cost = new int[N];

        cost[N-1] = 0;
        cost[N-2] = Math.abs(arr[N-2] - arr[N-1]);

        for (int j=N-3; j>=0; j--) {
            cost[j] = Math.min(Math.abs(arr[j] - arr[j+1]) + cost[j+1], Math.abs(arr[j] - arr[j+2]) + cost[j+2]);
        }

        System.out.println(cost[0]);
    }
}


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

include<bits/stdc++.h>
using namespace std; 
 
long long int n,k,a[1000], dp[1000009];
// dp[k][turn];
 
int main(){
  
  cin>>n>>k;
  for(int i = 1; i<=n;i++)
    cin>>a[i];
  
  for(int i = 1; i<=k; i++){
    for(int j = 1; j<=n; j++){
      if(i-a[j]>=0){
          // dependencies of dynamic relation 
          dp[i]|=!(dp[i-a[j]]);
      }
    }
  }
  
  if(dp[k]) cout<<"First"<<endl;
  else 
    cout<<"Second"<<endl;
 
  return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:9:3: error: 'cin' was not declared in this scope
    9 |   cin>>n>>k;
      |   ^~~
a.cc:22:13: error: 'cout' was not declared in this scope
   22 |   if(dp[k]) cout<<"First"<<endl;
      |             ^~~~
a.cc:22:28: error: 'endl' was not declared in this scope
   22 |   if(dp[k]) cout<<"First"<<endl;
      |                            ^~~~
a.cc:24:5: error: 'cout' was not declared in this scope
   24 |     cout<<"Second"<<endl;
      |     ^~~~
a.cc:24:21: error: 'endl' was not declared in this scope
   24 |     cout<<"Second"<<endl;
      |                     ^~~~
Language: C++

clude<bits/stdc++.h>
using namespace std; 
 
long long int n,k,a[1000], dp[1000009];
// dp[k][turn];
 
int main(){
  
  cin>>n>>k;
  for(int i = 1; i<=n;i++)
    cin>>a[i];
  
  for(int i = 1; i<=k; i++){
    for(int j = 1; j<=n; j++){
      if(i-a[j]>=0){
          // dependencies of dynamic relation 
          dp[i]|=!(dp[i-a[j]]);
      }
    }
  }
  
  if(dp[k]) cout<<"First"<<endl;
  else 
    cout<<"Second"<<endl;
 
  return 0;
}

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:9:3: error: 'cin' was not declared in this scope
    9 |   cin>>n>>k;
      |   ^~~
a.cc:22:13: error: 'cout' was not declared in this scope
   22 |   if(dp[k]) cout<<"First"<<endl;
      |             ^~~~
a.cc:22:28: error: 'endl' was not declared in this scope
   22 |   if(dp[k]) cout<<"First"<<endl;
      |                            ^~~~
a.cc:24:5: error: 'cout' was not declared in this scope
   24 |     cout<<"Second"<<endl;
      |     ^~~~
a.cc:24:21: error: 'endl' was not declared in this scope
   24 |     cout<<"Second"<<endl;
      |                     ^~~~
Language: C++

include<cstdio>
int h[100005];
int n,minAns=0x7fffffff;// n<=10^5
void dfs(int i,int j,int n,int tans){
    int t=h[i]-h[j];
    if(t<0)t=-t;
    t=t+tans;
    if(j>=n){
        if(j==n&&minAns>t)minAns=t;
        return;
    }
    dfs(j,j+1,n,t);
    dfs(j,j+2,n,t);
}
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++)scanf("%d",&h[i]);
    dfs(1,1,n,0);
    printf("%d\n",minAns);
    return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<cstdio>
      | ^~~~~~~
a.cc: In function 'void dfs(int, int, int, int)':
a.cc:5:11: error: 'h' was not declared in this scope
    5 |     int t=h[i]-h[j];
      |           ^
a.cc: In function 'int main()':
a.cc:16:5: error: 'scanf' was not declared in this scope
   16 |     scanf("%d",&n);
      |     ^~~~~
a.cc:17:38: error: 'h' was not declared in this scope
   17 |     for(int i=1;i<=n;i++)scanf("%d",&h[i]);
      |                                      ^
a.cc:19:5: error: 'printf' was not declared in this scope
   19 |     printf("%d\n",minAns);
      |     ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | include<cstdio>
Language: C++

#include <iostream>
#include <math.h>
#include <queue>
using namespace std;
const int maxn=10010;
const int INF=99999;
int n,A[maxn],hm=INF,step=0;
bool hash[maxn];
struct Node{
	int h,step;
	int sum;
}node,S;

void bfs(){
	queue<Node> Q;
	S.h=A[0];
	S.sum=0;
	S.step=0;
	Q.push(S);
	while(!Q.empty()){
		Node top=Q.front();
		Q.pop();
		if(top.step==n-1){
			if(top.sum<hm)
			hm=top.sum;
		}
		if(top.step>=n) return;
		for(int i=1;i<=2;i++){
			if(hash[top.step+i]==false){
				node.h=A[top.step+i];
				node.sum=top.sum+abs(node.h-top.h);
			    node.step=top.step+i;
			    Q.push(node);
			}
		}
	}
}
int main(){
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	scanf("%d",&A[i]);
	bfs();
	printf("%d",hm);
	return 0;
}

Compiler output:
a.cc: In function 'void bfs()':
a.cc:29:28: error: reference to 'hash' is ambiguous
   29 |                         if(hash[top.step+i]==false){
      |                            ^~~~
In file included from /usr/include/c++/14/string_view:50,
                 from /usr/include/c++/14/bits/basic_string.h:47,
                 from /usr/include/c++/14/string:54,
                 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/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:8:6: note:                 'bool hash [10010]'
    8 | bool hash[maxn];
      |      ^~~~
Language: C++

#include <iostream>
#include <math.h>
#include <queue>
#include <string.h>
using namespace std;
const int maxn=10010;
const int INF=99999;
int n,A[maxn],hm=INF,step=0;
bool hash[maxn];
struct Node{
	int h,step;
	int sum;
}node,S;

void bfs(){
	queue<Node> Q;
	S.h=A[0];
	S.sum=0;
	S.step=0;
	Q.push(S);
	while(!Q.empty()){
		Node top=Q.front();
		Q.pop();
		if(top.step==n-1){
			if(top.sum<hm)
			hm=top.sum;
		}
		if(top.step>=n) return;
		for(int i=1;i<=2;i++){
			if(hash[top.step+i]==false){
				node.h=A[top.step+i];
				node.sum=top.sum+abs(node.h-top.h);
			    node.step=top.step+i;
			    Q.push(node);
			}
		}
	}
}
int main(){
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	scanf("%d",&A[i]);
	memset(hash,false,sizeof(hash));
	bfs();
	printf("%d",hm);
	return 0;
}

Compiler output:
a.cc: In function 'void bfs()':
a.cc:30:28: error: reference to 'hash' is ambiguous
   30 |                         if(hash[top.step+i]==false){
      |                            ^~~~
In file included from /usr/include/c++/14/string_view:50,
                 from /usr/include/c++/14/bits/basic_string.h:47,
                 from /usr/include/c++/14/string:54,
                 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/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:9:6: note:                 'bool hash [10010]'
    9 | bool hash[maxn];
      |      ^~~~
a.cc: In function 'int main()':
a.cc:43:16: error: reference to 'hash' is ambiguous
   43 |         memset(hash,false,sizeof(hash));
      |                ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:9:6: note:                 'bool hash [10010]'
    9 | bool hash[maxn];
      |      ^~~~
a.cc:43:34: error: reference to 'hash' is ambiguous
   43 |         memset(hash,false,sizeof(hash));
      |                                  ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:9:6: note:                 'bool hash [10010]'
    9 | bool hash[maxn];
      |      ^~~~
Language: C++

#include<bits/stdc++.h>

using namespace std;

const int maxn = 100005;
int a[maxn], dp[maxn];

int findMin(int n)
{
	if(n<=1) return a[1];
  if(n==2) return min(a[1]-a[0]);
  if(dp[n]==-1) return dp[n] = min(dp[i-2]+abs(a[i-2]-a[i]), dp[i-1]+abs(a[i-1]-a[i])); 
  
  
}


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

Compiler output:
a.cc: In function 'int findMin(int)':
a.cc:11:22: error: no matching function for call to 'min(int)'
   11 |   if(n==2) return min(a[1]-a[0]);
      |                   ~~~^~~~~~~~~~~
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: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:   candidate expects 2 arguments, 1 provided
/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, 1 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   template argument deduction/substitution failed:
a.cc:11:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   11 |   if(n==2) return min(a[1]-a[0]);
      |                   ~~~^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   candidate expects 2 arguments, 1 provided
a.cc:12:39: error: 'i' was not declared in this scope
   12 |   if(dp[n]==-1) return dp[n] = min(dp[i-2]+abs(a[i-2]-a[i]), dp[i-1]+abs(a[i-1]-a[i]));
      |                                       ^
Language: C++

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#include<vector>
int optim(int a,vector <int> b,int n)
{
  if(a==0){ return 0;}
  if(a==1){ return absol(b[0],b[1]);}
  if(a>1) 
  { return min (optim(a-1,b,n)+absol(b[n-(a)],b[n-(a-1)]),optim(a-2,b,n)+absol(b[n-(a-1)],b[n-(a-2)]) ) ; }  

}

int absol(int a,int b)
   {  if(a>b){return (a-b);}
      else{return (b-a);}  
   }
 
  
int main()
{   int n;
    int temp;
    vector<int> h;
    cin >>n;
    int i=0;
    while(i<n)
    { cin >>temp;
      h.push_back(temp);
      i++;   
    }
    int res;
res=optim(n,h,n);
return res;

}

int optim(int a,vector <int> b,int n)
{
  if(a==0){ return 0;}
  if(a==1){ return absol(b[0],b[1]);}
  if(a>1) 
  { return min (optim(a-1,b,n)+absol(b[n-(a)],b[n-(a-1)]),optim(a-2,b,n)+absol(b[n-(a-1)],b[n-(a-2)]) ) ; }  

}

int absol(int a,int b)
   {  if(a>b){return (a-b);}
      else{return (b-a);}  
   }
 


Compiler output:
a.cc: In function 'int optim(int, std::vector<int>, int)':
a.cc:8:20: error: 'absol' was not declared in this scope
    8 |   if(a==1){ return absol(b[0],b[1]);}
      |                    ^~~~~
a.cc:10:32: error: 'absol' was not declared in this scope
   10 |   { return min (optim(a-1,b,n)+absol(b[n-(a)],b[n-(a-1)]),optim(a-2,b,n)+absol(b[n-(a-1)],b[n-(a-2)]) ) ; }
      |                                ^~~~~
a.cc: At global scope:
a.cc:37:5: error: redefinition of 'int optim(int, std::vector<int>, int)'
   37 | int optim(int a,vector <int> b,int n)
      |     ^~~~~
a.cc:5:5: note: 'int optim(int, std::vector<int>, int)' previously defined here
    5 | int optim(int a,vector <int> b,int n)
      |     ^~~~~
a.cc:46:5: error: redefinition of 'int absol(int, int)'
   46 | int absol(int a,int b)
      |     ^~~~~
a.cc:14:5: note: 'int absol(int, int)' previously defined here
   14 | int absol(int a,int b)
      |     ^~~~~
a.cc: In function 'int optim(int, std::vector<int>, int)':
a.cc:44:1: warning: control reaches end of non-void function [-Wreturn-type]
   44 | }
      | ^
Language: C++

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#include<vector>
int optim(int a,vector <int> b,int n){}
int absol(int a,int b){}
  
int main()
{   int n;
    int temp;
    vector<int> h;
    cin >>n;
    int i=0;
    while(i<n)
    { cin >>temp;
      vec.push_back(temp);
      i++;   
    }
    int res;
res=optim(n,h,n);
return res;

}

int optim(int a,vector <int> b,int n)
{
  if(a==0){ return 0;}
  if(a==1){ return absol(b[0],b[1]);}
  if(a>1) 
  { return min (optim(a-1,b,n)+absol(b[n-(a)],b[n-(a-1)]),optim(a-2,b,n)+absol(b[n-(a-1)],b[n-(a-2)]) ) ; }  

}

int absol(int a,int b)
   {  if(a>b){return (a-b);}
      else{return (b-a);}  
   }
 


Compiler output:
a.cc: In function 'int optim(int, std::vector<int>, int)':
a.cc:5:39: warning: no return statement in function returning non-void [-Wreturn-type]
    5 | int optim(int a,vector <int> b,int n){}
      |                                       ^
a.cc: In function 'int absol(int, int)':
a.cc:6:24: warning: no return statement in function returning non-void [-Wreturn-type]
    6 | int absol(int a,int b){}
      |                        ^
a.cc: In function 'int main()':
a.cc:16:7: error: 'vec' was not declared in this scope
   16 |       vec.push_back(temp);
      |       ^~~
a.cc: At global scope:
a.cc:25:5: error: redefinition of 'int optim(int, std::vector<int>, int)'
   25 | int optim(int a,vector <int> b,int n)
      |     ^~~~~
a.cc:5:5: note: 'int optim(int, std::vector<int>, int)' previously defined here
    5 | int optim(int a,vector <int> b,int n){}
      |     ^~~~~
a.cc:34:5: error: redefinition of 'int absol(int, int)'
   34 | int absol(int a,int b)
      |     ^~~~~
a.cc:6:5: note: 'int absol(int, int)' previously defined here
    6 | int absol(int a,int b){}
      |     ^~~~~
a.cc: In function 'int optim(int, std::vector<int>, int)':
a.cc:32:1: warning: control reaches end of non-void function [-Wreturn-type]
   32 | }
      | ^
Language: C++

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#include<vector>
int optim(int a,vector <int> b,int n){}
int absol(int a,int b){}
  
int main
{   int n;
    int temp;
    vector<int> h;
    cin >>n
    int i=0;
    while(i<n)
    { cin >>temp
      vec.push_back(temp);
      i++;   
    }
  int res;  
  res=optim(n,h,n);
  return res;

}

int optim(int a,vector <int> b,int n)
{
  if(a==0){ return 0;}
  if(a==1){ return absol(b[0],b[1]);}
  if(a>1) 
  { return min (optim(a-1,b,n)+absol(b[n-(a)],b[n-(a-1)]),optim(a-2,b,n)+absol(b[n-(a-1)],b[n-(a-2)]) ) ; }  

}

int absol(int a,int b)
   {  if(a>b){return (a-b);}
      else{return (b-a);}  
   }
 


Compiler output:
a.cc: In function 'int optim(int, std::vector<int>, int)':
a.cc:5:39: warning: no return statement in function returning non-void [-Wreturn-type]
    5 | int optim(int a,vector <int> b,int n){}
      |                                       ^
a.cc: In function 'int absol(int, int)':
a.cc:6:24: warning: no return statement in function returning non-void [-Wreturn-type]
    6 | int absol(int a,int b){}
      |                        ^
a.cc: At global scope:
a.cc:8:5: error: cannot declare '::main' to be a global variable
    8 | int main
      |     ^~~~
a.cc:9:5: error: expected primary-expression before 'int'
    9 | {   int n;
      |     ^~~
a.cc:9:5: error: expected '}' before 'int'
    9 | {   int n;
      | ~   ^~~
a.cc:12:5: error: 'cin' does not name a type
   12 |     cin >>n
      |     ^~~
a.cc:14:5: error: expected unqualified-id before 'while'
   14 |     while(i<n)
      |     ^~~~~
a.cc:20:3: error: 'res' does not name a type
   20 |   res=optim(n,h,n);
      |   ^~~
a.cc:21:3: error: expected unqualified-id before 'return'
   21 |   return res;
      |   ^~~~~~
a.cc:23:1: error: expected declaration before '}' token
   23 | }
      | ^
a.cc:25:5: error: redefinition of 'int optim(int, std::vector<int>, int)'
   25 | int optim(int a,vector <int> b,int n)
      |     ^~~~~
a.cc:5:5: note: 'int optim(int, std::vector<int>, int)' previously defined here
    5 | int optim(int a,vector <int> b,int n){}
      |     ^~~~~
a.cc:34:5: error: redefinition of 'int absol(int, int)'
   34 | int absol(int a,int b)
      |     ^~~~~
a.cc:6:5: note: 'int absol(int, int)' previously defined here
    6 | int absol(int a,int b){}
      |     ^~~~~
a.cc: In function 'int optim(int, std::vector<int>, int)':
a.cc:32:1: warning: control reaches end of non-void function [-Wreturn-type]
   32 | }
      | ^
Language: C++

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#include<vector>
long long int optim(long long int a,vector <int> b,long long int n){}
int absol(int a,int b){}
  
int main
{   long long int n;
    int temp;
    vector<int> h;
    cin >>n
    int i=0;
    while(i<n)
    { cin >>temp
      vec.push_back(temp);
      i++;   
    }
 long long int res;   
 res=optim(n,h,n);
return res;

}

long long int optim(long long int a,vector <int> b,long long int n)
{
  if(a==0){ return 0;}
  if(a==1){ return absol(b[0],b[1]);}
  if(a>1) 
  { return min (optim(a-1,b,n)+absol(b[n-(a)],b[n-(a-1)]),optim(a-2,b,n)+absol(b[n-(a-1)],b[n-(a-2)]) ) ; }  

}

int absol(int a,int b)
   {  if(a>b){return (a-b);}
      else{return (b-a);}  
   }
 


Compiler output:
a.cc: In function 'long long int optim(long long int, std::vector<int>, long long int)':
a.cc:5:69: warning: no return statement in function returning non-void [-Wreturn-type]
    5 | long long int optim(long long int a,vector <int> b,long long int n){}
      |                                                                     ^
a.cc: In function 'int absol(int, int)':
a.cc:6:24: warning: no return statement in function returning non-void [-Wreturn-type]
    6 | int absol(int a,int b){}
      |                        ^
a.cc: At global scope:
a.cc:8:5: error: cannot declare '::main' to be a global variable
    8 | int main
      |     ^~~~
a.cc:9:5: error: expected primary-expression before 'long'
    9 | {   long long int n;
      |     ^~~~
a.cc:9:5: error: expected '}' before 'long'
    9 | {   long long int n;
      | ~   ^~~~
a.cc:12:5: error: 'cin' does not name a type
   12 |     cin >>n
      |     ^~~
a.cc:14:5: error: expected unqualified-id before 'while'
   14 |     while(i<n)
      |     ^~~~~
a.cc:20:2: error: 'res' does not name a type
   20 |  res=optim(n,h,n);
      |  ^~~
a.cc:21:1: error: expected unqualified-id before 'return'
   21 | return res;
      | ^~~~~~
a.cc:23:1: error: expected declaration before '}' token
   23 | }
      | ^
a.cc:25:15: error: redefinition of 'long long int optim(long long int, std::vector<int>, long long int)'
   25 | long long int optim(long long int a,vector <int> b,long long int n)
      |               ^~~~~
a.cc:5:15: note: 'long long int optim(long long int, std::vector<int>, long long int)' previously defined here
    5 | long long int optim(long long int a,vector <int> b,long long int n){}
      |               ^~~~~
a.cc:34:5: error: redefinition of 'int absol(int, int)'
   34 | int absol(int a,int b)
      |     ^~~~~
a.cc:6:5: note: 'int absol(int, int)' previously defined here
    6 | int absol(int a,int b){}
      |     ^~~~~
a.cc: In function 'long long int optim(long long int, std::vector<int>, long long int)':
a.cc:32:1: warning: control reaches end of non-void function [-Wreturn-type]
   32 | }
      | ^
Language: C++

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#include<vector>
int optim(int a,vector <int> b,int n){}
int absol(int a,int b)
  
int main
{   int n;
    int temp;
    vector<int> h;
    cin >>n
    int i=0;
    while(i<n)
    { cin >>temp
      vec.push_back(temp);
      i++;   
    }
    
optim(n,h,n)


}

int optim(int a,vector <int> b,int n)
{
  if(a==0){ return 0;}
  if(a==1){ return absol(b[0],b[1]);}
  if(a>1) 
  { return min (optim(a-1,b,n)+absol(b[n-(a)],b[n-(a-1)]),optim(a-2,b,n)+absol(b[n-(a-1)],b[n-(a-2)]) ) ; }  

}

int absol(int a,int b)
   {  if(a>b){return (a-b);}
      else{return (b-a);}  
   }
 


Compiler output:
a.cc: In function 'int optim(int, std::vector<int>, int)':
a.cc:5:39: warning: no return statement in function returning non-void [-Wreturn-type]
    5 | int optim(int a,vector <int> b,int n){}
      |                                       ^
a.cc: At global scope:
a.cc:8:1: error: expected initializer before 'int'
    8 | int main
      | ^~~
a.cc:25:5: error: redefinition of 'int optim(int, std::vector<int>, int)'
   25 | int optim(int a,vector <int> b,int n)
      |     ^~~~~
a.cc:5:5: note: 'int optim(int, std::vector<int>, int)' previously defined here
    5 | int optim(int a,vector <int> b,int n){}
      |     ^~~~~
a.cc: In function 'int optim(int, std::vector<int>, int)':
a.cc:28:20: error: 'absol' was not declared in this scope
   28 |   if(a==1){ return absol(b[0],b[1]);}
      |                    ^~~~~
a.cc:30:32: error: 'absol' was not declared in this scope
   30 |   { return min (optim(a-1,b,n)+absol(b[n-(a)],b[n-(a-1)]),optim(a-2,b,n)+absol(b[n-(a-1)],b[n-(a-2)]) ) ; }
      |                                ^~~~~
Language: C++

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#include<vector>
int optim(int a,vector <int> b,int n)
int absol(int a,int b)
  
int main
{   int n;
    int temp;
    vector<int> h;
    cin >>n
    int i=0;
    while(i<n)
    { cin >>temp
      vec.push_back(temp);
      i++;   
    }
    
optim(n,h,n)


}

int optim(int a,vector <int> b,int n)
{
  if(a==0){ return 0;}
  if(a==1){ return absol(b[0],b[1]);}
  if(a>1) 
  { return min (optim(a-1,b,n)+absol(b[n-(a)],b[n-(a-1)]),optim(a-2,b,n)+absol(b[n-(a-1)],b[n-(a-2)]) ) ; }  

}

int absol(int a,int b)
   {  if(a>b){return (a-b);}
      else{return (b-a);}  
   }
 


Compiler output:
a.cc:6:1: error: expected initializer before 'int'
    6 | int absol(int a,int b)
      | ^~~
a.cc: In function 'int optim(int, std::vector<int>, int)':
a.cc:28:20: error: 'absol' was not declared in this scope
   28 |   if(a==1){ return absol(b[0],b[1]);}
      |                    ^~~~~
a.cc:30:32: error: 'absol' was not declared in this scope
   30 |   { return min (optim(a-1,b,n)+absol(b[n-(a)],b[n-(a-1)]),optim(a-2,b,n)+absol(b[n-(a-1)],b[n-(a-2)]) ) ; }
      |                                ^~~~~
Language: C++

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#include<vector>
int optim(int a,vector <int> b,int n)
int absol(int a,int b)
   {  if(a>b){return (a-b);}
      else{return (b-a);}  
   }
 
int main
{   int n;
    int temp;
    vector<int> h;
    cin >>n
    int i=0;
    while(i<n)
    { cin >>temp
      vec.push_back(temp);
      i++;   
    }
    
optim(n,h,n)


}

int optim(int a,vector <int> b,int n)
{
  if(a==0){ return 0;}
  if(a==1){ return absol(b[0],b[1]);}
  if(a>1) 
  { return min (optim(a-1,b,n)+absol(b[n-(a)],b[n-(a-1)]),optim(a-2,b,n)+absol(b[n-(a-1)],b[n-(a-2)]) ) ; }  

}




Compiler output:
a.cc:6:1: error: expected initializer before 'int'
    6 | int absol(int a,int b)
      | ^~~
a.cc:11:5: error: cannot declare '::main' to be a global variable
   11 | int main
      |     ^~~~
a.cc:12:5: error: expected primary-expression before 'int'
   12 | {   int n;
      |     ^~~
a.cc:12:5: error: expected '}' before 'int'
   12 | {   int n;
      | ~   ^~~
a.cc:15:5: error: 'cin' does not name a type
   15 |     cin >>n
      |     ^~~
a.cc:17:5: error: expected unqualified-id before 'while'
   17 |     while(i<n)
      |     ^~~~~
a.cc:23:6: error: expected constructor, destructor, or type conversion before '(' token
   23 | optim(n,h,n)
      |      ^
a.cc:26:1: error: expected declaration before '}' token
   26 | }
      | ^
a.cc: In function 'int optim(int, std::vector<int>, int)':
a.cc:31:20: error: 'absol' was not declared in this scope
   31 |   if(a==1){ return absol(b[0],b[1]);}
      |                    ^~~~~
a.cc:33:32: error: 'absol' was not declared in this scope
   33 |   { return min (optim(a-1,b,n)+absol(b[n-(a)],b[n-(a-1)]),optim(a-2,b,n)+absol(b[n-(a-1)],b[n-(a-2)]) ) ; }
      |                                ^~~~~