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

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

/* #pragma */
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")


/*alias*/
#define F first
#define S second

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define itn int

/*template*/
template<class T>inline bool amax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>inline bool amin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

/* func */
int32_t GCD(int32_t a, int32_t b){return b ? GCD(b, a%b) : a;}
int64_t GCD(int64_t a, int64_t b){return b ? GCD(b, a%b) : a;}
int32_t LCM(int32_t a, int32_t b){return a * b / GCD(a, b);}
int64_t LCM(int64_t a, int64_t b){return a * b / GCD(a, b);}

/*struct*/
struct aaa {
	aaa() {
		cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20);
	};
}aaaaaaa;

/* const */
constexpr int32_t INF = 1001001001;
constexpr int64_t LINF = 1001001001001001001ll;
constexpr int32_t MOD = 1e9 + 7; //10^9
constexpr int64_t EPS = 1e-9;
constexpr int32_t dx[] = { 1, 1, 0, -1, -1, -1, 0, 1 }, dy[] = { 0, 1, 1, 1, 0, -1, -1, -1 };
//constexpr int32_t dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
//Counterclockwise from the 6o'clock direction
//Take the x-axis downward and the y-axis right


//g++ -std=c++14 -Wall --pedantic-errors -o template template.cpp
//g++ -std=c++14 -Wall --pedantic-errors template.cpp
//chcp 65001

/*global*/



