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

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

}




Compiler output:
a.cc:6:1: error: expected initializer before 'int'
    6 | int abso(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: 'abso' was not declared in this scope; did you mean 'abs'?
   31 |   if(a==1){ return abso(b[0],b[1]);}
      |                    ^~~~
      |                    abs
a.cc:33:32: error: 'abso' was not declared in this scope; did you mean 'abs'?
   33 |   { return min (optim(a-1,b,n)+abso(b[n-(a)],b[n-(a-1)]),optim(a-2,b,n)+abso(b[n-(a-1)],b[n-(a-2)]) ) ; }
      |                                ^~~~
      |                                abs
Language: C++

#include<bits/stdc++.c>
int optim(int a,vector<int> b,int n)
int abs(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 abs(b[0],b[1]);}
  if(a>1) 
  { return min (optim(a-1,b,n)+abs(b[n-(a)],b[n-(a-1)]),optim(a-2,b,n)+abs(b[n-(a-1)],b[n-(a-2)]) ) ; }  

}




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

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

public class Solution {

    public static int frog1(int[] arr) {
        if(arr == null || arr.length == 0) {
            return 0;
        }
        int[] dp = new int[arr.length];

        for(int i = 1; i < arr.length; i++) {
            if(i == 1) {
                dp[i] = dp[i - 1] + Math.abs(arr[i] - arr[i-1]);
            } else {
                dp[i] = Math.min(dp[i - 1] + Math.abs(arr[i] - arr[i-1]), 
                                dp[i-2] + Math.abs(arr[i] - arr[i-2]));   
            }
        }
        return dp[arr.length - 1];
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        
        int[] arr = new int[n];
        for(int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        System.out.println(frog1(arr));
  }
}


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

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

typedef long long int ll;
#define test int t; cin >> t; while(t--) 
using namespace std;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:13:5: error: expected initializer before 'int'
   13 |     int n;
      |     ^~~
a.cc:14:10: error: 'n' was not declared in this scope; did you mean 'yn'?
   14 |   cin >> n;
      |          ^
      |          yn
a.cc:17:12: error: 'h' was not declared in this scope
   17 |     cin >> h[i];
      |            ^
a.cc:21:12: error: 'h' was not declared in this scope
   21 |   r[2]=abs(h[1]-h[0]);
      |            ^
a.cc:24:14: error: 'c' was not declared in this scope
   24 |     r[i]=min(c[i-2] + abs(h[i]-h[i-2])),c[i-1] + abs(h[i]-h[i-1]));
      |              ^
a.cc:27:24: error: expected '}' at end of input
   27 |   cout << r[n] << endl;
      |                        ^
a.cc:10:12: note: to match this '{'
   10 | int main (){
      |            ^
Language: Java

import java.util.*;

public class frog1{
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int arr[] = new int[n];
        for(int i=0;i<n;i++)
            arr[i] = s.nextInt();
        int dp[] = new int[n];
        for(int i=1;i<n;i++)
            dp[i] = Integer.MAX_VALUE;
        // dp[0] = 0;
        for(int i=1;i<n;i++){
            dp[i] = Math.min(dp[i],dp[i-1]+Math.abs(arr[i]-arr[i-1]));
            if(i<n-1){
                dp[i+1] = Math.min(dp[i+1],dp[i-1]+Math.abs(arr[i+1]-arr[i-1]));
            }
        }
        System.out.println(dp[n-1]);
    }
}

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


import java.util.*;
import java.io.*;
public class j {
 
 public static int frog(int arr[], int i, int prev){
     if(i >= arr.length)
           return 0;
     if(i == arr.length-1)
         return Math.abs(arr[prev]- arr[i]);
     int a = 0; int b = 0;
     if(prev == -1){
        return Math.min(0+frog(arr,i+1,0),0+frog(arr,i+2,0));
     }
    
     else{
            // System.out.println(arr[prev]+ " - " + arr[i] );
             a =   Math.abs(arr[prev] - arr[i]) + frog(arr,i+1,i);
             b =   Math.abs(arr[prev] - arr[i]) + frog(arr,i+2,i);
     
     }
  
 return Math.min(a,b);
  
 }
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   
        int n = Integer.parseInt(br.readLine());
        int[] arr = new int[n+1];
        StringTokenizer str  = new StringTokenizer(br.readLine()," ");
        int i = 0;
        while(str.hasMoreTokens()){
            arr[i] = Integer.parseInt(str.nextToken());
            i++;
        }
        
