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

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

int main(){
    int N;
    scanf("%d%*c",&N);
    char *s = (char *)malloc(12 * N * sizeof(char));
    gets(s);
    long unsigned int max = 0;
    long unsigned int sum = 0;
    for(int i = 0;i < N; i++){
        int n;
        long unsigned int a;
        sscanf(s,"%ld %n",&a,&n);
        if(max < a)max = a;
        sum += max - a;
        s = &s[n];
    }
    printf("%d\n",sum);
    return 0;
}g

Compiler output:
main.c: In function 'main':
main.c:8:5: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
    8 |     gets(s);
      |     ^~~~
      |     fgets
main.c: At top level:
main.c:21:1: error: expected '=', ',', ';', 'asm' or '__attribute__' at end of input
   21 | }g
      | ^
Language: C++

#include <bits/stdc++.h>
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 ans=0;
	int maxnum=0;
	for (int i = 0; i < N; i++)
    {
		MaxNum = max(MaxNum, A[i]);
        int Bi = MaxNum;
        ans += Bi - A[i];
    }
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:17: error: 'MaxNum' was not declared in this scope; did you mean 'maxnum'?
   17 |                 MaxNum = max(MaxNum, A[i]);
      |                 ^~~~~~
      |                 maxnum
Language: C++

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

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

import java.util.*;
class Main{

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


Compiler output:
Main.java:15: error: incompatible types: possible lossy conversion from long to int
       a=a+k;
          ^
1 error
Language: C++

        #include <iostream>
        #include <algorithm>
        using namespace std;
         
