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

#include<stdio.h>
int main()
{
  int n;
  scanf("%d",&n);
  int a[n],i,count=0,percount=0;
  for(i=0;i<n;i++)
  {
  		scanf("%d",&a[i]);
 		if(i>=1&&percount==0)
        {
          	if(a[i]<a[i-1])
            {
              k=a[i-1];
              percount++;
              x=k-a[i];
              count=count+x;
            }
        else if(i>=1&&percount!=0)
        {
          	if(a[i]>=k)
            {
              k=a[i];
            }
          	if(a[i]<k)
            {
              x=a[i]-k;
              count+=x;
            }
        }
   }
    printf("%d",count);
  }

Compiler output:
main.c: In function 'main':
main.c:14:15: error: 'k' undeclared (first use in this function)
   14 |               k=a[i-1];
      |               ^
main.c:14:15: note: each undeclared identifier is reported only once for each function it appears in
main.c:16:15: error: 'x' undeclared (first use in this function)
   16 |               x=k-a[i];
      |               ^
main.c:33:3: error: expected declaration or statement at end of input
   33 |   }
      |   ^
Language: C++

int main(){
long long n,i,t;
 cin>>n;
 vector<long long> v;
 long long sum=0;
 for(i=0;i<n;i++){
    cin>>t;
    v.push_back(t);
 }
 for(i=0;i<n-1;i++){
    if(v[i]>v[i+1]){
        sum=sum+(v[i]-v[i+1])
        v[i]=v[i+1];
    }
 }
 cout<<sum;
   


    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:3:2: error: 'cin' was not declared in this scope
    3 |  cin>>n;
      |  ^~~
a.cc:4:2: error: 'vector' was not declared in this scope
    4 |  vector<long long> v;
      |  ^~~~~~
a.cc:4:9: error: expected primary-expression before 'long'
    4 |  vector<long long> v;
      |         ^~~~
a.cc:8:5: error: 'v' was not declared in this scope
    8 |     v.push_back(t);
      |     ^
a.cc:11:8: error: 'v' was not declared in this scope
   11 |     if(v[i]>v[i+1]){
      |        ^
a.cc:16:2: error: 'cout' was not declared in this scope
   16 |  cout<<sum;
      |  ^~~~
Language: C++

#include<stdio.h>
#include<iostream>
using namespace std;

int main()
{
  int N;
  cin >> N;
  
  int result = 0;
  int maxTall = 0;
  int A;
  
  cin >> maxTall;
  for(int i = 0; i < N -1 ; i++)
  {
    cin >> A;
    if(maxTall > A)
    {
      result += (maxTall - A);
    }
    if(maxTall < A)
    {
      maxTall = A;
    }
  }
  

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

#include<bits/stdc++.h>
using namespace std;
int main()
{long long n,x,t,y,i;
 cin>>n;long long a[n];y=0;
 for(i=0;i<n;i++){cin>>a[i];}x=a[0];
for(i=0;i<n;i++)
{if(a[i]>=x)x=a[i];
else y=y+x-a[i];}
cout<<y;
return 0;}
#include<bits/stdc++.h>
using namespace std;
int main()
{long long n,x,t,y;
 cin>>n;long long a[n];y=0;
 for(i=0;i<n;i++){cin>>a[i];}x=a[0];
for(i=0;i<n;i++)
{if(a[i]>=x)x=a[i];
else y=y+x-a[i];}
cout<<y;
return 0;}


Compiler output:
a.cc:14:5: error: redefinition of 'int main()'
   14 | int main()
      |     ^~~~
a.cc:3:5: note: 'int main()' previously defined here
    3 | int main()
      |     ^~~~
a.cc: In function 'int main()':
a.cc:17:6: error: 'i' was not declared in this scope
   17 |  for(i=0;i<n;i++){cin>>a[i];}x=a[0];
      |      ^
a.cc:18:5: error: 'i' was not declared in this scope
   18 | for(i=0;i<n;i++)
      |     ^
Language: C++

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


int main()
{  int n;
    cin>>n;
    vector <long long> a(n);  int i;
 for(i=0;i<n;i++)
 {  
   cin>>a[i];  
 }
  long long sum=0ll;
  for(i=0;i<n-1;i++)
 {   
    sum+=max(0ll,a[i]-a[i+1]);
    a[i+1]=max(a[i+1],a[i]);
 }
 cout<<sum;
    return 0; 
 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: 'vector' was not declared in this scope
    9 |     vector <long long> a(n);  int i;
      |     ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include <algorithm>
  +++ |+#include <vector>
    3 | using namespace std;
a.cc:9:13: error: expected primary-expression before 'long'
    9 |     vector <long long> a(n);  int i;
      |             ^~~~
a.cc:12:9: error: 'a' was not declared in this scope
   12 |    cin>>a[i];
      |         ^
a.cc:17:18: error: 'a' was not declared in this scope
   17 |     sum+=max(0ll,a[i]-a[i+1]);
      |                  ^
Language: C++

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

int main(){
  int N,sum=0;
  cin >> N;
  vector<int> vec(N);
  for(int i=0;i<N;i++){
    cin >> vec.at(i);
  }
  for(int i=0;i<N-1;i++){
    if(vec.at(i) > vec.at(i+1)){
      sum += vec.at(i+1) - vec.at(i);
      vec.at(i+1) = vec.at(i);
    }
  }
  cout << sum;
  return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
int main()
{long long n,x,t,y;
 cin>>n;long long a[n];y=0;
 for(i=0;i<n;i++){cin>>a[i];}x=a[0];
for(i=0;i<n;i++)
{if(a[i]>=x)x=a[i];
else y=y+x-a[i];}
cout<<y;
return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:6: error: 'i' was not declared in this scope
    6 |  for(i=0;i<n;i++){cin>>a[i];}x=a[0];
      |      ^
a.cc:7:5: error: 'i' was not declared in this scope
    7 | for(i=0;i<n;i++)
      |     ^
Language: Java

import java.util.Scanner;

public class Main2 {

    public static void main(String args []) {

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int[] line = new int[n];
        long sum= 0;

        for (int i = 0; i<n; i++) {

            line[i] = sc.nextInt();
        }

        for (int i = 0; i<n-1; i++) {

            if (line[i] > line[i+1]) {
                int a = line[i] - line[i+1];
                line[i + 1] = line[i];
                sum += a;
            }
        }

        System.out.println(sum);
    }
}


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

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

int main(){
          int sum = 0;
          int n; cin >> n;
          int a[n];
           for(int i=0; i<n; ++i) { cin >> a[i]; }
           for(int i =0; i<n; ++i){
                  if(a[i] >a[i+1) sum += a[i] - a[i-1];
           }
         cout << sum;
       return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:33: error: expected ']' before ')' token
   10 |                   if(a[i] >a[i+1) sum += a[i] - a[i-1];
      |                                 ^
      |                                 ]
Language: C++

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

int main() {
  long long int n;
  cin>>n;
  long long int L=0;
  long long int ans=0;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  for(int i=0;i<n;i++){  
    L=max(L,a[i]);
      if(a[i]<=L){
        ans+=L-a[i];
    }
  }
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:10: error: no matching function for call to 'max(long long int&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   14 |     L=max(L,a[i]);
      |       ~~~^~~~~~~~
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:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:14:10: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   14 |     L=max(L,a[i]);
      |       ~~~^~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303: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:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:14:10: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   14 |     L=max(L,a[i]);
      |       ~~~^~~~~~~~
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
const int N=2e5+10;
int n;
ll a[N];
int main()
{
	cin>>n;
	for(int i=0; i<n; i++) cin>>a[i];
	ll sum=0;
	for(int i=1; i<n; i++)
	{
		if(a[i]<a[i-1])
		{
			sum+=a[i-1]-a[i];
			a[i]=a[i-1];
		}
	}
	cout<<sum;
}

Compiler output:
a.cc:6:1: error: 'll' does not name a type
    6 | ll a[N];
      | ^~
a.cc: In function 'int main()':
a.cc:10:37: error: 'a' was not declared in this scope
   10 |         for(int i=0; i<n; i++) cin>>a[i];
      |                                     ^
a.cc:11:9: error: 'll' was not declared in this scope
   11 |         ll sum=0;
      |         ^~
a.cc:14:20: error: 'a' was not declared in this scope
   14 |                 if(a[i]<a[i-1])
      |                    ^
a.cc:16:25: error: 'sum' was not declared in this scope
   16 |                         sum+=a[i-1]-a[i];
      |                         ^~~
a.cc:20:15: error: 'sum' was not declared in this scope
   20 |         cout<<sum;
      |               ^~~
Language: C++

#include<stdio.h>
int main()
{
  int n;
  scanf("%d",&n);
  int arr[n];
  for(int i=0;i<n;i++)
  {
    scanf("%d",&arr[i]);
  }
  max=arr[0];
  long long int sum=0;
  for(int i=1;i<n;i++)
  {
    if(max>arr[i])
    {
      sum=sum+(max-arr[i]);
    }else{
      max=arr[i];
    }  
  }
  printf("%lld",sum);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:3: error: 'max' was not declared in this scope
   11 |   max=arr[0];
      |   ^~~
Language: C++

#include<bits/stdc++.h>
#define ll long long
 
using namespace std;
 
int main()
{
    ll i,n;
    cin>>n;
    vector<ll> v(n);
    for(i=0;i<n;i++)
    {
             icn>>v[i]    
    }
    ll cnt = 0;
    for(i=1;i<n;i++)
    {
          if(v[i-1]>v[i])
          {
                    cnt = max (cnt,abs(v[i]-v[i-1])+1);
                     
          }     
    } 
    cout<<cnt<<endl;
    return 0; 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:14: error: 'icn' was not declared in this scope
   13 |              icn>>v[i]
      |              ^~~
Language: C++

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

int main() {
  	int N, count, c, d;
  	count = 0;
  	cin >> N;
  	int a[N];
  	for (int i = 0; i < N; i++) cin >> a[i];
  	for (i = 0; i < N-1 ; i++) {
      	c = a[i]
        d = a[i+1]
		while (c > d) {
          	c++;
          	count++;
        }
    cout << count << endl;
}

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

import java.util.Scanner;

public class Main2 {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		String[] tmp = sc.nextLine().split(" ");
		long[] list = new long[n];
		long ans   = 0;


		list[0] = Long.parseLong(tmp[0]);
		for(int i = 1; i < n; i++) {

			list[i] = Long.parseLong(tmp[i]);

			if(list[i - 1] > list[i]) {

				ans += list[i - 1] - list[i];
				list[i] = list[i - 1];

			}
		}

		System.out.println(ans);
	}

}


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

#include<stdio.h>
int main()
{
  int n;
  scanf("%d",&n);
  int arr[n];
  max=arr[0];
  long long int sum=0;
  for(int i=1;i<n;i++)
  {
    if(max>arr[i])
    {
      sum=sum+(max-arr[i]);
    }else{
      max=arr[i];
    }  
  }
  printf("%lld",sum);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'max' was not declared in this scope
    7 |   max=arr[0];
      |   ^~~
Language: Java

import java.util.Scanner;

public class Main {

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

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

		int sum = 0;
		for (int i = 0; i < n - 1; i++) {
			if (intArr[i] > intArr[i + 1]) {
				int max = intArr[i];
				int min = intArr[i - 1];
				intArr[i + 1] = max;
				sum += max - min;
			}
		}

		aSystem.out.println(sum);

	}
}

Compiler output:
Main.java:24: error: package aSystem does not exist
		aSystem.out.println(sum);
		       ^
1 error
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:11:17: error: invalid types 'int[int]' for array subscript
   11 |         cin >> a[0];
      |                 ^
a.cc:14:21: error: invalid types 'int[int]' for array subscript
   14 |             cin >> a[i];
      |                     ^
a.cc:15:18: error: invalid types 'int[int]' for array subscript
   15 |             if (a[i - 1] > a[i])
      |                  ^
a.cc:15:29: error: invalid types 'int[int]' for array subscript
   15 |             if (a[i - 1] > a[i])
      |                             ^
a.cc:17:23: error: invalid types 'int[int]' for array subscript
   17 |                 s += a[i - 1] - a[i];
      |                       ^
a.cc:17:34: error: invalid types 'int[int]' for array subscript
   17 |                 s += a[i - 1] - a[i];
      |                                  ^
a.cc:18:18: error: invalid types 'int[int]' for array subscript
   18 |                 a[i] = a[i - 1];
      |                  ^
a.cc:18:25: error: invalid types 'int[int]' for array subscript
   18 |                 a[i] = a[i - 1];
      |                         ^
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: expected initializer before 'long'
   10 |         long long s = 0;
      |         ^~~~
a.cc:11:16: error: 'a' was not declared in this scope
   11 |         cin >> a[0];
      |                ^
a.cc:17:17: error: 's' was not declared in this scope
   17 |                 s += a[i - 1] - a[i];
      |                 ^
a.cc:21:17: error: 's' was not declared in this scope
   21 |         cout << s;
      |                 ^
Language: Java


import java.io.IOException;
import java.util.Scanner;

public class Test {

	public static void Main(String[] args) throws IOException{

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] A = new int[N];
		for(int i=0; i<N; i++) A[i]=sc.nextInt();



		int old_hight = 0;
		int sum = 0;

		for(int h : A) {
			if(old_hight!=0){
				if(h >= old_hight) {
					old_hight=h;
				}
				else {
					int s = old_hight - h;
					sum = sum + s;
				}
			}
			else {
				old_hight=h;
			}
		}

		System.out.println(sum);

	}
}

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

long long int n,a[200000],k=0,d=0;
cin >> n;
for(int i=0;i<n;i++)
    {
        cin >> a[i];
    }
for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<n;j++)
        if(a[j]<a[i])
            {
                k=k+(a[i]-a[j]);
                 if(j==n-1)
                    {
                        d=1;
                    }
            }
            else
            {
                if(j==n-1)
                    {
                        d=1;
                    }
                break;
            }
            if(d==1)
                {
                    break;
                }
    }
    cout << k;
        return 0;
        
}


Compiler output:
a.cc:2:1: error: 'cin' does not name a type
    2 | cin >> n;
      | ^~~
a.cc:3:1: error: expected unqualified-id before 'for'
    3 | for(int i=0;i<n;i++)
      | ^~~
a.cc:3:13: error: 'i' does not name a type
    3 | for(int i=0;i<n;i++)
      |             ^
a.cc:3:17: error: 'i' does not name a type
    3 | for(int i=0;i<n;i++)
      |                 ^
a.cc:7:1: error: expected unqualified-id before 'for'
    7 | for(int i=0;i<n;i++)
      | ^~~
a.cc:7:13: error: 'i' does not name a type
    7 | for(int i=0;i<n;i++)
      |             ^
a.cc:7:17: error: 'i' does not name a type
    7 | for(int i=0;i<n;i++)
      |                 ^
a.cc:31:5: error: 'cout' does not name a type
   31 |     cout << k;
      |     ^~~~
a.cc:32:9: error: expected unqualified-id before 'return'
   32 |         return 0;
      |         ^~~~~~
a.cc:34:1: error: expected declaration before '}' token
   34 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int k[1005][1005],is[1005][1005];
int main(){
	int a,b,x,y,x1,y1;
	cin>>a>>b>>x>>y>>x1>>y1;
	for(int i=0;i<a;i++)
		for(int j=0;j<b;j++)
			cin>>k[i][j];
	for(int i=0;i<a;i++)
		for(int j=0;j<b;j++)
			is[i][j]=INT_MAX;
	queue<pair<int,int> >q;
	q.qush(make_pair(x,y));
	is[x][y]=0;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:11: error: 'class std::queue<std::pair<int, int> >' has no member named 'qush'; did you mean 'push'?
   14 |         q.qush(make_pair(x,y));
      |           ^~~~
      |           push
Language: C++

#include<iostream>
using namespace std;
int main(){
int n,ans=0;
  int x[n];
  cin >> n;
  for(int i=1;i<n;i++){
  if(n[i]-n[i-1]<0){
  ans=ans+n[i-1]-n[i];
  }
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:7: error: invalid types 'int[int]' for array subscript
    8 |   if(n[i]-n[i-1]<0){
      |       ^
a.cc:8:12: error: invalid types 'int[int]' for array subscript
    8 |   if(n[i]-n[i-1]<0){
      |            ^
a.cc:9:12: error: invalid types 'int[int]' for array subscript
    9 |   ans=ans+n[i-1]-n[i];
      |            ^
a.cc:9:19: error: invalid types 'int[int]' for array subscript
    9 |   ans=ans+n[i-1]-n[i];
      |                   ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int k[1005][1005],is[1005][1005];
int main(){
	int a,b,x,y,x1,y1;
	cin>>a>>b>>x>>y>>x1>>y1;
	for(int i=0;i<a;i++)
		for(int j=0;j<b;j++)
			cin>>k[i][j];
	for(int i=0;i<a;i++)
		for(int j=0;j<b;j++)
			is[i][j]=INT_MAX;
	queue<pair<int,int> >q;
	q.qush(x,y);
	is[x][y]=0;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:11: error: 'class std::queue<std::pair<int, int> >' has no member named 'qush'; did you mean 'push'?
   14 |         q.qush(x,y);
      |           ^~~~
      |           push
Language: C++

# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
#N, K = map(int, input().split())
# 文字列の入力
N = input()
#開業されたN個要素を受け付ける
input_list = list(map(int, input().split()))

i=1

ans = 0

while i < len(input_list):
    if(input_list[i] < input_list[i-1]):
        tmp = input_list[i-1] - input_list[i]
        ans = ans + tmp
        input_list[i] = input_list[i] + 1
    i = i+1

print(ans)


Compiler output:
a.cc:1:3: error: invalid preprocessing directive #-
    1 | # -*- coding: utf-8 -*-
      |   ^
a.cc:2:3: error: invalid preprocessing directive #\U000030b9\U000030da\U000030fc\U000030b9\U0000533a\U00005207\U0000308a\U0000306e\U00006574\U00006570\U0000306e\U00005165\U0000529b
    2 | # スペース区切りの整数の入力
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:3:2: error: invalid preprocessing directive #N
    3 | #N, K = map(int, input().split())
      |  ^
a.cc:4:3: error: invalid preprocessing directive #\U00006587\U00005b57\U00005217\U0000306e\U00005165\U0000529b
    4 | # 文字列の入力
      |   ^~~~~~~~~~~~
a.cc:6:2: error: invalid preprocessing directive #\U0000958b\U0000696d\U00003055\U0000308c\U0000305fN\U0000500b\U00008981\U00007d20\U00003092\U000053d7\U00003051\U00004ed8\U00003051\U0000308b
    6 | #開業されたN個要素を受け付ける
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:5:1: error: 'N' does not name a type
    5 | N = input()
      | ^
Language: C++

#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <cstring>

using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using PP = pair<ll, pair<ll,ll>>;
#define rep(i,n) for (ll i = 0; i < (n); ++i)

ll n, a, t, ans;

int main() {
    cin >> n;
    t = 0;
    ans = 0;
    rep(i,n){
        cin >> a;
        ll add = max(0,t-a);
        t = add+a;
        ans += add;
    }
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:21: error: no matching function for call to 'max(int, ll)'
   24 |         ll add = max(0,t-a);
      |                  ~~~^~~~~~~
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:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:24:21: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   24 |         ll add = max(0,t-a);
      |                  ~~~^~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:5:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:24:21: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   24 |         ll add = max(0,t-a);
      |                  ~~~^~~~~~~
Language: C++

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

using namespace std;
int main(){
  long long n,x=0;
  cin>>n;
  vector<int> a(n);
  
  for(int i=0;i<n;i++){
    cin>>a.at(i);
    //cout<<a[i]<<endl;
    if(i>0){
      if(a.at(i)<=a.at(i-1)){
        x+=a.at(i-1)-a.at(i);
        a[i]=a[i-1];
      }
    }
  }
  cout<<x<<endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:20:17: error: expected '}' at end of input
   20 |   cout<<x<<endl;
      |                 ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

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

int main() {
  int N,sum=0; cin >> N;
  int A[200010];
  for(int i=0; i<N; i++) cin >> A[i];
  for(int i=0; i<N; i++) {
    if(A[i]>A[i+1]) {
      sum += A[i] - A[i+1];
    }
  }
  cout << sum -A[i] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:18: error: 'i' was not declared in this scope
   13 |   cout << sum -A[i] << endl;
      |                  ^
Language: C

#include<stdio.h>

int main(void){
    int N;
    long sum = 0;
    scanf("%d",&N);
    int A[N];
    for(int i = 0; i < N; i++){
        scanf("%d",&A[i]);
    }
    for(int i = 1; i < N; i++){
        int j = 0;
        while(A[i] < A[i-1]){
            sum++;
            A[i]++;
        }
    }
    printf("%ld\n",sum);
    return 0;

Compiler output:
main.c: In function 'main':
main.c:19:5: error: expected declaration or statement at end of input
   19 |     return 0;
      |     ^~~~~~
Language: Java

import java.util.Scanner;

public class Ans {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int max = sc.nextInt();
        int count = 0;
        for (int i = 1; i < n; i++) {
            int a = sc.nextInt();
            if(a<max){
                count += max-a;
                a = max;
            }
            else if(a>max){
                max = a;
            }
        }
        System.out.println(count);
    }
}


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

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

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n;
    while(cin >> n){
        int total=0;
        int arr[n];
        int ans[n];
        for(int i=0;i<n;i++){
            cin >> arr[i];
            ans[i]=arr[i];
        }sort(ans,ans+n);
        for(int i=0;i<n;i++){
            for(int j=i+1;j<n;j++){
                    if(arr[i]>arr[j]){
                        total+=1;
                        int temp=arr[i];
                        arr[i]=arr[j];
                        arr[j]=temp;
                    }
                }
            }
        }cout << total << '\n';
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:18: error: 'total' was not declared in this scope
   27 |         }cout << total << '\n';
      |                  ^~~~~
a.cc: At global scope:
a.cc:29:1: error: expected declaration before '}' token
   29 | }
      | ^
Language: C

#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define MOD 1000000007
#define len(x) x.size()
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define all(v) v.begin(), v.end()
#define alla(a, n) a, a + n
#define endl "\n";
#define MOD 1000000007

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef unordered_map<ll, ll> ump;

int32_t main()
{

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll n;
    cin >> n;
    vll a;
    for (int i = 0; i < n; i++)
    {
        ll num;
        cin >> num;
        a.push_back(num);
    }
    //s(a);
    ll ans = 0;
    for (int i = 1; i < n; i++)
    {
        if (a[i - 1] > a[i])
        {

            ans += (a[i - 1] - a[i]);
            a[i] = a[i - 1];
        }
    }
    cout << ans << endl;
}

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

#include<bits/stdc++.h>

typedef long long ll;
typedef long double ld;
using namespace std;
//mt19937_64 mrand(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 mrand(42);
#define ii for(int i=1;i<=n;++i)
#define ji for(int j=1;j<=n;++j)
#define jj for(int j=1;j<=m;++j)
#define ij for(int i=1;i<=m;++i)
#define sz(x) ((ll)x.size())
#define all(x) x.begin(),x.end()
#define al(x) x+1,x+1+n
#define asd cout<<"ok"<<endl;
#define asdd cout<<"okok"<<endl;
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vii vector<pair<int,int>>
#define pr(v) for(auto i:v) cout<<i<<" ";cout<<endl;
#define prt(a, l, r) for(auto i=l;i<=r;++i) cout<<a[i]<<" ";cout<<endl;
#define pc(x) __builtin_popcount(x)
#define pb push_back
#define PS string qqwwee;cin>>qqwwee;
typedef pair<int,int> pii;

int a[200005];
int main() {
    int n;
    cin>>n;
    ii cin>>a[i];
    ll ans=0,mx=0;
    ii {
        if(a[i]<mx) ans+=mx-a[i];
        else mx=max(mx,a[i]);
    }
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:20: error: no matching function for call to 'max(ll&, int&)'
   36 |         else mx=max(mx,a[i]);
      |                 ~~~^~~~~~~~~
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:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:36:20: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   36 |         else mx=max(mx,a[i]);
      |                 ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303: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:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:36:20: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   36 |         else mx=max(mx,a[i]);
      |                 ~~~^~~~~~~~~
Language: C++

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

int main() {

  int n;
  cin >> n;

  vector<ll> arr;
  for(int i=0; i<n; i++) {
    ll t;
    cin >> t;
    arr.push_back(t);
  }

  ll cnt =0;
  ll j=0;
  ll max_so_far = -1;
  for(int i=1; i<arr.size(); i++) {
    max_so_far = max(max_so_far, arr[i-1]);
    if(arr[i] < max_so_far) {
      cnt += (max_so_far - arr[i]);
    }
  }

  cout << cnt << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:10: error: 'll' was not declared in this scope
   10 |   vector<ll> arr;
      |          ^~
a.cc:10:12: error: template argument 1 is invalid
   10 |   vector<ll> arr;
      |            ^
a.cc:10:12: error: template argument 2 is invalid
a.cc:12:7: error: expected ';' before 't'
   12 |     ll t;
      |       ^~
      |       ;
a.cc:13:12: error: 't' was not declared in this scope
   13 |     cin >> t;
      |            ^
a.cc:14:9: error: request for member 'push_back' in 'arr', which is of non-class type 'int'
   14 |     arr.push_back(t);
      |         ^~~~~~~~~
a.cc:17:5: error: expected ';' before 'cnt'
   17 |   ll cnt =0;
      |     ^~~~
      |     ;
a.cc:18:5: error: expected ';' before 'j'
   18 |   ll j=0;
      |     ^~
      |     ;
a.cc:19:5: error: expected ';' before 'max_so_far'
   19 |   ll max_so_far = -1;
      |     ^~~~~~~~~~~
      |     ;
a.cc:20:22: error: request for member 'size' in 'arr', which is of non-class type 'int'
   20 |   for(int i=1; i<arr.size(); i++) {
      |                      ^~~~
a.cc:21:5: error: 'max_so_far' was not declared in this scope
   21 |     max_so_far = max(max_so_far, arr[i-1]);
      |     ^~~~~~~~~~
a.cc:21:37: error: invalid types 'int[int]' for array subscript
   21 |     max_so_far = max(max_so_far, arr[i-1]);
      |                                     ^
a.cc:22:11: error: invalid types 'int[int]' for array subscript
   22 |     if(arr[i] < max_so_far) {
      |           ^
a.cc:23:7: error: 'cnt' was not declared in this scope; did you mean 'int'?
   23 |       cnt += (max_so_far - arr[i]);
      |       ^~~
      |       int
a.cc:23:31: error: invalid types 'int[int]' for array subscript
   23 |       cnt += (max_so_far - arr[i]);
      |                               ^
a.cc:27:11: error: 'cnt' was not declared in this scope; did you mean 'int'?
   27 |   cout << cnt << endl;
      |           ^~~
      |           int
Language: C

#include<stdio.h>

int main(void){
    int N, sum = 0;
    scanf("%d",&N);
    int A[N];
    for(int i = 0; i < N; i++){
        scanf("%d",&A[i]);
    }
    for(int i = 1; i < N; i++){
        int j = 0;
        while(A[i] < A[i-1]){
            sum++;
            A[i]++;
        }
    }
    printf("%d\n",sum);
    re

Compiler output:
main.c: In function 'main':
main.c:18:5: error: 're' undeclared (first use in this function)
   18 |     re
      |     ^~
main.c:18:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:18:7: error: expected ';' at end of input
   18 |     re
      |       ^
      |       ;
main.c:18:5: error: expected declaration or statement at end of input
   18 |     re
      |     ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
 int n;
 cin>>n;
 int a[n];
 for(int i=0;i<n;i++)
   cin>>a[i];
 long long int sum=0; 
 for(int i=1;i<n;i++)
 {
  if(a[i]<a[i-1])
  {
   sum=sum+a[i-1]-a[i];
    a[i]=a[i-1];
  }  
   cout<<sum<<endl;
 return 0;
}  

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

import java.util.*;
public class Main
{
  public static void main(String[] args)
  {
   Scanner s=new Scanner(System.in);
    int n=s.nextInt();
    int a[]=new int[n];
    for(int i=0;i<n;i++)
    {
      a[i]=s.nextInt();
    }
    long ans=0;
    for(int i=1;i<n;i++)
    {
      ans+=Mathmax(0,a[i-1]-a[i]);
      a[i]=Math.max(a[i],a[i-1]);
    }
    System.out.println(ans);
  }
}

Compiler output:
Main.java:16: error: cannot find symbol
      ans+=Mathmax(0,a[i-1]-a[i]);
           ^
  symbol:   method Mathmax(int,int)
  location: class Main
1 error
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 [] A = new int [N+1];
        for(int i=1; i<N+1; i++){
        	A[i] = sc.nextInt();
        }
        
        int [] L = new int [N+1];
        for(i=2; i<N+1; i++){
        	if(A[i]<A[i-1]){
            	L[i]=A[i]-A[i-1];
            }
        }
      	
      	int S;
   		S=0;
      	for(i=2; i<N+1; i++){
        	S=S+L[i];
        }     	
        // 出力
        System.out.println(S);
    }
}

Compiler output:
Main.java:14: error: cannot find symbol
        for(i=2; i<N+1; i++){
            ^
  symbol:   variable i
  location: class Main
Main.java:14: error: cannot find symbol
        for(i=2; i<N+1; i++){
                 ^
  symbol:   variable i
  location: class Main
Main.java:14: error: cannot find symbol
        for(i=2; i<N+1; i++){
                        ^
  symbol:   variable i
  location: class Main
Main.java:15: error: cannot find symbol
        	if(A[i]<A[i-1]){
        	     ^
  symbol:   variable i
  location: class Main
Main.java:15: error: cannot find symbol
        	if(A[i]<A[i-1]){
        	          ^
  symbol:   variable i
  location: class Main
Main.java:16: error: cannot find symbol
            	L[i]=A[i]-A[i-1];
            	  ^
  symbol:   variable i
  location: class Main
Main.java:16: error: cannot find symbol
            	L[i]=A[i]-A[i-1];
            	       ^
  symbol:   variable i
  location: class Main
Main.java:16: error: cannot find symbol
            	L[i]=A[i]-A[i-1];
            	            ^
  symbol:   variable i
  location: class Main
Main.java:22: error: cannot find symbol
      	for(i=2; i<N+1; i++){
      	    ^
  symbol:   variable i
  location: class Main
Main.java:22: error: cannot find symbol
      	for(i=2; i<N+1; i++){
      	         ^
  symbol:   variable i
  location: class Main
Main.java:22: error: cannot find symbol
      	for(i=2; i<N+1; i++){
      	                ^
  symbol:   variable i
  location: class Main
Main.java:23: error: cannot find symbol
        	S=S+L[i];
        	      ^
  symbol:   variable i
  location: class Main
12 errors
Language: C++

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

int main(void){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a.at(i);

    ll ans = 0;
    ll max_h = 0;

    rep(i, n){
        if(i==0){
            max_h = a.at(i);
            continue;
        }
        if(max_h > a.at(i)) ans += (max_h - a.at(i));
        max_h = max(max_h, a.at(i));
    }

    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:20: error: no matching function for call to 'max(ll&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   22 |         max_h = max(max_h, a.at(i));
      |                 ~~~^~~~~~~~~~~~~~~~
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:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:22:20: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   22 |         max_h = max(max_h, a.at(i));
      |                 ~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303: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:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:22:20: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   22 |         max_h = max(max_h, a.at(i));
      |                 ~~~^~~~~~~~~~~~~~~~
Language: C++

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

int main()
{
  int N;
  cin >> N;
    
  vector<int> height(N);
  for(int i = 0; i < N; i++)
  {
    cin >> height.at(i);
  }
  int sum = 0;
  
  for(int i = 0; i < N-1; i++)
  {
    if(height.at(i) > height.at(i + 1) )
    {
      sum += height.at(i) -height(i+1);
      height.at(i+1) = height.at(i);
    }
  }
  cout << sum;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:34: error: no match for call to '(std::vector<int>) (int)'
   20 |       sum += height.at(i) -height(i+1);
      |                            ~~~~~~^~~~~
Language: Java


import java.io.IOException;
import java.util.Scanner;

public class Test {

	public static void Main(String[] args) throws IOException{

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] A = new int[N];
		for(int i=0; i<N; i++) A[i]=sc.nextInt();


		int old_hight = 0;
		int sum = 0;

		for(int h : A) {
			if(old_hight!=0){
				if(h >= old_hight) {
					old_hight=h;
				}
				else {
					int s = h - old_hight;
					sum = sum + s;
					old_hight = h;
				}
			}
		}

		System.out.println(sum);

	}
}

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

package contest;
import java.util.*;
public class A {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
			int n=sc.nextInt();
		long a[]=new long[n];
		for(int i=0;i<n;i++) {
			a[i]=sc.nextLong();
		}
		long ans=0;
		long max=a[0];
		for(int i=0;i<n-1;i++) {
			if(a[i]<=a[i+1])
				continue;
			else {
//				System.out.print(max+" ");
				max=Math.max(a[i], max);
				ans+=max-a[i+1];
				
				
			}
		}
		System.out.println(ans);
					
				
			}
		
	}
	   



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

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

int main() {
 	int n; 
	cin >> n;
	int ans = 0;
    int a[n];
  	int max = 0;
  
  for(int i=0; i<n; i++) 
  {
    cin >> a[i];
  	if(a[i] > max)
    {
      max = a[i];
    }
    else
    {
      ans += max-a[i];
    }

  }

  cout << ans << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:25:23: error: expected '}' at end of input
   25 |   cout << ans << endl;
      |                       ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

#include <iostream> 
using namespace std; 

typedef long long int ll;
typedef long unsigned lu;
typedef vector<ll> v;
typedef pair<ll,ll> p;
typedef vector <p> vp;
#define rep(i,j,k) for(ll i=j;i<k;i++)
#define repr(i,j,k) for(ll i=k;i>=j;i--)
#define read(a,n) rep(i,0,n) cin>>a[i];
#define show(a,n) rep(i,0,n) cout<<a[i]<<" ";
#define modulus 1000000007
#define MAX 100005
#define INF 1000000001
// #define cinv vl a(n) rep(i,0,n) { cin>>a[i]; }
#define fastio() ios_base::sync_with_stdio(false); cin.tie(NULL);
ll dp[MAX];

int main()
{
    fastio();
    int n;
    cin>>n;
    ll a[n];
    read(a,n);
    ll sum=0;
    for (int i = 0; i < n-1; i++)
    {
        if(a[i+1]<a[i])
        {
            sum+=abs(a[i]-a[i+1]);
            a[i+1]=a[i];
        }
        
    }
    cout<<sum<<"\n";
}



Compiler output:
a.cc:6:9: error: 'vector' does not name a type
    6 | typedef vector<ll> v;
      |         ^~~~~~
a.cc:8:9: error: 'vector' does not name a type
    8 | typedef vector <p> vp;
      |         ^~~~~~
Language: C++

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

int main() {
  
  int n;
  cin >> n;
  
  vector<int> vec(n);
  
  for (int i = 0; i < n; i++){
    int x;
    cin >> x;
    vec.at(i) = x;
  }
  
  int total = 0;
  
  for (int i = 1; i < n; i++){
    
    int j = i -1;
    
    if(vec.at(j) <= vec.at(i)){
      vec.at(i) = vec.at(i) + 0;
    }
    else if (vec.at(j) > vec.at(i)){
      int num;
      num = vec.at(j) - vec.at(i);
      vec.at(i) = vec.at(i) + num;
      total = total + num;
    }
    
  }
  
  cout << total << endl;
  
}





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:7:3: error: 'cin' was not declared in this scope
    7 |   cin >> n;
      |   ^~~
a.cc:9:3: error: 'vector' was not declared in this scope
    9 |   vector<int> vec(n);
      |   ^~~~~~
a.cc:9:10: error: expected primary-expression before 'int'
    9 |   vector<int> vec(n);
      |          ^~~
a.cc:14:5: error: 'vec' was not declared in this scope
   14 |     vec.at(i) = x;
      |     ^~~
a.cc:23:8: error: 'vec' was not declared in this scope
   23 |     if(vec.at(j) <= vec.at(i)){
      |        ^~~
a.cc:35:3: error: 'cout' was not declared in this scope
   35 |   cout << total << endl;
      |   ^~~~
a.cc:35:20: error: 'endl' was not declared in this scope
   35 |   cout << total << endl;
      |                    ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  int sa,sum;
  sa = 0;
  sum = 0;
  int a[200000]
  for(int i=0;i<N;i++){
    cin >> a[i];
  }
  for(int i=1;i<N;i++){
    if(a[i-1]>a[i]){
      sa = a[i-1] - a[i];
      a[i] = a[i] + sa;
      sum = sum + sa;
    }
  }
  cout << sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: expected initializer before 'for'
    9 |   for(int i=0;i<N;i++){
      |   ^~~
a.cc:9:15: error: 'i' was not declared in this scope
    9 |   for(int i=0;i<N;i++){
      |               ^
a.cc:13:8: error: 'a' was not declared in this scope
   13 |     if(a[i-1]>a[i]){
      |        ^
Language: Java

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Scanner;
import java.math.BigInteger; 
public class C_Step
{
     static Scanner sc=new Scanner(System.in);
    static PrintWriter out=new PrintWriter(System.out);
    static void pn(Object o)
     {
    out.println(o);
    out.flush();
    
    }
    static void p(Object o)
    {
    out.print(o);
    out.flush();
    }
    static void pni(Object o)
    {
    out.println(o);System.out.flush();
    }
        static int I() throws IOException
    { 
    return sc.nextInt();
    }
    static long L()throws IOException
    {
    return sc.nextLong();
    }
    static double D()throws IOException
    {
    return sc.nextDouble();
    }
    static String S()throws IOException
    {
    return sc.next();
        }
        static void process() throws IOException
     {
         int n=I();
         long a[]=new long[n];long c=0;
         for(int i=0;i<n;i++)
         {
             a[i]=L();
            }
         for(int i=1;i<n;i++)
         {
            if(a[i]<a[i-1])
            {
                c=c+a[i-1]-a[i];
                a[i]=a[i-1];
            }
            
            }
         pn(c);
        }
         public static void main(String[] args) throws IOException
  {
   try
{
        process();
 }
catch(Exception e)
{
return;
}
}
             
         
       }
   

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