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

#include<iostream>
using namespace std;
const int maxn=200000+5;
int n,a[maxn],c[maxn],ans[maxn];
int main(){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
        c[i]=a[i];
    }
    /*for(int i=0;i<n;i++){
        cout<<clone[i]<<" ";
    }*/
    int temp;
    for(int i=0;i<n;i++){
        temp=c[i];
        c[i]=0;
        sort(c,c+n);
        cout<<c[n-1]<<endl;
        for(int j=0;j<n;j++){
            c[j]=a[j];
        }
        c[i]=temp;
    }
    return 0;
}

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

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

int		main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	int			n;
	int			max;
	int			second_max;
	cin >> n;
	vector<int>	A(n);
	vector<int>	B(n);

	/* rep(i, n) */
	/* 	cin >> A.at(i); */
	for (int &a : A)
		cin >> a
	B = A;
	sort(B.begin(), B.end(), greater<>());
	max = B.at(0);
	second_max = B.at(1);
	rep(i, n)
	{
		if (A.at(i) != max)
			cout << max << endl;
		else
			cout << second_max << endl;
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:25: error: expected ';' before 'B'
   21 |                 cin >> a
      |                         ^
      |                         ;
   22 |         B = A;
      |         ~
Language: C++

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

typedef unsigned long long ll;
#define Inf 1 << 20
#define MInf -(1 << 20)
 
#define rep(i,n) for(int i = 0;i < (int)(n);i++)
#define Rep(i,n,m) for(int i = (int)(n); i < (int)(m);i++)
#define rrep(i,n) for(int i = (int)(n - 1); i > -1;i--)
#define RRep(i,n,m) for(int i = (int)(n - 1); i > (int)(m);i--)
#define trav(a, x) for(auto& a : x)
 
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V))
#define REVERSE(V) reverse(ALL(V))
#define RSORT(V) SORT(V);REVERSE(V)
 
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define yes(n) cout << ((n) ? "yes" : "no") << endl;


int main()
{
   int N;
   cin >> N;
   vector<int> list(N);
   vector<int> list2(N);
   vector<int> list3(N);
   int max = 0;
   int second = 0;
   rep(i,N)
   {
       cin >> list.at(i);
       if(max < list.at(i))
       {
           max = list.at(i);
       }
   }
   RSORT(list);
   list2 = list;
   list3 = list;
   rep(i,N)
   {
       if(list2[i] == max)
       {
           list2.erase(list2.begin());
       }
   }
    int second = list2[0];
    rep(i,N)
    {
        if(max == list3[i])
        {
            cout << second << endl;
        }
        else
        {
            cout << max << endl;
        }
    }

}


Compiler output:
a.cc: In function 'int main()':
a.cc:51:9: error: redeclaration of 'int second'
   51 |     int second = list2[0];
      |         ^~~~~~
a.cc:32:8: note: 'int second' previously declared here
   32 |    int second = 0;
      |        ^~~~~~
Language: C++

#pragma GCC optimize("O3")
#pragma GCC target("sse4")

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

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T>
// using Tree =
//     tree<T, null_type, less<T>, rb_tree_tag,
//     tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;  // check the limits, dummy

void Main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int N;
  cin >> N;
  // cout << N << '\n';

  vi v;
  vi v1;
  int n;
  F0R(i, N) {
    cin >> n;
    v.push_back(n);
  }
  v1 = v;

  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());

  F0R(i, N) {
    if (v1[i] == v[0]) {
      cout << v[1] << '\n';
    } else {
      cout << v[0] << '\n';
    }
  }
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
}

Compiler output:
In file included from /usr/include/c++/14/string:43,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:4:
/usr/include/c++/14/bits/allocator.h: In destructor 'std::_Vector_base<int, std::allocator<int> >::_Vector_impl::~_Vector_impl()':
/usr/include/c++/14/bits/allocator.h:182:7: error: inlining failed in call to 'always_inline' 'std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = int]': target specific option mismatch
  182 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53:
/usr/include/c++/14/bits/stl_vector.h:132:14: note: called from here
  132 |       struct _Vector_impl
      |              ^~~~~~~~~~~~
Language: C++

#pragma GCC optimize("O3")
#pragma GCC target("sse4")

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

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T>
using Tree =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;  // check the limits, dummy

void Main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int N;
  cin >> N;
  // cout << N << '\n';

  vi v;
  vi v1;
  int n;
  F0R(i, N) {
    cin >> n;
    v.push_back(n);
  }
  v1 = v;

  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());

  F0R(i, N) {
    if (v1[i] == v[0]) {
      cout << v[1] << '\n';
    } else {
      cout << v[0] << '\n';
    }
  }
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
}

Compiler output:
In file included from /usr/include/c++/14/string:43,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:4:
/usr/include/c++/14/bits/allocator.h: In destructor 'std::_Vector_base<int, std::allocator<int> >::_Vector_impl::~_Vector_impl()':
/usr/include/c++/14/bits/allocator.h:182:7: error: inlining failed in call to 'always_inline' 'std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = int]': target specific option mismatch
  182 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53:
