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

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

int main()
{
	int nNum = 0;
	cin >> nNum;
	int nProfit = INT_MIN, nInprice = INT_MAX;
	int nTemp = 0;
	for (int i = 0; i < nNum; ++i)
	{
		cin >> nTemp;
		nProfit = max(nProfit, nTemp - nInprice);
		nInprice = min(nInprice, nTemp);
	}
	cout << nProfit << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:23: error: 'INT_MIN' was not declared in this scope
    9 |         int nProfit = INT_MIN, nInprice = INT_MAX;
      |                       ^~~~~~~
a.cc:3:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <algorithm>
  +++ |+#include <climits>
    3 | using namespace std;
a.cc:14:48: error: 'nInprice' was not declared in this scope
   14 |                 nProfit = max(nProfit, nTemp - nInprice);
      |                                                ^~~~~~~~
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 = -20000000000;
    int maxv = numeric_limits<int>::min();
    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:13:16: error: 'numeric_limits' was not declared in this scope
   13 |     int maxv = numeric_limits<int>::min();
      |                ^~~~~~~~~~~~~~
a.cc:13:31: error: expected primary-expression before 'int'
   13 |     int maxv = numeric_limits<int>::min();
      |                               ^~~
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, r[i]);
    }
    cout << maxv << endl;
    return 0;
}


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

 #include <iostream>
#include <algorithm>
#define INT_MAX 2147483647

