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

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


Compiler output:
a.cc: In function 'int dp(int, int*)':
a.cc:9:16: error: invalid types 'int(int, int*)[int*]' for array subscript
    9 |   return min(dp[n-1,h]+abs(h[n]-h[n-1]),dp[n-2,h]+abs(h[n]-h[n-2]));
      |                ^
a.cc:9:43: error: invalid types 'int(int, int*)[int*]' for array subscript
    9 |   return min(dp[n-1,h]+abs(h[n]-h[n-1]),dp[n-2,h]+abs(h[n]-h[n-2]));
      |                                           ^
Language: C++

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


Compiler output:
a.cc: In function 'int dp(int, int*)':
a.cc:6:16: error: 'd' was not declared in this scope
    6 |     return abs(d[n]-d[n-1]);
      |                ^
a.cc:9:16: error: invalid types 'int(int, int*)[int*]' for array subscript
    9 |   return min(dp[n-1,h]+abs(h[n]-h[n-1]),dp[n-2,h]+abs(h[n]-h[n-2]));
      |                ^
a.cc:9:43: error: invalid types 'int(int, int*)[int*]' for array subscript
    9 |   return min(dp[n-1,h]+abs(h[n]-h[n-1]),dp[n-2,h]+abs(h[n]-h[n-2]));
      |                                           ^
Language: C++

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


Compiler output:
a.cc: In function 'int main()':
a.cc:14:28: error: expected primary-expression before '>' token
   14 |       abs(h[i]-h[i-1])>abs(>h[i]-h[i-2])?d[i]=abs(h[i]-h[i-1]):d[i]=abs(>h[i]-h[i-2]);
      |                            ^
a.cc:14:73: error: expected primary-expression before '>' token
   14 |       abs(h[i]-h[i-1])>abs(>h[i]-h[i-2])?d[i]=abs(h[i]-h[i-1]):d[i]=abs(>h[i]-h[i-2]);
      |                                                                         ^
Language: C

