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


#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX=2000; b
int main()
{
	int R[MAX],n;
	cin>>n;

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

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

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

	cout<<maxv;


			
}

Compiler output:
a.cc:5:28: error: 'b' does not name a type
    5 | static const int MAX=2000; b
      |                            ^
Language: C++

// 1_1_D.cpp : ????????§??¶??°?????¨?¨?????????\??£??????
//

#include "stdafx.h"



#include<iostream>
using namespace std;
static const int MAX=2000; 
int main()
{
	int R[MAX],n;
	cin>>n;

	for(int i=0;i<n;i++)
		cin>>R[i];
	int max=-2000;
	int min=R[0];
	
	for(int i=1;i<n;i++)
	{
		if(max<R[i]-min)
			max=R[i]-min;
		
	}

	cout<<max;


			
}

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

// 1_1_D.cpp : ????????§??¶??°?????¨?¨?????????\??£??????
//

#include "stdafx.h"



#include<iostream>
using namespace std;
static const int MAX=2000; 
int main()
{
	int R[MAX],n;
	cin>>n;

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

	int max=-2000;
	int min=R[0];
	
	for(int i=1;i<n;i++)
	{

		if(min>R[i])
			min=R[i];
		if(max<R[i]-min)
			max=R[i]-min;
	}

	cout<<max;


			
}

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

#include <iostream>

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

    int R[n];

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

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

    for (int i = 2; i < n - 1; i++) {
        if (R[i] - minv > maxv) {
            maxv = R[i] - minv;
        }
        if (R[i] < minv) {
            minv = R[i];
        }
    }

    std::cout << maxv << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:26: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   25 |     std::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 <cstdint>
#include <vector>

#include "problems.hpp"

using namespace std;

int maximum_profit(vector<int32_t> &vec)
{
  int32_t max_val = INT32_MIN;
  int32_t min_val = INT32_MAX;
  for (auto iter = vec.begin(); iter != vec.end(); iter++) {
    max_val = max(max_val, *iter - min_val);
    min_val = min(min_val, *iter);
  }

  return max_val;
}

#if !defined(TEST)
#include <iostream>
int32_t main(void)
{
  int32_t num;
  cin >> num;

  vector<int32_t> vec;
  for (uint32_t i = 0; i < num; i++) {
    int32_t d;
    cin >> d;
    vec.push_back(d);
  }

  int32_t val = maximum_profit(vec);

  cout << val << endl;

  return 0;
}
#endif

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

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

static const int MAX = 200005

int main(){
    int n;
    scanf("%d", &n);

    int R[MAX];
    for (int idx = 0; idx < n; idx++){
        scanf("%d", &R[idx]);
    }

    long long res = (long long)R[1] - R[0];
    int preMin = R[0];
    for (int idx = 1; idx < n; idx++){
        long long currRes = (long long)R[idx] - preMin;
        if (currRes > res){
            res = currRes;
        }
        preMin = min(R[idx], preMin);
    }
    printf("%d", res);

    return 0;
}

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

#include <cstdio>
#include <algorithm>
using namespace std;
  
static const int MAX = 200005;
  
