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

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

int f3() {
    int N;
    cin >> N;
    vector<int> v(N);
    for(int i = 0; i< N; i++) cin >> v[i];

    int sum = 0;
    int maxv = v[0];
    for(int i = 1; i < N; i++) {
        if(v[i] < maxv) {
            sum += maxv - v[i];
        } else {
            maxv = max(maxv, v[i]);
        }
    }
    cout << sum << endl;
    return 0;
}

int main() {
    f3();
    return 0;
}



Compiler output:
a.cc: In function 'int f3()':
a.cc:8:5: error: 'vector' was not declared in this scope
    8 |     vector<int> v(N);
      |     ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include <cmath>
  +++ |+#include <vector>
    3 | using namespace std;
a.cc:8:12: error: expected primary-expression before 'int'
    8 |     vector<int> v(N);
      |            ^~~
a.cc:9:38: error: 'v' was not declared in this scope
    9 |     for(int i = 0; i< N; i++) cin >> v[i];
      |                                      ^
a.cc:12:16: error: 'v' was not declared in this scope
   12 |     int maxv = v[0];
      |                ^
Language: C++

#include <iostream>

using namespace std;

int main() {

    int n;
    cin >> n;
    int m = INT_MIN;
    int tool = 0;
    while (n--) {
        int val;
        cin >> val;
        m = max(m, val);
        if (m > val) tool += m - val;
    }
    cout<<tool;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:13: error: 'INT_MIN' was not declared in this scope
    9 |     int m = INT_MIN;
      |             ^~~~~~~
a.cc:2:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include <iostream>
  +++ |+#include <climits>
    2 |
Language: C++

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

int f3() {
    int N;
    cin >> N;
    vector<int> v(N);
    for(int i = 0; i< N; i++) cin >> v[i];

    int sum = 0;
    int maxv = v[0];
    for(int i = 1; i < N; i++) {
        if(v[i] < maxv) {
            sum += maxv - v[i];
        } else {
            maxv = max(maxv, v[i]);
        }
    }
    cout << sum << endl;
    return 0;
}

int main() {
    f3();
    return 0;
}



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

import java.io.IOException;
import java.io.InputStreamReader;
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 now_max = 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 + s;
				}
			}
		}
	}
}


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++

#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <unordered_map>
#include <limits>
#include <cassert>

using namespace std;

#define inf numeric_limits<int>::max()
#define double_inf numeric_limits<double>::infinity();

typedef long long int lli;
typedef unsigned long long int ulli;


int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	int N = 0;
	lli loc_max = 0;
	ulli total_sum = 0;
	vector<int> A;
	cin >> N;
	A.resize(N);
	for (int i = 0; i < N; i++){
		cin >> A[i];
		loc_max = max(A[i], loc_max);
		total_sum += (loc_max>A[i] ? loc_max-A[i] : 0);
	}
	cout << total_sum << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:30: error: no matching function for call to 'max(__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&, lli&)'
   32 |                 loc_max = max(A[i], loc_max);
      |                           ~~~^~~~~~~~~~~~~~~
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:32:30: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'lli' {aka 'long long int'})
   32 |                 loc_max = max(A[i], loc_max);
      |                           ~~~^~~~~~~~~~~~~~~
/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:4:
/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:32:30: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   32 |                 loc_max = max(A[i], loc_max);
      |                           ~~~^~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#define int long long
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	int arr[n];
	for (int i = 0; i < n; ++i){
		cin>>arr[i];
	}
	int max = arr[0];
	int ans = 0;
	for (int i = 1; i < n; ++i){
		if(arr[i]>max){
			max = arr[i];
		}else{
			ans += max-arr[i];
		}
	}
	cout << ans << endl;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: Java

import java.util.*;

