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

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.PriorityQueue;


public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(br.readLine());
		
		int[] input = new int[n];
		
		String[] tmpArray = br.readLine().split(" ");
		
		for(int i = 0; i < n; i++){
			input[i] = Integer.parseInt(tmpArray[i]);
		}
		
		int[] inputClone = Arrays.copyOf(input, n);
		
		Arrays.sort(inputClone);
		
		int med = n/2;
		
		for(int i = 0; i < n; i++){
			if(input[i] < inputClone[med]){
				System.out.println(inputClone[med]);
			}
			else {
				System.out.println(inputClone[med - 1]);
			}
		}
	}

}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.io.BufferedReader;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.io.IOException;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import java.io.InputStreamReader;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
    4 | import java.util.ArrayList;
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: 'import' does not name a type
    5 | import java.util.Arrays;
      | ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: 'import' does not name a type
    6 | import java.util.Comparator;
      | ^~~~~~
a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:1: error: 'import' does not name a type
    7 | import java.util.PriorityQueue;
      | ^~~~~~
a.cc:7:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:10:1: error: expected unqualified-id before 'public'
   10 | public class Main {
      | ^~~~~~
Language: C

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <bitset>
#include <climits>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define RFOR(i,a,b) for (int i=(a)-1;i>=(b);i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int INF = 1e9;
const ll LL_INF = 1e18;
const int MOD = 1e9 + 7;

using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  pair<int, int> x[200005];
  REP(i,N){
    cin >> x[i].first;
    x[i].second = i;
  }
  sort(x, x + N);
  int f = x[N/2 - 1].first;
  int s = x[N/2].first;
  REP(i,N){
    if(i >= N/2){
      x[i].first = f;
    }else{
      x[i].first = s;
    }
  }
  sort(x, x + N, [](const pair<int, int>& a, const pair<int,int>& b){
      return a.second < b.second;});
  REP(i,N){
    cout << x[i].first << endl;
  }
  return 0;
}


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

1. #include<iostream>
2. using namespace std;
3. int X,Y,S;
4. int tax(int Z, int k){
5.     return Z*(100+k)/100;
6. }
7. void solve(){
8.     int maximum;
9.     for(int i=1;i<S;i++){
10.         for(int j=i;j<S;j++){
11.             if(tax(X,i)+tax(X,j)==S)maximum=max(maximum, tax(Y,i)+tax(Y,j));
12.         }
13.     }
14.     cout<<maximum<<endl;
15. }
16.   

1.   
2. int main(){
3.     while(cin>>X>>Y>>S && X>0){
4.         solve();
5.     }
6.     return 0;
7. }


Compiler output:
a.cc:1:4: error: stray '#' in program
    1 | 1. #include<iostream>
      |    ^
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 1. #include<iostream>
      | ^~
a.cc:3:1: error: expected unqualified-id before numeric constant
    3 | 3. int X,Y,S;
      | ^~