        int main()
        {
          int N;
          cin>>N;
          int sum=0;
          int arr[N];
          for (int i=0;i<N;i++)
          {
            int n;
            cin>>arr[i];
          }
          for (int i=0;i<N;i++)
          {
            j = i+1;
            while j<N
            {
             	if (arr[i]>arr[j])
                {
                  sum+=arr[i]-arr[j];
                  j++;
                }      
              	
              
              	else
                {
                  break;
                }
            }
            
            if (arr[i]==*max_element(arr,arr+N-1))
            {
              break;
            }
          } 
          
          cout<<sum;
          
         return 0; 
        }

Compiler output:
a.cc: In function 'int main()':
a.cc:18:13: error: 'j' was not declared in this scope
   18 |             j = i+1;
      |             ^
a.cc:19:19: error: expected '(' before 'j'
   19 |             while j<N
      |                   ^
      |                   (
a.cc:19:22: error: expected ')' before '{' token
   19 |             while j<N
      |                   ~  ^
      |                      )
   20 |             {
      |             ~
Language: Java

import java.util.*;
class Main{

  public static void main(String args[]){
    Scanner sc=new Scanner(System.in);
   long n=sc.nextLong();
    int a=0;
    long arr[]=new long[n];
    for(int i=0;i<n;i++){
      arr[i]=sc.nextInt();
    }
    for(int i=1;i<n;i++){
     if(arr[i]<arr[i-1]){
       int k=arr[i-1]-arr[i];
       a=a+k;
       arr[i]=arr[i]+k;
     }
    }
    System.out.println(a);
  }}
  


Compiler output:
Main.java:8: error: incompatible types: possible lossy conversion from long to int
    long arr[]=new long[n];
                        ^
Main.java:14: error: incompatible types: possible lossy conversion from long to int
       int k=arr[i-1]-arr[i];
                     ^
2 errors
Language: Java

import java.util.*;
class Main{

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


Compiler output:
Main.java:8: error: incompatible types: possible lossy conversion from long to int
    long arr[]=new long[n];
                        ^
Main.java:14: error: incompatible types: possible lossy conversion from long to int
       int k=arr[i-1]-arr[i];
                     ^
2 errors
Language: C++

int main(){
        ll n;
        cin>>n;
        int arr[n];
        for(int i=0;i<n;i++){
                cin>>arr[i];
        }
        int max=arr[0];
        int stool=0;
        for(int i=1;i<n;i++){
                if(arr[i]<max){
                        stool+=max-arr[i];
                }
                else if(arr[i]>=max){
                        max=arr[i];
                }
        }
        cout<<stool<<"\n";
        return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:2:9: error: 'll' was not declared in this scope
    2 |         ll n;
      |         ^~
a.cc:3:9: error: 'cin' was not declared in this scope
    3 |         cin>>n;
      |         ^~~
a.cc:3:14: error: 'n' was not declared in this scope
    3 |         cin>>n;
      |              ^
a.cc:6:22: error: 'arr' was not declared in this scope
    6 |                 cin>>arr[i];
      |                      ^~~
a.cc:8:17: error: 'arr' was not declared in this scope
    8 |         int max=arr[0];
      |                 ^~~
a.cc:18:9: error: 'cout' was not declared in this scope
   18 |         cout<<stool<<"\n";
      |         ^~~~
Language: C++

    #include <iostream>
    #include <bits>
    using namespace std;
     
    int main()
    {
      int N;
      cin>>N;
      int sum=0;
      int arr[N];
      for (int i=0;i<N;i++)
      {
        int n;
        cin>>arr[i];
      }
      for (int i=0;i<N;i++)
      {
        j = i+1;
        while j<N
        {
         	if (arr[i]>arr[j])
            {
              sum+=arr[i]-arr[j];
              j++;
            }      
          	
          
          	else
            {
              break;
            }
        }
        
        if (arr[i]==*max_element(0,N-1))
        {
          break;
        }
      } 
      
      cout<<sum;
      
     return 0; 
    }

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

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

int main()
{
  int N;
  cin>>N;
  int sum=0;
  int arr[N];
  for (int i=0;i<N;i++)
  {
    int n;
    cin>>arr[i];
  }
  for (int i=0;i<N;i++)
  {
    j = i+1;
    while j<N
    {
     	if (arr[i]>arr[j])
        {
          sum+=arr[i]-arr[j];
          j++;
        }      
      	
      
      	else
        {
          break;
        }
    }
    
    if (arr[i]==*max_element(0,N-1))
    {
      break;
    }
  } 
  
 return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:5: error: 'j' was not declared in this scope
   18 |     j = i+1;
      |     ^
a.cc:19:11: error: expected '(' before 'j'
   19 |     while j<N
      |           ^
      |           (
a.cc:19:14: error: expected ')' before '{' token
   19 |     while j<N
      |           ~  ^
      |              )
   20 |     {
      |     ~         
a.cc:34:17: error: invalid type argument of unary '*' (have 'int')
   34 |     if (arr[i]==*max_element(0,N-1))
      |                 ^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
                 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/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_less_iter::operator()(_Iterator1, _Iterator2) const [with _Iterator1 = int; _Iterator2 = int]':
/usr/include/c++/14/bits/stl_algo.h:5626:12:   required from 'constexpr _ForwardIterator std::__max_element(_ForwardIterator, _ForwardIterator, _Compare) [with _ForwardIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
 5626 |         if (__comp(__result, __first))
      |             ~~~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5650:43:   required from 'constexpr _FIter std::max_element(_FIter, _FIter) [with _FIter = int]'
 5650 |       return _GLIBCXX_STD_A::__max_element(__first, __last,
      |                                           ^
a.cc:34:29:   required from here
   34 |     if (arr[i]==*max_element(0,N-1))
      |                  ~~~~~~~~~~~^~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:45:16: error: invalid type argument of unary '*' (have 'int')
   45 |       { return *__it1 < *__it2; }
      |                ^~~~~~
/usr/include/c++/14/bits/predefined_ops.h:45:25: error: invalid type argument of unary '*' (have 'int')
   45 |       { return *__it1 < *__it2; }
      |                         ^~~~~~
Language: Java

import java.util.*;
class Main{

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

Compiler output:
Main.java:8: error: incompatible types: String cannot be converted to int
    int arr[]=new int[n];
                      ^
Main.java:9: error: bad operand types for binary operator '<'
    for(int i=0;i<n;i++){
                 ^
  first type:  int
  second type: String
Main.java:12: error: bad operand types for binary operator '<'
    for(int i=1;i<n;i++){
                 ^
  first type:  int
  second type: String
3 errors
Language: C++

#include <iostream>
using namespace std;
typedef long long ll;
int main()
{
    int n;
    cin>>n;
    int p=0;
    ll ans=0;
    for(int i=1; i<=n; i++){
        int x;
        cin>>x;
        if(x<p){
          ans+=p-x,x=p;
        pre=x;
    }
    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: 'pre' was not declared in this scope
   15 |         pre=x;
      |         ^~~
a.cc:19:2: error: expected '}' at end of input
   19 | }
      |  ^
a.cc:5:1: note: to match this '{'
    5 | {
      | ^
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:8:19: warning: range-based 'for' loops with initializer only available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions]
    8 |   for (int i = 0; i < N: i++) {
      |                   ^
a.cc:8:24: error: found ':' in nested-name-specifier, expected '::'
    8 |   for (int i = 0; i < N: i++) {
      |                        ^
      |                        ::
a.cc:8:23: error: 'N' is not a class, namespace, or enumeration
    8 |   for (int i = 0; i < N: i++) {
      |                       ^
a.cc:19:1: error: expected primary-expression before '}' token
   19 | }
      | ^
a.cc:18:23: error: expected ')' before '}' token
   18 |   cout << ans << endl;
      |                       ^
      |                       )
   19 | }
      | ~                      
a.cc:8:7: note: to match this '('
    8 |   for (int i = 0; i < N: i++) {
      |       ^
a.cc:19:1: error: expected primary-expression before '}' token
   19 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(int argc, const char *argv[])
{
    int n;
    cin >> n;

    int pre, x;
    ll sum = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> x;
        if (i > 0 && x < pre)
        {
            sum += pre - x;
            x = pre;
        }
        pre = x;
    }
    cout << sum << endl;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:9:5: error: 'll' was not declared in this scope
    9 |     ll sum = 0;
      |     ^~
a.cc:15:13: error: 'sum' was not declared in this scope
   15 |             sum += pre - x;
      |             ^~~
a.cc:20:13: error: 'sum' was not declared in this scope
   20 |     cout << sum << endl;
      |             ^~~
Language: C++

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (ll i=(ll)from; i<(ll)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }


int main() {
  ll N; cin >> N;
  ll A[N]; rep(i,N) cin >> A[i];
  ll now = A[0], result = 0;
  repr(i,1,N) {
    if (A[i]<now) result += now - A[i];
    else now = A[i];˜
  }
  cout << result << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:21: error: '\U000002dc' was not declared in this scope
   32 |     else now = A[i];˜
      |                     ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,A,sum = 0;
  cin >> N;
  vector<int> H(N);
  for(int i = 0;i<N;i++){
   cin >> A;
   H.at(i) = A;
  } 
  for(int i = 1;i<N;i++){
   if(H.at(i) <= H.at(i - 1)){
    int sa = H.at(i - 1) - H.at(i);
    H.at(i) = H.at(i) + sa;
    sum = sum + sa;
   }
  }
 cout << sum << endl;
}
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,A,sum = 0;
  cin >> N;
  vector<int> H(N);
  for(int i = 0;i<N;i++){
   cin >> A;
   H.at(i) = A;
  } 
  for(int i = 1;i<N;i++){
   if(H.at(i) < H.at(i - 1)){
    int sa = H.at(i - 1) - H.at(i);
    H.at(i) = H.at(i) + sa;
    sum = sum + sa;
   }
  }
 cout << sum << endl;
}
提出情報
提出日時	2020-08-22 21:34:36
問題	C - Step
ユーザ	

Compiler output:
a.cc:42:22: error: invalid digit "8" in octal constant
   42 | 提出日時        2020-08-22 21:34:36
      |                      ^~
a.cc:24:5: error: redefinition of 'int main()'
   24 | int main() {
      |     ^~~~
a.cc:4:5: note: 'int main()' previously defined here
    4 | int main() {
      |     ^~~~
a.cc:41:1: error: '\U000063d0\U000051fa\U000060c5\U00005831' does not name a type
   41 | 提出情報
      | ^~~~~~~~
Language: C++

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

#pragma region typedef 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
#pragma endregion

#pragma region define
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for(int i = 0; (i) < (n); (i)++)
#define pb push_back
#define pf push_front
#pragma endregion

#pragma region const
const ld PI = 3.141592653589793;
#pragma endregion

#pragma region function
template<class T>bool chmax(T &a, const T &b){
  if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, T &b, T &c){
  if (b<a) { a=b; c++; return 1; } return 0; }
int sort_3int(int a, int b, int c){
  if (a>b) { swap(a,b); }
  if (a>c) { swap(a,c); }
  if (b>c) { swap(b,c); } return true;}
#pragma endregion

int main(){
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  int ans = 0;

  for(int i = 1; i < n; i++){
    if (a[i-1] > a[i]){
      ans += max(a[i-1] - a[i]);
      a[i] = a[i-1];
    }
  }
  cout << ans << endl;

return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:17: error: no matching function for call to 'max(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)'
   43 |       ans += max(a[i-1] - 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:2:
/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:   candidate expects 2 arguments, 1 provided
/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, 1 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:   template argument deduction/substitution failed:
a.cc:43:17: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   43 |       ans += max(a[i-1] - a[i]);
      |              ~~~^~~~~~~~~~~~~~~
/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:   candidate expects 2 arguments, 1 provided
Language: C++

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

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

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

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

Compiler output:
cc1plus: error: '::main' must return 'int'
a.cc: In function 'int main()':
a.cc:12:22: error: expected ']' before ')' token
   12 |     if(a[i] < a[i - 1){
      |                      ^
      |                      ]
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:8:12: error: 'a' was not declared in this scope
    8 |     cin >> a[i];
      |            ^
a.cc:11:8: error: 'a' was not declared in this scope
   11 |     if(a[i-1]>a[i]{
      |        ^
a.cc:15:3: error: expected primary-expression before 'return'
   15 |   return 0;
      |   ^~~~~~
a.cc:14:4: error: expected ')' before 'return'
   14 |   }
      |    ^
      |    )
   15 |   return 0;
      |   ~~~~~~
a.cc:11:7: note: to match this '('
   11 |     if(a[i-1]>a[i]{
      |       ^
a.cc:16:2: error: expected '}' at end of input
   16 | }
      |  ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

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

    

Compiler output:
a.cc: In function 'int main()':
a.cc:12:10: error: request for member 'at' in 'N', which is of non-class type 'int'
   12 |     if(N.at(i)>N.at(i+1)){
      |          ^~
a.cc:12:18: error: request for member 'at' in 'N', which is of non-class type 'int'
   12 |     if(N.at(i)>N.at(i+1)){
      |                  ^~
a.cc:13:14: error: request for member 'at' in 'N', which is of non-class type 'int'
   13 |       ans+=N.at(i)-N.at(i+1);
      |              ^~
a.cc:13:22: error: request for member 'at' in 'N', which is of non-class type 'int'
   13 |       ans+=N.at(i)-N.at(i+1);
      |                      ^~
Language: C++

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

int main() {
  int N,chukan=0;
  long long sum=0
  cin >> N;
  vector<int> vec(N);
  for(int i=0;i<N;i++)
  {
    cin >> vec[i];
  }
  for(int i=0;i<N;i++){
    chukan=max(chukan,vec[i]);
    sum += chukan - vec[i];
  }
  cout << sum;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: expected ',' or ';' before 'cin'
    7 |   cin >> N;
      |   ^~~
Language: C++

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

int main() {
  int N,chukan=0;
  long long sum=0
  cin >> N;
  vector<int> vec(N);
  for(int i=0;i<N;i++){
    cin >> vec[i];
  }
  for(int i=0;i<N;i++){
    chukan=max(chukan,vec[i]);
    sum += chukan - vec[i];
  }
  cout << sum;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: expected ',' or ';' before 'cin'
    7 |   cin >> N;
      |   ^~~
Language: C

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

int main() {
  int N,sum=0,chukan=0;
  vector<int> vec(N);
  for(int i=0;i<N;i++){
    cin >> vec[i];
  }
  for(int i=0;i<N-1;i++){
    chukan=max(chukan,vec[i]);
    sum += chukan = vec[i];
  }
  cout << sum;
  return 0;
}

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;
int main();
{
  int n;
  cin>>n;
  int ans=0;
  int x;
  int max=0; 
  for (int i=0;i<n;i++)
  {
    cin>>x;
    if (x<max)
      ans+=max-x; 
    else
      max=x;
  }
  cout<<ans;
  return 0;
}

Compiler output:
a.cc:4:1: error: expected unqualified-id before '{' token
    4 | {
      | ^
Language: C++

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

int main() {
  long int N, sum = 0, max;
  cin >> N;
  vector<long int> a(N);
  rep(i,N) cin >> a.at(i);
  max = a.at(0);
  rep(i,N-1) {
    if(x <= a.at(i+1)) x = a.at(i+1);
    else sum += (x - a.at(i+1));
  }
  cout << sum << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:8: error: 'x' was not declared in this scope
   12 |     if(x <= a.at(i+1)) x = a.at(i+1);
      |        ^
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();
        BigInteger[] nums = new BigInteger[N];


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

        BigInteger sum = BigInteger.ZERO;
        for (int i = 1; i < N; i++) {
            if (nums[i-1].compareTo(nums[i]) > 0) {
                BigInteger b = nums[i - 1].subtract(nums[i]);

                sum = sum.add(b);
                nums[i] =nums[i].add(b);
            }
        }

        System.out.println(sum);

    }
}

Compiler output:
Main.java:9: error: cannot find symbol
        BigInteger[] nums = new BigInteger[N];
        ^
  symbol:   class BigInteger
  location: class Main
Main.java:9: error: cannot find symbol
        BigInteger[] nums = new BigInteger[N];
                                ^
  symbol:   class BigInteger
  location: class Main
Main.java:16: error: cannot find symbol
        BigInteger sum = BigInteger.ZERO;
        ^
  symbol:   class BigInteger
  location: class Main
Main.java:16: error: cannot find symbol
        BigInteger sum = BigInteger.ZERO;
                         ^
  symbol:   variable BigInteger
  location: class Main
Main.java:19: error: cannot find symbol
                BigInteger b = nums[i - 1].subtract(nums[i]);
                ^
  symbol:   class BigInteger
  location: class Main
5 errors
Language: Java

import java.util.*;
public class Main{   
public static void main(String[] args) {
   Scanner sc = new Scanner(System.in);
         String str = sc.nextLine();
        int a = Integer.parseInt(str);
  int aa[] = new int[a];
        aa[0]=scanner.nextInt();
        int sum =0;
        for (int i = 1; i <a ; i++) {
            aa[i]=scanner.nextInt();
          if(aa[i]-aa[i-1]>=0)
          {
              continue;
          }else
          {
              sum+=aa[i-1]-aa[i];
              aa[i]=aa[i-1];
          }
        }
          System.out.println(sum);
    
    }
}

Compiler output:
Main.java:8: error: cannot find symbol
        aa[0]=scanner.nextInt();
              ^
  symbol:   variable scanner
  location: class Main
Main.java:11: error: cannot find symbol
            aa[i]=scanner.nextInt();
                  ^
  symbol:   variable scanner
  location: class Main
2 errors
Language: Java

import java.util.*;
public class Main{   
public static void main(String[] args) {
   Scanner s = new Scanner(System.in);
         String str = sc.nextLine();
        int a = Integer.parseInt(str);
  int aa[] = new int[a];
        aa[0]=scanner.nextInt();
        int sum =0;
        for (int i = 1; i <a ; i++) {
            aa[i]=scanner.nextInt();
          if(aa[i]-aa[i-1]>=0)
          {
              continue;
          }else
          {
              sum+=aa[i-1]-aa[i];
              aa[i]=aa[i-1];
          }
        }
          System.out.println(sum);
    
    }
}

Compiler output:
Main.java:5: error: cannot find symbol
         String str = sc.nextLine();
                      ^
  symbol:   variable sc
  location: class Main
Main.java:8: error: cannot find symbol
        aa[0]=scanner.nextInt();
              ^
  symbol:   variable scanner
  location: class Main
Main.java:11: error: cannot find symbol
            aa[i]=scanner.nextInt();
                  ^
  symbol:   variable scanner
  location: class Main
3 errors
Language: Java

import java.util.*;
public class Main{   
public static void main(String[] args) {
   Scanner scanner = new Scanner(System.in);
         String str = sc.nextLine();
        int a = Integer.parseInt(str);
  int aa[] = new int[a];
        aa[0]=scanner.nextInt();
        int sum =0;
        for (int i = 1; i <a ; i++) {
            aa[i]=scanner.nextInt();
          if(aa[i]-aa[i-1]>=0)
          {
              continue;
          }else
          {
              sum+=aa[i-1]-aa[i];
              aa[i]=aa[i-1];
          }
        }
          System.out.println(sum);
    
    }
}

Compiler output:
Main.java:5: error: cannot find symbol
         String str = sc.nextLine();
                      ^
  symbol:   variable sc
  location: class Main
1 error
Language: C++

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


Compiler output:
a.cc: In function 'int main()':
a.cc:8:22: error: expected primary-expression before ']' token
    8 |  ll *arr = new int[ll];
      |                      ^
a.cc:8:22: error: cannot convert 'int*' to 'll*' {aka 'long long int*'} in initialization
    8 |  ll *arr = new int[ll];
      |                      ^
      |                      |
      |                      int*
Language: C++

#include<iostream>
#include<string>
#include<cmath>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cctype>
 
using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<char> vc;

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 3;

#define sortA(v) sort(v.begin(), v.end())
#define fill(a) memset(a, 0, sizeof(a))

#define FOR(i, a, b) for(int i = a; i < b; i++)
#define FOR_REV(i, a ,b) for(int i = a; i >= b; i--)
#define REP(i, n) FOR(i, 0, n)


void test() {
    int n;
    cin >> n;
    vll a(n);
    REP(i, n) {
        cin >> a[i];
    }
    ll sum = 0;
    ll high = a[0];
    FOR(i, 1, n) {
        if(a[i] < high) {
            sum += high - a[i];
        }
        else {
            high = a[i];
        }
    }
    cout << sum << endl;
}   
 
int main ()     
{
    // int t;
    // cin >> t;
    // while(t--) 
        test();
}


Compiler output:
a.cc: In function 'void test()':
a.cc:31:5: error: 'vll' was not declared in this scope; did you mean 'll'?
   31 |     vll a(n);
      |     ^~~
      |     ll
a.cc:33:16: error: 'a' was not declared in this scope
   33 |         cin >> a[i];
      |                ^
a.cc:36:15: error: 'a' was not declared in this scope
   36 |     ll high = a[0];
      |               ^
Language: C++

#include <bits/stdc++.h>
#include<iostream>
using namespace std;
 
int main() {
    int a,b,c,d,tmp,max;
    string s;
 	long long 
    a = b = c = d = ans = tmp = 0;
    

    cin >> a;
    vector<int>x(a);
  	for(int i =0;i < a;i++){
      cin >> x[i];
    }
  
   for(int i = 1;i < a;i++){
     if(x[i] < x[i-1]){
       ans += x[i-1] - x[i];
     }
   }
   cout << ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: conflicting declaration 'long long int a'
    9 |     a = b = c = d = ans = tmp = 0;
      |     ^
a.cc:6:9: note: previous declaration as 'int a'
    6 |     int a,b,c,d,tmp,max;
      |         ^
a.cc:9:21: error: 'ans' was not declared in this scope; did you mean 'abs'?
    9 |     a = b = c = d = ans = tmp = 0;
      |                     ^~~
      |                     abs
Language: C++

#include <bits/stdc++.h>
#include<iostream>
using namespace std;
 
int main() {
    int a,b,c,d,ans,tmp,max;
    string s;
 
    a = b = c = d = ans = tmp = 0;
    

    cin >> a;
    vector<int>x(a);
  	for(int i =0;i < a;i++){
      cin >> x[i];
    }
  
    tmp = x.size()-1;
    for(int i = tmp;i > 2;i--){
      
      max = *std::max_element(0, x.end()-d);
      if(x[i] < max){
        ans += max = x[i];
      }
      d++;
    }
   cout << ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:30: error: no matching function for call to 'max_element(int, __gnu_cxx::__normal_iterator<int*, std::vector<int> >)'
   21 |       max = *std::max_element(0, x.end()-d);
      |              ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:5641:5: note: candidate: 'template<class _FIter> constexpr _FIter std::max_element(_FIter, _FIter)'
 5641 |     max_element(_ForwardIterator __first, _ForwardIterator __last)
      |     ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5641:5: note:   template argument deduction/substitution failed:
a.cc:21:30: note:   deduced conflicting types for parameter '_FIter' ('int' and '__gnu_cxx::__normal_iterator<int*, std::vector<int> >')
   21 |       max = *std::max_element(0, x.end()-d);
      |              ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5666:5: note: candidate: 'template<class _FIter, class _Compare> constexpr _FIter std::max_element(_FIter, _FIter, _Compare)'
 5666 |     max_element(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5666:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:524:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::max_element(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Compare)'
  524 | max_element(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Compare __comp);
      | ^~~~~~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:524:1: note:   candidate expects 4 arguments, 2 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:528:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::max_element(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator)'
  528 | max_element(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last);
      | ^~~~~~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:528:1: note:   candidate expects 3 arguments, 2 provided
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pint = pair<int, int>;

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

  ll ans = 0;
  int ma = a[0];
  if (int i = 1; i < n; i++)
  {
    if (a[i] < ma)
    {
      ans += ma - a[i];
      ma = max(ma, a[i]);
    }
  }

  cout << ans << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:23: error: expected ')' before ';' token
   18 |   if (int i = 1; i < n; i++)
      |      ~                ^
      |                       )
a.cc:18:25: error: 'i' was not declared in this scope
   18 |   if (int i = 1; i < n; i++)
      |                         ^
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;



int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    long long int ma = a[0];
    long long ans = 0;
    vector<int> b(n);
    for(int i=0;i<n-1;i++)
        if(a[i]<ma) ans+=(ma-a[i]),ma=max(ma,a[i]);
    cout<<ans;
    return 0;
}


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

#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;



int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    long long int ma = a[0];
    vector<int> b(n);
    for(int i=0;i<n-1;i++)
        if(a[i]<ma) ans+=(ma-a[i]),ma=max(ma,a[i]);
    cout<<ans;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:21: error: 'ans' was not declared in this scope; did you mean 'abs'?
   19 |         if(a[i]<ma) ans+=(ma-a[i]),ma=max(ma,a[i]);
      |                     ^~~
      |                     abs
a.cc:19:42: error: no matching function for call to 'max(long long int&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   19 |         if(a[i]<ma) ans+=(ma-a[i]),ma=max(ma,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:19:42: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   19 |         if(a[i]<ma) ans+=(ma-a[i]),ma=max(ma,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:19:42: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   19 |         if(a[i]<ma) ans+=(ma-a[i]),ma=max(ma,a[i]);
      |                                       ~~~^~~~~~~~~
a.cc:20:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   20 |     cout<<ans;
      |           ^~~
      |           abs
Language: C

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

Compiler output:
main.c:2:1: error: expected ';' before 'int'
    2 | ​
      | ^
      | ;
    3 | int main(void){
      | ~~~
main.c: In function 'main':
main.c:8:1: error: unknown type name '\U0000200b'
    8 | ​
      |  
main.c:9:11: error: expected declaration specifiers or '...' before string constant
    9 |     scanf("%d", &n);
      |           ^~~~
main.c:9:17: error: expected declaration specifiers or '...' before '&' token
    9 |     scanf("%d", &n);
      |                 ^
main.c:10:1: error: '\U0000200b' undeclared (first use in this function)
   10 | ​
      |  
main.c:10:1: note: each undeclared identifier is reported only once for each function it appears in
main.c:10:1: error: expected ';' before 'for'
   10 | ​
      | ^
      | ;
   11 |     for(int i = 0; i < n; i++){
      |     ~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define freop freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define st string
typedef long long ll;
 
void solve(){
     int n, ans;
     cin >> n;
     int arr[n];
     for(int i = 0; i < n; i++){
         cin >> arr[i];
     }
  	 int aux = arr[0];
  	 int ans = 0;
     for(int i = 1; i < n; i++){
         if(aux > arr[i]) {
             ans += aux - arr[i];
             
         }
         aux = max(aux, arr[i]);
     }
     cout << ans;
}
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:15:14: error: redeclaration of 'int ans'
   15 |          int ans = 0;
      |              ^~~
a.cc:8:13: note: 'int ans' previously declared here
    8 |      int n, ans;
      |             ^~~
Language: C

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


Compiler output:
main.c:2:1: error: expected ';' before 'int'
    2 | ​
      | ^
      | ;
    3 | int main(void){
      | ~~~
main.c: In function 'main':
main.c:8:1: error: unknown type name '\U0000200b'
    8 | ​
      |  
main.c:9:11: error: expected declaration specifiers or '...' before string constant
    9 |     scanf("%d", &n);
      |           ^~~~
main.c:9:17: error: expected declaration specifiers or '...' before '&' token
    9 |     scanf("%d", &n);
      |                 ^
main.c:10:1: error: '\U0000200b' undeclared (first use in this function)
   10 | ​
      |  
main.c:10:1: note: each undeclared identifier is reported only once for each function it appears in
main.c:10:1: error: expected ';' before 'for'
   10 | ​
      | ^
      | ;
   11 |     for(int i = 0; i < n; i++){
      |     ~~~
main.c:23:5: error: expected declaration or statement at end of input
   23 |     return 0;
      |     ^~~~~~
Language: C

#include <stdio.h>
​
int main(void){
    int n = 0;
    int max = 0;
    int temp = 0;
    long long sum = 0;
​
    scanf("%d", &n);
​
    for(int i = 0; i < n; i++){
        scanf("%d", &temp);
​
        if(temp < max){
            sum += (max - temp);
        } else {
            max = temp;
        }
    }
​
    printf("%ld",sum);
    
    return 0;


Compiler output:
main.c:2:1: error: expected ';' before 'int'
    2 | ​
      | ^
      | ;
    3 | int main(void){
      | ~~~
main.c: In function 'main':
main.c:8:1: error: unknown type name '\U0000200b'
    8 | ​
      |  
main.c:9:11: error: expected declaration specifiers or '...' before string constant
    9 |     scanf("%d", &n);
      |           ^~~~
main.c:9:17: error: expected declaration specifiers or '...' before '&' token
    9 |     scanf("%d", &n);
      |                 ^
main.c:10:1: error: '\U0000200b' undeclared (first use in this function)
   10 | ​
      |  
main.c:10:1: note: each undeclared identifier is reported only once for each function it appears in
main.c:10:1: error: expected ';' before 'for'
   10 | ​
      | ^
      | ;
   11 |     for(int i = 0; i < n; i++){
      |     ~~~
main.c:23:5: error: expected declaration or statement at end of input
   23 |     return 0;
      |     ^~~~~~
Language: C++

#include <iostream>
#include <string>
#include <map>
#include <set>
#include <cstring>
#include <vector>
#include <cmath>
#include <algorithm>
#define ll long long
//for (auto &x : a) { cin >> x; }
using namespace std;

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

    ll n;
    cin >> n;
    ll a[10e9];
    for(ll i=0; i<n; i++){
        cin >> a[i];
    }
    ll wm = 0;
    ll ans = 0;
    for(ll i=0; i<n; i++){
        if(a[i] < wm){
            ans += wm - a[i];
            a[i] = wm;
        }
        wm = max(wm, a[i]);
    }
    cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:10: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
   19 |     ll a[10e9];
      |          ^~~~
a.cc:19:10: error: could not convert '1.0e+10' from 'double' to 'long unsigned int'
   19 |     ll a[10e9];
      |          ^~~~
      |          |
      |          double
a.cc:19:10: error: size of array 'a' has non-integral type 'double'
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
int main(){
  int n; cin >> n;
  int a[n];
  rep(i, n) cin >> a[i];
  ll mx = -1, ans = 0;
  rep(i, n){
    mx = max(mx, a[i]);
    ans += max(mx - a[i], (ll)0);
  }
  cout << ans << endl;
  return 0;
}


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