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

#include<bits/stdc++.h>

using namespace std;
int main(){
	int size;
	cin >> size;
	vector<long>values;
	for(int i=0; i<size; i++){
		int next;cin>>next;
		values.push_back(next);
	}
	
	int maxx=values.at(0);
	long answer=0;
	for(int i=1; i<size; i++){
			maxx= max(maxx,values.at(i));
			answer+=(maxx-values.at(i));
		
	}
	cout << answer;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:34: error: no matching function for call to 'max(int&, __gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type&)'
   16 |                         maxx= max(maxx,values.at(i));
      |                               ~~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:16:34: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'})
   16 |                         maxx= max(maxx,values.at(i));
      |                               ~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:16:34: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   16 |                         maxx= max(maxx,values.at(i));
      |                               ~~~^~~~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
  
using namespace std;
int main(){
        int size;
        cin >> size;
        vector<int>values;
        for(int i=0; i<size; i++){
                int next;cin>>next;
                values.push_back(next);
        }

        int maxx=values.at(0);
        int answer=0;
        for(int i=0; i<size; i++){
                        maxx= max(maxx,values.at(i));
                        answer+=(maxx-values.at(i));

        }
        cout << answer;

}
~      

Compiler output:
a.cc:23:2: error: expected class-name at end of input
   23 | ~
      |  ^
Language: C++

using namespace std;



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N;
    vector<long long > List;
    long long result = 0;
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        long long temp;
        cin >> temp;
        List.push_back(temp);
    }
    for (int i = 1; i < N; i++)
    {
        if (List[i] < List[i - 1])
        {
            result += List[i - 1] - List[i];
            List[i] = List[i - 1];
        }
    }
    cout<<result;
    

    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'ios_base' has not been declared
    7 |     ios_base::sync_with_stdio(false);
      |     ^~~~~~~~
a.cc:8:5: error: 'cin' was not declared in this scope
    8 |     cin.tie(NULL);
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:8:13: error: 'NULL' was not declared in this scope
    8 |     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 | using namespace std;
a.cc:10:5: error: 'vector' was not declared in this scope
   10 |     vector<long long > List;
      |     ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | using namespace std;
a.cc:10:12: error: expected primary-expression before 'long'
   10 |     vector<long long > List;
      |            ^~~~
a.cc:17:9: error: 'List' was not declared in this scope
   17 |         List.push_back(temp);
      |         ^~~~
a.cc:21:13: error: 'List' was not declared in this scope
   21 |         if (List[i] < List[i - 1])
      |             ^~~~
a.cc:27:5: error: 'cout' was not declared in this scope
   27 |     cout<<result;
      |     ^~~~
a.cc:27:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include<iostream>
int main()
{
  int n;
  cin>>n;
  for(int i=0;i<n;i++)
  {
    long long int temp,a,count=0;
    cin>>a;
    if(temp>a)
      count+=temp-a;
    temp=a;#include<iostream>
using namespace std;
int main()
{
  int n;
  cin>>n;
  long long int count=0,temp=0,a;
  for(int i=0;i<n;i++)
  {
    cin>>a;
    if(temp>a)
    {
      count+=(temp-a);
      continue;
    } 
    temp=a;  
  }
  cout<<count<<endl;
  return 0;
} 
    
  }
  cout<count<<endl;
  return 0;
} 
    

Compiler output:
a.cc:12:12: error: stray '#' in program
   12 |     temp=a;#include<iostream>
      |            ^
a.cc: In function 'int main()':
a.cc:5:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    5 |   cin>>n;
      |   ^~~
      |   std::cin
In file included 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:12:13: error: 'include' was not declared in this scope
   12 |     temp=a;#include<iostream>
      |             ^~~~~~~
a.cc:12:21: error: 'iostream' was not declared in this scope; did you mean 'std::iostream'?
   12 |     temp=a;#include<iostream>
      |                     ^~~~~~~~
      |                     std::iostream