a.cc:4:1: error: expected unqualified-id before numeric constant
    4 | 4. int tax(int Z, int k){
      | ^~
a.cc:7:1: error: expected unqualified-id before numeric constant
    7 | 7. void solve(){
      | ^~
a.cc:16:1: error: expected unqualified-id before numeric constant
   16 | 16.
      | ^~~
Language: C++

#include<iostream>
using namespace std;
void solve(){
    int maximum;
    for(int i=1;i<S;i++){
        for(int j=i;j<S;j++){
            if(tax(X,i)+tax(X,j)==S)maximum=max(maximum, tax(Y,i)+tax(Y,j));
        }
    }
    cout<<maximum<<endl;
}
  
int tax(int Z, int k){
    return Z*(100+k)/100;
}
  
int main(){
    int X,Y,S;
    while(cin>>X>>Y>>S && X>0){
        solve();
    }
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:5:19: error: 'S' was not declared in this scope
    5 |     for(int i=1;i<S;i++){
      |                   ^
a.cc:7:20: error: 'X' was not declared in this scope
    7 |             if(tax(X,i)+tax(X,j)==S)maximum=max(maximum, tax(Y,i)+tax(Y,j));
      |                    ^
a.cc:7:16: error: 'tax' was not declared in this scope
    7 |             if(tax(X,i)+tax(X,j)==S)maximum=max(maximum, tax(Y,i)+tax(Y,j));
      |                ^~~
a.cc:7:62: error: 'Y' was not declared in this scope
    7 |             if(tax(X,i)+tax(X,j)==S)maximum=max(maximum, tax(Y,i)+tax(Y,j));
      |                                                              ^
Language: C++

#include<iostream>
using namespace std;
void solve(){
    int maximum;
    for(int i=1;i<S;i++){
        for(int j=i;j<S;j++){
            if(tax(X,i)+tax(X,j)==S)maximum=max(maximum, tax(Y,i)+tax(Y,j));
        }
    }
    cout<<maximum<<endl;
}
  
int tax(int Z, int k){
    return Z*(100+k)/100
}
  
int main(){
    int X,Y,S;
    while(cin>>X>>Y>>S && X>0){
        solve();
    }
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:5:19: error: 'S' was not declared in this scope
    5 |     for(int i=1;i<S;i++){
      |                   ^
a.cc:7:20: error: 'X' was not declared in this scope
    7 |             if(tax(X,i)+tax(X,j)==S)maximum=max(maximum, tax(Y,i)+tax(Y,j));
      |                    ^
a.cc:7:16: error: 'tax' was not declared in this scope
    7 |             if(tax(X,i)+tax(X,j)==S)maximum=max(maximum, tax(Y,i)+tax(Y,j));
      |                ^~~
a.cc:7:62: error: 'Y' was not declared in this scope
    7 |             if(tax(X,i)+tax(X,j)==S)maximum=max(maximum, tax(Y,i)+tax(Y,j));
      |                                                              ^
a.cc: In function 'int tax(int, int)':
a.cc:14:25: error: expected ';' before '}' token
   14 |     return Z*(100+k)/100
      |                         ^
      |                         ;
   15 | }
      | ~
Language: Java

//  2018/4/15

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

public class atcode {
  public static void main(String[] args) {

    Scanner  sc = new Scanner(System.in);

    System.out.print("Nを入力：");
    int n = sc.nextInt();
    int[] nums = new int[n];

    for(int i = 0; i < nums.length; i++) {
      nums[i] = sc.nextInt();
    }

    def(n, nums);
  }

  public static void def(int n, int[] nums) {
    int nx = n-1;
    int count;
    int[] ce;

    for(int i = 0; i < n; i++) {
      ce = new int[nx];
      count = nx-1;
      for(int l = 0; l < n; l++) {
        if(l != i) {
		      ce[count--] = nums[l];
        }
      }

      Arrays.sort(ce);
      if (nx % 2 != 0) {
        System.out.println(ce[nx/2]);
      } else {
        System.out.println(ce[nx-1/2]);
      }
    }

  }
}


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

#include <bits/stdc++.h>
#include <NTL/ZZ.h>
using namespace std;
using namespace NTL;
typedef long long ll;
const int inf = 2147483647;

const int maxn = 1e5 + 7;
int n;
int a[maxn];
int main() {
  int n;
  scanf("%d", &n);
  int best = 0, id = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    if (a[i] > best) {
      best = a[i];
      id = i;
    }
  }
  int second = a[1];
  if (id == 1) second = a[2];
  for (int i = 2; i <= n; i++) {
    if (min(a[i], best - a[i]) > min(second, best - second)) second = a[i];
  }
  printf("%d %d\n", best, second);
  return 0;
}



Compiler output:
a.cc:2:10: fatal error: NTL/ZZ.h: No such file or directory
    2 | #include <NTL/ZZ.h>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long> v(n);
  for(int i=0;i<n;i++)
    cin >> v[i];
  ll m = n/2;
  for(int i=0;i<n;i++) {
    if(v[i] <=v[m])
      cout << v[m-1] << endl;
    else
      cout << v[m] << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: 'll' was not declared in this scope
    9 |   ll m = n/2;
      |   ^~
a.cc:11:17: error: 'm' was not declared in this scope
   11 |     if(v[i] <=v[m])
      |                 ^
Language: C++

#include<cstdio>
#include<iostream>
#include<map>
#include<algorithm>
#include<set>
using namespace std;
int main()
{
    int n,i,j,k,num[200005],num1[200005];
    cin>>n;
    for(i=1;i<=n;i++)scanf("%d",&num[i]);
    memcpy(num1,num,sizeof(num));sort(num+1,num+1+n);
    for(i=1;i<=n;i++){
        int pos=lower_bound(num+1,num+1+n,num1[i])-num;
        if(pos<=n/2)cout<<num[n/2+1]<<endl;
        else cout<<num[n/2]<<endl;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'memcpy' was not declared in this scope
   12 |     memcpy(num1,num,sizeof(num));sort(num+1,num+1+n);
      |     ^~~~~~
a.cc:6:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include<set>
  +++ |+#include <cstring>
    6 | using namespace std;
Language: C++

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

int h, w;
char s[13][13];
char ns[13][13];

int p[13];
bool used[13];

bool finished;

void check(){
	for(int i=1; i<=h; i++)
		for(int j=1; j<=w; j++)
			ns[i][j] = s[i][p[j]];


	int cnt=0;
	int chk = 0;
	for(int i=1; i<=h; i++){
		if(chk & (1<<i)) continue;
		bool found=false;
		for(int j=i+1; j<=h; j++){
			if(chk & (1<<j)) continue;
			bool flag=true;
			for(int k=1, l=w; k<=w; k++, l--)
				if(ns[i][k] != ns[j][l]){
					flag=false;
					break;
				}
			if(flag){
				found=true;
				check |= (1<<i);
				check |= (1<<j);
				break;
			}
		}
		if(!found) cnt++;
		if((h%2==0 && cnt>0) || (h%2==1 && cnt>1)) return;
	}
	finished = true;
}

void backtrack(int now, int val, int cnt){
	for(int i=val+1; i<=w; i++){
		if(used[i]) continue;
		used[i]=true;
		p[now]=i;

		if(cnt == w){ /// end condition
			check();
		}
		else if(cnt&1) backtrack(w+1-now, i, cnt+1);
		else backtrack(w+2-now, 0, cnt+1);

		used[i]=false;

		if(finished) return;
	}
	return;
}

int main(){
	scanf("%d %d", &h, &w);
	for(int i=1; i<=h; i++){
		scanf("\n");
		for(int j=1; j<=w; j++)
			scanf("%c", &s[i][j]);
	}
	backtrack(1, 0, 1);
	puts(finished?"YES":"NO");
	return 0;
}


Compiler output:
a.cc: In function 'void check()':
a.cc:35:39: error: invalid operands of types 'void()' and 'int' to binary 'operator|'
   35 |                                 check |= (1<<i);
      |                                 ~~~~~~^~~~~~~~~
a.cc:35:39: note:   in evaluation of 'operator|=(void(), int)'
a.cc:36:39: error: invalid operands of types 'void()' and 'int' to binary 'operator|'
   36 |                                 check |= (1<<j);
      |                                 ~~~~~~^~~~~~~~~
a.cc:36:39: note:   in evaluation of 'operator|=(void(), int)'
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n,a;
vector<pair<int,int> >V;
int index[234567];
int fix(int k){
	if(k<=(n/2))return V[n/2+1].first;
	else return V[n/2].first;
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n;
	V.push_back({-1,-1});
	for(int i=1;i<=n;i++){
		cin>>a;
		V.push_back({a,i});
	}
	sort(V.begin(),V.end());
	for(int i=1;i<=n;i++){
		index[V[i].second]=fix(i);
	}
	for(int i=1;i<=n;i++)cout<<index[i]<<endl;
	return 0;
}

Compiler output:
a.cc:5:17: error: 'int index [234567]' redeclared as different kind of entity
    5 | int index[234567];
      |                 ^
In file included from /usr/include/string.h:462,
                 from /usr/include/c++/14/cstring:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
                 from a.cc:1:
/usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)'
   50 | extern const char *index (const char *__s, int __c)
      |                    ^~~~~
a.cc: In function 'int main()':
a.cc:22:22: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   22 |                 index[V[i].second]=fix(i);
      |                      ^
a.cc:24:41: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   24 |         for(int i=1;i<=n;i++)cout<<index[i]<<endl;
      |                                         ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
	int a,b;
	cin>>a;
	int x[20000];
	for(int i=0;i<a;i++){
		cin>>x[i];
	}
	if(a==2)cout<<2<<" "1<<" ";
	if(a==4)cout<<"2 4 4 3";
	if(a==6)cout<<"4 4 4 4 4 4";
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:29: error: expected ';' before numeric constant
   10 |         if(a==2)cout<<2<<" "1<<" ";
      |                             ^
      |                             ;
Language: C++

#include<iostream>
using namespace std;
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);
    int m1=b[n/2-1],m2=b[n/2];
    for(int i=0;i<n;i++)
    {
        if(a[i]<=m1)cout<<m2<<endl;
        else cout<<m1<<endl;
    }
    return 0;
}

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

import java.util.*;
public class Main{

  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    long[] X = new long[N+10];
    long[] copy = new long[N+10];
    for(int i =1;i<=N;i++){
      X[i] = sc.nextLong();
      copy[i] = X[i];
    }
    quickSort(X,1,N);
    long C1 = X[N/2];
    long C2 = X[N/2+1];

    for(int i =1;i<=N;i++){
      if(copy[i]<=C1){
        System.out.println(C2);
      }else if(copy[i]>=C2){
      System.out.println(C1);
      }
    }
    sc.close();
  }
  
 public static void quickSort(long[] array, int left, int right) {
        int curleft = left;
        int curright = right;
        long pivot = array[(curleft + curright) / 2];
        
        do {
            while (array[curleft] < pivot) {
                curleft++;
            }
            
            while (array[curright] > pivot) {
                curright--;
            }
            if (curleft <= curright) {
                swap (array, curleft++, curright--);
            }
        } while (curleft <= curright);
        
        if (left < curright) {
            quickSort(array, left, curright);
        }
        
        if (curleft < right) {
            quickSort(array, curleft, right);
        }
    }
    
    private static void swap (long[] array, int idx1, int idx2) {
        long tmp = array[idx1];
        array[idx1] = array[idx2];
        array[idx2] = tmp;
    }
}


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: expected unqualified-id before 'public'
    2 | public class Main{
      | ^~~~~~
Language: C++

#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cmath>
#include<cstdio>
#include<time.h>
#include<vector>
#include<cstring>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
#define R register
#define LL long long
using namespace std;
const int N=1e5+10;
const int mod=1e9+7;
const int inf=0x3f3f3f3f;

int n,a[N];

namespace FastIO {
	template<typename tp> inline void read(tp &x) {
		x=0; register char c=getchar(); register bool f=0;
		for(;c<'0'||c>'9';f|=(c=='-'),c = getchar());
		for(;c>='0'&&c<='9';x=(x<<3)+(x<<1)+c-'0',c = getchar());
		if(f) x=-x;
	}
	template<typename tp> inline void write(tp x) {
	  if (x==0) return (void) (putchar('0'));
     if (x<0) putchar('-'),x=-x;
     int pr[20]; register int cnt=0;
     for (;x;x/=10) pr[++cnt]=x%10;
     while (cnt) putchar(pr[cnt--]+'0');
	}
	template<typename tp> inline void writeln(tp x) {
		write(x);
		putchar('\n');
	}
}
using namespace FastIO;

int main() {
	read(n);
	for (int i=1;i<=n;i++) read(a[i]);
	sort(a+1,a+n+1);
	double mid=1.0*a[n]/2;
	int ans=-1;
	for (int i=1;i<n;i++) {
		if (abs(a[i]-mid)<abs(ans-mid)) ans=a[i];
	}
	cout<<a[n]<<' '<<8ans;
	return 0;
}

Compiler output:
a.cc: In function 'void FastIO::read(tp&)':
a.cc:24:36: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   24 |                 x=0; register char c=getchar(); register bool f=0;
      |                                    ^
a.cc:24:63: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   24 |                 x=0; register char c=getchar(); register bool f=0;
      |                                                               ^
a.cc: In function 'void FastIO::write(tp)':
a.cc:32:31: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   32 |      int pr[20]; register int cnt=0;
      |                               ^~~
a.cc: In function 'int main()':
a.cc:52:26: error: unable to find numeric literal operator 'operator""ans'
   52 |         cout<<a[n]<<' '<<8ans;
      |                          ^~~~
a.cc: In instantiation of 'void FastIO::read(tp&) [with tp = int]':
a.cc:44:6:   required from here
   44 |         read(n);
      |         ~~~~^~~
a.cc:24:36: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   24 |                 x=0; register char c=getchar(); register bool f=0;
      |                                    ^
a.cc:24:63: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   24 |                 x=0; register char c=getchar(); register bool f=0;
      |                                                               ^
Language: C++

int a[200000];
int b[200000];
int main()
{
	Ill(n);
	for (int i = 0; i < n; ++i)
	{
		scanf("%d", &a[i]);
	}
	for (int i = 0; i < n; ++i)
	{
		b[i] = a[i];
	}
	sort(a, a + n);
	ll t = a[n / 2];
	ll tt = a[n / 2-1];
	for (int i = 0; i < n; ++i)
	{
		if(b[i]<t)std::cout << t <<"\n";
		else { std::cout << tt << "\n"; }
	}

}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:13: error: 'n' was not declared in this scope
    5 |         Ill(n);
      |             ^
a.cc:5:9: error: 'Ill' was not declared in this scope
    5 |         Ill(n);
      |         ^~~
a.cc:8:17: error: 'scanf' was not declared in this scope
    8 |                 scanf("%d", &a[i]);
      |                 ^~~~~
a.cc:14:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   14 |         sort(a, a + n);
      |         ^~~~
      |         short
a.cc:15:9: error: 'll' was not declared in this scope
   15 |         ll t = a[n / 2];
      |         ^~
a.cc:16:11: error: expected ';' before 'tt'
   16 |         ll tt = a[n / 2-1];
      |           ^~~
      |           ;
a.cc:19:25: error: 't' was not declared in this scope
   19 |                 if(b[i]<t)std::cout << t <<"\n";
      |                         ^
a.cc:19:32: error: 'cout' is not a member of 'std'
   19 |                 if(b[i]<t)std::cout << t <<"\n";
      |                                ^~~~
a.cc:1:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | int a[200000];
a.cc:20:29: error: 'cout' is not a member of 'std'
   20 |                 else { std::cout << tt << "\n"; }
      |                             ^~~~
a.cc:20:29: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:20:37: error: 'tt' was not declared in this scope
   20 |                 else { std::cout << tt << "\n"; }
      |                                     ^~
Language: C++

#include <iostream>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <iterator>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> a, b;
    int x;
    for(int i=0;i<n;i++){
        cin >> x;
        a.push_back(x);
    }
    copy(a.begin(), a.end(), back_inserter(b));
    sort(b.begin(), b.end());
    int left = b[n/2-1], right = b[n/2];
    
    for(int i=0;i<n;i++){
        if(a[i]<=left){
            cout << right << endl;
        } else {
            cout << left << endl;
        }
    }
}



Compiler output:
a.cc: In function 'int main()':
a.cc:13:5: error: 'vector' was not declared in this scope
   13 |     vector<int> a, b;
      |     ^~~~~~
a.cc:6:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    5 | #include <iterator>
  +++ |+#include <vector>
    6 | 
a.cc:13:12: error: expected primary-expression before 'int'
   13 |     vector<int> a, b;
      |            ^~~
a.cc:17:9: error: 'a' was not declared in this scope
   17 |         a.push_back(x);
      |         ^
a.cc:19:10: error: 'a' was not declared in this scope
   19 |     copy(a.begin(), a.end(), back_inserter(b));
      |          ^
a.cc:19:44: error: 'b' was not declared in this scope
   19 |     copy(a.begin(), a.end(), back_inserter(b));
      |                                            ^
Language: C++

#include <algorithm>
#include <cstdio>

using namespace std;

int main() {

    int n, temp, mid1, mid2;
    vector<int> x, sortedX;

    scanf("%d", &n);

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

        scanf("%d", &temp);

        x.push_back(temp);
        sortedX.push_back(temp);

        sort(sortedX.begin(), sortedX.end());

        mid1 = sortedX[(n >> 1) - 1];
        mid2 = sortedX[n >> 1];

    }

    for (int i = 0; i < n; ++i) {
        printf("%d\n", x[i] > mid1 ? mid1 : mid2);
    }

    return 0;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: 'vector' was not declared in this scope
    9 |     vector<int> x, sortedX;
      |     ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include <cstdio>
  +++ |+#include <vector>
    3 | 
a.cc:9:12: error: expected primary-expression before 'int'
    9 |     vector<int> x, sortedX;
      |            ^~~
a.cc:17:9: error: 'x' was not declared in this scope
   17 |         x.push_back(temp);
      |         ^
a.cc:18:9: error: 'sortedX' was not declared in this scope
   18 |         sortedX.push_back(temp);
      |         ^~~~~~~
a.cc:28:24: error: 'x' was not declared in this scope
   28 |         printf("%d\n", x[i] > mid1 ? mid1 : mid2);
      |                        ^
Language: C++

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

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

int main() {
  int n; cin >> n;
  vector<int> x(n);
  vector<int> c(n);
  REP(i,n) cin >> x[i];
  REP(i,n) c[i] = x[i];
  sort(x.begin(), x.end());
  int l = x[n/2-1], r = x[n/2];
  REP(i,n) {
    if (c[i] < l) cout << r << endl;
    else if (c[i] > r) cout << l << endl;
    else if (c[i] == l) cout << r << endl;
    else if (c[i] == r) cout << l << endl;
  }
  return 0;
}


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

#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(c) (c).begin(), (c).end()

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

using namespace std;

int medians(vector<int> X, int excluseP) {
  X.erase(excluseP);
  sort(ALL(X));
  int const center = X.size() / 2;
  return (X[center - 1] + X[center]) / 2;
}

int main() {
  int N;
  cin >> N;
  vector<int> X;
  REP(i, N) {
    int x;
    cin >> x;
    X.push_back(x);
  }

  REP(i, N) { cout << medians(X, i) << endl; }

  return 0;
}

Compiler output:
a.cc: In function 'int medians(std::vector<int>, int)':
a.cc:11:10: error: no matching function for call to 'std::vector<int>::erase(int&)'
   11 |   X.erase(excluseP);
      |   ~~~~~~~^~~~~~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:6:
/usr/include/c++/14/bits/stl_vector.h:1536:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]'
 1536 |       erase(const_iterator __position)
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1536:28: note:   no known conversion for argument 1 from 'int' to 'std::vector<int>::const_iterator'
 1536 |       erase(const_iterator __position)
      |             ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator, const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]'
 1564 |       erase(const_iterator __first, const_iterator __last)
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:7: note:   candidate expects 2 arguments, 1 provided
Language: Java

import java.util.*;
import java.io.*;

public class Solution {
	
  public static void main(String[] args) {
    Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
    
    int N = in.nextInt();
    Num[] original = new Num[N];
    Num[] sorted = new Num[N];
    
    for (int i = 0; i < N; i++) {
    	int n = in.nextInt();
    	original[i] = new Num(i, n);
    	sorted[i] = new Num(i, n);
    }
    
    Arrays.sort(sorted);
    Map<Integer, Integer> order = new HashMap<Integer, Integer>(); // Keeps index in original => index in sorted
    for (int i = 0; i < N; i++) {
    	order.put(sorted[i].index, i);
    }
    
    for (int i = 0; i < N; i++) {
    	int index = order.get(original[i].index);
    	
    	if (index < N / 2) {
    		System.out.println(sorted[N / 2].n);
    	} else {
    		System.out.println(sorted[N / 2 - 1].n);
    	}
    }
  }
}

class Num implements Comparable<Num> {
	int index;
	int n;
	
	public Num(int index, int n) {
		this.index = index;
		this.n = n;
	}

	@Override
	public int compareTo(Num o) {
		return this.n - o.n;
	}
	
	
}

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

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

struct Segtree{
	int data[1<<19], base=1<<18;
	void add(int p, int v){
		for(p+=base-1; p; p/=2)
			data[p]+=v;
	}
	int getKth(int k){
		int now=1;
		while(now < base){
			if(data[now*2]>=k) now*=2;
			else{
				k -= data[now*2];
				now = now*2+1;
			}
		}
		return now-(base-1);
	}
} seg;

int a[200010];
vector<int> comp;
int O2N(int Org){ return lower_bound(comp.begin(), comp.end(), Org)-comp.begin()+1;}
int N2O(int New){ return comp[New-1]; }

int main(){
	int n;
	scanf("%d", &n);
	for(int i=1; i<=n; i++)
		scanf("%d", &a[i]), comp.push_back(a[i]);;
	sort(comp.begin(), comp.end());
	comp.resize(distance(comp.begin(), unique(comp.begin(), comp.end())));
	for(int i=1; i<=n; i++){
		a[i] = O2N(a[i]);
		seg.add(a[i], 1);
	}
	for(int i=1; i<=n; i++){
		seg.add(a[i], -1);
		int val = seg.getKth(n/2);
		printf("%d\n", N2O(val));
		seg.add(a[i], 1);
	}
	return 0;
}


Compiler output:
a.cc:25:1: error: 'vector' does not name a type
   25 | vector<int> comp;
      | ^~~~~~
a.cc: In function 'int O2N(int)':
a.cc:26:38: error: 'comp' was not declared in this scope
   26 | int O2N(int Org){ return lower_bound(comp.begin(), comp.end(), Org)-comp.begin()+1;}
      |                                      ^~~~
a.cc: In function 'int N2O(int)':
a.cc:27:26: error: 'comp' was not declared in this scope
   27 | int N2O(int New){ return comp[New-1]; }
      |                          ^~~~
a.cc: In function 'int main()':
a.cc:33:37: error: 'comp' was not declared in this scope
   33 |                 scanf("%d", &a[i]), comp.push_back(a[i]);;
      |                                     ^~~~
a.cc:34:14: error: 'comp' was not declared in this scope
   34 |         sort(comp.begin(), comp.end());
      |              ^~~~
Language: C++

//---------------------------------------------------------------
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#include<algorithm>
//---------------------------------------------------------------
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define SIZE 100005
#define INF 1e18
#define all(x) x.begin(),x.end()
#define fi first
#define se second
#define vec vector
using pint = pair<int,int>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
//---------------------------------------------------------------
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const double pi = acos(-1);
//---------------------------------------------------------------

//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓


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

    ll n;
    cin>>n;
    vll a(n);
    rep(i,n){
        cin>>a[i];
    }
    sort(all(a));
    ll d = (a[n-1]+1)/2;
    ll ans = a[0];
    ll sample = INF;
    if(a[0]==0&&a[1==100]{
        cout<<100<<' '<<0<<endl;
      	return 0;
    }
    rep(i,n){
        ll tmp = abs(d -a[i]);
        if(sample>=tmp){
            sample = tmp;
            ans =a[i];
        }
    }

    cout<<a[n-1]<<' '<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:26: error: expected ')' before '{' token
   53 |     if(a[0]==0&&a[1==100]{
      |       ~                  ^
      |                          )
a.cc:57:9: error: 'i' was not declared in this scope
   57 |     rep(i,n){
      |         ^
a.cc:16:35: note: in definition of macro 'rep'
   16 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                                   ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
 
int main() {
ll n;
cin>>n;
ll ca=10000000000;
ll counter=0;
ll a[n]={};
ll cb=10000000000;
ll cc;
ll f=0;
ll counter1;
ll cd;
ll ce;
for(ll i=0;i<n;i++){
cin>>a[i];}
sort(a,a+n);
cout<<a[n-1]<<" ";
if(a[n-1]%2==0){
counter=a[n-1]/2;
for(ll i=0; i<n; i++){
if(counter<a[i]){
ca=i;
break;
}}

if(abs(counter-a[ca-1])>abs(counter-a[ca])){
cout<<a[ca]<<endl;}
else
cout<<a[ca-1]<<endl;}

else{
counter=a[n-1]/2;
for(ll i=0; i<n; i++){
if(counter<a[i]){
ca=i;
break;
}}

counter1=a[n-1]/2+1;
for(ll i=0; i<n; i++){
if(counter1<a[i]){
cb=i;
break;
}}

if(abs(counter-a[ca-1])>abs(counter-a[ca])){
cc=abs(counter-a[ca]);}
else{
cc=abs(counter-a[ca-1]);}

if(abs(counter1-a[cb-1])>abs(counter1-a[cb])){
cd=abs(counter1-a[cb]);}
else{
cd=abs(counter1-a[cb-1]);}

if(cc>cd){
if(abs(counter1-a[cb-1])>abs(counter1-a[cb])){
cout<<a[cb]<<endl;}
else
cout<<a[cb-1]<<endl;}
 
else{
if(abs(counter-a[ca-1])>abs(counter-a[ca])){
cout<<a[ca]<<endl;}
else
cout<<a[ca-1]<<endl;}}


Compiler output:
a.cc: In function 'int main()':
a.cc:70:23: error: expected '}' at end of input
   70 | cout<<a[ca-1]<<endl;}}
      |                       ^
a.cc:6:12: note: to match this '{'
    6 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
 
int main() {
ll n;
cin>>n;
ll ca=10000000000;
ll counter=0;
ll a[n]={};
ll cb=10000000000;
ll cc;
ll f=0;
ll counter1;
ll cd;
ll ce;
for(ll i=0;i<n;i++){
cin>>a[i];}
sort(a,a+n);
cout<<a[n-1]<<" ";
if(a[n-1]%2==0){
counter=a[n-1]/2;
for(ll i=0; i<n; i++){
if(counter<a[i]){
ca=i;
break;
}}

if(abs(counter-a[ca-1])>abs(counter-a[ca])){
cout<<a[ca]<<endl;}
else
cout<<a[ca-1]<<endl;}

else{
counter=a[n-1]/2;
for(ll i=0; i<n; i++){
if(counter<a[i]){
ca=i;
break;
}}

counter1=a[n-1]/2+1;
for(ll i=0; i<n; i++){
if(counter1<a[i]){
cb=i;
break;
}}

if(abs(counter-a[ca-1])>abs(counter-a[ca])){
cc=abs(counter-a[ca]);
else{
cc=abs(counter-a[ca-1]);}}

if(abs(counter1-a[cb-1])>abs(counter1-a[cb])){
cd=abs(counter1-a[cb]);
else{
cd=abs(counter1-a[cb-1]);}}

if(cc>cd){
if(abs(counter1-a[cb-1])>abs(counter1-a[cb])){
cout<<a[cb]<<endl;}
else
cout<<a[cb-1]<<endl;}
 
else{
if(abs(counter-a[ca-1])>abs(counter-a[ca])){
cout<<a[ca]<<endl;}
else
cout<<a[ca-1]<<endl;}}

Compiler output:
a.cc: In function 'int main()':
a.cc:52:1: error: expected '}' before 'else'
   52 | else{
      | ^~~~
a.cc:50:44: note: to match this '{'
   50 | if(abs(counter-a[ca-1])>abs(counter-a[ca])){
      |                                            ^
a.cc:57:1: error: expected '}' before 'else'
   57 | else{
      | ^~~~
a.cc:55:46: note: to match this '{'
   55 | if(abs(counter1-a[cb-1])>abs(counter1-a[cb])){
      |                                              ^
a.cc: At global scope:
a.cc:60:1: error: expected unqualified-id before 'if'
   60 | if(cc>cd){
      | ^~
a.cc:66:1: error: expected unqualified-id before 'else'
   66 | else{
      | ^~~~
a.cc:70:22: error: expected declaration before '}' token
   70 | cout<<a[ca-1]<<endl;}}
      |                      ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
 
int main() {
ll n;
cin>>n;
ll ca=10000000000;
ll counter=0;
ll a[n]={};
ll cb=10000000000;
ll cc;
ll f=0;
ll counter1;
ll cd;
ll ce;
for(ll i=0;i<n;i++){
cin>>a[i];}
sort(a,a+n);
cout<<a[n-1]<<" ";
if(a[n-1]%2==0){
counter=a[n-1]/2;
for(ll i=0; i<n; i++){
ca=abs(counter-a[i]);
cb=min(ca,cb);
}
cc=counter-cb;
for(ll j=0; j<n;j++){
if(a[j]==cc){
cout<<cc<<endl;
f=1;
break;}}
if(f=0){
cc=counter+cb;
for(ll j=0; j<n;j++){
if(a[j]==cc){
cout<<cc<<endl;
f=1;
break;}}}

else{
counter=a[n-1]/2;
for(ll i=0; i<n; i++){
ca=abs(counter-a[i]);
cb=min(ca,cb);
}
counter1=a[n-1]/2+1;
for(ll j=0; j<n;j++){
cd=abs(counter1-a[j]);
ce=min(ce,cd);
}
if(cd>ce){
cc=counter1+ce;
for(ll j=0; j<n;j++){
if(a[j]==cc){
cout<<cc<<endl;
f=1;
break;}}
if(f==0){

cc=counter1-ce;
for(ll j=0; j<n;j++){
if(a[j]==cc){
cout<<cc<<endl;
break;}}}

else{
cc=counter+cd;
for(ll j=0; j<n;j++){
if(a[j]==cc){
cout<<cc<<endl;
f=1;
break;}}
if(f==0){

cc=counter1-cd;
for(ll j=0; j<n;j++){
if(a[j]==cc){
cout<<cc<<endl;
break;}}}}}


Compiler output:
a.cc: In function 'int main()':
a.cc:81:12: error: expected '}' at end of input
   81 | break;}}}}}
      |            ^
a.cc:42:5: note: to match this '{'
   42 | else{
      |     ^
a.cc:81:12: error: expected '}' at end of input
   81 | break;}}}}}
      |            ^
a.cc:22:16: note: to match this '{'
   22 | if(a[n-1]%2==0){
      |                ^
a.cc:81:12: error: expected '}' at end of input
   81 | break;}}}}}
      |            ^
