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

#include <iostream>
#include <vector>

using namespace std;

int main(){
    int l=1, i=0, n, h;

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

    while(l < n){

        h = a[l];
        a.erase(a.bigin() + l);
        cout << max(a[i]) << endl;
        a.insert(a.bigin() + l, h);

        l++
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:11: error: request for member 'erase' in 'a', which is of non-class type 'int [n]'
   17 |         a.erase(a.bigin() + l);
      |           ^~~~~
a.cc:17:19: error: request for member 'bigin' in 'a', which is of non-class type 'int [n]'
   17 |         a.erase(a.bigin() + l);
      |                   ^~~~~
a.cc:18:20: error: no matching function for call to 'max(int&)'
   18 |         cout << max(a[i]) << endl;
      |                 ~~~^~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/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, 1 provided
a.cc:19:11: error: request for member 'insert' in 'a', which is of non-class type 'int [n]'
   19 |         a.insert(a.bigin() + l, h);
      |           ^~~~~~
a.cc:19:20: error: request for member 'bigin' in 'a', which is of non-class type 'int [n]'
   19 |         a.insert(a.bigin() + l, h);
      |                    ^~~~~
a.cc:21:12: error: expected ';' before '}' token
   21 |         l++
      |            ^
      |            ;
   22 |     }
      |     ~
Language: C

#include<stdio.h>

int main(void)
{
  int n = 0;
  int a = 0;
  int i = 0;
  int j = 0;
  int max = 0;
  
  
  do{
    scanf("%d", &n);
  }while(n =< 1 || n => 200000);

  int num[n];
  for(i = 0; i < n; i++){
    do{
      scanf("%d", &num[i]);
    }while(num[i] =< 1 || num[i] => 200000);
  }
 
  for(i = 0; i < n; i++){
    for(j = 0; j < n; j++){
      if(max <= num[j] && i != j){
        max = j;
      }
    }
    printf("%d\n", max);
  }

  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:14:13: error: expected expression before '<' token
   14 |   }while(n =< 1 || n => 200000);
      |             ^
main.c:20:20: error: expected expression before '<' token
   20 |     }while(num[i] =< 1 || num[i] => 200000);
      |                    ^
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int l, N, i=0;
  cin >> N;
  int vec[N];
  while(cin >> l){
    vec[i] = l;
    i++;
  }
  int max = 0;
  
  for(i = 0; i < N; i++){
    for (int j = 0; j < N; j++){
      if(max < a[j] && i != j){
        max = a[j];
      }
    }
    cout << max << "\n";
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:16: error: 'a' was not declared in this scope
   18 |       if(max < a[j] && i != j){
      |                ^
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int l, N, i=0;
  cin >> N;
  int vec[N];
  while(cin >> l){
    vec[i] = l;
    i++;
  }
  int max = 0;
  
  for(i = 0; i < N; i++){
    for (int j = 0; j < N; j++){
      if(max < a[j] && i != j){
        max = a[j];
    }
    cout << max << "\n";
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:16: error: 'a' was not declared in this scope
   18 |       if(max < a[j] && i != j){
      |                ^
a.cc:23:2: error: expected '}' at end of input
   23 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C

#include<stdio.h>

int main(void)
{
  int n = 0;
  int a = 0;
  int i = 0;
  int j = 0;
  int max = 0;
  
  
  do{
    scanf("%d", &n);
  }while(n < 1 || n > 200000);

  int num[n];
  for(i = 0; i < n; i++){
    do{
      scanf("%d", &num[i]);
    }while(num[i] < 1 || num[i] > 200000);
  }
 
  for(i = 0; i < n; i++){
    for(j = 0; j < n; j++){
      if(max <= num[j] && i != j){
        max = j;
      }
    }
    printf("%d\n", max);
  }


Compiler output:
main.c: In function 'main':
main.c:30:3: error: expected declaration or statement at end of input
   30 |   }
      |   ^
Language: Java

public class Main {
	Scanner scan = new Scanner(System.in);
	
	
	void compute() {
		int N = scan.nextInt();
		int m = 0;
		int[] t = new int[N];
		for(int i=0; i<N; i++) {
			t[i] = scan.nextInt();
		}
		for(int i=0; i<N; i++) {
			m = t[1];		 
	        for (int index = 0; index < N; index ++) {
	        	if(index != i) {
		            m = Math.max(m, t[index]);
	        	}
	        }
			System.out.println(m);
		}
	}

	public static void main(String[] args) {
		new Main().compute();
	}

}


Compiler output:
Main.java:2: error: cannot find symbol
	Scanner scan = new Scanner(System.in);
	^
  symbol:   class Scanner
  location: class Main
Main.java:2: error: cannot find symbol
	Scanner scan = new Scanner(System.in);
	                   ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: Java

import java.util.Scanner;
 
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] nseq = new nSeq[n];

	for(int i = 0;i < n;i++){
      nSeq[i] = sc.nextInt();
    }
    System.out.println("--------------");
    int box = 0;
    for(int i = 0;i < n;i++){
      box = nSeq[i];
      nSeq[i] = 0;
      int max = 0;
      for(int x : nSeq){
          if(max < x){
              max = x;
          }
      }
    System.out.println(max);

      nSeq[i] = box;
    }
  }
}

Compiler output:
Main.java:7: error: cannot find symbol
    int[] nseq = new nSeq[n];
                     ^
  symbol:   class nSeq
  location: class Main
Main.java:10: error: cannot find symbol
      nSeq[i] = sc.nextInt();
      ^
  symbol:   variable nSeq
  location: class Main
Main.java:15: error: cannot find symbol
      box = nSeq[i];
            ^
  symbol:   variable nSeq
  location: class Main
Main.java:16: error: cannot find symbol
      nSeq[i] = 0;
      ^
  symbol:   variable nSeq
  location: class Main
Main.java:18: error: cannot find symbol
      for(int x : nSeq){
                  ^
  symbol:   variable nSeq
  location: class Main
Main.java:25: error: cannot find symbol
      nSeq[i] = box;
      ^
  symbol:   variable nSeq
  location: class Main
6 errors
Language: C++

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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N ; i++) {
    cin >> vec.at(i);
  }
  for (int i = 0; i < N ; i++) {
    maximum = 0;
    for (int j = 0; j < N; j++) {
      if ( j == i ){
        continue;
      }
      maximum = max(vec.at(j), maximum);
    }
    cout << maximum << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'maximum' was not declared in this scope; did you mean 'fmaximum'?
   12 |     maximum = 0;
      |     ^~~~~~~
      |     fmaximum
Language: C++

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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N ; i++) {
    cin >> vec.at(i);
  }
  for (int i = 0; i < N ; i++) {
    maximum = 0
    for (int j = 0; j < N; j++) {
      if ( j == i ){
        continue
      }
      maximum = max(vec.at(j), maximum)
    }
    cout << maximum << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'maximum' was not declared in this scope; did you mean 'fmaximum'?
   12 |     maximum = 0
      |     ^~~~~~~
      |     fmaximum
a.cc:13:21: error: 'j' was not declared in this scope
   13 |     for (int j = 0; j < N; j++) {
      |                     ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  inta,b,c;
  cin>>a>>b>>c;
  if(a>b)
    cout<<a;
  else
    cout<<b;
   if(a>c)
     cout<<a;
  else
    cout<<c;
  if(b<c)
    cout<<b;
  else
    cout<<c;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: 'inta' was not declared in this scope; did you mean 'int'?
    5 |   inta,b,c;
      |   ^~~~
      |   int
a.cc:5:8: error: 'b' was not declared in this scope
    5 |   inta,b,c;
      |        ^
a.cc:5:10: error: 'c' was not declared in this scope
    5 |   inta,b,c;
      |          ^
a.cc:6:8: error: 'a' was not declared in this scope
    6 |   cin>>a>>b>>c;
      |        ^
Language: C++

#include<iostream>
using namespace std;
int main(){
  int N;
  cin>>N;
  int a[200000];
  int ans[200000];
  for(int i=0;i<N;i++){
    cin>>a[i];
  }   
  for(int m=0;m<N;m++) {
   for(int i=0;i<N;i++){
  for(int j=0;j<N;j++){
   for(int n=0;n<N;n++){
  if（a[i]>a[j];）{
    ans[m]=a[i];
  }
     if(a[n]>a[j]&&a[n]<a[i]){
       int b=a[n];}
    if(ans[m]==a[m]){
      ans[m]=b;}
}
       for(int z=0;z<N;z++){
       cout<<ans[z];
         return 0;
       }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:3: error: 'if\U0000ff08a' was not declared in this scope
   15 |   if（a[i]>a[j];）{
      |   ^~~~~
a.cc:15:17: error: '\U0000ff09' was not declared in this scope
   15 |   if（a[i]>a[j];）{
      |                 ^~
a.cc:21:14: error: 'b' was not declared in this scope
   21 |       ans[m]=b;}
      |              ^
a.cc:27:2: error: expected '}' at end of input
   27 | }
      |  ^
a.cc:12:24: note: to match this '{'
   12 |    for(int i=0;i<N;i++){
      |                        ^
a.cc:27:2: error: expected '}' at end of input
   27 | }
      |  ^
a.cc:11:24: note: to match this '{'
   11 |   for(int m=0;m<N;m++) {
      |                        ^
a.cc:27:2: error: expected '}' at end of input
   27 | }
      |  ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include <iostream>
using namespace std;

int N;
int A[20000];

int main(){
  cin >> N;
  for (int i=0;i<N;++i) cin >> A[i];
  int max = 0;
  int i_max = 0;
  int max2 = 0;
  int i_max2 = 0;
  
  for (int i=0;i<N;++i){

    if (max < A[i]) {
      max = A[i];
      i_max = i;
    }else if (max => A[i] && A[i] > max2) {
      max2 = A[i];
      i_max2 = i;
    }
  }
  for (int j=0;j<N;++j){
    if (j != i_max) {
      cout << max << endl;
    } else {
      cout << max2 << endl;
      }
  }   
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:20: error: expected primary-expression before '>' token
   20 |     }else if (max => A[i] && A[i] > max2) {
      |                    ^
Language: C

#include <stdio.h>

int main(int argc, char const *argv[]) {
 int N;
 int A[200000];
 int m=0;
 int m1;
 int m2;

 scanf("%d\n",&N );
 for (int i = 0; i < N; i++) {
   scanf("%d\n",&A[i] );
 }


 for (int i = 0; i < N; i++) {
   if(m<A[i]){
     m=A[i];
     m1=i;
   }
 }
 m=0;

 for (int i = 0; i < N; i++) {
   if(i!=m1){
     if(m<A[i]){
       m=A[i]
       m2=i;
     }
   }
 }

 for (int i = 0; i < N; i++) {
   if(i!=m1){
     printf("%d\n",A[m1] );
   }else{
     printf("%d\n",A[m2] );
   }
 }
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:27:14: error: expected ';' before 'm2'
   27 |        m=A[i]
      |              ^
      |              ;
   28 |        m2=i;
      |        ~~
Language: C++

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

int main(){
    int n;
    cin >> n;
    vector<int>V(n);
    for(int k = 0; k < n; k++){
      cin >> V.at(k);
    }

    for(int i = 0; i<n; i++){
      V.at(i) = -1;
      int x = max_element(0,n);
      cout << x <<endl;
    }
}

Compiler output:
In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
                 from /usr/include/c++/14/algorithm:60,
                 from a.cc:1:
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_less_iter::operator()(_Iterator1, _Iterator2) const [with _Iterator1 = int; _Iterator2 = int]':
/usr/include/c++/14/bits/stl_algo.h:5626:12:   required from 'constexpr _ForwardIterator std::__max_element(_ForwardIterator, _ForwardIterator, _Compare) [with _ForwardIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
 5626 |         if (__comp(__result, __first))
      |             ~~~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5650:43:   required from 'constexpr _FIter std::max_element(_FIter, _FIter) [with _FIter = int]'
 5650 |       return _GLIBCXX_STD_A::__max_element(__first, __last,
      |                                           ^
a.cc:17:26:   required from here
   17 |       int x = max_element(0,n);
      |               ~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/predefined_ops.h:45:16: error: invalid type argument of unary '*' (have 'int')
   45 |       { return *__it1 < *__it2; }
      |                ^~~~~~
/usr/include/c++/14/bits/predefined_ops.h:45:25: error: invalid type argument of unary '*' (have 'int')
   45 |       { return *__it1 < *__it2; }
      |                         ^~~~~~
Language: C++

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

int main(){
int a,d; 
cin>>a;
vector<int> b(a),c;
for(int i=0;i<a;i++)
cin>>b.at(i);
c=b;
sort(b.begin(),b.end());
for(int i=0;i<a;i++){
if(c.at(i)==b.at(a-1)){
d=i;
break;
}
}
for(int i=0;i<a;i++){
if(d==i)
cout<<b.at(a-2)<<endl
else
cout<<b.at(a-1)<<endl
}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:22: error: expected ';' before 'else'
   20 | cout<<b.at(a-2)<<endl
      |                      ^
      |                      ;
   21 | else
      | ~~~~
Language: C++

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

int main(){
    int n;
    cin >> n;
    vector<int>V(n);
    for(int k = 0; k < n; k++){
      cin >> V.at(k);
    }

    for(int i = 0; i<n; i++){
      V.at(i) = -1
      int x = max_element(0,n)
      cout << x <<endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:19: error: expected ';' before 'int'
   16 |       V.at(i) = -1
      |                   ^
      |                   ;
   17 |       int x = max_element(0,n)
      |       ~~~
Language: C

#include <stdio.h>
int main(){
int a,i,b[a],max,j,k;
scanf("%d",&a);
for(i=1;i<=a;i++)
scanf("%d",&b[i-1]);
for(i=0;i<a;i++)
{
max!=b[i];
{for(j=0;j<i-1;j++)
if(b[j+1]>b[j])
max=b[j+1];
for(k=i+1;k<a;k++)
if(b[k+1]>b[k])
max=b[k+1];
if(b[j+1]>=b[k+1])
max=b[j+1];
else
max=b[k+1]
}
}
}

Compiler output:
main.c: In function 'main':
main.c:19:11: error: expected ';' before '}' token
   19 | max=b[k+1]
      |           ^
      |           ;
   20 | }
      | ~
Language: C++

#include <stdio.h>

int main() {
  int n, a, b, a_pos, b_pos;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    if (i == 0) {
      a = x;
      a_pos = 0;
    } else if (i == 1) {
      if (x > a) {
        b = a;
        b_pos = a_pos
        a = x;
        a_pos = i;
      } else {
        b = x;
        b_pos = i;
      }
    } else {
      if (x > a) {
        b = a;
        b_pos = a_pos;
        a = x;
        a_pos = i;
      } else if (x > b) {
        b = x;
        b_pos = i;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    printf("%d\n", ((i == a_pos) ? b : a));
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:22: error: expected ';' before 'a'
   15 |         b_pos = a_pos
      |                      ^
      |                      ;
   16 |         a = x;
      |         ~
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int l, N, i=0;
  cin >> N;
  int vec[N];
  int copy[N-1];
  while(cin >> l){
    vec[i] = l;
    i++;
  }
  int max;
  size_t maxIndex;
  
  for(i = 0; i < N; i++){
    for (int j = 0; j < N; j++){
      if (j != i){
    	copy[j] = vec[j];
      }
    }
    sort(copy.begin(), copy.end(), greater<int>()); // 降順
  	cout << copy[0] << "\n";
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:15: error: request for member 'begin' in 'copy', which is of non-class type 'int [(N + -1)]'
   24 |     sort(copy.begin(), copy.end(), greater<int>()); // 降順
      |               ^~~~~
a.cc:24:29: error: request for member 'end' in 'copy', which is of non-class type 'int [(N + -1)]'
   24 |     sort(copy.begin(), copy.end(), greater<int>()); // 降順
      |                             ^~~
Language: C++

#include <stdio.h>
#include <limits.h>

int main(){
  int n;
  scanf("%d", &n);
  
  // get array
  long *array = (long *)malloc(sizeof(long)*n);
  for(int i = 0; i < n;i++){
	scanf("%d", &array[i]);
  }
  
  long max,nextMax;
  int maxIndex;

  // init
  if(array[0] > array[1]) {
	max = array[0];
    maxIndex = 0;
    nextMax = array[1];
  } else {
	max = array[1];
    maxIndex = 1;
    nextMax = array[0];
  }
  
  for(int i = 2; i < n; i++){
	if(max < array[i]) {
      nextMax = max;
      max = array[i];
      maxIndex = i;
    } else if(nextMax < array[i]){
	  nextMax = array[i];
    }
  }
  
  // print
  for(int i = 0; i < n; i++){
	if(i == maxIndex)
      printf("%d\n", max);
    else
      printf("%d\n", nextMax);
  }
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:25: error: 'malloc' was not declared in this scope
    9 |   long *array = (long *)malloc(sizeof(long)*n);
      |                         ^~~~~~
a.cc:3:1: note: 'malloc' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>'
    2 | #include <limits.h>
  +++ |+#include <cstdlib>
    3 |
Language: C++

#include<iostream>
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
using namespace std;
int N;
int A[200001];
int main(){
	ios::sync_with_stdio(false);
   cin.tie(NULL); cout.tie(NULL);
   cin >> N;
   for (int i = 0; i < N; i ++) cin >> A[i];
   for (int i = 0; i < N; i ++) B[i] = A[i];
	sort(A, A + N); reverse(A, A + N);
	for (int i = 0; i < N; i ++) 
	{
		if (B[i] == A[0]) cout << A[1];
		else cout << A[0];
		cout << endl;
	}
   return 0;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:19:33: error: 'B' was not declared in this scope
   19 |    for (int i = 0; i < N; i ++) B[i] = A[i];
      |                                 ^
a.cc:23:21: error: 'B' was not declared in this scope
   23 |                 if (B[i] == A[0]) cout << A[1];
      |                     ^
Language: Java

public class Main {
	Scanner scan = new Scanner(System.in);
	
	
	void compute() {
		int N = scan.nextInt();
		int m = 0;
		int[] t = new int[N];
		for(int i=0; i<N; i++) {
			t[i] = scan.nextInt();
		}
		for(int i=0; i<N; i++) {
			m = 0;
			for(int n=0; n<N; n++) {
				if(n !=  i) {
					if(t[n] > m) {
						m = t[n];
					}
				}
			}
			System.out.println(m);
		}
	}

	public static void main(String[] args) {
		new Main().compute();
	}

}


Compiler output:
Main.java:2: error: cannot find symbol
	Scanner scan = new Scanner(System.in);
	^
  symbol:   class Scanner
  location: class Main
Main.java:2: error: cannot find symbol
	Scanner scan = new Scanner(System.in);
	                   ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: Java

public class Main {
	Scanner scan = new Scanner(System.in);
	
	
	void compute() {
		int N = scan.nextInt();
		int[] t = new int[N];
		for(int i=0; i<N; i++) {
			t[i] = scan.nextInt();
		}
		for(int i=0; i<N; i++) {
			int m = 0;;
			for(int n=0; n<N; n++) {
				if(n !=  i) {
					if(t[n] > m) {
						m = t[n];
					}
				}
			}
			System.out.println(m);
		}
	}

	public static void main(String[] args) {
		new Main().compute();
	}

}


Compiler output:
Main.java:2: error: cannot find symbol
	Scanner scan = new Scanner(System.in);
	^
  symbol:   class Scanner
  location: class Main
Main.java:2: error: cannot find symbol
	Scanner scan = new Scanner(System.in);
	                   ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: C

#include <stdio.h>

int main(void) {
  int N;
  scanf("%d", &N);
  int array[N];
  for (int i = 0; i < N; i++) {
    scanf("%d", &array[i]);
  }
  int max=0, max_i;
  for ( j = 0; j < N; j++) {  //最大値探索
    if (*(array+j)>max) {
      max = *(array+j);
      max_i = j;
    }
  }

  for (int i = 0; i < N; i++) {
    if (i!=max_i) {
      printf("%d\n", max);
    } else {
      max2=0;
      for (int j = 0; j < N; j++) {
        if (j != i) {
          if (*(array+j)>max2) {
            max2 = *(array+j);
          }
        }
      }
      printf("%d\n", max);
    }
  }

  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:11:9: error: 'j' undeclared (first use in this function)
   11 |   for ( j = 0; j < N; j++) {  //最大値探索
      |         ^
main.c:11:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:22:7: error: 'max2' undeclared (first use in this function); did you mean 'max'?
   22 |       max2=0;
      |       ^~~~
      |       max
Language: C++

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

int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    vector<int> D(N);
    D = A;
    sort(A.begin(), A.end());

    vector<int> B(N);
    if (A[N - 2] == A[N - 1]) {
        for (int i = 0; i < N; ++i) {
            B[i] = A[N - 1];
        }
    } else {
        for (int i = 0; i < N; ++i) {
            if (D[i] == A[N - 1]) {
                B[i] = A[N - 2];
            } else {
                B[i] = A[N - 1];
            }
        }
    }
    for (int i = 0; i < N; ++i) {
        cout << B[i] << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   15 |     sort(A.begin(), A.end());
      |     ^~~~
      |     short
Language: C++

#include <stdio.h>

int main(int argc, char const *argv[])
{
    int N;
    scanf("%d", &N);
    int array[N];
    for(int i=0; i<N; i++) {
        scanf("%d", &array[i]);
    }
    int max =0;
    for(int i=0; i<N; i++) {
        max = 0;
        for(int j=0; j<N-1; j++) {
            if(i == j) {
                printf("index %d", i);
                printf("array %d", array[i];)
            }
            else if(max <= array[j]) {            
                max = array[j];
            }
        }
        printf("%d\n", max);
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:17:44: error: expected ')' before ';' token
   17 |                 printf("array %d", array[i];)
      |                       ~                    ^
      |                                            )
a.cc:17:45: error: expected primary-expression before ')' token
   17 |                 printf("array %d", array[i];)
      |                                             ^
Language: C++

#include <iostream>
#include<vector>
#include<algorithm>
#include<string.h>
using namespace std;
int main(void){
    int N;
    cin>>N;
    vector<int>A(N);
    vector<int>B(N);
    for(int i=0;i<N;i++){
        cin>>A[i];
    }
    memcpy(B,A,sizeof(A));
    
    for(int j=0;j<N;j++){
        A[j]=0;
        sort(A.begin(),A.end());
        cout<<A[N-1]<<endl;
        memcpy(A,B,sizeof(A));
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:12: error: cannot convert 'std::vector<int>' to 'void*'
   14 |     memcpy(B,A,sizeof(A));
      |            ^
      |            |
      |            std::vector<int>
In file included from a.cc:4:
/usr/include/string.h:43:39: note:   initializing argument 1 of 'void* memcpy(void*, const void*, size_t)'
   43 | extern void *memcpy (void *__restrict __dest, const void *__restrict __src,
      |                      ~~~~~~~~~~~~~~~~~^~~~~~
a.cc:20:16: error: cannot convert 'std::vector<int>' to 'void*'
   20 |         memcpy(A,B,sizeof(A));
      |                ^
      |                |
      |                std::vector<int>
/usr/include/string.h:43:39: note:   initializing argument 1 of 'void* memcpy(void*, const void*, size_t)'
   43 | extern void *memcpy (void *__restrict __dest, const void *__restrict __src,
      |                      ~~~~~~~~~~~~~~~~~^~~~~~
Language: C++

#include <iostream>
using namespace std;

int main(void){
    int i, n;
    cin >> n ;
    int *a;
    a = new int[n];
    for(i=0; i<n; i++) cin >> a[i];
    
    int first;
    int f_max, s_max;
    first = 0;
    second = 0;
    f_max = 0;
    s_max = 0;
    for(i=0; i<n; i++){
        if(f_max<a[i]){
            s_max = f_max;
            first = i;
            f_max = a[i];
        }else if(s_max<a[i]){
            s_max = a[i];
        }
    }
    // output
    for(i=0; i<n; i++){
        if(i!=first){
            cout << f_max << endl;
        }else{
            cout << s_max << endl;
        }
    }
    
    
    return 0;
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:14:5: error: 'second' was not declared in this scope
   14 |     second = 0;
      |     ^~~~~~
Language: C++

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

int main(){
    int n;
    cin >> n;
    vector<int>V(n);

    int maxN=0;
    int maxNN=0
    for(int k = 0; k < n; k++){
      cin >> V.at(k);
      if(k!=0 || k!=n-1){
        maxN = max(maxN,V.at(j);
        maxNN = max(maxN,V.at(j);
      }
    }
    cout << maxN << endl;
    cout << maxNN << endl;

    maxN=0;
    for(int i = 1; i<n-1; i++){
      for(int j = 1; j<n-1; j++){
        if(i!=j){
          maxN = max(maxN,V.at(j));
        }
      }
      cout << maxN <<endl;
      maxN =0;
    }
}











Compiler output:
a.cc: In function 'int main()':
a.cc:14:5: error: expected ',' or ';' before 'for'
   14 |     for(int k = 0; k < n; k++){
      |     ^~~
a.cc:14:20: error: 'k' was not declared in this scope
   14 |     for(int k = 0; k < n; k++){
      |                    ^
Language: C++



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

int main(){
   	int n,d,max=0;
   	cin>>n;
   	vector<int> v(n);
   	vector<int> a(n);
   	for(int i=0; i<n; i++){
   		cin>>v[i];
   	}
   	for(int i=0; i<n; i++){
   		a[i]=v[i];
   	}
   	sort(a.begin(), a.end);

   	for(int i=0; i<n; i++){
   		if(v[i]==a[n-1])cout<< a[n-2]<<endl;

   		else cout << a[n-1]<<endl;
   	}
  

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:13: error: no matching function for call to 'sort(std::vector<int>::iterator, <unresolved overloaded function type>)'
   17 |         sort(a.begin(), a.end);
      |         ~~~~^~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'void std::sort(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<int*, vector<int> >]'
 4762 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:63: note:   no known conversion for argument 2 from '<unresolved overloaded function type>' to '__gnu_cxx::__normal_iterator<int*, std::vector<int> >'
 4762 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |                                         ~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'
 4793 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
  292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note:   candidate expects 4 arguments, 2 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)'
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note:   candidate expects 3 arguments, 2 provided
Language: C++

#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#include <functional>
#include <complex>
#include <ccomplex>
using namespace std;

int max(int a[], int n) {
	int max = a[0];
	for (int i = 1; i < n; i++)
		if (max < a[i])
			max = a[i];
	return max;
}
void XoaPhanTu(int a[], int &n, int pos) {
	// Mang rong, khong the xoa.
	if (n <= 0) {
		return;
	}
	// Neu pos <= 0 => Xoa dau
	if (pos < 0) {
		pos = 0;
	}
	// Neu pos >= n => Xoa cuoi
	else if (pos >= n) {
		pos = n - 1;
	}
	// Dich chuyen mang
	for (int i = pos; i < n - 1; i++) {
		a[i] = a[i + 1];
	}
	// Giam so luong phan tu sau khi xoa.
	--n;
}

int main() {
	int N, N1, i, j;
	cin >> N;
	int X[N];
	int X1[N];
	int Y[N - 1];
	for (i = 0; i<N; i++) {
		cin >> X[i];
		cin >> X1[i];
	}
	for (i = 0; i<N; i++) {
		N1 = N;
		X1 = X;
		XoaPhanTu(X1, N1, i);
		Y[i] = max(X1, N1 - 1);
	}
	for (j = 0; j < N; j++) {
		cout << Y[j] << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:52:20: error: invalid array assignment
   52 |                 X1 = X;
      |                 ~~~^~~
Language: C++

#include <iostream>
#include<vector>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, i=0;
  cin >> N;
  vector<int> vec(N);
  vector<int> copy;
  while(cin >> l){
    vec[i] = l;
    i++;
  }
  int max;
  size_t maxIndex;
  
  for(i = 0; i < N; i++){
    memcpy(copy, vec, sizeof(int) * N);
    copy.erase(copy.begin() + i);
  	cout << *max_element(copy.begin(), copy.end()) << "\n";
  }
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:16: error: 'l' was not declared in this scope
   11 |   while(cin >> l){
      |                ^
a.cc:19:5: error: 'memcpy' was not declared in this scope
   19 |     memcpy(copy, vec, sizeof(int) * N);
      |     ^~~~~~
a.cc:3:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<vector>
  +++ |+#include <cstring>
    3 | using namespace std;
a.cc:21:18: error: 'max_element' was not declared in this scope
   21 |         cout << *max_element(copy.begin(), copy.end()) << "\n";
      |                  ^~~~~~~~~~~
Language: C++

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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N ; i++) {
    cin >> vec.at(i);
  }
  for (int i = 0; i < N ; i++) {
    cout << max(vec.at(i), vec.at(i+1)) << endl;
}

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

#include<stdio.h>

int main(void)
{
  int n = 0;
  int a = 0;
  int i = 0;
  int j = 0;
  int max = 0;
  int num[200000] = 0;
  
  do{
    scanf("%d", &n);
  }while(n < 1 || n > 200000);

  for(i = 0; i < n; i++){
    do{
      scanf("%d", &num[i]);
    }while(a < 1 || a > 200000);
  }

  for(i = 0; i < n; i++){
    for(j = 0; j < n; j++){
      if(max <= num[j] || i != j){
        max = j;
      }
    printf("%d\n", max);
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:10:21: error: invalid initializer
   10 |   int num[200000] = 0;
      |                     ^
main.c:30:1: error: expected declaration or statement at end of input
   30 | }
      | ^
Language: C++

#include <iostream>
#include<vector>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, i=0;
  cin >> N;
  vector<int> vec(N);
  vector<int> copy;
  while(cin >> l){
    vec[i] = l;
    i++;
  }
  int max;
  size_t maxIndex;
  
  for(i = 0; i < N; i++){
    memcpy(copy, vec, sizeof(int) * N);
    copy.erase(copy.begin() + i);
  	cout >> *max_element(copy.begin(), copy.end()) >> "\n";
  }
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:16: error: 'l' was not declared in this scope
   11 |   while(cin >> l){
      |                ^
a.cc:19:5: error: 'memcpy' was not declared in this scope
   19 |     memcpy(copy, vec, sizeof(int) * N);
      |     ^~~~~~
a.cc:3:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<vector>
  +++ |+#include <cstring>
    3 | using namespace std;
a.cc:21:18: error: 'max_element' was not declared in this scope
   21 |         cout >> *max_element(copy.begin(), copy.end()) >> "\n";
      |                  ^~~~~~~~~~~
Language: C

#include<stdio.h>

int main(int)
{
  int n = 0;
  int a = 0;
  int i = 0;
  int j = 0;
  int max = 0;
  int num[200000] = 0;
  
  do{
    scanf("%d", &n);
  }while(n < 1 || n > 200000);

  for(i = 0; i < n; i++){
    do{
      scanf("%d", &num[i]);
    }while(a < 1 || a > 200000);
  }

  for(i = 0; i < n; i++){
    for(j = 0; j < n; j++){
      if(max <= num[j] || i != j){
        max = j;
      }
    printf("%d\n", max);
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:10:21: error: invalid initializer
   10 |   int num[200000] = 0;
      |                     ^
main.c:30:1: error: expected declaration or statement at end of input
   30 | }
      | ^
Language: C

#include<stdio.h>

int main(int)
{
  int n = 0;
  int a = 0;
  int m = 0;
  int i = 0;
  int j = 0;
  int max = 0;
  int num[200000] = 0;
  
  do{
    scanf("%d", &n);
  }while(n < 1 || n > 200000);

  for(i = 0; i < n; i++){
    do{
      scanf("%d", &num[i]);
    }while(a < 1 || a > 200000);
  }

  for(i = 0; i < n; i++){
    for(j = 0; j < n; j++){
      if(max <= num[j] || i != j){
        max = j;
      }
    printf("%d\n", max);
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:11:21: error: invalid initializer
   11 |   int num[200000] = 0;
      |                     ^
main.c:31:1: error: expected declaration or statement at end of input
   31 | }
      | ^
Language: C++

#include <iostream>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, i=0;
  cin >> N;
  vector<int> vec(N);
  vector<int> copy;
  while(cin >> l){
    vec[i] = l;
    i++;
  }
  int max;
  size_t maxIndex;
  
  for(i = 0; i < N; i++){
    memcpy(copy, vec, sizeof(int) * N);
    copy.erase(copy.begin() + i);
  	cout >> *std::max_element(copy.begin(), copy.end()) >> "\n";
  }
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'vector' was not declared in this scope
    8 |   vector<int> vec(N);
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:8:10: error: expected primary-expression before 'int'
    8 |   vector<int> vec(N);
      |          ^~~
a.cc:9:10: error: expected primary-expression before 'int'
    9 |   vector<int> copy;
      |          ^~~
a.cc:10:16: error: 'l' was not declared in this scope
   10 |   while(cin >> l){
      |                ^
a.cc:11:5: error: 'vec' was not declared in this scope
   11 |     vec[i] = l;
      |     ^~~
a.cc:18:18: error: 'vec' was not declared in this scope
   18 |     memcpy(copy, vec, sizeof(int) * N);
      |                  ^~~
a.cc:18:5: error: 'memcpy' was not declared in this scope
   18 |     memcpy(copy, vec, sizeof(int) * N);
      |     ^~~~~~
a.cc:2:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | using namespace std;
a.cc:19:10: error: overloaded function with no contextual type information
   19 |     copy.erase(copy.begin() + i);
      |          ^~~~~
a.cc:19:21: error: overloaded function with no contextual type information
   19 |     copy.erase(copy.begin() + i);
      |                     ^~~~~
a.cc:20:23: error: 'max_element' is not a member of 'std'; did you mean 'tuple_element'?
   20 |         cout >> *std::max_element(copy.begin(), copy.end()) >> "\n";
      |                       ^~~~~~~~~~~
      |                       tuple_element
a.cc:20:40: error: overloaded function with no contextual type information
   20 |         cout >> *std::max_element(copy.begin(), copy.end()) >> "\n";
      |                                        ^~~~~
a.cc:20:54: error: overloaded function with no contextual type information
   20 |         cout >> *std::max_element(copy.begin(), copy.end()) >> "\n";
      |                                                      ^~~
Language: C

#include<stdio.h>
int main()
{
  int n;
  if(scanf("%d",&n)>0)
  {int a[n];
  for(int i=0;i<n;i++)
    {if(scanf("%d",&a[i])>0)
    }
  int max=0;
  for(int i=1;i<n;i++)
  {
    if(a[max]<a[i])
      max=i;
  }
  int max1=0;
   for(int i=1;i<n;i++)
  {
    if(a[max1]<a[i] && i!=max)
      max1=i;
  }
  for(int i=0;i<n;i++)
  {
    if(i!=max)
      printf("%d\n",a[max]);
    else
      printf("%d\n",a[max1]);
  }
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:9:5: error: expected expression before '}' token
    9 |     }
      |     ^
Language: C

N = int(input())
s = [int(input()) for i in range(N)]
for k in s:
    m = s.pop(0)
    print(max(s))
    s.append(m)


Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | N = int(input())
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'N' [-Wimplicit-int]
main.c:1:5: error: expected expression before 'int'
    1 | N = int(input())
      |     ^~~
Language: C++

#include <stdio.h>
  

int main(void){
  int n,ma;
  scanf("%d",&n);
  int num[n];
  for(int i=0;i<n;i++){
    fgets("%d",&num[i]);
  }
  for(int j = 0;j<n;j++){
    if(x !=0){ma = num[0];
           }else{
    ma = num[1];
  }
  for(int j = 0;j<x;j++){
    if(ma<num[j]){
      ma = num[j];
    }
  }
  for(int j = x+1;j<n;j++){
    if(ma<num[j]){
      ma = num[j];
    }
  }
  }
  return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:9:11: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
    9 |     fgets("%d",&num[i]);
      |           ^~~~
a.cc:9:16: error: invalid conversion from 'int*' to 'int' [-fpermissive]
    9 |     fgets("%d",&num[i]);
      |                ^~~~~~~
      |                |
      |                int*
a.cc:9:10: error: too few arguments to function 'char* fgets(char*, int, FILE*)'
    9 |     fgets("%d",&num[i]);
      |     ~~~~~^~~~~~~~~~~~~~
In file included from a.cc:1:
/usr/include/stdio.h:654:14: note: declared here
  654 | extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
      |              ^~~~~
a.cc:12:8: error: 'x' was not declared in this scope
   12 |     if(x !=0){ma = num[0];
      |        ^
a.cc:16:19: error: 'x' was not declared in this scope
   16 |   for(int j = 0;j<x;j++){
      |                   ^
a.cc:21:15: error: 'x' was not declared in this scope
   21 |   for(int j = x+1;j<n;j++){
      |               ^
a.cc:27:12: error: expected '}' at end of input
   27 |   return 0;
      |            ^
a.cc:4:15: note: to match this '{'
    4 | int main(void){
      |               ^
Language: C

#include<stdio.h>
int main(void){
	int i,n.m[3000000],j,k[3000000],x;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%d",&m[i]);
	}

	for(x=0;x<n;x++){
		for(j=1;j<n-1;j++){
			if(m[1]<=[j]){
				m[1]=m[j];
				k[x]=m[1];
				
			}
		}
	}



	for(x=0;x<n;x++){
		printf("%d",k[x]);
	}
}

Compiler output:
main.c: In function 'main':
main.c:3:16: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    3 |         int i,n.m[3000000],j,k[3000000],x;
      |                ^
main.c:4:21: error: 'n' undeclared (first use in this function)
    4 |         scanf("%d",&n);
      |                     ^
main.c:4:21: note: each undeclared identifier is reported only once for each function it appears in
main.c:6:29: error: 'm' undeclared (first use in this function)
    6 |                 scanf("%d",&m[i]);
      |                             ^
main.c:9:13: error: 'x' undeclared (first use in this function)
    9 |         for(x=0;x<n;x++){
      |             ^
main.c:10:21: error: 'j' undeclared (first use in this function)
   10 |                 for(j=1;j<n-1;j++){
      |                     ^
main.c:11:34: error: expected expression before '[' token
   11 |                         if(m[1]<=[j]){
      |                                  ^
main.c:13:33: error: 'k' undeclared (first use in this function)
   13 |                                 k[x]=m[1];
      |                                 ^
Language: C++

#include <iostream>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, i=0;
  cin >> N;
  std::vector<int> vec(N);
  std::vector<int> copy;
  while(cin >> l){
    vec[i] = l;
    i++;
  }
  int max;
  size_t maxIndex;
  
  for(i = 0; i < N; i++){
    memcpy(copy, vec, sizeof(int) * N);
    copy.erase(copy.begin() + i);
  	cout >> *std::max_element(copy.begin(), copy.end()) >> "\n";
  }
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:8: error: 'vector' is not a member of 'std'
    8 |   std::vector<int> vec(N);
      |        ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:8:15: error: expected primary-expression before 'int'
    8 |   std::vector<int> vec(N);
      |               ^~~
a.cc:9:8: error: 'vector' is not a member of 'std'
    9 |   std::vector<int> copy;
      |        ^~~~~~
a.cc:9:8: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:9:15: error: expected primary-expression before 'int'
    9 |   std::vector<int> copy;
      |               ^~~
a.cc:10:16: error: 'l' was not declared in this scope
   10 |   while(cin >> l){
      |                ^
a.cc:11:5: error: 'vec' was not declared in this scope
   11 |     vec[i] = l;
      |     ^~~
a.cc:18:18: error: 'vec' was not declared in this scope
   18 |     memcpy(copy, vec, sizeof(int) * N);
      |                  ^~~
a.cc:18:5: error: 'memcpy' was not declared in this scope
   18 |     memcpy(copy, vec, sizeof(int) * N);
      |     ^~~~~~
a.cc:2:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | using namespace std;
a.cc:19:10: error: overloaded function with no contextual type information
   19 |     copy.erase(copy.begin() + i);
      |          ^~~~~
a.cc:19:21: error: overloaded function with no contextual type information
   19 |     copy.erase(copy.begin() + i);
      |                     ^~~~~
a.cc:20:23: error: 'max_element' is not a member of 'std'; did you mean 'tuple_element'?
   20 |         cout >> *std::max_element(copy.begin(), copy.end()) >> "\n";
      |                       ^~~~~~~~~~~
      |                       tuple_element
a.cc:20:40: error: overloaded function with no contextual type information
   20 |         cout >> *std::max_element(copy.begin(), copy.end()) >> "\n";
      |                                        ^~~~~
a.cc:20:54: error: overloaded function with no contextual type information
   20 |         cout >> *std::max_element(copy.begin(), copy.end()) >> "\n";
      |                                                      ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  int n;
  cin >> n;
  
  int vec[200002];
  for (int i = 0; i < n; ++i) {
    cin >> vec[i];
    map.insert(vec[i]);
  }
  
  for (int i = 0; i < n; ++i) {
    int key = vec[i];
    auto it = map.rbegin();
    if (key < *it) {
      cout << *it << endl;
    }
    else {
      if (map.count(key) > 1) {
        cout << key << endl;
      }
      else {
        auto it = map.find(key);
        if (it != map.begin()) it--;
        cout << *it << endl;
      }
    }
  }
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:8: error: expected unqualified-id before '.' token
   13 |     map.insert(vec[i]);
      |        ^
a.cc:18:18: error: missing template arguments before '.' token
   18 |     auto it = map.rbegin();
      |                  ^
a.cc:23:14: error: expected unqualified-id before '.' token
   23 |       if (map.count(key) > 1) {
      |              ^
a.cc:27:22: error: missing template arguments before '.' token
   27 |         auto it = map.find(key);
      |                      ^
a.cc:28:22: error: missing template arguments before '.' token
   28 |         if (it != map.begin()) it--;
      |                      ^
Language: C++

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

int main() {
    int N, i=0;
    cin >> N ;
    int a[N];
    while(N){
        cin >> SS;
        a[i] = SS;
        i++;
    }
    i=0;
    int s,max;
    while(N){
        s=0;
        max=0;
        while(N){
            if(i!=s){
                if(s>0&&max<a[s]){
                    max = a[s];
                }
                s++;
            }
        }
        cout << max << endl;
        i++;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:16: error: 'SS' was not declared in this scope
    9 |         cin >> SS;
      |                ^~
Language: Java

import java.util.Scanner;
import java.util.ArrayList;
import java.util.Collections;
 
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    List<Integer> nSeq = new ArrayList<>();
    int n = sc.nextInt();
	for(int i = 0;i < n;i++){
      nSeq.add(sc.nextInt());
    }
    int box = 0;
    for(int i = 0;i < nSeq.size();i++){
      box = nSeq.get(i);
      nSeq.set(i,0);
      System.out.println(Collections.max(nSeq));
      nSeq.set(i,box);
    }
  }
}

Compiler output:
Main.java:8: error: cannot find symbol
    List<Integer> nSeq = new ArrayList<>();
    ^
  symbol:   class List
  location: class Main
1 error
Language: C

#include <stdio.h>
#include <stdlib.h>
 
int main(void)
{
  int *a;
  int N;
  scanf("%d",&N);
  a = (int)malloc(sizoof(int)*N);
  int i,m1= 0,m2=0;
  for(i = 0; i<N;i++){
    scanf("%d",a+i);
    m1 = (m1>a[i]) ? m1:a[i];
    m2 = (m1> a[i] && a[i] > m2) ? a[i]:m2;
  }
  for(i = 0;i<N;i++){
    if(m1 != a[i]) printf("%d",m1);
    else  printf("%d",m2);
  }
  return 0;
} 

Compiler output:
main.c: In function 'main':
main.c:9:19: error: implicit declaration of function 'sizoof' [-Wimplicit-function-declaration]
    9 |   a = (int)malloc(sizoof(int)*N);
      |                   ^~~~~~
main.c:9:26: error: expected expression before 'int'
    9 |   a = (int)malloc(sizoof(int)*N);
      |                          ^~~