           int[] dp = new int[arr.length];
           Arrays.fill(dp,-1);
            System.out.println(frog(arr,0,-1));
        
        
    }
    
}


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


package javaapplication9;
import java.util.*;
import java.io.*;
public class JavaApplication9 {
 
 public static int frog(int arr[], int i, int prev){
     if(i >= arr.length)
           return 0;
     if(i == arr.length-1)
         return Math.abs(arr[prev]- arr[i]);
     int a = 0; int b = 0;
     if(prev == -1){
        return Math.min(0+frog(arr,i+1,0),0+frog(arr,i+2,0));
     }
    
     else{
            // System.out.println(arr[prev]+ " - " + arr[i] );
             a =   Math.abs(arr[prev] - arr[i]) + frog(arr,i+1,i);
             b =   Math.abs(arr[prev] - arr[i]) + frog(arr,i+2,i);
     
     }
  
 return Math.min(a,b);
  
 }
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   
        int n = Integer.parseInt(br.readLine());
        int[] arr = new int[n+1];
        StringTokenizer str  = new StringTokenizer(br.readLine()," ");
        int i = 0;
        while(str.hasMoreTokens()){
            arr[i] = Integer.parseInt(str.nextToken());
            i++;
        }
        
           int[] dp = new int[arr.length];
           Arrays.fill(dp,-1);
            System.out.println(frog(arr,0,-1));
        
        
    }
    
}


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

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

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


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

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

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


Compiler output:
a.cc:1:2: error: invalid preprocessing directive #inlude; did you mean #include?
    1 | #inlude <bits/stdc++.h>
      |  ^~~~~~
      |  include
a.cc: In function 'int main()':
a.cc:7:3: error: 'cin' was not declared in this scope
    7 |   cin >> x;
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #inlude <bits/stdc++.h>
a.cc:12:9: error: 'abs' was not declared in this scope
   12 |   dp[1]=abs(arr[1]-arr[0]);
      |         ^~~
a.cc:15:15: error: 'cout' was not declared in this scope
   15 |               cout << dp[x-1];
      |               ^~~~
a.cc:15:15: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

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

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


Compiler output:
a.cc:1:2: error: invalid preprocessing directive #inlude; did you mean #include?
    1 | #inlude <bits/stdc++.h>
      |  ^~~~~~
      |  include
a.cc: In function 'int main()':
a.cc:7:3: error: 'cin' was not declared in this scope
    7 |   cin >> x;
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #inlude <bits/stdc++.h>
a.cc:12:9: error: 'abs' was not declared in this scope
   12 |   dp[1]=abs(arr[1]-arr[0]);
      |         ^~~
a.cc:15:15: error: 'cout' was not declared in this scope
   15 |               cout << dp[k-1];
      |               ^~~~
a.cc:15:15: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:15:26: error: 'k' was not declared in this scope
   15 |               cout << dp[k-1];
      |                          ^
Language: C++

#inlude bits/stdc++.h
using namespace std;

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


Compiler output:
a.cc:1:2: error: invalid preprocessing directive #inlude; did you mean #include?
    1 | #inlude bits/stdc++.h
      |  ^~~~~~
      |  include
a.cc: In function 'int main()':
a.cc:7:3: error: 'cin' was not declared in this scope
    7 |   cin >> x;
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #inlude bits/stdc++.h
a.cc:11:10: error: 'k' was not declared in this scope
   11 |   int dp[k+1];
      |          ^
a.cc:12:3: error: 'dp' was not declared in this scope
   12 |   dp[0]=0;
      |   ^~
a.cc:13:9: error: 'abs' was not declared in this scope
   13 |   dp[1]=abs(arr[1]-arr[0]);
      |         ^~~
a.cc:16:15: error: 'cout' was not declared in this scope
   16 |               cout << dp[k-1];
      |               ^~~~