a.cc:6:12: note: to match this '{'
    6 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
 
int main() {
ll n;
cin>>n;
ll ca=10000000000;
ll counter=0;
ll a[n]={};
ll cb=10000000000;
ll cc;
ll f=0;
ll counter1;
ll cd;
ll ce;
for(ll i=0;i<n;i++){
cin>>a[i];}
sort(a,a+n);
cout<<a[n-1]<<" ";
if(a[n-1]%2==0){
counter=a[n-1]/2;
for(ll i=0; i<n; i++){
ca=abs(counter-a[i]);
cb=min(ca,cb);
}
cc=counter-cb;
for(ll j=0; j<n;j++){
if(a[j]==cc){
cout<<cc<<endl;
f=1;
break;}}
if(f=0){
cc=counter+cb;
for(ll j=0; j<n;j++){
if(a[j]==cc){
cout<<cc<<endl;
f=1;
break;}}}

else{
counter=a[n-1]/2;
for(ll i=0; i<n; i++){
ca=abs(counter-a[i]);
cb=min(ca,cb);
}
counter1=a[n-1]/2+1;
for(ll j=0; j<n;j++){
cd=abs(counter1-a[j]);
ce=min(ce,cd);
}
if(cd>ce){
cc=counter1+ce;
for(ll j=0; j<n;j++){
if(a[j]==cc){
cout<<cc<<endl;
f=1;
break;}}
if(f==0){

cc=counter1-ce;
for(ll j=0; j<n;j++){
if(a[j]==cc){
cout<<cc<<endl;
break;}}}

else{
cc=counter+cd;
for(ll j=0; j<n;j++){
if(a[j]==cc){
cout<<cc<<endl;
f=1;
break;}}
if(f==0){

cc=counter1-cd;
for(ll j=0; j<n;j++){
if(a[j]==cc){
cout<<cc<<endl;
break;}}}}


Compiler output:
a.cc: In function 'int main()':
a.cc:81:11: error: expected '}' at end of input
   81 | break;}}}}
      |           ^
