criyle/codenet-compile-errors huggingface dataset:
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;
		XoaPhanTu(X1, N1, i);
		int Y[i] = max(X1,N1-1);
		for (i = 0; i < N; i++) {
			N1[i] = N[i];
		}
	}
	for (ij= 0; j < N; j++) {
		cout << Y[j] << endl;
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:53:31: error: array must be initialized with a brace-enclosed initializer
   53 |                 int Y[i] = max(X1,N1-1);
      |                            ~~~^~~~~~~~~
a.cc:55:27: error: invalid types 'int[int]' for array subscript
   55 |                         N1[i] = N[i];
      |                           ^
a.cc:55:34: error: invalid types 'int[int]' for array subscript
   55 |                         N1[i] = N[i];
      |                                  ^
a.cc:58:14: error: 'ij' was not declared in this scope; did you mean 'j'?
   58 |         for (ij= 0; j < N; j++) {
      |              ^~
      |              j
Language: C

#include<stdio.h>

int main(){
  int N,i,r,max;
  scanf("%d",&N);
  
  int A[N];
  
  for(i=0;i<N;i++){
    (scanf("%d",&A[i]);
  }
  for(i=0;i<N;i++){
  	for(r=0;i<N;r++){
    	if(r != i){
          if(A[r] > max)max = A[r];
        }
    }
    printf("%d",max);
  }
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:10:23: error: expected ')' before ';' token
   10 |     (scanf("%d",&A[i]);
      |     ~                 ^
      |                       )
main.c:10:24: error: expected ';' before '}' token
   10 |     (scanf("%d",&A[i]);
      |                        ^
      |                        ;
   11 |   }
      |   ~
Language: C

#include<stdio.h>

int main(){
  int N,i,r,max;
  if(scanf("%d",&N)=1);
  
  int A[N];
  
  for(i=0;i<N;i++){
    (scanf("%d",&A[i]);
  }
  for(i=0;i<N;i++){
  	for(r=0;i<N;r++){
    	if(r != i){
          if(A[r] > max)max = A[r];
        }
    }
    printf("%d",max);
  }
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:20: error: lvalue required as left operand of assignment
    5 |   if(scanf("%d",&N)=1);
      |                    ^
main.c:10:23: error: expected ')' before ';' token
   10 |     (scanf("%d",&A[i]);
      |     ~                 ^
      |                       )
main.c:10:24: error: expected ';' before '}' token
   10 |     (scanf("%d",&A[i]);
      |                        ^
      |                        ;
   11 |   }
      |   ~
Language: C

#include <stdio.h>
#incldue <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:2:2: error: invalid preprocessing directive #incldue; did you mean #include?
    2 | #incldue <stdlib.h>
      |  ^~~~~~~
      |  include
main.c: In function 'main':
main.c:9:12: error: implicit declaration of function 'malloc' [-Wimplicit-function-declaration]
    9 |   a = (int)malloc(sizoof(int)*N);
      |            ^~~~~~
main.c:2:1: note: include '<stdlib.h>' or provide a declaration of 'malloc'
    1 | #include <stdio.h>
  +++ |+#include <stdlib.h>
    2 | #incldue <stdlib.h>
main.c:9:12: warning: incompatible implicit declaration of built-in function 'malloc' [-Wbuiltin-declaration-mismatch]
    9 |   a = (int)malloc(sizoof(int)*N);
      |            ^~~~~~
main.c:9:12: note: include '<stdlib.h>' or provide a declaration of 'malloc'
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);
      |                          ^~~
Language: C++

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

int main() {
    int N, i=0;
    cin >> N ;
    int a[N];
    while(N){
        cin >> N;
        a[i] = N;
        i++;
    }
    int i=0;
    while(N){
        int s=0;
        int 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:13:9: error: redeclaration of 'int i'
   13 |     int i=0;
      |         ^
a.cc:5:12: note: 'int i' previously declared here
    5 |     int N, i=0;
      |            ^
Language: C

include <stdio.h>


int main(void) {

	int suuretu, tmp, max;
	int array[200000];
	
	scanf("%d", &suuretu);

	for (int i = 0; i<suuretu; i++) {
		scanf("%d", &array[i]);
		
	}



	for (int m = 0; m<suuretu; m++) {
		tmp = array[0];
		array[0] = array[m];
		array[m] = tmp;
		max = array[1];
		for (int j = 1; j<suuretu; j++) {
			if (max<array[j]) {
				max = array[j];
			}
		}
		printf("%d\n", max);
		
	}
	return 0;
}

Compiler output:
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include <stdio.h>
      |         ^
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(inti=0; i<n; i++){
   		cin>>v[i];
   	}

   	for(int j=0;j<n; j++){
   		for(int k=0; k<n; k++){
   			if(k!=j){
   				if(max < v[k])max=v[k];
   			}
   		}
   		a[j]=max;
   		max=0;
   	}

   	for(inti=0; i<n; i++){
   		cout<<a[i]<<endl;
   	}

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:13: error: 'inti' was not declared in this scope; did you mean 'int'?
   11 |         for(inti=0; i<n; i++){
      |             ^~~~
      |             int
a.cc:11:21: error: 'i' was not declared in this scope
   11 |         for(inti=0; i<n; i++){
      |                     ^
a.cc:25:13: error: 'inti' was not declared in this scope; did you mean 'int'?
   25 |         for(inti=0; i<n; i++){
      |             ^~~~
      |             int
a.cc:25:21: error: 'i' was not declared in this scope
   25 |         for(inti=0; i<n; i++){
      |                     ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n;
    cin>>n;
    vector<int> s;
    int first=INT_MIN,sec=INT_MIN;  
    for(int i=0;i<n;i++)
    {  
         int x;
         cin>>x;
         s.push_back(x);
         if(first<x)
         {
           first=x;
         }
      	else if(sec<x)
      	{
         sec=x;
      	}
    }
    
 
     for(int i=0;i<n;i++)
     {
       if(s[i]!=first)
       {
          cout<<first<<endl;
        }
       else
       {
          cout<<second<<endl;
       }
     }
	return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n;
    cin>>n;
    vector<int> s;
    int first=INT_MIN,sec=INT_MIN;  
    for(int i=0;i<n;i++)
    {  
         int x;
         cin>>x;
         s.push_back(x);
         if(first<x)
         {
           first=x;
         }
      	else if(second<x)
      	{
         second=x;
      	}
    }
    
 
     for(int i=0;i<n;i++)
     {
       if(s[i]!=first)
       {
          cout<<first<<endl;
        }
       else
       {
          cout<<second<<endl;
       }
     }
	return 0;
}

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

#include <iostream>
#include <valarray>
#include <cstdio>
using namespace std;

int main() {
	int n;
	cin >> n;
	valarray<int> a(n);
	for (int i = 0; i < n; ++i) {
		int d = scanf_s("%d", &a[i]);
	}
	valarray<int> b = a;
	int max1 = b.max();
	valarray<bool> m = b != max1;
	valarray<int> r = b[m];
	int max2 = r.max();
	for (int i = 0; i < n; ++i) {
		if (b[i] == max1) {

			cout << max2 << "\n";
		}
		else {

			cout << max1 << "\n";
		}
	}
}


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

#include <iostream>

using namespace std;

int main(void){
	
	int n;
	cin >> n;
	
	int a[n];
	for(int i = 0; i < n; ++i){
		cin >> a[i];
	}
	
	int max = 0, smax = -1;
	for(int i = 1; i < n; ++i){
		if(a[max] < a[i]){
			smax = max;
			max = i;
		}
	}
	if(max == 0 && smax == -1) smax = 1
	if(max + 1 < n){
		for(int i = max+1; i < n; ++i){
			if(a[smax] < a[i]){
				smax = i;
			}
		}
	}
	
	for(int i = 0; i < n; ++i){
		if(i == max){
			cout << a[smax] << endl;
		}else{
			cout << a[max] << endl;
		}
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:44: error: expected ';' before 'if'
   22 |         if(max == 0 && smax == -1) smax = 1
      |                                            ^
      |                                            ;
   23 |         if(max + 1 < n){
      |         ~~
Language: C++

#include<fstream>
#include<string>
#include<iostream>
#include<sstream>
#include<iterator>
#include<cmath>

using namespace std;


int main(){
 int N;
 cin >> N;
 int a[N];
 int i;
 int j;
 for(i=0;i<N;++i){
     cin >> a[i];
   }
  int tmp = 0;
  int best;
  int hukusuu=0;
 for(i=0;i<1;++i){
   for(j=1;j<N;++j){
     if(tmp < a[j]){
       tmp = a[j];
       best = j;
       hukusuu = 0;}
     else if(tmp == a[j]){
       hukusuu++;}}
   cout << tmp << endl;
 }
 if(a[0]>=tmp){
   for(i=1;i<N;++i){
     cout << a[0] << endl;
   }
  else if(hukusuu>0){
    for(i=1;i<N;++i){
    cout << tmp << endl;
    }}
   else{
    for(i=1;i<N;++i){
    if(i!=best){cout << tmp << endl;}
      else{
        int newtmp = 0;
        for(j=0;j<N;++j){
          if(j!=best)newtmp=max(newtmp,a[j]);}
        cout << newtmp << endl;
      }
    }
   }
 }  
 return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:3: error: expected '}' before 'else'
   37 |   else if(hukusuu>0){
      |   ^~~~
a.cc:33:15: note: to match this '{'
   33 |  if(a[0]>=tmp){
      |               ^
a.cc: At global scope:
a.cc:53:2: error: expected unqualified-id before 'return'
   53 |  return 0;
      |  ^~~~~~
a.cc:54:1: error: expected declaration before '}' token
   54 | }
      | ^
Language: C++

#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <cmath>
#define rep(i, n) for(int i=0;i<n;i++)
using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> a(200010);
    rep(i, n) cin >> a[i];
    vector<int> b = a;
    sort(b.begin(), b.end(), greater<int>());
    rep(i, n) {
        if (a[i] == b[0]) cout << b[1] << endl;
        else cout << b[0] << endl;;
    }
}


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

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:8:20: error: cannot convert 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'int' in assignment
    8 |         a[i] = cin >> N;
      |                ~~~~^~~~
      |                    |
      |                    std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
Language: C++

#include<fstream>
#include<string>
#include<iostream>
#include<sstream>
#include<iterator>
#include<cmath>

using namespace std;

if(a[j]>=tmp){
  tmp=a[j];
  b[k] = j;

int main(){
 int N;
 cin >> N;
 int a[N];
 int i;
 int j;
 for(i=0;i<N;++i){
     cin >> a[i];
   }
  int tmp = 0;
  int best;
  int hukusuu=0;
 for(i=0;i<1;++i){
   for(j=1;j<N;++j){
     if(tmp < a[j]){
       tmp = a[j];
       best = j;
       hukusuu = 0;}
     else if(tmp == a[j]){
       hukusuu++;}}
   cout << tmp << endl;
 }
 if(a[0]>=tmp){
   for(i=1;i<N;++i){
     cout << a[0] << endl;
   }
  else if(hukusuu>0){
    for(i=1;i<N;++i){
    cout << tmp << endl;
    }}
   else{
    for(i=1;i<N;++i){
    if(i!=best){cout << tmp << endl;}
      else{
        int newtmp = 0;
        for(j=0;j<N;++j){
          if(j!=best)newtmp=max(newtmp,a[j]);}
        cout << newtmp << endl;
      }
    }
   }
 }  
 return 0;
}


Compiler output:
a.cc:10:1: error: expected unqualified-id before 'if'
   10 | if(a[j]>=tmp){
      | ^~
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);
    ArrayList<Integer> nSeq = new ArrayList<>();
    int n = sc.nextInt();
	for(int i = 0;i < n;i++){
      nSeq.add(sc.nextInt());
    }
    Collections.sort(nSeq,Collections.reverseOrder());
    for(int i = 0;i < nSeq.size;i++){
      System.out.println(nSeq.get(i));
    }
  }
}

Compiler output:
Main.java:14: error: size has private access in ArrayList
    for(int i = 0;i < nSeq.size;i++){
                          ^
1 error
Language: Java

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int[] A = new int[N];
		Integer[] B = new Integer[N];
		for(int i=0;i<N;i++) {
			int a = sc.nextInt();
			A[i] = a;
			B[i] = a;
		}
		
		Arrays.sort(B, Comparator.reverseOrder());
		int max = B[0];
		int secMax = B[1];
		
		for(int i=0;i<N;i++) {
			int skipInt = A[i];
			if(max != skipInt) {
				System.out.println(max);
			}else {
				System.out.println(secMax);
			}
		}
		
		sc.close();	
	}
}

Compiler output:
Main.java:3: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:3: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
Main.java:14: error: cannot find symbol
		Arrays.sort(B, Comparator.reverseOrder());
		^
  symbol:   variable Arrays
  location: class Main
Main.java:14: error: cannot find symbol
		Arrays.sort(B, Comparator.reverseOrder());
		               ^
  symbol:   variable Comparator
  location: class Main
4 errors
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);
    ArrayList<Integer> nSeq = new ArrayList<>();
    int n = sc.nextInt();
	for(int i = 0;i < n;i++){
      nSeq.add(sc.nextInt());
    }
    Collections.sort(nSeq,Collections.reverseOrder());
    for(int i = 0;i < nSeq.size;i++){
      System.out.println(nSeq.get(i));
    
  }
}

Compiler output:
Main.java:18: error: reached end of file while parsing
}
 ^
1 error
Language: C

#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
    int n;
    int a[200005], b[200005];
    scanf("%d", &n);
    int i;
    for (i = 0; i < n; i++)
    {
        scanf("%d", &a[i]);
        b[i] = a[i];
    }
    sort(b, b + n);
    for (i = 0; i < n; i++)
    {
        if (b[n - 1] != a[i])
            printf("%d\n", b[n - 1]);
        else
            printf("%d\n", b[n - 2]);
    }
    return 0;
}

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

#include <iostream>
#include <vector>

int main(){
  int n,b,max,max2,d;
  std::cin >> n;
  std::vector<int> v(n);
  for (int i = 0; i < n; i++) std::cin >> v[i];
  max = *std::max_element(v.begin(), v.end());
  for (int i = 0; i < n; i++)  {
    if (v[i]==max){
      max2=*std::max_element(v.begin()+i+1, v.end());
      std::cout << max2 << '\n';
      for (int j = i+1; j < n; j++) {std::cout << max << '\n';}
      return 0;
    }else{
      std::cout << max << '\n';
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:15: error: 'max_element' is not a member of 'std'; did you mean 'tuple_element'?
    9 |   max = *std::max_element(v.begin(), v.end());
      |               ^~~~~~~~~~~
      |               tuple_element
a.cc:12:18: error: 'max_element' is not a member of 'std'; did you mean 'tuple_element'?
   12 |       max2=*std::max_element(v.begin()+i+1, v.end());
      |                  ^~~~~~~~~~~
      |                  tuple_element
Language: C++

#include <iostream>
#include <vector>

int main(){
  int n,b,max,max2,d;
  std::cin >> n;
  std::vector<int> v(n);
  for (int i = 0; i < n; i++) std::cin >> v[i];
  max = *std::max_element(v.begin(), v.end());
  for (int i = 0; i < n; i++)  {
    if (v[i]==max){
      max2=*std::max_element(v.begin()+i+1, v.end());
      std::cout << max2 << '\n';
      for (int j = i+1; j < n; j++) {std::cout << max << '\n';}
      return 0;
    }else{
      std::cout << max << '\n';
    }
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:15: error: 'max_element' is not a member of 'std'; did you mean 'tuple_element'?
    9 |   max = *std::max_element(v.begin(), v.end());
      |               ^~~~~~~~~~~
      |               tuple_element
a.cc:12:18: error: 'max_element' is not a member of 'std'; did you mean 'tuple_element'?
   12 |       max2=*std::max_element(v.begin()+i+1, v.end());
      |                  ^~~~~~~~~~~
      |                  tuple_element
Language: C++

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

int main() {

  int N,ret,maxval,mval,mval2;
  cin>> N ;
  vector<int> A(N),B(N);
  mval=0;
  mval2=0;
  for(int i=0;i<N;i++){
    cin>>A.at(i);
  }
  B(N)=A(N);
  sort(A.begin(), A.end() ,greater<int>());
  mval=A.at(0);
  mval2=A.at(1);

  for (int i=0;i<N;i++){
    maxval=mval;
    if(mval==B.at(i)){
      cout<<"Y";
      maxval=mval2;
  }
    cout<<maxval<<endl;
  }

}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:4: error: no match for call to '(std::vector<int>) (int&)'
   14 |   B(N)=A(N);
      |   ~^~~
a.cc:14:9: error: no match for call to '(std::vector<int>) (int&)'
   14 |   B(N)=A(N);
      |        ~^~~
Language: C++

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

int main()
{
  int n;
  cin>>n;
  vector<int> v(n);
  for(int i=0; i<n; i++)
  	cin>>v[i];
  int maxel;
  for(int i=0; i<n; i++)
  {
    maxel = v[(i+1)%n];
    for(int j=0; j<n; j++)
    {
      if(v[j]>=maxel && v[j]!=v[i])
      {
        maxel = v[j];
      }
    }
    cout<<maxel<<endl;
  }
  
  return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:25:12: error: expected '}' at end of input
   25 |   return 0;
      |            ^
a.cc:5:1: note: to match this '{'
    5 | {
      | ^
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main(){
    int n, ai;
    cin >> n;
    vector<int> v;
    for(int i = 0; i < n; i++){
        cin >> ai;
        v.push_back(ai);
    }
    for(int i = 0; i < n; i++){
        vector<int> v2(v);
        v2.erase(v2.begin() + i);
        cout << *max_element(v2.begin(), v2.end()) << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:18: error: 'max_element' was not declared in this scope
   17 |         cout << *max_element(v2.begin(), v2.end()) << endl;
      |                  ^~~~~~~~~~~
Language: C++

# -*- coding: utf-8 -*-

N = int(input()) 
s = [input() for i in range(N)] 

for i in range((len(s))):
    temp = s.pop(i)
    print(max(s))
    s.insert(i, temp)

Compiler output:
a.cc:1:3: error: invalid preprocessing directive #-
    1 | # -*- coding: utf-8 -*-
      |   ^
a.cc:3:1: error: 'N' does not name a type
    3 | N = int(input())
      | ^
Language: C++

#include<iostream>
using namespace std;
unsigned long long a[200000];
int main()
{
	unsigned long long n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	long long ans=0;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			if(j!=i)
			{
				ans=max(ans,a[j]);
			}
		}
		cout<<ans<<endl;
		ans=0;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:40: error: no matching function for call to 'max(long long int&, long long unsigned int&)'
   19 |                                 ans=max(ans,a[j]);
      |                                     ~~~^~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:19:40: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
   19 |                                 ans=max(ans,a[j]);
      |                                     ~~~^~~~~~~~~~
/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 <bits.stdc++.h>
using namespace std;
int a[200005];
int main()
{
	int n;
  	cin>>n;
  	int maxx=-1;
  	for(int i=0;i<n;i++)
    {
      	cin>>a[i];
      	maxx=max(maxx,a[i]);
    }
  	for(int i=0;i<n;i++)
    {
      	if (a[i]<maxx)
          	cout<<maxx;
      	else 
        {
          	int maxxx=-1;
        	for(int j=0;j<n;j++)
             	if (j!=i)
                 	maxxx=max(maxxx,a[j]);
          	cout<<maxxx;
        }
    }
  return 0;
}

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

#include <bits.stdc++.h>
using namespace std;
int a[200005]
int main()
{
	int n;
  	cin>>n;
  	int maxx=-1;
  	for(int i=0;i<n;i++)
    {
      	cin>>a[i];
      	maxx=max(maxx,a[i]);
    }
  	for(int i=0;i<n;i++)
    {
      	if (a[i]<maxx)
          	cout<<maxx;
      	else 
        {
          	int maxxx=-1;
        	for(int j=0;j<n;j++)
             	if (j!=i)
                 	maxxx=max(maxxx,a[j]);
          	cout<<maxxx;
        }
    }
  return 0;
}

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

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

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

  return 0;
}


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

#include<bits/stdc++.h>
using namespace std;
int main()
{
    long n,i,t,s,p,a[200003];
  cin>>n;
  for(i=0;i<n;i++){
  cin>>a[i];
  }
  t=s=0;
    for(i=0;i<n;i++){
      if(t<=a[i]){
        t=a[i];
        s=t;
        p=i;
      }
      else if(s<=a[i]){
        s=a[i];
        p=i;
    }
        for(i=0;i<n;i++){
          if(i==p) cout<<s<<endl;
          else cout<<t<<endl;
        }
}

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

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

int main(){
	int N, k, i;
	vector<int> A;
	
	cin >> N;
	for (i = 0; i < N; i++) {
		cin >> k;
		A.push_back(k);
	}

	for (i = 0; i < N; i++){
		vector<int> C(A);
		C.erase(C.begin()+i);
		int max = *max_element(C.begin(), C.end());
		cout << max << endl;
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:28: error: 'max_element' was not declared in this scope
   18 |                 int max = *max_element(C.begin(), C.end());
      |                            ^~~~~~~~~~~
Language: C++

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> A(n),B(n);
  for(int i=0;i<n;i++){
    cin >> A.at(i);
  }
  
  for(int i=0;i<n;i++){
    B.at(i)=A.at(i);
  }
  
  sort(B.begin(), B.end());
  reverse(B.begin(), B.end());
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(A.at(i)!=B.at(j)){
        cout << B.at(j) << endl;
        break;
      }
    }
}


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

#include <iostream>
#include <vector>

using namespace std;

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

    int max = 0;
    int index = 0;
    for(int i = 0;i < n; i++){
        cin >> a[i];
        if(max > a[i]){
            max = a[i];
            index = i;
        }
    }

    sort(a.begin(),a.end());
    int max2 = a[2];
    for(int i = 0;i < n; i++){
        if(i == index)cout << max2 << endl;
        else cout << max << endl;
    }
    return 0;
}

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

#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;

#define mem(dp,a)           memset(dp,a,sizeof dp)
#define rep(i,a,b)          for(ll i=a;i<b;i++)
#define pb(x)               push_back(x)
#define mp(x,y)             make_pair(x,y)
#define fastio              ios_base::sync_with_stdio(false);cin.tie(NULL)
#define F                   first
#define S                   second
#define all(v)              (v).begin(),(v).end()
#define pi                  3.14159265359
ll INF=1e18+10;
ll MOD=1000000009;

int main()
{
    fastio;
    int n;cin>>n;
    int a[n];
    int maxx=INT_MIN,maxx2=INT_MIN,maxc=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        maxx=max(maxx,a[i]);
    }
    for(int i=0;i<n;i++)
    {
        if(a[i]!=maxx)
            maxx2=max(maxx2,a[i]);
        else
            maxc++;
    }
    for(int i=0;i<n;i++)
        cout<<((a[i]==maxx && maxc==1) ? maxx2 : maxx)<<endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:14: error: 'INT_MIN' was not declared in this scope
   37 |     int maxx=INT_MIN,maxx2=INT_MIN,maxc=0;
      |              ^~~~~~~
a.cc:17:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   16 | #include <functional>
  +++ |+#include <climits>
   17 | using namespace std;
a.cc:46:13: error: 'maxx2' was not declared in this scope; did you mean 'maxx'?
   46 |             maxx2=max(maxx2,a[i]);
      |             ^~~~~
      |             maxx
a.cc:48:13: error: 'maxc' was not declared in this scope; did you mean 'maxx'?
   48 |             maxc++;
      |             ^~~~
      |             maxx
a.cc:51:31: error: 'maxc' was not declared in this scope; did you mean 'maxx'?
   51 |         cout<<((a[i]==maxx && maxc==1) ? maxx2 : maxx)<<endl;
      |                               ^~~~
      |                               maxx
a.cc:51:42: error: 'maxx2' was not declared in this scope; did you mean 'maxx'?
   51 |         cout<<((a[i]==maxx && maxc==1) ? maxx2 : maxx)<<endl;
      |                                          ^~~~~
      |                                          maxx
Language: C++

#include<bits/stdc++.h>
using namespace std;
int r,ans[200000],b[200000];
int main(){
cin>>r;
  for(int i=0;i<r;i++)cin>>ans[i];
  for(int i=0;i<r;i++){
memcpy(b, ans, sizeof(ans));   
    b[i]=0;
    sort(b,b+r);
    cout<<b[n-1]<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:13: error: 'n' was not declared in this scope
   11 |     cout<<b[n-1]<<endl;
      |             ^
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#define ll long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,0,n)
#define SORT(V) sort((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
using namespace std;

int main(){
  int N,p,q;
  cin>>N;
  vector<pair<int,int>> A;
  REP(i,N){
    int a;
    cin>>a;
    A.push_back(make_pair(a,i));
  }
  SORT(A);
  bool CAN=false;
  if(A[N-1].first==A[N-2].first) CAN=true;
  else{
    p=A[N-1].second;
    q=A[N-2].first;
  }
  
  if(CAN){
    REP(i,N) cout<<A[N-1].first<<endl;
  }
  else{
    if(i==p) cout<<q<<endl;
    else cout<<A[N-1].first<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:8: error: 'i' was not declared in this scope
   39 |     if(i==p) cout<<q<<endl;
      |        ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int r,ans[200000],b[200000];
int main(){
cin>>r;
  for(int i=0;i<r;i++)cin>>ans[i];
  for(int i=0;i<r;i++){
memcpy(b, ans, sizeof(ans));   
    b[i]=0;
    sort(b,b+n);
    cout<<b[n-1]<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:14: error: 'n' was not declared in this scope
   10 |     sort(b,b+n);
      |              ^
Language: C++

#include<iostream>

typedef unsigned long long ULL;
using namespace std;

bool check(int a, int b){
    if( a > b ){
        return true;
    }else{
        return false;
    }
}
int main(){
    int *A;
    int *B;
    int N;
    int i;
    int pos;
    int point,score;
    
    cin >> N;
    A = new int[N];
    B = new int[N];
    for(i=0;i<N;i++){
        cin >> A[i];
        B[i] = A[i];
    }
    sort(B,B+N,check);
    for(i=0;i<N;i++){
        if( B[0] == A[i] ){
            cout << B[1] << endl;
        }else{
            cout << B[0] << endl;
        }
    }
    
    return 0;
}


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

#include <bits/stdc++.h>
using namespace std;
int a[200005]
int main()
{
	int n;
	cin>>n;
  	for(int i=0;i<n;i++)
      	cin>>a[i];
  	for(int i=0;i<n;i++)
    	for(int j=i+1;j<n;j++)
        	cout<<max(a[i],a[j])<<endl;
 	return 0;
}

Compiler output:
a.cc:4:1: error: expected initializer before 'int'
    4 | int main()
      | ^~~
Language: C++


#include <iostream>
#include <algorithm>

using namespace std;

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

	int* A = new int[N];
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}

	int* B = new int[N];
	memcpy(B, A, sizeof(int) * N);

	sort(B, B + N);

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

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:9: error: 'memcpy' was not declared in this scope
   18 |         memcpy(B, A, sizeof(int) * N);
      |         ^~~~~~
a.cc:4:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <algorithm>
  +++ |+#include <cstring>
    4 |
Language: C++

#include <bits/stdc++.h>

using namespace std;
#define maxn 200005
int arr[maxn];
int main(void)
{
  int n;cin>>n;
  for(int i=1;i<=n;i++){ cin>>arr[i]; }
  for(int i=1;i<=n;i++{ //dont calculate which i-th
    int maxinum=0;
    for(int j=1;j<=n;j++){
      if(j==i) continue;
      if(arr[j]>maxinum) maxinum=arr[j];
    }
    cout<<maxinum<<endl;
  }
  return 0;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:10:23: error: expected ')' before '{' token
   10 |   for(int i=1;i<=n;i++{ //dont calculate which i-th
      |      ~                ^
      |                       )
Language: C++

#include<iostream>
using namespace std;

int main(){
  int n;
  cin >>n;
  int a[n],max=0,max2=0;
  for(int i=0;i<<n;i++){
    cin >> a[i];
    if(a[i]>=a[max]){
      max2 = max;
      max = i;
    }else(a[i]>=a[max2]){
       max2=i;
    }
  }
  for(int i=0;i<n;i++){
    if(i==max) cout << a[max2];
    else cout << a[max];
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:25: error: expected ';' before '{' token
   13 |     }else(a[i]>=a[max2]){
      |                         ^
      |                         ;
Language: C++

#include <stdio.h>
#include <algorithm>

using namespace std;

int div_up(int a, int b){
    int res = a/b;
    if (a%b != 0){
        res += 1;
    }
    return res;
}



int main(){
    int n;
    int a[212345];
    int as[212345];
    scanf("%d", &n);
    for(int i=0; i < n; i++){
        scanf("%d", a + i);
        as[i] = a[i];
    }
    sort(as, as+n, std::greater<int>());
    int res;
    for(int i=0; i < n; i++){
        if(as[0] == a[i]){
            res = as[1];
        }else{
            res = as[0];
        }
        printf("%d\n", res);
    }
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:25: error: 'greater' is not a member of 'std'
   25 |     sort(as, as+n, std::greater<int>());
      |                         ^~~~~~~
a.cc:25:33: error: expected primary-expression before 'int'
   25 |     sort(as, as+n, std::greater<int>());
      |                                 ^~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

int main() {
  int n;
  cin >> n;
  vector<int> a(n); rep (i, n) cin >> a[i];
  int max_1st, max_2nd;
  if (a[n - 1] > a[n - 2]) {
    max_1st = a[n - 1];
    max_2nd = a[n - 2];
  } else {
    max_1st = a[n - 2];
    max_2nd = a[n - 1];
  }
  rep(i, n - 2) {
    if (a[i] > max_1st) {
      max_2nd = max_1st;
      max_1st = a[i];
    } else if (a[i] > max_2nd) {
      max_2nd = a[i];
    }
  }
  rep(i, n) cout << (a[i] > max_1st) ? max_2nd : max_1st << endl;

//  int ans = n - (int)(n - (float)n / (2 * d + 1)); // 切り上げ
//  cout << ans << endl;

//  vector<int> a(n);
//  rep(i,n) cin >> a[i];
//  ll x2 = 0;
//  rep(i,n) {
//    if (i%2) x2 -= a[i];
//    else x2 += a[i];
//  }
//  vector<int> ans(n);
//  ans[0] = x2/2;
//  rep(i,n-1) {
//    ans[i+1] = a[i]-ans[i];
//  }
//  rep(i,n) ans[i] *= 2;
//  rep(i,n) printf("%d%c", ans[i], i==n-1?'\n':' ');
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:58: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   26 |   rep(i, n) cout << (a[i] > max_1st) ? max_2nd : max_1st << endl;
      |                                                  ~~~~~~~~^~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int n;
    cin >> n;
    vector<int> retu(n);
    vector<int> han(n)
    for (int i = 0; i < n; i++) {
        cin >> retu.at(i);
        han.at(i) = retu.at(i);
    }
    int a, b;
    sort(han.begin(), han.end());
    a = han.at(n - 1);
    b = han.at(n - 2);
    for(int i = 0; i < n; i++) {
        if(retu.at(i) != a) {
            cout << a << endl;
        } else {
            cout << b << endl;
        }
    }
}

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

#include <stdio.h>


int main(void)
{
	int N;
	int A[200000];
	int i;
	int maxNum = 0;
	int secondMaxNum = 0;
	int maxPos;
	int secondMaxPos;
	scanf("%d", &N);
	for (i = 0; i < N; i++) {
		scanf_s("%d", &A[i]);
		if (maxNum < A[i]) {
			maxNum = A[i];
			maxPos = i;
		}
	}

	for (i = 0; i < N; i++) {
		if (secondMaxNum < A[i] && i != maxPos) {
			secondMaxNum = A[i];
			secondMaxPos = i;
		}
	}

	for (i = 0; i < N; i++) {
		if (i != maxPos) {
			printf("%d\n", maxNum);
		}
		else {
			printf("%d\n", secondMaxNum);

		}
	}
    return 0;
}


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

#include<iostream>
using namespace std;

int main(){
  int n;
  cin >>n;
  int a[n],max=0,max2=0;
  for(int i=0;i<<n;i++){
    cin >> a[i];
    if(a[i]>=a[max]){
      max2 = max;
      max = i;
    }else(a[i]>=a[max2]) max2=i;

  }
  for(int i=0;i<n;i++){
    if(i==max) cout << a[max2];
    else cout << a[max];
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:25: error: expected ';' before 'max2'
   13 |     }else(a[i]>=a[max2]) max2=i;
      |                         ^~~~~
      |                         ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
int a[200005];
int main()
{
  int n;
  cin>>n;
  for(int i=0;i<n;i++)
  	cin>>a[i]
  for(int i=0;i<n;i++)
    for(int j=i+1;j<n;i++)
    	cout<<max(a[i],a[j]);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:18: error: expected ';' before 'for'
    9 |         cin>>a[i]
      |                  ^
      |                  ;
   10 |   for(int i=0;i<n;i++)
      |   ~~~             
a.cc:10:15: error: 'i' was not declared in this scope
   10 |   for(int i=0;i<n;i++)
      |               ^
a.cc:11:19: error: 'j' was not declared in this scope
   11 |     for(int j=i+1;j<n;i++)
      |                   ^
Language: C++

#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
typedef long long cc;

cc N, K, Ans, i, j, k, a[5000000], sub = 0;
cc kai[35], A[5000000];

string S;


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

	for (i = 0; i < N; i++) {
		if (A[0] < a[i])
			A[0] = a[i];
		else if (A[1] < a[i])
			A[1] = a[i];
	}
	
	for (i = 0; i < N; i++) {
		if (a[i] != A[0])
			cout << A[0] << endl;
		else
			cout << A[1] << endl;
	}
	return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:35:18: error: expected '}' at end of input
   35 |         return 0;
      |                  ^
a.cc:16:12: note: to match this '{'
   16 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 

using namespace __gnu_pbds;
using namespace std;

#define mod 1000000007

#define ft first
#define sd second
#define pb push_back
#define all(x) x.begin(),x.end()
#define ll long long int
#define db long double
#define vlli vector<long long int >
#define mp make_pair
#define ms(x, v) memset(x, v, sizeof x)
#define cnl cout<<"\n";
#define fr(i,b) for(ll i=0; i<=b; i++)
#define frr(i,b) for(ll i=0;i<b;i++)
#define fb(i,b) for(ll i=b-1; i>=0; i--)
#define PI 3.14159265



 long int gcd(long long int a,long long int b){
  if(a<b) swap(a,b);
    if(b==0) return a;
    else return gcd(a%b,b);
 }

 bool comp(pair<long int ,long int>v1,pair<long int ,long int>v2){
          if(v1.ft==v2.ft) return v1.sd>v2.sd;
          else return v1<v2;
 }

 typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;
ll i,j,k;
 

int main(){
  ll n; cin>>n;
  vlli v(n);
  frr(i,n) cin>>v[i];
  ll max=-1;
  ll p;
  sort(all(v));
  ll y=[n-2];
  frr(i,n){
    if(v[i]>max){
      max=v[i];
      p=i;
    }
  }
  frr(i,n){
    if(i==p) cout<<y<<endl;
    else cout<<max<<endl;
  }





return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:48:10: error: expected ',' before '-' token
   48 |   ll y=[n-2];
      |          ^
      |          ,
a.cc:48:10: error: expected identifier before '-' token
a.cc: In lambda function:
a.cc:48:13: error: expected '{' before ';' token
   48 |   ll y=[n-2];
      |             ^
a.cc: In function 'int main()':
a.cc:48:8: error: cannot convert 'main()::<lambda()>' to 'long long int' in initialization
   48 |   ll y=[n-2];
      |        ^~~~~
      |        |
      |        main()::<lambda()>
Language: C++

#include <stdio.h>
#include <algorithm>

using namespace std;

int div_up(int a, int b){
    int res = a/b;
    if (a%b != 0){
        res += 1;
    }
    return res;
}



int main(){
    int n;
    int a[212345];
    int as[212345];
    scanf("%d", &n);
    for(int i=0; i < n; i++){
        scanf("%d", a + i);
        as[i] = a[i];
    }
    sort(as, as+n, greater<int>());
    int res;
    for(int i=0; i < n; i++){
        if(as[0] == a[i]){
            res = as[1];
        }else{
            res = as[0];
        }
        printf("%d\n", res);
    }
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:20: error: 'greater' was not declared in this scope
   25 |     sort(as, as+n, greater<int>());
      |                    ^~~~~~~
a.cc:25:28: error: expected primary-expression before 'int'
   25 |     sort(as, as+n, greater<int>());
      |                            ^~~
Language: C++

        #include<bits/stdc++.h>                                                                                                                
        using namespace std;
        long long a[200050],ai[200050];
        int main(){
            long long n;
            cin >> n;
            for(int i=0;i<n;i++){
                cin >> a[i];
                ai[i] = a[i];
            }   
         　　sort(a,a+n,greater<long long>());
            for(int i=0;i<n;i++){
                if(a[0]==ai[i]) cout << a[1] << '\n';
                else cout << a[0] << '\n';
            }   
         
            return 0;
        }

Compiler output:
a.cc:11:10: error: extended character 　 is not valid in an identifier
   11 |          　　sort(a,a+n,greater<long long>());
      |          ^
a.cc:11:10: error: extended character 　 is not valid in an identifier
a.cc: In function 'int main()':
a.cc:11:10: error: '\U00003000\U00003000sort' was not declared in this scope
   11 |          　　sort(a,a+n,greater<long long>());
      |          ^~~~~~~~
Language: Java

import java.util.*;

public class Main{
	public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
      	int n = scan.nextInt();
      	int[] a = new int[n];
      	for(int i = 0; i < n; i ++){
        	a[i] = scan.nextInt();
        }
      	for(int j = 0;j < n; j++){
          	int swap = a[j];
        	a[j] = 0;
          	Arrays.sort(a);
          	Sysmtem.out.print(a[n]);
          	a[j] = swap;
        }
    }
}

Compiler output:
Main.java:15: error: package Sysmtem does not exist
          	Sysmtem.out.print(a[n]);
          	       ^
1 error
Language: C++

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

int max(int num,int a[num],int j){
	int max=a[0];
	for(int i=1;i<num;i++){
		if(i==j)continue;
		if(max<a[i])max=a[i];
	}
	return max;
}
int main(){
	int num=0,a[200000]={};
	cin>>num;
	for(int i=0;i<num;i++){
		cin>>a[i];
	}
	for(int i=0;i<num;i++){
		cout<<max(num,a,i)<<endl;
	}
	return 0;
}


Compiler output:
a.cc:8:26: error: use of parameter outside function body before ']' token
    8 | int max(int num,int a[num],int j){
      |                          ^
a.cc:8:27: error: expected ')' before ',' token
    8 | int max(int num,int a[num],int j){
      |        ~                  ^
      |                           )
a.cc:8:28: error: expected unqualified-id before 'int'
    8 | int max(int num,int a[num],int j){
      |                            ^~~
Language: C++

    #include<bits/stdc++.h>                                                                                                                
    using namespace std;
    long long a[200050],ai[200050];
    int main(){
        long long n;
        cin >> n;
        for(int i=0;i<n;i++){
            cin >> a[i];
            ai[i] = a[i];
        }   
     　　sort(a,a+n,greater<long long>())
        for(int i=0;i<n;i++){
            if(a[0]==ai[i]) cout << a[1] << '\n';
            else cout << a[0] << '\n';
        }   
     
        return 0;
    }

Compiler output:
a.cc:11:6: error: extended character 　 is not valid in an identifier
   11 |      　　sort(a,a+n,greater<long long>())
      |      ^
a.cc:11:6: error: extended character 　 is not valid in an identifier
a.cc: In function 'int main()':
a.cc:11:6: error: '\U00003000\U00003000sort' was not declared in this scope
   11 |      　　sort(a,a+n,greater<long long>())
      |      ^~~~~~~~
a.cc:12:21: error: 'i' was not declared in this scope
   12 |         for(int i=0;i<n;i++){
      |                     ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;++i){
    cin>>a[i];
    b[i]=a[i];
  }
  sort(a,a+n);
  int lar=a[n-1], slar=a[n-2];
  for(int i=0;i<n;++i){
  if(b[i]==lar) cout<<slar<<'\n';
    else cout<<lar<<'\n';
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: 'b' was not declared in this scope
   10 |     b[i]=a[i];
      |     ^
a.cc:15:6: error: 'b' was not declared in this scope
   15 |   if(b[i]==lar) cout<<slar<<'\n';
      |      ^
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map>
#include <map>
#include <numeric>
#include <limits>
#include <utility>
#include <queue>
#include <random>
#include <bitset>
#include <memory>
#include <complex>
#include<fstream>
using namespace std;
typedef long long LL;

int main(void)
{
	LL n;
	cin >>n;
	vector<LL> a(n);
	vector<LL> b(n);
	for (LL i = 0; i < n; i++) {
		cin >>a[i];
		b[i]=a[i];
	}

	sort(b.begin(),b.end(),greater<LL>());
	

	for (LL i = 0; i < n; i++) {
		if (a[i] == b[0]) {
			cout <<b[1]<<endl;
		}
		else {
			cout <<b[o]<<endl;
		}
	}


	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:34: error: 'o' was not declared in this scope
   41 |                         cout <<b[o]<<endl;
      |                                  ^