a.cc:16:15: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#inlude bits/stdc++.h
using namespace std;
int out(int arr,int k)
{
  int dp[k+1];
  dp[0]=0;
  dp[1]=abs(arr[1]-arr[0]);
  for (int i=0;i<=k;i++)
    dp[i]=min(dp[i-1]+abs(arr[i-1]-arr[i]),dp[i-2]+abs(arr[i-2]-arr[i]);
}
int main()
{
	int x;
  cin >> x;
  int arr[x];
  for (int i=0;i<x;i++)
    cin >> arr[i];
  cout << out(arr,x-1);
}

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #inlude; did you mean #include?
    1 | #inlude bits/stdc++.h
      |  ^~~~~~
      |  include
a.cc: In function 'int out(int, int)':
a.cc:7:16: error: invalid types 'int[int]' for array subscript
    7 |   dp[1]=abs(arr[1]-arr[0]);
      |                ^
a.cc:7:23: error: invalid types 'int[int]' for array subscript
    7 |   dp[1]=abs(arr[1]-arr[0]);
      |                       ^
a.cc:7:9: error: 'abs' was not declared in this scope
    7 |   dp[1]=abs(arr[1]-arr[0]);
      |         ^~~
a.cc:9:30: error: invalid types 'int[int]' for array subscript
    9 |     dp[i]=min(dp[i-1]+abs(arr[i-1]-arr[i]),dp[i-2]+abs(arr[i-2]-arr[i]);
      |                              ^
a.cc:9:39: error: invalid types 'int[int]' for array subscript
    9 |     dp[i]=min(dp[i-1]+abs(arr[i-1]-arr[i]),dp[i-2]+abs(arr[i-2]-arr[i]);
      |                                       ^
a.cc:9:59: error: invalid types 'int[int]' for array subscript
    9 |     dp[i]=min(dp[i-1]+abs(arr[i-1]-arr[i]),dp[i-2]+abs(arr[i-2]-arr[i]);
      |                                                           ^
a.cc:9:68: error: invalid types 'int[int]' for array subscript
    9 |     dp[i]=min(dp[i-1]+abs(arr[i-1]-arr[i]),dp[i-2]+abs(arr[i-2]-arr[i]);
      |                                                                    ^
a.cc:10:1: warning: no return statement in function returning non-void [-Wreturn-type]
   10 | }
      | ^
a.cc: In function 'int main()':
a.cc:14:3: error: 'cin' was not declared in this scope
   14 |   cin >> x;
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #inlude bits/stdc++.h
a.cc:18:3: error: 'cout' was not declared in this scope
   18 |   cout << out(arr,x-1);
      |   ^~~~
a.cc:18:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:18:15: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   18 |   cout << out(arr,x-1);
      |               ^~~
      |               |
      |               int*
a.cc:3:13: note:   initializing argument 1 of 'int out(int, int)'
    3 | int out(int arr,int k)
      |         ~~~~^~~
Language: C++

#include <iostream>
#include <cmath>
#define MAX 100000

using namespace std;

int v[MAX + 5], dp[MAX + 5];
int main()
{
    int n;
	
  	ios::sync_with_studio(false);
  	cin.tie(0);
  	cout.tie(0);
  
    cin >> n;

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

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

    for(int i = 2; i < n; i++)
        dp[i] = min(dp[i - 1] + abs(v[i] - v[i - 1]), dp[i - 2] + abs(v[i] - v[i - 2]));

    cout << dp[n - 1];

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:14: error: 'sync_with_studio' is not a member of 'std::ios' {aka 'std::basic_ios<char>'}
   12 |         ios::sync_with_studio(false);
      |              ^~~~~~~~~~~~~~~~
Language: C++

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

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

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

vector<int> a;

map<int,int> mp;

int dp(int i){
    if(i == 0){
        return 0;
    }
    if(i==1){
        return abs(a[1]-a[0]);
    }
  	if(mp.count(i)){
      return mp[i];
    }
    mp[i] = min(abs(a[i]-a[i-2]+dp(i-2)) , a[i]-a[i-1]+dp(i-1)) );
  	return mp[i];
}

int main(){


    int n;
    cin>>n;
    a.resize(n);
  	for(int& i : a)cin>>i;
    cout<<dp(n-1);
}

Compiler output:
a.cc: In function 'int dp(int)':
a.cc:18:64: error: expected ';' before ')' token
   18 |     mp[i] = min(abs(a[i]-a[i-2]+dp(i-2)) , a[i]-a[i-1]+dp(i-1)) );
      |                                                                ^~
      |                                                                ;
Language: C++

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

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

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

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

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

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

    // 答え
    cout << dp[N-1] << endl;
}


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

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

//何でも良い型に変換
template<class T> inline bool chmin(T&a, 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];

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

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

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

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

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

    // 答え
    cout << dp[N-1] << endl;
}


Compiler output:
a.cc:5:42: error: 'b' has not been declared
    5 | template<class T> inline bool chmin(T&a, b){
      |                                          ^
a.cc: In function 'bool chmin(T&, int)':
a.cc:6:10: error: 'b' was not declared in this scope
    6 |   if(a > b){
      |          ^
Language: C++

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

//何でも良い型に変換
template<class T> inline bool chmin(T&a, 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];

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

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

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

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

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

    // 答え
    cout << dp[N-1] << endl;
}

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

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

int dp[100005];
//dp[i] 足場[i]にいくときの最小コスト


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

  dp[1]=0;
  dp[2]=abs(h[2]-h[1]);
  for(int i=3;i<=n;i++){
    int a, b;
    a = dp[i-1]+abs(h[i]-h[i-1]);
    b = dp[i-2]+abs(h[i]-h[i-2]);
    //cout << "[" << a << "][" <<b << "]"<<endl;
    dp[i]=min(a,b);
  }

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

Compiler output:
a.cc:1:9: fatal error: bits\stdc++.h: No such file or directory
    1 | #include<bits\stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: Java

import java.util.*;

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


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

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

Compiler output:
a.cc:2:7: error: expected nested-name-specifier before 'namepace'
    2 | using namepace std;
      |       ^~~~~~~~
a.cc: In function 'int main()':
a.cc:6:1: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 | cin>>n;
      | ^~~
      | std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:15:7: error: 'max' was not declared in this scope; did you mean 'std::max'?
   15 | dp[i]=max(dp[i-2]+abs(arr[i-2]-arr[i]),dp[i-1]+abs(arr[i]-arr[i-1]));
      |       ^~~
      |       std::max
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:18:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   18 | cout<<dp[n-1];
      | ^~~~
      | std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C

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

int min(long a, long b) {
    return a < b ? a : b;
}

int main() {
    const long INF = LONG_MAX >> 5;
    long N;
    long h[10010];
    long dp[10010];

    scanf("%d", &N);
    for (long i = 0; i < N; i++) {
        scanf("%d", &h[i]);
    }
    for (long i = 0; i < N; i++) {
        dp[i] = INF;
    }

    dp[0] = 0;
    dp[1] = abs(h[0] - h[1]);
    for (long i = 2; i < N; i++) {
        dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]));
    }
    prlongf("%d", dp[N - 1]);
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:28:5: error: implicit declaration of function 'prlongf' [-Wimplicit-function-declaration]
   28 |     prlongf("%d", dp[N - 1]);
      |     ^~~~~~~