In file included from /usr/include/c++/14/ios:40,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/iosfwd:146:41: note: 'std::iostream' declared here
  146 |   typedef basic_iostream<char>          iostream;
      |                                         ^~~~~~~~
a.cc:13:1: error: expected primary-expression before 'using'
   13 | using namespace std;
      | ^~~~~
a.cc:14:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   14 | int main()
      |         ^~
a.cc:14:9: note: remove parentheses to default-initialize a variable
   14 | int main()
      |         ^~
      |         --
a.cc:14:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:15:1: error: a function-definition is not allowed here before '{' token
   15 | {
      | ^
a.cc:34:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   34 |   cout<count<<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:34:8: error: 'count' was not declared in this scope
   34 |   cout<count<<endl;
      |        ^~~~~
a.cc:34:15: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   34 |   cout<count<<endl;
      |               ^~~~
      |               std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int i,j,a,size,temp,num,count=0;
	cin >> size;
	vector<int> arr(size);
	for(i=0;i<size;i++)
		cin >> arr[i];
	for(i=0;i<size-1;i++)
	{
		if(arr[i+1] < arr[i])
		{
			temp = (arr[i] - arr[i+1]);
			arr[i+1] = a[i];
			count += temp;
		}
	}
	for(i=0;i<size;i++)
		cout << arr[i] << endl;
	//cout << count << endl;
	//return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:37: error: invalid types 'int[int]' for array subscript
   15 |                         arr[i+1] = a[i];
      |                                     ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
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-1; i++)
	{
      if(A[i]>=A[i+1])
		ans += A[i]-A[i+1];
      A[i+1]=A[i]
	}

	cout << ans << endl;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:21:18: error: expected ';' before '}' token
   21 |       A[i+1]=A[i]
      |                  ^
      |                  ;
   22 |         }
      |         ~
Language: C++

#include <iostream>

using namespace std;

