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

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

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

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

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

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:47:55: error: expected ';' before '}' token
   47 |     max_diff = std::max(max_diff, R_max[i] - R_min[i])
      |                                                       ^
      |                                                       ;
   48 |   }
      |   ~                                                    
a.cc:50:57: error: expected ';' before '}' token
   50 |     max_diff = std::max(max_diff, R_max[i+1] - R_min[i])
      |                                                         ^
      |                                                         ;
   51 |   }
      |   ~
Language: C++

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

int main() {
  int n, in, min_d, max_d;

  cin >> n;   // n???
  cin >> in;  // ???????????????
  min_d = in; // ?????????
  max_d = INT_MIN; // ?????????

  for (int i = 1; i < n; ++i) {
    cin >> in;
    max_d = max(max_d, in - min_d);
    min_d = min(min_d, in);
  }

  cout << max_d << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:11: error: 'INT_MIN' was not declared in this scope
   11 |   max_d = INT_MIN; // ?????????
      |           ^~~~~~~
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;
Language: C++



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


int main(){

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

Compiler output:
a.cc: In function 'int main()':
a.cc:29:5: error: 'out' was not declared in this scope
   29 |     out << maxv << endl;
      |     ^~~
Language: C++

import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] array= new int[n];
        for (int i = 0; i < n; i++){
            array[i] =  Integer.parseInt(br.readLine());
        }
        int minv = array[0];
        int maxv = Integer.MIN_VALUE;
        for (int j = 1; j < n; j++){
            maxv = max(maxv, array[j] - minv);
            minv = min(minv, array[j]);
            System.out.println(maxv + " " + minv);
        }
        System.out.println(maxv);
    }
    static int max(int a, int b){
        if (a > b){
            return a;
        }else{
            return b;
        }
    }
    static int min(int a, int b){
        if (a > b){
            return b;
        }else{
            return a;
        }
    }
}

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

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

int main() {
int data_size;
cin >>data_size;
int r[data_size];
for(int i=0;i<data_size;i++)
	cin>> r[i];
int min_value=r[0];
int diff_max=-1e10;
for(int j=1;j<data_size;j++){
	if(diff_max<=r[j]-min_value);
	if(r[i]>=min_value) min_value=r[i];
}

cout<<diff_max;
	
	

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:14: warning: overflow in conversion from 'double' to 'int' changes value from '-1.0e+10' to '-2147483648' [-Woverflow]
   12 | int diff_max=-1e10;
      |              ^~~~~
a.cc:15:14: error: 'i' was not declared in this scope
   15 |         if(r[i]>=min_value) min_value=r[i];
      |              ^
Language: C++

import java.io.*;

class Main{

static final PrintWriter out=new PrintWriter(System.out);

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while(line=br.readLine())!=null&&!line.isEmpty()){
int n=Integer.parseInt(line);
int[] r=new int[n];
for(int i=0;i<n;i++) r[i]=Integer.parseInt(br.readLine());
int ans=Integer.MIN_VALUE;
for(int i=1;i<n;i++){
for(int j=0;j<n&&i>j;j++){
ans=Math.max(ans,r[i]-r[j]);
}
}
out.println(ans);
out.flush();
}
}
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.io.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:8: error: 'final' does not name a type
    5 | static final PrintWriter out=new PrintWriter(System.out);
      |        ^~~~~