Language: C

#include <stdio.h>

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

int main() {
    const long INF = INT_MAX << 5;
    int N;
    int h[10010];
    int dp[10010];

    scanf("%d", N);
    for (int i = 0; i < N; i++) {
        scanf("%d", h[i]);
    }
    for (int i = 0; i < N; i++) {
        dp[i] = INF;
    }

    dp[0] = 0;
    dp[1] = abs(h[0] - h[1]);
    for (int i = 2; i < N; i++) {
        dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]));
    }
    printf("%d", dp[N - 1]);
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:8:22: error: 'INT_MAX' undeclared (first use in this function)
    8 |     const long INF = INT_MAX << 5;
      |                      ^~~~~~~
main.c:2:1: note: 'INT_MAX' is defined in header '<limits.h>'; this is probably fixable by adding '#include <limits.h>'
    1 | #include <stdio.h>
  +++ |+#include <limits.h>
    2 | 
main.c:8:22: note: each undeclared identifier is reported only once for each function it appears in
    8 |     const long INF = INT_MAX << 5;
      |                      ^~~~~~~
main.c:22:13: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
   22 |     dp[1] = abs(h[0] - h[1]);
      |             ^~~
main.c:2:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
    1 | #include <stdio.h>
  +++ |+#include <stdlib.h>
    2 |
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	long i=0;
	long n;
  	vector <long> r; 
	cin>>n;
	long J;
	for (int j=0;j<n;j++)
	{
		cin>>J;r.push_back(J);
	}
  	long J=0;
	while(i<n)
	{
		if (abs(r.at(i)-r.at(i+1))>abs(r.at(i+2)-r.at(i)))
		{
			i+=2;
			J+=abs(r.at(i+2)-r.at(i));
		}
		else
	{i++;
		J+=abs(r.at(i+1)-r.at(i));
	}
	if (i>=n-2) break;
	}
	cout<<J<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:14: error: redeclaration of 'long int J'
   16 |         long J=0;
      |              ^