a.cc:53:10: note: to match this '{'
   53 | if(cd>ce){
      |          ^
a.cc:81:11: error: expected '}' at end of input
   81 | break;}}}}
      |           ^
a.cc:42:5: note: to match this '{'
   42 | else{
      |     ^
a.cc:81:11: error: expected '}' at end of input
   81 | break;}}}}
      |           ^
a.cc:22:16: note: to match this '{'
   22 | if(a[n-1]%2==0){
      |                ^
a.cc:81:11: error: expected '}' at end of input
   81 | break;}}}}
      |           ^
a.cc:6:12: note: to match this '{'
    6 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
 
int main() {
ll n;
cin>>n;
ll ca=10000000000;
ll counter=0;
ll a[n]={};
ll cb=10000000000;
ll cc;
ll f=0;
ll counter1;
ll cd;
ll ce;
for(ll i=0;i<n;i++){
cin>>a[i];}
sort(a,a+n);
cout<<a[n-1]<<" ";
if(a[n-1]%2==0){
counter=a[n-1]/2;
for(ll i=0; i<n; i++){
ca=abs(counter-a[i]);
cb=min(ca,cb);
}
cc=counter-cb;
for(ll j=0; j<n;j++){
if(a[j]==cc){
cout<<cc<<endl;
f=1;
break;}}
if(f=0){
cc=counter+cb;
for(ll j=0; j<n;j++){
if(a[j]==cc){
cout<<cc<<endl;
f=1;
break;}}}}

else{
counter=a[n-1]/2;
for(ll i=0; i<n; i++){
ca=abs(counter-a[i]);
cb=min(ca,cb);
}
counter1=a[n-1]/2+1;
for(ll j=0; j<n;j++){
cd=abs(counter1-a[j]);
ce=min(ce,cd);
}
if(cd>ce){
cc=counter1+ce;
for(ll j=0; j<n;j++){
if(a[j]==cc){
cout<<cc<<endl;
f=1;
break;}}
if(f==0){

cc=counter1-ce;
for(ll j=0; j<n;j++){
if(a[j]==cc){
cout<<cc<<endl;
break;}}

else{
cc=counter+cd;
for(ll j=0; j<n;j++){
if(a[j]==cc){
cout<<cc<<endl;
f=1;
break;}}
if(f==0){

cc=counter1-cd;
for(ll j=0; j<n;j++){
if(a[j]==cc){
cout<<cc<<endl;
break;}}}}


Compiler output:
a.cc: In function 'int main()':
a.cc:68:1: error: expected '}' before 'else'
   68 | else{
      | ^~~~
a.cc:60:9: note: to match this '{'
   60 | if(f==0){
      |         ^
a.cc:81:11: error: expected '}' at end of input
   81 | break;}}}}
      |           ^
a.cc:53:10: note: to match this '{'
   53 | if(cd>ce){
      |          ^
a.cc:81:11: error: expected '}' at end of input
   81 | break;}}}}
      |           ^
