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

#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,dif;
	cin >> n;
	int[] r = new int[n];
	int currentMax = r[1] - r[0];
	for(int i = 1;i < n;i++){
		for(int j = 0;j < i;j++){
			dif = r[i] - r[j];
			if(dif > currentMax){
				currentMax = dif;
			}
		}
	}
	
	cout  << dif << endl;

	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:6:12: error: structured binding declaration cannot have type 'int'
    6 |         int[] r = new int[n];
      |            ^~
a.cc:6:12: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:6:12: error: empty structured binding declaration
a.cc:6:15: error: expected initializer before 'r'
    6 |         int[] r = new int[n];
      |               ^
a.cc:7:26: error: 'r' was not declared in this scope
    7 |         int currentMax = r[1] - r[0];
      |                          ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,dif;
	cin >> n;
	int r[] = new int[n];
	int currentMax = r[1] - r[0];
	for(int i = 1;i < n;i++){
		for(int j = 0;j < i;j++){
			dif = r[i] - r[j];
			if(dif > currentMax){
				currentMax = dif;
			}
		}
	}
	
	cout  << dif << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:19: error: initializer fails to determine size of 'r'
    6 |         int r[] = new int[n];
      |                   ^~~~~~~~~~
a.cc:6:19: error: array must be initialized with a brace-enclosed initializer
Language: C++