a.cc:11:14: note: 'long int J' previously declared here
   11 |         long J;
      |              ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	int i=0;
	int n;vector <int> r;int 
	cin>>n;
	int J;
	for (int j=0;j<n;j++)
	{
		cin>>J;r.push_back(J);
	}J=0;
	while(i<n)
	{
		if (abs(r.at(i)-r.at(i+1))>abs(r.at(i+2)-r.at(i)))
		{
			i+=2;
			J+=abs(r.at(i+2)-r.at(i));
		}
		else
	{i++;
		J+=abs(r.at(i+1)-r.at(i));
	}
	if (i>=n-2) break;
	}
	cout<<J<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:12: error: expected initializer before '>>' token
    9 |         cin>>n;
      |            ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	int n;vector <int> r;
	cin>>n;
	int J=0;
	for (int i=0;i<n;i++)
	{
		cin>>J;r.push_back(J);
	}
	while(i<n)
	{
		if (abs(r.at(i)-r.at(i+1))>abs(r.at(i+2)-r.at(i)))
		{
			i+=2;
			J+=abs(r.at(i+2)-r.at(i));
		}
		else
	{i++;
		J+=abs(r.at(i+1)-r.at(i));
	}
	}
	cout<<J<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:15: error: 'i' was not declared in this scope
   14 |         while(i<n)
      |               ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	int n;vector <int> r;
	cin>>n;
	int J=0;
	for (int& x:r)
	{
		scanf("%d",&x);
	}
	while(i<n)
	{
		if (abs(r.at(i)-r.at(i+1))>abs(r.at(i+2)-r.at(i)))
		{
			i+=2;
			J+=abs(r.at(i+2)-r.at(i));
		}
		else
	{i++;
		J+=abs(r.at(i+1)-r.at(i));
	}
	}
	cout<<J<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:15: error: 'i' was not declared in this scope
   14 |         while(i<n)
      |               ^
Language: C++

#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <map>
#include <list>
#include <stdio.h>
#include <sstream>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
//ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
//ll lcm(ll x, ll y) {return x / gcd(x, y) * y;}
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const ll mod = 1e9 + 7;
const ll inf = 1LL << 60;
const long double pi = 3.14159265358979323846;

// ****************************************CODE***************************************//


ll n, h[100100];
ll dp[100100];

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

  for(int i = 0; i < 100100; i++) dp[i] = inf;
  dp[0] = 0;

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

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



Compiler output:
a.cc: In function 'int main()':
a.cc:39:37: error: 'a' was not declared in this scope
   39 |   for(int i = 0; i < n; i++) cin >> a[i];
      |                                     ^
Language: C++

#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <map>
#include <list>
#include <stdio.h>
#include <sstream>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
//ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
//ll lcm(ll x, ll y) {return x / gcd(x, y) * y;}
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const ll mod = 1e9 + 7;
const ll inf = 1LL << 60;
const long double pi = 3.14159265358979323846;

// ****************************************CODE***************************************//


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

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

  for(int i = 0; i < 100100; i++) dp[i] = inf;
  dp[0] = 0;

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

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