/usr/include/c++/14/bits/stl_vector.h:132:14: note: called from here
  132 |       struct _Vector_impl
      |              ^~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(s,i, n) for (int i = (int)s; i < (int)(n); i++)
#define pb push_back
typedef long long ll;
  
int main(){
    ll n;
    cin>>n;
    ll ai;
    ll aii=0;
    ll max=0;
    vector<ll> k;
    rep(i,n){
        cin>>ai;
        k.pb(ai);
        if(ai>max){
            max=ai;
            aii=i;
        }
    }
    sort(k.begin(),k.end(),greater<ll>[]);

    rep(i,n){
        if(i!=aii)cout<<k[0]<<endl;
        else cout<<k[1]<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:39: error: expected primary-expression before '[' token
   23 |     sort(k.begin(),k.end(),greater<ll>[]);
      |                                       ^
a.cc:23:40: error: expected primary-expression before ']' token
   23 |     sort(k.begin(),k.end(),greater<ll>[]);
      |                                        ^
Language: Java

import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt;
    int[] seq = new int[n];
    int f = 0;
    int index = 0;
    int s = 0;
    for(int i = 0 ; i < n; i++){
      seq[i]= sc.nextInt();
      if(seq[i] >= f){
        s = f;
        f = seq[i];
        index = i;
      }
    }
    for(int i = 0; i < n; i++){
      if(i != index)System.out.println(f);
      else{System.out.println(s);}
    }
  }
}

Compiler output:
Main.java:5: error: cannot find symbol
    int n = sc.nextInt;
              ^
  symbol:   variable nextInt
  location: variable sc of type Scanner
1 error
Language: Java

import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextint;
    int[] seq = new int[n];
    int f = 0;
    int index = 0;
    int s = 0;
    for(int i = 0 ; i < n; i++){
      seq[i]= sc.nextInt();
      if(seq[i] >= f){
        s = f;
        f = seq[i];
        index = i;
      }
    }
    for(int i = 0; i < n; i++){
      if(i != index)System.out.println(f);
      else{System.out.println(s);}
    }
  }
}

Compiler output:
Main.java:5: error: cannot find symbol
    int n = sc.nextint;
              ^
  symbol:   variable nextint
  location: variable sc of type Scanner
1 error
Language: Java

import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextint;
    int[] seq = new int[n];
    int f = 0;
    int index = 0;
    int s = 0;
    for(int i = 0 ; i < n;; i++){
      seq[i]= sc.nextInt();
      if(seq[i] >= f){
        s = f;
        f = seq[i];
        index = i;
      }
    }
    for(int i = 0; i < n; i++){
      if(i != index)System.out.println(f);
      else{System.out.println(s);}
    }
  }
}