//#define int int64_t
signed main()
{
	int n; cin >> n;
	vector<int> a(n);
	for(int i = 0, i_len = (int)n; i < i_len; ++i) cin >> a[i];

	vector<int> left(n, 0);
	vector<int> right(n+2, 0);

	for(int i = 1, i_len = (int)n; i < i_len; ++i)
	{
		left[j] = max(left[j-1], a[j]);
	}
	for(int i = 2, i_len = (int)n+2; i < i_len; ++i)
	{
		right[j] = max(right[j+1], a[j]);
	}

	for(int i = 0, i_len = (int)n; i < i_len; ++i)
	{
		cout << max(left[i-1], right[i+1]) << '\n';
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:69:22: error: 'j' was not declared in this scope
   69 |                 left[j] = max(left[j-1], a[j]);
      |                      ^
a.cc:73:23: error: 'j' was not declared in this scope
   73 |                 right[j] = max(right[j+1], a[j]);
      |                       ^
Language: C++

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

int main(void){
  
  int i,N,c;
  cin >> N;
  int a[N];
  for(i=0;i<N;i++){
    cin >> a[i];
  }
  int max = 0;
  int max1 = 0;
  for(i=0;i<N;i++){
    if(max < a[i]){
      max = a[i];
      c = i;
    }
  }
  a[c] = 0;
  for(i=0;i<N;i++){
    if(max < a[i]){
      max1 = a[i];
    }
  }
  
  for(i=0;i<N;i++){
    if(i == c){
      cout << max1 << endl;
    }
    else{
      cout << max << endl;
    }
    
  }
  
  return 0;
}

Compiler output:
a.cc:2:20: error: expected ';' before 'int'
    2 | using namespace std
      |                    ^
      |                    ;
    3 | 
    4 | int main(void){
      | ~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector <int> a(n);
    vector <int> b(n);
    for(int i=0; i<n; i++)
    {
        cin >> a[i];
        b[i]=a[i];
    }
    sort(a.begin(),a.end());
    for(int i=0; i<n; i++)
    {
        if(b[i]==a[n-1])
        cout << a[n-2] << '\n';
        else
        cout << a[n-1] << '\n';
    }
    return 0;
}

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

#include <iostream>
#include <vector>
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector <int> a(n);
    vector <int> b(n);
    for(int i=0; i<n; i++)
    {
        cin >> a[i];
        b[i]=a[i];
    }
    sort(begin(a),end(a));
    for(int i=0; i<n; i++)
    {
        if(b[i]==a[n-1])
        cout << a[n-2] << '\n';
        else
        cout << a[n-1] << '\n';
    }
    return 0;
}

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: expected initializer before 'for'
    9 |         for(int i = 0 ; i < n ; i++){
      |         ^~~
a.cc:9:25: error: 'i' was not declared in this scope
    9 |         for(int i = 0 ; i < n ; i++){
      |                         ^
a.cc:15:51: error: 'b' was not declared in this scope
   15 |       int pos = lower_bound(a.begin() , a.end() , b[i]) - a.begin();
      |                                                   ^
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:14:40: error: expected primary-expression before ')' token
   14 |   sort(b.begin(), b.end(), greater<int>);
      |                                        ^
Language: C++

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

int main() {
  int n;
  cin >> n;
  
  vector<int> a(n);
  for (int i=0; i<n; i++) {
  	cin >> a.at(i);
  }
  int max = *max_element(a.begin(), a.end())
  
  for (int i=0; i<n; i++) {
    if (a.at(i) == max) {
      vector<int> b(n);
      copy(a.begin(), a.end(), b.begin());
      b.at(i) *= -1;
      cout << *max_element(b.begin(), b.end()) << endl;
    }else{
      cout << max << endl;
    }
  }
  
}

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

#include<iostream>
#include<algoriTHm>
#include<cstring>
using namespace std;
int n,x,minn,maxx;
int a[200005];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
	  scanf("%d",&a[i]);
	  if(a[i]>maxx) maxx=a[i];
	  else minn=max(minn,a[i]);
	}
	for(int i=1;i<=n;i++)
	  if(a[i]==maxx) printf("%d\n",minn);
	  else printf("%d\n",maxx);
	return 0;
	
}

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:9:21: error: 'i' was not declared in this scope
    9 |   rep(i,n) cin >> a[i];
      |                     ^
Language: C++

#include <stdio.h>
#include <stdbool.h>
#define rep(i,j) for(int i=0;i<j;i++)
#define max(i,b) (i>b)?i:b
void main(void)
{
	int array[200000];
	int N,tmp,mm;
	scanf("%d",&N);
	rep(i,N) scanf("%d",&array[i]);
	rep(i,N){
		mm=0;
		tmp=array[i];
		array[i]=0;
		rep(j,N) mm=max(mm,array[j]);
		printf("%d\n",mm);
		array[i]=tmp;
	}
}


Compiler output:
a.cc:5:1: error: '::main' must return 'int'
    5 | void main(void)
      | ^~~~
Language: C++

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

int main() {
 int n,j;cin>>n; int a[n],s[n];for(int i=0 ;i<n;i++) {
   s[i]=0;cin>>a[i] ;
 }
  if(i!=0 && i!=n-1){
  for(int i=0;i<n;i++){
    
      for(j=0;j<i;j++) if(a[j]>s[i])s[i]=a[j];
      for(j=i+1;j<n;j++)if(a[j]>s[i])s[i]=a[j];
    }
    
  }
    
    else if(i==0){
      for(j=1;j<n;j++)if(a[j]>s[i])s[i]=a[j];
    }
    
    else if (i==n-1){
      for(j=0;j<n-1;j++)if(a[j]>s[i])s[i]=a[j];
    }
    cout<<s[i]<<endl;
  
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:6: error: 'i' was not declared in this scope
    8 |   if(i!=0 && i!=n-1){
      |      ^
a.cc:24:13: error: 'i' was not declared in this scope
   24 |     cout<<s[i]<<endl;
      |             ^
Language: C++

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

int main() {
 int n;cin>>n; int a[n],s[n];for(int i=0 ;i<n;i++) {
   s[i]=0;cin>>a[i] ;
 }
  if(i!=0 && i!=n-1){
  for(int i=0;i<n;i++){
    
      for(int j=0;j<i;j++) if(a[j]>s[i])s[i]=a[j];
      for(int j=i+1;j<n;j++)if(a[j]>s[i])s[i]=a[j];
    }
    
  }
    
    else if(i==0){
      for(int j=1;j<n;j++)if(a[j]>s[i])s[i]=a[j];
    }
    
    else if (i==n-1){
      for(int j=0;j<n-1;j++)if(a[j]>s[i])s[i]=a[j];
    }
    cout<<s[i]<<endl;
  
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:6: error: 'i' was not declared in this scope
    8 |   if(i!=0 && i!=n-1){
      |      ^
a.cc:24:13: error: 'i' was not declared in this scope
   24 |     cout<<s[i]<<endl;
      |             ^
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);
  
  for (int i=0;i<n;i++){
    a.at(i)-=200005;
    sort(a.begin(),a.end());
    cout << a(n-1) << endl;
  }
}



Compiler output:
a.cc: In function 'int main()':
a.cc:12:14: error: no match for call to '(std::vector<int>) (int)'
   12 |     cout << a(n-1) << endl;
      |             ~^~~~~
Language: C++

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



Compiler output:
a.cc: In function 'int main()':
a.cc:6:19: error: invalid declarator before 'a'
    6 |   int vector<int> a(n);
      |                   ^
a.cc:7:32: error: 'a' was not declared in this scope
    7 |   for (int i=0;i<n;i++) cin >> a.at(i);
      |                                ^
a.cc:10:5: error: 'a' was not declared in this scope
   10 |     a.at(i)-=200005;
      |     ^
Language: C++

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



Compiler output:
a.cc: In function 'int main()':
a.cc:5:19: error: invalid declarator before 'a'
    5 |   int vector<int> a(n);
      |                   ^
a.cc:8:5: error: 'a' was not declared in this scope
    8 |     a.at(i)-=200005;
      |     ^
Language: C++

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



Compiler output:
a.cc: In function 'int main()':
a.cc:5:19: error: invalid declarator before 'a'
    5 |   int vector<int> a(n);
      |                   ^
a.cc:7:17: error: expected ';' before '<' token
    7 |   for (int i=0,i<n,i++){
      |                 ^
      |                 ;
a.cc:7:17: error: expected primary-expression before '<' token
a.cc:7:23: error: expected ';' before ')' token
    7 |   for (int i=0,i<n,i++){
      |                       ^
      |                       ;
a.cc:8:5: error: 'a' was not declared in this scope
    8 |     a.at(i)-=200005;
      |     ^
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define SZ(x) ((int)(x).size())
typedef long long ll;

typedef long double ld;
using namespace std;


int main() {
    ll N;
    cin>>N;
    ll A[N],B[N];
    REP(i,N){
        cin >>A[i];
        cout<<A[i]<<endl;
    }
    REP(i,N){
        int Max=0,Max2=0;
        Max=max_element(A[0],A[i-1]);
        Max2=max_element(A[i+1],A[N]);

        if(Max<Max2){
            cout<<Max2<<endl;
        }else{
            cout<<Max<<endl;
        }
    }

}
 

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

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

int ans[100001];

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

    sort(b,b+n,greater<int>());
    for(int i=0, i<n; i++){
        if(a[i] == b[0]) cout << b[1] << endl;
        else cout << b[0] << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:19: error: expected ';' before '<' token
   18 |     for(int i=0, i<n; i++){
      |                   ^
      |                   ;
a.cc:18:19: error: expected primary-expression before '<' token
Language: C++

#include <iostream>

using namespace std:

int main(){

    int N;
    cin >> N;
    vector<int> A(N);
    for(int i = 0; i < N; i++) cin >> A[i];

    int64_t sum = accumulate(A.begin(), A.end(), 0);

    for(int i = 0; i < N; i++) cout << sum - A[i] << endl;

    return 0;
}

Compiler output:
a.cc:3:20: error: expected ';' before ':' token
    3 | using namespace std:
      |                    ^
      |                    ;
a.cc:3:20: error: expected unqualified-id before ':' token
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:15:19: error: expected primary-expression before ';' token
   15 |         for(int i=;i<N;i++) cout << max << endl;
      |                   ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
int main(){
	int N;
	cin >> N;
	vi a(N);
	multiset<int> s;
	for(int i=0;i<N;i++){
		cin >> a[i];
		s.insert(a[i]);
	}
	for(int i=0;i<N;i++){
		auto it = s.find(a[i]);
		s.erase(it);
		cout << *s.rbegin() << endl;
		s.insert(a[i]);
	}
	return 0;
}



Compiler output:
a.cc:24:14: error: stray '\177' in program
   24 |         multi<U+007F>set<int> s;
      |              ^~~~~~~~
a.cc: In function 'int main()':
a.cc:24:9: error: 'multi' was not declared in this scope
   24 |         multiset<int> s;
      |         ^~~~~
a.cc:27:17: error: 's' was not declared in this scope
   27 |                 s.insert(a[i]);
      |                 ^
a.cc:30:27: error: 's' was not declared in this scope
   30 |                 auto it = s.find(a[i]);
      |                           ^
Language: Java

import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
      	int coursol = sc.nextInt();
		ArrayList<Integer> list = new ArrayList<Integer>();
		int AnsMin = 0;
      
    	for( int i = 0 ; i < coursol ; i++){
 			list.add(sc.nextInt());
            }
  
			ArrayList<Integer> copy = (ArrayList<Integer>)(list.clone());
            copy.remove(i);
          	         
          	Collections.sort(copy, Collections.reverseOrder());
            System.out.println(copy.get(0));
            }
       }
}


Compiler output:
Main.java:21: error: class, interface, enum, or record expected
}
^
1 error
Language: C++

#define repi(a,b) for(i=(a); i<(b); i++)
#include <iostream>

int main()
{
  long n;
  std::cin >> n;
  long *a = new long[n];
  long i;
  repi(0,n) std::cin >> a[i];
  long max=-1,max2=-1;
  repi(0,n)
    if(max<a[i])
      max = a[i];
  rep(0,n)
    if(max2<a[i] && a[i]!=max)
      max2 = a[i];
  if(max2 == -1) max2 = max;
  repi(0,n)
    if(a[i] == max)
      std::cout << max << std::endl;
    else
      std::cout << max2 << std::endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:3: error: 'rep' was not declared in this scope; did you mean 'repi'?
   15 |   rep(0,n)
      |   ^~~
      |   repi
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'vector' was not declared in this scope
    8 |   vector<int> vec(n);
      |   ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include <algorithm>
  +++ |+#include <vector>
    3 | using namespace std;
a.cc:8:10: error: expected primary-expression before 'int'
    8 |   vector<int> vec(n);
      |          ^~~
a.cc:9:28: error: conversion from 'int' to non-scalar type 'std::pair<int, int>' requested
    9 |   pair<int, int> max = (0, -1);
      |                            ^~
a.cc:11:12: error: 'vec' was not declared in this scope
   11 |     cin >> vec.at(i);
      |            ^~~
a.cc:17:8: error: 'vec' was not declared in this scope
   17 |   sort(vec.begin(), vec.end());
      |        ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i = 0;i< (n);i++)
#define N 1000010
int MNA(vector<int> arr){
	/*正の整数配列の最大値となるときの番号を返す*/
	int max=0;
	int n=0;
	REP(i,arr.size){
		if(arr.at(i)>=max){
			max=arr.at(i);
			n=i;
		}
	}
	return n;
}

int main(){
	int n,t;
	vector<int> an(N);
	cin>>n;
	REP(i,n){
		cin>>an.at(i);
	}
	t=MNA(an);
	sort(an.begin(),an.end());
	REP(k,n){
		if(k==t){
			cout<<an.at(n-2)<<endl;
		}else{
			cout<<an.at(n-1)<<endl;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int MNA(std::vector<int>)':
a.cc:9:19: error: invalid use of member function 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = int; _Alloc = std::allocator<int>; size_type = long unsigned int]' (did you forget the '()' ?)
    9 |         REP(i,arr.size){
      |                   ^
a.cc:3:36: note: in definition of macro 'REP'
    3 | #define REP(i,n) for(int i = 0;i< (n);i++)
      |                                    ^
Language: C

int main(void)
{
int n,i,max=0,j=0,second=0,num;
  
  scanf("%d",&n);
  int f[n];
  for(i=0; i<n; i++)
    scanf("%d",&b[i]);
  
  for(i=0; i<n; i++){
    j++;
	if(max < f[i]) {
      max = f[i];
      j=0;
    }
  }
  if(j<2){
    for(i=0; i<n; i++){
	if(max > f[i] && second < f[i]){ 
      second = f[i];
      num = i;
    }
    }
    for(i=0; i<n; i++){
      printf("%d",max);
      if(i == num)   printf("%d",max);
    }
  }
  else{
    for(i=0; i<n; i++)
      printf("%d",max);
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    5 |   scanf("%d",&n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | int main(void)
main.c:5:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    5 |   scanf("%d",&n);
      |   ^~~~~
main.c:5:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:8:17: error: 'b' undeclared (first use in this function)
    8 |     scanf("%d",&b[i]);
      |                 ^
main.c:8:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:25:7: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   25 |       printf("%d",max);
      |       ^~~~~~
main.c:25:7: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:25:7: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:25:7: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:31:7: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   31 |       printf("%d",max);
      |       ^~~~~~
main.c:31:7: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

#include<stdio.h>

int main(void)
{
int n,i,max=0,j=0,second=0,num;
  
  scanf("%d",&n);
  int b[n];
  for(i=0; i<n; i++)
    scanf("%d",&b[i]);
  
  for(i=0; i<n; i++){
    j++;
	if(max < f[i]) {
      max = f[i];
      j=0;
    }
  }
  if(j<2){
    for(i=0; i<n; i++){
	if(max > f[i] && second < f[i]){ 
      second = f[i];
      num = i;
    }
    }
    for(i=0; i<n; i++){
      printf("%d",max);
      if(i == num)   printf("%d",max);
    }
  }
  else{
    for(i=0; i<n; i++)
      printf("%d",max);
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:14:18: error: 'f' undeclared (first use in this function)
   14 |         if(max < f[i]) {
      |                  ^
main.c:14:18: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>

int main(void)
{
int n,i,max=0,j=0,second=0,num;
  
  scanf("%d",n);
  int b[n],x[n];
  for(i=0; i<n; i++)
    scanf("%d",&b[i]);
  
  for(i=0; i<n; i++){
    j++;
	if(max < f[i]) {
      max = f[i];
      j=0;
    }
  }
  if(j<2){
    for(i=0; i<n; i++){
	if(max > f[i] && second < f[i]){ 
      second = f[i];
      num = i;
    }
    }
    for(i=0; i<n; i++){
      printf("%d",max);
      if(i == num)   printf("%d",max);
    }
  }
  else{
    for(i=0; i<n; i++)
      printf("%d",max);
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:14:18: error: 'f' undeclared (first use in this function)
   14 |         if(max < f[i]) {
      |                  ^
main.c:14:18: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

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

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

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

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

int main(){
  int n;
  int m1=0,m2=1;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++) cin>>a.at(i);
  if(a.at(m1)<a.at(m2)) swap(m1,m2);
  for(int i=1;i<n;i++){
    if(a.at(m1)<=a.at(i)) m1=i;
    else if(a.at(m2)<=a.at(i)) m2=i;
  }
  
  for(int i=0;i<n;i++){
    if(i==m1) cout<<a.at(m2)<<endl;
    else cout<<a.at(m1)<<endl;
  }
}


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

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

int main(){
  int n;
  int m1=0,m2=0;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++) cin>>a.at(i);
  for(int i=1;i<n;i++){
    if(a.at(m1)<=a.at(i)) m1=i;
    else if(a.at(m2)<=a.at(i)) m2=i;
  }
  
  for(int i=0;i<n;i++){
    if(i==m1) cout<<a.at(m2)<<endl;
    else cout<<a.at(m1)<<endl;
  }
}


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

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

int main(){
  int n;
  int m1=0,m2=0;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++) cin>>a.at(i);
  for(int i=1;i<n;i++){
    if(a.at(i-1)<=a.at(i)) m1=i;
    else if(a.at(m2)<=a.at(i)) m2=i;
  }
  
  for(int i=0;i<n;i++){
    if(i==m1) cout<<a.at(m2)<<endl;
    else cout<<a.at(m1)<<endl;
  }
}

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

#include <iostream>
#include <vector>
#include <algorithm>

int main(int argc, char *argv[]){
  unsigned int N;
  std::cin >> N;
  std::vector<unsigned int>A(N);
  for(auto &a : A){
    std::cin >> a;
  }
  unsigned int a;
  for(int i=0; i<N; ++i){
    a = A[i];
    A.erase(A.begin()+i);
    std::cout << *std::max_element(A.begin(),A.end());
    A.insert(A.begin()+i,a)
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:17:28: error: expected ';' before '}' token
   17 |     A.insert(A.begin()+i,a)
      |                            ^
      |                            ;
   18 |   }
      |   ~
Language: C++

#include <iostream>
#include <vector>
#include <cmath>

int main(int argc, char *argv[]){
  unsigned int N;
  std::cin >> N;
  std::vector<unsigned int>A(N);
  for(auto &a : A){
    std::cin >> a;
  }
  unsigned int a;
  for(int i=0; i<N; ++i){
    a = A[i]
    A.erase(A.begin()+i);
    std::cout << *std::max_element(A.begin(),A.end());
    A.insert(A.begin()+i,a)
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:14:13: error: expected ';' before 'A'
   14 |     a = A[i]
      |             ^
      |             ;
   15 |     A.erase(A.begin()+i);
      |     ~        
a.cc:16:24: error: 'max_element' is not a member of 'std'; did you mean 'tuple_element'?
   16 |     std::cout << *std::max_element(A.begin(),A.end());
      |                        ^~~~~~~~~~~
      |                        tuple_element
a.cc:17:28: error: expected ';' before '}' token
   17 |     A.insert(A.begin()+i,a)
      |                            ^
      |                            ;
   18 |   }
      |   ~
Language: C++

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int n;
int a[200005];
int nax1 = -1, nax2 = -2;

int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for(int i = 1; i <= n; i++)
    cin >> a[i];
  
  for(int i = 1; i <= n; i++) {
    if(nax1 < a[i]) {
      nax2 = nax1
      nax1 = a[i];
    } else if(nax2 < a[i]) {
      nax2 = a[i];
    }
    for(int i = 1; i <= n; i++) {
      if(a[i] == nax1) cout << nax2 << endl;
      else cout << nax1 << endl;
    }
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:18: error: expected ';' before 'nax1'
   20 |       nax2 = nax1
      |                  ^
      |                  ;
   21 |       nax1 = a[i];
      |       ~~~~
Language: C++

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

int main()
{
  int n,i;
  cin>>n
    
  int array[n];
  
  for(i=0;i<n;i++)
  {
    cin>>array[i];
  }
  
  int max1 = 0;
  int max2 = 0;
  
  for(int i=0;i<n;i++)
  {
    if (array[i]>max1)
	{
		max2=max1;
		max1=array[i];
	}
	
	else if (array[i]>max2 && array[i]<max1)
	{
		max2=array[i];
	}
  }
  
  for(int i=0;i<n;i++)
  {
	  if(array[i]==max1)
		  cout<<max2;
	  else
		  cout<<max1;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: expected ';' before 'int'
    7 |   cin>>n
      |         ^
      |         ;
    8 | 
    9 |   int array[n];
      |   ~~~    
a.cc:13:15: error: missing template arguments before '[' token
   13 |     cin>>array[i];
      |               ^
a.cc:21:14: error: expected unqualified-id before '[' token
   21 |     if (array[i]>max1)
      |              ^
a.cc:24:27: error: missing template arguments before '[' token
   24 |                 max1=array[i];
      |                           ^
a.cc:27:23: error: expected unqualified-id before '[' token
   27 |         else if (array[i]>max2 && array[i]<max1)
      |                       ^
a.cc:29:27: error: missing template arguments before '[' token
   29 |                 max2=array[i];
      |                           ^
a.cc:35:19: error: expected unqualified-id before '[' token
   35 |           if(array[i]==max1)
      |                   ^
Language: Java

import java.util.*;

public class Main{
	public static void main(String args[]){
    	Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
      
        int[] A = new int[N];
        int[] a = new int[N];
        for(int i = 0; i < N; i++){
            A[i] = scanner.nextInt();
            a[i] = A[i];
        }
		
        int max_first = 0;
        int max_second = 0;
        int max_first_position = 0;
        
        /*
        * 1つ目の最大値の箇所のみ2つ目の最大値を出力。他は最大値を出力。
        * 2つ目の最大値 = 最大値　の可能性もある。
        */
      
        //1つ目の最大値探索
        for(int i = 0; i < N; i++){
            if(A[i] > max_first){
                max_first = A[i];
                max_first_position = i;
            }
        }
      
        a[max_first_position] = 0;　//a配列では、1つ目の最大値の箇所を0にする
        
        //2つ目の最大値探索
        for(int i = 0; i < N; i++){
            if(a[i] > max_second){
                max_second = a[i];
            }
        } 
      
        for(int i = 0; i < N; i++){  
            if(a[i] == 0){
                System.out.println(max_second);
            } else {
                System.out.println(max_first);
            }
        } 
    }
}

Compiler output:
Main.java:32: error: illegal character: '\u3000'
        a[max_first_position] = 0;?//a?????1??????????0???
                                  ^
1 error
Language: C++

#include <cstdio>
using namespace std;

int main()
{
  int maxV=0, secV=0, maxP;
  scanf("%d", &N);
  int x;
  for (int i=0; i<N; i++) {
    scanf("%d", &x);
    if (maxV < x) {
      secV = maxV;
      maxV = x;
      maxP = i;
    } else if (secV < x) {
      secV = x;
    }
  }
  
  for (int i=0; i<N; i++)
  {
    if (i == maxP) printf("%d\n", secV);
    else printf("%d\n", maxV);
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:16: error: 'N' was not declared in this scope
    7 |   scanf("%d", &N);
      |                ^
Language: C

#include<stdio.h>

int main(){
    int r[20000];
    int n;
    int top, second;
    scanf("%d",&n);
    for(int i = 0;i<n;i++){
        scanf("%d",&r[i]);
    }
    top = 0;
    second = 0;
    for(int i = 1;i < n;i++){
        if(top<r[i]){
            second = top;
            top = i;
        }
    }
    for(int i = 1;i < n;i++){
        if(top == i){
            printf("%d", r[second]);
        }else{
            printf("%d",r[top]);
        }
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:26:1: error: expected declaration or statement at end of input
   26 | }
      | ^
Language: C++

#include <iostream>
#include <vector>

using namespace std;

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

    vector<int> A(N), maxA(N);
    for(int i=0; i<N; i++){
        cin >> A.at(i);
    }

    maxA = A;

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


    for(int i=0; i<N; i++){
        int maxNum =0;
        if(maxA.at(0) > A.at(i)){
            maxNum = maxA.at(0);
        }else{
            maxNum = maxA.at(1);
        }

        cout << maxNum <<endl;
    }
}


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

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vp;
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin() , v.end()
#define inputv(v,n) rep(i,n){\
    ll x;\
    cin>>x;\
    v.push_back(x);\
    }
const ll INF=99999999999999;
const ll MOD=1000000007;
 
int main() {
  ll n;
  cin >> n;
  vl v;
  inputv(v,n);
  ll mx=0,sec=0;
  rep(i,n){
    mx = max(mx,v[i]);
  }
  rep(i,n){
      if(v[i] < mx){
      sec = max(sec, v[i]);
    }
  }
  ll count=0;
  rep(i,n){
    if(v[i] == mx){
      count++;
    }
  }
  vl ans(n);
  if(count == 1){
  rep(i,n){
      if(v[i] == mx){
        ans[i] = sec;
      } else {
        ans[i] = mx;
      }
  }
  }
  if(count > 1){
    ans[i] = mx;
  }
  rep(i,n){
    cout << ans[i] << endl;
  }
 return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:47:9: error: 'i' was not declared in this scope
   47 |     ans[i] = mx;
      |         ^
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];
        for(int i = 0; i < n; i++)
            a[i] = sc.nextInt();
        
        int max1 = max(a);
        int max2 = sec_max(a);
        for(int i = 0; i < n; i++){
            if(max1 == a[i])
                System.out.println(max2);
            else
                System.out.println(max1);
        }
        sc.close();  
    }

    static int max(int[] a){
        return max1.sec_max(a);
    }

    static int sec_max(int[] a){
        int max1 = a[0];
        int max2 = a[0];
        for(int i = 1; i < a.length; i++){
            if(a[i] > max1) {
                max2 = max1;
                max1 = a[i];
            } else if(a[i] > max2){
                max2 = a[i];
            }
        }
        return max2;
    }
}

Compiler output:
Main.java:23: error: cannot find symbol
        return max1.sec_max(a);
               ^
  symbol:   variable max1
  location: class Main
1 error
Language: C++

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

int main() {
  int N;
  cin >> N;
  int v[N];
  for (int i=0; i<N; ++i) {
    cin >> v[i];
  }
  int c = v;
  sort(c.begin(), c.end()), greater<int>);
  for (int i=0; i<N; ++i) {
    if (v[i] != v[0]) {
      cout << v[0] << endl;
    } else {
      if (v[i] != v[1]) {
        cout << v[1] << endl;
      } else {
        cout << v[0] << endl;
      }
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:11: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   11 |   int c = v;
      |           ^
      |           |
      |           int*
a.cc:12:10: error: request for member 'begin' in 'c', which is of non-class type 'int'
   12 |   sort(c.begin(), c.end()), greater<int>);
      |          ^~~~~
a.cc:12:21: error: request for member 'end' in 'c', which is of non-class type 'int'
   12 |   sort(c.begin(), c.end()), greater<int>);
      |                     ^~~
a.cc:12:41: error: expected primary-expression before ')' token
   12 |   sort(c.begin(), c.end()), greater<int>);
      |                                         ^
Language: C++

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std

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


Compiler output:
a.cc:16:20: error: expected ';' before 'int'
   16 | using namespace std
      |                    ^
      |                    ;
   17 | 
   18 | int main(){
      | ~~~                 
a.cc: In function 'int main()':
a.cc:20:6: error: structured binding declaration cannot have type 'int'
   20 |   int[] A = new int[N];
      |      ^~
a.cc:20:6: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:20:6: error: empty structured binding declaration
a.cc:20:9: error: expected initializer before 'A'
   20 |   int[] A = new int[N];
      |         ^
a.cc:23:12: error: 'A' was not declared in this scope
   23 |     cin >> A[i];
      |            ^
a.cc:25:6: error: structured binding declaration cannot have type 'int'
   25 |   int[] B = A;
      |      ^~
a.cc:25:6: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:25:6: error: empty structured binding declaration
a.cc:25:9: error: expected initializer before 'B'
   25 |   int[] B = A;
      |         ^
a.cc:26:8: error: 'A' was not declared in this scope
   26 |   sort(A.begin(), A.end(), greater<int>());
      |        ^
a.cc:29:8: error: 'B' was not declared in this scope
   29 |     if(B[i] != M){
      |        ^
a.cc:35:4: error: expected '}' at end of input
   35 |   }
      |    ^
a.cc:18:11: note: to match this '{'
   18 | int main(){
      |           ^
Language: C++

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

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

Compiler output:
a.cc:2:20: error: expected ';' before 'int'
    2 | using namespace std
      |                    ^
      |                    ;
    3 | 
    4 | int main(){
      | ~~~                 
a.cc: In function 'int main()':
a.cc:6:6: error: structured binding declaration cannot have type 'int'
    6 |   int[] A = new int[N];
      |      ^~
a.cc:6:6: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:6:6: error: empty structured binding declaration
a.cc:6:9: error: expected initializer before 'A'
    6 |   int[] A = new int[N];
      |         ^
a.cc:9:12: error: 'A' was not declared in this scope
    9 |     cin >> A[i];
      |            ^
a.cc:11:6: error: structured binding declaration cannot have type 'int'
   11 |   int[] B = A;
      |      ^~
a.cc:11:6: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:11:6: error: empty structured binding declaration
a.cc:11:9: error: expected initializer before 'B'
   11 |   int[] B = A;
      |         ^
a.cc:12:8: error: 'A' was not declared in this scope
   12 |   sort(A.begin(), A.end(), greater<int>());
      |        ^
a.cc:15:8: error: 'B' was not declared in this scope
   15 |     if(B[i] != M){
      |        ^
a.cc:21:4: error: expected '}' at end of input
   21 |   }
      |    ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++


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

int main() {
	int N;
	cin >>N;
	vector <int> A(N);

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

	int max;
	int second_max;

	
	vector <int> B(N);
	copy(A.begin(), A.end(), back_inserter(B));

	sort(B.begin(), B.end(), greater<int>);
	max = B[0];
	second_max = B[1];

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

Compiler output:
a.cc: In function 'int main()':
a.cc:23:46: error: expected primary-expression before ')' token
   23 |         sort(B.begin(), B.end(), greater<int>);
      |                                              ^
Language: C++

#include <stdio.h>

int main(){
  int N,i,j,s;
  scanf("%d",&N)
  int a[N];
  for(i=0;i<N;i++){
    scanf("%d",&a[i]);
  }
  for(i=0;i<N;i++){
    for(j=0;j<i;j++){
      if(a[j]<a[j+1]){
        s = a[j+1];
      }else{
        s = a[j];
      }
    }
    for(j=i+1;j<N-1;j++){
      if(a[j]<a[j+1]){
        s = a[j+1];
      }else{
        s = a[j];
      }
    }
    printf("%d\n",s);
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:17: error: expected ';' before 'int'
    5 |   scanf("%d",&N)
      |                 ^
      |                 ;
    6 |   int a[N];
      |   ~~~            
a.cc:8:17: error: 'a' was not declared in this scope
    8 |     scanf("%d",&a[i]);
      |                 ^
a.cc:12:10: error: 'a' was not declared in this scope
   12 |       if(a[j]<a[j+1]){
      |          ^
a.cc:19:10: error: 'a' was not declared in this scope
   19 |       if(a[j]<a[j+1]){
      |          ^
Language: C++

#include <stdio.h>

int main(){
  int N,i,j,s;
  scanf("%d",&N)
  int a[N];
  for(i=0;i<N;i++){
    scanf("%d",&a[i]);
  }
  for(i=0;i<N;i++){
    for(j=0;j<i;j++){
      if(a[j]<a[j+1]){
        s = a[j+1];
      }else{
        s = a[j];
      }
    }
    for(j=i+1;j<N;j++){
      if(a[j]<a[j+1]){
        s = a[j+1];
      }else{
        s = a[j];
      }
    }
    printf("%d\n",s);
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:17: error: expected ';' before 'int'
    5 |   scanf("%d",&N)
      |                 ^
      |                 ;
    6 |   int a[N];
      |   ~~~            
a.cc:8:17: error: 'a' was not declared in this scope
    8 |     scanf("%d",&a[i]);
      |                 ^
a.cc:12:10: error: 'a' was not declared in this scope
   12 |       if(a[j]<a[j+1]){
      |          ^
a.cc:19:10: error: 'a' was not declared in this scope
   19 |       if(a[j]<a[j+1]){
      |          ^
Language: C++

#include <stdio.h>

int main(){
  int N,i,j,s;
  scanf("%d",&N)
  int a[N];
  for(i=0;i<N;i++){
    scanf("%d",a[i]);
  }
  for(i=0;i<N;i++){
    for(j=0;j<i;j++){
      if(a[j]<a[j+1]){
        s = a[j+1];
      }else{
        s = a[j];
      }
    }
    for(j=i+1;j<N;j++){
      if(a[j]<a[j+1]){
        s = a[j+1];
      }else{
        s = a[j];
      }
    }
    printf("%d\n",s);
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:17: error: expected ';' before 'int'
    5 |   scanf("%d",&N)
      |                 ^
      |                 ;
    6 |   int a[N];
      |   ~~~            
a.cc:8:16: error: 'a' was not declared in this scope
    8 |     scanf("%d",a[i]);
      |                ^
a.cc:12:10: error: 'a' was not declared in this scope
   12 |       if(a[j]<a[j+1]){
      |          ^
a.cc:19:10: error: 'a' was not declared in this scope
   19 |       if(a[j]<a[j+1]){
      |          ^
Language: C++

#include <stdio.h>

int main(){
  int N,i,j,s;
  scanf("%d",&N)
  int a[N];
  for(i=0;i<N;i++){
    scanf("%d",a[i]);
  }
  for(i=0;i<N;i++){
    for(j=0;j<i;j++){
      if(a[j]<a[j+1]){
        s = a[j+1];
      }else{
        s = a[j];
      }
    }
    for(j=i+1;j<N;j++){
      if(a[j]<a[j+1]){
        s = a[j+1];
      }else{
        s = a[j];
    }
    printf("%d\n",s);
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:17: error: expected ';' before 'int'
    5 |   scanf("%d",&N)
      |                 ^
      |                 ;
    6 |   int a[N];
      |   ~~~            
a.cc:8:16: error: 'a' was not declared in this scope
    8 |     scanf("%d",a[i]);
      |                ^
a.cc:12:10: error: 'a' was not declared in this scope
   12 |       if(a[j]<a[j+1]){
      |          ^
a.cc:19:10: error: 'a' was not declared in this scope
   19 |       if(a[j]<a[j+1]){
      |          ^
a.cc:26:2: error: expected '}' at end of input
   26 | }
      |  ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include <stdio.h>

int main(){
  int N,i,j,s;
  scanf("%d",&N)
  int a[N];
  for(i=0;i<N;i++){
    scanf("%d",a[i]);
  }
  for(i=0;i<N;i++){
    for(j=0;j<i;j++){
      if(a[j]<a[j+1]){
        s = a[j+1];
      }else{
        s = a[j];
    }
    for(j=i+1;j<N;j++){
      if(a[j]<a[j+1]){
        s = a[j+1];
      }else{
        s = a[j];
    }
    printf("%d\n",s);
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:17: error: expected ';' before 'int'
    5 |   scanf("%d",&N)
      |                 ^
      |                 ;
    6 |   int a[N];
      |   ~~~            
a.cc:8:16: error: 'a' was not declared in this scope
    8 |     scanf("%d",a[i]);
      |                ^
a.cc:12:10: error: 'a' was not declared in this scope
   12 |       if(a[j]<a[j+1]){
      |          ^
a.cc:18:10: error: 'a' was not declared in this scope
   18 |       if(a[j]<a[j+1]){
      |          ^
a.cc:25:2: error: expected '}' at end of input
   25 | }
      |  ^
a.cc:10:19: note: to match this '{'
   10 |   for(i=0;i<N;i++){
      |                   ^
a.cc:25:2: error: expected '}' at end of input
   25 | }
      |  ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include <stdio.h>

int main(){
  int N,i,j,s;
  scanf("%d",&N)
  int a[N];
  for(i=0;i<N;i++){
    scanf("%d",a[i]);
  }
  for(i=0;i<N;i++){
    for(j=0;j<i;j++){
      if(a[j]<a[j+1]){
        s = a[j+1];
      }else{
        s = a[j];
    }
    for(j=i+1;j<N;j++){
      if(a[j]<a[j+1]){
        s = a[j+1];
      }else{
        s = a[j];
    }
    printf("%d\n",s)
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:17: error: expected ';' before 'int'
    5 |   scanf("%d",&N)
      |                 ^
      |                 ;
    6 |   int a[N];
      |   ~~~            
a.cc:8:16: error: 'a' was not declared in this scope
    8 |     scanf("%d",a[i]);
      |                ^
a.cc:12:10: error: 'a' was not declared in this scope
   12 |       if(a[j]<a[j+1]){
      |          ^
a.cc:18:10: error: 'a' was not declared in this scope
   18 |       if(a[j]<a[j+1]){
      |          ^
a.cc:23:21: error: expected ';' before '}' token
   23 |     printf("%d\n",s)
      |                     ^
      |                     ;
   24 |   }
      |   ~                  
a.cc:25:2: error: expected '}' at end of input
   25 | }
      |  ^
a.cc:10:19: note: to match this '{'
   10 |   for(i=0;i<N;i++){
      |                   ^
a.cc:25:2: error: expected '}' at end of input
   25 | }
      |  ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^