Compiler output:
a.cc: In function 'int main()':
a.cc:45:40: error: 'h' was not declared in this scope
   45 |     dp[i+1] = max(dp[i+1], dp[i] + abs(h[i] - h[i+1]));
      |                                        ^
Language: Java

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

public class FrogJump {
    public static int cost(int[] heights){
        int[] cost = new int[heights.length];
        cost[0] = 0;
        cost[1] = Math.abs(heights[1] - heights[0]);
        for (int i = 2; i < heights.length; i++) {
            cost[i] = Math.min(cost[i-1] + Math.abs(heights[i] - heights[i-1]),
                    cost[i-2] + Math.abs(heights[i] - heights[i-2]));
        }
        return cost[heights.length - 1];
    }

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(reader.readLine());
        int[] h = new int[N];
        StringTokenizer st = new StringTokenizer(reader.readLine());
        for (int i = 0; i < N; i++) {
            h[i] = Integer.parseInt(st.nextToken());
        }
        System.out.println(cost(h));
    }
}


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

import java.util.*;
import java.io.*;
import java.math.*;
import java.lang.*;
public class MyClass {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        PrintWriter pw=new PrintWriter(System.out);
        int n=sc.nextInt(),
            k=sc.nextInt();
        int[] a=new int[n];
        for(int i=0;i<n;i++)
            a[i]=sc.nextInt();
        int[] dp=new int[n];
        Arrays.fill(dp,Integer.MAX_VALUE);
        dp[0]=0;
        for(int i=0;i<n;i++) {
            for(int j=1;j<=k;j++) {
                if((i+j)<n)
                    dp[i+j]=Math.min(dp[i+j],dp[i]+Math.abs(a[i]-a[i+j]));
            }
        }
        pw.print(dp[n-1]);
        pw.close();
    }
}

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

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

public class Code {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        //out.print("AMan");
        int n = sc.nextInt();
        int[] a = new int[n];
        for(int i=0;i<n;i++) {
            a[i] = sc.nextInt();
        }
        int dp[] = new int[n];
        Arrays.fill(dp,(int)1e9+7);
        dp[0]=0;
        for(int i=0;i<n;i++) {
            if(i+1<n) dp[i+1] = Math.min(dp[i+1],dp[i]+Math.abs(a[i+1]-a[i]));
            if(i+2<n) dp[i+2] = Math.min(dp[i+2],dp[i]+Math.abs(a[i+2]-a[i]));
        }
        out.println(dp[n-1]);

        out.flush();
        out.close();
    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public Scanner(FileReader fileReader) {
            br = new BufferedReader(fileReader);
        }

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

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

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

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public boolean ready() throws IOException {
            return br.ready();
        }
    }
}

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

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:13:25: error: expected ']' before ')' token
   13 |         a[i] = min(a[i-1)+ abs(h[i]-h[i-1]) , a[i-2]+abs(h[i]-h[i-2]));
      |                         ^
      |                         ]
a.cc:13:19: error: no matching function for call to 'min(int&)'
   13 |         a[i] = min(a[i-1)+ abs(h[i]-h[i-1]) , a[i-2]+abs(h[i]-h[i-2]));
      |                ~~~^~~~~~~
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:13:19: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   13 |         a[i] = min(a[i-1)+ abs(h[i]-h[i-1]) , a[i-2]+abs(h[i]-h[i-2]));
      |                ~~~^~~~~~~
/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
Language: C++

#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define all(v) ((v).begin()),((v).end())
#define rall(v) ((v).rbegin()),((v).rend())
#define clr(v,line) memset(v,line,sizeof(v))
#define endl '\n'
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 <<endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* coma = strchr(names + 1, ',');cerr.write(names, coma - names) << " : " << arg1<<" | ";__f(coma+1, args...);
}
#else
#define trace(...)
#endif
 
void file() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

void fast()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL); cout.tie(NULL);
}

const int OO = 1e9 + 5;
int N;
int h[OO], dp[OO];