int main() {
 	ing n;
  	cin >> n;
  	long long arr[n];
  
  	int sum = 0;
  	for (int i = 1; i < n; i++) {
     	if (arr[i - 1] > arr[i]) sum += (arr[i - 1] - arr[i]);
    }
  
  	cout << sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'ing' was not declared in this scope; did you mean 'int'?
    6 |         ing n;
      |         ^~~
      |         int
a.cc:7:16: error: 'n' was not declared in this scope
    7 |         cin >> n;
      |                ^
a.cc:12:13: error: 'arr' was not declared in this scope
   12 |         if (arr[i - 1] > arr[i]) sum += (arr[i - 1] - arr[i]);
      |             ^~~
Language: C++

#include<bits/stdc++.h>
#define ll long long
#define nl "\n"
#define pi acos(-1)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define pcase printf("Case %d:\n",ca)
int ca=1;
using namespace std;
int main(){
   int a;
   cin>>a;
   int arr[a];
   for(int i = 0;i<a;i++){
    cin>>arr[i];
   }
   ll ma = arr[0];
   ll ans = 0;
   for(int i = 1;i<a;i++){
        ma = max(arr[i],ma);
    if(arr[i]<ma){
        ans+=ma-arr[i];
    }
   }
   cout<<ans<<nl;
   }




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

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

typedef long long int ll;
int main(){
 int n;
 cin>>n;
 vector<int>v(n);
 int ar[n],i,m,ans=0;
 for(i=0;i<n;i++){
 	//cin>>ar[i];
 	cin>>v.at(i);
 }
 int l=n;
vector<int>::iterator it;
it=v.end()-1;
 while(l--){
 	m=max_element(v.begin(),it)-v.begin();
 //	cout<<"max index:"<<v[m]<<endl;
 //cout<<"iterator valut: "<<*it<<endl;
 	if(*it<v[m]){ans=ans+(v[m]-*it);
	 }
	 it--;
 }
 cout<<ans;
	return 0;
}

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

/*
    Author:    DreamCat4er
    Created:   22.08.2020 18:20:37
*/
#include <bits/stdc++.h>
using namespace std;

void solve() {
    int n;
    cin >> n;
    vector <long long> a(n);
    for (long long &i : a)
        cin >> i;

    long long mx = a[0], ans = 0;
    for (int i = 1; i < n; ++i) {
        ans += max(0, mx - a[i]);
        mx = max(mx, a[i]);
    }

    cout << ans << "\n";
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
                
    #ifdef _LOCAL
        int t;
        cin >> t;
        for (int _t = 0; _t < t; ++_t) {
            cout << "Case " << _t << " :\n";
            solve();
            cout << "\n";
        }
    #else
        solve();
    #endif // _LOCAL

    return 0;
}

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

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

int main(){
  int h,w,m; cin>>h>>w>>m;
  int bombh[m],bombw[m];
  map<int,int> counth,countw;
  for(int i=0;i<m;i++){
    cin>>bombh[i]>>bombw[i]; bombh[i]--; bombw[i]--;
    counth[bombh[i]]++; countw[bombw[i]]++;
  }
  int hmax=0,wmax=0;
  for(auto p:counth){
    hmax=max(hmax,p.second);
  }
  for(auto p:countw){
    wmax=max(wmax,p.second);
  }
  int ans=hmax+wmax-1;
  cout<<ans;
  int acmaxhcount=0,acmaxwcount=0;
  vector<int> acmaxh,acmaxw;
  for(auto p:counth){
    if(p.second==hmax){
      acmaxhcount++;
      acmaxh.push_back(p.first);
    }
  }
  for(auto p:countw){
    if(p.second==wmax){
      acmaxwcount++;
      acmaxw.push_back(p.first);
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:3: error: 'vector' was not declared in this scope
   23 |   vector<int> acmaxh,acmaxw;
      |   ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include<map>
  +++ |+#include <vector>
    3 | using namespace std;
a.cc:23:10: error: expected primary-expression before 'int'
   23 |   vector<int> acmaxh,acmaxw;
      |          ^~~
a.cc:27:7: error: 'acmaxh' was not declared in this scope
   27 |       acmaxh.push_back(p.first);
      |       ^~~~~~
a.cc:33:7: error: 'acmaxw' was not declared in this scope
   33 |       acmaxw.push_back(p.first);
      |       ^~~~~~
Language: C

#include <stdio.h>

int main () {

	int N;
	
	scanf("%d", &N);
	
	int A[N];
	for(int Ai = 0; Ai < N; Ai++) {
		scanf("%d", &A[Ai]);
	}
	
	long long  total_hight = 0;
	int max = A[0];
	for(int Ai = 1; Ai < N; Ai++) {
            
		if(tmp > A[Ai]) {
           //printf("max %d - A[i] %d total_hight= %d\n", max, A[Ai], max - A[Ai]);
			total_hight += max - A[Ai];
		} else {
	      	max = A[Ai];
        }  
	}
	
	printf("%lld", total_hight);
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:18:20: error: 'tmp' undeclared (first use in this function)
   18 |                 if(tmp > A[Ai]) {
      |                    ^~~
main.c:18:20: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>

int main () {

	int N;
	
	scanf("%d", &N);
	
	int A[N];
	for(int Ai = 0; Ai < N; Ai++) {
		scanf("%d", &A[Ai]);
	}
	
	long long  total_hight = 0;
	int max = A[0];
	for(int Ai = 1; Ai < N; ++Ai) {
            
		if(tmp > A[Ai]) {
           //printf("tmp %d - A[i] %d total_hight= %d\n", tmp, A[Ai], tmp - A[Ai]);
			total_hight += max - A[Ai];
		} else {
	      	max = A[Ai];
        }  
	}
	
	printf("%d", total_hight);
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:18:20: error: 'tmp' undeclared (first use in this function)
   18 |                 if(tmp > A[Ai]) {
      |                    ^~~
main.c:18:20: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include<iostream>
#include<vector>
int main(){
  int n;
  std::cin>>n;
  std::vector<int> a(n);
  for(auto& ai:a)std::cin>>ai;
  int64_t answer = 0;
  for(int i=1;i<n;++i){
    if(a[i-1]>a[i]){
      answer += a[i-1]-a[i];
      a[i] = a[i-1];
    }
  }
  std::cout<<answer<<std::endl;

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

#include <stdio.h>

int main () {

	int N;
	int A[10000000];
	
	scanf("%d", &N);
	for(int Ai = 0; Ai < N; Ai++) {
		scanf("%d", &A[Ai]);
	}
	
	int total_hight = 0;
	int tmp = A[0];
	for(int Ai = 1; A[Ai] != 0; ++Ai) {
		if(tmp > A[Ai]) {
			//printf("A[Ai + 1]= %d\n", A[Ai + 1]);
			//printf("total_hight= %d\n", A[Ai] - A[Ai + 1]);
			total_hight += tmp - A[Ai];
			total_hight = A[Ai]
		}
	}
	
	printf("%d", total_hight);
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:20:44: error: expected ';' before '}' token
   20 |                         total_hight = A[Ai]
      |                                            ^
      |                                            ;
   21 |                 }
      |                 ~
Language: C++

#include<iostream>
#include<vector>
using namespace std;
int main() {
    int N;
    cin >> N;
    int m = 0;
    vector<int>a(N);
    for (int i = 0; i < N; i++)cin >> a[i];
    for (int i = 1; i < N; i++) {
        m=a[i]-a[i-1]
    }
    cout << m << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:22: error: expected ';' before '}' token
   11 |         m=a[i]-a[i-1]
      |                      ^
      |                      ;
   12 |     }
      |     ~
Language: C++

#include<iostream>
#include<vector>
int main(){
  int N;
  std::cin >> N;
  std::vector<int>a(N);//cin
  for(int i = 0; i < N; i++){
    int b;
    std::cin >> b;
    a.push_back(b);
  }
  int step=0;
  std::vector<int>c;//diff
  std::vector<int>d;//after
  d.push_back(a[0]);
  for(int j = 1; j < N; j++){
    if(a[j-1]<=a[j]){
      c.push_back(0);
      d.push_back(a[j]);
    }
    else if(a[j-1]>a[j]){
      c.push_back(std::abs(a[j]-d[j-1]));
      d.push_back(a[j]+std::abs(a[j]-d[j-1]));
    }
    int k;
    int sum=0;
    for(k=0;k<N;k++){
      sum=sum+c[k];
    }
    std::cout << sum << std::endl;
  }

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

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

Compiler output:
a.cc:3:7: error: expected nested-name-specifier before 'namepsace'
    3 | using namepsace std;
      |       ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 |   cin >> n;
      |   ^~~
      |   std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:20:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   20 |   cout << ans;
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:14:10: error: no matching function for call to 'max(long long int&, int&)'
   14 |    m1=max(m1,a[i]);
      |       ~~~^~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:14:10: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   14 |    m1=max(m1,a[i]);
      |       ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:14:10: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   14 |    m1=max(m1,a[i]);
      |       ~~~^~~~~~~~~
Language: C++

#include<bits/stdc++.h>

using namespace std;

const int N=2e5;

long long ans,a[N+2];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    int i,n;
    cin >> n;
    for(i=1;i<=n;i++)cin >> a[i];
    for(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;
}ree DP & Rerooting technique


Compiler output:
a.cc:22:2: error: 'ree' does not name a type
   22 | }ree DP & Rerooting technique
      |  ^~~
Language: C++

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

Compiler output:
a.cc:2:17: error: 'stf' is not a namespace-name
    2 | using namespace stf;
      |                 ^~~
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 |   cin>>n;
      |   ^~~
      |   std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:12:10: error: 'max' was not declared in this scope; did you mean 'std::max'?
   12 |     ans+=max(0,a[i-1]-a[i]);
      |          ^~~
      |          std::max
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:13:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   13 |   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:13:14: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   13 |   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)
      |     ^~~~
Language: C++

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

int main() {
  long N;cin>>N;
  vector<long> A(N);
  for(int i=0;i<N;i++) cin>>A.at(i);
  long ans=0;
  for(int i=0;i<N-1;i++){
    if(A.at(i)>A.at(i+1)){
      ans+=A.at(i)-A.at(i+1);
      A.at(i+1)=A.at(i);
  }
  cout<<ans<<endl;
}


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

#include <iostream>
#include <vector>

using namespace std;

int main(){
  long long n;
  std::cin >> n;

  vector<long long> a(n);

  long long ans = 0;

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

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

  for(int i=0; i<n; i++) std::cout << a[i] << '\n';

  std::cout << ans << '\n';
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:15: error: no matching function for call to 'max(int, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)'
   19 |     ans += max(0, a[i - 1] - a[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:19:15: 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'})
   19 |     ans += max(0, a[i - 1] - 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
a.cc:20:16: error: no matching function for call to 'max(int, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)'
   20 |     a[i] += max(0, a[i - 1] - a[i]);
      |             ~~~^~~~~~~~~~~~~~~~~~~~
/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:16: 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'})
   20 |     a[i] += max(0, a[i - 1] - 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
Language: Java

import java.util.*;

public class B176_C_Step {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int loop = sc.nextInt();
        int[] array = new int[loop];
        int count = 0;
        for(int i = 0; i < loop; i++) {
            array[i] = sc.nextInt();
        }
        if(loop == 1){
            System.out.println("0");
        }
        else{
            for(int i = 0; i < (loop - 1); i++) {
                int temp = array[i];
                int next = array[i+1];
                if(next < temp){
                    count += (temp - next);
                    array[i+1] = temp;
                }
            }
            System.out.println(count);
        }

    }
}


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

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

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

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'll' was not declared in this scope
    6 |         ll n;
      |         ^~
a.cc:7:14: error: 'n' was not declared in this scope; did you mean 'yn'?
    7 |         cin>>n;
      |              ^
      |              yn
a.cc:8:11: error: expected ';' before 'arr'
    8 |         ll arr[n];
      |           ^~~~
      |           ;
a.cc:10:12: error: 'arr' was not declared in this scope
   10 |       cin>>arr[i];
      |            ^~~
a.cc:11:11: error: expected ';' before 'ans'
   11 |         ll ans=0;
      |           ^~~~
      |           ;
a.cc:13:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   13 |       ans+=max(0, arr[i-1]-arr[i]);
      |       ^~~
      |       abs
a.cc:13:19: error: 'arr' was not declared in this scope
   13 |       ans+=max(0, arr[i-1]-arr[i]);
      |                   ^~~
a.cc:16:15: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |         cout<<ans;
      |               ^~~
      |               abs
Language: C

main(){
 int a;
  scanf("%d",&a);
  int t=0,i,
  long int b[20000000],k=0;
  for(i=0;i<a;i++){
    scanf("%ld",&b[i]);
  if(t<b[i]) t=b[i];
    else k+=t-b[i];
  }
printf("%ld",k);
}


Compiler output:
main.c:1:1: error: return type defaults to 'int' [-Wimplicit-int]
    1 | main(){
      | ^~~~
main.c: In function 'main':
main.c:3:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    3 |   scanf("%d",&a);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | main(){
main.c:3:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    3 |   scanf("%d",&a);
      |   ^~~~~
main.c:3:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:5:3: error: expected identifier or '(' before 'long'
    5 |   long int b[20000000],k=0;
      |   ^~~~
main.c:7:18: error: 'b' undeclared (first use in this function)
    7 |     scanf("%ld",&b[i]);
      |                  ^
main.c:7:18: note: each undeclared identifier is reported only once for each function it appears in
main.c:9:10: error: 'k' undeclared (first use in this function)
    9 |     else k+=t-b[i];
      |          ^
main.c:11:1: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   11 | printf("%ld",k);
      | ^~~~~~
main.c:11:1: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:11:1: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:11:1: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C++

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

int main()
{
	int n;

	cin >> n;
	vector<int> a(n);
	vector<int> f(n);

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

	int now = a[0];

	for(int i = 0;i<n;i++){
		if(now > a[i]){
			f[i] = now - a[i];
		}else if(now < a[i]){
			now = a[i];
		}
	}

	int cnt=0;
	for(int i=0;i<n;i++){
		cnt = cnt + f[i];
	}

/*
cout << "-------------" << endl;
	for(double i=0;i<n;i++){
		cout << f[i] << " ";
	}
	cout << endl;
	for(double i=0;i<n;i++){
		cout << f[i] + a[i] << " ";
	}
	cout << endl;
cout << "------------" << endl;
*/

	cout << cnt << endl;

	return 0;
}

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

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

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

main(){
 int a;
  scanf("%d",&a);
  int t=0,i,
  long int b[20000000],k=0;
  for(i=0;i<a;i++){
    scanf("%ld",&b[i]);
  if(t<b[i]) t=b[i];
    else k+=t-b[i];
  }
printf("%ld",k);
}

Compiler output:
main.c:1:1: error: return type defaults to 'int' [-Wimplicit-int]
    1 | main(){
      | ^~~~
main.c: In function 'main':
main.c:3:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    3 |   scanf("%d",&a);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | main(){
main.c:3:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    3 |   scanf("%d",&a);
      |   ^~~~~
main.c:3:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:5:3: error: expected identifier or '(' before 'long'
    5 |   long int b[20000000],k=0;
      |   ^~~~
main.c:7:18: error: 'b' undeclared (first use in this function)
    7 |     scanf("%ld",&b[i]);
      |                  ^
main.c:7:18: note: each undeclared identifier is reported only once for each function it appears in
main.c:9:10: error: 'k' undeclared (first use in this function)
    9 |     else k+=t-b[i];
      |          ^
main.c:11:1: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   11 | printf("%ld",k);
      | ^~~~~~
main.c:11:1: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:11:1: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:11:1: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C++

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

int main(){
	ll n,ans=0; cin >> n;
	vint a(n);
	rep(i,n) cin >> a[i];
	ll nowmax=a[0];
	for(ll i=1;i<n;i++) {
		if(a[i]<=nowmax) ans+=nowmax-a[i];
		else nowmax=a[i];
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'll' was not declared in this scope
    7 |         ll n,ans=0; cin >> n;
      |         ^~
a.cc:7:28: error: 'n' was not declared in this scope; did you mean 'yn'?
    7 |         ll n,ans=0; cin >> n;
      |                            ^
      |                            yn
a.cc:10:11: error: expected ';' before 'nowmax'
   10 |         ll nowmax=a[0];
      |           ^~~~~~~
      |           ;
a.cc:11:15: error: expected ';' before 'i'
   11 |         for(ll i=1;i<n;i++) {
      |               ^~
      |               ;
a.cc:11:20: error: 'i' was not declared in this scope
   11 |         for(ll i=1;i<n;i++) {
      |                    ^
a.cc:12:26: error: 'nowmax' was not declared in this scope
   12 |                 if(a[i]<=nowmax) ans+=nowmax-a[i];
      |                          ^~~~~~
a.cc:12:34: error: 'ans' was not declared in this scope; did you mean 'abs'?
   12 |                 if(a[i]<=nowmax) ans+=nowmax-a[i];
      |                                  ^~~
      |                                  abs
a.cc:15:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   15 |         cout << ans << endl;
      |                 ^~~
      |                 abs
Language: C

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

int main() {
  int n;
  scanf("%d\n", &n);
  int a[n];
  scanf("%d\n", &a[0]);
  int n2 = n - 1;
  int i = 1;
  int x;
  while(n2--){
    scanf("%d\n", &a[i++]);
    x = a[i] - a[i+1];
    if(x > 0)
      sum += x;
  }
  printf("%d\n", sum);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:17:7: error: 'sum' undeclared (first use in this function)
   17 |       sum += x;
      |       ^~~
main.c:17:7: note: each undeclared identifier is reported only once for each function it appears in
Language: C

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

int main() {
  int n;
  scanf("%d\n", &n);
  int a[n];
  scanf("%d\n", &a[0]);
  int n2 = n - 1;
  int i = 1;
  int x;
  while(n2--){
    scanf("%d\n", &a[i++]);
    x = strcmp(a[i], a[i+1]);
    if(x)
      sum += x;
  }
  printf("%d\n", sum);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:15:17: error: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   15 |     x = strcmp(a[i], a[i+1]);
      |                ~^~~
      |                 |
      |                 int
In file included from main.c:3:
/usr/include/string.h:156:32: note: expected 'const char *' but argument is of type 'int'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                    ~~~~~~~~~~~~^~~~
main.c:15:23: error: passing argument 2 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   15 |     x = strcmp(a[i], a[i+1]);
      |                      ~^~~~~
      |                       |
      |                       int
/usr/include/string.h:156:50: note: expected 'const char *' but argument is of type 'int'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                                      ~~~~~~~~~~~~^~~~
main.c:17:7: error: 'sum' undeclared (first use in this function)
   17 |       sum += x;
      |       ^~~
main.c:17:7: note: each undeclared identifier is reported only once for each function it appears in
Language: C

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

int main() {
  int n;
  scanf("%d\n", n);
  int a[n];
  scanf("%d\n", a);
  int n2 = n - 1;
  int i = 1;
  int x;
  while(n2--){
    scanf("%d\n", a++);
    x = strcmp(a[i], a[i+1]);
    if(x)
      sum += x;
  }
  printf("%d\n", sum);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:14:20: error: lvalue required as increment operand
   14 |     scanf("%d\n", a++);
      |                    ^~
main.c:15:17: error: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   15 |     x = strcmp(a[i], a[i+1]);
      |                ~^~~
      |                 |
      |                 int
In file included from main.c:3:
/usr/include/string.h:156:32: note: expected 'const char *' but argument is of type 'int'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                    ~~~~~~~~~~~~^~~~
main.c:15:23: error: passing argument 2 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   15 |     x = strcmp(a[i], a[i+1]);
      |                      ~^~~~~
      |                       |
      |                       int
/usr/include/string.h:156:50: note: expected 'const char *' but argument is of type 'int'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                                      ~~~~~~~~~~~~^~~~
main.c:17:7: error: 'sum' undeclared (first use in this function)
   17 |       sum += x;
      |       ^~~
main.c:17:7: note: each undeclared identifier is reported only once for each function it appears in
Language: Java

import java.util.Scanner;

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


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

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

int main() {
  int n;
  scanf("%d\n", n);
  int a[n];
  scanf("%d\n", a[0]);
  int n2 = n - 1;
  int i = 1;
  int x;
  while(n2--){
    scanf("%d\n", a[i++]);
    x = strcmp(a[i], a[i+1]);
    if(x)
      sum += x;
  }
  printf("%d\n", sum);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:15:17: error: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   15 |     x = strcmp(a[i], a[i+1]);
      |                ~^~~
      |                 |
      |                 int
In file included from main.c:3:
/usr/include/string.h:156:32: note: expected 'const char *' but argument is of type 'int'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                    ~~~~~~~~~~~~^~~~
main.c:15:23: error: passing argument 2 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   15 |     x = strcmp(a[i], a[i+1]);
      |                      ~^~~~~
      |                       |
      |                       int
/usr/include/string.h:156:50: note: expected 'const char *' but argument is of type 'int'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                                      ~~~~~~~~~~~~^~~~
main.c:17:7: error: 'sum' undeclared (first use in this function)
   17 |       sum += x;
      |       ^~~
main.c:17:7: note: each undeclared identifier is reported only once for each function it appears in