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

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

const int MAXN = 1e5 + 21;

int n;
long long h[MAXN];
long long dp[MAXN];

int main() {
  cin >> n;
  for (int i = 1; i <= n; i++)
  		cin >> h[i];
  dp[2] = abs(h[1] - h[2]);

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

Compiler output:
a.cc: In function 'int main()':
a.cc:21:2: error: expected '}' at end of input
   21 | }
      |  ^
a.cc:10:12: note: to match this '{'
   10 | int main() {
      |            ^
Language: C++

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

const int MAXN = 1e5 + 21;

int n;
long long h[MAXN];
long long dp[MAXN];

int main() {
  cin >> n;
  for (int i = 1; i <= n; i++)
  		cin >> h[i];
  dp[2] = abs(h[1] - h[2]);

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

Compiler output:
a.cc: In function 'int main()':
a.cc:21:2: error: expected '}' at end of input
   21 | }
      |  ^
a.cc:10:12: note: to match this '{'
   10 | int main() {
      |            ^
Language: C++

#include<iostream>
#include<string>
#include<vector>

using namespace std;
//knapsack problem
long long max(long long a,long long b){
    return a>b?a:b;
}

const int Nmax = 100001;
vector< vector<long long> > knap_sack(Nmax);
void KnapSack(vector< pair<long long,int> > &table, int N){
    //initialize
    for(int i=0;i<Nmax;i++){
        knap_sack[i] = vector<long long>(N);
        for(int j=0;j<N;j++){
            
            if(i<table[j].first) knap_sack[i][j] = 0;
            else{
                knap_sack[i][j] = table[j].second + (j>0?knap_sack[i-table[j].first][j-1]:0);
            }
            if(j>0) knap_sack[i][j] = max(knap_sack[i][j],knap_sack[i][j-1]);
            
        }
    }
}
long long Knapsack2(vector< pair<int,long long> > &table, int W,int N,int j){
    long long max1 = 0;
    if(j<0) return 0;

    if(W<Nmax) return knap_sack[W][N-1];

    
    long long a=table[j].second+Knapsack2(table,W-table[j].first,N,j-1);
    max1 = max(a,Knapsack2(table,W,N,j-1));
    return max1;
}

int main(){
    //driving code for knapsack
    int n,cos;cin>>n>>cos;
    vector< pair<long long,int> > table(n);
    for(int i=0;i<n;i++){
        cin >> table[i].first >> table[i].second;
    }
    KnapSack(table,n);
        cout << Knapsack2(table,cos,n,n-1) << endl;
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:48:27: error: invalid initialization of reference of type 'std::vector<std::pair<int, long long int> >&' from expression of type 'std::vector<std::pair<long long int, int> >'
   48 |         cout << Knapsack2(table,cos,n,n-1) << endl;
      |                           ^~~~~
a.cc:28:52: note: in passing argument 1 of 'long long int Knapsack2(std::vector<std::pair<int, long long int> >&, int, int, int)'
   28 | long long Knapsack2(vector< pair<int,long long> > &table, int W,int N,int j){
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
long long arr[100007],dp[100007],n;
long long frog(int i){
   if(i<=1)return 0;
   if(n==2)return abs(arr[1]-arr[2]);
   
   long long p=0,q=0;
   p=abs(arr[i]-arr[i-1])+min(dp[i],frog(i-1));
   q=abs(arr[i]-arr[i-2])+min(dp[i],frog(i-2));
   dp[i]=min(dp[i],min(p,q));
   //cout<<p<<" "<<q<<endl;
   return dp[i];
   }
}
int main(){
cin>>n;
for(int i=1;i<=n;i++){cin>>arr[i];dp[i]=INT_MAX;}
cout<<frog(n)<<endl;

return 0;
}


Compiler output:
a.cc:15:1: error: expected declaration before '}' token
   15 | }
      | ^
Language: C++

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

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;
}

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

const ll INF = 1LL << 60;

int main() {
  int N; cin >> N;
  int h[100010]; REP(i, N) cin >> h[i];
  int dp[100010] = {INF}; // カエルが足場iへ移動するコスト
  dp[0] = 0;
  for(int i=0; i<N; i++){
    chmin(dp[i], dp[i-1] + abs(h[i]-h[i-1]));
    if(i>1) {
      chmin(dp[i], dp[i-2] + abs(h[i] - h[i-2]));
    }
  }
  cout << dp[N-1] << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:21: error: narrowing conversion of '1152921504606846976' from 'll' {aka 'long long int'} to 'int' [-Wnarrowing]
   31 |   int dp[100010] = {INF}; // カエルが足場iへ移動するコスト
      |                     ^~~
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;

int N;
long long h[100010];

long long dp[100010];

int main() {
	cin >> N;
	for (int i = 0; i < N; ++i) cin >> h[i];
	
	//DPテーブル全体を初期化
	for (int i = 0; i < 100010; ++i) dp[i] = INF;
	
	//初期条件
	dp[0] = 0;
	
	//ループ
	for (int i = 1 i < N; ++i) {
		chmin(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
		if (i > 1) chmin(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
	}
	
	cout << dp[N - 1] << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:23: error: expected ';' before 'i'
   25 |         for (int i = 1 i < N; ++i) {
      |                       ^~
      |                       ;
Language: C++

#include <bits/cstd++.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;

int N;
long long h[100010];

long long dp[100010];

int main() {
	cin >> N;
	for (int i = 0; i < N; ++i) cin >> h[i];
	
	//DPテーブル全体を初期化
	for (int i = 0; i < 100010; ++i) dp[i] = INF;
	
	//初期条件
	dp[0] = 0;
	
	//ループ
	for (int i = 1 i < N; ++i) {
		chmin(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
		if (i > 1) chmin(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
	}
	
	cout << dp[N - 1] << endl;
}


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

#include<bits/stdc++.h>
using namespace std;
long long solve(int n,int i,int j,vector<vector<int> > h,vector<vector<long long int> > dp)
{
	if(i==n-1){
		return h[i][j];
	}
  if(i>n)
    return 0;
  if(dp[i][j]!=-1)
    return dp[i][j]; 
  
  	long long c=h[i][j];
  	if(j==0)
      c=c+max(solve(n,i+1,j+1,h,dp),solve(n,i+1,j+2,h,dp));
    else if(j==1)
      c=c+max(solve(n,i+1,j+1,h,dp),solve(n,i+1,j-1,h,dp));
    else if(j==2)
      c=c+max(solve(n,i+1,j-1,h,dp),solve(n,i+1,j-2,h,dp));
    dp[i][j]=c;
  
   return c;
}
int main()
{
 	 int n;
  cin>>n;
  vector<vector<int> > h(n,vector<int>(3));
  vector<vector<long long> > dp(n,vector<long long>(3,-1));
  for(int i=0;i<n;i++)
    for(int j=0;j<3;j++)
      cin>>h[i][j];
      if(n!=1){
      	long long m=max({solve(n,0,0,h,dp),solve(n,0,1,h,dp),solve(n,0,2,h,dp)};
		cout<<m;
      }
      else{
      	int m=max({h[0][1],h[0][2],h[0][0]});
       	cout<<m;
      }
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:80: error: expected ')' before ';' token
   34 |         long long m=max({solve(n,0,0,h,dp),solve(n,0,1,h,dp),solve(n,0,2,h,dp)};
      |                        ~                                                       ^
      |                                                                                )
Language: C++

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

Compiler output:
a.cc: In function 'int solve(int, int*, std::vector<int>&, int)':
a.cc:11:99: error: expected ')' before ';' token
   11 |         return dp[i]=min((abs(a[i]-a[i+1])+solve(i+1,a,dp,n)),(abs(a[i]-a[i+2])+solve(i+2,a,dp,n));
      |                         ~                                                                         ^
      |                                                                                                   )
Language: C++

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

Compiler output:
a.cc: In function 'int solve(int, int*, std::vector<int>&)':
a.cc:5:15: error: 'n' was not declared in this scope
    5 |         if(i==n || i==n+1  || i==n+2)
      |               ^
a.cc:7:15: error: 'n' was not declared in this scope
    7 |         if(i==n-2)
      |               ^
a.cc:11:95: error: expected ')' before ';' token
   11 |         return dp[i]=min((abs(a[i]-a[i+1])+solve(i+1,a,dp)),(abs(a[i]-a[i+2])+solve(i+2,a,dp));
      |                         ~                                                                     ^
      |                                                                                               )
Language: Java

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

public class Main {
  
  public static void main(String[] args) throws Exception {
    Scanner reader = new Scanner(System.in);
    int n = reader.readInt();
    int[] a = new int[n];
    for (int i = 0; i < n; ++i) {
      a[i] = reader.readInt();
    }
  }
  
  private static int solve(int[] a) {
    return 0;
  }
}

Compiler output:
Main.java:8: error: cannot find symbol
    int n = reader.readInt();
                  ^
  symbol:   method readInt()
  location: variable reader of type Scanner
Main.java:11: error: cannot find symbol
      a[i] = reader.readInt();
                   ^
  symbol:   method readInt()
  location: variable reader of type Scanner
2 errors
Language: Java

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

public class Main {
  
  public static void main(String[] args) throws Exception {
    Scanner reader = new Scanner(System.in));
    int n = reader.readInt();
    int[] a = new int[n];
    for (int i = 0; i < n; ++i) {
      a[i] = reader.readInt();
    }
  }
  
  private static int solve(int[] a) {
    return 0;
  }
}

Compiler output:
Main.java:7: error: ';' expected
    Scanner reader = new Scanner(System.in));
                                           ^
1 error
Language: Java

import java.io.*;

public class Main {
  
  public static void main(String[] args) throws Exception {
    Scanner reader = new Scanner(System.in);
    int n = reader.readInt();
    int[] a = new int[n];
    for (int i = 0; i < n; ++i) {
      a[i] = reader.readInt();
    }
  }
  
  private static int solve(int[] a) {
    return 0;
  }
}

Compiler output:
Main.java:6: error: cannot find symbol
    Scanner reader = new Scanner(System.in);
    ^
  symbol:   class Scanner
  location: class Main
Main.java:6: error: cannot find symbol
    Scanner reader = new Scanner(System.in);
                         ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: Java

import java.io.*;

public class Main {
  
  public static void main(String[] args) throws Exception {
    Scanner reader = new Scanner(System.in));
    int n = reader.readInt();
    int[] a = new int[n];
    for (int i = 0; i < n; ++i) {
      a[i] = reader.readInt();
    }
  }
  
  private static int solve(int[] a) {
    return 0;
  }
}

Compiler output:
Main.java:6: error: ';' expected
    Scanner reader = new Scanner(System.in));
                                           ^
1 error
Language: Java

import java.io.*;

public class Main {
  
  public static void main(String[] args) throws Exception {
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    int n = reader.readInt();
    int[] a = new int[n];
    for (int i = 0; i < n; ++i) {
      a[i] = reader.readInt();
    }
  }
  
  private static int solve(int[] a) {
    return 0;
  }
}

Compiler output:
Main.java:7: error: cannot find symbol
    int n = reader.readInt();
                  ^
  symbol:   method readInt()
  location: variable reader of type BufferedReader
Main.java:10: error: cannot find symbol
      a[i] = reader.readInt();
                   ^
  symbol:   method readInt()
  location: variable reader of type BufferedReader
2 errors
Language: Java

import java.io.*;

public class Main {
  
  public static void main(String[] args) throws Exception {
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    int n = reader.nextInt();
    int[] a = new int[n];
    for (int i = 0; i < n; ++i) {
      a[i] = reader.nextInt();
    }
  }
  
  private static int solve(int[] a) {
    return 0;
  }
}

Compiler output:
Main.java:7: error: cannot find symbol
    int n = reader.nextInt();
                  ^
  symbol:   method nextInt()
  location: variable reader of type BufferedReader
Main.java:10: error: cannot find symbol
      a[i] = reader.nextInt();
                   ^
  symbol:   method nextInt()
  location: variable reader of type BufferedReader
2 errors
Language: Java

public class Main {
  
  public static void main(String[] args) throws Exception {
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    int n = reader.nextInt();
    int[] a = new int[n];
    for (int i = 0; i < n; ++i) {
      a[i] = reader.nextInt();
    }
  }
  
  private static int solve(int[] a) {
    return 0;
  }
}


Compiler output:
Main.java:4: error: cannot find symbol
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    ^
  symbol:   class BufferedReader
  location: class Main
Main.java:4: error: cannot find symbol
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
                                ^
  symbol:   class BufferedReader
  location: class Main
Main.java:4: error: cannot find symbol
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
                                                   ^
  symbol:   class InputStreamReader
  location: class Main
3 errors
Language: Java

public class Solution {
  
  public static void main(String[] args) throws Exception {
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    int n = reader.nextInt();
    int[] a = new int[n];
    for (int i = 0; i < n; ++i) {
      a[i] = reader.nextInt();
    }
  }
  
  private static int solve(int[] a) {
    return 0;
  }
}


Compiler output:
Main.java:1: error: class Solution is public, should be declared in a file named Solution.java
public class Solution {
       ^
Main.java:4: error: cannot find symbol
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    ^
  symbol:   class BufferedReader
  location: class Solution
Main.java:4: error: cannot find symbol
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
                                ^
  symbol:   class BufferedReader
  location: class Solution
Main.java:4: error: cannot find symbol
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
                                                   ^
  symbol:   class InputStreamReader
  location: class Solution
4 errors
Language: Java

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

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

	    int r = minimumTotalCost(stones, N);
	    System.out.println(r);
    }

    public static int minimumTotalCost(int[] s, int N) {
        int[] v = new int[N];
        int r = 0;
        v[0] = 0;
        v[1] = Math.abs(s[0]-s[1]);
//        r += v[1];
        for(int i=2; i<N; ++i) {
            v[i] = Math.min(Math.abs(s[i-1]-s[i]) +v[i-1], Math.abs(s[i-2]-s[i]) +v[i-2]);
//            if(v[i] == Math.abs(s[i-1]-s[i])) {
//                r += v[i-1];
//            }
//            else {
//                r += v[i-2];
//            }
        }

        return v[N-1];
    }

Compiler output:
Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
    public static void main(String[] args) {
                  ^
  (use --enable-preview to enable unnamed classes)
1 error
Language: C++

#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define speed ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;
const ll N = 3e4 + 1;
ll n,k;
ll arr[N][N];
bool kek[N][N];
ll a[N];
ll recurs(ll l = 0 ,ll r = n - 1){
	if(l == r){
		arr[l][r] = a[l];
		return a[l];	
	}
	if(kek[l][r])return arr[l][r];
	kek[l][r] = 1;
	arr[l][r] = max(a[l] - recurs(l + 1,r),a[r] - recurs(l,r - 1));
	return arr[l][r];
}

int main() {
	speed;
	cin >> n;
	for(int i = 0 ; i < n ; i++)
		cin >> a[i];
	recurs();
	cout << arr[0][n - 1];
}
/*
Timus : 288471KD
Atcoder : Zhabka
Codeforces : Zhabka
mail : dzhon.snoudin@mail.ru
*/



Compiler output:
/tmp/cc7M488C.o: in function `recurs(long long, long long)':
a.cc:(.text+0x22): relocation truncated to fit: R_X86_64_PC32 against symbol `kek' defined in .bss section in /tmp/cc7M488C.o
a.cc:(.text+0x5b): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/cc7M488C.o
a.cc:(.text+0xca): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/cc7M488C.o
/tmp/cc7M488C.o: in function `main':
a.cc:(.text.startup+0x4c): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/cc7M488C.o
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define For(i, n) for(int i = 1; i <= n; ++i)

int mi(int arr) {
    int minn = arr[0], sz = arr.size();
    For(i, arr.size() - 1) {
        if(arr[i] < minn) minn = arr[i];
    }
    return minn;
}

int main() {
    int n, k, c1, c2;
    cin >> n >> k;
    int dp[n + 1], h[n + 1];
    For(i, n) {
        cin >> h[i];
        dp[i] = 0;
    }
    dp[2] = abs(h[2] - h[1]);
    int c[k + 1];
    For(i, n - k) {
        For(j, k) {
            c[j] = abs(h[i + k] - h[i + k - j]) + dp[i + k - j];
        }
        dp[i + k] = mi(c);
    }
    cout << dp[n];
    return 0;
}

Compiler output:
a.cc: In function 'int mi(int)':
a.cc:6:19: error: invalid types 'int[int]' for array subscript
    6 |     int minn = arr[0], sz = arr.size();
      |                   ^
a.cc:7:16: error: request for member 'size' in 'arr', which is of non-class type 'int'
    7 |     For(i, arr.size() - 1) {
      |                ^~~~
a.cc:3:39: note: in definition of macro 'For'
    3 | #define For(i, n) for(int i = 1; i <= n; ++i)
      |                                       ^
a.cc:8:15: error: invalid types 'int[int]' for array subscript
    8 |         if(arr[i] < minn) minn = arr[i];
      |               ^
a.cc:8:37: error: invalid types 'int[int]' for array subscript
    8 |         if(arr[i] < minn) minn = arr[i];
      |                                     ^
a.cc: In function 'int main()':
a.cc:27:24: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   27 |         dp[i + k] = mi(c);
      |                        ^
      |                        |
      |                        int*
a.cc:5:12: note:   initializing argument 1 of 'int mi(int)'
    5 | int mi(int arr) {
      |        ~~~~^~~
Language: Java

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

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

#https://atcoder.jp/contests/dp/tasks/dp_a
n=int(input())
L=list(map(int,input().split()))
#L=[30 ,10 ,60 ,10 ,60 ,50]
dp=[9999999]*n
#upišem si za prva dva jer mi je lakše
dp[0]=0
dp[1]=abs(L[0]-L[1])
#krećemo od dva jer ga još nismo izračunali
for i in range(2,n):
       skok1=dp[i-1]+abs(L[i]-L[i-1])
       skok2=dp[i-2]+abs(L[i]-L[i-2])
       dp[i]=min(skok1, skok2)

print(dp[n-1])
       



Compiler output:
a.cc:1:2: error: invalid preprocessing directive #https
    1 | #https://atcoder.jp/contests/dp/tasks/dp_a
      |  ^~~~~
a.cc:4:2: error: invalid preprocessing directive #L
    4 | #L=[30 ,10 ,60 ,10 ,60 ,50]
      |  ^
a.cc:6:2: error: invalid preprocessing directive #upi\U00000161em
    6 | #upišem si za prva dva jer mi je lakše
      |  ^~~~~~
a.cc:9:2: error: invalid preprocessing directive #kre\U00000107emo
    9 | #krećemo od dva jer ga još nismo izračunali
      |  ^~~~~~~
a.cc:2:1: error: 'n' does not name a type
    2 | n=int(input())
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  arr h[n+2]={};
  for(int i=0;i<n+1;)
  {
    cin>>h[i];
  }
  int sumf=0;
  int sumb=0;
  for(int i=0;i<n;i++)
  {
    if(abs(h[i]-h[i+2])>abs(h[i]-h[i+1]))
    {
      sumf+=abs(h[i]-h[i+1]);
      i++;
    }
    else
    {
      sumf+=abs(h[i]-h[i+2]);
      i+=2;
    }
  }
  
  for(int i=n;i>1;)
  {
    if(abs(h[i]-h[i-2])>abs(h[i]-h[i-1]))
    {
      sumb+=abs(h[i]-h[i-1]);
      i--;
    }
    else
    {
      sumb+=abs(h[i]-h[i-2]);
      i-=2;
    }
  }
  if(sumb>sumf)
    cout<<sumf;
  else
    cout<<sumb;
}
  
      
    


Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'arr' was not declared in this scope
    7 |   arr h[n+2]={};
      |   ^~~
a.cc:10:10: error: 'h' was not declared in this scope
   10 |     cin>>h[i];
      |          ^
a.cc:16:12: error: 'h' was not declared in this scope
   16 |     if(abs(h[i]-h[i+2])>abs(h[i]-h[i+1]))
      |            ^
a.cc:30:12: error: 'h' was not declared in this scope
   30 |     if(abs(h[i]-h[i-2])>abs(h[i]-h[i-1]))
      |            ^
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:6:6: error: expected ';' before 'n'
    6 |   cin n;
      |      ^~
      |      ;
a.cc:7:3: error: 'h' was not declared in this scope
    7 |   h[n+2]={};
      |   ^
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;
 
void max_self(ll& a, ll b) {
    a = max(a, b);
}
void min_self(ll& a, ll b) {
    a = min(a, b);
}
 
const ll INF = 1e18L + 5;
 
int main() {
    int n, W;
    scanf("%d%d", &n, &W);
    vector<int> weight(n), value(n);
    for(int i = 0; i < n; ++i) {
        scanf("%d%d", &weight[i], &value[i]);
    }
    int sum_value = 0;
    for(int x : value) {
        sum_value += x;
    }
    vector<ll> dp(sum_value + 1, INF); // 0 ... W
    dp[0] = 0;
    // dp[i] - the minimum total weight of items with total value exactly i
    for(int item = 0; item < n; ++item) {
        for(int value_already = sum_value - value[item]; value_already >= 0; --value_already) {
        //~ for(int weight_already = 0; weight_already <= W - weight; ++weight_already) {
            min_self(dp[value_already+value[item]], dp[value_already] + weight[item]);
        }
    }
    ll answer = 0;
    for(int i = 0; i <= sum_value; ++i) {
        if(dp[i] >= W) {
            answer = i-1
        }
        //~ min_self(answer, dp[i]);
    }
    printf("%lld\n", answer);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:66:25: error: expected ';' before '}' token
   66 |             answer = i-1
      |                         ^
      |                         ;
   67 |         }
      |         ~
Language: C++

#include<isotream>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int h[n+1];
    
    for(int i=1;i<=n;i++)
      cin>>h[i];
  h[0]=0;
  int dp[n+1];
  dp[0]=0;
  dp[1]=0;
  dp[2]=abs(h[1]-h[2]);
  for(int i=3;i<=n;i++)
  {
    dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
  }
              cout<<dp[n]<<endl;
              return 0;
  
}

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

#include <bits/stdc++.h>
#define ll long long int
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;

int main() 
{
    fastio;

    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif

    int n;
    cin>>n;

    vector<int> heights(n);
    for(int i=0;i<n;i++)
        cin>>a[i];

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

Compiler output:
a.cc: In function 'int main()':
a.cc:20:14: error: 'a' was not declared in this scope
   20 |         cin>>a[i];
      |              ^
a.cc:24:15: error: 'h' was not declared in this scope
   24 |     dp[1]=abs(h[1]-h[0]);
      |               ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,a,b;
  cin>>n;
  int A[n];
  for(int i=0;i<n;i++)
    A[i]=2e7;
  int B[n];
  for(int i=0;i<n;i++)
    cin>>B[i];
  A[0]=0;
  A[1]=B[1]-B[0];
  for(int i=2;i<n;i++)
  {
    
    a=B[i]-B[i-1]+A[i-1];
    b=B[i]-B[i-2]+A[i-2];
    A[i]=a<b?a:b;
  }
  cout<<A[n-1];

Compiler output:
a.cc: In function 'int main()':
a.cc:22:16: error: expected '}' at end of input
   22 |   cout<<A[n-1];
      |                ^
a.cc:4:1: note: to match this '{'
    4 | {
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int maxn=1e5+5;
int n,arr[maxn],dp[maxn];
int main()
{
  cin>>n;
  for(int i=0;i<n;i++)cin>>arr[i];
  dp[0]=0;dp[1]=arr[1]-arr[0];
  if(dp[1]<0)dp[1]-=1;
  for(int i=2;i<n;i++)
  {
    int val1=arr[i]-arr[i-1];
    int val2=arr[i]-arr[i-2];
    if(val1<0)val1*=-1;
    if(val2<0)val2*=-1;
    dp[i]=min(dp[i-2]+val2,dp[i-1]+val1);
  }
  cout<<dp[n-1]<<endl;
  return 0;
}

Compiler output:
a.cc:4:11: error: size of array 'arr' is not an integral constant-expression
    4 | int n,arr[maxn],dp[maxn];
      |           ^~~~
a.cc:4:20: error: size of array 'dp' is not an integral constant-expression
    4 | int n,arr[maxn],dp[maxn];
      |                    ^~~~
Language: C++

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

int main()
{
    //ios_base::sync_with_stdio(false);
    //cin.tie(0);cout.tie(0);
    long long i, n, t = 0;
    long long a[100001], s[100001];
    cin >> n;
    for (i = 1; i <= n; i++) cin >> a[i];
s[0]=s[1]=0;
    for (i = 2; i <= n; i++) s[i] = min(abs(a[i-1]-a[i])+s[i-1],abs(a[i-2]-a[i])+s[i-2]);
    cout << s[n];
    return 0;

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

#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
    ios ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    //freopen("test.inp","r",stdin);
    int i, n, t = 0;
    int a[100001], b[100001], s[100001] = {0};
    cin >> n;
    for (i = 1; i <= n; i++) cin >> a[i];
    for (i = 2; i <= n; i++) s[i] = min(abs(a[i-1]-a[i])+s[i-1],abs(a[i-2]-a[i])+s[i-2]);
    cout << s[n];
    //for (i = t; i >= 1; i--) cout << b[i] <<" ";
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:34: error: qualified-id in declaration before '(' token
    7 |     ios ios_base::sync_with_stdio(false);
      |                                  ^
Language: C++

#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
  ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    //freopen("test.inp","r",stdin);
    int i, n, t = 0;
    int a[100001], b[100001], s[100001] = {0};
    cin >> n;
    for (i = 1; i <= n; i++) cin >> a[i];
    for (i = 2; i <= n; i++) s[i] = min(abs(a[i-1]-a[i])+s[i-1],abs(a[i-2]-a[i])+s[i-2]);
    cout << s[n];
    //for (i = t; i >= 1; i--) cout << b[i] <<" ";
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:32: error: qualified-id in declaration before '(' token
    7 |   ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
      |                                ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main()
{
    //freopen("test.inp","r",stdin);
    int i, n, t = 0;
    int a[10001], b[10001], s[10001] = {0};
    cin >> n;
    for (i = 1; i <= n; i++) cin >> a[i];
    for (i = 2; i <= n; i++) s[i] = min(abs(a[i-1]-a[i])+s[i-1],abs(a[i-2]-a[i])+s[i-2]);
    i = n;
    t = 1; b[1] = n;
    while (i > 1)
    {
        if (s[i] == s[i-1]+abs(a[i-1]-a[i])) i--; else i-=2;
        t++;
        b[t] = i;
    }
    cout << s[n] << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:21:26: error: expected '}' at end of input
   21 |     cout << s[n] << endl;
      |                          ^
a.cc:6:1: note: to match this '{'
    6 | {
      | ^
Language: C++

#include <bits/stdc++.h>
#define pii pair<int,int>
#define vi vector<int>
#define ppii pair<pii>

using namespace std;

int n;
vector <int> arr;
vector<long long> dp;

void dfs(int a,int val)
{
    if(val<dp[a])dp[a]=val;else return;

    if(a<n-1)
        dfs(a+1,val+abs(arr[a]-arr[a+1]));
    if(a<n-2)
        dfs(a+2,val+abs(arr[a]-arr[a+2]));
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);

    cin>>n;

    arr=vi(n+1);
    dp=vi(n,INT_MAX);

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

    dfs(0,0);

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

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:20: error: no match for 'operator=' (operand types are 'std::vector<long long int>' and 'std::vector<int>')
   30 |     dp=vi(n,INT_MAX);
      |                    ^
In file included from /usr/include/c++/14/vector:72,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'std::vector<int>' to 'const std::vector<long long int>&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<long long int>&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::initializer_list<long long int>'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
Language: C++

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

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

ll h[100010];
ll dp[100010];
int N;
const long long INF = 1LL << 60;

int main()
{
    cin >> N;
    rep(i,N) cin >> h[i];
    rep(i,100010) dp[i] = INF;
    
    dp[0] = 0;

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

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

    return 0;
}

Compiler output:
a.cc: In function 'bool chmax(T&, T)':
a.cc:6:66: error: expected ';' before 'return'
    6 | template<class T> inline bool chmax(T& a,T b) { if (a < b) {a = b return 1;} return 0; }
      |                                                                  ^~~~~~~
      |                                                                  ;
a.cc: In function 'bool chmin(T&, T)':
a.cc:7:66: error: expected ';' before 'return'
    7 | template<class T> inline bool chmin(T& a,T b) { if (a > b) {a = b return 1;} return 0; }
      |                                                                  ^~~~~~~
      |                                                                  ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
20007];
 
struct node
{
  int w, s;
  long long v;
}a[1007];
 
bool cmp(node &x, node &y) 
{
  return x.w + x.s < y.w + y.s;
}

int main()
{
    int n;
  	cin >> n;
  	long long dp[n];
    for (int i = 1; i <= n; i++)
    {
      cin>>a[i].w;
      cin>>a[i].s;
      cin>>a[i].v;
    }
    sort(a + 1, a + 1 + n, cmp);
    long long result = 0;
    for (int i = 1; i <= n; i++)
        for (int j = a[i].s + a[i].w; j >= a[i].w; j--)
            result = max(result, dp[j] = max(dp[j], dp[j - a[i].w] + a[i].v));
  cout<<result;  
    return 0;
}


Compiler output:
a.cc:4:1: error: expected unqualified-id before numeric constant
    4 | 20007];
      | ^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
long long dp[20007];
 
struct node
{
  int w, s;
  long long v;
}a[1007];
 
bool cmp(node &x, node &y) 
{
  return x.w + x.s < y.w + y.s;
}

int main()
{
    int n;
  	cin >> n;
    for (int i = 1; i <= n; i++)
    {
      cin>>a[i].w;
      cin>>a[i].s;
      cin>>a[i].v;
    }
    sort(a + 1, a + 1 + n, cmp);
    ll ans = 0;
    for (int i = 1; i <= n; i++)
        for (int j = a[i].s + a[i].w; j >= a[i].w; j--)
            ans = max(ans, dp[j] = max(dp[j], dp[j - a[i].w] + a[i].v));
  cout<<ans;  
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:5: error: 'll' was not declared in this scope
   28 |     ll ans = 0;
      |     ^~
a.cc:31:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   31 |             ans = max(ans, dp[j] = max(dp[j], dp[j - a[i].w] + a[i].v));
      |             ^~~
      |             abs
a.cc:32:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   32 |   cout<<ans;
      |         ^~~
      |         abs
Language: C++

#include <bits/stdc++.h>
typedef long long int ll;
const ll MOD = 1000000007;
using namespace std;
int main(){
    vaibhavv06;
	int n,k; cin>>n>>k;
    vector<int> dp(k+1);
    dp[0]=1;
    for(int child = 0;child<n;child++){
        int upto; cin>>upto;
       
        vector<int> fake(k+1);
        for(int used=k;used>=0;used--){
            int temp = dp[used];
            int l = used+1;
            int r = used + min(upto,k-used);
            if(l<=r){
                fake[l]+=temp;
                if(fake[l]>MOD) fake[l]-=MOD;
                if(r+1<=k){
                    fake[r+1]-=temp;
                    if(fake[r+1]<0) fake[r+1]+=MOD;
                }
            }
        }
        int prefix = 0;
        for(int i=0;i<=k;i++){
            prefix+=fake[i];
            prefix%=MOD;
            dp[i]+=prefix;
            dp[i]%=MOD;
        }
    }
    cout<<dp[k]<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:5: error: 'vaibhavv06' was not declared in this scope
    6 |     vaibhavv06;
      |     ^~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#include <utility>
#include <algorithm>
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector<int> dp(3);
    for(int i = 0; i < n; i++)
    {
        vector<int> new_dp(3,0);
        vector<int> points(3);
        for(int j = 0; j < 3; j++)
            cin >> points[j];
        for(int k = 0; k < 3; k++)
        {
            for(int l = 0; l < 3; l++)
            {
                if(k != l)
                {
                    new_dp[l] = max(new_dp[l], dp[k]+points[l]);
                   // cout << new_dp[l]<<endl;
                }
            }
        }
        dp = new_dp;
    }
   /* for(int r = 0; r < 3; r++)
    {
        cout << dp[r]<<" ";
    }
    int m = dp[0];*/
    for(int o = 1; o < 3; o++)
    {
        m = max(m, dp[o]);
    }
    cout << m;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:9: error: 'm' was not declared in this scope
   36 |         m = max(m, dp[o]);
      |         ^
a.cc:38:13: error: 'm' was not declared in this scope
   38 |     cout << m;
      |             ^
Language: C++

# include <iostream>
# include <cstdio>
# include <cstring>
# include <vector>
# include <string>
# include <cmath>
# include <map>
# include <unordered_map>
# include <set>
# include <queue>
# include <deque>

using namespace std;

int f(int k, const vector < int > & h, vector < int > & res, int max_step) {
    if (k == 0) return 0;

    if (res[k] == -1) {
        
        res[k] = f(k - 1, h, res, max_step) + abs(h[k] - h[k - 1]);
            
            for(int step=2; step < min(k, max_step); step++)
            {
                if (k >= step) {
                    int tmp;
                    tmp := min(res[k], f(k - step, h, res, max_step) + abs(h[k] - h[k - step]));
                    if (tmp < res[k]) {
                        res[k] := tmp;
                    }
                }
            }
        }
        
        return res[k];
    }


int main() {
  int n;
  int max_step;
  cin >> n;
  cin >> max_step;

  // lets start from 0, to n-1
  vector<int> h(n);
  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }
  
  vector<int> res(n, -1);
  
  cout << f(n - 1, h, res, max_step);

  return 0;
}

Compiler output:
a.cc: In function 'int f(int, const std::vector<int>&, std::vector<int>&, int)':
a.cc:26:26: error: expected primary-expression before '=' token
   26 |                     tmp := min(res[k], f(k - step, h, res, max_step) + abs(h[k] - h[k - step]));
      |                          ^
a.cc:28:31: error: expected ';' before ':' token
   28 |                         res[k] := tmp;
      |                               ^~
      |                               ;
a.cc:28:30: warning: ignoring return value of 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = int; _Alloc = std::allocator<int>; reference = int&; size_type = long unsigned int]', declared with attribute 'nodiscard' [-Wunused-result]
   28 |                         res[k] := tmp;
      |                              ^
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_vector.h:1128:7: note: declared here
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
Language: Java

package jp.atcoder.dp;

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

public class Frog1 {
    public static int jumpCost(int start, int jumpLength, int end, int[] height) {
        if (start + jumpLength == end) {
            return Math.abs(height[start + jumpLength] - height[start]);
        }
        if (start + jumpLength > end) {
            return Integer.MAX_VALUE;
        } else {
            return Math.abs(height[start + jumpLength] - height[start])
                    + Math.min(
                    jumpCost(start + jumpLength, 1, end, height),
                    jumpCost(start + jumpLength, 2, end, height));
        }
    }

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

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

        int totalCost = 0;
        totalCost = Math.min(jumpCost(0, 1, n - 1, height), jumpCost(0, 2, n - 1, height));
        System.out.println(totalCost);

//        for (int i = 0; i < n; i++) {
//            System.out.printf("%d ", height[i]);
//        }


    }
}


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

Scanner scan = new Scanner(System.in);
      int size = scan.nextInt();
      String heights = scan.nextLine();
      String[] hstr = heights.split(" ");
      int[]hs = new int[hstr.length];
      for (int i = 0 ; i<hstr.length ; i++) {
        hs[i] = Integer.parseInt(hstr[i]);
      }
      
      scan.close();
      
      int[] res = new int[size];
      res[0] = 0;
      res[1] = Math.abs(hs[1]-hs[0]);
        
      for (int i = 2 ; i < size ; i++) {
        res[i] = Math.min(Math.abs(hs[i] - hs[i-1]),Math.abs(hs[i] - hs[i-2]));
      }
      
      System.out.print(res[size]);

Compiler output:
Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
Scanner scan = new Scanner(System.in);
^
  (use --enable-preview to enable unnamed classes)
Main.java:6: error: class, interface, enum, or record expected
      for (int i = 0 ; i<hstr.length ; i++) {
      ^
Main.java:6: error: class, interface, enum, or record expected
      for (int i = 0 ; i<hstr.length ; i++) {
                       ^
Main.java:6: error: class, interface, enum, or record expected
      for (int i = 0 ; i<hstr.length ; i++) {
                                       ^
Main.java:8: error: class, interface, enum, or record expected
      }
      ^
Main.java:13: error: class, interface, enum, or record expected
      res[0] = 0;
      ^
Main.java:14: error: class, interface, enum, or record expected
      res[1] = Math.abs(hs[1]-hs[0]);
      ^
Main.java:16: error: class, interface, enum, or record expected
      for (int i = 2 ; i < size ; i++) {
      ^
Main.java:16: error: class, interface, enum, or record expected
      for (int i = 2 ; i < size ; i++) {
                       ^
Main.java:16: error: class, interface, enum, or record expected
      for (int i = 2 ; i < size ; i++) {
                                  ^
Main.java:18: error: class, interface, enum, or record expected
      }
      ^
11 errors
Language: Java

import java.util.*;
public class Main {
    public static void main(String[] args){
      Scanner scan = new Scanner(System.in);
      int size = scan.nextInt();
      String heights = scan.nextLine();
      String[] hstr = heights.split(" ");
      int[]hs = new int[hstr.size()];
      for (int i = 0 ; i<hstr.size() ; i++) {
        hs[i] = Integer.parse(hstr[i]);
      }
      
      scan.close();
      
      int[] res = new int[size];
      res[0] = 0;
      res[1] = Math.abs(hs[1]-hs[0]);
        
      for (int i = 2 ; i < size ; i++) {
        res[i] = Math.min(Math.abs(hs[i] - hs[i-1]),Math.abs(hs[i] - hs[i-2]));
      }
      
      System.out.print(res[size]);
    }
}

Compiler output:
Main.java:8: error: cannot find symbol
      int[]hs = new int[hstr.size()];
                            ^
  symbol:   method size()
  location: variable hstr of type String[]
Main.java:9: error: cannot find symbol
      for (int i = 0 ; i<hstr.size() ; i++) {
                             ^
  symbol:   method size()
  location: variable hstr of type String[]
Main.java:10: error: cannot find symbol
        hs[i] = Integer.parse(hstr[i]);
                       ^
  symbol:   method parse(String)
  location: class Integer
3 errors
Language: Java

import java.util.*;
public class Main {
    public static void main(String[] args){
      Scanner scan = new Scanner(System.in);
      int size = scan.nextInt();
      String heights = scan.nextLine();
      String[] hstr = heights.split(" ");
      int[]hs = new int[hstr.size()]();
      for (int i = 0 ; i<hstr.size() ; i++) {
        hs[i] = Integer.parse(hstr[i]);
      }
      
      scan.close();
      
      int[] res = new int[size];
      res[0] = 0;
      res[1] = Math.abs(hs[1]-hs[0]);
        
      for (int i = 2 ; i < size ; i++) {
        res[i] = Math.min(Math.abs(hs[i] - hs[i-1]),Math.abs(hs[i] - hs[i-2]));
      }
      
      System.out.print(res[size]);
    }
}

Compiler output:
Main.java:8: error: ';' expected
      int[]hs = new int[hstr.size()]();
                                    ^
1 error
Language: Java

import java.util.*;
public class Main {
    public static void main(String[] args){
      Scanner scan = new Scanner(System.in);
      int size = scan.nextInt();
      String heights = scan.nextLine();
      int[] hs = heights.split(" ");
      
      scan.close();
      
      int[] res = new int[size];
      res[0] = 0;
      res[1] = Math.abs(hs[1]-hs[0]);
        
      for (int i = 2 ; i < size ; i++) {
        res[i] = Math.min(Math.abs(hs[i] - hs[i-1]),Math.abs(hs[i] - hs[i-2]));
      }
      
      return res[size];
    }
}

Compiler output:
Main.java:7: error: incompatible types: String[] cannot be converted to int[]
      int[] hs = heights.split(" ");
                              ^
Main.java:19: error: incompatible types: unexpected return value
      return res[size];
                ^
2 errors
Language: Java

import java.util.Scanner;

public static void main(String[] args) {
  Scanner s = new Scanner(System.in);
  int num = s.nextInteger();
  String heights = s.nextString();
  
  System.out.print(num);
}

Compiler output:
Main.java:3: error: unnamed classes are a preview feature and are disabled by default.
public static void main(String[] args) {
              ^
  (use --enable-preview to enable unnamed classes)
1 error