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

#include <iostream>
using namespace std;

int main(){
  int n,c;
  int a=0,b=0;
  cin>>n;
  int s[n];
  for(int i=0;i<n;i++){
    cin>>s[i];
    if(a<s[i]){
      a = s[i];
      c=i;
    }
  }
  
  for(int k=0;k<n;k++){
    if(k==i) continue;
    else b=max(b,s[k]);
  }
  
  for(int j=0;j<n;j++){
    if(j!=i) cout<<a<<endl;
    else cout<<b<<endl;
  }
  return 0;
}
    
  
  
  


Compiler output:
a.cc: In function 'int main()':
a.cc:18:11: error: 'i' was not declared in this scope
   18 |     if(k==i) continue;
      |           ^
a.cc:23:11: error: 'i' was not declared in this scope
   23 |     if(j!=i) cout<<a<<endl;
      |           ^
Language: C++

n = int(input())
numbers = [int(input()) for i in range(n)]

for i in range(n):
    temporary_list = list(numbers)
    temporary_list.pop(i)
    print(max(temporary_list))

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

N = int(input())
numbers = [int(input()) for n in range(N)]

for n in range(N):
    temporary_list = list(numbers)
    temporary_list.pop(n)
    print(max(temporary_list))

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

#include <stdio.h>
 
int main(void)
{
  int N, i1 = -1, m1 = 0, m2 = 0;
  scanf("%d", &N);
  for(int i = 0; i < N; i++){
    int A;
    scanf("%d", &A);
    if(m1 < A){
        i1 = i;
        m1 = A;
    } else if(m2 < A)
        m2 = A;
  }
  for(int i = 0; i < N; i++)
    printf("%d\n", i == i1 ? m2 : m1);
  return 0;

Compiler output:
main.c: In function 'main':
main.c:18:3: error: expected declaration or statement at end of input
   18 |   return 0;
      |   ^~~~~~
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
 
void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}
 
int main(){
  ll N;
  cin>>N;
  vector<ll> A (200010);
  rep(i,N){
    cin>>A[i];
  }
  vector<ll> B (200010);
  rep(i,N){
    rep(j,N){
      if(i==j)
        B[j]=0;
      else
        B[j]=A[j];
    }
    
    sort(B.begin(),B.end());
    reverse(B.begin(),B.end());
    cout<<B[0]<<endl;
    }
  }
}

Compiler output:
a.cc:74:1: error: expected declaration before '}' token
   74 | }
      | ^
Language: C++

#include <iostream>
using namespace std;

int main(){
    int N, A[200010];
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }

    for(int i = 0; i < N; i++){
        int B[200010];
        for(int k = 0; k < N; k++){
            B[k] = A[k];
        }
        B[i] = 0;
        sort(B, B+N);
        cout << B[N-1] << endl;
    }
}

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

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

}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:28: error: expected ';' before ')' token
    7 |         for(int i=0;i<n,i++) cin >> a.at (i);
      |                            ^
      |                            ;