int solve(int idx = 0)
{
    if(idx == N)
    {
        return min(
           abs(h[idx] - h[idx - 1]) * (idx - 1 >= 0),
            abs(h[idx] - h[idx - 2]) * (idx - 2 >= 0)
        );
    }

    int & ret = dp[idx];
    if(~ret)return ret;

    return ret = min(
            solve(idx + 1) + abs(h[idx] - h[idx + 1]),
            (solve(idx + 2) + abs(h[idx] - h[idx + 2])) * (idx + 2 <= N)
        );
}
int main(int argc, char const *argv[])
{
	// file();
	fast();

    cin>>N;

    for (int i = 0; i < N; ++i)
    {
        cin>>h[i];    
    }
    
    clr(dp, -1);

    cout<<solve();
}

Compiler output:
/tmp/ccCrq2EN.o: in function `solve(int)':
a.cc:(.text+0x162): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccCrq2EN.o
/tmp/ccCrq2EN.o: in function `main':
a.cc:(.text+0x2da): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccCrq2EN.o
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main()
{
  ios_base::sync_with_stdIO(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  
  int N;
  cin >> N;
  
  vector<int> V(N);
  for(auto& v : V)
  {
    cin >> v;
  }
  
  vector<int> dp(N, INT_MAX);
  
  for(int i = 0; i < N; ++i)
  {
    for(int j = i - 1; j >= i - 2 and j >= 0; --j)
    {
      dp[i] = min(dp[i], dp[j] + i - j);
    }
  }
  
  cout << dp[N - 1] << "\n";
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:13: error: 'sync_with_stdIO' is not a member of 'std::ios_base'
    7 |   ios_base::sync_with_stdIO(false);
      |             ^~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <cmath>
#include <string>

typedef long long lint;

using namespace std;

// dpテンプレ
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 lint INF = 10e9;

//入力
int n;
lint h[100000];
//dpテーブル
lint dp[100000];

int main(){
  int n,i;
  lint ans
  cin >> n;
  for(i = 0; i < n; i++){
    cin >> h[i];
  }

  for(i = 0; i < n; i++){
    dp[i] = INF;
  }
  for(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]));
    }
  }
  ans = dp[n - 1];
  cout << ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:3: error: expected initializer before 'cin'
   36 |   cin >> n;
      |   ^~~
a.cc:50:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
   50 |   ans = dp[n - 1];
      |   ^~~
      |   abs
Language: C++

#include <iostream>
#include <cmath>
#include <string>

#define lint long long;

using namespace std;

// dpテンプレ
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 lint INF = 10e9;

//入力
int n;
lint h[100000];
//dpテーブル
lint dp[100000];

int main(){
  int n,i;
  lint ans
  cin >> n;
  for(i = 0; i < n; i++){
    cin >> h[i];
  }

  for(i = 0; i < n; i++){
    dp[i] = INF;
  }
  for(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]));
    }
  }
  ans = dp[n - 1];
  cout << ans;
}


Compiler output:
a.cc:5:19: error: declaration does not declare anything [-fpermissive]
    5 | #define lint long long;
      |                   ^~~~
a.cc:25:7: note: in expansion of macro 'lint'
   25 | const lint INF = 10e9;
      |       ^~~~
a.cc:25:12: error: 'INF' does not name a type
   25 | const lint INF = 10e9;
      |            ^~~
a.cc:5:19: error: declaration does not declare anything [-fpermissive]
    5 | #define lint long long;
      |                   ^~~~
a.cc:29:1: note: in expansion of macro 'lint'
   29 | lint h[100000];
      | ^~~~
a.cc:29:6: error: 'h' does not name a type
   29 | lint h[100000];
      |      ^
a.cc:5:19: error: declaration does not declare anything [-fpermissive]
    5 | #define lint long long;
      |                   ^~~~
a.cc:31:1: note: in expansion of macro 'lint'
   31 | lint dp[100000];
      | ^~~~
a.cc:31:6: error: 'dp' does not name a type
   31 | lint dp[100000];
      |      ^~
a.cc: In function 'int main()':
a.cc:5:19: error: declaration does not declare anything [-fpermissive]
    5 | #define lint long long;
      |                   ^~~~
a.cc:35:3: note: in expansion of macro 'lint'
   35 |   lint ans
      |   ^~~~