public class Main3 {
	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.nextInt();
		}
		long count = 0;
		for(int j = 1; j < n; j++) {
			if(a[j - 1] > a[j]){
				count += a[j - 1] - a[j];
				a[j] = a[j - 1];
			}
		}
		System.out.println(count);
	}
}

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

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main() {
    ll n;
    cin >> n;
    vector<ll> a(n);
    ll cnt=0;
    ll max_num = 0;
    for (int i=0; i<n; i++){
        cin >> a[i];
        int s = a[i];
        if (s < max_num){
            cnt += max_num - s;
        }
        max_num = max(max_num,s);


    }
    cout << cnt << endl;
    


    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:22: error: no matching function for call to 'max(ll&, int&)'
   19 |         max_num = max(max_num,s);
      |                   ~~~^~~~~~~~~~~
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:19:22: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   19 |         max_num = max(max_num,s);
      |                   ~~~^~~~~~~~~~~
/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:19:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   19 |         max_num = max(max_num,s);
      |                   ~~~^~~~~~~~~~~
Language: Java

vimport java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);
    static final int mod = 1000000007;

    public static void main(String[] args) {

      int n =sc.nextInt();
      int[] a = new int[n];
      for(int i =0; i<n; i++)
      a[i] = sc.nextInt();
      
      int ans = 0;
           for(int i =1; i<n; i++)
           {
            if(a[i]<a[i-1])
           { ans+= a[i-1]-a[i];
            a[i] = a[i-1]; 
           }
           }
        
   System.out.println(ans);
        
       



    }
















    static int max(int a, int b)
    {
        return Math.max(a,b);
    }
    static int max(int a, int b, int c)
    {
        return Math.max(max(a,b), c);
    }
    static int max(int a, int b, int c, int d)
    {
        return Math.max(max(a,b), max(c,d));
    }

    static int min(int a, int b)
    {
        return Math.min(a, b);
    }

    static int min(int a, int b, int c )
    {
        return Math.min(a, min(b,c));
    }

    static int min(int a, int b, int c, int d )
    {
        return Math.min(min(a,d), min(b,c));
    }

    static boolean isPower(int a, int b)
    {
        double temp = Math.log(a)/Math.log(b);
        return temp == (int) temp;
    }
    static boolean isPrime(int n)
    {
        if(n==1) return false;
        if(n==2) return true;
        if(n%2==0) return false;

        if(n<9)return true;
        if(n%3==0) return false;

        int r = (int)Math.sqrt(n);

        for(int i = 5; i<=r; i +=6)
        {
            if(n%i==0) return false;
            if(n%(i+2)==0) return false;
        }
        return true;



    }
}


Compiler output:
Main.java:1: error: class, interface, enum, or record expected
vimport java.util.Scanner;
^
1 error
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int x=0;
 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)){
      x+=vec.at(i)-vec.at(i+1);
    }
    else{continue;}
  }
  cout<<x<<endl;

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

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll N=1e6+5,inf=1e18,mod=1e9+7;
#define test ll testcases;cin>>testcases; while(testcases--)
#define pb push_back
#define mp make_pair
#define pf push_front
#define ff first
#define ss second
#define vll vector<ll>
#define vld vector<ld>
#define pll pair<ll,ll> 
#define ppll pair<ll,pair<ll,ll>>
#define pld pair<ld,ld> 
#define vpll vector<pll>
#define vpld vector<pld>
#define all(X) X.begin(),X.end()
#define sz(x) ((ll)((x).size()))
const ld pi=3.141592653589793238;

bool check_prime(ll n)
{
	ll flag=0,i;
	for(i=2;i*i<=n;i++)
	{
		if(n%i==0)
		{
			flag=1;
			break;
		}
	}
	if(n==1)
	{
		return false;
	}
	else if(flag==0 || n==2 || n==3)
	{
		return true;
	}
	else
	{
		return false;
	}
}

ll fastexpo(ll a,ll b,ll MOD) 
{
	ll result=1;
	while(b>0)
	{
		if(b%2==1)
		{
			result=(result*a)%MOD;
		}
		a=(a*a)%MOD;
		b=b/2;
	}
	return result;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll i,s,n;
  cin>>n;
  ll a[n];
  for(i=0;i<n;i++)
  {
    cin>>a[i];
  }
  s=0;
  for(i=0;i<n-1;i++)
  {
	if(a[i]>a[i+1])
    {
		s+=(a[i]-a[i+1]);
      a[i+1]=a[i];
    }
  }
  cout<<s<<"\n";
       return 0;
}

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

import java.util.*;
class{
  public static void main(String[] args){
    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 max=a[0];
    int count=0;
    for(int i=0;i<a.length;i++){
      if(a[i]>max){
        max=a[i];
      }
      if(a[i]<max){
        count++;}
      else{
        count=0;}
    }
    System.out.println(count);
  }
}