int main(){
    int n;
    cin >> n;
  
    int R[MAX];
    for (int idx = 0; idx < n; idx++){
        cin >> R[idx];
    }
  
    long long res = (long long)R[1] - R[0];
    int preMin = R[0];
    for (int idx = 1; idx < n; idx++){
        long long currRes = (long long)R[idx] - preMin;
        if (currRes > res){
            res = currRes;
        }
        preMin = min(R[idx], preMin);
    }
    cout << res << endl;
  
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: 'cin' was not declared in this scope
    9 |     cin >> n;
      |     ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <algorithm>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:25:5: error: 'cout' was not declared in this scope
   25 |     cout << res << endl;
      |     ^~~~
a.cc:25:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:25:20: error: 'endl' was not declared in this scope
   25 |     cout << res << endl;
      |                    ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include <algorithm>
  +++ |+#include <ostream>
    3 | using namespace std;
Language: C++

#include<iostream>
int main(){
long a[200001],n,min=1000000000,max=-1000000000;
cin>>n;
for(int i=0;i<n;i++){
cin>>a[i];
}
for(int i=0;i<n;i++){
if(a[i]<min)
min=a[i];

if(a[i]-min>max)
max=a[i]-min;


}
cout<<max<<'\n';

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:1: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    4 | 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:17:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   17 | cout<<max<<'\n';
      | ^~~~
      | std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
static const int N = 10000;
int a[N];
int x;
int i,n,flag;
int main(){
    ios::sync_with_stdio(false);
    cin>>n;
    int ans;
    for (i=0;i<n;i++){
        cin>>a[i];
    }
    int minv=a[0];
    int maxv;
    for (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:18:25: error: 'R' was not declared in this scope
   18 |         maxv = max(maxv,R[i]-minv);
      |                         ^
Language: C++

#include <algorithm>
using namespace std;
static const int N = 10000;
int a[N];
int x;
int i,n,flag;
int main(){
    ios::sync_with_stdio(false);
    cin>>n;
    int ans;
    for (i=0;i<n;i++){
        cin>>a[i];
    }
    int minv=a[0];
    int maxv=-20000;
    for (i=0;i<n;i++){
        maxv = max(maxv,a[i]-minv);
        minv = min(minv,a[i]);
    }
    
    cout<<maxv<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'ios' has not been declared
    8 |     ios::sync_with_stdio(false);
      |     ^~~
a.cc:9:5: error: 'cin' was not declared in this scope
    9 |     cin>>n;
      |     ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <algorithm>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:21:5: error: 'cout' was not declared in this scope
   21 |     cout<<maxv<<endl;
      |     ^~~~
a.cc:21:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:21:17: error: 'endl' was not declared in this scope
   21 |     cout<<maxv<<endl;
      |                 ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include <algorithm>
  +++ |+#include <ostream>
    2 | using namespace std;
Language: C++

#include<stdio.h>
#include<algorithm>
using namespace std;
static const int MAX = 200000;

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

  cin >> n;

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

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

  for(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:10:3: error: 'cin' was not declared in this scope
   10 |   cin >> n;
      |   ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include<algorithm>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:12:7: error: 'i' was not declared in this scope
   12 |   for(i = 0 ; i < n ; i++){
      |       ^
a.cc:19:7: error: 'i' was not declared in this scope
   19 |   for(i = 0 ; i < n ; i++){
      |       ^
a.cc:24:3: error: 'cout' was not declared in this scope
   24 |   cout << maxv << endl;
      |   ^~~~
a.cc:24:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:24:19: error: 'endl' was not declared in this scope
   24 |   cout << maxv << endl;
      |                   ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include<algorithm>
  +++ |+#include <ostream>
    3 | using namespace std;
Language: C++

#include<stdio.h>
#include<algorithm>
using namespace std;
static const int MAX = 200000;

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

  cin >> n;

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

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

  for(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:10:3: error: 'cin' was not declared in this scope
   10 |   cin >> n;
      |   ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include<algorithm>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:12:7: error: 'i' was not declared in this scope
   12 |   for(i = 0 ; i < n ; i++){
      |       ^
a.cc:19:7: error: 'i' was not declared in this scope
   19 |   for(i = 0 ; i < n ; i++){
      |       ^
a.cc:24:3: error: 'cout' was not declared in this scope
   24 |   cout << maxv << endl;
      |   ^~~~
a.cc:24:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:24:19: error: 'endl' was not declared in this scope
   24 |   cout << maxv << endl;
      |                   ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include<algorithm>
  +++ |+#include <ostream>
    3 | using namespace std;
Language: C++

#include<stdio.h>
#include<algorithm>
using namespace std;
static const int MAX = 200000;

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

  cin >> n;

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

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

  for(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:3: error: 'cin' was not declared in this scope
   10 |   cin >> n;
      |   ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include<algorithm>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:12:7: error: 'i' was not declared in this scope
   12 |   for(i = 0 ; i < n ; i++){
      |       ^
a.cc:19:7: error: 'i' was not declared in this scope
   19 |   for(i = 1 ; i < n ; i++){
      |       ^
a.cc:24:3: error: 'cout' was not declared in this scope
   24 |   cout << maxv << endl;
      |   ^~~~
a.cc:24:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:24:19: error: 'endl' was not declared in this scope
   24 |   cout << maxv << endl;
      |                   ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include<algorithm>
  +++ |+#include <ostream>
    3 | using namespace std;
Language: C++

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

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

  cin >> n;

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

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

  for(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:12:7: error: 'i' was not declared in this scope
   12 |   for(i = 0 ; i < n ; i++){
      |       ^
a.cc:19:7: error: 'i' was not declared in this scope
   19 |   for(i = 1 ; i < n ; i++){
      |       ^
Language: C++

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

int main() {
  int n, r[];

  cin >> n;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:6:10: error: storage size of 'r' isn't known
    6 |   int n, r[];
      |          ^
a.cc:10:39: error: expected primary-expression before ']' token
   10 |   for(int i = 0; i < n; ++i) cin >> r[];
      |                                       ^
Language: C++

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

int main() {
  int n, r[];

  cin >> n;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:6:10: error: storage size of 'r' isn't known
    6 |   int n, r[];
      |          ^
Language: C++

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

int main() {
  int n, r[];

  cin >> n;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:6:10: error: storage size of 'r' isn't known
    6 |   int n, r[];
      |          ^
Language: C++

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

int main() {
  int n, r[];

  cin >> n;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:6:10: error: storage size of 'r' isn't known
    6 |   int n, r[];
      |          ^
Language: C++

#include<stdio.h>
#include<algorithm>
using namespace std;
static const int M = 200000;

int main(){
int R[M],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:9:1: error: 'cin' was not declared in this scope
    9 | cin>>n;
      | ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include<algorithm>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:20:1: error: 'cout' was not declared in this scope
   20 | cout<<maxv<<endl;
      | ^~~~
a.cc:20:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:20:13: error: 'endl' was not declared in this scope
   20 | cout<<maxv<<endl;
      |             ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include<algorithm>
  +++ |+#include <ostream>
    3 | using namespace std;
Language: C++

#include<stdio.h>
#include<algorithm>
using namespace std;
static const int M = 200000;

int main(){
int R[M],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:9:1: error: 'cin' was not declared in this scope
    9 | cin >> n;
      | ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include<algorithm>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:20:1: error: 'cout' was not declared in this scope
   20 | cout << maxv << endl;
      | ^~~~
a.cc:20:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:20:17: error: 'endl' was not declared in this scope
   20 | cout << maxv << endl;
      |                 ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include<algorithm>
  +++ |+#include <ostream>
    3 | using namespace std;
Language: C++

#include<stdio.h>
#include<algorithm>
using namespace std;
static const int M = 200000;

int main(){
int R[M],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:9:1: error: 'cin' was not declared in this scope
    9 | cin >> n;
      | ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include<algorithm>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:20:1: error: 'cout' was not declared in this scope
   20 | cout << maxv << endl;
      | ^~~~
a.cc:20:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:20:17: error: 'endl' was not declared in this scope
   20 | cout << maxv << endl;
      |                 ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include<algorithm>
  +++ |+#include <ostream>
    3 | using namespace std;
Language: C++

import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    //??\???
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] R = new int[n];
    for(int i = 0; i < n; i++) {
      R[i] = sc.nextInt();
    }

    //?¨????----------------------------------------------------------------------
    int minv = 2000000000; //R[i]?????§????????????????°????R[t]
    int maxp = -2000000000; //?????§??????
    int t;    //temp
    for(int i = 0; i < n; i++) {  //???R[t]????????????????????????
      if (R[i] < minv)  minv = R[i];  //minv?????´??°
      t = R[i] - minv;  //?????§??????????¨????
      if(t > maxp)  maxp = t; //maxp????????§???????????°maxp?????´??°
    }

    //??????----------------------------------------------------------------------
    System.out.println(maxp);

  }
}

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

#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int n,a;
    cin >> n;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:9:17: error: invalid types 'int[int]' for array subscript
    9 |         cin >> a[i];
      |                 ^
a.cc:13:26: error: invalid types 'int[int]' for array subscript
   13 |         maxv = max(maxv,a[j]- minv);
      |                          ^
a.cc:14:26: error: invalid types 'int[int]' for array subscript
   14 |         minv = min(minv,a[j])
      |                          ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int n,a;
    cin >> n;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:9:17: error: invalid types 'int[int]' for array subscript
    9 |         cin >> a[i];
      |                 ^
a.cc:11:32: error: invalid types 'int[int]' for array subscript
   11 |     int maxv = -200000,minv = a[0];
      |                                ^
a.cc:13:26: error: invalid types 'int[int]' for array subscript
   13 |         maxv = max(maxv,a[j]- minv);
      |                          ^
a.cc:14:26: error: invalid types 'int[int]' for array subscript
   14 |         minv = min(minv,a[j])
      |                          ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int n,a[200000];
    cin >> n;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:14:30: error: expected ';' before '}' token
   14 |         minv = min(minv,a[j])
      |                              ^
      |                              ;
   15 |     }
      |     ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int n,a;
    cin >> n;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:9:17: error: invalid types 'int[int]' for array subscript
    9 |         cin >> a[i];
      |                 ^
a.cc:11:32: error: invalid types 'int[int]' for array subscript
   11 |     int maxv = -200000,minv = a[0];
      |                                ^
a.cc:13:26: error: invalid types 'int[int]' for array subscript
   13 |         maxv = max(maxv,a[j]- minv);
      |                          ^
a.cc:14:26: error: invalid types 'int[int]' for array subscript
   14 |         minv = min(minv,a[j]);
      |                          ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int n,a;
    cin >> n;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:9:17: error: invalid types 'int[int]' for array subscript
    9 |         cin >> a[i];
      |                 ^
a.cc:11:17: error: invalid types 'int[int]' for array subscript
   11 |     int maxv = a[1]-a[0],minv = a[0];
      |                 ^
a.cc:11:22: error: invalid types 'int[int]' for array subscript
   11 |     int maxv = a[1]-a[0],minv = a[0];
      |                      ^
a.cc:13:26: error: invalid types 'int[int]' for array subscript
   13 |         maxv = max(maxv,a[j] - minv);
      |                          ^
a.cc:13:32: error: 'minv' was not declared in this scope
   13 |         maxv = max(maxv,a[j] - minv);
      |                                ^~~~
a.cc:14:26: error: invalid types 'int[int]' for array subscript
   14 |         minv = min(minv,a[j]);
      |                          ^
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;
#define MAX 200000

int main(void) {
	int R[MAX], n=0;
	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;
	

Compiler output:
a.cc: In function 'int main()':
a.cc:20:30: error: expected '}' at end of input
   20 |         cout << maxv << endl;
      |                              ^
a.cc:7:16: note: to match this '{'
    7 | int main(void) {
      |                ^
Language: C++

#include <iostream>
#include <list>
#include <cmath>
#include<vector>
#include <utility>
using namespace std;

#define D

#ifdef D

int main(void)
{
	int n;
	cin >> n;
	int max = INT_MIN;
	int min = INT_MAX;
	int dis,in;
	for (size_t i = 0; i < n; i++)
	{
		cin >> in;
		if (min > in)
			min = in;
		if (max < in - min)
			max = in - min;

	}


	cout << max << endl;

	return 0;
}
#endif // D

Compiler output:
a.cc: In function 'int main()':
a.cc:16:19: error: 'INT_MIN' was not declared in this scope
   16 |         int max = INT_MIN;
      |                   ^~~~~~~
a.cc:6:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    5 | #include <utility>
  +++ |+#include <climits>
    6 | using namespace std;
a.cc:17:19: error: 'INT_MAX' was not declared in this scope
   17 |         int min = INT_MAX;
      |                   ^~~~~~~
a.cc:17:19: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

using System;
class A{
 
static void Main(){
int n=int.Parse(Console.ReadLine());
var a=new int[n];
int max=0;
for(int i=0;i<n;i++){
a[i]=int.Parse(Console.ReadLine());
for(int j=0;j<i;j++){
max=Math.Max(a[j]-a[i],max);
}
}
Console.WriteLine(max);
///
}}

Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:16:3: error: expected ';' after class definition
   16 | }}
      |   ^
      |   ;
a.cc: In static member function 'static void A::Main()':
a.cc:5:7: error: expected primary-expression before 'int'
    5 | int n=int.Parse(Console.ReadLine());
      |       ^~~
a.cc:6:1: error: 'var' was not declared in this scope
    6 | var a=new int[n];
      | ^~~
a.cc:9:1: error: 'a' was not declared in this scope
    9 | a[i]=int.Parse(Console.ReadLine());
      | ^
a.cc:9:6: error: expected primary-expression before 'int'
    9 | a[i]=int.Parse(Console.ReadLine());
      |      ^~~
a.cc:11:5: error: 'Math' was not declared in this scope
   11 | max=Math.Max(a[j]-a[i],max);
      |     ^~~~
a.cc:14:1: error: 'Console' was not declared in this scope
   14 | Console.WriteLine(max);
      | ^~~~~~~
Language: C++

#include<iostream>
using namespace std;
int main() {
    int num, i, j, max_profit;
    cin >> num;
    int arr[num];
    for (i = 0; i < num; i++) {
        cin>>arr[i];
    }
    max_profit = arr[1] - arr[0];
    for (i = 0; i < num-1; i++) {
        for (j = i+1; j < num; j++) {
            if (max_profit < arr[j] - arr[i];) {
                max_profit = arr[j] - arr[i];
            }
        }
    }
    cout<<max_profit<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:46: error: expected primary-expression before ')' token
   13 |             if (max_profit < arr[j] - arr[i];) {
      |                                              ^
Language: C++

#include "stdafx.h"
#include <iostream>
#include <vector>

int main()
{
	std::vector<long> Dat = {};
	int t = 0;
	std::cin >> t;
	for (int i = 0; i<t; i++)
	{
		int tmp = 0;
		std::cin >> tmp;
		Dat.push_back(tmp);
	}
	long max = *(Dat.begin()+1)- *Dat.begin();
	for (auto cur = Dat.begin(); cur != Dat.end() - 1; cur++)// may bug
	{
		long start = *cur;
		long tmp = *(cur + 1);
		for (auto curr = cur + 2; curr != Dat.end(); curr++)
		{
			if (*curr>tmp) tmp = *curr;
		}
		if (tmp - *cur>max) max = tmp - *cur;
	}
	std::cout << max;
	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>
#include <vector>

int main()
{
	std::vector<long> Dat = {};
	int t = 0;
	std::cin >> t;
	for (int i = 0; i<t; i++)
	{
		int tmp = 0;
		std::cin >> tmp;
		Dat.push_back(tmp);
	}
	long min=*Dat.begin(),max=-2E9;
	for (auto cur = Dat.begin()+1; cur != Dat.end() ; cur++)
	{
		if (*(cur - 1) < min)min = *(cur - 1);
		if (*cur - min > max)max = *cur - min;
	}
	std::cout << max<<std::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 <cstdio>
#include <algorithm>

constexpr int inf = 1e30;

int main() {
  int n, maxv, minv, r;

  scanf("%d", &n);
  maxv = -inf;
  scanf("%d", &minv);

  for (int i = 1; i < n; i++) {
    scanf("%d", &r);
    maxv = max(maxv, r - minv);
    minv = min(minv, r)
  }

  printf("%d\n", maxv);
  return 0;
}

Compiler output:
a.cc:4:21: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+30' to '2147483647' [-Woverflow]
    4 | constexpr int inf = 1e30;
      |                     ^~~~
a.cc:4:21: error: overflow in constant expression [-fpermissive]
a.cc:4:21: error: overflow in constant expression [-fpermissive]
a.cc: In function 'int main()':
a.cc:15:12: error: 'max' was not declared in this scope; did you mean 'std::max'?
   15 |     maxv = max(maxv, r - 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:16:12: error: 'min' was not declared in this scope; did you mean 'std::min'?
   16 |     minv = min(minv, r)
      |            ^~~
      |            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 <cstdio>
#include <algorithm>

constexpr int inf = 1<<20;

int main() {
  int n, maxv, minv, r;

  scanf("%d", &n);
  maxv = -inf;
  scanf("%d", &minv);

  for (int i = 1; i < n; i++) {
    scanf("%d", &r);
    maxv = max(maxv, r - minv);
    minv = min(minv, r)
  }

  printf("%d\n", maxv);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:12: error: 'max' was not declared in this scope; did you mean 'std::max'?
   15 |     maxv = max(maxv, r - 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:16:12: error: 'min' was not declared in this scope; did you mean 'std::min'?
   16 |     minv = min(minv, r)
      |            ^~~
      |            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 <cstdio>
#include <algorithm>
using namespace std;

constexpr int inf = 1<<20;

int main() {
  int n, maxv, minv, r;

  scanf("%d", &n);
  maxv = -inf;
  scanf("%d", &minv);

  for (int i = 1; i < n; i++) {
    scanf("%d", &r);
    maxv = max(maxv, r - minv);
    minv = min(minv, r)
  }

  printf("%d\n", maxv);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:24: error: expected ';' before '}' token
   17 |     minv = min(minv, r)
      |                        ^
      |                        ;
   18 |   }
      |   ~
Language: C++

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

int main(){
	int n;
	long long int num[200000],max1=-1000000000,min1=1000000000;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> num[i];
		min1 = min(min1,num[i]);
		max1 = max(max1,num[i]-min1)
	}
	cout << max1 << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:45: error: expected ';' before '}' token
   12 |                 max1 = max(max1,num[i]-min1)
      |                                             ^
      |                                             ;
   13 |         }
      |         ~
Language: C++

#include <stdio.h>

int main(void)
{
 int n,t,R[],max,min;

 scanf("%d",&n");

 for(t=0;t<n;t++){
  scanf("%d",&R[t]);
 }

 min=R[0];
 max=0;
 for(t=1;t<n;t++){
  if( max^2 < (R[t]-min)^2 ){
    max = R[t]-min;
  }
  if( min > R[t] ){
    min = R[t];
  }
 }

 printf("%d",max);

 return 0;

}

Compiler output:
a.cc:7:15: warning: missing terminating " character
    7 |  scanf("%d",&n");
      |               ^
a.cc:7:15: error: missing terminating " character
    7 |  scanf("%d",&n");
      |               ^~~
a.cc: In function 'int main()':
a.cc:5:10: error: storage size of 'R' isn't known
    5 |  int n,t,R[],max,min;
      |          ^
a.cc:7:15: error: expected ')' before 'for'
    7 |  scanf("%d",&n");
      |       ~       ^
      |               )
    8 | 
    9 |  for(t=0;t<n;t++){
      |  ~~~           
a.cc:9:17: error: expected ';' before ')' token
    9 |  for(t=0;t<n;t++){
      |                 ^
      |                 ;
Language: C++

#include<bits/stdc++.h>
#define ll long long int
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n)
using namespace std;

int main () {
  int n, maxv, minv;
  cin >> n;
  int r [n], maxv = -1000000001;
  int minv = 1000000001;
  for (int i = 0; i <= n; i++) {
    cin >> r [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:11:14: error: redeclaration of 'int maxv'
   11 |   int r [n], maxv = -1000000001;
      |              ^~~~
a.cc:9:10: note: 'int maxv' previously declared here
    9 |   int n, maxv, minv;
      |          ^~~~
a.cc:12:7: error: redeclaration of 'int minv'
   12 |   int minv = 1000000001;
      |       ^~~~
a.cc:9:16: note: 'int minv' previously declared here
    9 |   int n, maxv, minv;
      |                ^~~~
Language: C++

#include<bits/stdc++.h>
#define ll long long int
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n)
using namespace std;

int main () {
  cin >> n;
  int r [n]; 
  int maxv = -1000000001;
  int minv = 1000000001;
  for (int i = 0; i <= n; i++) {
    cin >> r [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:9:10: error: 'n' was not declared in this scope; did you mean 'yn'?
    9 |   cin >> n;
      |          ^
      |          yn
a.cc:14:12: error: 'r' was not declared in this scope
   14 |     cin >> r [i];
      |            ^
Language: C++

#include<bits/stdc++.h>
#define ll long long int
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n)
using namespace std;

int main () {
  int n;
  cin >> n;
  int r[n]; 
    for (int i = 0; i < n; i++) {
    cin >> r[i];
  }
  int maxv = -1000000001;
  int minv = 1000000001;

  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:20:25: error: 'i' was not declared in this scope
   20 |     minv = min (minv, r[i]);
      |                         ^
a.cc: At global scope:
a.cc:22:3: error: 'cout' does not name a type
   22 |   cout << maxv << endl;
      |   ^~~~
a.cc:23:3: error: expected unqualified-id before 'return'
   23 |   return 0;
      |   ^~~~~~
a.cc:24:1: error: expected declaration before '}' token
   24 | }
      | ^
Language: C++

#include <iostream>
#include <vector>
#include <limits>

using namespace std;

int solve(const vector<int> &v) {
    int res = numeric_limits<int>::min();
    for (int i = 0; i < v.size(); i++) {
        for (int j = i + 1; j < v.size(); j++) {
            res = max(res, v[j] - v[i]);
        }
    }
    return res;
}

int solve2(const vector<int> &v) {
    struct stock { int time; int value; };
    vector<stock> pv;
    for (int i = 0; i < v.size(); i++) {
        pv.push_back({i, v[i]});
    }
    sort(pv.begin(), pv.end(), [](auto l, auto r) { return l.value > r.value; });
    size_t l = 0;
    size_t r = pv.size() - 1;
    while (true) {
        if (pv[l].time > pv[r].time) {
            break;
        }
        if (r - l == 1) {
            break;
        }

        auto lcond = pv[l + 1].time > pv[r].time;
        auto rcond = pv[l].time > pv[r - 1].time;
        auto lvalue = pv[l + 1].value - pv[r].value;
        auto rvalue = pv[l].value - pv[r - 1].value;

        if (lcond && rcond) {
            if (lvalue > rvalue) {
                l++;
            } else {
                r--;
            }
            break;
        } else if (lcond) {
            l++;
            break;
        } else if (rcond) {
            r--;
            break;
        }
        l++;
        r--;
        if (r < l) {
            break;
        }
    }
    return pv[l].value - pv[r].value;
}

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

    vector<int> v;
    for (int i = 0; i < n; i++) {
        int val;
        cin >> val;
        v.push_back(val);
    }

    //cout << solve(v) << endl;
    cout << solve2(v) << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int solve2(const std::vector<int>&)':
a.cc:23:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   23 |     sort(pv.begin(), pv.end(), [](auto l, auto r) { return l.value > r.value; });
      |     ^~~~
      |     short
Language: C++

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

int main() {
	int i, j,n,Rt[200000],max;
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d", &Rt[i]);
	}
	max = 0;
	for (i = 0; i < n; i++) {
		for (j = i+1; j < n; j++) {
			if (Rt[j] > Rt[i]) {
				max = Rt[j] - Rt[i];
			}
		}
	}
	printf("%d\n",max)

}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:27: error: expected ';' before '}' token
   18 |         printf("%d\n",max)
      |                           ^
      |                           ;
   19 | 
   20 | }
      | ~
Language: C++

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

int main() {
	int i, j,n,Rt[200000],max;
	scanf_s("%d", &n);
	for (i = 0; i < n; i++) {
		scanf_s("%d", &Rt[i]);
	}
	max = 0;
	for (i = 0; i < n; i++) {
		for (j = i+1; j < n; j++) {
			if (max < Rt[j] - Rt[i]) {
				max = Rt[j] - Rt[i];
			}
		}
	}
	printf("%d\n", max);

}

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

#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

typedef signed long long ll;

#define MIN(a, b)   (a < b) ? a : b
#define MAX(a, b)   (a > b) ? a : b

int main(void)
{
    int N = 0;
    int R = 0;
    int min = INT_MAX;
    int max = -INT_MAX;

    for(int i = 0;i < N;i++)
    {
        cin >> R;
        max = MAX(max, (R - min));
        min = MIN(R, min);
    }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:18:15: error: 'INT_MAX' was not declared in this scope
   18 |     int min = INT_MAX;
      |               ^~~~~~~
a.cc:7:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    6 | #include <vector>
  +++ |+#include <climits>
    7 | using namespace std;
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 maxValue = -2000000000;
    int minValue = R[0];
    for(int j=1;){
        maxValue = max(maxValue, R[j]-minValue);
        minValue = min(minValue, R[j]);
    }
    cout << maxValue << endl;
    return 0
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:17: error: expected primary-expression before ')' token
   13 |     for(int j=1;){
      |                 ^
a.cc:13:17: error: expected ';' before ')' token
   13 |     for(int j=1;){
      |                 ^
      |                 ;
a.cc:18:13: error: expected ';' before '}' token
   18 |     return 0
      |             ^
      |             ;
   19 | }
      | ~
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 maxValue = -2000000000;
    int minValue = R[0];
    for(int j=1; j<n; j++){
        maxValue = max(maxValue, R[j]-minValue);
        minValue = min(minValue, R[j]);
    }
    cout << maxValue << endl;
    return 0
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:13: error: expected ';' before '}' token
   18 |     return 0
      |             ^
      |             ;
   19 | }
      | ~
Language: C++

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

int greater(int a, int b)
{
	return a >= b ? a : b;
}

int main()
{
	int n;
	cin >> n;
	vector<int> Rt(n);
	for (int i = 0; i < n; i++) {
		cin >> Rt[i];
	}
	
	int posL = 0;
	int maxv = Rt[1] - Rt[0];
	for (int i = 1; i < n; i++) {
		if (Rt[i] <= Rt[posL])
			posL = i;
		else
			maxv = greater(maxv, Rt[i] - Rt[posL]);
	}
	cout << maxv << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:32: error: reference to 'greater' is ambiguous
   25 |                         maxv = greater(maxv, Rt[i] - Rt[posL]);
      |                                ^~~~~~~
In file included from /usr/include/c++/14/string:49,
                 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_function.h:353:12: note: candidates are: 'template<class _Tp> struct std::greater'
  353 |     struct greater;
      |            ^~~~~~~
a.cc:5:5: note:                 'int greater(int, int)'
    5 | int greater(int a, int b)
      |     ^~~~~~~
Language: C++

#include <algorithm>
#include <iostream>
#include <iterator>

template <typename T>
std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) {
  if(!v.empty()) {
    std::copy(v.begin(), v.end() - 1, std::ostream_iterator<T>(out, " "));
    out << v.back();
  } else {
    out << "";
  }
  return out;
}

int bubblesort(std::vector<int> &xs) {
  int len = xs.len();
  int cnt_swap = 0;
  bool flag = true;
  while(flag) {
    flag = false;
    for(int i = len - 1; i >= 1; --i) {
      if(xs[j] < xs[j - 1]) {
        std::swap(xs[j], xs[j - 1]);
        flag = true;
        cnt_swap++;
      }
    }
  }
  return cnt_swap;
}

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

  std::vector<int> xs;
  int x;
  for(int i = 0; i < n; ++i) {
    std::cin >> x;
    xs.push_back(x);
  }

  int cnt = bubblesort(xs);

  std::cout << xs << std::endl;
  std::cout << cnt << std::endl;

  return 0;
}

Compiler output:
a.cc:6:56: error: 'vector' in namespace 'std' does not name a template type
    6 | std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) {
      |                                                        ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include <iterator>
  +++ |+#include <vector>
    4 | 
a.cc:6:62: error: expected ',' or '...' before '<' token
    6 | std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) {
      |                                                              ^
a.cc: In function 'std::ostream& operator<<(std::ostream&, int)':
a.cc:7:7: error: 'v' was not declared in this scope
    7 |   if(!v.empty()) {
      |       ^
a.cc: At global scope:
a.cc:16:21: error: 'vector' is not a member of 'std'
   16 | int bubblesort(std::vector<int> &xs) {
      |                     ^~~~~~
a.cc:16:21: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:16:28: error: expected primary-expression before 'int'
   16 | int bubblesort(std::vector<int> &xs) {
      |                            ^~~
a.cc: In function 'int main()':
a.cc:37:8: error: 'vector' is not a member of 'std'
   37 |   std::vector<int> xs;
      |        ^~~~~~
a.cc:37:8: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:37:15: error: expected primary-expression before 'int'
   37 |   std::vector<int> xs;
      |               ^~~
a.cc:41:5: error: 'xs' was not declared in this scope; did you mean 'x'?
   41 |     xs.push_back(x);
      |     ^~
      |     x
a.cc:44:24: error: 'xs' was not declared in this scope; did you mean 'x'?
   44 |   int cnt = bubblesort(xs);
      |                        ^~
      |                        x
a.cc:44:26: error: 'bubblesort' cannot be used as a function
   44 |   int cnt = bubblesort(xs);
      |                          ^
Language: C++

#include <stdio.h>
#include <iostream>
#include <fstream>
using namespace std;

int main(){
  int n;
  cin >> n; cin.ignore();

  if (n < 2) {
    cout << 0 << endl;
    return 0;
  }

  int ary[n];
  for (uint32_t i = 0; i < n; i++) {
    cin >> ary[i];
    //cout << ary[i] << endl;
  }

  int maxProf = ary[1] - ary[0];
  int minRi = ary[0];
  for (uint32_t i = 3; i < n; i++) {
    if (minRi > ary[i-1])
      minRi = ary[i-1];

    int profit = ary[i] - minRi;
    if (maxProf < profit)
      maxProf = profit;
  }

  cout << maxProf << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:8: error: 'uint32_t' was not declared in this scope
   16 |   for (uint32_t i = 0; i < n; i++) {
      |        ^~~~~~~~
a.cc:4:1: note: 'uint32_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    3 | #include <fstream>
  +++ |+#include <cstdint>
    4 | using namespace std;
a.cc:16:24: error: 'i' was not declared in this scope
   16 |   for (uint32_t i = 0; i < n; i++) {
      |                        ^
a.cc:23:8: error: 'uint32_t' was not declared in this scope
   23 |   for (uint32_t i = 3; i < n; i++) {
      |        ^~~~~~~~
a.cc:23:8: note: 'uint32_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
a.cc:23:24: error: 'i' was not declared in this scope
   23 |   for (uint32_t i = 3; i < n; i++) {
      |                        ^
Language: C++

#include <iostream>
#include <array>

using namespace std;
const int MAX = 200000;

int main(int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;

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

    int maxv;
    for (int j = 1; j < n-1; j++) {
        for (int i = 0; i < j-1; i++) {
            maxv = (R[j]-R[i] > maxv) ? R[j]-R[i] : maxv;
        }
    }

    println(maxv)

    return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:26:5: error: 'println' was not declared in this scope; did you mean 'printf'?
   26 |     println(maxv)
      |     ^~~~~~~
      |     printf