Compiler output:
Main.java:10: error: illegal start of expression
    for(int i = 0 ; i < n;; i++){
                          ^
Main.java:10: error: ';' expected
    for(int i = 0 ; i < n;; i++){
                               ^
2 errors
Language: C++

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


Compiler output:
a.cc: In function 'int main()':
a.cc:10:11: error: no match for call to '(std::vector<int>) (int&)'
   10 |     cin>>b(i);
      |          ~^~~
a.cc:11:6: error: no match for call to '(std::vector<int>) (int&)'
   11 |     c(i)=b(i);
      |     ~^~~
a.cc:11:11: error: no match for call to '(std::vector<int>) (int&)'
   11 |     c(i)=b(i);
      |          ~^~~
Language: C++

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin>>n;
  vector<int> A(n,0),B(n,0);
  rep(i,n){
    cin>>A.at(i);
    B.at(i)=A.at(i);
  }
  sort(B.begin(),B.end());
  int MAX=B.at(0);
  int MAXsecond=MAX;
  rep(i,n) (MAX==B.at(i))?:{MAXsecond=B.at(i);break;}
  rep(i,n)(A.at(i)==MAX)? cout<<submax<<endl :cout<<MAX<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:28: error: expected primary-expression before '{' token
   17 |   rep(i,n) (MAX==B.at(i))?:{MAXsecond=B.at(i);break;}
      |                            ^
a.cc:18:33: error: 'submax' was not declared in this scope
   18 |   rep(i,n)(A.at(i)==MAX)? cout<<submax<<endl :cout<<MAX<<endl;
      |                                 ^~~~~~
Language: C++

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin>>n;
  vector<int> A(n,0);
  rep(i,n) cin>>A.at(i);
  int max=0;
  rep(i,n) max=max(max,A.at(i));
  int submax=0;
  rep(i,n)(A.at(i)==max)?continue :submax=max(submax,A.at(i));
  rep(i,n)(A.at(i)==max)?cout<<max<<endl:cout<<submax<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:19: error: 'max' cannot be used as a function
   12 |   rep(i,n) max=max(max,A.at(i));
      |                ~~~^~~~~~~~~~~~~
a.cc:14:26: error: expected primary-expression before 'continue'
   14 |   rep(i,n)(A.at(i)==max)?continue :submax=max(submax,A.at(i));
      |                          ^~~~~~~~
a.cc:14:26: error: expected ':' before 'continue'
   14 |   rep(i,n)(A.at(i)==max)?continue :submax=max(submax,A.at(i));
      |                          ^~~~~~~~
      |                          :
a.cc:14:26: error: expected primary-expression before 'continue'
   14 |   rep(i,n)(A.at(i)==max)?continue :submax=max(submax,A.at(i));
      |                          ^~~~~~~~
Language: C++







 long long n;
 int maxi=0;
 int index;
 vector<int>vc;
 cin>>n;
multiset<int>ls;
 for(int i=0;i<n;i++) {
     cin >> arr[i];
    vc.push_back(arr[i]);
 }
 sort(vc.begin(),vc.end());
 int k=vc[vc.size()-1];
 int k2=vc[vc.size()-2];


for(int i=0;i<n;i++) {

if(arr[i]==k)cout<<k2<<endl;
else cout<<k<<endl;




}




    return 0;
}


Compiler output:
a.cc:9:6: warning: built-in function 'index' declared as non-function [-Wbuiltin-declaration-mismatch]
    9 |  int index;
      |      ^~~~~
a.cc:10:2: error: 'vector' does not name a type
   10 |  vector<int>vc;
      |  ^~~~~~
a.cc:11:2: error: 'cin' does not name a type
   11 |  cin>>n;
      |  ^~~
a.cc:12:1: error: 'multiset' does not name a type
   12 | multiset<int>ls;
      | ^~~~~~~~
a.cc:13:2: error: expected unqualified-id before 'for'
   13 |  for(int i=0;i<n;i++) {
      |  ^~~
a.cc:13:14: error: 'i' does not name a type
   13 |  for(int i=0;i<n;i++) {
      |              ^
a.cc:13:18: error: 'i' does not name a type
   13 |  for(int i=0;i<n;i++) {
      |                  ^
a.cc:17:6: error: expected constructor, destructor, or type conversion before '(' token
   17 |  sort(vc.begin(),vc.end());
      |      ^
a.cc:18:8: error: 'vc' was not declared in this scope
   18 |  int k=vc[vc.size()-1];
      |        ^~
a.cc:18:11: error: 'vc' was not declared in this scope
   18 |  int k=vc[vc.size()-1];
      |           ^~
a.cc:19:9: error: 'vc' was not declared in this scope
   19 |  int k2=vc[vc.size()-2];
      |         ^~
a.cc:19:12: error: 'vc' was not declared in this scope
   19 |  int k2=vc[vc.size()-2];
      |            ^~
a.cc:22:1: error: expected unqualified-id before 'for'
   22 | for(int i=0;i<n;i++) {
      | ^~~
a.cc:22:13: error: 'i' does not name a type
   22 | for(int i=0;i<n;i++) {
      |             ^
a.cc:22:17: error: 'i' does not name a type
   22 | for(int i=0;i<n;i++) {
      |                 ^
a.cc:35:5: error: expected unqualified-id before 'return'
   35 |     return 0;
      |     ^~~~~~
a.cc:36:1: error: expected declaration before '}' token
   36 | }
      | ^
Language: C++

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

int main() {
    int n;
    cin >> n;
    auto a = vector<int>(n);
    for (auto &a_i : a)
        cin >> a_i;
    const auto copy = a;
    a.insert(a.end(), copy.begin(), copy.end());

    for (int i = 0; i < n; i++) {
        cout << *max_element(a.begin() + (i + 1), a.begin() + (i + 1) + (n - 1)) << "\n";
    }

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:18: error: 'max_element' was not declared in this scope
   15 |         cout << *max_element(a.begin() + (i + 1), a.begin() + (i + 1) + (n - 1)) << "\n";
      |                  ^~~~~~~~~~~
Language: C++

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

   int main(){
      int N;
      cin >> N;
     vector <int> vec(N);
       vector <int> vec1(N);
       
     for(int i=0;i<N;i++){
       cin >> vec[i];
         vec1[i] = vec[i];
     }
       int max = *max_element(vec.begin(),vec.end());
       rep(i,N){
           if(vec1[i] == max){
               sort(vec.begin(),vec.end());
               cout << vec[N-2] << endl;
           }
           else cout << max << endl;
    }
   }


Compiler output:
a.cc: In function 'int main()':
a.cc:16:12: error: 'i' was not declared in this scope
   16 |        rep(i,N){
      |            ^
a.cc:16:8: error: 'rep' was not declared in this scope
   16 |        rep(i,N){
      |        ^~~
Language: C++

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

int main(){
   int N;
   cin >> N;
  vector <int> vec(N);
  for(int i=0;i<N;i++){
    cin >> vec[i];
  }
  for(int i=0;i<N;i++){
  if(
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:3: error: expected primary-expression before '}' token
   13 |   }
      |   ^
a.cc:12:6: error: expected ')' before '}' token
   12 |   if(
      |     ~^
      |      )
   13 |   }
      |   ~   
a.cc:13:3: error: expected primary-expression before '}' token
   13 |   }
      |   ^
Language: C++

/* C */

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

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

	int a;
	int k = 0;

	int max1 = 0, max2 = 0;

	for (int i = 0; i < n; ++i)
	{
		cin >> a;
		if(a => max1) max1 = a;
		if((a => max2) && (a < max1)){
			max2 = a;
			k = i;
		}
	}

	for (int i = 0; i < n; ++i)
	{
		if(i != k) cout << max1 << max1;
		else cout << max2 << endl;
	}

}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:23: error: expected primary-expression before '>' token
   21 |                 if(a => max1) max1 = a;
      |                       ^
a.cc:22:24: error: expected primary-expression before '>' token
   22 |                 if((a => max2) && (a < max1)){
      |                        ^
Language: C++

/* C */

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

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

	int a;
	int k = 0;

	int max1 = 0, max2 = 0;

	for (int i = 0; i < n; ++i)
	{
		cin >> a;
		if(a >= max1) max1 = a;
		if((a => max2) && (a < max1)){
			max2 = a;
			k = i;
		}
	}

	for (int i = 0; i < n; ++i)
	{
		if(i != k) cout << max1 << max1;
		else cout << max2 << endl;
	}

}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:24: error: expected primary-expression before '>' token
   22 |                 if((a => max2) && (a < max1)){
      |                        ^
Language: C++

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

int main() {
  int n, s, f;
  cin >> n;
  vector<int> v(n);
  priority_queue<int> pq;
  rep(i, n){
    cin >> v[i];
    pq.push(v[i]);
  }
  s = pq.front();
  pq.pop();
  f = pq.front();
  rep(i, n){
    if(v[i] == f) cout << s << endl;
    else cout << f << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:10: error: 'class std::priority_queue<int>' has no member named 'front'
   14 |   s = pq.front();
      |          ^~~~~
a.cc:16:10: error: 'class std::priority_queue<int>' has no member named 'front'
   16 |   f = pq.front();
      |          ^~~~~
Language: C++

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

int main() {
  int n;
  cin>>n;
  vector<pair(int p,int q)>a(n);
  for(int i=0;i<n;i++){
    int l;
    cin>>l;
    a.at(i)=make_pair(l,i);
  }
  sort(a.begin(),a.end());
  for(int i=0;i<n;i++){
    if(i==a.at(n-1).second){
      cout<<a.at(n-2).first<<endl;
    }
    else cout<<a.at(n-1).first<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:27: error: template argument 1 is invalid
    7 |   vector<pair(int p,int q)>a(n);
      |                           ^
a.cc:7:27: error: template argument 2 is invalid
a.cc:11:7: error: request for member 'at' in 'a', which is of non-class type 'int'
   11 |     a.at(i)=make_pair(l,i);
      |       ^~
a.cc:13:10: error: request for member 'begin' in 'a', which is of non-class type 'int'
   13 |   sort(a.begin(),a.end());
      |          ^~~~~
a.cc:13:20: error: request for member 'end' in 'a', which is of non-class type 'int'
   13 |   sort(a.begin(),a.end());
      |                    ^~~
a.cc:15:13: error: request for member 'at' in 'a', which is of non-class type 'int'
   15 |     if(i==a.at(n-1).second){
      |             ^~
a.cc:16:15: error: request for member 'at' in 'a', which is of non-class type 'int'
   16 |       cout<<a.at(n-2).first<<endl;
      |               ^~
a.cc:18:18: error: request for member 'at' in 'a', which is of non-class type 'int'
   18 |     else cout<<a.at(n-1).first<<endl;
      |                  ^~
Language: C++

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

int main() {
  int n;
  cin>>n;
  vector<pair(int,int)>a(n);
  for(int i=0;i<n;i++){
    int l;
    cin>>l;
    a.at(i)=make_pair(l,i);
  }
  sort(a.begin(),a.end());
  for(int i=0;i<n;i++){
    if(i==a.at(n-1).second){
      cout<<a.at(n-2).first<<endl;
    }
    else cout<<a.at(n-1).first<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:23: error: template argument 1 is invalid
    7 |   vector<pair(int,int)>a(n);
      |                       ^
a.cc:7:23: error: template argument 2 is invalid
a.cc:11:7: error: request for member 'at' in 'a', which is of non-class type 'int'
   11 |     a.at(i)=make_pair(l,i);
      |       ^~
a.cc:13:10: error: request for member 'begin' in 'a', which is of non-class type 'int'
   13 |   sort(a.begin(),a.end());
      |          ^~~~~
a.cc:13:20: error: request for member 'end' in 'a', which is of non-class type 'int'
   13 |   sort(a.begin(),a.end());
      |                    ^~~
a.cc:15:13: error: request for member 'at' in 'a', which is of non-class type 'int'
   15 |     if(i==a.at(n-1).second){
      |             ^~
a.cc:16:15: error: request for member 'at' in 'a', which is of non-class type 'int'
   16 |       cout<<a.at(n-2).first<<endl;
      |               ^~
a.cc:18:18: error: request for member 'at' in 'a', which is of non-class type 'int'
   18 |     else cout<<a.at(n-1).first<<endl;
      |                  ^~
Language: C++

#include <iostream>
#include <vector>

using namespace std;

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

    cin >> n;

    a.resize(n);
    aSorted.resize(n);

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

    sort(aSorted.begin(), aSorted.end(), greater<int>());

    int maxA = aSorted[0];
    int subMaxA = aSorted[1];

    for(int i = 0; i < n; ++i)
    {
        cout << (a[i] == maxA ? subMaxA : maxA) << endl;
    }
}

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

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


//// C
int main(){
    int n; cin >> n;
    vector<int> v(n);
    rep(i,n) cin >> v[i];
    vector<int>::iterator result;
    rep(i,n){
        int tmp = v[i];
        v[i] =0;
        result =max_element(v.begin(), v.end());
        cout << *result << endl;
        v[i] = tmp;
    }
}

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

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


//// C
int main(){
    int n; cin >> n;
    vector<int> v(n);
    rep(i,n) cin >> v[i];
    vector<int>::iterator result;
    rep(i,n){
        int tmp = v[i];
        v[i] =0;
        result =max_element(v.begin(), v.end());
        cout << *result << endl;
        v[i] = tmp;
    }
}

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

// ========================================================================================================
// Library
// ========================================================================================================
#define _CRT_SECURE_NO_WARNINGS

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

// competitive macro
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b) - 1; i >= (a); i--)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i ,n) for (int i = (n) - 1; i >= 0; i--)
#define LL long long
#define ULL unsigned long long

void fastIOS()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
}
// ========================================================================================================
// ========================================================================================================

int main()
{
	fastIOS();

    int n; cin >> n;
    int indexMax = -1;
    int max1 = INT_MIN , max2 = INT_MIN;
    
    for(int i = 0; i< n; i++)
    {
        int tmp; cin >> tmp;
        
        if(array[i] > max1)
        {
            max2 = max1;
            max1 = array[i];
            indexMax = i;
        }
        
        else if(array[i] > max2)
        {
            max2 = array[i];
        }
    }
    
    for(int i = 0; i< n; i++)
    {
        if(i != indexMax)
        {
            cout << max1 << endl;
        }
        else{
            cout << max2 << endl;
        }
    }
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:17: error: expected unqualified-id before '[' token
   37 |         if(array[i] > max1)
      |                 ^
a.cc:40:25: error: missing template arguments before '[' token
   40 |             max1 = array[i];
      |                         ^
a.cc:44:22: error: expected unqualified-id before '[' token
   44 |         else if(array[i] > max2)
      |                      ^
a.cc:46:25: error: missing template arguments before '[' token
   46 |             max2 = array[i];
      |                         ^
Language: C++

#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define INF 100000000
using namespace std;

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


Compiler output:
a.cc: In function 'int main()':
a.cc:11:37: error: no match for call to '(std::vector<int>) (int&)'
   11 |  for(int i=0; i<N; i++){cin>>A[i]; B(i)=A(i);}
      |                                    ~^~~
a.cc:11:42: error: no match for call to '(std::vector<int>) (int&)'
   11 |  for(int i=0; i<N; i++){cin>>A[i]; B(i)=A(i);}
      |                                         ~^~~
Language: C++

#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define INF 100000000
using namespace std;

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


Compiler output:
a.cc: In function 'int main()':
a.cc:11:37: error: no match for call to '(std::vector<int>) (int&)'
   11 |  for(int i=0; i<N; i++){cin>>A[i]; B(N)=A(N);}
      |                                    ~^~~
a.cc:11:42: error: no match for call to '(std::vector<int>) (int&)'
   11 |  for(int i=0; i<N; i++){cin>>A[i]; B(N)=A(N);}
      |                                         ~^~~
Language: C++

#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) REV(SORT(V)) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b?gcd(b,a%b):a;} //最小公倍数

// デフォルト変数定義
int n,m,a,b,c,x,y,z;
double d,e,f;
string s,t;
//

signed main() {
  RAPID;
  IN(n);
  Vi A(n);
  VIN(A)
  Vi maxAr(n);
  maxAr = A;
  RSORT(maxAr);
  REP(i,n){
    if(maxAr.at(0) == A.at(i)) OUT(maxAr.at(1));
    else OUT(maxAr.at(0));
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:21: error: invalid use of 'void'
   10 | #define SORT(V) sort(ALL(V)) //小さい方からソート
      |                     ^
a.cc:9:17: note: in definition of macro 'ALL'
    9 | #define ALL(V) (V).begin(),(V).end()
      |                 ^
a.cc:12:18: note: in expansion of macro 'REV'
   12 | #define RSORT(V) REV(SORT(V)) //大きい方からソート
      |                  ^~~
a.cc:12:22: note: in expansion of macro 'SORT'
   12 | #define RSORT(V) REV(SORT(V)) //大きい方からソート
      |                      ^~~~
a.cc:62:3: note: in expansion of macro 'RSORT'
   62 |   RSORT(maxAr);
      |   ^~~~~
a.cc:10:21: error: invalid use of 'void'
   10 | #define SORT(V) sort(ALL(V)) //小さい方からソート
      |                     ^
a.cc:9:29: note: in definition of macro 'ALL'
    9 | #define ALL(V) (V).begin(),(V).end()
      |                             ^
a.cc:12:18: note: in expansion of macro 'REV'
   12 | #define RSORT(V) REV(SORT(V)) //大きい方からソート
      |                  ^~~
a.cc:12:22: note: in expansion of macro 'SORT'
   12 | #define RSORT(V) REV(SORT(V)) //大きい方からソート
      |                      ^~~~
a.cc:62:3: note: in expansion of macro 'RSORT'
   62 |   RSORT(maxAr);
      |   ^~~~~
Language: Java

import java.util.*;
import java.math.*;

public class Main {

  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();
    }

    for (int i = 0; i < n; i++) {
      int count = 0;
      for (int j = 0; j < n; j++) {
        if (a[i] == a[j]) continue;
        max = Math.max(max,a[j]);
      }
      System.out.println(max);
    }

  }

}


Compiler output:
Main.java:19: error: cannot find symbol
        max = Math.max(max,a[j]);
        ^
  symbol:   variable max
  location: class Main
Main.java:19: error: cannot find symbol
        max = Math.max(max,a[j]);
                       ^
  symbol:   variable max
  location: class Main
Main.java:21: error: cannot find symbol
      System.out.println(max);
                         ^
  symbol:   variable max
  location: class Main
3 errors
Language: Java

import java.util.*;
import java.math.*;

public class Main {

  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();
    }

    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        if (a[i] == a[j]) continue;
        max = Math.max(max,a[j]);
      }
      System.out.println(max);
    }

  }

}


Compiler output:
Main.java:18: error: cannot find symbol
        max = Math.max(max,a[j]);
        ^
  symbol:   variable max
  location: class Main
Main.java:18: error: cannot find symbol
        max = Math.max(max,a[j]);
                       ^
  symbol:   variable max
  location: class Main
Main.java:20: error: cannot find symbol
      System.out.println(max);
                         ^
  symbol:   variable max
  location: class Main
3 errors
Language: C++

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


}


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

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

int a[200005];
int b[200005];

int main() {
  int n; cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i], b[i] = a[i];
  sort(b, b + i);
  for (int i = 0; i < n; i++)
    cout << (a[i] != b[0] ? b[0] : b[1]) << endl;
}

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

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

int main() {
  long long N;
  cin >> N;
  vector<long long> vec(N);
  for (long long i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  
  sort(vec.begin(), vec.end());
  long long m1 = vec.at(N-1);
  long long m2 = vec.at(N-2);
  
  for (long long i = 0; i < N; i++) {
    if (vec.at(i) == m1) {
      cout << m2 << endl;
    }
    else {
      cout << m1 << ebdl;
    }
  }
  
  
}



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

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

int main() {
  long long N;
  cin >> N;
  vector<long long> vec(N);
  for (long long i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  
  sort.(vec.begin(),vec.end());
  long long m1 = vec.at(N-1);
  long long m2 = vec.at(N-2);
  
  for (long long i = 0; i < N; i++) {
    if (vec.at(i) == m1) {
      cout << m2 << endl;
    }
    else {
      cout << m1 << ebdl;
    }
  }
  
  
}



Compiler output:
a.cc: In function 'int main()':
a.cc:12:8: error: expected unqualified-id before '(' token
   12 |   sort.(vec.begin(),vec.end());
      |        ^
a.cc:21:21: error: 'ebdl' was not declared in this scope
   21 |       cout << m1 << ebdl;
      |                     ^~~~
Language: C++

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

int main() {
  long long N;
  cin >> N;
  vector<long long> v(N);
  for (long long i = 0; i < N; i++) {
    cin >> v.at(i);
  }
  
  sort.(v.begin(),v.end());
  long long m1 = v.at(N-1);
  long long m2 = v.at(N-2);
  
  for (long long i = 0; i < N; i++) {
    if (v.at(i) == m1) {
      cout << m2 << endl;
    }
    else {
      cout << m1 << ebdl;
    }
  }
  
  
}



Compiler output:
a.cc: In function 'int main()':
a.cc:12:8: error: expected unqualified-id before '(' token
   12 |   sort.(v.begin(),v.end());
      |        ^
a.cc:21:21: error: 'ebdl' was not declared in this scope
   21 |       cout << m1 << ebdl;
      |                     ^~~~
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);
  
  vector<int> ans(N);
  
  for (int i = 0; i < N; i++) {
    int tmp = A.at(i);
    A.at(i) = 0;
    ans.at(i) = *max_element(A.begin(), A.end());
    A.at(i) = tmp;
  }
  
  for (int i = 0; i < N; i++) cout << ans.at(i);
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:7:10: error: 'int\U0000ff1e' was not declared in this scope
    7 |   vector<int＞ A(N);
      |          ^~~~~
a.cc:7:19: error: template argument 1 is invalid
    7 |   vector<int＞ A(N);
      |                   ^
a.cc:7:19: error: template argument 2 is invalid
a.cc:8:38: error: 'A' was not declared in this scope
    8 |   for (int i = 0; i < N; i++) cin >> A.at(i);
      |                                      ^
a.cc:13:15: error: 'A' was not declared in this scope
   13 |     int tmp = A.at(i);
      |               ^
Language: C++

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

int main(){
  int N;
  cin>>N;
  vector<int> A(N);
  int max1=0;
  int ind;
  for(int i=0;i<N;++i){
    cin>>A.at(i);
    if(A.at(i)>max1){
      max1=A.at(i);
      ind=i;
    }
  }

  int max2=0;
  for(int i=0;i<N;++i){
    if(A.at(i)!=max1 && A.at(i)>max2){
      max2=A.at(i);
    }
  }

  int count;
  for(int i=0;i<N;++i){
    if(A.at(i)==max1){
      ++count;
    }
  }

  if(count>1){
    for(int i=0;i<N;++i){
      cout<<max1<<endl;
    }
  }
  else{
    for(int i=0;i<N;++i){
      if(i==ind){
        cout<<max2<<endl;
      }
      else{
        cout<<max1<<endl;
      }
    }
  }


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

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

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = Integer.parseInt(scanner.next());

        Integer[][] A = new Integer[N][2];
        for (int i = 0; i < N; i++) {
            A[i][0] = i;
            A[i][1] = Integer.parseInt(scanner.next());
        }
        scanner.close();

        // 値の降順ソート
        Arrays.sort(A, (a, b) -> b[1] - a[1]);

        // 最大値のindexであれば index: 1, そうでなければ index: 0
        for (int i = 0; i < N; i++) {
            if (A[0][0] == i) {
                System.out.println(A[1][1]);
            } else {
                System.out.println(A[0][1]);
            }
        }

        for (int n : ans) {
            System.out.println(n);
        }
    }
}


Compiler output:
Main.java:29: error: cannot find symbol
        for (int n : ans) {
                     ^
  symbol:   variable ans
  location: class Main
1 error
Language: C++

#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
#define f first
#define s second
int a[200000]={0};
int main(){
int n,i,j;
pair<int,int> mx,sb;
mx.f=0;
sb.f=0;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&a[i]);
if(mx.f<=a[i]){
sb.f=mx.f;
sb.s=mx.s;
mx.f=a[i].f;
mx.s=i;
}
else if(sb.f<a[i]){
sb.f=a[i];
sb.s=i;
}
}
for(i=0;i<n;i++){
if(i!=mx.s)
printf("%d\n",mx.f);
else
printf("%d\n",sb.f);
}
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:11: error: request for member 'first' in 'a[i]', which is of non-class type 'int'
    5 | #define f first
      |           ^~~~~
a.cc:19:11: note: in expansion of macro 'f'
   19 | mx.f=a[i].f;
      |           ^
Language: C++

#include<stdio.h>
#include<iostream>
#include<algrithm>
using namespace std;
#define f first
#define s second
int a[200000]={0};
int main(){
int n,i,j;
pair<int,int> mx,sb;
mx.f=0;
sb.f=0;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&a[i]);
if(mx.f<=a[i]){
sb.f=mx.f;
sb.s=mx.s;
mx.f=a[i].f;
mx.s=i;
}
else if(sb.f<a[i]){
sb.f=a[i];
sb.s=i;
}
}
for(i=0;i<n;i++){
if(i!=mx.s)
printf("%d\n",mx.f);
else
printf("%d\n",sb.f);
}
return 0;
}


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

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

int main(){
  
  int N,tmp,z=0;
  cin>>N;
  
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin>>A[i];
  }
  for(int j=0;j<N;j++){
    swap(A[j],z);
    cout<<*max_element(A.begin(), A.end())<<endl;
    swap(A[j],z);
  }
  
  return 0;
}#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
  
  int N,tmp,z=0;
  cin>>N;
  
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin>>A[i];
  }
  for(int j=0;j<N;j++){
    swap(A[j],z);
    cout<<*max_element(A.begin(), A.end())<<endl;
    swap(A[j],z);
  }
  
  return 0;
}

Compiler output:
a.cc:22:2: error: stray '#' in program
   22 | }#include<iostream>
      |  ^
a.cc:22:3: error: 'include' does not name a type
   22 | }#include<iostream>
      |   ^~~~~~~