Compiler output:
Main.java:2: error: <identifier> expected
class{
     ^
1 error
Language: C++

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

int main(){
  ll n,a,ans=0;
  cin>>n;
  vector<ll> vec(n);
  rep(i, n){
    cin>>vec[i];
  }
  rep(i,n-1){
    ans+=max(0,vec[i+1]-vec[i]);
  }
  cout<<ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:13: error: no matching function for call to 'max(int, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)'
   17 |     ans+=max(0,vec[i+1]-vec[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:17:13: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'})
   17 |     ans+=max(0,vec[i+1]-vec[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:17:13: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   17 |     ans+=max(0,vec[i+1]-vec[i]);
      |          ~~~^~~~~~~~~~~~~~~~~~~
Language: C++

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

int main(){
  int N,sum=0,max=0;
  cin >> N;
  
  
  for(int i=0;i<N;i++){
    int x;
    cin >> x;
    if(max < x){
      max = x;
    }else{
      sum += max - x;
    }
  }
  cout << sum << endl;
}
  

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:4:3: error: 'll' was not declared in this scope
    4 |   ll n,a[200005],ans=0;
      |   ^~
a.cc:5:8: error: 'n' was not declared in this scope; did you mean 'yn'?
    5 |   cin>>n;
      |        ^
      |        yn
a.cc:6:9: error: expected ';' before 'i'
    6 |   for(ll i=1;i<=n;i++) cin>>a[i];
      |         ^~
      |         ;
a.cc:6:14: error: 'i' was not declared in this scope
    6 |   for(ll i=1;i<=n;i++) cin>>a[i];
      |              ^
a.cc:6:29: error: 'a' was not declared in this scope
    6 |   for(ll i=1;i<=n;i++) cin>>a[i];
      |                             ^
a.cc:7:9: error: expected ';' before 'i'
    7 |   for(ll i=2;i<=n;i++){
      |         ^~
      |         ;
a.cc:7:14: error: 'i' was not declared in this scope
    7 |   for(ll i=2;i<=n;i++){
      |              ^
a.cc:8:8: error: 'a' was not declared in this scope
    8 |     if(a[i]<a[i-1]){
      |        ^
a.cc:9:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
    9 |       ans+=a[i-1]-a[i];
      |       ^~~
      |       abs
a.cc:13:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   13 |   cout<<ans;
      |         ^~~
      |         abs
Language: C

#include <bits/stdc++.h>

#define endl '\n'
#define ll long long

using namespace std;

ll gcd(ll a, ll b) {
    if(a == 0) return b;
    return gcd(b % a, a);
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    
    ll n, lr = 0, rl = 0;
    cin >> n;
    vector <int> v(n);
    for(int i = 0; i < n; i++) {
        cin >> v[i];
    }
    for(int i = 1; i < n; i++) {
        if(v[i] > v[i - 1]) {
            lr += v[i] - v[i - 1];
        }
    }
    for(int i = (n - 1) - 1; i >= 0; i--) {
        if(v[i] < v[i + 1]) {
            rl += v[i + 1] - v[i];
        }
    }
    cout << min(lr, rl) << 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>
using namespace std;
using ll = long long;

int main() {
  ll N;cin>>N;vector<ll> V(N);cin>>V[0];ll a=0;
  for(int i=1;i<N;i++){
    cin>>V[i];
    a+=max(V[i]-V[i-1],0);
  }cout<<a<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:11: error: no matching function for call to 'max(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type, int)'
    9 |     a+=max(V[i]-V[i-1],0);
      |        ~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: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:9:11: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
    9 |     a+=max(V[i]-V[i-1],0);
      |        ~~~^~~~~~~~~~~~~~~
/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:9:11: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
    9 |     a+=max(V[i]-V[i-1],0);
      |        ~~~^~~~~~~~~~~~~~~
Language: C++

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


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


Compiler output:
a.cc: In function 'int main()':
a.cc:17:13: error: no matching function for call to 'max(long long int&, int)'
   17 |     sum+=max(sum,a[i]-a[i+1]);
      |          ~~~^~~~~~~~~~~~~~~~~
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:17:13: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   17 |     sum+=max(sum,a[i]-a[i+1]);
      |          ~~~^~~~~~~~~~~~~~~~~
/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:2:
/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:17:13: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   17 |     sum+=max(sum,a[i]-a[i+1]);
      |          ~~~^~~~~~~~~~~~~~~~~
Language: C++

#include<iostream>
using namespace std;
int main(){
 	int n;
  	cin>>n;
  	int * arr = new int [n];
  	for(int i=0;i<n;i++){
      cin>>arr[i];
    }
  	double diff =0;
  	for(int i=1;i<n;i++){
      if(a[i]<a[i-1]){
        diff = a[i-1] -a[i];
        a[i] = a[i-1];
      }
    }
    cout<<diff<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:10: error: 'a' was not declared in this scope
   12 |       if(a[i]<a[i-1]){
      |          ^
Language: C++

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


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

Compiler output:
a.cc: In function 'int main()':
a.cc:10:6: error: 'i' was not declared in this scope
   10 |  for(i=0;i<n;i++)
      |      ^
a.cc:15:7: error: 'i' was not declared in this scope
   15 |   for(i=0;i<n-1;i++)
      |       ^
Language: C++

//
// Created by yozaam on 12/06/20.
//

//
// Created by yozaam on 04/06/20.
//



/********   All Required Header Files ********/
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <unordered_map>
#include <unordered_set>

using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define PI 3.1415926535897932384626
typedef pair<int, int>  pii;
typedef vector<int>     vi;
typedef vector<pii>     vpii;
typedef vector<vi>      vvi;
//=======================

//=======================
vi g[N];
int a[N];
int n, x,t,i;
//=======================

void solve() {
    cin>>n;
    cin>>x
    int tallest = x;
    int stool = 0;
    fo(i,n-1){

        cin>>x;

        if(x>=tallest){
            tallest = x;
        }else{
            stool += (x- tallest);
            //bring him up to the tallest value!
        }


    }

    cout<<stool;

}

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

    int t = 1;
    // cin >> t;
    while(t--) {
      solve();
    }

    return 0;
}

Compiler output:
a.cc:56:6: error: 'N' was not declared in this scope
   56 | vi g[N];
      |      ^
a.cc:57:7: error: 'N' was not declared in this scope
   57 | int a[N];
      |       ^
a.cc: In function 'void solve()':
a.cc:63:11: error: expected ';' before 'int'
   63 |     cin>>x
      |           ^
      |           ;
   64 |     int tallest = x;
      |     ~~~    
a.cc:70:15: error: 'tallest' was not declared in this scope
   70 |         if(x>=tallest){
      |               ^~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin>>n;
    ll arr[n];
    for(ll i=0;i<n;i++)
       cin>>arr[i];
    ll ans=0;
    for(ll i=0;i<n-1;i++)
    {
        if(arr[i]<=arr[i+1])
            ans+=abs(arr[i]-arr[i+1]);
    }
    cout<<ans<<"\n";
    return 0;

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


import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args){
		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 pmax = a[0];
		int s = 0;
		for( int i= 1; i<n ; i++ ) {
			int d = pmax - a[i];
			if( d >= 0 ) {
				s += d;
			}else {
				pmax = a[i];
			}
			
		}
		
		System.out.println(s);
	

Compiler output:
Main.java:31: error: reached end of file while parsing
		System.out.println(s);
		                      ^
1 error
Language: C++

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

int main() {
    long long n=0,x,t;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    x = a[0];
    t=0;
    for(int i=1;i<n;i++){
        if(x>a[i])
            t += (x-a[i]);
        x = max(x,a[i]);
    }
    cout<<t<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:16: error: no matching function for call to 'max(long long int&, int&)'
   15 |         x = max(x,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:15:16: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   15 |         x = max(x,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:15:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   15 |         x = max(x,a[i]);
      |             ~~~^~~~~~~~
Language: C++

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

int main()
{
  	int n;
	cin >> n;
  	vector<int> data(n);
  	REP(i, n){
      cin >> data[i];
    }
  
  	int bf = 0;
  int sum = 0;
  
  REP(i,n){
    int current = data[i];
    int step = 0;
    if(bf > current){
      step = bf - current;
    }
    bf = current + step;
    sum += step;
  }
  
  cout << step;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:11: error: 'step' was not declared in this scope; did you mean 'strsep'?
   27 |   cout << step;
      |           ^~~~
      |           strsep
Language: C++

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

int main() {
  int N;
  int c, k;
  cin >> N;
vector<int> veca(N);
  vector<int> vecb(N);
for (int i = 0; i < N; i++) {
  cin >> veca.at(i);
}
  vecb.at(i)=0;
  for (int i = 1; i < N; i++) {
  c=veca.at(i-1)+vecb.at(i-1);
    if(veca.at(i) >= c)
      vecb.at(i)=0;
    else
      vecb.at(i)=c-veca.at(i);
}
  k=0;
  for(int i=0; i<n; i++)
    k+=vecb.at(i);
  cout << k << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:11: error: 'i' was not declared in this scope
   13 |   vecb.at(i)=0;
      |           ^
a.cc:22:18: error: 'n' was not declared in this scope
   22 |   for(int i=0; i<n; i++)
      |                  ^
Language: C++

#include<cstdio>
#include<iostream>
using namespace std;
int n;
long long a[200005],ans;
int mian()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
	}
	for(int i=2;i<=n;i++)
	{
		if(a[i]<a[i-1])
		{
			a[i]+=a[i]-a[i-1];
			ans+=a[i]-a[i-1];
		}
	}
	printf("%lld\n",ans);
	return 0;
}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
const ll LL_MAX=LLONG_MAX;

struct In{
    template<typename T>
    operator T(){
        T x;
        cin >> x;
        return x;
    }
};
In in;

template <typename T,typename U>
void forin(T* x,U n){
    for (U i=0;i<n;i++) cin >> x[i];
}

template <typename T>
int div1(T x) {
    return x%1000000007;
}

template <typename T>
void out(T x){
    cout << x << endl;
}

template <typename T>
T gcd(T x,T y){
    if (y == 0) return x;
    return gcd(y,x%y);
}

template <typename T>
T lcm(T x,T y){
    return x*y/gcd(x,y);
}

int main(){
    int n=in,a[n],h
    ll ans=0;
    forin(a,n);
    h=a[0];
    for (int i=1;i<n;i++){
        if (a[i]<h) ans+=(h-a[i]);
        else if (a[i]>h) h=a[i];
    }
    out(ans);
}  

Compiler output:
a.cc: In function 'int main()':
a.cc:45:5: error: expected initializer before 'll'
   45 |     ll ans=0;
      |     ^~
a.cc:47:5: error: 'h' was not declared in this scope
   47 |     h=a[0];
      |     ^
a.cc:49:21: error: 'ans' was not declared in this scope; did you mean 'abs'?
   49 |         if (a[i]<h) ans+=(h-a[i]);
      |                     ^~~
      |                     abs
a.cc:52:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   52 |     out(ans);
      |         ^~~
      |         abs
Language: C++

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

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

#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define puts(i) cout << i << endl
#define INF INT_MAX
#define INFL LLONG_MAX
typedef long long ll;
using namespace std;
int main(){a
  ll n; cin >> n;

  ll ans = 0;
  ll max = 0;

  rep(i,n){
    ll a; cin >> a;
    if(a>=max){
      max = a;
    }else{
      ans+=max-a;
    }
  }

  cout << ans <<endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:12: error: 'a' was not declared in this scope
   10 | int main(){a
      |            ^
a.cc:11:16: error: 'n' was not declared in this scope; did you mean 'yn'?
   11 |   ll n; cin >> n;
      |                ^
      |                yn
Language: C++

#include<iostream>
using namespace std;
int main(){
  int n;
  long long array[200005];
  long long sum=0;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>array[i];
  }
  
  for(int i=1;i<n;i++){
    sum+=max(0,array[i-1]-array[i]);
    array[i]=max(array[i],array[i-1]);
  }
  cout<<sum<<endl;
  return(0);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:13: error: no matching function for call to 'max(int, long long int)'
   13 |     sum+=max(0,array[i-1]-array[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: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:13:13: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   13 |     sum+=max(0,array[i-1]-array[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
Language: Java

//package abc176;

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class C {
	public static void main(String[] args) throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int N = Integer.parseInt(br.readLine());
		String[] ip = br.readLine().split(" ");
		int[] ary = new int[N];
		
		for(int i = 0 ; i < N ; i++) {
			ary[i] = Integer.parseInt(ip[i]);
		}
		
		int prev = ary[0];
		int ans = 0;
		
		for(int i = 1 ; i < N ; i++) {
			if(prev > ary[i]) {
				ans += Math.abs(prev-ary[i]);
				ary[i] += Math.abs(prev-ary[i]);
			}
			prev = Math.max(ary[i], prev);
		}
		
		System.out.println(ans);
	}
	
}


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

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define MOD 1000000007
#define MAX 100010
#define aout(a) REP(i,sizeof(a)) cout << a[i] << " "; cout << endl;
#define vout(v) REP(i,v,size()) cout << v[i] << " "; cout << endl;
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

int main(){
  int N; cin>>N;
  vector<int> A(N);
  ll ans = 0;
  int mae = 0;
  REP(i,N) cin>>A[i];
  REP(i,N){
    if(mae <= A[i]) mae = A[i];
    else{
      ans += mae-A[i];
    }
  }a
  cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:4: error: 'a' was not declared in this scope
   24 |   }a
      |    ^
Language: C++

#include<bits/stdc++.h>
int main(){
  int N;
  cin>>N;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin>>A[i];
  }
  long long int ans=0;
  for(int i=1;i<N;i++){
    if(A[i]<A[i-1]){
      ans+=(A[i-1]-A[i]);
      A[i]=A[i-1];
    }
  }
  cout<<ans<<endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:4:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    4 |   cin>>N;
      |   ^~~
      |   std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:5:3: error: 'vector' was not declared in this scope
    5 |   vector<int> A(N);
      |   ^~~~~~
a.cc:5:3: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:5:10: error: expected primary-expression before 'int'
    5 |   vector<int> A(N);
      |          ^~~
a.cc:7:10: error: 'A' was not declared in this scope
    7 |     cin>>A[i];
      |          ^
a.cc:11:8: error: 'A' was not declared in this scope
   11 |     if(A[i]<A[i-1]){
      |        ^
a.cc:16:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   16 |   cout<<ans<<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:16:14: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   16 |   cout<<ans<<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:16:19: error: expected '}' at end of input
   16 |   cout<<ans<<endl;
      |                   ^
a.cc:2:11: note: to match this '{'
    2 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
#define prArr(Arr,n) for(int _=0;_<n;_++)   cout<<(Arr)[_]<<" ";
#define f first
#define s second
using namespace std;
const int INF=(int)0x3f3f3f3f;
const int MOD=(int)1e9+7;
const double eps=1e-9;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    long long n,mx=0,ans=0,tmp;
    cin>>n;
    for(int i=0;i<n&&cin>>tmp;i++)
        ans+=max(0,mx-tmp),mx=max(mx,tmp);
    cout<<ans;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:17: error: no matching function for call to 'max(int, long long int)'
   18 |         ans+=max(0,mx-tmp),mx=max(mx,tmp);
      |              ~~~^~~~~~~~~~
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:18:17: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   18 |         ans+=max(0,mx-tmp),mx=max(mx,tmp);
      |              ~~~^~~~~~~~~~
/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:18:17: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   18 |         ans+=max(0,mx-tmp),mx=max(mx,tmp);
      |              ~~~^~~~~~~~~~
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:25:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   25 |   cout<<ans;
      |         ^~~
      |         abs
Language: C++


	for(int i=0; i<n; i++){
		cin >> x;
		if(x < maxval) ans += maxval-x;
		else maxval = max(x, maxval);
	}
	cout << ans;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	while(t--){
		solve();
	}
    return 0;
}


Compiler output:
a.cc:2:9: error: expected unqualified-id before 'for'
    2 |         for(int i=0; i<n; i++){
      |         ^~~
a.cc:2:22: error: 'i' does not name a type
    2 |         for(int i=0; i<n; i++){
      |                      ^
a.cc:2:27: error: 'i' does not name a type
    2 |         for(int i=0; i<n; i++){
      |                           ^
a.cc:7:9: error: 'cout' does not name a type
    7 |         cout << ans;
      |         ^~~~
a.cc:8:1: error: expected declaration before '}' token
    8 | }
      | ^
a.cc: In function 'int main()':
a.cc:11:9: error: 'ios_base' has not been declared
   11 |         ios_base::sync_with_stdio(false);
      |         ^~~~~~~~
a.cc:12:9: error: 'cin' was not declared in this scope
   12 |         cin.tie(NULL);
      |         ^~~
a.cc:12:17: error: 'NULL' was not declared in this scope
   12 |         cin.tie(NULL);
      |                 ^~~~
a.cc:1:1: note: 'NULL' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
  +++ |+#include <cstddef>
    1 | 
a.cc:13:15: error: 't' was not declared in this scope
   13 |         while(t--){
      |               ^
a.cc:14:17: error: 'solve' was not declared in this scope
   14 |                 solve();
      |                 ^~~~~
Language: C++

#include <bits/stdc++.h>

#define ll long long

using namespace std;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:13:27: error: no matching function for call to 'max(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type, int)'
   13 |                 res += max(a[i-1] - a[i], 0);
      |                        ~~~^~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: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:13:27: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   13 |                 res += max(a[i-1] - a[i], 0);
      |                        ~~~^~~~~~~~~~~~~~~~~~
/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:13:27: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   13 |                 res += max(a[i-1] - a[i], 0);
      |                        ~~~^~~~~~~~~~~~~~~~~~