a.cc:9:28: error: expected ';' before ')' token
    9 |         for(int i=0;i<n,i++){
      |                            ^
      |                            ;
Language: C++

#include <stdio.h>
#include <stdlib.h>

int int_compare(const long* a, const long* b)
{
    if (*a < *b) {
        return 1;
    } else if (*a > *b) {
        return -1;
    }
    return 0;
}

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

    long* arr = calloc(n, sizeof(long));

    for (int i = 0; i < n; i++) {
        scanf("%ld", &arr[i]);
    }

    long* sorted = calloc(n, sizeof(long));

    for (int i = 0; i < n; i++) {
        sorted[i] = arr[i];
    }

    qsort(sorted, n, sizeof(long), (int (*)(const void*, const void*))(*int_compare));

    long max = sorted[0];
    long second_max = sorted[1];

    for (int i = 0; i < n; i++) {
        printf("%ld\n", arr[i] == max ? second_max : max);
    }

    free(arr);
    free(sorted);

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:23: error: invalid conversion from 'void*' to 'long int*' [-fpermissive]
   19 |     long* arr = calloc(n, sizeof(long));
      |                 ~~~~~~^~~~~~~~~~~~~~~~~
      |                       |
      |                       void*
a.cc:25:26: error: invalid conversion from 'void*' to 'long int*' [-fpermissive]
   25 |     long* sorted = calloc(n, sizeof(long));
      |                    ~~~~~~^~~~~~~~~~~~~~~~~
      |                          |
      |                          void*
Language: C++

package main

import (
	"fmt"
	"sort"
)

func main()  {
	var n int
	fmt.Scan(&n)
	a := make(pairs, n)
	for i := range a {
		fmt.Scan(&a[i].val)
		a[i].idx = i
	}
	sort.Sort(a)

	for i := range a {
		for j:=n-1;j>=0;j-- {
			if (i != a[j].idx) {
				fmt.Println(a[j].val)
				break
			}
		}
	}
}

type pair struct {
	idx int
	val int
}

type pairs []pair

func (p pairs) Len() int {
	return len(p)
}

func (p pairs) Less(i, j int) bool {
	return p[j].val > p[i].val
}

func (p pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}




Compiler output:
a.cc:1:1: error: 'package' does not name a type
    1 | package main
      | ^~~~~~~
a.cc:28:1: error: 'type' does not name a type; did you mean 'typeof'?
   28 | type pair struct {
      | ^~~~
      | typeof
a.cc:33:1: error: 'type' does not name a type; did you mean 'typeof'?
   33 | type pairs []pair
      | ^~~~
      | typeof
a.cc:39:6: error: expected constructor, destructor, or type conversion before '(' token
   39 | func (p pairs) Less(i, j int) bool {
      |      ^
a.cc:43:6: error: expected constructor, destructor, or type conversion before '(' token
   43 | func (p pairs) Swap(i, j int) {
      |      ^
Language: C++

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

int main()
{
	int N ;
        cin >> N;
 
	vector<int> a(N,0);
 
	int cnt;
	for (cnt = 0; cnt < N; cnt++)
	{
		cin >>a[cnt];
	}
 
        int max=a[0];
        int sec_max;
        for(cnt=1;cnt<N;cnt++)
        {
                if(a[cnt]>max)
                {
                         sec_max=max;
                         max=a[cnt];
                         
                }
                else if(a[cnt]==max)
                          sex_max=a[cnt];
         }
 
	for (cnt = 0; cnt < N; cnt++)
	{
if(a[cnt]<max)
		cout << max << endl;
else if(a[cnt]==max)
                cout<<sec_max<<endl;
	}
 
	return 0;
 
}
 

Compiler output:
a.cc: In function 'int main()':
a.cc:31:27: error: 'sex_max' was not declared in this scope; did you mean 'sec_max'?
   31 |                           sex_max=a[cnt];
      |                           ^~~~~~~
      |                           sec_max
Language: C++

#include<iostream>
#include<vector>
 
using namespace std;
 
int maximum(int N, vector<int>& vec, int nocnt);
 
int main()
{
	int N ;
        cin >> N;
 
	vector<int> a(N,0);
 
	int cnt;
	for (cnt = 0; cnt < N; cnt++)
	{
		cin >>a[cnt];
	}
 
        int max=a[0];
        int sec_max;
        for(cnt=1;cnt<N;cnt++)
        {
                if(a[cnt]>max)
                {
                         sec_max=max;
                         max=a[cnt];
                         
                }
                else if(a[cnt]==max)
                          sex_max=a[cnt];
         }
 
	for (cnt = 0; cnt < N; cnt++)
	{
if(a[cnt]<max)
		cout << max << endl;
else if(a[cnt]==max)
                cout<<sec_max<<endl;
	}
 
	return 0;
 
}
 


Compiler output:
a.cc: In function 'int main()':
a.cc:32:27: error: 'sex_max' was not declared in this scope; did you mean 'sec_max'?
   32 |                           sex_max=a[cnt];
      |                           ^~~~~~~
      |                           sec_max
Language: C++

#include<ibts/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int a[n];
  int max=1,smax=1;
  for(int i=0;i<n;i++){
    cin << a[i];
    if(i>max){
      max=a[i];
      smax=max;
    }
  }
  for(int i=0;i<n;i++){
    if(a[i]!=max){
      printf("%d",smax);
    }
    else{
      printf("%d",max);
    }
  }
}
    

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

#include <iostream>
#include <algorithm>
#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];
    }

    int max_value = *max_element(A.begin(), A.end());
    int max_index = *max_index(A.begin(), A.end());
    A[max_index] = 0;
    int smax_value = *max_element(A.begin(), A.end());
    int smax_index = *max_index(A.begin(), A.end());
    A[max_index] = max_value;

    for (int i = 0; i < N;i++){
        if(A[i] == max_value){
            cout << smax_value << endl;
        }else{
        cout << max_value << endl;
        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:31: error: 'max_index' cannot be used as a function
   15 |     int max_index = *max_index(A.begin(), A.end());
      |                      ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
a.cc:18:32: error: 'max_index' cannot be used as a function
   18 |     int smax_index = *max_index(A.begin(), A.end());
      |                       ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <algorithm>
#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];
    }
    
    for (int i = 0; i < N;i++){
        int tmp = A[i];
        A[i] = 0;
        int max = *max_element(B.begin(), B.end());
        cout << max << endl;
        A[i] = tmp;
    }
    return 0;
}

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

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

Compiler output:
main.c: In function 'main':
main.c:15:10: error: 'i' undeclared (first use in this function)
   15 |     if(a[i]==max1)      printf("%d\n",max2);
      |          ^
main.c:15:10: note: each undeclared identifier is reported only once for each function it appears in
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>::iterator maxIt = max_element(A.begin(), A.end());
  int maxIndex = distance(A.begin(),maxIt);
  int max = A[maxIndex];
  for(int i = 0; i < N; i++){
    if(i != maxIndex) cout << max << endl;
    else{
      int max2 = 0;
      for(int j = 0; j < N; j++){
        if(j == i) continue;
        else if(A[j] > max2)max2 = A[j];
      }
      cout << max2 << endl;
    }
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:33: error: 'max_element' was not declared in this scope
   13 |   vector<int>::iterator maxIt = max_element(A.begin(), A.end());
      |                                 ^~~~~~~~~~~
Language: Java

import java.util.*;
class Main {
  public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
  	int n = sc.nextInt();
  	int[] arr = new int[n];
    int max = 0;
  	int sec = 0;
  	for(int i=0;i<n;i++) {
    	arr[i] = sc.nextInt();
    	if(arr[i] > max) {
        	sec = max;
          	max = arr[i];
        }
      	else if(arr[i] > sec){
      		sec = arr[i];
      	}
    }
  	for(int i=0;i<n;i++) {
    	if(a[i] == max) {
        	System.out.println(sec);
        }
      	else System.out.println(max);
    }
  }
}


Compiler output:
Main.java:20: error: cannot find symbol
    	if(a[i] == max) {
    	   ^
  symbol:   variable a
  location: class Main
1 error
Language: Java

import java.util.*;
class Main {
	Scanner sc = new Scanner(System.in);
  	int n = sc.nextInt();
  	int[] arr = new int[n];\
    int max = 0;
  	int sec = 0;
  	for(int i=0;i<n;i++) {
    	arr[i] = sc.nextInt();
    	if(arr[i] > max) {
        	sec = max;
          	max = arr[i];
        }
      	else if(arr[i] > sec){
      		sec = arr[i];
      	}
    }
  	for(int i=0;i<n;i++) {
    	if(a[i] == max) {
        	System.out.println(sec);
        }
      	else System.out.println(max);
    }
}

Compiler output:
Main.java:5: error: illegal character: '\'
  	int[] arr = new int[n];\
  	                       ^
Main.java:6: error: <identifier> expected
    int max = 0;
           ^
Main.java:8: error: illegal start of type
  	for(int i=0;i<n;i++) {
  	^
Main.java:8: error: > or ',' expected
  	for(int i=0;i<n;i++) {
  	               ^
Main.java:8: error: <identifier> expected
  	for(int i=0;i<n;i++) {
  	                 ^
Main.java:18: error: illegal start of type
  	for(int i=0;i<n;i++) {
  	^
Main.java:18: error: > or ',' expected
  	for(int i=0;i<n;i++) {
  	               ^
Main.java:18: error: <identifier> expected
  	for(int i=0;i<n;i++) {
  	                 ^
8 errors
Language: C++

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

int main() {
  int n;
  cin >> n;
  
  vector<int> a(n);
  rep(i,n) cin >> a.at(i);
  
  vector<int> s=a;
  sort(s.rbegin(), s.rend());
  rep(i,n){
    if (a.at(i) == s[0]) {
      cout << s[1] << endl;
      continue;
    }
    
    cout << s[0] << endl;
  }
}


Compiler output:
a.cc:2:2: error: invalid preprocessing directive #defien; did you mean #define?
    2 | #defien rep(i,n) for (int i=0; i<(n); i++)
      |  ^~~~~~
      |  define
a.cc: In function 'int main()':
a.cc:10:7: error: 'i' was not declared in this scope
   10 |   rep(i,n) cin >> a.at(i);
      |       ^
a.cc:10:3: error: 'rep' was not declared in this scope
   10 |   rep(i,n) cin >> a.at(i);
      |   ^~~
Language: C++

#include <bits/stdc++.h>

#define rep(i,n) for (int i=0; i<(n); i++)
#define repr(i,n) for (int i=(n)-1; i>=0; i--)

using namespace std;
using ll = long long;

int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  
  vector<int> L(n+1,-1e9) , R(n+1,-1e9);
  rep(i,n) L[i+1] = max(L[i].a[i]);
  repr(i,n) R[i] = max(R[i+1],a[i]);
  rep(i,n){
    cout << max(L[i], R[i+1]) << '\n';
    
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:30: error: request for member 'a' in 'L.std::vector<int>::operator[](((std::vector<int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   18 |   rep(i,n) L[i+1] = max(L[i].a[i]);
      |                              ^
Language: C++

#include <bits/stdc++.h>

#define rep(i,n) for (int i=0; i<(n); i++)
#define repr(i,n) for (int i=(n)-1; i>=0; i--)

using namespace std;
using ll = long long;

int main(){
  cin,tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  
  vector<int> L(n+1,-1e9) , R(n+1,-1e9);
  rep(i,n) L[i+1] = max(L[i].a[i]);
  repr(i,n) R[i] = max(R[i+1],a[i]);
  rep(i,n){
    cout << max(L[i], R[i+1]) << '\n';
    
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:11: error: cannot bind non-const lvalue reference of type 'std::nullptr_t&' to an rvalue of type 'std::nullptr_t'
   10 |   cin,tie(nullptr);
      |           ^~~~~~~
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
                 from /usr/include/c++/14/string:68,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/tuple:2791:19: note:   initializing argument 1 of 'constexpr std::tuple<_Elements& ...> std::tie(_Elements& ...) [with _Elements = {std::nullptr_t}]'
 2791 |     tie(_Elements&... __args) noexcept
      |         ~~~~~~~~~~^~~~~~~~~~
a.cc:18:30: error: request for member 'a' in 'L.std::vector<int>::operator[](((std::vector<int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   18 |   rep(i,n) L[i+1] = max(L[i].a[i]);
      |                              ^
Language: C++

#include <bits/stdc++.h>
#include <chrono>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define eps 1e-9
#define f first
#define s second
typedef long long ll;
using namespace std;
const int N = 2e5;

int a[N+1];


int main() {
  ios_base:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
  
  int n,m = -1;
  cin >> n;
  
  int arr[n];
  for (int i=0; i<n; i++){
    cin >> arr[i];
    a[arr[i]]++;
    m=max(m,arr[i]);
  }
  
  for (int i=0; i<n; i++){
    for (int j=m; j>=0; j--){
      if (a[j]>1||(arr[i]!=j&&a[j])){
        cout << j;
        break;
      }
    }
    cout << "\n';
  }
  return 0;
}



Compiler output:
a.cc:34:13: warning: missing terminating " character
   34 |     cout << "\n';
      |             ^
a.cc:34:13: error: missing terminating " character
   34 |     cout << "\n';
      |             ^~~~~
a.cc: In function 'int main()':
a.cc:35:3: error: expected primary-expression before '}' token
   35 |   }
      |   ^
Language: C++

#include <bits/stdc++.h>
#include <chrono>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define eps1e-9
#define f first
#define s second
typedef long long ll;
using namespace std;
const int N = 2e5;

int a[N+1];


int main() {
  ios_base:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
  
  int n,m = -1;
  cin >> n;
  
  int arr[n];
  for (int i=0; i<n; i++){
    cin >> arr[i];
    a[arr[i]]++;
    m=max(m,arr[i]);
  }
  
  for (int i=0; i<n; i++){
    for (int j=m; j>=0; j--){
      if (a[j]>1||(arr[i]!=j&&a[j])){
        cout << j;
        break;
      }
    }
    cout << "\n';
  }
  return 0;
}



Compiler output:
a.cc:4:9: warning: ISO C++11 requires whitespace after the macro name
    4 | #define eps1e-9
      |         ^~~~~
a.cc:34:13: warning: missing terminating " character
   34 |     cout << "\n';
      |             ^
a.cc:34:13: error: missing terminating " character
   34 |     cout << "\n';
      |             ^~~~~
a.cc: In function 'int main()':
a.cc:35:3: error: expected primary-expression before '}' token
   35 |   }
      |   ^
Language: C++

#include<bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef long double ld;

const ll mod = 1e9+7;
const ll mod1 = 998244353;

#define fill(a)  memset(a, 0, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back

void fastscan(ll &number)
{
	bool negative = false;
	register int c;
	number = 0;
	c = getchar();
	if (c=='-') 
	{
		negative = true;
		c = getchar();
	}
	for (; (c>47 && c<58); c=getchar())
		number = number *10 + c - 48;
	if (negative)
		number *= -1;
}

bool isprime(ll n)
{
    if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;

    for (ll i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return false;

    return true;
}

bool checkisTree(ll degree[],ll n) 
{
    ll deg_sum = 0; 
    for (ll i = 0; i < n; i++) 
        deg_sum += degree[i]; 
    return (2*(n-1) == deg_sum);
}

ll gcd(ll a, ll b) 
{
    
    if (b == 0)  return a;
    return gcd(b, a % b);

}
int main()
{
	cin.sync_with_stdio(0);
	cin.exceptions(cin.failbit);
	cin.tie(0);
	ll t=1;
	//cin>>t;
	while(t--)
	{
		ll n;
      	cin>>n;
      	ll arr[n], arr1[n];
      	for(ll i=0; i<n; i++)
        {
          cin>>arr[i]; 
          arr1[i] = arr[i];
        }
      	sort(arr1,arr1+n);
      	for(ll i=0; i<n; i++)
        {
          if(arr1[n-1]!=arr[i];
             cout<<arr1[n-1]<<"\n";
          else
             cout<<arr1[n-2]<<"\n";
        }
	}
	
}

Compiler output:
a.cc: In function 'void fastscan(ll&)':
a.cc:20:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   20 |         register int c;
      |                      ^
a.cc: In function 'int main()':
a.cc:83:35: error: expected ')' before ';' token
   83 |              cout<<arr1[n-1]<<"\n";
      |                                   ^
      |                                   )
a.cc:82:13: note: to match this '('
   82 |           if(arr1[n-1]!=arr[i];
      |             ^
Language: C++

#include<bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef long double ld;

const ll mod = 1e9+7;
const ll mod1 = 998244353;

#define fill(a)  memset(a, 0, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back

void fastscan(ll &number)
{
	bool negative = false;
	register int c;
	number = 0;
	c = getchar();
	if (c=='-') 
	{
		negative = true;
		c = getchar();
	}
	for (; (c>47 && c<58); c=getchar())
		number = number *10 + c - 48;
	if (negative)
		number *= -1;
}

bool isprime(ll n)
{
    if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;

    for (ll i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return false;

    return true;
}

bool checkisTree(ll degree[],ll n) 
{
    ll deg_sum = 0; 
    for (ll i = 0; i < n; i++) 
        deg_sum += degree[i]; 
    return (2*(n-1) == deg_sum);
}

ll gcd(ll a, ll b) 
{
    
    if (b == 0)  return a;
    return gcd(b, a % b);

}
int main()
{
	cin.sync_with_stdio(0);
	cin.exceptions(cin.failbit);
	cin.tie(0);
	ll t=1;
	//cin>>t;
	while(t--)
	{
		ll n;
      	cin>>n;
      	ll arr[n], arr1[n];
      	for(ll i=0; i<n; i++)
        {
          cin>>arr[i]; 
          arr1[i] = arr[i];
        }
      	sort(arr1,arr1+n);
      	for(ll i=0; i<n; i++)
        {
          if(arr1[n-1]!=arr[i]
             cout<<arr[n-1]<<"\n";
          else
             cout<<arr[n-2]<<"\n";
        }
	}
	
}

Compiler output:
a.cc: In function 'void fastscan(ll&)':
a.cc:20:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   20 |         register int c;
      |                      ^
a.cc: In function 'int main()':
a.cc:82:31: error: expected ';' before 'cout'
   82 |           if(arr1[n-1]!=arr[i]
      |                               ^
      |                               ;
   83 |              cout<<arr[n-1]<<"\n";
      |              ~~~~              
a.cc:84:11: error: expected primary-expression before 'else'
   84 |           else
      |           ^~~~
a.cc:83:35: error: expected ')' before 'else'
   83 |              cout<<arr[n-1]<<"\n";
      |                                   ^
      |                                   )
   84 |           else
      |           ~~~~                     
a.cc:82:13: note: to match this '('
   82 |           if(arr1[n-1]!=arr[i]
      |             ^
Language: C++

#include<bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef long double ld;

const ll mod = 1e9+7;
const ll mod1 = 998244353;

#define fill(a)  memset(a, 0, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back

void fastscan(ll &number)
{
	bool negative = false;
	register int c;
	number = 0;
	c = getchar();
	if (c=='-') 
	{
		negative = true;
		c = getchar();
	}
	for (; (c>47 && c<58); c=getchar())
		number = number *10 + c - 48;
	if (negative)
		number *= -1;
}

bool isprime(ll n)
{
    if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;

    for (ll i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return false;

    return true;
}

bool checkisTree(ll degree[],ll n) 
{
    ll deg_sum = 0; 
    for (ll i = 0; i < n; i++) 
        deg_sum += degree[i]; 
    return (2*(n-1) == deg_sum);
}

ll gcd(ll a, ll b) 
{
    
    if (b == 0)  return a;
    return gcd(b, a % b);

}
int main()
{
	cin.sync_with_stdio(0);
	cin.exceptions(cin.failbit);
	cin.tie(0);
	ll t=1;
	//cin>>t;
	while(t--)
	{
		ll n;
      	cin>>n;
      	ll arr[n], arr1[n];
      	for(ll i=0; i<n; i++)
        {
          cin>>arr[i]; 
          arr1[i] = arr[i];
        }
      	sort(arr1,arr1+n);
      	for(ll i=0; i<n; i++)
        {
          if(arr1[n-1]!=arr[i]
             cout<<arr[n-1]<<"\n";
          else
             cout<<arr[n-2]<<"\n";
	}
	
}

Compiler output:
a.cc: In function 'void fastscan(ll&)':
a.cc:20:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   20 |         register int c;
      |                      ^
a.cc: In function 'int main()':
a.cc:82:31: error: expected ';' before 'cout'
   82 |           if(arr1[n-1]!=arr[i]
      |                               ^
      |                               ;
   83 |              cout<<arr[n-1]<<"\n";
      |              ~~~~              
a.cc:84:11: error: expected primary-expression before 'else'
   84 |           else
      |           ^~~~
a.cc:83:35: error: expected ')' before 'else'
   83 |              cout<<arr[n-1]<<"\n";
      |                                   ^
      |                                   )
   84 |           else
      |           ~~~~                     
a.cc:82:13: note: to match this '('
   82 |           if(arr1[n-1]!=arr[i]
      |             ^
a.cc:88:2: error: expected '}' at end of input
   88 | }
      |  ^
a.cc:63:1: note: to match this '{'
   63 | {
      | ^
Language: Java

import java.util.*;
public class Exception_handling{
	public static void main(String args[]) {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int A[]=new int[N];
		for(int i=0;i<N;i++) {
			A[i]=sc.nextInt();
		}
		sc.close();
		int high[]=new int[2];
		int highnum;
		high[0]=A[0];
		highnum=0;
		for(int j=1;j<N;j++) {
			if(high[0]<A[j]) {
				high[0]=A[j];
				highnum=j;
			}
		}
		if(high[0]!=A[0]) {
			high[1]=A[0];
		}else {
			high[1]=A[1];
		}
		for(int k=0;k<N;k++) {
			if(high[1]<A[k]&&highnum!=k) {
				high[1]=A[k];
			}
		}
		for(int l=0;l<N;l++) {
			if(l!=highnum) {
			System.out.println(high[0]);
			}else {
			System.out.println(high[1]);
			}
		}
	}
}

Compiler output:
Main.java:2: error: class Exception_handling is public, should be declared in a file named Exception_handling.java
public class Exception_handling{
       ^
1 error
Language: C++

#include<bits/stdc++.h>

using namespace std;
const int N = 2e5 + 5;

pair<int, int> a[N];
int n;
int ans[N];

int main()
{
  cin >> n;
  for (int i=0; i<n; i++) cin >> a[i].fi, a[i].se = i;
  sort(a,a+n);
  for (int i=0; i<n; i++)
  {
    if (i==n-1)
    {
      ans[a[i].se] = a[i-1].fi;
    }
    else 
    {
      ans[a[i].se] = a[n-1].fi;
    }
  }
  for (int i=0; i<n; i++) cout << ans[i] << '\n';
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:39: error: 'struct std::pair<int, int>' has no member named 'fi'
   13 |   for (int i=0; i<n; i++) cin >> a[i].fi, a[i].se = i;
      |                                       ^~
a.cc:13:48: error: 'struct std::pair<int, int>' has no member named 'se'
   13 |   for (int i=0; i<n; i++) cin >> a[i].fi, a[i].se = i;
      |                                                ^~
a.cc:19:16: error: 'struct std::pair<int, int>' has no member named 'se'
   19 |       ans[a[i].se] = a[i-1].fi;
      |                ^~
a.cc:19:29: error: 'struct std::pair<int, int>' has no member named 'fi'
   19 |       ans[a[i].se] = a[i-1].fi;
      |                             ^~
a.cc:23:16: error: 'struct std::pair<int, int>' has no member named 'se'
   23 |       ans[a[i].se] = a[n-1].fi;
      |                ^~
a.cc:23:29: error: 'struct std::pair<int, int>' has no member named 'fi'
   23 |       ans[a[i].se] = a[n-1].fi;
      |                             ^~
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
typedef unsigned long long ll;

int main()
{
  ll A,B,i,j; cin>>A;
  ll answer[A];for(i=0;i<A;i++)cin>>answer[i];
  ll maximum1 = max_element(answer,answer+A);
  ll maximum2=0;
  for(i=0;i<A;i++)
  {
    if(answer[i]>maximum2 && answer[i]<maximum1)
      maximum2 = answer[i];
  }
  for(i=0;i<A;i++)
  {
   if(answer[i]==maximum1){cout<<maximum2<<endl;}
   else{cout<<maximum1<<endl;}
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:28: error: invalid conversion from 'long long unsigned int*' to 'll' {aka 'long long unsigned int'} [-fpermissive]
   10 |   ll maximum1 = max_element(answer,answer+A);
      |                 ~~~~~~~~~~~^~~~~~~~~~~~~~~~~
      |                            |
      |                            long long unsigned int*
Language: Java







import java.util.Arrays;
import java.util.Scanner;

public class Main{
	
	//最大公約数・最小公倍数（セットで使う）
	public static long gcm(long a, long b) {
		long result = a;
		long k = 0;
		long n = b;
		do {
			k = result % n;
			result = n;
			n = k;
		} while(k != 0);
		return result;
	}
	
	public static long lcm(long a, long b) {
		long g;
		g = gcm(a, b);
		return a/g*b;
	}
	
	static long gcd (long a, long b) {
		long temp;
		while((temp = a%b)!=0) {
			a = b;
			b = temp;
		}
		return b;
	}



	//素数判定
	static boolean isPrime (int n) {
		if (n==2) return true;
		if (n<2 || n%2==0) return false;
		double d = Math.sqrt(n);
		for (int i=3; i<=d; i+=2) if(n%i==0){return false;}
		return true;
	}


	//倍数判定（10進数以外のときに有用）
	static boolean isMultiple (String s, int base, int m) {
		int temp = 0;
		for (int i=0; i<s.length(); i++) {
			temp = (temp*base+Character.getNumericValue(s.charAt(i)))%m;
		}
		if (temp==0) {return true;}
		return false;
	}


	//階乗
	static long factorial (int i) {
		if (i==1) {return 1;}
		else {return i*factorial(i-1);}
	}


	//進数変換
	static String toNbase (String sm, int m, int n) {
		return Long.toString(Long.parseLong(sm,m),n);
	}
	
	public static final long gcd_n(long[] param) {
	    final int len = param.length;
	    long g = gcd(param[0], param[1]);    //gcd(a, b) は以前作ったもの
	    for (int i = 1; i < len - 1; i++) {
	        g = gcd(g, param[i + 1]);       //gcd(a, b) は以前作ったもの
	    }
	    return g;
	}
	
	public static long lcm_n(long[] numbers) {
		long l;
		l = numbers[0];
		for (int i = 1; i < numbers.length; i++) {
			l = lcm(l, numbers[i]);
		}
		return l;
	}
	
	
 public static void main(String[] args) {
	 Scanner sc=new Scanner(System.in);
	 int N=sc.nextInt();
	 int[] A=new int[N];
	 int[] B=new int[N];
	 for(int i=0;i<N;i++){
		 A[i]=sc.nextInt();
		 B[i]=A[i];
	 }
	 Arrays.sort(B);
	 for(int i=0;i<N;i++){
		 if(A[i]==B[N-1]) {
			 System.out.println(B[N-2]);
		 }else {
			 System.out.println(B[N-1]);
		 }
	 }
	
	 
	 
	 
 }
	


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

/*
 * created   : 2019-07-24 23:40:47
 * accepted  : 2019-07-24 23:40:48
 * author    : landcold7
 */
#include <bits/stdc++.h>
using namespace std;

#define x first
#define y second
#define sz(x) ((int)(x).size())
#ifndef LOCAL
#define trace(...)
#endif
typedef long long ll;

void solve() {
  int n;
  cin >> n;
  vector<pair<int, int>> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i].x;
    a[i].y = i;
  }
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  trace(a);
  for (int i = 0; i < n; ++i) {
    if (i == a[0].y) {
      cout << a[1].x << "\n";

    else {
      cout << a[0].x << "\n";
    }
  }
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
  return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:32:5: error: expected '}' before 'else'
   32 |     else {
      |     ^~~~
a.cc:29:22: note: to match this '{'
   29 |     if (i == a[0].y) {
      |                      ^
Language: C++

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


Compiler output:
a.cc: In function 'int main()':
a.cc:28:37: error: expected ';' before ':' token
   28 |                 printf("%d\n",max_1):
      |                                     ^
      |                                     ;
Language: C++

#include<iostream>
using namespace std;
int main(){
  int i,N,A,Ist=0,Znd,Ino=0;
  cin >> N;
  for(i=0;i<N;i++){
    cin >> A;
    if(i==0){
      Ist=A;
      Znd=A;
    }
    if(A>=Ist){
      Znd=Ist;
      Ist=A;
      Ino=i;
    }else if(A<Ist && A>Znd){
      Znd=A;
    }else{
      continue;
  }
  for(i=0;i<N;i++){
    if(i==Ino){
      cout << Znd << endl;
    }else{
      cout << Ist << endl;
    }
  }
}

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

#include<iostream>
using namespace std;
int main(){
  int i,N,A,1st=0,2nd,1no=0;
  cin >> N;
  for(i=0;i<N;i++){
    cin >> A;
    if(i==0){
      1st=A;
      2nd=A;
    }
    if(A>=1st){
      2nd=1st;
      1st=A;
      1no=i;
    }
  }
  for(i=0;i<N;i++){
    if(i==1no){
      cout << 2nd << endl;
    }else{
      cout << 1st << endl;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:13: error: expected unqualified-id before numeric constant
    4 |   int i,N,A,1st=0,2nd,1no=0;
      |             ^~~
a.cc:9:7: error: unable to find numeric literal operator 'operator""st'
    9 |       1st=A;
      |       ^~~
a.cc:10:7: error: unable to find numeric literal operator 'operator""nd'
   10 |       2nd=A;
      |       ^~~
a.cc:12:11: error: unable to find numeric literal operator 'operator""st'
   12 |     if(A>=1st){
      |           ^~~
a.cc:13:7: error: unable to find numeric literal operator 'operator""nd'
   13 |       2nd=1st;
      |       ^~~
a.cc:13:11: error: unable to find numeric literal operator 'operator""st'
   13 |       2nd=1st;
      |           ^~~
a.cc:14:7: error: unable to find numeric literal operator 'operator""st'
   14 |       1st=A;
      |       ^~~
a.cc:15:7: error: unable to find numeric literal operator 'operator""no'
   15 |       1no=i;
      |       ^~~
a.cc:19:11: error: unable to find numeric literal operator 'operator""no'
   19 |     if(i==1no){
      |           ^~~
a.cc:20:15: error: unable to find numeric literal operator 'operator""nd'
   20 |       cout << 2nd << endl;
      |               ^~~
a.cc:22:15: error: unable to find numeric literal operator 'operator""st'
   22 |       cout << 1st << endl;
      |               ^~~
Language: C

//ヘッダファイル
#include<stdio.h>

//エントリポイント
int main(void)
{	
	int n;
	int a[200000]={};
	
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",a+i);
	}
	
	int first,fi;
	int second;
	
	if(a[0]>=a[1]){
		first=a[0];fi=0;
		second=a[1];
	}else{
		first=a[1];fi=1;
		second=a[0];
	}
	
	for(i=2;i<n;i++){
		if(a[i]>=first){
			second=first;
			first=a[i];fi=i;
		}else if(a[i]>=second){
			second=a[i];
		}
	}
	
	for(i=0;i<n-1;i++){
		printf("%d\n",i!=fi?first:second);
	}
	
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:26:13: error: 'i' undeclared (first use in this function); did you mean 'fi'?
   26 |         for(i=2;i<n;i++){
      |             ^
      |             fi
main.c:26:13: note: each undeclared identifier is reported only once for each function it appears in
Language: Java

import java.util.*;
public class Main{
  public static void main(String[] args){
    int n = sc.nextInt();
    ArrayList<Integer> arr = new ArrayList<Integer>();
    ArrayList<Integer> arr1 = new ArrayList<Integer>();
    for(int i=0;i<n;i++){
      int a = sc.nextInt();
      arr.add(a);
      arr1.add(a);
    }
    Collections.sort(arr);
    for(int i=0;i<n;i++){
      if(arr1.get(i)==arr.get(arr.size()-1)){
        System.out.println(arr.get(arr.size()-2));
                           }
      else{
        Ssystem.out.println(arr.get(arr.size()-1));
                            }
                            }
                            
                            }
                            }
                       

Compiler output:
Main.java:4: error: cannot find symbol
    int n = sc.nextInt();
            ^
  symbol:   variable sc
  location: class Main
Main.java:8: error: cannot find symbol
      int a = sc.nextInt();
              ^
  symbol:   variable sc
  location: class Main
Main.java:18: error: package Ssystem does not exist
        Ssystem.out.println(arr.get(arr.size()-1));
               ^
3 errors
Language: Java

import java.util.*;
public class Main{
  public static void main(String[] args){
    int n = sc.nextInt();
    ArrayList<Integer> arr = new ArrayList<Integer>();
    ArrayList<Integer> arr1 = new ArrayList<Integer>();
    for(int i=0;i<n;i++){
      int a = sc.nextInt();
      arr.add(a);
      arr1.add(a);
    }
    Collections.sort(arr);
    for(int i=0;i<n;i++){
      if(arr1.get(i)==arr.get(arr.size()-1){
        System.out.println(arr.get(arr.size()-2);
                           }
      else{
        Ssystem.out.println(arr.get(arr.size()-1);
                            }
                            }
                            
                            }
                            }
                            

Compiler output:
Main.java:14: error: ')' expected
      if(arr1.get(i)==arr.get(arr.size()-1){
                                           ^
Main.java:15: error: ')' or ',' expected
        System.out.println(arr.get(arr.size()-2);
                                                ^
Main.java:18: error: ')' or ',' expected
        Ssystem.out.println(arr.get(arr.size()-1);
                                                 ^
3 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e6+7;
int a[maxn];
int main()
{
  int N;
  scanf("%d",&N);
  for (int i=0;i<N;i++)
  {
    scanf("%d",a+i);
  }
  int _max = a[0];
  int _2max = a[0];
  int count_max = 0;
  for (int i=1;i<N;i++)
  {
    if (a[i]>_max) _max = a[i];
    else if (a[i]==max) count_max++;
    else{
      if (a[i]>_2max) _2max=a[i];
    }  
  }
  for (int i=0;i<N;i++)
  {
    if (a[i]==_max){
      if (count_max==0) printf("%d\n",_2max);
      else printf("%d\n",_max);
    }
    else printf("%d\n",_max)；
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:18: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator=='
   19 |     else if (a[i]==max) count_max++;
      |              ~~~~^~~~~
a.cc:30:29: error: expected ';' before '\U0000ff1b'
   30 |     else printf("%d\n",_max)；
      |                             ^~
      |                             ;
Language: C++

#include<iostream>
#include<vector>
#include<utility>

using namespace std;

typedef pair<int, int> pii;

int main(){
  int N;

  cin >> N;

  vector<pii>A(N);

  for(int i=0;i<N;i++){
    int t;
    cin >> t;
    A.at(i) = make_pair(t, i);
  }
  sort(A.begin(), A.end());
  reverse(A.begin(), A.end());


  for(int i=0;i<N;i++){
    if(i != A.at(0).second)  cout << A.at(0).first << endl;
    else cout << A.at(1).first << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   21 |   sort(A.begin(), A.end());
      |   ^~~~
      |   short
a.cc:22:3: error: 'reverse' was not declared in this scope
   22 |   reverse(A.begin(), A.end());
      |   ^~~~~~~
Language: Java

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int a[] = new int[n];
		int copy[] = new int[n];

		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
			copy[i] = a[i];
		}
		Arrays.sort(copy);

		for (int i = 0; i < n; i++) {
			int remove = a[i];

			if (remove == copy[n - 1]) {
				System.out.println(copy[n - 2]);
			} else {
				System.out.println(copy[n - 1]);
			}
		}
	}

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

#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int N, r;
	scanf("%d" &N);
	
	int A[N];
	int B[N];
	for(r=0; r<N; r++){
		scanf("%d", &B[r]);
		A[r] = B[r];
	}
	
	sort( A, A+N );
	
	for(r=0; r<N; r++){
		if(B[r] == A[N-1]) printf("%d\n", A[N-2]);
		else printf("%d\n", A[N-1]);
	}
	
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:20: error: invalid operands of types 'const char [3]' and 'int' to binary 'operator&'
    7 |         scanf("%d" &N);
      |               ~~~~ ^~
      |               |     |
      |               |     int
      |               const char [3]
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
	int N, r;
	scanf("%d" &N);
	
	int A[N];
	int B[N];
	for(r=0; r<N; r++){
		scanf("%d", &B[r]);
		A[r] = B[r];
	}
	
	sort( A, A+N );
	
	for(r=0; r<N; r++){
		if(B[r] == A[N-1]) printf("%d\n", A[N-2]);
		else printf("%d\n", A[N-1]);
	}
	
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:20: error: invalid operands of types 'const char [3]' and 'int' to binary 'operator&'
    6 |         scanf("%d" &N);
      |               ~~~~ ^~
      |               |     |
      |               |     int
      |               const char [3]
Language: C

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

	
		

Compiler output:
main.c: In function 'main':
main.c:31:17: error: implicit declaration of function 'print'; did you mean 'printf'? [-Wimplicit-function-declaration]
   31 |                 print("%d\n",a[i]);
      |                 ^~~~~
      |                 printf
Language: C++

#include <bits/stdc++.h>
using namespace std;
    
int main(){
  int N; cin >> N;
  vector<int> a(N);
  priority_queue<int, vector<int>, greater<int>> pq;
  
   for(int i = 0; i < N; i++)
  pq.push(at(i));
     MAX = pq.top();
  pq.pop();
	second = pq.top();

 for(int i = 0; i < N; i++){
   if(a.at(i) == MAX)
   cout << MAX << endl;
   else if(a.at(i) != MAX)
     cout << second << endl;
   } 
 }

Compiler output:
a.cc: In function 'int main()':
a.cc:10:11: error: 'at' was not declared in this scope; did you mean 'a'?
   10 |   pq.push(at(i));
      |           ^~
      |           a
a.cc:11:6: error: 'MAX' was not declared in this scope
   11 |      MAX = pq.top();
      |      ^~~
a.cc:13:9: error: 'second' was not declared in this scope
   13 |         second = pq.top();
      |         ^~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
    
int main(){
  vector<int> a(N);
  int N; cin >> N;
  
  for(int i = 0; i < N; i++){
    cin >> a.at(i);
  }
  
  int MAX;
 for(int j = 0; j < N; j++){   
  for(int i = 0; i < N; i++){
    if(i == j)
      break;
    else if(i != j)
  MAX = max(MAX, a.at(i));
      }
   cout << MAX << endl;
 }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:17: error: 'N' was not declared in this scope
    5 |   vector<int> a(N);
      |                 ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
    
int main(){
  vector<int> a(N);
  int N, cin >> N;
  
  for(int i = 0; i < N; i++){
    cin >> a.at(i);
  }
  
  int MAX;
 for(int j = 0; j < N; j++){   
  for(int i = 0; i < N; i++){
    if(i == j)
      break;
    else if(i != j)
  MAX = max(MAX, a.at(i));
      }
   cout << MAX << endl;
 }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:17: error: 'N' was not declared in this scope
    5 |   vector<int> a(N);
      |                 ^
a.cc:6:14: error: expected initializer before '>>' token
    6 |   int N, cin >> N;
      |              ^~
Language: C++

#include <iostream>
using namespace std;
int main(void){
    int N;
    cin >> N;
    int A[N];
    int first = 0;
    int second = 0;
    for(int i = 0;i < N;i++){
        cin >> a[i];
        if(a[i] > first){
            first = a[i];
        }else if(a[i > second){
            second = a[i]
        }
    }
    
    for(int i = 0;i < N;i++){
        if(a[i] == first){
            cout << second << endl;
        }else{
            cout << first << endl;
        }
    }
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:16: error: 'a' was not declared in this scope
   10 |         cin >> a[i];
      |                ^
a.cc:13:30: error: expected ']' before ')' token
   13 |         }else if(a[i > second){
      |                              ^
      |                              ]
a.cc:19:12: error: 'a' was not declared in this scope
   19 |         if(a[i] == first){
      |            ^
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.at(i);
    }
    vector <int> B = A;
    sort(B.begin(), B.end());
    for(int i = 0; i < N; i++) {
        int j = N-1;
        if(A.at(i) == B.at(j)) {
            j--;
        }
        cout << B.at(j) << endl;
    }
}

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

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

int main() {

    int n, m1 = 0, m2;
    cin >> n;
    vector< int > v(n);
    for(int i = 0; i < n; i++) {
        cin >> v[i];
    }
    vector< int > t = v;
    sort(t.begin(), t.end());
    m1 = t[t.size() - 1], m2 = t[t.size() - 2];

    for(int i = 0; i < n; i++) {
        if(m1 == m2) {
            cout << m1 << endl;
        }
        else if(m1 == v[i]) {
            cout << m2 << endl;
        } else {
            cout << m1 << endl;
        }
    }
}


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

#include <iostream>
#include <vector>
using namespace std ;
int main(){
    int n, s;
    cin >> n ;
    s = n ;
    vector<int> a(n) ;
    vector<int> b(s) ;
    for(int i = 0;i < n; i++){
        cin >> a.at(i)  ;
        b.at(i) = a.at(i) ;

    }
    //二列！

    sort(a.begin(), a.end() );
    //そーと！！

    for(int i =0; i < n; i++){
        if(b.at(i) == a.at(n-1)){
        cout << a.at(n-2)  << endl ;
        }
        if(b.at(i) != a.at(n-1)){
            cout << a.at(n-1) << endl ;
        }
    }
    //出力！

    return 0;
}

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