#include<Stdio.h>
int main()
{
  long long int N;
  scanf("%lld\n",&N);
  long long int a[N+1],dp[N+1];
  for(long long int i=1;i<N;i++)
    scanf("%lld ",&a[i]);
  dp[0] = 0;
  dp[1] = 0;
  for(long long int k=2;k<=N;k++)
    dp[i] = min(dp[i-2]+abs(a[i]-a[i-2],dp[i-1]+abs(a[i]-a[i-1]);
  printf("%lld\n",dp[N]);
 }

Compiler output:
main.c:1:9: fatal error: Stdio.h: No such file or directory
    1 | #include<Stdio.h>
      |         ^~~~~~~~~
compilation terminated.
Language: Java

import java.util.Scanner;

public class TaskA {
    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[] dp = new int[n];
        dp[0] = 0;
        dp[1] = Math.abs(stones[1] - stones[0]);
        for (int i = 2; i < stones.length; i++) {
            dp[i] = Math.min(dp[i - 1] + Math.abs(stones[i] - stones[i - 1]), dp[i - 2] + Math.abs(stones[i] - stones[i - 2]));
        }
        System.out.println(dp[n - 1]);
    }
}


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

 public static int solution(int[] stones) {
        int n = stones.length;
        if (n == 0) return 0;
        int[] dp = new int[n];
        dp[0] = 0;
        dp[1] = Math.abs(stones[1] - stones[0]);
        for (int i = 2; i < stones.length; i++) {
            dp[i] = Math.min(dp[i - 1] + Math.abs(stones[i] - stones[i - 1]), dp[i - 2] + Math.abs(stones[i] - stones[i - 2]));
        }
        return dp[n - 1];
    }

Compiler output:
Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
 public static int solution(int[] stones) {
               ^
  (use --enable-preview to enable unnamed classes)
1 error
Language: Java

public class Solutino {

    public static int solution(int[] stones) {
        int n = stones.length;
        if (n == 0) return 0;
        int[] dp = new int[n];
        dp[0] = 0;
        dp[1] = Math.abs(stones[1] - stones[0]);
        for (int i = 2; i < stones.length; i++) {
            dp[i] = Math.min(dp[i - 1] + Math.abs(stones[i] - stones[i - 1]), dp[i - 2] + Math.abs(stones[i] - stones[i - 2]));
        }
        return dp[n - 1];
    }

}


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

include <bits/stdc++.h>

using namespace std;

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

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

#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
int f[MAXN];
int a[MAXN];
int N;
int main()
{
  	cin >> N;
	for (int i = 1; i <= N; i++)
    	cin >> a[i];
  	f[1] = 0;
  	f[2] = abs(a[2] - a[1])
    for (int i = 3; i <= N; i++)
    	f[i] = min(f[i - 1] + abs(a[i] - a[i - 1]), f[i - 2] + abs(a[i] - a[i - 2]));
  	cout << f[N] << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:32: error: expected ';' before 'for'
   13 |         f[2] = abs(a[2] - a[1])
      |                                ^
      |                                ;
   14 |     for (int i = 3; i <= N; i++)
      |     ~~~                         
a.cc:14:21: error: 'i' was not declared in this scope
   14 |     for (int i = 3; i <= N; i++)
      |                     ^
Language: C++

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

int count(int n,vector<int> &a)
{
  int i;
  vector<int>dp;
  dp[1]=0;
  dp[2]=abs(a[2]-a[1]);
  if(n>2)
  {
    for(i=3;i<=n;i++)
    dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
  }
   return dp[n];                       
}
int main()
{
  int n,k,i;
  cin>>n;A
  vector<int>a(n);
  for(i=1;i<=n;i++)
    cin>>a[i];
  k=count(n,a);
  cout<<k<<endl;
}
  	

Compiler output:
a.cc: In function 'int main()':
a.cc:20:10: error: 'A' was not declared in this scope
   20 |   cin>>n;A
      |          ^
a.cc:23:10: error: 'a' was not declared in this scope
   23 |     cin>>a[i];
      |          ^
a.cc:24:13: error: 'a' was not declared in this scope
   24 |   k=count(n,a);
      |             ^
Language: C++

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

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

Compiler output:
a.cc: In function 'int count(int, std::vector<int>&)':
a.cc:11:18: error: 'ai' was not declared in this scope; did you mean 'i'?
   11 |     dp[i]=min(dp[ai-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
      |                  ^~
      |                  i
Language: C++

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

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

Compiler output:
a.cc: In function 'int count(int, std::vector<int>&)':
a.cc:10:16: error: expected primary-expression before ';' token
   10 |   for(i=n-1;i>=;i--)
      |                ^
Language: C++

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

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

Compiler output:
a.cc:4:11: error: 'n' was not declared in this scope; did you mean 'yn'?
    4 | int count(n,vector<int> &a)
      |           ^
      |           yn
a.cc:4:25: error: expected primary-expression before '&' token
    4 | int count(n,vector<int> &a)
      |                         ^
a.cc:4:26: error: 'a' was not declared in this scope
    4 | int count(n,vector<int> &a)
      |                          ^
a.cc:4:27: error: expression list treated as compound expression in initializer [-fpermissive]
    4 | int count(n,vector<int> &a)
      |                           ^
a.cc: In function 'int main()':
a.cc:21:5: error: reference to 'count' is ambiguous
   21 |   k=count(n,a);
      |     ^~~~~
In file included from /usr/include/c++/14/algorithm:86,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:4025:5: note:                 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4025 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
a.cc:4:5: note:                 'int count'
    4 | int count(n,vector<int> &a)
      |     ^~~~~
Language: C++

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

int count(long long n,vector<int> &a)
{
  int i;
  vector<int>dp;
  dp[0]=0;
  dp[1]=a[1]-a[0];
  for(i=2;i<n;i++)
    dp[i]=min(dp[i-1]+abs(a[i]-a[i-1],dp[i-2]+abs(a[i]-a[i-2]);
   return dp[n-1];                       
}
int main()
{
  long long n,k,i,m,j;
  cin>>n;
  vector<int>a(n);
  for(i=0;i<n;i++)
    cin>>a[i];
  k=count(n,a);
  cout<<k<<endl;
}
  	

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

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

int count(long long n,vector<int> &a)
{
  dp[0]=0;
  dp[1]=a[1]-a[0];
  for(i=2;i<n;i++)
    dp[i]=min(dp[i-1]+abs(a[i]-a[i-1],dp[i-2]+abs(a[i]-a[i-2]);
   return dp[n-1];                       
}
int main()
{
  long long n,k,i,m,j;
  cin>>n;
  vector<int>a(n);
  for(i=0;i<n;i++)
    cin>>a[i];
  k=count(n,a);
  cout<<k<<endl;
}
  	

Compiler output:
a.cc: In function 'int count(long long int, std::vector<int>&)':
a.cc:6:3: error: 'dp' was not declared in this scope; did you mean 'dup'?
    6 |   dp[0]=0;
      |   ^~
      |   dup
a.cc:8:7: error: 'i' was not declared in this scope
    8 |   for(i=2;i<n;i++)
      |       ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n,i;
  cin>>n;
  int ar[n];
  for(i=0;i<n;i++) cin>>ar[i];
  
  int c=0;
  for(i=0;i<n;i++)

  {
     if(abs(ar[i+1]-ar[i])>abs(ar[i+2]-ar[i])){
       c+=abs(ar[i+1]-ar[i])
              
              }
    else {c+=abs(ar[i+2]-ar[i]);
          ++i;
         }
  }
  cout<<c;
                       return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:29: error: expected ';' before '}' token
   15 |        c+=abs(ar[i+1]-ar[i])
      |                             ^
      |                             ;
   16 | 
   17 |               }
      |               ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n,i
  cin>>n;
  int ar[n];
  for(i=0;i<n;i++) cin>>ar[i];
  
  int c=0;
  for(i=0;i<n;i++)

  {
     if(abs(ar[i+1]-ar[i])>abs(ar[i+2]-ar[i])){
       c+=abs(ar[i+1]-ar[i])
              
              }
    else {c+=abs(ar[i+2]-ar[i]);
          ++i;
         }
  }
  cout<<c;
                       return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: expected initializer before 'cin'
    6 |   cin>>n;
      |   ^~~
a.cc:8:7: error: 'i' was not declared in this scope
    8 |   for(i=0;i<n;i++) cin>>ar[i];
      |       ^
a.cc:11:7: error: 'i' was not declared in this scope
   11 |   for(i=0;i<n;i++)
      |       ^
Language: C++

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

#define INF 0x3f3f3f3f
#define MAXN 100010
#define endl "\n"
#define abs(a, b) ((a > b) ? a-b : b-a)

/* End */

int n;
ll a[MAXN];
ll pd[3];

int main() {
	cin.tie(NULL);
	ios_base::sync_with_stdio(false);
	
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i];

	int m = 0;
	pd[(m-1)%3] = 0;
	for (int i = n-2; i >= 0; i--) {
		if (i < n-2) pd[m] = min(pd[(m+1)%3] + abs(a[i], a[i+1]),
              	            	         pd[(m+2)%3] + abs(a[i], a[i+2]));
		else pd[m] = abs(a[i], a[i+1]);
		m = (m == 0) ? 2 : m-1;
	}

	cout << pd[(m+1)%3] << endl;

	return 0;
}


Compiler output:
a.cc:12:1: error: 'll' does not name a type
   12 | ll a[MAXN];
      | ^~
a.cc:13:1: error: 'll' does not name a type
   13 | ll pd[3];
      | ^~
a.cc: In function 'int main()':
a.cc:20:43: error: 'a' was not declared in this scope
   20 |         for(int i = 0; i < n; i++) cin >> a[i];
      |                                           ^
a.cc:23:9: error: 'pd' was not declared in this scope
   23 |         pd[(m-1)%3] = 0;
      |         ^~
a.cc:25:60: error: 'a' was not declared in this scope
   25 |                 if (i < n-2) pd[m] = min(pd[(m+1)%3] + abs(a[i], a[i+1]),
      |                                                            ^
a.cc:7:21: note: in definition of macro 'abs'
    7 | #define abs(a, b) ((a > b) ? a-b : b-a)
      |                     ^
a.cc:27:34: error: 'a' was not declared in this scope
   27 |                 else pd[m] = abs(a[i], a[i+1]);
      |                                  ^
a.cc:7:21: note: in definition of macro 'abs'
    7 | #define abs(a, b) ((a > b) ? a-b : b-a)
      |                     ^
Language: Java

class Main{
	public static void main(String[] args) {
		Scanner s=new Scanner(System.in);
		int size=Integer.parseInt(s.next());
		int[] heights=new int[size];
		for(int i=0;i<size;i++)
		{
			heights[i]=(s.nextInt());
		}
        int[] dp=new int[heights.length];
  dp[0]=0;dp[1]=Math.abs(heights[1]-heights[0]);
  for(int i=2;i<heights.length;i++)
  {
    dp[i]=Math.min(dp[i-1]+Math.abs(heights[i]-heights[i-1]),
                   dp[i-2]+Math.abs(heights[i]-heights[i-2]));
  }
   int ans=dp[dp.length-1];
		System.out.println(ans);
		s.close();
	}
}

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


	public static void main(String[] args) {
		Scanner s=new Scanner(System.in);
		int size=Integer.parseInt(s.next());
		int[] heights=new int[size];
		for(int i=0;i<size;i++)
		{
			heights[i]=(s.nextInt());
		}
        int[] dp=new int[heights.length];
  dp[0]=0;dp[1]=Math.abs(heights[1]-heights[0]);
  for(int i=2;i<heights.length;i++)
  {
    dp[i]=Math.min(dp[i-1]+Math.abs(heights[i]-heights[i-1]),
                   dp[i-2]+Math.abs(heights[i]-heights[i-2]));
  }
   int ans=dp[dp.length-1];
		System.out.println(ans);
		s.close();
	}


Compiler output:
Main.java:2: 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: Java



public int minCost(int[] heights)
{
  int[] dp=new int[heights.length];
  dp[0]=0;dp[1]=Math.abs(heights[1]-heights[0]);
  for(int i=2;i<heights.length;i++)
  {
    dp[i]=Math.min(dp[i-1]+Math.abs(heights[i]-heights[i-1]),
                   dp[i-2]+Math.abs(heights[i]-heights[i-2]));
  }
  return dp[dp.length-1];
}
	public static void main(String[] args) {
		Scanner s=new Scanner(System.in);
		int size=Integer.parseInt(s.next());
		int[] h=new int[size];
		for(int i=0;i<size;i++)
		{
			h[i]=(s.nextInt());
		}
		System.out.println(new Main().minCost(h));
		s.close();
	}

Compiler output:
Main.java:3: error: unnamed classes are a preview feature and are disabled by default.
public int minCost(int[] heights)
       ^
  (use --enable-preview to enable unnamed classes)
1 error
Language: C++

#include<bits/stdc++.h>
#define int long long

int n;
int dp[100001];
bool v[100001];
vector<int> h;

int s1(int i)
{
    if(i==n)
        return 0;
    if(i==n-1)
        return abs(h[i]-h[i+1]);
    if(v[i])
        return dp[i];
    v[i] = 1;
    return dp[i] = min(abs(h[i]-h[i+1])+s1(i+1),abs(h[i]-h[i+2])+s1(i+2));
}

void solve()
{
    cin >> n;
    h.resize(n+1);
    for(int i=1; i<n+1; i++){
    	cin>>h[i];
    }

    cout << s1(1) << endl;
}
 
signed main()
{
    int t = 1;
    //cin >> t;
    while(t--)
        solve();
}


Compiler output:
a.cc:7:1: error: 'vector' does not name a type
    7 | vector<int> h;
      | ^~~~~~
a.cc: In function 'long long int s1(long long int)':
a.cc:14:20: error: 'h' was not declared in this scope
   14 |         return abs(h[i]-h[i+1]);
      |                    ^
a.cc:18:28: error: 'h' was not declared in this scope
   18 |     return dp[i] = min(abs(h[i]-h[i+1])+s1(i+1),abs(h[i]-h[i+2])+s1(i+2));
      |                            ^
a.cc:18:20: error: 'min' was not declared in this scope; did you mean 'std::min'?
   18 |     return dp[i] = min(abs(h[i]-h[i+1])+s1(i+1),abs(h[i]-h[i+2])+s1(i+2));
      |                    ^~~
      |                    std::min
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc: In function 'void solve()':
a.cc:23:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   23 |     cin >> n;
      |     ^~~
      |     std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:24:5: error: 'h' was not declared in this scope
   24 |     h.resize(n+1);
      |     ^
a.cc:29:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   29 |     cout << s1(1) << endl;
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:29:22: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   29 |     cout << s1(1) << endl;
      |                      ^~~~
      |                      std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include<bits/stdc++.h>
#define int long long

int n;
int dp[100001];
bool v[100001];
vector<int> h;

int s1(int i)
{
    if(i==n)
        return 0;
    if(i==n-1)
        return abs(h[i]-h[i+1]);
    if(v[i])
        return dp[i];
    v[i] = 1;
    return dp[i] = min(abs(h[i]-h[i+1])+s1(i+1),abs(h[i]-h[i+2])+s1(i+2));
}

void solve()
{
    cin >> n;
    h.resize(n+1);
    for(int i=1; i<n+1; i++){
    	cin>>h[i];
    }

    cout << s1(1) << endl;
}
 
signed main()
{
    speed;
    int t = 1;
    //cin >> t;
    while(t--)
        solve();
}


Compiler output:
a.cc:7:1: error: 'vector' does not name a type
    7 | vector<int> h;
      | ^~~~~~
a.cc: In function 'long long int s1(long long int)':
a.cc:14:20: error: 'h' was not declared in this scope
   14 |         return abs(h[i]-h[i+1]);
      |                    ^
a.cc:18:28: error: 'h' was not declared in this scope
   18 |     return dp[i] = min(abs(h[i]-h[i+1])+s1(i+1),abs(h[i]-h[i+2])+s1(i+2));
      |                            ^
a.cc:18:20: error: 'min' was not declared in this scope; did you mean 'std::min'?
   18 |     return dp[i] = min(abs(h[i]-h[i+1])+s1(i+1),abs(h[i]-h[i+2])+s1(i+2));
      |                    ^~~
      |                    std::min
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc: In function 'void solve()':
a.cc:23:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   23 |     cin >> n;
      |     ^~~
      |     std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:24:5: error: 'h' was not declared in this scope
   24 |     h.resize(n+1);
      |     ^
a.cc:29:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   29 |     cout << s1(1) << endl;
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:29:22: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   29 |     cout << s1(1) << endl;
      |                      ^~~~
      |                      std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc: In function 'int main()':
a.cc:34:5: error: 'speed' was not declared in this scope
   34 |     speed;
      |     ^~~~~
Language: C++

#include<iostream>
#include<vector>
using namespace std;
int abs(int a){
    if(a<0){
        return -a;
    }
    else{
        return a;
    }
}
int minJ(int N,vector<int> costL){
    if(N==1){
        return 0;
    }
    else if(N==2){
        return abs(costL[1]-costL[0]);
    }
    int result;
    result=minJ(N-1,costL)+abs(costL[N-1]-costL[N-2]);
    res=minJ(N-2,costL)+abs(costL[N-1]-costL[N-3]);
    if(res<result){
        return res;
    }
    else{
        return result;
    }
}
int main(){
    int n;
    cin>>n;
    vector<int> costL;
    for(int i=0;i<n;i++){
        int x;cin>>x;
        costL.push_back(x);
    }
    cout<<minJ(n,costL);
}


Compiler output:
a.cc: In function 'int minJ(int, std::vector<int>)':
a.cc:21:5: error: 'res' was not declared in this scope
   21 |     res=minJ(N-2,costL)+abs(costL[N-1]-costL[N-3]);
      |     ^~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
int main(){
  int n;
  cin >> n;
  vector<int> heights;
  for(int i = 0; i < n; i++){
    int temp;
    cin >> temp;
    heights.push_back(temp);
  }
  int dp[n];
  dp[0] = 0;
  dp[1] = max(heights[1] - heights[0], heights[0] - heights[1]);
  for(int i = 2; i < n; i++){
    dp[i] = max(dp[i - 1] + max(heights[i] - heights[i - 1], heights[i - 1], heights[i]), dp[i - 2] + max(heights[i] - heights[i-2], heights[i-2] - heights[i]));
  }
                cout << dp[n - 1] << endl;
}

Compiler output:
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:19:32:   required from here
   19 |     dp[i] = max(dp[i - 1] + max(heights[i] - heights[i - 1], heights[i - 1], heights[i]), dp[i - 2] + max(heights[i] - heights[i-2], heights[i-2] - heights[i]));
      |                             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:19:160: error: expected ')' before ';' token
   19 |     dp[i] = max(dp[i - 1] + max(heights[i] - heights[i - 1], heights[i - 1], heights[i]), dp[i - 2] + max(heights[i] - heights[i-2], heights[i-2] - heights[i]);
      |                ~                                                                                                                                               ^
      |                                                                                                                                                                )
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:19:32:   required from here
   19 |     dp[i] = max(dp[i - 1] + max(heights[i] - heights[i - 1], heights[i - 1], heights[i]), dp[i - 2] + max(heights[i] - heights[i-2], heights[i-2] - heights[i]);
      |                             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: C++


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

int main() {
    int N_given;
    cin >> N_given;
    int H_given[N_given];
    rep(i,N_given){
        cin >> H_given[i];
    }
    
    int dp[N_given];
    
    dp[0] = 0;
    rep(i,N_given-1){
        if(i != 0){
            dp[i+1] = min(dp[i]+H_given[i+1]-H_given[i],dp[i-1]+H_given[i+1]-H_given[i-1]);
        }else{
            dp[1] = dp[0] + H_given[1] - H_given[0];
        }
    }
    
    print(dp[N_given-1]);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:5: error: 'print' was not declared in this scope; did you mean 'rint'?
   26 |     print(dp[N_given-1]);
      |     ^~~~~
      |     rint
Language: C++


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

int main() {
    int N_given;
    cin >> N_given;
    int H_given[N_given]
    rep(i,N_given){
        cin >> H_given[i];
    }
    
    int dp[N_given];
    
    dp[0] = 0;
    rep(i,N_given-1){
        if(i != 0){
            dp[i+1] = min(dp[i]+H_given[i+1]-H_given[i],dp[i-1]+H_given[i+1]-H_given[i-1]);
        }else{
            dp[1] = dp[0] + H_given[1] - H_given[0];
        }
    }
    
    print(dp[N_given-1]);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:4:19: error: expected initializer before 'for'
    4 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                   ^~~
a.cc:11:5: note: in expansion of macro 'rep'
   11 |     rep(i,N_given){
      |     ^~~
a.cc:11:9: error: 'i' was not declared in this scope
   11 |     rep(i,N_given){
      |         ^
a.cc:4:35: note: in definition of macro 'rep'
    4 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                                   ^
a.cc:20:33: error: 'H_given' was not declared in this scope; did you mean 'N_given'?
   20 |             dp[i+1] = min(dp[i]+H_given[i+1]-H_given[i],dp[i-1]+H_given[i+1]-H_given[i-1]);
      |                                 ^~~~~~~
      |                                 N_given
a.cc:22:29: error: 'H_given' was not declared in this scope; did you mean 'N_given'?
   22 |             dp[1] = dp[0] + H_given[1] - H_given[0];
      |                             ^~~~~~~
      |                             N_given
a.cc:26:5: error: 'print' was not declared in this scope; did you mean 'rint'?
   26 |     print(dp[N_given-1]);
      |     ^~~~~
      |     rint
Language: C++

#include<bits/stdc++.h>
using namespace std;
int dp[100005];
int main()
{
  int n;
  cin>>n;
  
  int arr[n+1];
  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]=min(dp[i-1]+(arr[i]-arr[i-1]),dp[i-2]+(arr[i]-arr[i-2]))
    
   cout<<dp[n-1];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:67: error: expected ';' before 'cout'
   16 |     dp[i]=min(dp[i-1]+(arr[i]-arr[i-1]),dp[i-2]+(arr[i]-arr[i-2]))
      |                                                                   ^
      |                                                                   ;
   17 | 
   18 |    cout<<dp[n-1];
      |    ~~~~
Language: C++

#include<bits/stdc++.h> 
using namespace std;
 
int main()
{
  int i,j,n,p,x=0,k;
  cin>>n;
  cin>>p;
  int w[n],v[n],,y[n;
  for(i=0;i<n;i++)
  {
    cin>>w[i];
    cin>>v[i];
  }
  j=0;
  while(j!=n)
  {
    if(w[j]>p)
      j++;
    else
      break;
  }
  for(i=j;i<n;i++)
  {
    x=x+w[i];
    if(x<=p)
    {
      if(i>0)
      	y[i]=y[i-1]+v[i];
      else
       	y[i]=v[0];
    }
    else
    {
      for(k=j;k<i;k++)
      {
        if(v[i]>v[k] && w[i]<w[k])
          y[i]=y[i-1]-v[k]+v[i];
        swap(w[i],w[k]);
        swap(v[i],v[k]);
      }
    }
  }
    cout<<y[n-1]<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:17: error: expected unqualified-id before ',' token
    9 |   int w[n],v[n],,y[n;
      |                 ^
a.cc:9:21: error: expected ']' before ';' token
    9 |   int w[n],v[n],,y[n;
      |                     ^
      |                     ]
a.cc:29:9: error: 'y' was not declared in this scope
   29 |         y[i]=y[i-1]+v[i];
      |         ^
a.cc:31:9: error: 'y' was not declared in this scope
   31 |         y[i]=v[0];
      |         ^
a.cc:38:11: error: 'y' was not declared in this scope
   38 |           y[i]=y[i-1]-v[k]+v[i];
      |           ^
a.cc:44:11: error: 'y' was not declared in this scope
   44 |     cout<<y[n-1]<<endl;
      |           ^
Language: C++

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

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

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      	int n=sc.nextInt();
		int[] hight=new int[n];
      	for (int i=0;i<n;i++) {
          hight[i]=sc.nextInt();
        }
      	int[] dp=new int[n];
      	Arrays.fill(dp,Integer.MAX_VALUE);
      	dp[0]=0; 
      	for (int i=1;i<n;i++) {
        	if (i==1) dp[i]=Math.abs(hight[i]-hight[i-1]);
          	else {
              dp[i]=Math.min(dp[i-2]+Math.abs(hight[i]-hight[i-2]),dp[i-1]+Math.abs(hight[i]-hight[i-1]));
            }
        }
        System.out.println(dp[n-1]);
	}
}


Compiler output:
Main.java:3: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:3: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
Main.java:10: error: cannot find symbol
      	Arrays.fill(dp,Integer.MAX_VALUE);
      	^
  symbol:   variable Arrays
  location: class Main
3 errors
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      	int n=sc.nextInt();
		int[] hight=new int[n];
      	for (int i=0;i<n;i++) {
          hight[i]=sc.nextInt();
        }
      	int[] dp=new int[n];
      	Arrays.fill(dp,Integer.MAX_VALUE);
      	dp[0]=0; 
      	for (int i=1;i<n;i++} {
        	if (i==1) dp[i]=Math.abs(hight[i]-hight[i-1]);
          	else {
              dp[i]=Math.min(dp[i-2]+Math.abs(hight[i]-hight[i-2]),dp[i-1]+Math.abs(hight[i]-hight[i-1]));
            }
        }
        System.out.println(dp[n-1]);
	}
}

Compiler output:
Main.java:13: error: ')' expected
      	for (int i=1;i<n;i++} {
      	                    ^
Main.java:19: error: <identifier> expected
        System.out.println(dp[n-1]);
                          ^
Main.java:19: error: ']' expected
        System.out.println(dp[n-1]);
                              ^
Main.java:19: error: ',', ')', or '[' expected
        System.out.println(dp[n-1]);
                               ^
Main.java:21: error: class, interface, enum, or record expected
}
^
5 errors
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:8:16: error: 'i' was not declared in this scope; did you mean 'i1'?
    8 |         cin>>a[i];
      |                ^
      |                i1
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intput(i) cout << i << endl
#define ll long long
#define stringput(s) cout << (string)(s) << endl

int main(){
   int N;
    cin >> N;
    vector<int> a(N);
    dp[1] = 0;
    rep(i,N) cin >> a[i];
    if(N == 2) dp[N] = abs(a[1]-a[0]);
    else{
        dp[2] = abs(a[1]-a[0]);
        for(int i = 2;i<N;i++){
            dp[i+1] = min(dp[i]+abs(a[i]-a[i-1]), dp[i-1]+abs(a[i]-a[i-2]));
            
        }
    }
    cout << dp[N] << endl;
}

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

#include <bits/stdc++.h>
using namespace std;
const long long m = 1e9+7;
long long int n, total, w[m], v[m], dp[m][m];
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie();
    cout.tie();
    cin >> n >> total;
    for(long long int i=1;i<=n;i++){
        cin >> w[i] >> v[i];
    }
    memset(dp, 0, sizeof(dp));
    for(long long int i=1;i<=n;i++){
        for(long long int j=1;j<=total;j++){
            long long int best=dp[i-1][j];
            if(j>=w[i]){
                best=max(best, dp[i-1][j-w[i]]+v[i]);
            }
            dp[i][j]=best;
        }
    }
    cout << dp[n][total] << endl;
}

Compiler output:
/tmp/ccoI02B4.o: in function `main':
a.cc:(.text+0xa2): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccoI02B4.o
a.cc:(.text+0xdb): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccoI02B4.o
a.cc:(.text+0x122): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccoI02B4.o
a.cc:(.text+0x186): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccoI02B4.o
a.cc:(.text+0x19d): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccoI02B4.o
a.cc:(.text+0x1e7): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccoI02B4.o
a.cc:(.text+0x23e): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccoI02B4.o
collect2: error: ld returned 1 exit status
Language: C++

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

int main() {
  int n;
  cin>>n;
  int arr[n];
  int t[n][n] = {-1};
  for (int i = 0 ; i <= n ; i++) {
    cin >> arr[i];
    if (i > 0)
      t[i-1][i] = abs(arr[i] - arr[i-1]);
    else if (i > 1)
      t[i-2][i] = abs(arr[i] - arr[i-2]);
   }
   int j = 3;
   int ii, jj;
   ii = 0;
   jj = j;
   while (j != n) {
      int min = 10001
      for (int x = ii+1 ; x < jj ; x++) {
         if ((t[ii][x] + t[x][jj]) < min) {
            min = t[ii][x] + t[x][jj];
         }
      }
      t[ii][jj] = min;
      if (jj == n-1) {
         j++;
         ii = 0;
         jj = j;
      } else {
         ii++;
         jj++;
      }
   }
   cout << t[0][n-1];
   return 0;
}

Compiler output:
a.cc:1:24: error: missing terminating > character
    1 | #include <bits/stdc++.h
      |                        ^
a.cc: In function 'int main()':
a.cc:22:7: error: expected ',' or ';' before 'for'
   22 |       for (int x = ii+1 ; x < jj ; x++) {
      |       ^~~
a.cc:22:27: error: 'x' was not declared in this scope
   22 |       for (int x = ii+1 ; x < jj ; x++) {
      |                           ^
Language: C++

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

Compiler output:
a.cc:1:1: error: 'clude' does not name a type
    1 | clude<bits/stdc++.h>
      | ^~~~~
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:8:2: error: 'vector' was not declared in this scope
    8 |  vector <int > h(n);
      |  ^~~~~~
a.cc:8:10: error: expected primary-expression before 'int'
    8 |  vector <int > h(n);
      |          ^~~
a.cc:9:22: error: 'cin' was not declared in this scope
    9 |  for(int i=0;i<n;i++)cin>>h[i];
      |                      ^~~
a.cc:9:27: error: 'h' was not declared in this scope
    9 |  for(int i=0;i<n;i++)cin>>h[i];
      |                           ^
a.cc:10:12: error: expected primary-expression before 'int'
   10 |   vector < int > dp(n,1e7);
      |            ^~~
a.cc:11:3: error: 'dp' was not declared in this scope
   11 |   dp[0]=0;
      |   ^~
a.cc:14:33: error: 'h' was not declared in this scope
   14 |   dp[i+1]=min(dp[i+1],dp[i]+abs(h[i]-h[i+1]));
      |                                 ^
a.cc:14:29: error: 'abs' was not declared in this scope
   14 |   dp[i+1]=min(dp[i+1],dp[i]+abs(h[i]-h[i+1]));
      |                             ^~~
a.cc:14:11: error: 'min' was not declared in this scope; did you mean 'main'?
   14 |   dp[i+1]=min(dp[i+1],dp[i]+abs(h[i]-h[i+1]));
      |           ^~~
      |           main
a.cc:21:3: error: 'cout' was not declared in this scope
   21 |   cout<<dp[n-1];
      |   ^~~~
Language: C++

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

Compiler output:
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:11:3: error: 'dp' was not declared in this scope; did you mean 'dup'?
   11 |   dp[0]=0;
      |   ^~
      |   dup
Language: C++

#include<bits/stdc++.h>
using namespace std;
 
main(){
 
 
int n;
 vector <int > h(n);
 for(int i=0;i<n;i++)cin>>h[i];
  int dp[n];
  dp[0]=0;
  dp[1]=h[1]-h[0];
  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]));
   
  }
  cout<<dp[n-1]
 
 
 
 
 
 
 
 
 
 
}

Compiler output:
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:17:16: error: expected ';' before '}' token
   17 |   cout<<dp[n-1]
      |                ^
      |                ;
......
   28 | }
      | ~
Language: C++

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

main(){


int n;
 vector <int > h(n);
 for(int i=0;i<n;i++)cin>>h[i];
  int dp[n];
  dp[0]=0;
  dp[1]=h[1]-h[0];
  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]));
   
  }
  cout<<dp[i]










}

Compiler output:
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:17:12: error: 'i' was not declared in this scope
   17 |   cout<<dp[i]
      |            ^
Language: C++

#include <bits/stdc++.h>
 
using namespace std;
 
int n;
int k;
int valor[100005];
int  dp[100000];
 
 
int pd(int estou,int vou){
if (estou==n){return 0;}
if (dp[estou] !=-1){return dp[estou];}
 
int pula=abs(valor[estou]-valor[vou])+pd(vou,vou+1);
long long nao_pula=10000000;
if ( vou-estou<=k-1 and k!=1 ){
 nao_pula=pd(estou,vou+1);
}
 
return dp[estou]=min(pula,nao_pula);
}
 
int main (){
ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
 
cin>>n;
cin>>k;
 
for (int i=1;i<=n;i++){
    cin>>valor[i];
}
 
memset(dp,-1,sizeof(dp));
 
cout<<pd(1,2);
 
 
 
}

Compiler output:
a.cc: In function 'int pd(int, int)':
a.cc:21:21: error: no matching function for call to 'min(int&, long long int&)'
   21 | return dp[estou]=min(pula,nao_pula);
      |                  ~~~^~~~~~~~~~~~~~~
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:   template argument deduction/substitution failed:
a.cc:21:21: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   21 | return dp[estou]=min(pula,nao_pula);
      |                  ~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
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:   candidate expects 1 argument, 2 provided
/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:   template argument deduction/substitution failed:
a.cc:21:21: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   21 | return dp[estou]=min(pula,nao_pula);
      |                  ~~~^~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
typedef long long ll;
typedef long l;
typedef pair<int,int> p;
typedef vector<int> ve;
#define pb push_back
#define mp make_pair
#define loop(i,a,b) for(int i=a;i<b;i++)
int height[100001]={};
int cost[100001]={};
int dp(int current,int n)
{
  if(current==n)
    return 0;
  if(cost[current]!=INT_MAX)
    return cost[current];
  if(current+1==n)
  {
    return cost[current]=abs(height[current]-height[current+1]);
  }
  if(current+2<=n)
  {
    return cost[current]=min(abs(height[current]-height[current+1])+dp(current+1,n),abs(height[current]-height[current+2])+dp(current+2,n));
  }
}
int main()
{
  //start here
  int n;
  cin>>n;
  loop(i,1,n+1)
  {
    cin>>height[i];
  }
  fill(dp,dp+N,INT_MAX);
  int ans=dp(1,n);
  cout<<cost[1];
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:14: error: 'N' was not declared in this scope
   37 |   fill(dp,dp+N,INT_MAX);
      |              ^
a.cc: In function 'int dp(int, int)':
a.cc:27:1: warning: control reaches end of non-void function [-Wreturn-type]
   27 | }
      | ^
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'dp' was not declared in this scope; did you mean 'dup'?
   12 |     dp[1] = a[1] - a[0];
      |     ^~
      |     dup