int main(){
	int n,dif;
	cin >> n;
	int* r = new int[n];
	for(int i = 0;i < n; i++){
		cin >> r[i];
	}
	int currentMax = r[1] - r[0];
	for(int i = 1;i < n;i++){
		for(int j = 0;j < i;j++){
			dif = r[i] - r[j];
			if(dif > currentMax){
				currentMax = dif;
			}
		}
	}
	
	cout  << currentMax << endl;

	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:3:9: error: 'cin' was not declared in this scope
    3 |         cin >> n;
      |         ^~~
a.cc:18:9: error: 'cout' was not declared in this scope
   18 |         cout  << currentMax << endl;
      |         ^~~~
a.cc:18:32: error: 'endl' was not declared in this scope
   18 |         cout  << currentMax << endl;
      |                                ^~~~
Language: C++

#include<bits/stdc++.h>

int main(){
	int n,dif;
	cin >> n;
	int* r = new int[n];
	for(int i = 0;i < n; i++){
		cin >> r[i];
	}
	int currentMax = r[1] - r[0];
	for(int i = 1;i < n;i++){
		for(int j = 0;j < i;j++){
			dif = r[i] - r[j];
			if(dif > currentMax){
				currentMax = dif;
			}
		}
	}
	
	cout  << currentMax << endl;

	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    5 |         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:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   20 |         cout  << currentMax << 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:20:32: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   20 |         cout  << currentMax << 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<iostream>
#include<algorithm>
using namespace std;

int main(){
    int r[200000],n;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>r[i];
    }
    int maxv=-200000;
    int minv=r[0];
    for(int i=1;i<n;i++){
        maxv=max(maxv,r[i]-minv);
        minv=min(minv,r[i];)
    }
    cout<<maxv<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:27: error: expected ')' before ';' token
   15 |         minv=min(minv,r[i];)
      |                 ~         ^
      |                           )
a.cc:15:28: error: expected primary-expression before ')' token
   15 |         minv=min(minv,r[i];)
      |                            ^
Language: C++

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


int main(){
    r[200000],n;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>r[i];
    }
    int maxv=-2000000000;
    int minv=r[0];
    for(int i=1;i<n;i++){
        maxv=max(maxv,r[i]-minv);
        minv=min(minv,r[i]);
    }
    cout<<maxv<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'r' was not declared in this scope
    7 |     r[200000],n;
      |     ^
a.cc:7:15: error: 'n' was not declared in this scope
    7 |     r[200000],n;
      |               ^
Language: C++

#include <iostream>

using namespace std;

int main() {
    int min, max;
    int max_delta;

    cin >> n;

    int i;
    for (i = 1; i < n; i++) {
        if (i == 1) {
            min = n;
            max = n;
        } else {
            if (min > n) {
                min = n;
            } else if (max < n) {
                max = n;
            }
        }
        max_delta = max - min;
    }
    cout << max_delta << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:12: error: 'n' was not declared in this scope
    9 |     cin >> n;
      |            ^
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
static const int MAX = 200000;

int main(){
  int R[MAX},n;
//入力部分↓
  cin >> n;
  for (int i = 0; i < n; i++) cin >> R[i];

  int maxv = R[1] - R[0];
  int minv = R[0];

  for (int i = 1; i < n; i++) {
    maxv = max(maxv,R[i] - minv);
    minv = min(minv,R[i]);
  }

  cout << maxv << endl;

  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:7:12: error: expected ']' before '}' token
    7 |   int R[MAX},n;
      |            ^
      |            ]
a.cc: At global scope:
a.cc:7:13: error: mixing declarations and function-definitions is forbidden
    7 |   int R[MAX},n;
      |             ^
a.cc:9:3: error: 'cin' does not name a type
    9 |   cin >> n;
      |   ^~~
a.cc:10:3: error: expected unqualified-id before 'for'
   10 |   for (int i = 0; i < n; i++) cin >> R[i];
      |   ^~~
a.cc:10:19: error: 'i' does not name a type
   10 |   for (int i = 0; i < n; i++) cin >> R[i];
      |                   ^
a.cc:10:26: error: 'i' does not name a type
   10 |   for (int i = 0; i < n; i++) cin >> R[i];
      |                          ^
a.cc:12:14: error: 'R' was not declared in this scope
   12 |   int maxv = R[1] - R[0];
      |              ^
a.cc:12:21: error: 'R' was not declared in this scope
   12 |   int maxv = R[1] - R[0];
      |                     ^
a.cc:13:14: error: 'R' was not declared in this scope
   13 |   int minv = R[0];
      |              ^
a.cc:15:3: error: expected unqualified-id before 'for'
   15 |   for (int i = 1; i < n; i++) {
      |   ^~~
a.cc:15:19: error: 'i' does not name a type
   15 |   for (int i = 1; i < n; i++) {
      |                   ^
a.cc:15:26: error: 'i' does not name a type
   15 |   for (int i = 1; i < n; i++) {
      |                          ^
a.cc:20:3: error: 'cout' does not name a type
   20 |   cout << maxv << endl;
      |   ^~~~
a.cc:22:3: error: expected unqualified-id before 'return'
   22 |   return 0;
      |   ^~~~~~
a.cc:23:1: error: expected declaration before '}' token
   23 | }
      | ^
Language: C++

#include<iostream>
#include
using namespace std;
int main(){
    long n, minv=0, maxv=-2000000000;
    cin >> n;
    int r[n];
    for(int i=0;i<n;i++){
        cin >> r[i];
    }
    
    minv = r[0];
    for(int i=0;i<n;i++){
        maxv = max(maxv, r[i]-minv);
        minv = min(minv, r[i]);
    }
    
    cout << maxv << endl;
    
    return 0;
}


Compiler output:
a.cc:2:9: error: #include expects "FILENAME" or <FILENAME>
    2 | #include
      |         ^
a.cc: In function 'int main()':
a.cc:15:19: error: no matching function for call to 'min(long int&, int&)'
   15 |         minv = min(minv, r[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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:15:19: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'int')
   15 |         minv = min(minv, r[i]);
      |                ~~~^~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    long n, minv=0, maxv=-2000000000;
    cin >> n;
    int r[n];
    for(int i=0;i<n;i++){
        cin >> r[i];
    }
    
    minv = r[0];
    for(int i=0;i<n;i++){
        maxv = max(maxv, r[i]-minv);
        minv = min(minv, r[i]);
    }
    
    cout << maxv << endl;
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:19: error: no matching function for call to 'min(long int&, int&)'
   15 |         minv = min(minv, r[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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:15:19: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'int')
   15 |         minv = min(minv, r[i]);
      |                ~~~^~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:15:19: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   15 |         minv = min(minv, r[i]);
      |                ~~~^~~~~~~~~~~~
Language: C++

#include <iostream>
using namespace std;

array<int,200000> A;  
    
int main(){
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>A[i];
    
    int a=0;
    int m=1<<30;
    for(int i=0;i<n;i++){
       a=max(a,A[i]-m);
       m=min(m,A[i]);
 //      cout<<"a"<<a<<" m"<<m<<endl;
    }
    cout<<a<<endl;
    return 0;
}

Compiler output:
a.cc:4:19: error: aggregate 'std::array<int, 200000> A' has incomplete type and cannot be defined
    4 | array<int,200000> A;
      |                   ^
a.cc:2:1: note: 'std::array' is defined in header '<array>'; this is probably fixable by adding '#include <array>'
    1 | #include <iostream>
  +++ |+#include <array>
    2 | using namespace std;
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

int main() {
    long long R[200000];
    int i, N, max=0;
    cin >> N;
    for(i=0;i<N;i++) {
        cin >> R[i];
    }
    for(i=0;i<N;i++){
        for(j=i+1;j<N;j++) {
            max = max(max,R[j]-R[i])
        }
    }
    cout << max << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:13: error: 'j' was not declared in this scope
   14 |         for(j=i+1;j<N;j++) {
      |             ^
a.cc:15:36: error: 'max' cannot be used as a function
   15 |             max = max(max,R[j]-R[i])
      |                                    ^
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

int main() {
    long long R[200000];
    int i, j, N, m=0;
    cin >> N;
    for(i=0;i<N;i++) {
        cin >> R[i];
    }
    for(i=0;i<N;i++){
        for(j=i+1;j<N;j++) {
            m = max(m,R[j]-R[i])
        }
    }
    cout << m << endl;
}

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

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int n;
	int t[200000];
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&t[i]);
	}
	int ans=INT_MIN;
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			ans=max(ans,t[j]-t[i]);
		}
	}
	cout << ans << "\n";
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:17: error: 'INT_MIN' was not declared in this scope
   12 |         int ans=INT_MIN;
      |                 ^~~~~~~
a.cc:3:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include<cstdio>
  +++ |+#include <climits>
    3 | using namespace std;
Language: C++

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<vector>
#include<math.h>
#include<stack>
#include<sstream>
#include <typeinfo>
#include<sstream>
#include<queue>
using namespace std;



int main(){
		int N;cin>>N;
		int mini=INT_MAX;
		int ans=-1;
		for(int i=0;i<N;i++){
			int t;
			cin>>t;
			if(mini>t)mini=t;
			ans=max(ans,t-mini);
		}
		cout<<ans<<endl;
		
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:26: error: 'INT_MAX' was not declared in this scope
   17 |                 int mini=INT_MAX;
      |                          ^~~~~~~
a.cc:11:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   10 | #include<queue>
  +++ |+#include <climits>
   11 | using namespace std;
Language: C++

#include<iostream>
using namespace std;
int main(){
  int N,R[200000],h;
  int min=1000000000,max;
    long dis=LONG_MIN;

  cin >>N;
  for(int t=1;t<=N;t++){
    cin >> R[t];
  }

  for(int t=1;t<N;t++){
    if(min>R[t]){
      min=R[t];
      max=-1;
      for(int i=t+1;i<=N;i++) if(max<R[i]) max=R[i];
	  if((max-min) > dis) dis=max-min;
	}
      }
	
  cout <<dis<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:14: error: 'LONG_MIN' was not declared in this scope
    6 |     long dis=LONG_MIN;
      |              ^~~~~~~~
a.cc:2:1: note: 'LONG_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include<iostream>
  +++ |+#include <climits>
    2 | using namespace std;
Language: C++

#include <iostream>
using namespace std;
int main()
{
	long n, r, d = LONG_MIN, max_r = LONG_MIN, min_r, i;
	cin >> n >> min_r;
	for(i = 1; i < n; ++i){
		cin >> r;
		if( r > max_r ) 
			max_r = r;
			d = max_r - min_r;
		if( r < min_r ) {
			min_r = r;			
		}
	}
	
	cout << d << "\n";

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:24: error: 'LONG_MIN' was not declared in this scope
    5 |         long n, r, d = LONG_MIN, max_r = LONG_MIN, min_r, i;
      |                        ^~~~~~~~
a.cc:2:1: note: 'LONG_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include <iostream>
  +++ |+#include <climits>
    2 | using namespace std;
a.cc:6:21: error: 'min_r' was not declared in this scope
    6 |         cin >> n >> min_r;
      |                     ^~~~~
a.cc:7:13: error: 'i' was not declared in this scope
    7 |         for(i = 1; i < n; ++i){
      |             ^
a.cc:9:25: error: 'max_r' was not declared in this scope
    9 |                 if( r > max_r )
      |                         ^~~~~
a.cc:11:29: error: 'max_r' was not declared in this scope
   11 |                         d = max_r - min_r;
      |                             ^~~~~
Language: C++

int main()
{
	ios::sync_with_stdio(false);

	long n, r, k, d = LONG_MIN, min_r, i;
	cin >> n >> min_r;
	for(i = 1; i < n; ++i){
		cin >> r;
		k = r - min_r;
		if( k > d )
			d = k;
		if( r < min_r )
			min_r = r;
	}
	
	cout << d << "\n";

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:9: error: 'ios' has not been declared
    3 |         ios::sync_with_stdio(false);
      |         ^~~
a.cc:5:27: error: 'LONG_MIN' was not declared in this scope
    5 |         long n, r, k, d = LONG_MIN, min_r, i;
      |                           ^~~~~~~~
a.cc:1:1: note: 'LONG_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
  +++ |+#include <climits>
    1 | int main()
a.cc:6:9: error: 'cin' was not declared in this scope
    6 |         cin >> n >> min_r;
      |         ^~~
a.cc:6:21: error: 'min_r' was not declared in this scope
    6 |         cin >> n >> min_r;
      |                     ^~~~~
a.cc:7:13: error: 'i' was not declared in this scope
    7 |         for(i = 1; i < n; ++i){
      |             ^
a.cc:16:9: error: 'cout' was not declared in this scope
   16 |         cout << d << "\n";
      |         ^~~~
Language: C++

#include <iostream>
using namespace std;

int main(){
	int N,R,max;
	cin >> N;
	int array[N];
	for(int i=0; i<N;i++){
		cin >>array[i];
	}
	max0;
	for(int i=0; i<N-1; i++){
		for(int j=i+1; j<N; j++){
			if(max > (array[j]-array[i])){
				max = array[j]-array[i]);
			}
		}
	}
	cout << max << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'max0' was not declared in this scope; did you mean 'max'?
   11 |         max0;
      |         ^~~~
      |         max
a.cc:15:56: error: expected ';' before ')' token
   15 |                                 max = array[j]-array[i]);
      |                                                        ^
      |                                                        ;
Language: C++

#include <iostream>
using namespace std;

int main(){
	int N,max,tmp;
	cin >> N;
	int array[N];
	for(int i=0; i<N;i++){
		cin >>array[i];
	}
	max=array[1]-array[0];
	for(int i=0; i<N-1; i++){
		for(int j=i+1; j<N; j++){
			tmp = array[j]-array[i];
			if(max < tmp{
				max = tmp;
			}
		}
	}
	cout << max << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:37: error: expected ')' before '{' token
   15 |                         if(max < tmp{
      |                           ~         ^
      |                                     )
a.cc:18:17: error: expected primary-expression before '}' token
   18 |                 }
      |                 ^
Language: C++

#include <iostream>

using namespace std;

int main() {
  long n, a;
  cin >> n >> a;

  long mini = a;
  long dif = INT_MIN;
  for (int i = 1; i < n; i++) {
    cin >> a;
    
    dif = max(dif, a - mini);
    mini = min(mini, a);
  }

  cout << dif << endl;
  return 0;
}

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

#include<iostream>
#include<algorithm>

using namespace std;
static const int MAX =200000;

int main(){
	int R[MAX] ,n;
	cin >> n;
	for(int j=0;j<n;j++)cin >> R[j];
	
int maxnum=-2000000000;
int minnum=R[0];

for(int i=1;i<=MAX;i++){

maxnum=max(maxnum,R[i]-minnum);
minnum=min(minnum,R[i]);
}
count << maxnum <<endl;


}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:7: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator<<'
   20 | count << maxnum <<endl;
      | ~~~~~~^~~~~~~~~
Language: C++

#include "stdafx.h"
#include<iostream>
using namespace std;
static const int MAX = 200000;
int _tmain(int argc, _TCHAR* argv[])
{
	int R[MAX];
	int N;
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> R[i];
	}
	int max = -999999999;
	for (int i = 0; i < N-1; i++)
	{
		for (int j = i + 1; j < N; j++)
		{
			if (max < R[j] - R[i])
			{
				max = R[j] - R[i];
			}
		}
	}

	cout << max << endl;
	return 0;
}

Compiler output:
a.cc:1:10: fatal error: stdafx.h: No such file or directory
    1 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include "stdafx.h"
#include<iostream>
using namespace std;
static const int MAX = 200000;
int main()
{
	int R[MAX];
	int N;
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> R[i];
	}
	int max = -999999999;
	for (int i = 0; i < N-1; i++)
	{
		for (int j = i + 1; j < N; j++)
		{
			if (max < R[j] - R[i])
			{
				max = R[j] - R[i];
			}
		}
	}

	cout << max << endl;
	return 0;
}

Compiler output:
a.cc:1:10: fatal error: stdafx.h: No such file or directory
    1 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include<stdio.h>

int main()
{

int N,b,w;
b=0;w=0
while(scanf("%d",&N)!=EOF)
{
w=w+(N-b);
b=N;
}
peintf("%d\n",w};
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:8: error: expected ';' before 'while'
    7 | b=0;w=0
      |        ^
      |        ;
    8 | while(scanf("%d",&N)!=EOF)
      | ~~~~~   
a.cc:13:16: error: expected ')' before '}' token
   13 | peintf("%d\n",w};
      |       ~        ^
      |                )
a.cc: At global scope:
a.cc:14:1: error: expected unqualified-id before 'return'
   14 | return 0;
      | ^~~~~~
a.cc:15:1: error: expected declaration before '}' token
   15 | }
      | ^
Language: C++

#include <sstream>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iterator>
#include <numeric>
#include <functional>



using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main(){
  size_t n;
  cin >> n;
  int m, M, buf;
  cin >> m;
  M = INT_MIN;
  for (size_t i = 1; i < n; i++) {
    cin >> buf;
    M = max(M, buf - m);
    m = min(m, buf);
  }
  cout << M << endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:7: error: 'INT_MIN' was not declared in this scope
   31 |   M = INT_MIN;
      |       ^~~~~~~
a.cc:19:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   18 | #include <functional>
  +++ |+#include <climits>
   19 |
Language: C++

#include <sstream>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iterator>
#include <numeric>
#include <functional>



using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main(int argc, char** argv){
  size_t n;
  cin >> n;
  int m, M, buf;
  cin >> m;
  M = INT_MIN;
  for (size_t i = 1; i < n; i++) {
    cin >> buf;
    M = max(M, buf - m);
    m = min(m, buf);
  }
  cout << M << endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:31:7: error: 'INT_MIN' was not declared in this scope
   31 |   M = INT_MIN;
      |       ^~~~~~~
a.cc:19:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   18 | #include <functional>
  +++ |+#include <climits>
   19 |
Language: C++

#include <iostream>
#include <cmath>
#include <climits>
using namespace std;
int main()
{
    int n,m = INT32_MIN;
    long int rm;
    cin >> n >> rm;
    for(int i = 1;i < n;i++)
    {
         long int r;
         cin >> r;
         if(r - rm > m)
         {
             m = r - rm;
         }
         if(rm > r)
         {
             rm  = r;
         }
    }
    cout << m << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:15: error: 'INT32_MIN' was not declared in this scope; did you mean 'INT_MIN'?
    7 |     int n,m = INT32_MIN;
      |               ^~~~~~~~~
      |               INT_MIN
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}


#include <stdio.h>
int main()
{
    long long int r[200001]={0}, i, j, n, max=-1000000000, c,prev;
    scanf("%lld", &n);
    for(i = 0; i < n; i++){
        scanf("%lld", &r[i]);
    }
    for(i = 0; i < n; i++){
    	if (prev <= R[i]) ???continue;
        for(j = i + 1; j < n; j++){
            c = r[j] - r[i];
            if(c > max){
                max = c;
            }
        }
        prev = R[i];
    }
    printf("%lld\n", max);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:21: error: 'R' was not declared in this scope
   36 |         if (prev <= R[i]) ???continue;
      |                     ^
a.cc:36:27: error: expected primary-expression before '?' token
   36 |         if (prev <= R[i]) ???continue;
      |                           ^
a.cc:36:28: error: expected primary-expression before '?' token
   36 |         if (prev <= R[i]) ???continue;
      |                            ^
a.cc:36:29: error: expected primary-expression before '?' token
   36 |         if (prev <= R[i]) ???continue;
      |                             ^
a.cc:36:30: error: expected primary-expression before 'continue'
   36 |         if (prev <= R[i]) ???continue;
      |                              ^~~~~~~~
a.cc:36:30: error: expected ':' before 'continue'
   36 |         if (prev <= R[i]) ???continue;
      |                              ^~~~~~~~
      |                              :
a.cc:36:30: error: expected primary-expression before 'continue'
   36 |         if (prev <= R[i]) ???continue;
      |                              ^~~~~~~~
a.cc:36:30: error: expected ':' before 'continue'
   36 |         if (prev <= R[i]) ???continue;
      |                              ^~~~~~~~
      |                              :
a.cc:36:30: error: expected primary-expression before 'continue'
   36 |         if (prev <= R[i]) ???continue;
      |                              ^~~~~~~~
a.cc:36:30: error: expected ':' before 'continue'
   36 |         if (prev <= R[i]) ???continue;
      |                              ^~~~~~~~
      |                              :
a.cc:36:30: error: expected primary-expression before 'continue'
   36 |         if (prev <= R[i]) ???continue;
      |                              ^~~~~~~~
a.cc:43:16: error: 'R' was not declared in this scope
   43 |         prev = R[i];
      |                ^
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}


#include <stdio.h>
int main()
{
    long long int r[200001]={0}, i, j, n, max=-1000000000, c,prev;
    prev = 1000000001;
    scanf("%lld", &n);
    for(i = 0; i < n; i++){
        scanf("%lld", &r[i]);
    }
    for(i = 0; i < n; i++){
    	if (prev <= R[i]) ???continue;
        for(j = i + 1; j < n; j++){
            c = r[j] - r[i];
            if(c > max){
                max = c;
            }
        }
        prev = R[i];
    }
    printf("%lld\n", max);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:21: error: 'R' was not declared in this scope
   37 |         if (prev <= R[i]) ???continue;
      |                     ^
a.cc:37:27: error: expected primary-expression before '?' token
   37 |         if (prev <= R[i]) ???continue;
      |                           ^
a.cc:37:28: error: expected primary-expression before '?' token
   37 |         if (prev <= R[i]) ???continue;
      |                            ^
a.cc:37:29: error: expected primary-expression before '?' token
   37 |         if (prev <= R[i]) ???continue;
      |                             ^
a.cc:37:30: error: expected primary-expression before 'continue'
   37 |         if (prev <= R[i]) ???continue;
      |                              ^~~~~~~~
a.cc:37:30: error: expected ':' before 'continue'
   37 |         if (prev <= R[i]) ???continue;
      |                              ^~~~~~~~
      |                              :
a.cc:37:30: error: expected primary-expression before 'continue'
   37 |         if (prev <= R[i]) ???continue;
      |                              ^~~~~~~~
a.cc:37:30: error: expected ':' before 'continue'
   37 |         if (prev <= R[i]) ???continue;
      |                              ^~~~~~~~
      |                              :
a.cc:37:30: error: expected primary-expression before 'continue'
   37 |         if (prev <= R[i]) ???continue;
      |                              ^~~~~~~~
a.cc:37:30: error: expected ':' before 'continue'
   37 |         if (prev <= R[i]) ???continue;
      |                              ^~~~~~~~
      |                              :
a.cc:37:30: error: expected primary-expression before 'continue'
   37 |         if (prev <= R[i]) ???continue;
      |                              ^~~~~~~~
a.cc:44:16: error: 'R' was not declared in this scope
   44 |         prev = R[i];
      |                ^
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}


#include <stdio.h>
int main()
{
    long long int r[200001]={0}, i, j, n, max=-1000000000, c,prev;
    prev = 1000000001;
    scanf("%lld", &n);
    for(i = 0; i < n; i++){
        scanf("%lld", &r[i]);
    }
    for(i = 0; i < n; i++){
    	if (prev <= R[i]) continue;
        for(j = i + 1; j < n; j++){
            c = r[j] - r[i];
            if(c > max){
                max = c;
            }
        }
        prev = R[i];
    }
    printf("%lld\n", max);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:21: error: 'R' was not declared in this scope
   37 |         if (prev <= R[i]) continue;
      |                     ^
a.cc:44:16: error: 'R' was not declared in this scope
   44 |         prev = R[i];
      |                ^
Language: C++

#include <iostream>
#include <algorithm>
using namesapce std;
static const int MAX =200000;
int main(){
    int R[MAX],n;
    cin >> n;
    for(int i=0;i<n;i++)
        cin >> R[i];
    int maxv = -2000000000;
    int minv = R[0];

    for(int i=0;i<n;i++){
        maxv = max(maxv,R[i]-minv);
        minv = min(minv,R[i]);
    }
    cout << maxv << endl;
}

Compiler output:
a.cc:3:7: error: expected nested-name-specifier before 'namesapce'
    3 | using namesapce std;
      |       ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:7:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    7 |     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:14:16: error: 'max' was not declared in this scope; did you mean 'std::max'?
   14 |         maxv = max(maxv,R[i]-minv);
      |                ^~~
      |                std::max
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/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:15:16: error: 'min' was not declared in this scope; did you mean 'std::min'?
   15 |         minv = min(minv,R[i]);
      |                ^~~
      |                std::min
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:17:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   17 |     cout << maxv << 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:17:21: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   17 |     cout << maxv << endl;
      |                     ^~~~
      |                     std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include<stdio.h>
#include<math.h>

int max(int*,int);

int main()
{
	int n, i;
	scanf("%d", &n);
	int R[200001];
	for (i = 0; i <= n; i++)
	{
		scanf("%d", &R[i]);
	}
	printf("%d\n", max(R, n));

}


int max(int array[], int n)
{
	int start, target;
	int champion = -1000000000, challenger;
	for (start = 0; start <= n - 2; start++)
	{
                biggest=0;
		for (target = start + 1; target <= n - 1; target++)
		{
			if(array[target]>biggest) biggest=array[target];
		}
                challenger=array[target]-array[start];
                if(challenger>champion) champion=challenger;
	}
	return champion;
}

Compiler output:
a.cc: In function 'int max(int*, int)':
a.cc:26:17: error: 'biggest' was not declared in this scope
   26 |                 biggest=0;
      |                 ^~~~~~~
Language: C++

#include<stdio.h>
#include<math.h>

int max(int*,int);

int main()
{
	int n, i;
	scanf("%d", &n);
	int R[200001];
	for (i = 0; i <= n; i++)
	{
		scanf("%d", &R[i]);
	}
	printf("%d\n", max(R, n));

}


int max(int array[], int n)
{
    int i,r=0,champion=-1000000000,k;
    while(r!=n-1)
    {
        for(i=r;i<=n-1;i++)
        {
            int biggest=1;
            if(array[i]>=biggest) 
            {
                biggest=array[i];
                r=i;
            }
            for(k=0;k<=i;k++)
            {
                int smallest=1000000000;
                if(array[k]<=smallest)
                {
                    smallest=array[k];
                    int j=k;
                }
            }
        int challenger=biggest-smallest;
        }
    if(challenger>=champion) champion=challenger;
    }
    return champion;
}

Compiler output:
a.cc: In function 'int max(int*, int)':
a.cc:42:32: error: 'smallest' was not declared in this scope
   42 |         int challenger=biggest-smallest;
      |                                ^~~~~~~~
a.cc:44:8: error: 'challenger' was not declared in this scope
   44 |     if(challenger>=champion) champion=challenger;
      |        ^~~~~~~~~~
Language: C++

#include<stdio.h>
#include<math.h>

int max(int*, int);

int main()
{
	int n, i;
	scanf_s("%d", &n);
	int R[200001];
	for (i = 0; i <= n; i++)
	{
		scanf_s("%d", &R[i]);
	}
	printf("%d\n", max(R, n));

}


int max(int array[], int n)
{
	int  r = 0, i = r, champion = -1000000000, k, smallest = 1000000000, challenger;
	while (r != n )
	{
		while ( i <= n - 1)
		{
			i = r;
			int biggest = 1;
			if (array[i] >= biggest)
			{
				biggest = array[i];
				r = i + 1;
			}
			for (k = 0; k <= i; k++)
			{
				if (array[k] <= smallest) smallest = array[k];
			}
			challenger = biggest - smallest;
			i++;
		}
		if (challenger >= champion) champion = challenger;
	}
	return champion;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
    9 |         scanf_s("%d", &n);
      |         ^~~~~~~
      |         scanf
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 200000;

int main(){
	int R[MAX], n;

	cin >> n;
	for(int i = 0; i < n; i++)
		cin >> R[i];

	int maxv = -2000000000;
	int minv = R[0];

	for(int i = 1; i < n; i++){
		maxv = max(maxv, R[i] - minv);
		minv = min(minv, T[i]);
	}

	cout << maxv << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:34: error: 'T' was not declared in this scope
   18 |                 minv = min(minv, T[i]);
      |                                  ^
Language: C++

/*http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_D*/
#include <iostream>

using namespace std;

int main() {
    int n;
    int max;
    int min;

    cin>>n;
    cin>>min;
    for(int i = 0; i < n-1; i++){
        int r;
        cin>>r;
        int tmp=r-min;
        if(i == 0 || max<tmp){
            max=tmp;
        }
        min=min(min,r);
    }
    cout<<max<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:16: error: 'min' cannot be used as a function
   20 |         min=min(min,r);
      |             ~~~^~~~~~~
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main(int argc, char *argv[])
{
  cin >> n;

  vector<int> c;

  for (int i = 0; i < n; i++)
  {
    int r;
    cin >> r;
    c.emplace_back(r);
  }

  int res = c.front();
  
  for (int i = 1; i < n; i++)
  {
    auto v = c[i] - c[i-1];
    if (res > v)
    {
      res = v;
    }
  }

  std::cout << res << std::endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:8:10: error: 'n' was not declared in this scope
    8 |   cin >> n;
      |          ^
Language: C++

import java.util.Scanner;

public class Main{

	public static void main(String args[]){
		int i,j,k,t,m,l;
		Scanner sc=new Scanner(System.in);
		t=Integer.parseInt(sc.next());
		int n[]=new int[t+1];
		int max[]=new int[t+1];
		int Max[]=new int[t+1];
		for(i=0;i<t;i++){
			n[i]=Integer.parseInt(sc.next());
		}
		
		for(i=0;i<t-1;i++){
			for(j=i;j<t-1;j++){
				max[j]=n[j+1]-n[i];
				}
			
			for(j=i;j<t-1;j++){
				m=max[j];
				l=j;
				for(k=j+1;k<t-1;k++){
					if(max[l]<max[k]){
						l=k;
					}
				}
				max[j]=max[l];
				max[l]=m;
				
			}
			
			Max[i]=max[i];
		}
		k=0;
		l=0;
		for(i=0;i<t-1;i++){
			m=Max[i];
			
			l=i;
			for(k=i+1;k<t-1;k++){
			if(Max[l]<Max[k]){
				l=k;
			}
			}
			Max[i]=Max[l];
			Max[l]=m;
		}
		for(i=0;i<t-1;i++){
		
		}
		
		System.out.println(Max[0]);
	}
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Scanner;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
    3 | public class Main{
      | ^~~~~~
Language: C++

n = int( input( ) )

mi = int( input( ) )
profit = 0 - 1000000000
n -= 1
i = 0
while i < n:
	num = int( input( ) )
	
	diff = num - mi
	if profit < diff:
		profit = diff

	if num < mi:
		mi = num
	i += 1

print( profit )

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = int( input( ) )
      | ^
Language: C++

#include<iostream>
#include<algorithm>
#using namespace std;
static const int MAX = 200000;

int main(){
  int R[MAX], n;

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

  int maxv = -2000000000;
  int min = R[0];

  for (int i = 1; i < n; ++i)
  {
    maxv = max(maxv,R[i] - minv);
    minv = min(minv, R[i]);
  }

  cout << maxv << endl;

  returun 0 ;


}

Compiler output:
a.cc:3:2: error: invalid preprocessing directive #using
    3 | #using namespace std;
      |  ^~~~~
a.cc: In function 'int main()':
a.cc:9:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    9 |   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:20:28: error: 'minv' was not declared in this scope; did you mean 'min'?
   20 |     maxv = max(maxv,R[i] - minv);
      |                            ^~~~
      |                            min
a.cc:20:12: error: 'max' was not declared in this scope; did you mean 'std::max'?
   20 |     maxv = max(maxv,R[i] - minv);
      |            ^~~
      |            std::max
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/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:21:15: error: 'min' cannot be used as a function
   21 |     minv = min(minv, R[i]);
      |            ~~~^~~~~~~~~~~~
a.cc:24:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   24 |   cout << maxv << 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:24:19: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   24 |   cout << maxv << endl;
      |                   ^~~~
      |                   std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc:26:3: error: 'returun' was not declared in this scope
   26 |   returun 0 ;
      |   ^~~~~~~
Language: C++

//2???n???200,000
//1???Rt???10

#include <iostream>
#include <vector>
#include <numeric>

int main(){
  int N;
  std::vector<int> R;

  std::cin >> N;
  R.resize(N);
  
  for(int i =0; i<N; ++i){
    std::cin >> R[i];
  }

  std::vector<int> R_min;
  std::vector<int> R_max;

  R_min[0] = R[0];
  R_max[N-1] = R[N-1];
    
  for(int i=1; i<N; ++i){
    R_min[i] = std::min(R[i], R[i-1]);
  }
  for(int i=N-2; i>=0; --i){
    R_max[i] = std::max(R[i], R[i+1]);
  }

  int max_diff = std::numeric_limits<int>::min();
  for(int i=0; i<N; ++i){
    max_diff = std::max(max_diff, R_max[i] - R_min[i]);
  }

  std::cout << max_diff << std::endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:23: error: 'numeric_limits' is not a member of 'std'
   32 |   int max_diff = std::numeric_limits<int>::min();
      |                       ^~~~~~~~~~~~~~
a.cc:32:38: error: expected primary-expression before 'int'
   32 |   int max_diff = std::numeric_limits<int>::min();
      |                                      ^~~