a.cc:7:7: error: expected ':' before 'static'
    7 | public static void main(String[] args) throws IOException{
      |       ^~~~~~~
      |       :
a.cc:7:25: error: 'String' has not been declared
    7 | public static void main(String[] args) throws IOException{
      |                         ^~~~~~
a.cc:7:34: error: expected ',' or '...' before 'args'
    7 | public static void main(String[] args) throws IOException{
      |                                  ^~~~
a.cc:7:38: error: expected ';' at end of member declaration
    7 | public static void main(String[] args) throws IOException{
      |                                      ^
      |                                       ;
a.cc:7:40: error: 'throws' does not name a type
    7 | public static void main(String[] args) throws IOException{
      |                                        ^~~~~~
a.cc:24:2: error: expected ';' after class definition
   24 | }
      |  ^
      |  ;
Language: C++

import java.io.*;
 
class Main{
 
static final PrintWriter out=new PrintWriter(System.out);
 
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
int n=Integer.parseInt(line);
int[] r=new int[n];
for(int i=0;i<n;i++) r[i]=Integer.parseInt(br.readLine());
int ans=Integer.MIN_VALUE;
int min=r[0];
for(int i=1;i<n;i++){
ans=Math.max(ans,r[i]-min);
min=Mat.min(min,r[i]);
}
out.println(ans);
out.flush();
}
}
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.io.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:8: error: 'final' does not name a type
    5 | static final PrintWriter out=new PrintWriter(System.out);
      |        ^~~~~
a.cc:7:7: error: expected ':' before 'static'
    7 | public static void main(String[] args) throws IOException{
      |       ^~~~~~~
      |       :
a.cc:7:25: error: 'String' has not been declared
    7 | public static void main(String[] args) throws IOException{
      |                         ^~~~~~
a.cc:7:34: error: expected ',' or '...' before 'args'
    7 | public static void main(String[] args) throws IOException{
      |                                  ^~~~
a.cc:7:38: error: expected ';' at end of member declaration
    7 | public static void main(String[] args) throws IOException{
      |                                      ^
      |                                       ;
a.cc:7:40: error: 'throws' does not name a type
    7 | public static void main(String[] args) throws IOException{
      |                                        ^~~~~~
a.cc:24:2: error: expected ';' after class definition
   24 | }
      |  ^
      |  ;
Language: C++

import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		int max = -200000;
		Scanner san = new Scanner(System.in);
		int listCount = san.nextInt();
		int[] list = new int[listCount];
		for(int i = 0; i < listCount; i++){
			list[i] = san.nextInt();
		}
		int min = list[0];
		for(int i = 1; i < listCount; i++){
			max = Math.max(max, list[i] - min);
			min = Math.min(min, list[i]);
		}
		System.out.println(max);
	}
}

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

int m(int R[i], int R[j]);

int main() {
  int R[n];
  int max;

  cin >> n;

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

  for(int i = 0; i < n-2; i++){
    for(j = 1; j < n-1; j++){
      m(i, j);
    }
  }

  return max;
}



int m(int R[i], int R[j]){
if(i = 0 && j=1){
  max = R[j] - R[i];
}else{
    max = max(max,R[j]-R[i]);
  }
}

Compiler output:
a.cc:4:13: error: 'i' was not declared in this scope
    4 | int m(int R[i], int R[j]);
      |             ^
a.cc:4:15: error: expected ')' before ',' token
    4 | int m(int R[i], int R[j]);
      |      ~        ^
      |               )
a.cc:4:17: error: expected unqualified-id before 'int'
    4 | int m(int R[i], int R[j]);
      |                 ^~~
a.cc: In function 'int main()':
a.cc:7:9: error: 'n' was not declared in this scope
    7 |   int R[n];
      |         ^
a.cc:13:12: error: 'R' was not declared in this scope
   13 |     cin >> R[i];
      |            ^
a.cc:17:9: error: 'j' was not declared in this scope
   17 |     for(j = 1; j < n-1; j++){
      |         ^
a.cc: At global scope:
a.cc:27:13: error: 'i' was not declared in this scope
   27 | int m(int R[i], int R[j]){
      |             ^
a.cc:27:15: error: expected ')' before ',' token
   27 | int m(int R[i], int R[j]){
      |      ~        ^
      |               )
a.cc:27:17: error: expected unqualified-id before 'int'
   27 | int m(int R[i], int R[j]){
      |                 ^~~
Language: C++

#include <iostream>
using namespace std;

int m(int R[i], int R[j]){
if(i = 0 && j=1){
  max = R[j] - R[i];
}else{
    max = max(max,R[j]-R[i]);
  }
}

int main() {
  int R[n];
  int max;

  cin >> n;

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

  for(int i = 0; i < n-2; i++){
    for(j = 1; j < n-1; j++){
      m(i, j);
    }
  }

  return max;
}

Compiler output:
a.cc:4:13: error: 'i' was not declared in this scope
    4 | int m(int R[i], int R[j]){
      |             ^
a.cc:4:15: error: expected ')' before ',' token
    4 | int m(int R[i], int R[j]){
      |      ~        ^
      |               )
a.cc:4:17: error: expected unqualified-id before 'int'
    4 | int m(int R[i], int R[j]){
      |                 ^~~
a.cc: In function 'int main()':
a.cc:13:9: error: 'n' was not declared in this scope
   13 |   int R[n];
      |         ^
a.cc:19:12: error: 'R' was not declared in this scope
   19 |     cin >> R[i];
      |            ^
a.cc:23:9: error: 'j' was not declared in this scope
   23 |     for(j = 1; j < n-1; j++){
      |         ^
Language: C++

#include <iostream>
using namespace std;

int m(int x, int y){
if(i = 0 && j=1){
  max = y - x;
}else{
    max = max(x, y);
  }
}

int main() {
  int R[n];
  int max;

  cin >> n;

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

  for(int i = 0; i < n-2; i++){
    for(j = 1; j < n-1; j++){
      m(R[i], R[j]);
    }
  }

  return max;
}

Compiler output:
a.cc: In function 'int m(int, int)':
a.cc:5:4: error: 'i' was not declared in this scope
    5 | if(i = 0 && j=1){
      |    ^
a.cc:5:13: error: 'j' was not declared in this scope
    5 | if(i = 0 && j=1){
      |             ^
a.cc:6:13: error: overloaded function with no contextual type information
    6 |   max = y - x;
      |             ^
a.cc:8:19: error: overloaded function with no contextual type information
    8 |     max = max(x, y);
      |                   ^
a.cc:10:1: warning: no return statement in function returning non-void [-Wreturn-type]
   10 | }
      | ^
a.cc: In function 'int main()':
a.cc:13:9: error: 'n' was not declared in this scope
   13 |   int R[n];
      |         ^
a.cc:19:12: error: 'R' was not declared in this scope
   19 |     cin >> R[i];
      |            ^
a.cc:23:9: error: 'j' was not declared in this scope
   23 |     for(j = 1; j < n-1; j++){
      |         ^
a.cc:24:9: error: 'R' was not declared in this scope
   24 |       m(R[i], R[j]);
      |         ^
Language: C++

#include <iostream>
using namespace std;

int main() {
  int R[n];
  int max;

  cin >> n;

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

  for(int i = 0; i < n-1; i++){
    for(j = 1; j < n; j++){
      if(i = 0 && j=1){
        max = R[j] - R[i];
      }else{
          max = max(max, R[j] - R[i]);
        }
      }  
    }
  }

  return max;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: 'n' was not declared in this scope
    5 |   int R[n];
      |         ^
a.cc:11:12: error: 'R' was not declared in this scope
   11 |     cin >> R[i];
      |            ^
a.cc:15:9: error: 'j' was not declared in this scope
   15 |     for(j = 1; j < n; j++){
      |         ^
a.cc:17:15: error: 'R' was not declared in this scope
   17 |         max = R[j] - R[i];
      |               ^
a.cc:19:26: error: 'R' was not declared in this scope
   19 |           max = max(max, R[j] - R[i]);
      |                          ^
a.cc:19:37: error: 'max' cannot be used as a function
   19 |           max = max(max, R[j] - R[i]);
      |                                     ^
a.cc: At global scope:
a.cc:25:3: error: expected unqualified-id before 'return'
   25 |   return max;
      |   ^~~~~~
a.cc:26:1: error: expected declaration before '}' token
   26 | }
      | ^
Language: C++

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

int main() {
  int n;
  int R[n];
  int m;

  cin >> n;

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

  for(int i = 0; i < n-1; i++){
    for(int j = 1; j < n; j++){
      if(i = 0 && j=1){
        m = R[j] - R[i];
      }else{
          m = max(max, R[j] - R[i]);
        }
      }  
    }

  return m;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:16: error: lvalue required as left operand of assignment
   18 |       if(i = 0 && j=1){
      |              ~~^~~~
a.cc:21:18: error: no matching function for call to 'max(<unresolved overloaded function type>, int)'
   21 |           m = max(max, R[j] - R[i]);
      |               ~~~^~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'constexpr const _Tp& std::max(const _Tp&, const _Tp&) [with _Tp = int]'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:20: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const int&'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |         ~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
Language: C++

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

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

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

    int maxv = -200000
    int minv = R[0]

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

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

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

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

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

    int maxv = -200000
    int minv = R[0]

  for(int i = 1; j < 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:7:9: error: expected unqualified-id before 'int'
    7 |   int n,int R[MAX];
      |         ^~~
a.cc:11:12: error: 'R' was not declared in this scope
   11 |     cin >> R[i];
      |            ^
a.cc:15:5: error: expected ',' or ';' before 'int'
   15 |     int minv = R[0]
      |     ^~~
a.cc:17:18: error: 'j' was not declared in this scope
   17 |   for(int i = 1; j < n; i++){
      |                  ^
a.cc:17:25: error: 'i' was not declared in this scope
   17 |   for(int i = 1; j < n; i++){
      |                         ^
Language: C++

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

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

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

  int min = R[0];
  int max = R[0];
  int score = 0;
  for (int i = 1; i < n; i++) {
    if (R[0] > R[i]) {
      if (min > R[i]]) {
        min = R[i];
    }
    else {
      score = (score < R[i]) ?  R[i] - min : score;
    }
  }

  cout << score << endl;

  return 0;
}

  

Compiler output:
a.cc: In function 'int main()':
a.cc:21:21: error: expected ')' before ']' token
   21 |       if (min > R[i]]) {
      |          ~          ^
      |                     )
a.cc:21:21: error: expected primary-expression before ']' token
a.cc:32:2: error: expected '}' at end of input
   32 | }
      |  ^
a.cc:5:13: note: to match this '{'
    5 | int main( ) {
      |             ^
Language: C++

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

int n, maxv = -INT_MAX, minv, r;

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

Compiler output:
a.cc:5:16: error: 'INT_MAX' was not declared in this scope
    5 | int n, maxv = -INT_MAX, minv, r;
      |                ^~~~~~~
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;
a.cc: In function 'int main()':
a.cc:9:10: error: 'r' was not declared in this scope
    9 |   cin >> r;
      |          ^
a.cc:10:3: error: 'minv' was not declared in this scope
   10 |   minv = r;
      |   ^~~~
Language: C++

#include <stdio.h>
//#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>

using namespace std;

int main(int **argc) {

	int n;
	cin >> n;

	int mn = INT_MAX;
	int mx = -1;
	int diffMax = -1;
	for (int i = 0;i<n;i++) {
		int tmp;
		cin >> tmp;
		diffMax = max(tmp - mn, diffMax);
		mn = min(mn, tmp);
	}

	cout << diffMax << endl;
	return 0;
}

Compiler output:
a.cc:8:5: warning: first argument of 'int main(int**)' should be 'int' [-Wmain]
    8 | int main(int **argc) {
      |     ^~~~
a.cc:8:5: warning: 'int main(int**)' takes only zero or two arguments [-Wmain]
a.cc: In function 'int main(int**)':
a.cc:13:18: error: 'INT_MAX' was not declared in this scope
   13 |         int mn = INT_MAX;
      |                  ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include <iostream>
  +++ |+#include <climits>
    5 |
Language: C++

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

int main(){
	long i,n,min=LONG_MAX,marginmax=-1,R;
	cin >> n;
	for(i=0;i<n;i++){
		cin >> R;
		if(R<min) min=R;
		else if(R-min > marginmax) marginmax = R-min;
	}
	cout << marginmax << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:22: error: 'LONG_MAX' was not declared in this scope
    6 |         long i,n,min=LONG_MAX,marginmax=-1,R;
      |                      ^~~~~~~~
a.cc:3:1: note: 'LONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <vector>
  +++ |+#include <climits>
    3 | using namespace std;
a.cc:9:24: error: 'R' was not declared in this scope
    9 |                 cin >> R;
      |                        ^
a.cc:11:33: error: 'marginmax' was not declared in this scope
   11 |                 else if(R-min > marginmax) marginmax = R-min;
      |                                 ^~~~~~~~~
a.cc:13:17: error: 'marginmax' was not declared in this scope
   13 |         cout << marginmax << endl;
      |                 ^~~~~~~~~
Language: C++

#include <iostream>
#include <vector>

template<typename T>
T Input()
{
	T value;
	std::cin >> value;
	return value;

}

int main()
{
	int num, max = INT_MIN;
	std::vector<int> arr;
	std::cin >> num;
	for (auto i = 0; i < num; ++i)
		arr.emplace_back(Input<int>());
	for (auto i = 0; i < arr.size(); ++i)
	{
		for (auto j = num -1; j > i; --j)
		{
			if (max < arr[j] - arr[i])
				max = arr[j] - arr[i];
		}
	}

	std::cout << max << "\n";

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:24: error: 'INT_MIN' was not declared in this scope
   15 |         int num, max = INT_MIN;
      |                        ^~~~~~~
a.cc:3:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <vector>
  +++ |+#include <climits>
    3 |
Language: C++

#include <iostream>
#include <vector>

template<typename T>
T Input()
{
	T value;
	std::cin >> value;
	return value;
}

int main()
{
	int num, max = INT_MIN;
	std::vector<int> arr;
	std::cin >> num;
	for (auto i = 0; i < num; ++i)
		arr.push_back(Input<int>());
	for (auto i = 0; i < arr.size(); ++i)
	{
		for (auto j = num -1; j > i; --j)
		{
			if (max < arr[j] - arr[i])
				max = arr[j] - arr[i];
		}
	}

	std::cout << max << "\n";

	return 0;
}

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

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

template<typename T>
T Input()
{
	T value;
	std::cin >> value;
	return value;
}

int main()
{
	int num, max = INT_MIN;
	std::vector<int> arr;
	std::cin >> num;
	for (auto i = 0; i < num; ++i)
		arr.push_back(Input<int>());
	for (auto i = 0; i < arr.size(); ++i)
	{
		for (auto j = num -1; j > i; --j)
		{
			if (max < arr[j] - arr[i])
				max = arr[j] - arr[i];
		}
	}

	std::cout << max << "\n";

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:24: error: 'INT_MIN' was not declared in this scope
   15 |         int num, max = INT_MIN;
      |                        ^~~~~~~
a.cc:4:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include <limits>
  +++ |+#include <climits>
    4 |
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

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

  int m = INT_MAX - 1;
  int d = -INT_MAX - 1;
  int x;
  for (int i = 0; i < n; ++i) {
    cin >> x;
    if (i == 0) {
      m = x;
      continue;
    }
    d = max(d, x - m);
    if (x < m) {
      m = x;
    }
  }

  cout << d << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:11: error: 'INT_MAX' was not declared in this scope
   10 |   int m = INT_MAX - 1;
      |           ^~~~~~~
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++

min = 10**9
difmax=-10**9
cnt=0
n = STDIN.gets.split[0].to_i
0.upto(n-1) {|i| 
  n = STDIN.gets.split[0].to_i
 
  dif = n - min
  if n < min
    min = n
  end
  
 
  difmax = dif if dif > difmax
}
p difmax

Compiler output:
a.cc:1:1: error: 'min' does not name a type
    1 | min = 10**9
      | ^~~
a.cc:16:1: error: 'p' does not name a type
   16 | p difmax
      | ^
Language: C++

#!/usr/bin/env python3
# input
n = int(input())
R = []
for i in range(n):
    R.append(int(input()))

# calc
maximum = -10**6
for i in range(n):
    for j in range(i+1, n):
        if R[j] - R[i] > maximum:
            maximum = R[j] - R[i]

# output
print(maximum)

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #!
    1 | #!/usr/bin/env python3
      |  ^
a.cc:2:3: error: invalid preprocessing directive #input
    2 | # input
      |   ^~~~~
a.cc:8:3: error: invalid preprocessing directive #calc
    8 | # calc
      |   ^~~~
a.cc:15:3: error: invalid preprocessing directive #output
   15 | # output
      |   ^~~~~~
a.cc:3:1: error: 'n' does not name a type
    3 | n = int(input())
      | ^
Language: C++

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

int main(void)
{
	int num;
	int input;
	int lst[200000];
	int small;
	int large;
	int maximum;
	cin >> num;
	for(int i = 0; i < num; i++)
	{
		cin >> lst[i];

	}
	maximum = lst[1] - lst[0];
	small = lst[0];
	large = lst[0];

	for (int i = 0; i < num; i++)
	{
		maximum = max(maximum, lst[i] - small);
		small = min(min, lst[i]);
	}
	cout << maximum << "\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:28: error: no matching function for call to 'min(<unresolved overloaded function type>, int&)'
   26 |                 small = min(min, lst[i]);
      |                         ~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'constexpr const _Tp& std::min(const _Tp&, const _Tp&) [with _Tp = int]'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:20: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const int&'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |         ~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:26:28: note:   couldn't deduce template parameter '_Tp'
   26 |                 small = min(min, lst[i]);
      |                         ~~~^~~~~~~~~~~~~
Language: C++

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

int main(void)
{
	int num;
	int input;
	int lst[200000];
	int small;
	int large;
	int maximum;
	cin >> num;
	for(int i = 0; i < num; i++)
	{
		cin >> lst[i];

	}
	maximum = -20000000
	small = lst[0];
	large = lst[0];

	for (int i = 0; i < num; i++)
	{
		maximum = max(maximum, lst[i] - small);
		small = min(small, lst[i]);
	}
	cout << maximum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:28: error: expected ';' before 'small'
   19 |         maximum = -20000000
      |                            ^
      |                            ;
   20 |         small = lst[0];
      |         ~~~~~
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
int main(){
      int n,ans = INT_MIN,minnum = INT_MAX,tmp;
      cin >> n;
      for(int i= 0;i<n;i++){
            cin >> tmp;
            if(i!=0) ans = max(ans,tmp - minnum);
            minnum = min(tmp,minnum);
      }
      cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:19: error: 'INT_MIN' was not declared in this scope
    5 |       int n,ans = INT_MIN,minnum = INT_MAX,tmp;
      |                   ^~~~~~~
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:8:20: error: 'tmp' was not declared in this scope; did you mean 'tm'?
    8 |             cin >> tmp;
      |                    ^~~
      |                    tm
a.cc:9:42: error: 'minnum' was not declared in this scope
    9 |             if(i!=0) ans = max(ans,tmp - minnum);
      |                                          ^~~~~~
a.cc:10:13: error: 'minnum' was not declared in this scope
   10 |             minnum = min(tmp,minnum);
      |             ^~~~~~
Language: C++

#include <queue>
#include <cstdio>
#include <limits>
#include <algorithm>
 
int main()
{
    int n, MAX = std::numeric_limits<int>::min();
    
    std::queue<int> R;
    
    scanf("%d", &n);
    
    for (int i = 0; i < n; i++)
    {
        int temp;
        
        scanf("%d", &temp);
        
        R.push(temp);
        
        MAX = R.size > 1 ? std::max(R.back() - R.front(), MAX) : MAX;
 
        if (R.back() < R.front())
        {
            while (R.size() > 1)
            {
                R.pop();
            }
        }
    }
 
    printf("%d\n", MAX);
 
    return 0;
}
 
// Time : O( 2n )

Compiler output:
a.cc: In function 'int main()':
a.cc:22:17: error: invalid use of member function 'std::queue<_Tp, _Sequence>::size_type std::queue<_Tp, _Sequence>::size() const [with _Tp = int; _Sequence = std::deque<int, std::allocator<int> >; size_type = long unsigned int]' (did you forget the '()' ?)
   22 |         MAX = R.size > 1 ? std::max(R.back() - R.front(), MAX) : MAX;
      |               ~~^~~~
      |                     ()
Language: C++

#include <stdio.h>

int main(void)
{
	int n;
	int ans = 0;
	scanf("%d", &n);
	int r[n];
	for(int i = 0; i < n; i++){
		scanf("%d", &x[i]);
	}
	for(int i = 0; i < n; i++){
		for(int j = n - 1; j > i; j--){
			if(ans < r[j] - r[i]){
				ans = r[j] - r[i];
			}
		}
	}
	printf("%d\n", ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:30: error: 'x' was not declared in this scope
   10 |                 scanf("%d", &x[i]);
      |                              ^
Language: C++

#include <stdio.h>

int main(void)
{
	int n, ans, min;
	scanf("%d", &n);
	int r[n];
	for(int i = 0; i < n; i++){
		scanf("%d", &r[i]);
	}
	ans = r[1] - r[0];
	min = -1000000000;
	max = r[0];
	for(int i = 0; i < n; i++){
		if(min > r[i]){
			min = r[i];
		}else{
			int temp = r[i] - min;
			if(ans < temp){
				ans = temp;
			}
		}
	}
	printf("%d\n", ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: 'max' was not declared in this scope
   13 |         max = r[0];
      |         ^~~
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++ ) {   // ????????§?????? 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:15:14: error: expected ';' before '-' token
   15 |   for ( int i - 1; i < n; i++ ) {   // ????????§?????? R[i] ?????????????????°??????????????????
      |              ^~
      |              ;
a.cc:15:25: error: expected ')' before ';' token
   15 |   for ( int i - 1; i < n; i++ ) {   // ????????§?????? R[i] ?????????????????°??????????????????
      |       ~                 ^
      |                         )
a.cc:15:27: error: 'i' was not declared in this scope
   15 |   for ( int i - 1; i < n; i++ ) {   // ????????§?????? R[i] ?????????????????°??????????????????
      |                           ^
a.cc:20:11: error: 'maxV' was not declared in this scope; did you mean 'maxv'?
   20 |   cout << maxV << endl;
      |           ^~~~
      |           maxv
Language: C++

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

int main(){
  int n;
  std::cin >> n;
  if (n == 0)[
    std::cout << 0 << std::endl;
    return 0;
  }  

  long price, min_price;
  long max_diff = -1 * 10e+9;
  std::cin >> min_price;
  while(std::cin >> price){
    min_price = std::min(min_price, price);
    max_diff = std::max(max_diff, price - min_price);
  }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: capture of non-variable 'std'
    9 |     std::cout << 0 << std::endl;
      |     ^~~
In file included from /usr/include/c++/14/bits/requires_hosted.h:31,
                 from /usr/include/c++/14/iostream:38,
                 from a.cc:1:
/usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:308:11: note: 'namespace std { }' declared here
  308 | namespace std
      |           ^~~
a.cc:9:8: error: expected ',' before '::' token
    9 |     std::cout << 0 << std::endl;
      |        ^~
      |        ,
a.cc:9:8: error: expected identifier before '::' token
    9 |     std::cout << 0 << std::endl;
      |        ^~
a.cc:9:32: error: expected ']' before ';' token
    9 |     std::cout << 0 << std::endl;
      |                                ^
      |                                ]
a.cc: In lambda function:
a.cc:9:32: error: expected '{' before ';' token
a.cc: At global scope:
a.cc:15:8: error: 'cin' in namespace 'std' does not name a type
   15 |   std::cin >> min_price;
      |        ^~~
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:16:3: error: expected unqualified-id before 'while'
   16 |   while(std::cin >> price){
      |   ^~~~~
a.cc:21:8: error: 'cout' in namespace 'std' does not name a type
   21 |   std::cout << max_diff << std::endl;
      |        ^~~~
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:22:1: error: expected declaration before '}' token
   22 | }
      | ^
Language: C++

#include <stdio.h>

int main(void)
{
  int n, R[200000], i, j, max;

  scanf("%d", &n);

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

  max = R[1] - R[0]

  for(i = 2; i < n; i++){
    for(j = 0; j < i; j++){
      if (max < R[i] - R[j]){
        max = R[i] - R[j];
      }
    }
  }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:12:20: error: expected ';' before 'for'
   12 |   max = R[1] - R[0]
      |                    ^
      |                    ;
   13 | 
   14 |   for(i = 2; i < n; i++){
      |   ~~~               
a.cc:14:24: error: expected ';' before ')' token
   14 |   for(i = 2; i < n; i++){
      |                        ^
      |                        ;
a.cc:22:23: error: expected '}' at end of input
   22 |   printf("%d\n", max);
      |                       ^
a.cc:4:1: note: to match this '{'
    4 | {
      | ^
Language: C++

 n = int(raw_input())
 maxv = -1*10**9
 minv = int(raw_input())

 for j in range(n-1):
   num = int(raw_input())
   diff = num - minv
   maxv = max(maxv,diff)
   minv = min(minv,num)
 print maxv

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

n = int(raw_input())
max = -10^9
min = 10^9
ans = -10^9
for i in range(n-1):
 x[i] = int(raw_input())
for s in range(n-1):
 for t in range(n-1):
  if ans < (x[n-1-s]-x[n-1-t]):
   ans=x[n-1-s]-x[n-1-t]
print ans

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

n =int(raw_input())
max= -10^9

for i in range(0,n):
 x=int(raw_input())
 if min>x:
  min=x
 if max<(x -min):
  max=x-min
print max

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

#include <iostream>
#include <string>
#include <cstring>
#include <sstream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main()
{
	int n;
	cin >> n;
	cin.ignore();
	
	vector<int> vr;

	for (int i = 0; i < n; i++)
	{
		int t;
		cin >> t;
		vr.push_back(t);
	}

	int profit = vr[1] - vr[0];
	for (int i = 0; i < vr.size() -1; ++i)
	{
		for (int j = i + 1; j < vr.size(); ++j)
		{
			profit = max(profit, vr[j] - vr[i]);
			if (vr[j] - vr[i] < 0)break;
		}
	}
	cout << profitf << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:17: error: 'profitf' was not declared in this scope; did you mean 'profit'?
   36 |         cout << profitf << endl;
      |                 ^~~~~~~
      |                 profit
Language: C++

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

int main(void){
    
    int n;

    cin >> n;

    int maxv = -2000000000;

    int minv = R[0];

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

Compiler output:
a.cc: In function 'int main()':
a.cc:14:16: error: 'R' was not declared in this scope
   14 |     int minv = R[0];
      |                ^
Language: C++

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

int main(void){
    
    int n;
    
    // First input, determines how many values there are
    cin >> n;

    // Initialise max value
    int maxv = -2000000000;
    
    // Initialise min value to first element
    int minv = cin;
    
    // Max value always after min value because of R[i] - minv
    for(int i = 1; i < n; i++){
        int number;
        cin >> number;
        maxv = max(maxv, number - minv);
        minv = min(minv, number);
    }
    
    cout << maxv << endl;
    
    return 0;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:16: error: cannot convert 'std::istream' {aka 'std::basic_istream<char>'} to 'int' in initialization
   17 |     int minv = cin;
      |                ^~~
      |                |
      |                std::istream {aka std::basic_istream<char>}
Language: C++

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

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

  cin >> N;
  for(int i=0;i<N;i++) {
    int r;
    cin >> r;
    R.push_back(r);
  }

  int max_p = R[1] - R[0];
  int min_r = R[0];
  for(int i=1;i<N;i++) {
    min_r = min(min_r,R[i-1]);
    max_p = max(max_p,R[i]-min_r);
  }
  cout << max_p << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'vector' was not declared in this scope
    7 |   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 | using namespace std;
a.cc:7:10: error: expected primary-expression before 'int'
    7 |   vector<int> R;
      |          ^~~
a.cc:13:5: error: 'R' was not declared in this scope
   13 |     R.push_back(r);
      |     ^
a.cc:16:15: error: 'R' was not declared in this scope
   16 |   int max_p = R[1] - R[0];
      |               ^
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 = -MAX
  int minx = 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:44: error: expected ';' before 'int'
   10 |   for ( int i = 0; i < n; i++ ) cin >> R[i]
      |                                            ^
      |                                            ;
   11 | 
   12 |   int maxv = -MAX
      |   ~~~                                       
a.cc:15:20: error: 'i' was not declared in this scope
   15 |   for ( int i = 1; i < n; i++ ) {
      |                    ^
a.cc:22:2: error: expected '}' at end of input
   22 | }
      |  ^
a.cc:6:12: note: to match this '{'
    6 | int main() {
      |            ^
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 = -MAX;
  int minx = 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:16:29: error: 'minv' was not declared in this scope; did you mean 'minx'?
   16 |     maxv = max(maxv, R[i] - minv);
      |                             ^~~~
      |                             minx
a.cc:22:2: error: expected '}' at end of input
   22 | }
      |  ^
a.cc:6:12: note: to match this '{'
    6 | int main() {
      |            ^
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 = -MAX;
  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:22:2: error: expected '}' at end of input
   22 | }
      |  ^
a.cc:6:12: note: to match this '{'
    6 | int main() {
      |            ^
Language: C++

#include "iostream"

using namespace std;

void main() {

	int num;
	int min;
	int sa = -1000000000;

	cin >> num;

	//????????????????´?
	cin >> min;
	//2????????\??????????´?
	for (int i = 1; i < num; i++) {
		int a;
		cin >> a;

		if (a - min > sa) {
			sa = a - min;
		}
		if (a < min) {
			min = a;
		}

	}

	cout << sa << endl;

}

Compiler output:
a.cc:5:1: error: '::main' must return 'int'
    5 | void main() {
      | ^~~~
Language: C++

n = input()

R = []
for i in range(n):
    R.append(input())

min_v = R[0]
max_v = -pow(10, 2)
for i in range(1, n):
    temp = R[i] - min_v
    if (temp >= max_v):
        max_v = temp
    temp = R[i]
    if (min_v >= temp):
        min_v = temp
print max_v

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

#include <iostream>

using namespace std;

int n;
int R[200000];
int maxdR, mdR, dR;

int main(void)
{
	cin >> n;

	for(int i=0;i<n-1;i++){
		dR = R[n-i-1]-R[n-i-2];
		if (i==0){
			mdR = dR;
			maxdR = mdR;
		}else{
			if (mdR>0){
				mdR += dR;
			}else{
				mdR = dR;
			}
			if (mdR>maxdR){
				maxdR = mdR;
			}
		}
	}
	
	cout << dp1 << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:17: error: 'dp1' was not declared in this scope
   30 |         cout << dp1 << endl;
      |                 ^~~
Language: C++

#include <iostream>

using namespace std;

int n;
int R[200000];
int maxdR, mdR, dR;

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

	for(int i=0;i<n-1;i++){
		dR = R[n-i-1]-R[n-i-2];
		if (i==0){
			mdR = dR;
			maxdR = mdR;
		}else{
			if (mdR>0){
				mdR += dR;
			}else{
				mdR = dR;
			}
			if (mdR>maxdR){
				maxdR = mdR;
			}
		}
	}
	
	cout << dp1 << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:17: error: 'dp1' was not declared in this scope
   33 |         cout << dp1 << endl;
      |                 ^~~
Language: C++

#include <iostream>

using namespace std;

int n;
int R[200000];
int maxdR, mdR, dR;

int main(void)
{
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> R[i];
	}
	
	mdR = R[n-i-1]-R[n-i-2];
	maxdR  = mdR;

	for(int i=1;i<n-1;i++){
		dR = R[n-i-1]-R[n-i-2];
		if (mdR>0){
			mdR += dR;
		}else{
			mdR = dR;
		}
		if (mdR>maxdR){
			maxdR = mdR;
		}
	}
	
	cout << maxdR << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:19: error: 'i' was not declared in this scope
   16 |         mdR = R[n-i-1]-R[n-i-2];
      |                   ^
Language: C++

#include <iostream>
using namespace std;

int n;
int r[200005];

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

int ans = INT_MAX;
int min = r[0];

for(int i=1;i<n;i++) {
if(r[i] - min > ans) ans = r[i]-min;
if(r[i] < min) min = r[i];
}

cout << ans << endl;

return 0;
}

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