a.cc:35:8: error: 'ans' was not declared in this scope; did you mean 'abs'?
   35 |   lint ans
      |        ^~~
      |        abs
a.cc:38:12: error: 'h' was not declared in this scope
   38 |     cin >> h[i];
      |            ^
a.cc:42:5: error: 'dp' was not declared in this scope
   42 |     dp[i] = INF;
      |     ^~
a.cc:42:13: error: 'INF' was not declared in this scope
   42 |     dp[i] = INF;
      |             ^~~
a.cc:45:11: error: 'dp' was not declared in this scope
   45 |     chmin(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
      |           ^~
a.cc:45:34: error: 'h' was not declared in this scope
   45 |     chmin(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
      |                                  ^
a.cc:50:9: error: 'dp' was not declared in this scope
   50 |   ans = dp[n - 1];
      |         ^~
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b){if(a<b) {a=b; return 1;} return 0; }
template<class T> inline bool chmin(T& a, T b){if(a>b) {a=b; return 1;} return 0; }
const ll INF = 100100100;

int main(){
    ll N;
	cin>>N;
	vll h(N),dp(N,INF);
	REP(i,N) {
		cin>>h[i];
	}
	
	dp[0]=0;
	
	FOR(i,1,N){
		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:13:9: error: 'vll' was not declared in this scope; did you mean 'll'?
   13 |         vll h(N),dp(N,INF);
      |         ^~~
      |         ll
a.cc:15:22: error: 'h' was not declared in this scope
   15 |                 cin>>h[i];
      |                      ^
a.cc:18:9: error: 'dp' was not declared in this scope; did you mean 'dup'?
   18 |         dp[0]=0;
      |         ^~
      |         dup
a.cc:21:43: error: 'h' was not declared in this scope
   21 |                 chmin(dp[i],dp[i-1] + abs(h[i]-h[i-1]));
      |                                           ^
Language: C++

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

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

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:28: error: expected ';' before '}' token
   10 |                 cin>>arr[i]
      |                            ^
      |                            ;
   11 |         }
      |         ~                   
a.cc:12:9: error: 'll' was not declared in this scope
   12 |         ll mi=0;
      |         ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll sum=0,n;
ll dp[100];
vector<ll> sl;
ll func(ll a[],int i){
	if(dp[i]!=-1)
		return dp[i];
	if(i>n-2)
		return 0;
	dp[i]=min(abs(a[i]-a[i+1])+func(a,i+1),abs(a[i]-a[i+2])+func(a,i+2));
	return dp[i];

}

main()
{
	ll a[100]={0};
	memset(dp,-1,sizeof(dp));
	cin>>n;
	for(ll i=0;i<n;i++)
	cin>>a[i];
if(n==1){
	cout<<dp[0];
	return;
}
if(n==2)
{
	cout<<abs(dp[1]-dp[0]);
	return;
}

	cout<<min(abs(a[0]-a[1])+func(a,1),abs(a[0]-a[2])+func(a,2));
	
}

Compiler output:
a.cc:17:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   17 | main()
      | ^~~~
a.cc: In function 'int main()':
a.cc:26:9: error: return-statement with no value, in function returning 'int' [-fpermissive]
   26 |         return;
      |         ^~~~~~
a.cc:31:9: error: return-statement with no value, in function returning 'int' [-fpermissive]
   31 |         return;
      |         ^~~~~~
Language: Java

import java.util.Scanner;

public class A_Flog1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

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

        int[] dp = createArray(n, Integer.MAX_VALUE);
        dp[0] = 0;
        for (int i = 1; i < n; i++) {
            dp[i] = dp[i -1] + Math.abs(h[i] - h[i - 1]);
            if (i > 1) {
                dp[i] = Math.min(dp[i], dp[i -2] + Math.abs(h[i] - h[i -2]));
            }
        }

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

    private static int[] createArray(int size, int defaultValue) {
        int[] array = new int[size];
        for (int i = 0; i < size; i++) {
            array[i] = defaultValue;
        }
        return array;
    }
}


Compiler output:
Main.java:3: error: class A_Flog1 is public, should be declared in a file named A_Flog1.java
public class A_Flog1 {
       ^
1 error