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

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



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

#include<stdio.h>
int main(){
  int N;
  scanf("%d",&N);
  int A[N];
  for(int i=0;i<N;i++){
    scanf("%d",&A[i]);
  }
  int B[N];
  for(int i=0;i<N,i++){
    for(int j=0;j<N-1;j++){
      if(i>j)
        B[N]=A[N];
      else
        B[N]=A[N+1];
    }
    int max=0;
     for(int j=0;j<N-1;j++){
       if(B[j]>max)
         max=B[j];
     }
    printf("%d",max);
    return 0;
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:10:22: error: expected ';' before ')' token
   10 |   for(int i=0;i<N,i++){
      |                      ^
      |                      ;
a.cc:24:4: error: expected '}' at end of input
   24 |   }
      |    ^
a.cc:2:11: note: to match this '{'
    2 | int main(){
      |           ^
Language: C++

#include<stdio.h>
int main(){
  int N;
  scanf("%d",&N);
  int A[N];
  for(int i=0;i<N;i++){
    scanf("%d",&A[i]);
  }
  int B[N]
  for(int i=0;i<N,i++){
    for(int j=0;j<N-1;j++){
      if(i>j)
        B[N]=A[N];
      else
        B[N]=A[N+1];
    }
    int max=0;
     for(int j=0;j<N-1;j++){
       if(B[j]>max)
         max=B[j]
     }
    printf("%d",max);
    return 0;
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: expected initializer 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++){
      |               ^
a.cc:24:4: error: expected '}' at end of input
   24 |   }
      |    ^
a.cc:2:11: note: to match this '{'
    2 | int main(){
      |           ^
Language: C++

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

int main () {
	int N;
	int max=0, sucmax=0, maxid=-1;
	cin >> N;
	for (int i=0; i<N; i++) {
		int tmp;
		cin >> tmp;
		if (tmp>=max) {
			sucmax = max;
			max = tmp;
			maxid = i;
		} else if (tmp>sucmax) {
			sucmax = tmp;
		}
	}
	for (int i=0; i<N; i++) {
		if (i==maxid)
			cout << sucmax << endl;
		else
			cout << max << endl;
	}
	return 0;
}
#include <iostream>
#include <vector>
using namespace std;

int main () {
	int N;
	int max=0, sucmax=0, maxid=-1;
	cin >> N;
	for (int i=0; i<N; i++) {
		int tmp;
		cin >> tmp;
		if (tmp>=max) {
			sucmax = max;
			max = tmp;
			maxid = i;
		} else if (tmp>sucmax) {
			sucmax = tmp;
		}
	}
	for (int i=0; i<N; i++) {
		if (i==maxid)
			cout << sucmax << endl;
		else
			cout << max << endl;
	}
	return 0;
}

Compiler output:
a.cc:32:5: error: redefinition of 'int main()'
   32 | int main () {
      |     ^~~~
a.cc:5:5: note: 'int main()' previously defined here
    5 | int main () {
      |     ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  ll n,i,p,max=-1,c=0;
  cin>>n;
  ll a[n];
  for(i=0;i<n;i++)
      {
        cin>>a[i];
      }
  p=*max_element(a,a+n);   
  for(i=0;i<n;i++)
  {
  	if(a[i]==p)
  	c++;
   }
  for(i=0;i<n;i++)
  {
    if(a[i]<p)
    {
      if(max<a[i])
      {
        max=a[i];
      }
    }
  }
if(c>1)
{
	max=p;
}
  for(i=0;i<n;i++)
  {
    if(a[i]==p)
      cout<<max<<endl;
    else
      cout<<k<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:13: error: 'k' was not declared in this scope
   38 |       cout<<k<<endl;
      |             ^
Language: C

#include"stdio.h"
int main(void){
int n;
scanf("%d",&n);
int a[n],i,j,t=0;

  for(i=0;i<n;i++){
  	scanf("%d",&a[i]);
  }
  
  for(j=0;j<n;j++){
  for(i=0;i<n;i++){
  	if(a[i] > t && a[i]!=a[j]){
      t=a[i]
    }
  }
    printf("%d",t);
  }

return 0;
}

Compiler output:
main.c: In function 'main':
main.c:14:13: error: expected ';' before '}' token
   14 |       t=a[i]
      |             ^
      |             ;
   15 |     }
      |     ~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif*/
	ll r,n;
	cin>>n;
	vector<ll>a;
	set<ll>b;
	for(ll i=0;i<n;i++)
	{
		ll z;
		cin>>z;
		a.push_back(z);
		b.insert(z);
	}
	auto it=r.begin();
	ll mx=*it;
	--it;
	ll tx=*it;
	if(b.size()==1 )
	{
		for(ll i=0;i<n;i++)
			cout<<a[0]<<endl;
	}
	else
	{
		for(ll i=0;i<n;i++)
			{if(a[i] != mx)
				cout<<mx<<endl;
				else
					cout<<tx<<endl;
			}
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:19: error: request for member 'begin' in 'r', which is of non-class type 'll' {aka 'long long int'}
   21 |         auto it=r.begin();
      |                   ^~~~~
Language: C

a_max=0
a_max_next=0
A=[]
N=int(input())

for i in range(N):
    A.append(int(input()))
    if A[i]>a_max:
        a_max=A[i]
    elif A[i]>=a_max_next:
        a_max_next=A[i]

for i in range(N):
    if A[i]==a_max:
        print(a_max_next)
    else:
        print(a_max)

Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | a_max=0
      | ^~~~~
main.c:1:1: error: type defaults to 'int' in declaration of 'a_max' [-Wimplicit-int]
main.c:2:1: error: expected ',' or ';' before 'a_max_next'
    2 | a_max_next=0
      | ^~~~~~~~~~
Language: C

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

struct unit{
  int a;
  int number;
};

int main(void){
  int N,i,j;
  struct unit *A;
  scanf("%d",&N);
  A=(unit*)malloc(sizeof(unit)*N);
  for(i=0;i<N;i++){
    scanf("%d",&A[i].a);
    A[i].number=i;
  }
  for(i=0;i<2;i++){
    for(j=N-1;j>i;j--){
      if(A[j].a>A[j-1].a){
        int tmpA,tmpnum;
        tmpA=A[j-1].a;
        tmpnum=A[j-1].number;
        A[j-1].a=A[j].a;
        A[j-1].number=A[j].number;
        A[j].a=tmpA;
        A[j].number=tmpnum;
      }
    }
  }
  for(i=0;i<N;i++){
    if(i!=A[0].number){
      printf("%d\n",A[0].a);
    }else{
      printf("%d\n",A[1].a);
    }
  }
  free(A);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:13:6: error: 'unit' undeclared (first use in this function)
   13 |   A=(unit*)malloc(sizeof(unit)*N);
      |      ^~~~
main.c:13:6: note: each undeclared identifier is reported only once for each function it appears in
main.c:13:11: error: expected expression before ')' token
   13 |   A=(unit*)malloc(sizeof(unit)*N);
      |           ^
Language: C++

#include<iostream>
#include<algorithm>

using namespace std;
int main(){
  int n;
  cin>>n;
  int a[n],b[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
    
  }
  sort(a.begin(),a.end());
  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:13:10: error: request for member 'begin' in 'a', which is of non-class type 'int [n]'
   13 |   sort(a.begin(),a.end());
      |          ^~~~~
a.cc:13:20: error: request for member 'end' in 'a', which is of non-class type 'int [n]'
   13 |   sort(a.begin(),a.end());
      |                    ^~~
Language: C++

#include<iostream>
#unclude<algorithm>

using namespace std;
int main(){
  int n;
  cin>>n;
  int a[n],b[i];
  for(int i=0;i<n;i++){
    cin>>a[i];
    
  }
  sort(a.begin(),a.end());
  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:2:2: error: invalid preprocessing directive #unclude; did you mean #include?
    2 | #unclude<algorithm>
      |  ^~~~~~~
      |  include
a.cc: In function 'int main()':
a.cc:8:14: error: 'i' was not declared in this scope
    8 |   int a[n],b[i];
      |              ^
a.cc:13:10: error: request for member 'begin' in 'a', which is of non-class type 'int [n]'
   13 |   sort(a.begin(),a.end());
      |          ^~~~~
a.cc:13:20: error: request for member 'end' in 'a', which is of non-class type 'int [n]'
   13 |   sort(a.begin(),a.end());
      |                    ^~~
a.cc:13:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   13 |   sort(a.begin(),a.end());
      |   ^~~~
      |   short
a.cc:15:8: error: 'b' was not declared in this scope
   15 |     if(b[i]==a[n-1]) cout << a[n-2] << endl;
      |        ^
Language: C++

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++)	cin >> a[i];
  b = a;
  sort(b.rbegin(), b.rend());
  for(int i = 0; i < n; i++)	cout << (a[i]==b[0] ? b[1] : b[0]) << " \n"[i+1==n];
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:3: error: 'b' was not declared in this scope
   11 |   b = a;
      |   ^
Language: Java

import java.util.Scanner;
public class Main {
	static Scanner scan=new Scanner(System.in);
	static int gcd (int a, int b) {return b>0?gcd(b,a%b):a;}
	static long lcm (int a, int b) {return a*b/gcd(a,b);}
	static int max(int a,int b) {return a>b?a:b;}
	static int min(int a,int b) {return a<b?a:b;}
	static long factorial(int i) {return i==1?1:i*factorial(i-1);}
	static int lower_bound(int a[],int key) {
		int low=0,high=a.length;
		while(low<high) {
			int mid=((high-low)/2)+low;
			if(a[mid]<=key)low=mid+1;
			else high=mid;
		}
		return high;
		}
	static int upper_bound(int a[],int key) {
		int low=0,high=a.length;
		while(low<high) {
			int mid=((high-low)/2)+low;
			if(a[mid]<key)low=mid+1;
			else high=mid;
		}
		return high;
		}
	static boolean isPrime (int n) {
		if (n==2) return true;
		if (n<2 || n%2==0) return false;
		double d = Math.sqrt(n);
		for (int i=3; i<=d; i+=2)if(n%i==0){return false;}
		return true;
	}
	
	
		public static void main(String[] args) {
			Scanner scan=new Scanner(System.in);
			int a=scan.nextInt();
		    int b[]=new int[a];
          int max=0,sec=0;
          for(int i=0;i<a;i++){
            b[i]=scan.nextInt();
            if(max<b[i]){
              sec=max;
              max=b[i];
            }
            
          }
          for(int i=0;i<a;i++){
            if(b[i]==max)System.out.println(sec);
            else System.our.println(max);
          }
		}
}


Compiler output:
Main.java:51: error: cannot find symbol
            else System.our.println(max);
                       ^
  symbol:   variable our
  location: class System
1 error
Language: Java

import java.util.Scanner;
public class Main {
	static Scanner scan=new Scanner(System.in);
	static int gcd (int a, int b) {return b>0?gcd(b,a%b):a;}
	static long lcm (int a, int b) {return a*b/gcd(a,b);}
	static int max(int a,int b) {return a>b?a:b;}
	static int min(int a,int b) {return a<b?a:b;}
	static long factorial(int i) {return i==1?1:i*factorial(i-1);}
	static int lower_bound(int a[],int key) {
		int low=0,high=a.length;
		while(low<high) {
			int mid=((high-low)/2)+low;
			if(a[mid]<=key)low=mid+1;
			else high=mid;
		}
		return high;
		}
	static int upper_bound(int a[],int key) {
		int low=0,high=a.length;
		while(low<high) {
			int mid=((high-low)/2)+low;
			if(a[mid]<key)low=mid+1;
			else high=mid;
		}
		return high;
		}
	static boolean isPrime (int n) {
		if (n==2) return true;
		if (n<2 || n%2==0) return false;
		double d = Math.sqrt(n);
		for (int i=3; i<=d; i+=2)if(n%i==0){return false;}
		return true;
	}
	
	
		public static void main(String[] args) {
			Scanner scan=new Scanner(System.in);
			int a=scan.nextInt();
		    int b[]=new int[a];
          int max=0,sec=0;
          for(int i=0;i<a;i++){
            b[i]=scan.nextInt();
            if(max<b[i]){
              sec=max;
              max=b[i];
            }
          }
          for(int i=0i<a;i++){
            if(b[i]==max)System.out.println(sec);
            else System.our.println(max);
          }
		}
}


Compiler output:
Main.java:48: error: ';' expected
          for(int i=0i<a;i++){
                     ^
1 error
Language: C++

#include <bits/stdc++.h> 
using namespace std;
int main()
{
	long long n,i,j,ans1=0,ans2=0;
	cin>>n;
	long long a[n+2],b[n+2];
	for (i=1;i<=n;i++)
	{
		cin>>a[i];
		b[i]=a[i]
	}
	/*for (i=1;i<=n;i++)
	{
		ans1=max(ans1,a[i]);
		if (a[i]!=ans1)
		   ans2=max(ans2,a[i]);
    }*/
    sort(b+1,b+n+1);
    ans1=b[n];
    ans2=b[n-1];
	for (i=1;i<=n;i++)
	{
		if (a[i]!=ans1)
		   cout<<ans1<<endl;
		else
		   cout<<ans2<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:26: error: expected ';' before '}' token
   11 |                 b[i]=a[i]
      |                          ^
      |                          ;
   12 |         }
      |         ~
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:15:33: error: invalid types '<unresolved overloaded function type>[long long int]' for array subscript
   15 |                         ans+=max[a[i],a[j]];
      |                                 ^
Language: C++

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


int main(){
  int N;
  cin>>N;
  vector<int> vec(N);
  vector<int> ans(N);
  for(int i=0; i<N;i++){
    cin>>vec.at(i);
  }
    int max1=0;
    int max2=0;
  //max1
  for(int i=0;i<N;i++){
    if(vec.at(i)>max1){
      max1=vec.at(j);
    }
  }
  //max1
  for(int i=0;i<N;i++){
    if(vec.at(i)>max2 && vec.at(i)!=max1){
      max2=vec.at(i);
    }
  }
  //cout
  for(int i=0;i<N;i++){
    if(vec.ac(i)!=max1){
     cout<<max1<<endl;
    }
    else {
     cout<<max2<<endl;      
    }
  }  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:19: error: 'j' was not declared in this scope
   18 |       max1=vec.at(j);
      |                   ^
a.cc:29:12: error: 'class std::vector<int>' has no member named 'ac'; did you mean 'at'?
   29 |     if(vec.ac(i)!=max1){
      |            ^~
      |            at
Language: C++

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


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


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

#include  <bits/stdc++.h>
using namespace  std
int main()
{
	int n;
	cin>>n;
	vector<int>A(n), pre(n), suf(n);
	for(int i=0; i<n; i++)cin>>A[i];
	if(n==1){cout<<A[0];return 0;}
	int max1=0, max2=0;
	for(int i=0; i<n; i++)
	{
		max1=max(max1, A[i]);
		pre[i]=max1;
	}
	for(int i=n-1; i>=0; i--)
	{
		max2=max(max2, A[i]);
		suf[i]=max2;
	}
	for(int i=0; i<n; i++)
	{
		if(i!=0&&i!=n-1)
		cout<<max(pre[i-1], suf[i+1]);
		else if(i==0)cout<<suf[1];
		else cout<<pre[n-2];
	}
}


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

#include <iostream>
#include <vector>

using namespace std;

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


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

#include<bits/stdc++.h>

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> a(n + 1);
  for(int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  vector<int> b(n + 1), c(n + 2);
  for(int i = 1; i <= n; i++) {
    b[i] = max(a[i], b[i-1]);
  }
  for(int i = n; i; i--) {
    c[i] = max(a[i], c[i+1];
  }
  for(int i = 1; i <= n; i++) {
    cout << max(b[i-1], c[i+1]) << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:28: error: expected ')' before ';' token
   17 |     c[i] = max(a[i], c[i+1];
      |               ~            ^
      |                            )
Language: C++

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

int main(){
    int n,a,m=0,ms=0,im;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a;
        if(a>m){
            m=a;
            im=i+1
        }
        else if(a<=m && a>ms) ms=a;
    }
    for(int i=0;i<n;i++) cout<<(i!=im?m:ms)<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:19: error: expected ';' before '}' token
   11 |             im=i+1
      |                   ^
      |                   ;
   12 |         }
      |         ~
Language: C++

#include<bits/stdc++.h>

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  int max1 = 0, ind = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (max1 < a[i]) {
      max1 = a[i];
      ind = i;
    }
  }
  a.erase(a.begin() + ind);
  for (int i = 0; i < n - 1; i++) {
     if (max2 < a[i]) max2 = a[i];
  }
  for (int i = 0; i < n; i++) {
    if (i != ind) cout << max1 << "\n";
    else cout << max2 << "\n";
  }
}  

Compiler output:
a.cc: In function 'int main()':
a.cc:19:10: error: 'max2' was not declared in this scope; did you mean 'max1'?
   19 |      if (max2 < a[i]) max2 = a[i];
      |          ^~~~
      |          max1
a.cc:23:18: error: 'max2' was not declared in this scope; did you mean 'max1'?
   23 |     else cout << max2 << "\n";
      |                  ^~~~
      |                  max1
Language: C++

#include <stdio.h>

int main(void)
{
    int n;
    int a[200000];
    int i;
    int max = 0;
    int max_2 = 0;
    int *p_1;

    scanf("%d", &n); 

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

    for(i = 0; n > i; i++){
        if(a[j] > max){
            p_1 = &a[i];
            max = a[i];
        }

        if(a[i] > max_2 && &a[i] != p_1){
            max_2 = a[i];
        }
    }

    for(i = 0; n > i; i++){
        if(p_1 != &a[i]){
            printf("%d\n", max);
        }

        else{
            printf("%d\n", max_2);
        }
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:14: error: 'j' was not declared in this scope
   19 |         if(a[j] > max){
      |              ^
Language: C

#include<stdio.h>

int main(){
  int a;
  scanf("%d", &a);
  int[] b = new int[a];
  
  for(int i=0;i<a;i++){
    scanf("%d", &b[i]);
  }
  
  for(int i=0;i<a;i++){
    int ans = 0;
    for(int j=0;j<a-1;j++){
      if(i == j){
        continue;
      }else if(i == j+1){
      }else{
        if(b[j] <= b[j+1]){
          ans = b[j+1]
        }
      }
      printf("%d", ans);
    }
  }
}

Compiler output:
main.c: In function 'main':
main.c:6:6: error: expected identifier or '(' before '[' token
    6 |   int[] b = new int[a];
      |      ^
main.c:9:18: error: 'b' undeclared (first use in this function)
    9 |     scanf("%d", &b[i]);
      |                  ^
main.c:9:18: note: each undeclared identifier is reported only once for each function it appears in
main.c:20:23: error: expected ';' before '}' token
   20 |           ans = b[j+1]
      |                       ^
      |                       ;
   21 |         }
      |         ~
Language: C++

#include <iostream>

using namespace std;

int main()
{
  int i,n,a[200000],max,sec,I,ok;
  cin>>n;
  cin>>a[0];
  max=a[0];
  sec=max;
  for(i=1;i<n;i++)
  {
    cin>>a[i];
    if(a[i]==max)
      ok=0;
    if(a[i]>max)
    {
      max=a[i];
      I=i;
      ok=1;
    }
    else if(a[i]>sec)
      sec=a[0];
  }
  if(ok)
  {
    for(i=0;i<I;i++)
      cout<<max<<endl;
    cout<<sec<<endl;
    for(i=I+1;i<n;i++)
      cout<<max<<endl;
  }
  else
    for(i=0;i<ni++)
      cout<<max<<endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:15: error: 'ni' was not declared in this scope; did you mean 'n'?
   35 |     for(i=0;i<ni++)
      |               ^~
      |               n
a.cc:35:19: error: expected ';' before ')' token
   35 |     for(i=0;i<ni++)
      |                   ^
      |                   ;
Language: C++

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

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){
    int ans = s[0];
    if (s[0] == a[i]) ans = s[1];
    cout << ans << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:10: error: 'n' was not declared in this scope
    9 |   rep(i, n) cin >> a[i];
      |          ^
a.cc:3:45: note: in definition of macro 'rep'
    3 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                                             ^
a.cc:13:10: error: 'n' was not declared in this scope
   13 |   rep(i, n){
      |          ^
a.cc:3:45: note: in definition of macro 'rep'
    3 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                                             ^
Language: C++

#include <bits/stdc++.h>
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){
    int ans = s[0];
    if (s[0] == a[i]) ans = s[1];
    cout << ans << endl;
  }
}


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

#include <stdio.h>

int main(void)
{
    int n;
    int a[200000];
    int i;
    int j;
    int max = 0;
    int max_2 = 0;
    int *max;

    scanf("%d", &n); 

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

    for(i = 0; n > i; i++){
        for(j = 0; n > j; j++){
            if(a[j] > max){
                p_1 = &a[j];
                max = a[j];
            }

            if(a[j] > max_2 && &a[j] != p_1){
                max_2 = a[j];
            }
        }

        if(p_1 != &a[i]){
            printf("%d\n", max);
        }

        else{
            printf("%d\n", max_2);
        }
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:10: error: conflicting declaration 'int* max'
   11 |     int *max;
      |          ^~~
a.cc:9:9: note: previous declaration as 'int max'
    9 |     int max = 0;
      |         ^~~
a.cc:22:17: error: 'p_1' was not declared in this scope
   22 |                 p_1 = &a[j];
      |                 ^~~
a.cc:26:41: error: 'p_1' was not declared in this scope
   26 |             if(a[j] > max_2 && &a[j] != p_1){
      |                                         ^~~
a.cc:31:12: error: 'p_1' was not declared in this scope
   31 |         if(p_1 != &a[i]){
      |            ^~~
Language: C++

include <bits/stdc++.h>
using namespace std;
 
int main(){
	int n;
	vector<int> a;
	
	cin >> n;
	
	int mostLargestNum = 0;
	int secondLargestNum = 0;
	bool largestJuhuku = false;
	for(int i = 0; i < n; i++){
		int input;
		cin >> input;
		a.push_back(input);
		if(input > mostLargestNum){
			secondLargestNum = mostLargestNum;
			mostLargestNum = input;
			largestJuhuku = false;
		}
		if(input > secondLargestNum && input <= mostLargestNum){
			secondLargestNum = input;
		}
	}
	
	for(int i = 0; i < n; i++){
		if(a[i] == mostLargestNum){
			cout << secondLargestNum << endl;
		}else{
			cout << mostLargestNum << endl;
		}
	}
	
	return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:6:9: error: 'vector' was not declared in this scope
    6 |         vector<int> a;
      |         ^~~~~~
a.cc:6:16: error: expected primary-expression before 'int'
    6 |         vector<int> a;
      |                ^~~
a.cc:8:9: error: 'cin' was not declared in this scope
    8 |         cin >> n;
      |         ^~~
a.cc:16:17: error: 'a' was not declared in this scope
   16 |                 a.push_back(input);
      |                 ^
a.cc:28:20: error: 'a' was not declared in this scope
   28 |                 if(a[i] == mostLargestNum){
      |                    ^
a.cc:29:25: error: 'cout' was not declared in this scope
   29 |                         cout << secondLargestNum << endl;
      |                         ^~~~
a.cc:29:53: error: 'endl' was not declared in this scope
   29 |                         cout << secondLargestNum << endl;
      |                                                     ^~~~
a.cc:31:25: error: 'cout' was not declared in this scope
   31 |                         cout << mostLargestNum << endl;
      |                         ^~~~
a.cc:31:51: error: 'endl' was not declared in this scope
   31 |                         cout << mostLargestNum << endl;
      |                                                   ^~~~
Language: C++

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

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

#include <bits/stdc++.h>
using namespace std;
 
int main()
{
const int num=N ;
cin >> N;
int A[num],B[num];
for(int i=0; i<num; i++){
cin >> A[i];
}
A[num] = B[num];
for(int s=0; s<num-1; s++){
  for(int t=s+1; t<num; t++){
    if(B[t]>B[s]){
      int tmp = B[t];
      B[t] = B[s];
      B[s] = tmp;
      }}}

for(int u=0; u<num; u++){
  if(A[u]==B[0]&&B[0]==B[1]){
    cout << B[0] << endl;}
  else if(A[u]==B[0]){
    cout << B[1] << endl;}
  else{
    cout << B[0] << endl;}
  }
  
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:15: error: 'N' was not declared in this scope
    6 | const int num=N ;
      |               ^
a.cc:8:7: error: size of array 'A' is not an integral constant-expression
    8 | int A[num],B[num];
      |       ^~~
a.cc:8:14: error: size of array 'B' is not an integral constant-expression
    8 | int A[num],B[num];
      |              ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main()
{
const int num=N ;
cin >> N;
int A[num],B[num];
for(int i=0; i<num; i++){
cin >> A[i];
}
A[num] = B[num];
for(int s=0; s<num-1; s++){
  for(int t=s+1; t<num; t++){
    if(B[t]>B[s]){
      int tmp = B[t];
      B[t] = B[s];
      B[s] = tmp;
      }}}

for(int u=0; u<num; u++){
  if(A[u]==B[0]&&B[0]==B[1]){
    cout << B[0] << endl;}
  else if(A[u]==B[0]){
    cout << B[1] << endl;}
  else{
    cout << B[0] << endl;}
  
  
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:15: error: 'N' was not declared in this scope
    6 | const int num=N ;
      |               ^
a.cc:8:7: error: size of array 'A' is not an integral constant-expression
    8 | int A[num],B[num];
      |       ^~~
a.cc:8:14: error: size of array 'B' is not an integral constant-expression
    8 | int A[num],B[num];
      |              ^~~
a.cc:31:2: error: expected '}' at end of input
   31 | }
      |  ^
a.cc:5:1: note: to match this '{'
    5 | {
      | ^
Language: C++

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

#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

int main()
{
  int N;
  cin >> N;
  
  int A[N-1];
  for(int i=0;i<N;i++)
    cin >> A[i];
  
  int max=0;
  
  for(int i=0;i<N;i++){
    int B=A[i];
    A[i]=0;
    
    sort(A,A+size_of_array(A));
    max=A[N-1];
    
    cout << max << endl;
    
    max=0;
    A[i]=B;
  }
  
  return 0;
 
}


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

#include <iostream>
using namespace std;

int N;

int main(){
  cin >> N;
  int a[N];
  for (int i=0;i<N;++i) cin >> A[i];
  int max = 0;
  int i_max = 0;
  int max2 = 0;
  int i_max2 = 0;
  
  for (int k=0;k<N;++k){

    if (max < A[k]) {
      max2 = max;
      max = A[k];
      i_max = k;
    }else if (A[k] > max2) {
      max2 = A[k];
      i_max2 = k;
    }
  }
  for (int j=0;j<N;++j){
    if (j == i_max) {
      cout << max2 << endl;
    } else {
      cout << max << endl;
      }
  }   
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:32: error: 'A' was not declared in this scope
    9 |   for (int i=0;i<N;++i) cin >> A[i];
      |                                ^
a.cc:17:15: error: 'A' was not declared in this scope
   17 |     if (max < A[k]) {
      |               ^
Language: C++

#include<iostream>
using namespace std;

int main()
{
  int N;
  cin >> N;
  
  int A[N-1];
  for(int i=0;i<N;i++)
    cin >> A[i];
  
  int max=0;
  
  for(int i=0;i<N;i++){
    int B=A[i];
    A[i]=0;
    
    sort(A,A+size_of_array(A));
    max=A[N-1];
    
    cout << max << endl;
    
    max=0;
    A[i]=B;
  }
  
  return 0;
 
}

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

#include <bits/stdc++.h>
using namespace std;
 
int main()
{
int N;
cin >> N;
const int N ;
int A[N],B[N];
for(int i=0; i<N; i++){
cin >> A[i];
}
A[N] = B[N];
for(int s=0; s<N-1; s++){
  for(int t=s+1; t<N; t++){
    if(B[t]>B[s]){
      int tmp = B[t];
      B[t] = B[s];
      B[s] = tmp;
      }}}

for(int u=0; u<N; u++){
  if(A[u]==B[0]&&B[0]==B[1]){
    cout << B[0] << endl;}
  else if(A[u]==B[0]){
    cout << B[1] << endl;}
  else{
    cout << B[0] << endl;}
  
  
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:11: error: conflicting declaration 'const int N'
    8 | const int N ;
      |           ^
a.cc:6:5: note: previous declaration as 'int N'
    6 | int N;
      |     ^
a.cc:32:2: error: expected '}' at end of input
   32 | }
      |  ^
a.cc:5:1: note: to match this '{'
    5 | {
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main()
{
int N;
cin >> N;
const int N ;
int A[N],B[N];
for(int i=0; i<N i++){
cin >> A[i];
}
A[N] = B[N];
for(int s=0; s<N-1; s++){
  for(int t=s+1; t<N; t++){
    if(B[t]>B[s]){
      int tmp = B[t];
      B[t] = B[s];
      B[s] = tmp;
      }}}

for(int u=0; u<N; u++){
  if(A[u]==B[0]&&B[0]==B[1]){
    cout << B[0] << endl;}
  else if(A[u]==B[0]){
    cout << B[1] << endl;}
  else{
    cout << B[0] << endl;}
  
  
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:11: error: conflicting declaration 'const int N'
    8 | const int N ;
      |           ^
a.cc:6:5: note: previous declaration as 'int N'
    6 | int N;
      |     ^
a.cc:10:17: error: expected ';' before 'i'
   10 | for(int i=0; i<N i++){
      |                 ^~
      |                 ;
a.cc:32:2: error: expected '}' at end of input
   32 | }
      |  ^
a.cc:5:1: note: to match this '{'
    5 | {
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main()
{
int N;
cin >> N;
const int N ;
int A[N],B[N];
for(int i=0; i<N i++){
cin >> A[i];
}
A[N] = B[N];
for(int s=0; s<N-1; s++){
  for(int t=s+1; t<N; t++){
    if(B[t]>B[s]){
      int tmp = B[t];
      B[t] = B[s];
      B[s] = tmp;
      }}}

for(int u=0; u<N; u++){
  if(A[u]==B[0]&&B[0]=B[1]){
    cout << B[0]} << endl;
  else if(A[u]==B[0]){
    cout << B[1] << endl;}
  else{
    cout << B[0] << endl;}
  
  
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:11: error: conflicting declaration 'const int N'
    8 | const int N ;
      |           ^
a.cc:6:5: note: previous declaration as 'int N'
    6 | int N;
      |     ^
a.cc:10:17: error: expected ';' before 'i'
   10 | for(int i=0; i<N i++){
      |                 ^~
      |                 ;
a.cc:23:16: error: lvalue required as left operand of assignment
   23 |   if(A[u]==B[0]&&B[0]=B[1]){
      |      ~~~~~~~~~~^~~~~~
a.cc:24:17: error: expected ';' before '}' token
   24 |     cout << B[0]} << endl;
      |                 ^
      |                 ;
a.cc:24:19: error: expected primary-expression before '<<' token
   24 |     cout << B[0]} << endl;
      |                   ^~
a.cc:25:3: error: 'else' without a previous 'if'
   25 |   else if(A[u]==B[0]){
      |   ^~~~
a.cc:32:2: error: expected '}' at end of input
   32 | }
      |  ^
a.cc:5:1: note: to match this '{'
    5 | {
      | ^
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int l, N, i=0;
  cin >> N;
  int vec[N];
  int g_max = 0;
  int max = 0;
  int sec_index = 0;
  int sec_max = 0;
  while(cin >> l){
    vec[i] = l;
    if (max < l){
      max = l;
      g_max = i;
    } else {
      if (sec_max < l){
        sec_max = l;
    }
    
    i++;
  }

  for(i = 0; i < N; i++){
    max = 0;
    if(i == g_max){
      max = sec_max;
    } else {
      max = vec[g_max];
    }
    cout << max << "\n";
  }
}

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

#include <iostream>
#include <algorithm>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int l, N, i=0;
  cin >> N;
  int vec[N];
  int g_max = 0;
  int max = 0;
  int sec_index = 0;
  int sec_max = 0;
  while(cin >> l){
    vec[i] = l;
    if (max < l){
      sec_max = max;
      sec_index = g_max;
      max = l;
      g_max = i;
    }
    i++;
  }

  for(i = 0; i < N; i++){
    max = 0;
    if(i == g_max){
      max = vec_[sec_index];
    } else {
      max = vec[g_max];
    }
    cout << max << "\n";
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:13: error: 'vec_' was not declared in this scope; did you mean 'vec'?
   28 |       max = vec_[sec_index];
      |             ^~~~
      |             vec
Language: C++

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


int main(void){

  int buff;
  int n;

  vector<int> seq;
  cin >> n;

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

    seq.push_back(buff);
  }
  int indent = *max_element(seq.begin(),seq.end());
  sort(seq.begin(),seq.end());

  for(i = 0; i< n;i++)
    {
      if(indent != seq[i])
        cout << indent << '\n';

      cout << seq[1] << '\n';
    }
  cout << endl;
  return 0;    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:17: error: 'max_element' was not declared in this scope
   20 |   int indent = *max_element(seq.begin(),seq.end());
      |                 ^~~~~~~~~~~
a.cc:21:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   21 |   sort(seq.begin(),seq.end());
      |   ^~~~
      |   short
a.cc:23:7: error: 'i' was not declared in this scope
   23 |   for(i = 0; i< n;i++)
      |       ^
Language: C++

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

int main()
{
  int a;
  cin>>a;
  int c=0;
  int d=0;
  int b[a-1]={0};
  for(int i=0;i<a;i++){
    cin>>b[i];
  }
  for(int j=0;j<a;j++){
      c=max(b[j],c);
  }
  for(int k=0;k<a;k++){
    if(b[k]==c){
      continue;
    }
    d=max(b[k],d);
  }
  for(int l=0;l<a;l++){
    if(b[l]==c){
      cout<<d<<endl;
    }
    else if(){
      cout<<c<<endl;
    }
  }
}
    
  
    
    
    
    
    

Compiler output:
a.cc: In function 'int main()':
a.cc:28:13: error: expected primary-expression before ')' token
   28 |     else if(){
      |             ^
Language: C++

#include <bits/stdc++.h>
#include <iostream>
#include <vector>
int main() {
	int N, i,j;
	std::cin >> N;
	int Y[N];
	std::vector<int> X(N);
	for (i = 0; i<N; i++) {
		std::cin >> X[i];
	}
	for (i = 0; i<N; i++) {
		j = X[i];
		X[i] = 0;
		Y[i] = *std::max_element(X.begin(), X.end());
		X[i] = j;
		std::cout << Y[i] << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:38: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   17 |                 std::cout << Y[i] << endl;
      |                                      ^~~~
      |                                      std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
                 from a.cc:1:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C

#include<stdio.h>
int max(int data[]){
  int j;
  int no_1 = data[0];
  int no_2;
  for(j=0;j<200001;j++){
    if(no_1 < number[j]){
        no_2=no_1;
        no_1=data[j];
    }else if(no_2 < data[j]){
        no_2=data[j];
    }
  }
}
int main(){
  int a;
  int b[300000];
  int i;
  scanf("%d",&a);
  for(i=0;i<=a-1;i++){
    scanf("%d", &b[i]);
  }
  int Max = max(b);
  for(i=0;i<=a-1;i++){
    if(Max != b[i]){
      printf("%d", Max);
    }else{
      printf("%d", Max);
    }
  }
}

Compiler output:
main.c: In function 'max':
main.c:7:15: error: 'number' undeclared (first use in this function)
    7 |     if(no_1 < number[j]){
      |               ^~~~~~
main.c:7:15: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
int main (void)
{
  int n = 0; 
  int a = 0;　
  int b = 0;
  int i = 0;
  int hai[250000];
  int max = 0;
  
  max = hai[0];
  
  scanf("%d",&n);
  
  for(a=1;a <= n;a++){
    scanf("%d",&b);
    hai[a]=b;
  }
  for(i=1;i<=n;i++){
    hai[250000]-=hai[i];
     for(a=1;a <= n-1;a++){
       if(hai[a]>max){
         max=hai[a];
       }
     }
  }
  return 0;
}
  

Compiler output:
main.c: In function 'main':
main.c:5:13: error: stray '\343' in program
    5 |   int a = 0;<U+3000>
      |             ^~~~~~~~
Language: C++

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

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

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


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

#include<stdio.h>
int max(int data[]){
  int j;
  int no_1 = data[0];
  int no_2;
  for(j=0;j<200001;j++){
    if(no_1 < number[j]){
        no_2=no_1;
        no_1=data[j];
    }else if(no_2 < data[j]){
        no_2=data[j];
    }
  }
}
int main(){
  int a;
  int b[300000];
  int i;
  scanf("%d",&a);
  for(i=0;i<=a-1;i++){
    scanf("%d", &b[i]);
  }
  int Max = max(b);
  for(i=0;i<=a-1;i++){
    if(Max |= b[i]){
      printf("%d", Max);
    }else{
      
    }
  }
}

Compiler output:
main.c: In function 'max':
main.c:7:15: error: 'number' undeclared (first use in this function)
    7 |     if(no_1 < number[j]){
      |               ^~~~~~
main.c:7:15: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <bits/stdc++.h>
#include <iostream>
#include <vector>
int main() {
	int N, i;
	std::cin >> N;
	std::vector<int> X(N);
	for (i = 0; i<N; i++) {
		std::cin >> X[i];
	}
	for (i = 0; i<N; i++) {
		j = X[i];
		X[i] = 0;
		cout << *std::max_element(X.begin(), X.end())  << endl;
		X[i] = j;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:17: error: 'j' was not declared in this scope
   12 |                 j = X[i];
      |                 ^
a.cc:14:17: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   14 |                 cout << *std::max_element(X.begin(), X.end())  << endl;
      |                 ^~~~
      |                 std::cout
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:14:67: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   14 |                 cout << *std::max_element(X.begin(), X.end())  << endl;
      |                                                                   ^~~~
      |                                                                   std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C

#include<stdio.h>
int main(void){
	int n,a[],max,i,j;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	for(i=0;i<n;i++){
		max=-1;
		for(j=0;j<n;J++){
			if(!a[i]){
				if(max>a[j]){
					max=a[j];
				}
			}
		}
		printf("%d\n",max);
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:3:15: error: array size missing in 'a'
    3 |         int n,a[],max,i,j;
      |               ^
main.c:10:29: error: 'J' undeclared (first use in this function)
   10 |                 for(j=0;j<n;J++){
      |                             ^
main.c:10:29: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <stdio.h>

int main(int argc, char const *argv[])
{
    int N;
    scanf("%d", &N);
    int array[N];
    for(int i=0; i<N; i++) {
        scanf("%d", &array[i]);
    }
    int index1, index2, index3;
    int max, sec, th = 0;
    for(int i=0; i<N; i++) {
        if(max<=array[i]) {
            max = array[i];
            index1 = i;
        }
    }
    for(int i=0; i<N; i++) {
        if(sec <= array[i] && i != index1) {
            sec = array[i];
            index2 = i;
        }
    }
    for(int =0; i<N; i++) {
        if(th <= array[i] && i != index1 && index3 != i)
        {
            th = array[i];
            index3 = th;
        }
    }
    for(int i=0; i<N; i++) {
        if(index1 == i) {
            printf("%d\n", sec);
        }
        else if(index2 == i){
            printf("%d\n", th);
        }
        else {
            printf("%d\n", max);
        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:25:13: error: expected unqualified-id before '=' token
   25 |     for(int =0; i<N; i++) {
      |             ^
a.cc:25:12: error: expected ';' before '=' token
   25 |     for(int =0; i<N; i++) {
      |            ^~
      |            ;
a.cc:25:13: error: expected primary-expression before '=' token
   25 |     for(int =0; i<N; i++) {
      |             ^
a.cc:25:17: error: 'i' was not declared in this scope
   25 |     for(int =0; i<N; i++) {
      |                 ^
a.cc:25:20: error: expected ')' before ';' token
   25 |     for(int =0; i<N; i++) {
      |        ~           ^
      |                    )
a.cc:25:22: error: 'i' was not declared in this scope
   25 |     for(int =0; i<N; i++) {
      |                      ^
Language: Java

import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
Integer a[] = new Integer[N];
Integer b[] = new Integer[N];
for(int i=0;i<N;i++){
a[i]= sc.nextint();
b[i]= a[i];
}
Arrays.sort(a, Comparator.reverseOrder());
for(int i=0;i<N;i++){
if(a[0]==b[i]){
System.out.println(a[1]+"¥n");
}else{
System.out.println(a[0]+"¥n");
}
}
}
}

Compiler output:
Main.java:9: error: cannot find symbol
a[i]= sc.nextint();
        ^
  symbol:   method nextint()
  location: variable sc of type Scanner
1 error
Language: C

#include <stdio.h>

void swap(int *swapa, int *swapb);
void quick_sort(int b[], int left, int right);

int main() {
  int a[200000], n;
  scanf("%d", &n);
  for(int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for(int i = 0; i < n; i++) {
    quick_sort(a, 0, n - 1);
    printf("%d", a[n - 1]);
  }
  return 0;
}

void swap(int *swapa, int *swapb) {
  int temp;
  temp = *swapa;
  *swapa = *swapb;
  *swapb = temp;
}

void quick_sort(int b[], int left, int right) {
  int lp, rp, mid;
  mid = b[left];
  lp = left;
  rp = right;

  while(lp < rp) {
    while (b[lp] <= mid && lp <= rp) {
      lp++;
    }
    while (mid < b[rp] && lp <= rp) {
      rp--;
    }
  }
  if (lp < rp) {
    swap(&b[lp], &b[rp]);
  }
  swap(&b[left], &b[rp]);
  if(left < rp - 1) {
    quick_sort(b, left, rp - 1);
  }
  if (rp + 1 < right) {
    quick_sort(d, rp + 1, right);
  }
}


Compiler output:
main.c: In function 'quick_sort':
main.c:48:16: error: 'd' undeclared (first use in this function)
   48 |     quick_sort(d, rp + 1, right);
      |                ^
main.c:48:16: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>

void swap(int *swapa, int *swapb);
void quick_sort(int b[], int left, int right);

int main() {
  int a[200000], n;
  scanf("%d", &n);
  for(int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for(int i = 0; i < n; i++) {
    quick_sort(a, 0, n - 1);
    printf("%d", a[n - 1]);
  }
  return 0;
}

void swap(int *swapa, int *swapb) {
  int temp;
  temp = *swapa;
  *swapa = *swapb;
  *swapb = temp;
}

void quick_sort(int b[], int left, int right) {
  int lp, rp, mid;
  mid = d[left];
  lp = left;
  rp = right;

  while(lp < rp) {
    while (b[lp] <= mid && lp <= rp) {
      lp++;
    }
    while (mid < b[rp] && lp <= rp) {
      rp--;
    }
  }
  if (lp < rp) {
    swap(&b[lp], &b[rp]);
  }
  swap(&b[left], &b[rp]);
  if(left < rp - 1) {
    quick_sort(b, left, rp - 1);
  }
  if (rp + 1 < right) {
    quick_sort(d, rp + 1, right);
  }
}

Compiler output:
main.c: In function 'quick_sort':
main.c:28:9: error: 'd' undeclared (first use in this function)
   28 |   mid = d[left];
      |         ^
main.c:28:9: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int l, N, i=0;
  cin >> N;
  int vec[N];
  while(cin >> l){
    vec[i] = l;
    i++;
  }
  int max = 0;
  
  for(i = 0; i < N; i++){
    max = 0
    for (int j = 0; j < N; j++){
      if(max < vec[j] && i != j){
        max = vec[j];
      }
    }
    cout << max << "\n";
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:12: error: expected ';' before 'for'
   17 |     max = 0
      |            ^
      |            ;
   18 |     for (int j = 0; j < N; j++){
      |     ~~~     
a.cc:18:21: error: 'j' was not declared in this scope
   18 |     for (int j = 0; j < N; j++){
      |                     ^