a.cc:42:5: note: to match this '{'
   42 | else{
      |     ^
a.cc:81:11: error: expected '}' at end of input
   81 | break;}}}}
      |           ^
a.cc:6:12: note: to match this '{'
    6 | int main() {
      |            ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
signed main(){
  int a;
  cin>>a;
  vector<int> b(a),c(a-1);
  fo(i,a)
    cin>>b[i];
  Sort(b);
  int d=b[a-1],e=1000000008,f;
  fo(i,a-1){
    if(d%2==0)
      c[i]=abs(b[i]-(d/2-1));
    else
       c[i]=min<int>(abs(b[i]-(d/2)),abs(b[i]-(d/2)));
  fo(i,a-1){
    if(e>=c[i]){
      e=c[i];
      f=i;
    }
  }
  cout<<d<<' '<<b[f]<<endl;
}

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

#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20);
#define int long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(...) _overload(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
#define _rev(i, n) revi(i, n, 0)
#define revi(i, a, b) for(int i = (int)(a - 1); i >= (int)(b); i--)
#define rev(...) _overload(__VA_ARGS__, revi, _rev)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
void in(){}
template<typename F, typename... R>
bool in(F& f, R&... r){
    if(cin >> f){in(r...);return true;}
    else return false;
}
#define out(x) cout << (x)
#define space() cout << " "
#define indent() cout << '\n'
void print(){}
template<typename F, typename... R>
void print(F f, R... r){out(f), indent(), print(r...);}
#define debughead(x) cerr << "Line " << __LINE__ << ": " << #x << ": "
#define debugout(x) cerr << (x) << " "
#define debugindent() cerr << '\n'
#define debug(x) debughead(x), debugout(x), debugindent()
const int INF = 1e18, MOD = 1e9 + 7;
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}

main(){
    INCANT;
    int n, res = -INF, mx = -INF;
    string s;
    in(n);
  	if(n == 2){
      in(n, res);
      out(n), space(res);
      return 0;
    }
    int a[n];
    rep(i, n){
        in(a[i]);
        chmax(mx, a[i]);
    }
    rep(i, n){
        if(abs(mx / 2 - a[i]) < abs(mx / 2 - res)){
            res = a[i];
        }
    }
    out(mx), space(), out(res);
}


Compiler output:
a.cc:45:24: error: macro "space" passed 1 arguments, but takes just 0
   45 |       out(n), space(res);
      |                        ^
a.cc:23:9: note: macro "space" defined here
   23 | #define space() cout << " "
      |         ^~~~~
a.cc:38:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   38 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:45:15: error: 'space' was not declared in this scope; did you mean 'std::filesystem::space'?
   45 |       out(n), space(res);
      |               ^~~~~
      |               std::filesystem::space
In file included from /usr/include/c++/14/filesystem:54,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200,
                 from a.cc:1:
/usr/include/c++/14/bits/fs_ops.h:354:14: note: 'std::filesystem::space' declared here
  354 |   space_info space(const path& __p, error_code& __ec) noexcept;
      |              ^~~~~
Language: C++

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

#define int long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define SORT(c) sort((c).begin(),(c).end())

typedef long long ll;
const ll INF = 1LL<<60;
const ll mod = 998244353;
const int MAX_N = 5e5 + 5;
int dx[] = { -1,0,1,0 }, dy[] = { 0,1,0,-1 };
vector<ll> prime;

ll inv[MAX_N], fac[MAX_N];

template <class T = ll> T in() { T x; cin >> x; return (x); }
inline ll GCD(ll a, ll b) { ll c; while (b != 0) { c = a % b; a = b; b = c; }return a; }
inline ll LCM(ll a, ll b) { return a * b / GCD(a, b); }
inline ll POW(ll a, ll b) { ll c = 1; while (b > 0) { if (b & 1) { c = a * c%mod; }a = a * a%mod; b >>= 1LL; }return c; }
inline void _nCr() { fac[0] = 1; for (int i = 1LL; i < MAX_N; i++) { fac[i] = fac[i - 1] * i%mod; }for (int i = 0; i < MAX_N; i++) { inv[i] = POW(fac[i], mod - 2); } }
inline ll nCr(ll n, ll r) { return (fac[n] * inv[r] % mod)*inv[n - r] % mod; }
inline void PRI(ll n) { bool A[n + 1]; for (int i = 0; i < n + 1; i++) { A[i] = 1; }for (int i = 2; i < n + 1; i++) { if (A[i]) { prime.pb(i); ll b = i; while (b <= n) { A[b] = 0; b += i; } } } }

vector<vector<pair<int,int>>> Edge;
vector<int> node;

bool bellman_ford(int n,int s) {
	node = vector<int>(n,INF);
	node[s] = 0;
	REP (i,n) {
		REP (j,Edge.size()) {
			REP (k,Edge[j].size()) {
				int from = j,to = Edge[j][k].F;
				int cost = Edge[j][k].S;
				if (node[from] != INF && node[to] > node[from] + cost) {
					node[to] = node[from] + cost;
					if (i == n - 1 && to == n - 1) return true;
				}
			}
		}
	}
	return false;
}

signed main() {
	int n;
	cin >> n;
	vector<int> A(n);
	REP (i,n) {cin >> A[i];}
	SORT(a);
	_nCr();
	int ma = -1;
	int a,b;
	for (int i = n - 1;i >= 0;i--) {
		if (nCr(A[i],A[i]/2) < ma) break;
		auto it = lower_bound(ALL(a),A[i] / 2);
		if (*it * 2 == A[i]) {
			if (nCr(A[i],A[i]/2) > ma) {
				a = A[i];
				b = A[i]/2;
			}
		}
		else {
			if (nCr(A[i],*it) > ma) {
				a = A[i];
				b = *it;
			}
			if (nCr(A[i],*(--it)) > ma) {
				a = A[i];
				b = *it;
			}
		}
	}
	cout << a << " " << b << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:14: error: 'a' was not declared in this scope
   58 |         SORT(a);
      |              ^
a.cc:13:23: note: in definition of macro 'SORT'
   13 | #define SORT(c) sort((c).begin(),(c).end())
      |                       ^
Language: C++

#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<"!"<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;cin>>n;
  vi A(n);
  for(auto &a:A)cin>>a;
  sort(ALL(A),greater<ll>());
  ll mi=llINF;
  ll ans;
  for(int i=1;i<n;i++){
    if(mi>abs(A[i]-(n-n/2))){
      mi=abs(A[i]-(n-n/2));
      ans=A[i];
    }
  }
  cout<<A[i]<<" "<<ans<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:11: error: 'i' was not declared in this scope; did you mean 'mi'?
   36 |   cout<<A[i]<<" "<<ans<<endl;
      |           ^
      |           mi