a.cc:27:5: error: redefinition of 'int main()'
   27 | int main(){
      |     ^~~~
a.cc:6:5: note: 'int main()' previously defined here
    6 | int main(){
      |     ^~~~
Language: C++

#include<stdio.h>
int a[1000010];
int main()
{
int n, x, y, cnt;
while (~scanf("%d",&n))
{
cnt = 0;
for(int i=0; i<n; i++)
scanf("%d",&a[i]);
x = y = a[0];
for(int i=1; i<n; i++)
{
if(a[i]>x)
{
y=x;
x=a[i];
}
else if(a[i]<x&&a[i]>y)
y=a[i];
}
for(int i=0; i<n; i++)
if(a[i]==x) cnt++;
for(int i=0; i<n; i++)
{
if(a[i]==x&&cnt==1) printf("%d\n,y);
else printf("%d\n",x);
}
//printf("\n");
}
return 0;
}

Compiler output:
a.cc:26:28: warning: missing terminating " character
   26 | if(a[i]==x&&cnt==1) printf("%d\n,y);
      |                            ^
a.cc:26:28: error: missing terminating " character
   26 | if(a[i]==x&&cnt==1) printf("%d\n,y);
      |                            ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:27:1: error: expected primary-expression before 'else'
   27 | else printf("%d\n",x);
      | ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  
  int N;
  cin >> N;
  
  vector<int> A(N);
  
  int num = -1;
  
  for(int i = 0;i < N;++i){
    cin >> A[i];
  }
  
  for(int i = 0;i < N;++i){
    for(int j = 0;j < N;++j){
      if(i == j){
        goto end;
      }
      
      num = max(A[j],num);
    }
    cout << num << endl;
    end;
  }
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:8: error: statement cannot resolve address of overloaded function
   25 |     end;
      |        ^
a.cc:19:14: error: label 'end' used but not defined
   19 |         goto end;
      |              ^~~
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define sz(a)  int((a).size())
#define pb  push_back
#define eb  emplace_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define repC3(vari,varj,vark,n)  for(int vari=0;vari<(n)-2;++vari)for(int varj=vari+1;varj<(n)-1;++varj)for(int vark=varj+1;vark<(n);++vark)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
using namespace std;
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }


int main() {
    int N;
    int ans=0;
    cin>>N;
    vector<int> a(N),b(N);
    rep(i,N)cin>>a[i];
    rep(i,N)b[i]=a[i];
    sort(RALL(a));
    rip(i,N){
        if(a[0]==b[i])
            Out(a[1]);
        else
            Out(a[0]);
    }  
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:9: error: 'i' was not declared in this scope
   32 |     rip(i,N){
      |         ^
a.cc:32:5: error: 'rip' was not declared in this scope; did you mean 'rep'?
   32 |     rip(i,N){
      |     ^~~
      |     rep
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define sz(a)  int((a).size())
#define pb  push_back
#define eb  emplace_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define repC3(vari,varj,vark,n)  for(int vari=0;vari<(n)-2;++vari)for(int varj=vari+1;varj<(n)-1;++varj)for(int vark=varj+1;vark<(n);++vark)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
using namespace std;
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }


int main() {
    int N;
    int ans=0;
    cin>>N;
    vector<int> a(N),b(N);
    rip(i,N)cin>>a[i];
    rip(i,N)b[i]=a[i];
    sort(RALL(a));
    rip(i,N){
        if(a[0]==b[i])
            Out(a[1]);
        else
            Out(a[0]);
    }  
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:9: error: 'i' was not declared in this scope
   29 |     rip(i,N)cin>>a[i];
      |         ^
a.cc:29:5: error: 'rip' was not declared in this scope; did you mean 'rep'?
   29 |     rip(i,N)cin>>a[i];
      |     ^~~
      |     rep
Language: C++

#include<stdio.h>
int main()
{
	int n,a[200005],i,x,d;
	while(~scanf("%d",&n))
	{
		for(i=0;i<n;i++)
		{
			scanf("%d",&a[i]);
		} 
		for(j=1;j<3;j++)
		for(i=1;i<n-1-j;i++)
		{
			if(a[i]>a[i+1])
			{
				d=a[i];
				a[i]=a[i+1];
				a[i+1]=d;
			}
		}
			if(n==2)printf("%d\n",a[n-1]);
			else printf("%d\n",a[n-2]);
			for(i=0;i<n-1;i++)
			printf("%d\n",a[n-1]);
		}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:21: error: 'j' was not declared in this scope
   11 |                 for(j=1;j<3;j++)
      |                     ^
Language: C

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

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

#include<stdio.h>
#include<queue>
using namespace std;
priority_queue<int,vector<int>,less<int> >q;
int main()
{
	int n,i,a[20005],x;
	while(~scanf("%d",&n))
	{
		for(i=0;i<n;i++)
		{scanf("%d",&a[i]);
		 push(a[i])q;
		}
		for(i=0;i<n;i++)
		{pop()q;
		 if(top()q!=a[0])printf("%d\n",top()q);
		 push(a[i])q;
		}
	}
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:12:18: error: 'push' was not declared in this scope
   12 |                  push(a[i])q;
      |                  ^~~~
a.cc:15:18: error: 'pop' was not declared in this scope; did you mean 'popen'?
   15 |                 {pop()q;
      |                  ^~~
      |                  popen
a.cc:16:21: error: 'top' was not declared in this scope
   16 |                  if(top()q!=a[0])printf("%d\n",top()q);
      |                     ^~~
a.cc:16:26: error: expected ')' before 'q'
   16 |                  if(top()q!=a[0])printf("%d\n",top()q);
      |                    ~     ^
      |                          )
a.cc:17:18: error: 'push' was not declared in this scope
   17 |                  push(a[i])q;
      |                  ^~~~