int main(void){
  int n;
  int val;

  int max_profit = -INT_MAX;
  int minv;

  std::cin >> n;
  std::cin >> minv;

  for(int i=0; i<n-1; i++){
      std::cin >> val;
      max_profit = max(max_profit, val - minv);
      minv = min(minv, val);
  }

  std::cout << max_profit << '\n';

  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:17:20: error: 'max' was not declared in this scope; did you mean 'std::max'?
   17 |       max_profit = max(max_profit, val - 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:18:14: error: 'min' was not declared in this scope; did you mean 'std::min'?
   18 |       minv = min(minv, val);
      |              ^~~
      |              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)
      |     ^~~
Language: C++

#include <iostream>
#include <algorithm>
#define INT_MAX 2147483647

int main(void){
  int n;
  int val;

  int max_profit = -INT_MAX;
  int minv;

  std::cin >> n;
  std::cin >> minv;

  for(int i=0; i<n-1; i++){
      std::cin >> val;
      max_profit = max(max_profit, val - minv);
      minv = min(minv, val);
  }

  std::cout << max_profit << '\n';

  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:17:20: error: 'max' was not declared in this scope; did you mean 'std::max'?
   17 |       max_profit = max(max_profit, val - 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:18:14: error: 'min' was not declared in this scope; did you mean 'std::min'?
   18 |       minv = min(minv, val);
      |              ^~~
      |              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)
      |     ^~~
Language: C++

#include <iostream>
#include <algorithm>

int main(void){
  int n;
  int val;

  int max_profit = -INT_MAX;
  int minv;

  std::cin >> n;
  std::cin >> minv;

  for(int i=0; i<n-1; i++){
      std::cin >> val;
      max_profit = std::max(max_profit, val - minv);
      minv = std::min(minv, val);
  }

  std::cout << max_profit << '\n';

  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:8:21: error: 'INT_MAX' was not declared in this scope
    8 |   int max_profit = -INT_MAX;
      |                     ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <algorithm>
  +++ |+#include <climits>
    3 |
Language: C++

#include <iostream>
using namespace std;

int main()
{
	int n, max, tmp;
	cin >> n;
	int input[n];
	for(int i = 0; i < n; i++)
	{
		cin >> tmp;
		input[i] = tmp;
	}

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:16:9: error: 'minR' was not declared in this scope
   16 |         minR = input[0];
      |         ^~~~
a.cc:20:38: error: overloaded function with no contextual type information
   20 |                         min = input[i];
      |                                      ^
Language: C++

#include <iostream>
using namespace std;

int main()
{
	int n, max, tmp;
	cin >> n;
	int input[n];
	for(int i = 0; i < n; i++)
	{
		cin >> tmp;
		input[i] = tmp;
	}

	max = -1000000000;
	int minR = input[0];
	for(int i = 1; i < n; i++)
	{
		if(minR > input[i])
			min = input[i];

		if(max < input[i]-minR)
			max = input[i]-minR;
	}

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


Compiler output:
a.cc: In function 'int main()':
a.cc:20:38: error: overloaded function with no contextual type information
   20 |                         min = input[i];
      |                                      ^
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;


int main() {
    vector<int> r;
    int n;
    cin>>n;
    int t;
    for (int i = 0; i <n ; ++i) {
        cin>>t;
        r.push_back(t);
    }
    int minv=r[0];
    int maxv=-2000000000;
    for(int i=1;i<r.size();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:8:5: error: 'vector' was not declared in this scope
    8 |     vector<int> r;
      |     ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include <algorithm>
  +++ |+#include <vector>
    3 | 
a.cc:8:12: error: expected primary-expression before 'int'
    8 |     vector<int> r;
      |            ^~~
a.cc:14:9: error: 'r' was not declared in this scope
   14 |         r.push_back(t);
      |         ^
a.cc:16:14: error: 'r' was not declared in this scope
   16 |     int minv=r[0];
      |              ^
Language: C++

import sys

input_amount = int(input())
values = [int(input()) for i in range(input_amount)]

maxv = - sys.maxsize - 1
minv = values[0]

for value in enumerate(values):
    maxv = max(maxv, value - minv)
    minv = min(minv, value) 

print(maxv)



Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import sys
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
    int num=0;
    scanf("%d",&num);
    int x[num];
    int max,min;
    scanf(" %d",&x[0]);
    scanf(" %d",&x[1]);
    max=x[1]-x[0];
    if(x[1]<x[0]){
        min=x[1];
    }else{
        min=x[0];
    }
    
    for(int i=2;i<num;i++){
        scanf(" %d",&x[i]);
        if(x[i]<min){
            min=x[i];
        }
        if(x[i]=>min&&x[i]-min>max){
            max=x[i]-min;
        }

    }
    printf("%d\n",max);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:17: error: expected primary-expression before '>' token
   23 |         if(x[i]=>min&&x[i]-min>max){
      |                 ^
Language: C++

int main(){
    int n;
    cin >> n;
    int count=0;
    int a[200000];
    int Mid=0;
    int mid=0;
    for(int i=0;i<n;i++){
        cin >> a[i];
        if (a[Mid]<a[i]){
            Mid=i;
        }
        if (a[mid]>a[i]){
            mid=i;
        }
    }
    int frommax=-1000000000;
    int frommin=-1000000000;
    for(int i=0;i<Mid;i++){
        frommax=max(frommax,a[Mid]-a[i]);
    }
    for(int i=n-1;i>Mid;i--){
        frommin=max(frommin,a[i]-a[mid]);
    }
    cout << max(frommax,frommin) << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:3:5: error: 'cin' was not declared in this scope
    3 |     cin >> n;
      |     ^~~
a.cc:20:17: error: 'max' was not declared in this scope
   20 |         frommax=max(frommax,a[Mid]-a[i]);
      |                 ^~~
a.cc:23:17: error: 'max' was not declared in this scope
   23 |         frommin=max(frommin,a[i]-a[mid]);
      |                 ^~~
a.cc:25:5: error: 'cout' was not declared in this scope; did you mean 'count'?
   25 |     cout << max(frommax,frommin) << endl;
      |     ^~~~
      |     count
a.cc:25:13: error: 'max' was not declared in this scope
   25 |     cout << max(frommax,frommin) << endl;
      |             ^~~
a.cc:25:37: error: 'endl' was not declared in this scope
   25 |     cout << max(frommax,frommin) << endl;
      |                                     ^~~~
Language: C++

int largest(int a,int b,int c)
{
  int max1 = (a >= b ? a : b);
  int max2 = (b >= c ? b : c);
 
  return (max1 >= max2 ? max1 : max2);
}

int main()
{
  int n;
  std::vector<int> r;
  
  std::cin >> n;
  for(int i=0; i < n; i++){
    int x;
    std::cin >> x;
    r.push_back(x);
  }
  int mx = r[1] - r[0];
  while(r.size() > 0){
    int max_from_min = *max_element( min_element( r.begin(), r.end() ), r.end() );
    max_from_min -= *min_element( r.begin(), r.end() );
    int max_from_max = *max_element( r.begin(), max_element( r.begin(), r.end() ));
    max_from_max -= *max_element( r.begin(), r.end() );
    mx = largest(max_from_min, max_from_max, mx);
    if(r.size() == 1){
      r.erase(r.begin());
    }else{
      r.erase(max_element( r.begin(), r.end() ));
      r.erase(min_element( r.begin(), r.end() ));
    }
  }
  std::cout << mx << std::endl;
  return 0; 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:8: error: 'vector' is not a member of 'std'
   12 |   std::vector<int> r;
      |        ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | int largest(int a,int b,int c)
a.cc:12:15: error: expected primary-expression before 'int'
   12 |   std::vector<int> r;
      |               ^~~
a.cc:14:8: error: 'cin' is not a member of 'std'
   14 |   std::cin >> n;
      |        ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | int largest(int a,int b,int c)
a.cc:17:10: error: 'cin' is not a member of 'std'
   17 |     std::cin >> x;
      |          ^~~
a.cc:17:10: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:18:5: error: 'r' was not declared in this scope
   18 |     r.push_back(x);
      |     ^
a.cc:20:12: error: 'r' was not declared in this scope
   20 |   int mx = r[1] - r[0];
      |            ^
a.cc:22:38: error: 'min_element' was not declared in this scope
   22 |     int max_from_min = *max_element( min_element( r.begin(), r.end() ), r.end() );
      |                                      ^~~~~~~~~~~
a.cc:22:25: error: 'max_element' was not declared in this scope
   22 |     int max_from_min = *max_element( min_element( r.begin(), r.end() ), r.end() );
      |                         ^~~~~~~~~~~
a.cc:34:8: error: 'cout' is not a member of 'std'
   34 |   std::cout << mx << std::endl;
      |        ^~~~
a.cc:34:8: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:34:27: error: 'endl' is not a member of 'std'
   34 |   std::cout << mx << std::endl;
      |                           ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | int largest(int a,int b,int c)
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>

int largest(int a,int b,int c)
{
  int max1 = (a > b ? a : b);
  int max2 = (b > c ? b : c);
 
  return (max1 > max2 ? max1 : max2);
}

int main()
{
  int n;
  std::vector<int> r;
  
  std::cin >> n;
  for(int i=0; i < n; i++){
    int x;
    std::cin >> x;
    r.push_back(x);
  }
  int mx = r[1] - r[0];
  while(r.size() > 0){
    print(r);
    int max_from_min = *max_element( min_element( r.begin(), r.end() ), r.end() );
    max_from_min -= *min_element( r.begin(), r.end() );
    int max_from_max = -1 * *min_element( r.begin(), max_element( r.begin(), r.end() ));
    max_from_max += *max_element( r.begin(), r.end() );
    mx = largest(max_from_min, max_from_max, mx);

    if(r.size() == 1){
      r.erase(r.begin());
    }else{
      r.erase(max_element( r.begin(), r.end() ));
      r.erase(min_element( r.begin(), r.end() ));
    }
  }
  std::cout << mx << std::endl;
  return 0; 
}



Compiler output:
a.cc: In function 'int main()':
a.cc:26:5: error: 'print' was not declared in this scope; did you mean 'printf'?
   26 |     print(r);
      |     ^~~~~
      |     printf
Language: C++

#include <iostream>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <vector>
#include <cmath>
#include <cstdint>
#include <string>

using namespace std;

int main() {
  int count;
  std::vector<int> X;
  cin >> count;
  for (int i = 0; i < count; ++i) {
    int x;
    cin >> x;
    X.push_back(x);
  }
  int d = INT_MIN;
  for (int j = 1; j < X.size(); ++j) {
    for (int i = 0; i < j; ++i) {
      d = max(X[j] - X[i], d);
    }
  }
  cout << d << endl;
}



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

intMax = -100000000

inputData = int(input())
inputList = list()
count = 0
while count < inputData:
    inputList.append(int(input()))
    count = count + 1

inputDataMax = intMax
inputDataMin = inputList[0]
count2 = 1
while count2 < inputData:
    inputDataMax = max(inputDataMax,  inputList[count2] - inputDataMin)
    inputMin = min(inputDataMin, inputList[count2])

print(inputDataMax)


Compiler output:
a.cc:1:1: error: 'intMax' does not name a type
    1 | intMax = -100000000
      | ^~~~~~
Language: C++

#include<iostream>
#include<algorithm>
using namespase 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,R[i]);
	}
	cont << maxv << endl;
	return 0;
}


Compiler output:
a.cc:3:7: error: expected nested-name-specifier before 'namespase'
    3 | using namespase std;
      |       ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:9:9: 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:16:22: error: 'max' was not declared in this scope; did you mean 'std::max'?
   16 |                 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:17:22: error: 'min' was not declared in this scope; did you mean 'std::min'?
   17 |                 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:19:9: error: 'cont' was not declared in this scope; did you mean 'const'?
   19 |         cont << maxv << endl;
      |         ^~~~
      |         const
a.cc:19:25: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   19 |         cont << 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<iostream>
#include<algorithm>
using namespase 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,R[i]);
	}
	cout << maxv << endl;
	return 0;
}



Compiler output:
a.cc:3:7: error: expected nested-name-specifier before 'namespase'
    3 | using namespase std;
      |       ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:9:9: 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:16:24: error: 'max' was not declared in this scope; did you mean 'std::max'?
   16 |                 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:17:24: error: 'min' was not declared in this scope; did you mean 'std::min'?
   17 |                 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:19:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   19 |         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:19:25: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   19 |         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<iostream>
#include<algorithm>
using namespase std;
static const int MAX = 200000;

int main(){
	int R[MAX],n,cin,max,min,cout;
	
	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:3:7: error: expected nested-name-specifier before 'namespase'
    3 | using namespase std;
      |       ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:16:27: error: 'max' cannot be used as a function
   16 |                 maxv = max(maxv,R[i]-minv);
      |                        ~~~^~~~~~~~~~~~~~~~
a.cc:17:27: error: 'min' cannot be used as a function
   17 |                 minv = min(minv,R[i]);
      |                        ~~~^~~~~~~~~~~
a.cc:19:25: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   19 |         cout << maxv << endl;
      |                         ^~~~
      |                         std::endl
In file included from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include<iostream>
#include<algarithm>
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 = 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: fatal error: algarithm: No such file or directory
    2 | #include<algarithm>
      |         ^~~~~~~~~~~
compilation terminated.
Language: C++

#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<utility>
#include<map>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K
#define INF 100000000
#define MOD 100000007
#define SIZE 100005
#define pi 	3.14159265358979323846

int main(){
	ll n,num;
	cin >> n;
	ll MAX = 0;
	ll MIN = INF;
	REP(n,i){
		cin >> num;
		MIN = min(MIN,num);
		MAX = max(MAX,num);
	}
	cout << MAX << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:15: error: 'i' was not declared in this scope
   33 |         REP(n,i){
      |               ^
a.cc:17:32: note: in definition of macro 'REP'
   17 | #define REP(i,n) for(int i=0;i<n;i++)
      |                                ^
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,R[i]);
}
cout << maxv << endl;

return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:10: error: expected initializer before 'R'
   13 | int minv R[0];
      |          ^
a.cc:16:24: error: 'minv' was not declared in this scope
   16 | maxv = max(maxv,R[i] - minv);
      |                        ^~~~
Language: C++

#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<utility>
#include<map>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K
#define INF 100000000
#define MOD 100000007
#define SIZE 100005
#define pi 	3.14159265358979323846

int main(){
	ll n,num;
	cin >> n;
	ll MAX,MIN
	cin << num << endl;
	MIN = num;
	MAX = num;
	REP(i,n-1){
		cin >> num;
		MIN = min(MIN,num);
		MAX = max(MAX,num-MIN);
	}
	if(MAX<0){
		cout << -1 << endl;
		return 0;
	}
	cout << MAX << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:9: error: expected initializer before 'cin'
   32 |         cin << num << endl;
      |         ^~~
a.cc:33:9: error: 'MIN' was not declared in this scope
   33 |         MIN = num;
      |         ^~~
Language: C++

int main()
{
	int n;
	scanf("%d", &n);
	int R[200000];
	for (int i = 0; i < n; i++)
		scanf("%d", R + i);
	int max = (int)0x80000000;
	int min = R[0];
	for (int i = 1; i < n; i++)
	{
		if (R[i] - min > max)
			max = R[i] - min;
		if (R[i] < min)
			min = R[i];
	}
	/*
	for (int i = 0; i < n; i++)
	{
		for (int j = i + 1; j < n; j++)
		{
			int diff = R[j] - R[i];
			if (diff > max)
			{
				max = diff;
			}
		}
	}
	//*/
	
	printf("%d\n", max);
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:4:9: error: 'scanf' was not declared in this scope
    4 |         scanf("%d", &n);
      |         ^~~~~
a.cc:31:9: error: 'printf' was not declared in this scope
   31 |         printf("%d\n", max);
      |         ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int main()
Language: C++

#include<iostream>

int main()
{
	int n,R[200];
	std::cin>>n;
	for(int i=0;i<n;i++){
		std::cin>>R[i];
	}
	int max=-10**12;
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			if((R[j]-R[i])>max){
				max=R[j]-R[i];
			}
		}
	}
	std::cout<<max;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:21: error: invalid type argument of unary '*' (have 'int')
   10 |         int max=-10**12;
      |                     ^~~
Language: C++

#include<cmath>

int main(){
  int A[200000]={0};
  int n,max=-1000000000,tmp=0;
  std::cin>>n;
  for(int i=0;i<n;i++){
    std::cin>>A[i];
  }
  for(int i=0;i<n-1;i++){
    for(int j=i+1;j<n;j++){
      tmp=A[j]-A[i];
      if(tmp>max){
	max=tmp;
      }
    }
  }
  std::cout<<max<<"\n";
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:6:8: error: 'cin' is not a member of 'std'
    6 |   std::cin>>n;
      |        ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<cmath>
  +++ |+#include <iostream>
    2 | 
a.cc:8:10: error: 'cin' is not a member of 'std'
    8 |     std::cin>>A[i];
      |          ^~~
a.cc:8:10: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:18:8: error: 'cout' is not a member of 'std'
   18 |   std::cout<<max<<"\n";
      |        ^~~~
a.cc:18:8: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
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, R[i]);
        }
        cout << maxv << endl;
        return 0;#

}


Compiler output:
a.cc:19:18: error: stray '#' in program
   19 |         return 0;#
      |                  ^
Language: C++

int main() {
    cin >> n;
    int R[n];
    for (int t = 0; t < n; t++) {
        cin >> R[t];
    }
    max = R[1] - R[0];
    int tmp;
    for (int i = 0; i < n; i++) {
        for (int j = i; j < n; j++) {
            tmp = R[j] - R[i];
            if(max < tmp) {
                max = tmp;
            }
        }
    }
    cout << tmp;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:2:5: error: 'cin' was not declared in this scope
    2 |     cin >> n;
      |     ^~~
a.cc:2:12: error: 'n' was not declared in this scope
    2 |     cin >> n;
      |            ^
a.cc:5:16: error: 'R' was not declared in this scope
    5 |         cin >> R[t];
      |                ^
a.cc:7:5: error: 'max' was not declared in this scope
    7 |     max = R[1] - R[0];
      |     ^~~
a.cc:7:11: error: 'R' was not declared in this scope
    7 |     max = R[1] - R[0];
      |           ^
a.cc:17:5: error: 'cout' was not declared in this scope
   17 |     cout << tmp;
      |     ^~~~
Language: C++

#include <iostream.h>

int main() {
    cin >> n;
    int R[n];
    for (int t = 0; t < n; t++) {
        cin >> R[t];
    }
    int max = R[1] - R[0];
    int tmp;
    for (int i = 0; i < n; i++) {
        for (int j = i; j < n; j++) {
            tmp = R[j] - R[i];
            if(max < tmp) {
                max = tmp;
            }
        }
    }
    cout << tmp;

    return 0;
}


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

#include "stdafx.h"
#include <iostream>
using namespace std;

int main()
{
	int n;
	cin >> n;
	int R[200000];
	for (int t = 0; t < n; t++) {
		cin >> R[t];
	}
	int max = R[1] - R[0];
	int tmp;
	for (int i = 0; i < n; i++) {
		for (int j = i; j < n; j++) {
			tmp = R[j] - R[i];
			if (max < tmp) {
				max = tmp;
			}
		}
	}
	cout << tmp;

    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 <iostream>
using namespace std;

int main()
{
	int n;
	cin >> n;
    int maxv = -1000000000;
    int minv, Rj;
	for (int j = 0; j < n; j++) {
		cin >> Rj;        
        if(j == 0) {
            minv = Rj;
        } else {
            if (minv < Rj) {
                minv = Rj;
            }
        }
        if(maxv < (Rj - minv) {
            maxv = Rj - minv;
        }
	}
	cout << maxv << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:30: error: expected ')' before '{' token
   19 |         if(maxv < (Rj - minv) {
      |           ~                  ^~
      |                              )
a.cc:22:9: error: expected primary-expression before '}' token
   22 |         }
      |         ^
Language: C++

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

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

  int maxr = r[1] - r[0];
  int minr = min(r[1],r[0]);

  for(int i = 2;i < n;i++){
    maxr = max(maxr,r[i]-minr);
    minr = min(minr,r[i]);
  }

  cout << maxr << endl;
}
s


Compiler output:
a.cc:20:1: error: 's' does not name a type
   20 | s
      | ^
Language: C++


#include<stdc++.h>

using namespace std;

int main()
{
    long long s,n,minn=999999999999,maxn=-999999999999;
    scanf("%lld",&n);
    for(long long i=0;i<n;i++){
        scanf("%lld",&s);
        maxn=max(maxn,s-minn);
        minn=min(s,minn);
    }
    printf("%lld\n",maxn);
    return 0;
}



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

#include "stdio.h"
#include <math.h>
int main()
{
	int n,R;
	int diff = (int)pow(10, 9)*-1-1;
	int Min = (int)pow(10, 9) + 1;
	scanf_s("%d ", &n);
	for (int i = 0; i < n; i++) {
		scanf_s("%d", &R);
		if (Min > R) {
			Min = R;
		}
		if (diff < R - Min) {
			diff = R - Min;
		}
	}
	printf("%d", diff);
    return 0;
}



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

#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX =200000000
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,R[i]);
}
cout << maxv << endl;
return 0;
}


Compiler output:
a.cc:5:1: error: expected ',' or ';' before 'int'
    5 | int main(){
      | ^~~
Language: C++

#include "stdio.h"
#include <math.h>
int main()
{
	int n,R;
	int diff = (int)pow(10, 9)*-1-1;
	int Min = (int)pow(10, 9) + 1;
	scanf_s("%d ", &n);
	for (int i = 0; i < n; i++) {
		scanf_s("%d", &R);
		if (diff < R - Min) {
			diff = R - Min;
		}
		if (Min > R) {
			Min = R;
		}	
	}
	printf("%d", diff);
    return 0;
}



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

#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;
#define PB push_back
using LL = long long;
using namespace std;

const int dy[] = {0, 0, 1, -1};
const int dx[] = {1, -1, 0, 0};
const double EPS = 1e-10;
const double PI = acos(-1.0);

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);


    int n;
    cin >> n;

    vector<int> v;
    for(int i=0: i<n: i++){
        int r;
        cin >> r;
        v.PB(r);
    }

    int min = v[0];
    int max = 1e10;

    for(int i=1: i<n: i++){
        max = max(max, v[i]-min);
        min = min(min, v[i])
    }

    cout << max << endl;

}



Compiler output:
a.cc: In function 'int main()':
a.cc:27:14: error: initializer in range-based 'for' loop
   27 |     for(int i=0: i<n: i++){
      |              ^
a.cc:27:21: error: found ':' in nested-name-specifier, expected '::'
   27 |     for(int i=0: i<n: i++){
      |                     ^
      |                     ::
a.cc:27:20: error: 'n' is not a class, namespace, or enumeration
   27 |     for(int i=0: i<n: i++){
      |                    ^
a.cc:34:15: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+10' to '2147483647' [-Woverflow]
   34 |     int max = 1e10;
      |               ^~~~
a.cc:36:14: error: initializer in range-based 'for' loop
   36 |     for(int i=1: i<n: i++){
      |              ^
a.cc:36:21: error: found ':' in nested-name-specifier, expected '::'
   36 |     for(int i=1: i<n: i++){
      |                     ^
      |                     ::
a.cc:36:20: error: 'n' is not a class, namespace, or enumeration
   36 |     for(int i=1: i<n: i++){
      |                    ^
a.cc:37:18: error: 'max' cannot be used as a function
   37 |         max = max(max, v[i]-min);
      |               ~~~^~~~~~~~~~~~~~~
a.cc:38:18: error: 'min' cannot be used as a function
   38 |         min = min(min, v[i])
      |               ~~~^~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;
#define PB push_back
//using LL = long long;
using namespace std;

const int dy[] = {0, 0, 1, -1};
const int dx[] = {1, -1, 0, 0};
const double EPS = 1e-10;
const double PI = acos(-1.0);

int main()
{
    //cin.tie(0);
    //ios::sync_with_stdio(false);


    int n;
    cin >> n;

    vector<int> v;
    for(int i=0: i<n: i++){
        int r;
        cin >> r;
        v.PB(r);
    }

    int min = v[0];
    int max = 1e10;

    for(int i=1: i<n: i++){
        max = max(max, v[i]-min);
        min = min(min, v[i])
    }

    cout << max << endl;

}



Compiler output:
a.cc: In function 'int main()':
a.cc:27:14: error: initializer in range-based 'for' loop
   27 |     for(int i=0: i<n: i++){
      |              ^
a.cc:27:21: error: found ':' in nested-name-specifier, expected '::'
   27 |     for(int i=0: i<n: i++){
      |                     ^
      |                     ::
a.cc:27:20: error: 'n' is not a class, namespace, or enumeration
   27 |     for(int i=0: i<n: i++){
      |                    ^
a.cc:34:15: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+10' to '2147483647' [-Woverflow]
   34 |     int max = 1e10;
      |               ^~~~
a.cc:36:14: error: initializer in range-based 'for' loop
   36 |     for(int i=1: i<n: i++){
      |              ^
a.cc:36:21: error: found ':' in nested-name-specifier, expected '::'
   36 |     for(int i=1: i<n: i++){
      |                     ^
      |                     ::
a.cc:36:20: error: 'n' is not a class, namespace, or enumeration
   36 |     for(int i=1: i<n: i++){
      |                    ^
a.cc:37:18: error: 'max' cannot be used as a function
   37 |         max = max(max, v[i]-min);
      |               ~~~^~~~~~~~~~~~~~~
a.cc:38:18: error: 'min' cannot be used as a function
   38 |         min = min(min, v[i])
      |               ~~~^~~~~~~~~~~
Language: C++

#include <vector>
#include <iostream>
#include <algorithm>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;
#define PB push_back
//using LL = long long;
using namespace std;

int main()
{
    //cin.tie(0);
    //ios::sync_with_stdio(false);


    int n;
    cin >> n;

    vector<int> v;
    for(int i=0: i<n: i++){
        int r;
        cin >> r;
        v.PB(r);
    }

    int min = v[0];
    int max = 1e-10;

    for(int i=1: i<n: i++){
        max = max(max, v[i]-min);
        min = min(min, v[i])
    }

    cout << max << endl;

}



Compiler output:
a.cc: In function 'int main()':
a.cc:24:14: error: initializer in range-based 'for' loop
   24 |     for(int i=0: i<n: i++){
      |              ^
a.cc:24:21: error: found ':' in nested-name-specifier, expected '::'
   24 |     for(int i=0: i<n: i++){
      |                     ^
      |                     ::
a.cc:24:20: error: 'n' is not a class, namespace, or enumeration
   24 |     for(int i=0: i<n: i++){
      |                    ^
a.cc:33:14: error: initializer in range-based 'for' loop
   33 |     for(int i=1: i<n: i++){
      |              ^
a.cc:33:21: error: found ':' in nested-name-specifier, expected '::'
   33 |     for(int i=1: i<n: i++){
      |                     ^
      |                     ::
a.cc:33:20: error: 'n' is not a class, namespace, or enumeration
   33 |     for(int i=1: i<n: i++){
      |                    ^
a.cc:34:18: error: 'max' cannot be used as a function
   34 |         max = max(max, v[i]-min);
      |               ~~~^~~~~~~~~~~~~~~
a.cc:35:18: error: 'min' cannot be used as a function
   35 |         min = min(min, v[i])
      |               ~~~^~~~~~~~~~~
Language: C++

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

static const int MAX = 200000;
#define dump(x) cerr << #x << " = " << (x) << endl;

int main()
{
    //cin.tie(0);
    //ios::sync_with_stdio(false);


    int n;
    cin >> n;

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

    int minv = v[0];
    int maxv = -INT_MAX;

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

    cout << maxv << endl;

}



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

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

static const int MAX = 200000;
#define dump(x) cerr << #x << " = " << (x) << endl;

int main()
{
    //cin.tie(0);
    //ios::sync_with_stdio(false);


    int n;
    cin >> n;

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

    int minv = v[0];
    int maxv = -(INT_MAX);

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

    cout << maxv << endl;

}



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

#include <iostream>
#include <algorithm>
using namespace std;
#define IINF (INT_MAX)

static const int MAX = 200000;
#define dump(x) cerr << #x << " = " << (x) << endl;

int main()
{
    //cin.tie(0);
    //ios::sync_with_stdio(false);


    int n;
    cin >> n;

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

    int minv = v[0];
    int maxv = -IINF;

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

    cout << maxv << endl;

}



Compiler output:
a.cc: In function 'int main()':
a.cc:4:15: error: 'INT_MAX' was not declared in this scope
    4 | #define IINF (INT_MAX)
      |               ^~~~~~~
a.cc:24:17: note: in expansion of macro 'IINF'
   24 |     int maxv = -IINF;
      |                 ^~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <algorithm>
  +++ |+#include <climits>
    3 | using namespace std;
Language: C++

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

int main(){
    int n, num[200000];
    cin >>n;
    for(int i = 0; i < n; i++){
        cin >> num[i];
    }
    int minv = num[0], maxv = -200000000;
    for(int i = 1; i<n; i++){
        mav = 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:13:9: error: 'mav' was not declared in this scope; did you mean 'maxv'?
   13 |         mav = max(maxv, R[i] - minv);
      |         ^~~
      |         maxv
a.cc:13:25: error: 'R' was not declared in this scope
   13 |         mav = max(maxv, R[i] - minv);
      |                         ^
Language: C++

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

int main(){
    int n, num[200000];
    cin >>n;
    for(int i = 0; i < n; i++){
        cin >> num[i];
    }
    int minv = num[0], maxv = -200000000;
    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:13:26: error: 'R' was not declared in this scope
   13 |         maxv = max(maxv, R[i] - minv);
      |                          ^
Language: C++

#include<iostreeam>
#include<algorithm>
using namespace std;
static const int MAX = 2000000;

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 ; i < n; i++){
 maxv =max(maxv,R[i]-minv);
 minv = min(minv,R[i]);
}

cout << maxv << endl;

return 0;
}


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

#include<iostreeam>
#include<algorithm>
using namespace std;
static const int MAX = 2000000;

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 ; i < n; i++){
 maxv =max(maxv,R[i]-minv);
 minv = min(minv,R[i]);
}

cout << maxv << endl;

return 0;
}


Compiler output:
a.cc:1:9: fatal error: iostreeam: No such file or directory
    1 | #include<iostreeam>
      |         ^~~~~~~~~~~
compilation terminated.
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,R[i]);
 }
	
	cout << maxv << endl;
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:37: error: 'r' was not declared in this scope
   10 |  for ( int i = 0;i < n; i++ )cin >> r[i];
      |                                     ^
Language: C++

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

int main()
{
    long int arr[200010]={0};
    long int arrmin=1000000000;
    int n=0;
    schanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&arr[i]);
        if(i==0) continue;
        if(i==1) long int dmax=arr[1]-arr[0];
        if(arr[i-1]<arr[i]){
            dmax=max(arr[i]-arrmin,dmax);
        }else{
            arrmin=min(arr[i],arrmin);
        }        
    } 
    printf("%d",&dmax);


    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: 'schanf' was not declared in this scope; did you mean 'scanf'?
   10 |     schanf("%d",&n);
      |     ^~~~~~
      |     scanf
a.cc:11:9: error: 'i' was not declared in this scope
   11 |     for(i=0;i<n;i++){
      |         ^
a.cc:16:13: error: 'dmax' was not declared in this scope
   16 |             dmax=max(arr[i]-arrmin,dmax);
      |             ^~~~
a.cc:21:18: error: 'dmax' was not declared in this scope
   21 |     printf("%d",&dmax);
      |                  ^~~~
Language: C++

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

int main()
{
    long int arr[200010]={0};
    long int arrmin=1000000000;
    int n=0;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&arr[i]);
        if(i==0) continue;
        if(i==1) long int dmax=arr[1]-arr[0];
        if(arr[i-1]<arr[i]){
            dmax=max(arr[i]-arrmin,dmax);
        }else{
            arrmin=min(arr[i],arrmin);
        }        
    } 
    printf("%d",&dmax);


    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'i' was not declared in this scope
   11 |     for(i=0;i<n;i++){
      |         ^
a.cc:16:13: error: 'dmax' was not declared in this scope
   16 |             dmax=max(arr[i]-arrmin,dmax);
      |             ^~~~
a.cc:21:18: error: 'dmax' was not declared in this scope
   21 |     printf("%d",&dmax);
      |                  ^~~~
Language: C++

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

int main()
{
    long int arr[200010]={0};
    long int arrmin=1000000000;
    int n=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&arr[i]);
        if(i==0) continue;
        if(i==1) long int dmax=arr[1]-arr[0];
        if(arr[i-1]<arr[i]){
            dmax=max(arr[i]-arrmin,dmax);
        }else{
            arrmin=min(arr[i],arrmin);
        }        
    } 
    printf("%d",&dmax);


    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:13: error: 'dmax' was not declared in this scope
   16 |             dmax=max(arr[i]-arrmin,dmax);
      |             ^~~~
a.cc:21:18: error: 'dmax' was not declared in this scope
   21 |     printf("%d",&dmax);
      |                  ^~~~