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

#include<iostream>
#include<queue>

using namespace std;
int main(){
  int n;
  cin >> n;
  int a[n];
  int i;
  priority_que<int> b;
  for(i=0;i<n;i++){
    cin >> a[i];
    b.push(a[i]);
  }
  
  for(i=0;i<n;i++){
    if(b.top() == a[i]){
      int tmp = b.top();
      b.pop();
      cout << b.top();
      b.push(tmp);
    }else
      cout << b.top();
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: 'priority_que' was not declared in this scope
   10 |   priority_que<int> b;
      |   ^~~~~~~~~~~~
a.cc:10:16: error: expected primary-expression before 'int'
   10 |   priority_que<int> b;
      |                ^~~
a.cc:13:5: error: 'b' was not declared in this scope
   13 |     b.push(a[i]);
      |     ^
a.cc:17:8: error: 'b' was not declared in this scope
   17 |     if(b.top() == a[i]){
      |        ^
Language: C++

#include<iostream>
#include<queue>

using namespace std;
int main(){
  int n;
  cin >> n;
  int a[n];
  int i;
  priority_que<int> b;
  for(i=0;i<n;i++){
    cin >> a[i];
    b.push(a[i]);
  }
  
  for(i=0;i<n;i++){
    if(b.top() == a[i]){
      int tmp = b.top();
      b.pop();
      cout << b.top();
      b.push(tmp);
    }else
      cout << b.top();
  }
}
        
  
  
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: 'priority_que' was not declared in this scope
   10 |   priority_que<int> b;
      |   ^~~~~~~~~~~~
a.cc:10:16: error: expected primary-expression before 'int'
   10 |   priority_que<int> b;
      |                ^~~
a.cc:13:5: error: 'b' was not declared in this scope
   13 |     b.push(a[i]);
      |     ^
a.cc:17:8: error: 'b' was not declared in this scope
   17 |     if(b.top() == a[i]){
      |        ^
a.cc: At global scope:
a.cc:30:1: error: expected declaration before '}' token
   30 | }
      | ^
Language: C++

#include<iostream>
#include<queue>
#include<vector>
int main(){
  int n;
  std::cin >> n;
  int a[n];
  int i;
  std::priority_que<int> b;
  for(i=0;i<n;i++){
    cin >> a[i];
    b.push(a[i]);
  }
  
  for(i=0;i<n;i++){
    if(b.top() == a[i]){
      int tmp = b.top();
      b.pop();
      std::cout << b.top();
      b.push(tmp);
    }else
      std::cout << b.top();
  }
}
        
  
  
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:8: error: 'priority_que' is not a member of 'std'; did you mean 'priority_queue'?
    9 |   std::priority_que<int> b;
      |        ^~~~~~~~~~~~
      |        priority_queue
a.cc:9:21: error: expected primary-expression before 'int'
    9 |   std::priority_que<int> b;
      |                     ^~~
a.cc:11:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   11 |     cin >> a[i];
      |     ^~~
      |     std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:12:5: error: 'b' was not declared in this scope
   12 |     b.push(a[i]);
      |     ^
a.cc:16:8: error: 'b' was not declared in this scope
   16 |     if(b.top() == a[i]){
      |        ^
a.cc: At global scope:
a.cc:29:1: error: expected declaration before '}' token
   29 | }
      | ^
Language: C++

#include<iostream>
#include<queue>
using namespace std;
int main(){
  int n;
  cin >> n;
  int a[n];
  int i;
  priority_que<int> b;
  for(i=0;i<n;i++){
    cin >> a[i];
    b.push(a[i]);
  }
  
  for(i=0;i<n;i++){
    if(b.top() == a[i]){
      int tmp = b.top();
      b.pop();
      cout << b.top();
      b.push(tmp);
    }else
      cout << b.top();
  }
}
        
  
  
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: 'priority_que' was not declared in this scope
    9 |   priority_que<int> b;
      |   ^~~~~~~~~~~~
a.cc:9:16: error: expected primary-expression before 'int'
    9 |   priority_que<int> b;
      |                ^~~
a.cc:12:5: error: 'b' was not declared in this scope
   12 |     b.push(a[i]);
      |     ^
a.cc:16:8: error: 'b' was not declared in this scope
   16 |     if(b.top() == a[i]){
      |        ^
a.cc: At global scope:
a.cc:29:1: error: expected declaration before '}' token
   29 | }
      | ^
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int n;
  cin >> n;
  int a[n];
  int i;
  int b[n];
  for(i=0;i<n;i++){
    cin >> a[i];
    b[i] = a[i];
  }
  sort(b,b+n;greater<>());
  for(i=0;i<n;i++){
    if(b[0] == a[i]) cout << b[1];
    else cout << b[0];
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:13: error: expected ')' before ';' token
   14 |   sort(b,b+n;greater<>());
      |       ~     ^
      |             )
a.cc:14:25: error: expected ';' before ')' token
   14 |   sort(b,b+n;greater<>());
      |                         ^
      |                         ;
Language: C++

#include<stdio.h>
int main(void)
{
	long long int n,a[200010],m=0,ms=0,count=0;
	scanf("%lld", &n);
	for ( int i = 0; i < n; i++)
	{
		scanf("%d",&a[i]);
	}
	for ( int i = 0; i < n; i++)
	{
		if(i==0)m = a[i];
		if (m < a[i + 1])
		{
			m = a[i + 1];
		}
	}
	for ( int i = 0; i < n; i++)
	{
		if (ms <= a[i + 1] && !a[i + 1] == m)ms = a[i + 1];

	}
	for ( int i = 0; i < n; i++)
	{
		if (m == a[i])count++;
		if (count == 2)
		{
			ms = m;
		}
	
	for ( int i = 0; i < n; i++)
	{
		if (ms == m)printf("%d", ms);
		if (ms < m && a[i] == m)printf("%d", ms);
		if (!a[i] == m && ms < m) printf("%d", m);

	}
	return 0;
}






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

#include<stdio.h>
int main(void)
{
	long long int n,a[200010],m=0,ms=0,count=0;
	scanf("%lld", &n);
	for ( int i = 0; i < n; i++)
	{
		scanf("%d",&a[i]);
	}
	for ( int i = 0; i < n; i++)
	{
		if(i==0)m = a[i];
		if (m < a[i + 1])
		{
			m = a[i + 1];
		}
	}
	for ( int i = 0; i < n; i++)
	{
		if (ms <= a[i + 1] && !a[i + 1] == m)ms = a[i + 1];

	}
	for ( int i = 0; i < n; i++)
	{
		if (m == a[i])count++;
		if (count == 2)
		{
			ms = m;
			break;
		}
	
	for ( int i = 0; i < n; i++)
	{
		if (ms == m)printf("%d", ms);
		if (ms < m && a[i] == m)printf("%d", ms);
		if (!a[i] == m && ms < m) printf("%d", m);

	}
	return 0;
}






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

#include<stdio.h>
int main(void)
{
	long long int n,a[200010],m=0,ms=0,count=0;
	scanf("%lld", &n);
	for ( int i = 0; i < n; i++)
	{
		scanf("%lld",&a[i]);
	}
	for ( int i = 0; i < n; i++)
	{
		if(i==0)m = a[i];
		if (m < a[i + 1])
		{
			m = a[i + 1];
		}
	}
	for ( int i = 0; i < n; i++)
	{
		if (ms <= a[i + 1] && !a[i + 1] == m)ms = a[i + 1];

	}
	for ( int i = 0; i < n; i++)
	{
		if (m == a[i])count++;
		if (count == 2)
		{
			ms = m;
			break;
		}
	
	for (long long int i = 0; i < n; i++)
	{
		if (ms == m)printf("%lld", ms);
		if (ms < m && a[i] == m)printf("%lld", ms);
		if (!a[i] == m && ms < m) printf("%lld", m);

	}
	return 0;
}





  

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

#include<stdio.h>
int main(void)
{
	long long int n,a[200010],m=0,ms=0,count=0;
	scanf("%lld", &n);
	for (long long int i = 0; i < n; i++)
	{
		scanf("%lld",&a[i]);
	}
	for (long long int i = 0; i < n; i++)
	{
		if(i==0)m = a[i];
		if (m < a[i + 1])
		{
			m = a[i + 1];
		}
	}
	for (long long int i = 0; i < n; i++)
	{
		if (ms <= a[i + 1] && !a[i + 1] == m)ms = a[i + 1];

	}
	for (long long int i = 0; i < n; i++)
	{
		if (m == a[i])count++;
		if (count == 2)
		{
			ms = m;
			break;
		}
	
	for (long long int i = 0; i < n; i++)
	{
		if (ms == m)printf("%lld", ms);
		if (ms < m && a[i] == m)printf("%lld", ms);
		if (!a[i] == m && ms < m) printf("%lld", m);

	}
	return 0;
}






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

#include<stdio.h>
int main(void)
{
	long long int n,a[200010],m=0,ms=0,count=0;
	scanf("%lld", &n);
	for (long long int i = 0; i < n; i++)
	{
		scanf("%lld", a[i]);
	}
	for (long long int i = 0; i < n; i++)
	{
		if(i==0)m = a[i];
		if (m < a[i + 1])
		{
			m = a[i + 1];
		}
	}
	for (long long int i = 0; i < n; i++)
	{
		if (ms <= a[i + 1] && !a[i + 1] == m)ms = a[i + 1];

	}
	for (long long int i = 0; i < n; i++)
	{
		if (m == a[i])count++;
		if (count == 2)
		{
			ms = m;
			break;
		}
	
	for (long long int i = 0; i < n; i++)
	{
		if (ms == m)printf("%lld", ms);
		else
		{
			if (ms < m && a[i] == m)printf("%lld", ms);
		else
		{
			printf("%lld", m);
		}

	}
	return 0;
}






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

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

typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)

int main() {
  int n;
  int max=-1;
  int sbmax=-1;
  cin >> n;
  vector<int> vec(n);
  rep(i,n){
    cin >> vec[i];
    if (max < vec[i]){
      max=vec[i];
      sbmax=max;
  }
  rep(i,n){
    if (vec[i]==max) cout << sbmax << endl;
    else cout << max << endl;
  }
  
  return 0;
}


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

#include<cstdio>
int main(){
  cin >> n;
  int a[200000];
  int max_first = 0;
  int max_second = 0;
  int tmp = 0;
  for(int i=0; i<n; i++){
    cin >> a[i];
    if(max_first < a[i])
    	max_first = a[i];
    else if(max_first != a[i] && max_second < a[i])
      max_second = a[i];
  }
  
  for(int i=0; i<n; i++){
    if(i == tmp){
      cout << max_second;
    }
    else{
      cout << max_first;
    }
  }
  
 return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:3:3: error: 'cin' was not declared in this scope
    3 |   cin >> n;
      |   ^~~
a.cc:3:10: error: 'n' was not declared in this scope
    3 |   cin >> n;
      |          ^
a.cc:18:7: error: 'cout' was not declared in this scope
   18 |       cout << max_second;
      |       ^~~~
a.cc:21:7: error: 'cout' was not declared in this scope
   21 |       cout << max_first;
      |       ^~~~
Language: C++

#include<cstdio>
#include<math>
int main(){
  cin >> n;
  int a[200000];
  int max_first = 0;
  int max_second = 0;
  int tmp = 0;
  for(int i=0; i<n; i++){
    cin >> a[i];
    if(max_first < a[i])
    	max_first = a[i];
    else if(max_first != a[i] && max_second < a[i])
      max_second = a[i];
  }
  
  for(int i=0; i<n; i++){
    if(i == tmp){
      cout << max_second;
    }
    else{
      cout << max_first;
    }
  }
  
 return 0;
}

Compiler output:
a.cc:2:9: fatal error: math: No such file or directory
    2 | #include<math>
      |         ^~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 9999999999999999;
using ll = long long;
int main(){
  int N;
  cin>>N;
  int a[N];
  int saidai = 0;
  int saidai2 = 0;
  for(int i = 0;i>N;i++){
    cin>>a[i];
    saidai = max(saidai,a[i]);
  }
  int saidaiko = 0;
  for(int i = 0;i<N;i++){
    if(a[i] == saidai){
      saidaiko++;
    }
  }
  if(saidaiko > 1){
    for(int i = 0;i<N;i++){
      cout << saidai << endl;
    }
    return 0
  }
  else{
    for(int i = 0;i<N;i++){
      if(a[i] != saidai){
        saidai2 = max(saidai2,a[i]);
      }
    }
    for(int i = 0;i<N;i++){
      if(a[i] != saidai){
        cout << saidai << endl;
      }
      else{
        cout << saidai2 << endl;
      }
    }
  }
  return 0;
}
      
    

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

#include<iostream>
using namespace std;
int main(){
  int n, a[200000];
  int m1 = m2 = -1;
  for(int i=0; i<n; i++){
    cin >> a[i];
  	if (a[i] >= m1) {
		m2 = m1;
      	m1 = a[i];
    }else if(a[i] >= m2){
      	m2 = a[i];
    }
    for(int i=0; i<n; i++){
      if(a[i] == m1)cout << m2 << endl;
      else cout << m1 << endl;
    }
    return 0;
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:5:12: error: 'm2' was not declared in this scope; did you mean 'm1'?
    5 |   int m1 = m2 = -1;
      |            ^~
      |            m1
a.cc:19:4: error: expected '}' at end of input
   19 |   }
      |    ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
int main(){
  int N; std::cin >> N;
  std::vector<int>A(N),B;
  for(auto&e : A)
    std::cin >> e;
  B = A;
  std::sort(B.begin(),B.end(),std::greater<>());
  for(auto e : A){
    std:: cout << (e == B.front() ? B.at(1) : B.front()) << std:: endl;
  
}

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

#include<bits/stdc++.h>
int main(){
  int N; std::cin >> N;
  std::vector<int>A(N),B;
  for(auto&e : A)
    std::cin >> e;
  B = A;
  std::sort(B.begin(),B.end(),greater<>());
  for(auto e : A){
    std:: cout << (e == B.front() ? B.at(1) : B.front()) << std:: endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:31: error: 'greater' was not declared in this scope; did you mean 'std::greater'?
    8 |   std::sort(B.begin(),B.end(),greater<>());
      |                               ^~~~~~~
      |                               std::greater
In file included from /usr/include/c++/14/string:49,
                 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/bits/stl_function.h:353:12: note: 'std::greater' declared here
  353 |     struct greater;
      |            ^~~~~~~
a.cc:8:39: error: expected primary-expression before '>' token
    8 |   std::sort(B.begin(),B.end(),greater<>());
      |                                       ^
a.cc:8:41: error: expected primary-expression before ')' token
    8 |   std::sort(B.begin(),B.end(),greater<>());
      |                                         ^
a.cc:12:2: error: expected '}' at end of input
   12 | }
      |  ^
a.cc:2:11: note: to match this '{'
    2 | int main(){
      |           ^
Language: Java

import java.util.Scanner;

public class CP {
    
	public static void main(String[] args) {
		
        Scanner s = new Scanner (System.in);
        int n = s.nextInt();
        int[] a = new int[n];
        
        a[0] = s.nextInt();
        int max = a[0];
        int max2 = a[0];
        
        for (int i = 1; i < n; i ++) {
        	a[i] = s.nextInt();
        	if (a[i] > max) {
        		max2 = max;
        		max = a[i];
        	} else if (a[i] > max2 && a[i] < max)
        		max2 = a[i];
        }
        
        for (int i : a) {
        	if (i == max)
        		System.out.println(max2);
        	else
        		System.out.println(max);
        }
        
	}
}

Compiler output:
Main.java:3: error: class CP is public, should be declared in a file named CP.java
public class CP {
       ^
1 error
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[i];
  int B[N]=A;
  sort(A.begin(),A.end());
  int ans=A[N-1];
  int sub=A[N-2];
  for(int i=0;i<N;i++){
    if(B[i]==ans) cout<<sub<<endl;
    else cout<<ans<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:12: error: array must be initialized with a brace-enclosed initializer
    9 |   int B[N]=A;
      |            ^
Language: C++

#include<iostream>
#include<vector>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define ppb pop_back
#define INF 1e18
typedef long long ll;

using namespace std;

int main(int argc,char* argv[])
{
    int n;
    cin>>n;
    vector<int> a(n);
    rep(i,n)cin>>a[i];
    vector<int>sorted = a;
    sort(all(sorted),greater<int>());
    rep(i,n)
    {
        if(a[i] == sorted[0])
        {
            cout<<sorted[1]<<endl;
        }
        else
        {
            cout<<sorted[0]<<endl;
        }
    }
    return 0;
}

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

#include<iostream>
#include<vector>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define ppb pop_back
#define INF 1e18
typedef long long ll;

using namespace std;

int main(int argc,char* argv[])
{
    int n;
    cin>>n;
    vector<int> a(n);
    rep(i,n)cin>>a[i];
    vector<int>sorted = a;
    sort(all(sorted));
    rep(i,n)
    {
        if(a[i] == sorted[0])
        {
            cout<<sorted[1]<<endl;
        }
        else
        {
            cout<<sorted[0]<<endl;
        }
    }
    return 0;
}

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

#include<iostream>
#include<algorithm>

#define REP(i, n) for(int i = 0; i < n; i++)

using namespace std;

int main(){
    int n; cin >> n;
    int max_number = 0, second_max_number = 0;
    int index;

    REP(i, n){
        int x; cin >> x;
        if(!(max_number <= x)) second_max_number = max(second_max_numbe
        else{
            index = i;
            second_max_number = max_number;
            max_number = x;
        }
    }

    REP(i, n){
        if(index != i) cout << max_number << '\n';
        else cout << second_max_number << '\n';
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:56: error: 'second_max_numbe' was not declared in this scope; did you mean 'second_max_number'?
   15 |         if(!(max_number <= x)) second_max_number = max(second_max_numbe
      |                                                        ^~~~~~~~~~~~~~~~
      |                                                        second_max_number
Language: C++

#include<iostream>
#include<algorithm>

#define REP(i, n) for(int i = 0; i < n; i++)

using namespace std;

int main(){
    int n; cin >> n;
    int max_number = 0, second_max_number = 0;
    int index;

    REP(i, n){
        int x; cin >> x;
        if(max_number <= x){
            index = i;
            second_max_number = max_number;
            max_number = x;
        }else second_max_number = max(second_max_number, x);
    }

    REP(i, n){
        if(index != i) cout << max_number << '\n';
        else cout << second_max_number << '\n';
    }


Compiler output:
a.cc: In function 'int main()':
a.cc:25:6: error: expected '}' at end of input
   25 |     }
      |      ^
a.cc:8:11: note: to match this '{'
    8 | int main(){
      |           ^
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=0, nextmax=0,cnt=0;
	rep(i,n){
		if(max < a[i]){
			max = a[i];
			cnt = i;
		}
	}
	rep(i,n){
		if(i = cnt) continue;
		nextmax = max(nextmax, a[i]);
	}
	vector<int> ans(n);
	rep(i,n){
		if(i==cnt) ans[i]=nextmax;
		else ans[i]=max;
	}
	rep(i,n) cout << ans[i] << endl;
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:20:30: error: 'max' cannot be used as a function
   20 |                 nextmax = max(nextmax, a[i]);
      |                           ~~~^~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <queue>
#include <cmath>
#include <stack>
typedef long long ll;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define mod 1000000007
const long long INF = 1LL<<60;


int main(){	
	int N;
	cin >> N;
	vector<int> A(N);
	for(int i = 0; i < N; i++){
		cin >> A[i];
	}
	vector<int> ans(N);
	ans = A;
	sort(A.begin(),A.end());
	for(int i = 0; i < N; i++){
		if(ans[i] == max){
			cout << A[N-2] << endl;
		}else{
			cout << A[N-1] << endl;
		}

	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:27: error: invalid operands of types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} and '<unresolved overloaded function type>' to binary 'operator=='
   27 |                 if(ans[i] == max){
Language: C++

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

int int_len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}

int int_sum(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}






int ggcd(int a,int b)
{
 
  int r, tmp;
 
  
 
  /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
 
 
 
  return b;
}







int fac(int n){
  int m=1;
  while(n>=1) m*=n,n--;
  return m;
}

int vec_sum(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}
///////////////////////////
int main() {
  int n,count=0,ans=0;
  cin>>n;
  vector<int> v(n);
  rep(i,n) cin>>v[i];
  rep(i,n){
    if(v[i]>count){
      count=v[i];
      ans=i;
    }
  }
  sort(v.begin(),v.end());
  if(v[v.size()-1]==v[v.size()-2]){
    rep(i,n){
      cout<<v[v.size()-1]<<endl;
    }
  }else{
    rep(i,n){
      if(i==k){
        cout<<v[v.size()-2]<<endl;
      }else{
        cout<<v[v.size()-1]<<endl;
      }
    }
  }
  
  
  
}
///////////////////////////

Compiler output:
a.cc: In function 'int main()':
a.cc:87:13: error: 'k' was not declared in this scope
   87 |       if(i==k){
      |             ^
Language: C++

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

int int_len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}

int int_sum(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}






int ggcd(int a,int b)
{
 
  int r, tmp;
 
  
 
  /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
 
 
 
  return b;
}







int fac(int n){
  int m=1;
  while(n>=1) m*=n,n--;
  return m;
}

int vec_sum(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}
///////////////////////////
int main() {
  int n,count=0,ans=0;
  cin>>n;
  vector<int> v(n);
  rep(i,n) cin>>v[i];
  rep(i,n){
    if(v[i]>count){
      count=v[i];
      ans=i;
    }
  }
  sort(v.begin(),v.end());
  if(v[v.size()-1]==v[v.size()-2]){
    rep(i,n){
      cout<<v[v.size()-1]<<endl;
    }
  }else{
    rep(i,n){
      if(i=k){
        cout<<v[v.size()-2]<<endl;
      }else{
        cout<<v[v.size()-1]<<endl;
      }
    }
  }
  
  
  
}
///////////////////////////

Compiler output:
a.cc: In function 'int main()':
a.cc:87:12: error: 'k' was not declared in this scope
   87 |       if(i=k){
      |            ^
Language: C

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

#include <string> //C++
#include <iostream> //C++
#include <vector> //C++
#include <algorithm> //C++


using namespace std; //C++


// cin >>n;     scanf(入力)
// cout <<k;    printf(出力)
// cout <<k<<endl;   (kを出力して改行)
// string s="AAA";    s.size() =3(sのサイズ)
// vector <int> a;  配列a(サイズは0)
// a.push_back(10); 配列のサイズが一つ増えて一番後ろに10を代入
// A.pop_back();  最後の要素が消去される
// A.begin() 　配列Aの最初の要素　
// sort(A.begin(),A.end());  配列Aの最初の要素から最後の要素までを小さい順に並び替えてa[0]から代入していく
// reverse(A.begin(),A.end());  配列Aの最初の要素から最後の要素までを逆の順にしてa[0]から代入していく



int main()
{
	int N, a[200000],i,j;

	scanf("%d", &N);

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

	int max = 0;

	for (i = 0; i < N; i++) {

		if (a[i] > max) {
			max = a[i];
			j = i;
		}
	}

	int max2 = 0;

	for (i = 0; i < N; i++) {

		if (a[i] > max2 && i!=j) {
			max2 = a[i];
			
		}
	}


	for (i = 0; i < N; i++) {

		if (i == j) {
			cout<<max2;

		}else cout<<max;
	}

}











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

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>




int main()
{
	int N, a[200000],i,j;

	scanf("%d", &N);

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

	int max = 0;

	for (i = 0; i < N; i++) {

		if (a[i] > max) {
			max = a[i];
			j = i;
		}
	}

	int max2 = 0;

	for (i = 0; i < N; i++) {

		if (a[i] > max2 && i!=j) {
			max2 = a[i];
			
		}
	}


	for (i = 0; i < N; i++) {

		if (i == j) {
			printf("%d\n", max2);

		}else cout<< max;
	}

}







Compiler output:
main.c: In function 'main':
main.c:44:23: error: 'cout' undeclared (first use in this function)
   44 |                 }else cout<< max;
      |                       ^~~~
main.c:44:23: 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){
    //入力
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int[N];
        int max = 0;
        int second = 0;
        for(int i=0; i<N; i++){
            A[i] = sc.nextInt();
            if(A[max]<A[i]){
                max = i;
            }
            else if(A[max] = A[i]){
                second = i;
            }
            else if(A[second]<A[i]){
                second = i;
            }
        }
    //処理
        for (int i=0;i<N;i++){
            System.out.println((i==max)?A[second]:A[max]);
        }
        sc.close();

    }
}


Compiler output:
Main.java:16: error: incompatible types: int cannot be converted to boolean
            else if(A[max] = A[i]){
                           ^
1 error
Language: C++

using namespace std;

void solve() {
	int n; cin >> n;
	vector<int> A(n), B(n);
	rep(i, n) {
		scanf("%d", &A[i]);
		B[i] = A[i];
	}
	sort(B.begin(), B.end());
	int max_f = B[n - 1];
	int max_s = B[n - 2];
	rep(i, n) {
		if (A[i] == max_f) cout << max_s << endl;
		else cout << max_f << endl;
	}
}

int main(void) {
	solve();
	return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:4:16: error: 'cin' was not declared in this scope
    4 |         int n; cin >> n;
      |                ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:5:9: error: 'vector' was not declared in this scope
    5 |         vector<int> A(n), B(n);
      |         ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | using namespace std;
a.cc:5:16: error: expected primary-expression before 'int'
    5 |         vector<int> A(n), B(n);
      |                ^~~
a.cc:6:13: error: 'i' was not declared in this scope
    6 |         rep(i, n) {
      |             ^
a.cc:6:9: error: 'rep' was not declared in this scope
    6 |         rep(i, n) {
      |         ^~~
a.cc:10:14: error: 'B' was not declared in this scope
   10 |         sort(B.begin(), B.end());
      |              ^
a.cc:10:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   10 |         sort(B.begin(), B.end());
      |         ^~~~
      |         short
Language: C++

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n){
    cin >> a[i];
  }
  priority_queue<int> q;
  rep(i,n){
    rep(j,n){
      if(i!=j)
        q.push(a[j]);
      	cout << q.top() << endl;
      	while(!q.empty){
          q.pop();
        }
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:18: error: cannot convert 'std::priority_queue<int>::empty' from type 'bool (std::priority_queue<int>::)() const' to type 'bool'
   18 |         while(!q.empty){
      |                  ^~~~~
a.cc:18:18: error: in argument to unary !
   18 |         while(!q.empty){
      |                ~~^~~~~
Language: C++

int main() {
    int N, a = -1, b = -1;
    cin >> N;
    vector<int> A(N, 0), B(200000, 0);
    
    for (int i = 0; i < N; i++) cin >> A[i];
    for (int i = 0; i < N; i++) ++B[A[i]];
    for (int i = 200000; i > 0; i--) {
        if (B[i] > 0 && a < 0) {
            a = i;
        }
        else if (B[i] > 0 && a >= 0) {
            b = i; break;
        }
    }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:3:5: error: 'cin' was not declared in this scope
    3 |     cin >> N;
      |     ^~~
a.cc:4:5: error: 'vector' was not declared in this scope
    4 |     vector<int> A(N, 0), B(200000, 0);
      |     ^~~~~~
a.cc:4:12: error: expected primary-expression before 'int'
    4 |     vector<int> A(N, 0), B(200000, 0);
      |            ^~~
a.cc:6:40: error: 'A' was not declared in this scope
    6 |     for (int i = 0; i < N; i++) cin >> A[i];
      |                                        ^
a.cc:7:35: error: 'B' was not declared in this scope
    7 |     for (int i = 0; i < N; i++) ++B[A[i]];
      |                                   ^
a.cc:7:37: error: 'A' was not declared in this scope
    7 |     for (int i = 0; i < N; i++) ++B[A[i]];
      |                                     ^
a.cc:9:13: error: 'B' was not declared in this scope
    9 |         if (B[i] > 0 && a < 0) {
      |             ^
a.cc:18:13: error: 'A' was not declared in this scope
   18 |         if (A[i] != a)  cout << a << endl;
      |             ^
a.cc:18:25: error: 'cout' was not declared in this scope
   18 |         if (A[i] != a)  cout << a << endl;
      |                         ^~~~
a.cc:18:38: error: 'endl' was not declared in this scope
   18 |         if (A[i] != a)  cout << a << endl;
      |                                      ^~~~
a.cc:19:18: error: 'B' was not declared in this scope
   19 |         else if (B[a] > 1) cout << a << endl;
      |                  ^
a.cc:19:28: error: 'cout' was not declared in this scope
   19 |         else if (B[a] > 1) cout << a << endl;
      |                            ^~~~
a.cc:19:41: error: 'endl' was not declared in this scope
   19 |         else if (B[a] > 1) cout << a << endl;
      |                                         ^~~~
a.cc:20:14: error: 'cout' was not declared in this scope
   20 |         else cout << b << endl;
      |              ^~~~
a.cc:20:27: error: 'endl' was not declared in this scope
   20 |         else cout << b << endl;
      |                           ^~~~
Language: C++

#include <bits/stdc++>
#define 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[i];
  int h;h=0;
  vector<int> s=a;
  sort(s.begin(),s.end());
  reverse(s.begin(),s.end());
  rep(i,n){
    rep(j,n){
      h=max(h,a[j]);
    }
    if(h==a[i]){
      cout << s[1] << endl;
    }
    else{
      cout << h << endl;
    }
  }
}
  

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

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

int main () {
  int n; cin >> n;
  queue<int> q;
  for (int i=0;i<n;i++) {
    int x; cin >> x;
    q.push(x);
  }
  for (int i=0;i<n;i++) {
    int a = q.front();
    q.pop();
    priority_queue<int> p;
    p = q;
    cout << p.top() << endl;
    q.push(a);
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: no match for 'operator=' (operand types are 'std::priority_queue<int>' and 'std::queue<int>')
   15 |     p = q;
      |         ^
In file included from /usr/include/c++/14/queue:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:157,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_queue.h:496:11: note: candidate: 'std::priority_queue<int>& std::priority_queue<int>::operator=(const std::priority_queue<int>&)'
  496 |     class priority_queue
      |           ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:496:11: note:   no known conversion for argument 1 from 'std::queue<int>' to 'const std::priority_queue<int>&'
/usr/include/c++/14/bits/stl_queue.h:496:11: note: candidate: 'std::priority_queue<int>& std::priority_queue<int>::operator=(std::priority_queue<int>&&)'
/usr/include/c++/14/bits/stl_queue.h:496:11: note:   no known conversion for argument 1 from 'std::queue<int>' to 'std::priority_queue<int>&&'
Language: C++

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

int main () {
  int n; cin >> n;
  queue<int> q;
  for (int i=0;i<n;i++) {
    int x; cin >> x;
    q.pudh(x);
  }
  for (int i=0;i<n;i++) {
    int a = q.front();
    q.pop();
    priority_queue<int> p = q;
    cout << p.top() << endl;
    q.push(a);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:7: error: 'class std::queue<int>' has no member named 'pudh'; did you mean 'push'?
    9 |     q.pudh(x);
      |       ^~~~
      |       push
a.cc:14:29: error: conversion from 'std::queue<int>' to non-scalar type 'std::priority_queue<int>' requested
   14 |     priority_queue<int> p = q;
      |                             ^
a.cc:17:2: error: expected '}' at end of input
   17 | }
      |  ^
a.cc:4:13: note: to match this '{'
    4 | int main () {
      |             ^
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:13:31: error: expected ',' or ';' before '=' token
   13 |         vector<long long>s(n) = a(n);
      |                               ^
Language: C++

#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <set>
#include <map>

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define for_p(i, a, b) for(int i = a; i < b; i++)
#define for_m(i, a, b) for(int i = a - 1; i >= b; i--)

//a = s1.size();
//vector<string> s1;
//string s2 = accumulate( s1.begin(), s1.end(), string() );

using namespace std;

int main()
{
  int a = 0 , b = 0, c = 0, d = 0, e = 0, f = 0, g = 0;
  int i = 0, j = 0;
  double d1 = 0, d2 = 0, d3 = 0, d4 = 0, d5 = 0, d6 = 0;
  int a1[256], a2[512], a3[1024];
  char s1[200000], s2[200000], s3[200000];
  
  cin >> a;
  
  for(i = 0; i < a; i++){
    cin >> a1[i];
    if(a1[i] >= b){
      b = a1[i];
    }else(a1[i] >= c){
      c = a1[i];
    }
  }
  for(i = 0; i < a; i++){
    if(a1[i] == b){
      a2[d++] = i;
    }else if(a1[i] == c){
      a3[e++] = i;
    }
  }
  f = c;
  for(i = 0; i < a; i++){
    for(j = 0; j < d; j++){
      if(i != a2[j]){
        f = b;
        break;
      }
    }
    cout << f << endl;
  }
}

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

#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <set>
#include <map>

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define for_p(i, a, b) for(int i = a; i < b; i++)
#define for_m(i, a, b) for(int i = a - 1; i >= b; i--)

//a = s1.size();
//vector<string> s1;
//string s2 = accumulate( s1.begin(), s1.end(), string() );

using namespace std;

int main()
{
  int a = 0 , b = 0, c = 0, d = 0, e = 0, f = 0;
  int i = 0, j = 0;
  double d1 = 0, d2 = 0, d3 = 0, d4 = 0, d5 = 0, d6 = 0;
  int a1[256], a2[512], a3[1024];
  char s1[200000], s2[200000], s3[200000];
  
  cin >> a;
  
  for(i = 0; i < a; i++){
    cin >> a1[i];
  }
  for(i = 0; i < a; i++){
    if(a % 2 != 0){
      for(j = 0; j < a / 2; j++){
        if(i != j && b <= a1[j] || i != j && b<= a1[a - j]){
          if(a1[j] <= a1[a - j]){
            b = a1[a - j];
          }else{
            b = a1[j];
          }
        }
        if(a[j + 1] >= b){
          b = a1[j + 1];
        }
      }
    }else{        
      for(j = 0; j < a / 2; j++){
        if(i != j && b <= a1[j] || i != j && b<= a1[a - j]){
          if(a1[j] <= a1[a - j]){
            b = a1[a - j];
          }else{
            b = a1[j];
          }
        }
      }
    }
    cout << b << endl;
    b = 0;
  }                   
}


Compiler output:
a.cc: In function 'int main()':
a.cc:48:13: error: invalid types 'int[int]' for array subscript
   48 |         if(a[j + 1] >= b){
      |             ^
Language: C++

#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <set>
#include <map>

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define for_p(i, a, b) for(int i = a; i < b; i++)
#define for_m(i, a, b) for(int i = a - 1; i >= b; i--)

//a = s1.size();
//vector<string> s1;
//string s2 = accumulate( s1.begin(), s1.end(), string() );

using namespace std;

int main()
{
  int a = 0 , b = 0, c = 0, d = 0, e = 0, f = 0;
  int i = 0, j = 0;
  double d1 = 0, d2 = 0, d3 = 0, d4 = 0, d5 = 0, d6 = 0;
  int a1[256], a2[512], a3[1024];
  char s1[200000], s2[200000], s3[200000];
  
  cin >> a;
  
  for(i = 0; i < a; i++){
    cin >> a1[i];
  }
  for(i = 0; i < a; i++){
    for(j = 0; j < a / 2; j++){
      if((i != j && b <= a1[j])　|| (i != j && b<= a1[a - j])){
        b = a1[j];
      }
    }
    cout << b << endl;
    b = 0;
  }                   
}


Compiler output:
a.cc:40:32: error: extended character 　 is not valid in an identifier
   40 |       if((i != j && b <= a1[j])　|| (i != j && b<= a1[a - j])){
      |                                ^
a.cc: In function 'int main()':
a.cc:40:32: error: expected ')' before '\U00003000'
   40 |       if((i != j && b <= a1[j])　|| (i != j && b<= a1[a - j])){
      |         ~                      ^~
      |                                )
Language: C++

#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <set>
#include <map>

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define for_p(i, a, b) for(int i = a; i < b; i++)
#define for_m(i, a, b) for(int i = a - 1; i >= b; i--)

//a = s1.size();
//vector<string> s1;
//string s2 = accumulate( s1.begin(), s1.end(), string() );

using namespace std;

int main()
{
  int a = 0 , b = 0, c = 0, d = 0, e = 0, f = 0;
  int i = 0, j = 0;
  double d1 = 0, d2 = 0, d3 = 0, d4 = 0, d5 = 0, d6 = 0;
  int a1[256], a2[512], a3[1024];
  char s1[200000], s2[200000], s3[200000];
  
  cin >> a;
  
  for(i = 0; i < a; i++){
    cin >> a1[i];
  }
  for(i = 0; i < a; i++){
    for(j = 0; j < a / 2; j++){
      if((i != j && b <= a1[j])　|| (i != j && b<= a1[a - j]){
        b = a1[j];
      }
    }
    cout << b << endl;
    b = 0;
  }                   
}


Compiler output:
a.cc:40:32: error: extended character 　 is not valid in an identifier
   40 |       if((i != j && b <= a1[j])　|| (i != j && b<= a1[a - j]){
      |                                ^
a.cc: In function 'int main()':
a.cc:40:32: error: expected ')' before '\U00003000'
   40 |       if((i != j && b <= a1[j])　|| (i != j && b<= a1[a - j]){
      |         ~                      ^~
      |                                )
a.cc:43:5: error: expected primary-expression before '}' token
   43 |     }
      |     ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n;
    vector<int> vec(n);
    cin >> n;
    
    for (int i = 0; i < n; i++) {
        cin >> vec[i];
    }
    vec_sorted = vec;
 vector<int> vec_sorted = vec;
    sort(vec_sorted.rbegin(), vec_sorted.rend());
  
    for(int i = 0; i < n; i++) {
    int ans = vec_sorted[0];
    if (vec_sorted[0] == vec[i]) ans = vec_sorted[1];
    cout << ans << endl;
    }
    return 0;
}

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

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

int main() {
  int n,ans=0; cin>>n;
  vector<int> a(n); vector<int> b(n);
  rep(i,n) {
    cin>>a[i]; b[i]=a[i];
  }
  sort(b.begin(),b.end());
  rep(i,n) {
      if(a_max==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:15:10: error: 'a_max' was not declared in this scope
   15 |       if(a_max==a[i]) cout<<b[n-2]<<endl;
      |          ^~~~~
Language: C++

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

int n; vector<int> a(n);
int main() {
    rep(i,n) {
        a[i]=0; ans=0;
        rep(j,n-1) {
            ans=max(ans,a[j]);
        }
        cout<<ans<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
    9 |         a[i]=0; ans=0;
      |                 ^~~
      |                 abs
Language: C++

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

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  auto itr = A.begin();
  for(int n=0; n<N; n++){
    cin >> A.at(n);
  }
  vector<int> A_cpy(N);
  copy(A.begin(),A.end(),A_cpy.begin());
  sort(A_cpy.begin(),A_cpy.end());
  int max=A_cpy.at(N-1);
  int sec=A_cpy.at(N-2);
  for(int i=0; i<N; i++){
	if(A.at(i)==max){
      cout << sec << endl;
    }else{
      cout << max << endl;
    }
  }
  
}

Compiler output:
a.cc:2:1: error: 'include' does not name a type
    2 | include <bits/stdc++.h>
      | ^~~~~~~
Language: C++

#include<iostream>
#include<algorism>
using namespace std;
int main()
{
    int N;
    int a[N];
    int b[N];
  
    cin >> N;
  
  　for(int i = 0; i < N; i++) {
    	cin >> a[i];
    }
  　
  　for(int i = 0; i < N; i++) {
    	b[i] = a[i];
    }
    
    sort(a, a+N, greater<int>());
    max = a[0];
    max2 = a[1];
  
    for(int i = 0; i < N; i++) {
    	if(b[i] == max) cout << max2 << endl;
        else cout << max << endl;
    }
    return 0;
}




Compiler output:
a.cc:2:9: fatal error: algorism: No such file or directory
    2 | #include<algorism>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>

using namespace std;

int main(){

  int n;
  cin>>n;
  
  vector<int> v(n),temp(n);
  
  for(int i = 0; i < n ; i++) { cin>>v[i]; temp=v[i];}
  
  sort(v.begin(), v.end());
  
  for(int i =0 ; i < n; i++) {
    if(temp[i] != v[n-1]) cout<<v[n-1]<<endl;
    else cout<< v[n-2]<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:52: error: no match for 'operator=' (operand types are 'std::vector<int>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   12 |   for(int i = 0; i < n ; i++) { cin>>v[i]; temp=v[i];}
      |                                                    ^
In file included from /usr/include/c++/14/vector:72,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} to 'const std::vector<int>&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} to 'std::vector<int>&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} to 'std::initializer_list<int>'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
Language: C++

// abc134_c.cpp
#include <iostream>
#include <vector>

using namespace std;
int A[200000];
int N;
int main() {
	cin >> N;
	for (int i =0; i<N; i++){
		int a;
		cin >> a;
		A[i] = a;
	}

	int firstMax, secondMax;

	firstMax = 0;
	firstMin = 0;
	
	for ( int i = 1; i< N; i++){
		if (A[firstMax] < A[i]){
			firstMax = i;
		}
		if (A[firstMin] > A[i]){
			firstMin = i;
		}
	}
	A[firstMax] = A[firstMin];
	
	secondMax = 0;
	for ( int i = 1; i< N; i++){
		if (A[secondMax] < A[i]){
			secondMax = i;
		}
	}
	for(int i =0 ; i<N; i++){
		if(i != firstMax){
			cout << A[firstMax] << endl;
		}
		else{
			cout << A[secondMax] << endl;
		}
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:9: error: 'firstMin' was not declared in this scope; did you mean 'firstMax'?
   19 |         firstMin = 0;
      |         ^~~~~~~~
      |         firstMax