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

#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int a[212345];

int main(){
    std::ios::sync_with_studio(false);
    int n;
    cin >> n;
//    vector<int> a(n);
    rep(i, n) cin >> a[i];
//    sort(a.begin(), a.end());
    sort(a, a+n);
    int ans = 0;
    double half_num = a[n-1] * 1.000 / 2.00;
    double dist = 1e9;
    rep(i, n) {
        if ( abs(half_num - a[i]) < dist ) {
            dist = abs(half_num - a[i]);
            ans = a[i];
        }
    }
    cout << a[n-1] << " " << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:15: error: 'sync_with_studio' is not a member of 'std::ios' {aka 'std::basic_ios<char>'}
   20 |     std::ios::sync_with_studio(false);
      |               ^~~~~~~~~~~~~~~~
Language: C++

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

int main(){
  lli n;
  cin >> n;
  vector<lli> vec(n);
  rep0(i,n)cin >> vec[i];
  sort(all(vec));

  lli num = INF*1000, s=0;
  if(vec.back()&1){
    rep0(i,n-1)if(num >= min(abs(vec[i] - vec.back()/2), abs(vec[i] - vec.back()/2-1))){
      num = min(abs(vec[i] - vec.back()/2), abs(vec[i] - vec.back()/2-1));
      s=i;
    }
  }
  else {
    rep0(i,n-1)if(num >= abs(vec[i] - vec.back()/2)){
      num = abs(vec[i] - vec.back()/2);
      s=i;
    }
  }
  cout << vec.back() << ' ' << vec[s];

}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: 'lli' was not declared in this scope
    5 |   lli n;
      |   ^~~
a.cc:6:10: error: 'n' was not declared in this scope; did you mean 'yn'?
    6 |   cin >> n;
      |          ^
      |          yn
a.cc:7:13: error: template argument 2 is invalid
    7 |   vector<lli> vec(n);
      |             ^
a.cc:8:8: error: 'i' was not declared in this scope
    8 |   rep0(i,n)cin >> vec[i];
      |        ^
a.cc:8:3: error: 'rep0' was not declared in this scope
    8 |   rep0(i,n)cin >> vec[i];
      |   ^~~~
a.cc:9:8: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'?
    9 |   sort(all(vec));
      |        ^~~
      |        std::filesystem::perms::all
In file included from /usr/include/c++/14/filesystem:51,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200,
                 from a.cc:1:
/usr/include/c++/14/bits/fs_fwd.h:158:7: note: 'std::filesystem::perms::all' declared here
  158 |       all               =  0777,
      |       ^~~
a.cc:11:6: error: expected ';' before 'num'
   11 |   lli num = INF*1000, s=0;
      |      ^~~~
      |      ;
a.cc:12:10: error: request for member 'back' in 'vec', which is of non-class type 'int'
   12 |   if(vec.back()&1){
      |          ^~~~
a.cc:24:15: error: request for member 'back' in 'vec', which is of non-class type 'int'
   24 |   cout << vec.back() << ' ' << vec[s];
      |               ^~~~
a.cc:24:36: error: 's' was not declared in this scope
   24 |   cout << vec.back() << ' ' << vec[s];
      |                                    ^
Language: C++

import java.util.*;


public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	public void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		ArrayList<Long> a = new ArrayList<Long>();
		for(int i=0; i<n; i++) {
			a.add(sc.nextLong());
		}
		Collections.sort(a, Collections.reverseOrder());
		long l = a.get(0);
		long m=a.get(a.size()/2);
		System.out.println(l + " " + m);
		sc.close();
	}

	private long comb(long n, long k) {
		return fact(n) / (fact(n-k) * fact(k));
	}

	private long fact(long n) {
		long res = 1;
		for(int i=1; i<=n; i++) {
			res *= i;
		}
		return res;
	}

	private long pow(long n, long k) {
		long res = 1;//k==0
		if(k%2==0) {
			res = pow(n, k/2);
			res = res * res;
		}else {
			res = pow(n, k-1);
			res = res * n;
		}
		return res;
	}
}


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:4:1: error: expected unqualified-id before 'public'
    4 | public class Main {
      | ^~~~~~
Language: C++

// D - Binomial Coefficients
#include <bits/stdc++.h>
using namespace std;

int main(){
	int N; cin>>N;
	vector<int> A(N);
	for(int i=0; i<N; ++i) cin>>A[i];
	sort(A.begin(), A.end());
	int n = A[N-1], r = 0;
	int mindiff = INT_MAX;
	for(int i=N-2; i>=0; --i){
		int diff = abs((n+2-1)/2 - A[i]);// |⌈n/2⌉ - ai|
		if(mindiff > diff){ mindiff = diff; r = A[i]; }
		// if(mindiff >= diff){ mindiff = diff; r = A[i]; }

		// int diff = abs((n+2-1)/2 - A[i]);// |⌈n/2⌉ - ai|
		// if(mindiff > diff){ mindiff = diff; r = A[i]; }
		// if(mindiff >= diff){ mindiff = diff; r = A[i]; }

		int diff = abs(n/2 - A[i]); // |⌊n/2⌋ - ai|
		if(mindiff > diff){ mindiff = diff; r = A[i]; }
		// if(mindiff >= diff){ mindiff = diff; r = A[i]; } // NG!
	}
	cout<< n <<" "<< r <<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:21: error: redeclaration of 'int diff'
   21 |                 int diff = abs(n/2 - A[i]); // |⌊n/2⌋ - ai|
      |                     ^~~~
a.cc:13:21: note: 'int diff' previously declared here
   13 |                 int diff = abs((n+2-1)/2 - A[i]);// |⌈n/2⌉ - ai|
      |                     ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main() {
  int n; cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  int N = *max_elemnt(v.begin(), v.end());
  sort(v.begin(), v.end(), [&](int a, int b) {
    return abs(2*N - a) > abs(2*N - b);
  });
  cout << N << ' ' << v[0] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:12: error: 'max_elemnt' was not declared in this scope
    7 |   int N = *max_elemnt(v.begin(), v.end());
      |            ^~~~~~~~~~
Language: C++

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

const int MAX = 51000000000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


signed main(){
    COMinit();

    int n;
    cin >> n;
    int a[100020];
    for(int i = 1;i <= n;i++){
        cin >> a[i];
    }
    sort(a+1,a+n+1);
    int N = 0,R = 0;
    int max=-1;
    for(int i = n;i > 0;i--){
        for(int j = i-1;j > 0;j--){
            int nCr;
            if(a[i] == 0 || a[j] == 0)nCr = 0;
            else nCr = COM(a[i],a[j]);
   
            if(nCr > max){max = nCr;N = a[i];R = a[j];}
        }
    }
    cout << N << " " << R;
}

Compiler output:
/tmp/ccZ3Aai9.o: in function `COMinit()':
a.cc:(.text+0x20): relocation truncated to fit: R_X86_64_PC32 against symbol `finv' defined in .bss section in /tmp/ccZ3Aai9.o
a.cc:(.text+0x2b): relocation truncated to fit: R_X86_64_PC32 against symbol `finv' defined in .bss section in /tmp/ccZ3Aai9.o
a.cc:(.text+0x32): relocation truncated to fit: R_X86_64_PC32 against symbol `finv' defined in .bss section in /tmp/ccZ3Aai9.o
a.cc:(.text+0x39): relocation truncated to fit: R_X86_64_PC32 against symbol `inv' defined in .bss section in /tmp/ccZ3Aai9.o
a.cc:(.text+0xd0): relocation truncated to fit: R_X86_64_PC32 against symbol `inv' defined in .bss section in /tmp/ccZ3Aai9.o
a.cc:(.text+0x130): relocation truncated to fit: R_X86_64_PC32 against symbol `inv' defined in .bss section in /tmp/ccZ3Aai9.o
a.cc:(.text+0x14b): relocation truncated to fit: R_X86_64_PC32 against symbol `finv' defined in .bss section in /tmp/ccZ3Aai9.o
a.cc:(.text+0x162): relocation truncated to fit: R_X86_64_PC32 against symbol `inv' defined in .bss section in /tmp/ccZ3Aai9.o
a.cc:(.text+0x1af): relocation truncated to fit: R_X86_64_PC32 against symbol `finv' defined in .bss section in /tmp/ccZ3Aai9.o
/tmp/ccZ3Aai9.o: in function `COM(long long, long long)':
a.cc:(.text+0x232): relocation truncated to fit: R_X86_64_PC32 against symbol `finv' defined in .bss section in /tmp/ccZ3Aai9.o
a.cc:(.text+0x24d): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include "pch.h"
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>

#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <utility>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <bitset>

#define ll long long
#define fri(n) for(i=0;i<(n);i++)
#define frj(n) for(j=0;j<(n);i++)
#define min(p,q) ((p)<(q)?(p):(q))
#define max(p,q) ((p)>(q)?(p):(q))
#define INF 1000000000000000000//10^18
#define INFINT 2000000001//2*10^9+1
#define MOD 1000000007
#define MODANOTHER 998244353
#define PI acos(-1)

//#define int ll

using namespace std;


signed main(void)
{
	//変数の宣言
	int n,m;
	int h,w;
	int a[100010];

	//よく使う変数
	int i,j,k,l;
	int flag=0;
	int ans=0;
	int count=0;
	int temp=0;
	int temp1=0;
	int temp2=0;
	int temp3=0;
	static int vec[100010];
	int max=0;
	int min=INFINT;
	int len=0;
	int sum=0;
	int ok=0;
	int ng=0;
	char dummy;
	static char stemp[100010];
	
	//データの読み込み


//	scanf("%d",&n);
	scanf_s("%d",&n);


//	scanf("%s",&s);
//	scanf_s("%s",&s,1000010);


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


/*	//scanf("%c",&dummy);
	scanf_s("%c",&dummy);
	for(i=0;i<n;i++){
//		scanf("%c",&s[i]);
		scanf_s("%c",&s[i]);
	}*/


/*	for(i=0;i<3;i++){
//		scanf("%s",&s);
		scanf_s("%s",&s[i],100010);
	}*/


	//	printf("nは%dです\n", n);
	//	printf("データの読み込み終了\n");
	//実際の処理

//	clock_t start=clock();

	temp=0;
	for(i=0;i<n;i++){
		if(a[i]>a[temp]){
			temp=i;
		}
	}
	max=temp;

	temp=0;
	for(i=0;i<n;i++){
		if(abs(2*a[i]-a[max])<abs(2*a[temp]-a[max])){
			temp=i;
		}
	}

	printf("%d %d",a[max],a[temp]);




//	clock_t end=clock();

	//	printf("計算部分終了\n");

	//出力
	
	//printf("%d",(d[i-1][j-1]+1)/2);

//	printf("time=%lf",(double)(end-start)/CLOCKS_PER_SEC);
	//	printf("結果の出力終了\n");

	return 0;
}



Compiler output:
a.cc:1:10: fatal error: pch.h: No such file or directory
    1 | #include "pch.h"
      |          ^~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using in6 = int64_t;
using ind = double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int ex(int x) {
  int ret = 1;
  while(x) {
    ret *= x;
    x--;
  }
  return ret;
}

int comb(int x,int y) {
  int ret = beki(x) / beki(x - y) /beki(y);
  return ret;
}

int main() {
  int n;
  cin >> n;
  vi data(n);
  rep(i,n) cin >> data[i];
  sort(data.begin(), data.end());
  int ans = 0;
  pair<int,int> pi;
  rep(i,n) {
    rep(j,i) {
      int a = comb(data[i],data[j]);
      if(a >= ans) {
        pi.first = data[i];
        pi.second = data[j];
      }
      ans = max(ans,a);
    }
  }
  cout << pi.first << " " << pi.second << endl;
}

Compiler output:
a.cc: In function 'int comb(int, int)':
a.cc:19:13: error: 'beki' was not declared in this scope
   19 |   int ret = beki(x) / beki(x - y) /beki(y);
      |             ^~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define pa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
#define pb push_back

using ll = long long;
using namespace std;
using pint = pair<int,int>;
using pll = pair<ll,ll>;
const int INFint = 1e9;
const ll INFll = 1e18;
ll MOD=1e9+7;

ll gcd(ll a, ll b) { return __gcd(a,b); } //最大公約数
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; } //最大公倍数

// aのn乗をMODで割りながら計算する
ll modpow(ll a, ll n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % MOD;
    a = a * a % MOD;
    n >>= 1; // right shift
  }
  return res;
}

// MODを法としたaの逆元を計算する
ll modinv(ll a) {
  return modpow(a, MOD - 2);
}

int main(){
  double N,A[100000];
  cin>>N; 
  for (int i(0);i<N;i++) cin>>A[i];
  sort(A,A+N);
  double maxi = A[N-1];
  double ans(0),tmp(1e9+1);
  for (int i(0);i<N-1;i++){
    if (tmp > abs(A[i]-maxi/(double)2)){
      ans = A[i];
      tmp = abs(A[i] - maxi/(double)2);
    }
  }
  cout << maxi << " " << ans << endl;
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:37:11: error: invalid operands of types 'double [100000]' and 'double' to binary 'operator+'
   37 |   sort(A,A+N);
      |          ~^~
      |          | |
      |          | double
      |          double [100000]
a.cc:38:18: error: invalid types 'double [100000][double]' for array subscript
   38 |   double maxi = A[N-1];
      |                  ^
Language: C++

#include "bits/stdc++.h"

using namespace std;

//using Matrix = vector< vector<int> >;
typedef long long ll;
typedef pair<int, int> P;
#define fir first
#define sec second

const int INF = 1e9 + 10;
//const ll INF = 1e18 + 10LL;
int dx[5] = {0, 0, 1, -1, 0}, dy[5] = {1, -1, 0, 0, 0};
const double EPS = 1e-10;
bool cmp(P a, P b) { return a.second < b.second; } //End sort (Interval scheduling problem)
ll MOD = 1e9 + 7;

struct Combination {
	static const int MAX = 1000000;
	vector<ll> fac, finv, inv;

	Combination() {
		COMinit();
	}

	// テーブルを作る前処理
	void COMinit() {
		fac.resize(MAX); finv.resize(MAX), inv.resize(MAX);
	    fac[0] = fac[1] = 1;
	    finv[0] = finv[1] = 1;
	    inv[1] = 1;
	    for (int i = 2; i < MAX; i++){
	        fac[i] = fac[i - 1] * i % MOD;
	        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
	        finv[i] = finv[i - 1] * inv[i] % MOD;
	    }
	}
	 
	// 二項係数計算
	ll COM(int n, int k){
	    if (n < k) return 0;
	    if (n < 0 || k < 0) return 0;
	    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
	}
};

int n;
int a[100010];

void solve() {
	Combination comb;
	sort(a, a + n);

	ll max_comb = 0;
	int k = 0;
	for (int i = 0; i < n; i++) {
		if (max_comb < comb.COM(a[n - 1], a[i])) {
			max_comb = comb.COM(a[n - 1], a[i]);
			k = a[i];
		}

		ans = max(ans, comb.COM(a[n - 1], a[i]));
	}

	printf("%d %d\n", a[n - 1], k);
}

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

	solve();
	
	return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:62:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   62 |                 ans = max(ans, comb.COM(a[n - 1], a[i]));
      |                 ^~~
      |                 abs
Language: C++

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

int fact(int n){
  int ret = 1;
  for(int i=n; 0<i; i--){
    ret *= i;
  }
  return ret;
}

int main(){
  int n;cin >> n;
  vector<int> a(n);
  for(int i=0; i<n; i++){
    cin >> a.at(i);
  }
  sort(a.begin(),a.end());
  int m = a.at(a.size()-1);
  int n=0;
  for(int i=0; i<n-1; i++){
    if(m/2<a.at(i)){
      n=i;
    }
  }
  if(n==0){cout << m << ' ' << a.at(0);}
  else if(n==m){cout << m << ' ' << a.at(a.size()-2);}
  if(fact(a.at(n))<fact(a.at(n-1))){cout << m << ' ' << a.at(n);}
  else{cout << m << ' ' << a.at(n-1);}
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:20:7: error: redeclaration of 'int n'
   20 |   int n=0;
      |       ^
a.cc:13:7: note: 'int n' previously declared here
   13 |   int n;cin >> n;
      |       ^
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
#define maxs(x,y) x = max(x, y)
#define mins(x,y) x = min(x, y)
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const int inf = (1<<29);

const int MAX = 1000000001;
const ll MOD = 1e9+7;
ll fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理O(n)
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}

// 二項係数計算O(1)
ll COM(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

int main() {

    int n;
    cin >> n;
    vector<int> a(n);
    REP(i, n) cin >> a[i];
    
    sort(RALL(a));
    COMinit();

    int ans1 = 0, ans2 = 0;
    ll ans = 0;

    for(int i = 0; i < n; i++) {
        for(int j = i+1; j < n; j++) {
            ll tmp = COM(a[i], a[j]);
            // cout << a[i] << " " << a[j] << " " << tmp << endl;
            if (tmp > ans) {
                ans = tmp;
                ans1 = a[i], ans2 = a[j];
            }
        }
    }

    cout << ans1 << " " << ans2 << endl;
    
    return 0;
}

Compiler output:
/tmp/cc570eMN.o: in function `COMinit()':
a.cc:(.text+0x20): relocation truncated to fit: R_X86_64_PC32 against symbol `finv' defined in .bss section in /tmp/cc570eMN.o
a.cc:(.text+0x2b): relocation truncated to fit: R_X86_64_PC32 against symbol `finv' defined in .bss section in /tmp/cc570eMN.o
a.cc:(.text+0x32): relocation truncated to fit: R_X86_64_PC32 against symbol `finv' defined in .bss section in /tmp/cc570eMN.o
a.cc:(.text+0x39): relocation truncated to fit: R_X86_64_PC32 against symbol `inv' defined in .bss section in /tmp/cc570eMN.o
a.cc:(.text+0xdd): relocation truncated to fit: R_X86_64_PC32 against symbol `inv' defined in .bss section in /tmp/cc570eMN.o
a.cc:(.text+0x143): relocation truncated to fit: R_X86_64_PC32 against symbol `inv' defined in .bss section in /tmp/cc570eMN.o
a.cc:(.text+0x15e): relocation truncated to fit: R_X86_64_PC32 against symbol `finv' defined in .bss section in /tmp/cc570eMN.o
a.cc:(.text+0x176): relocation truncated to fit: R_X86_64_PC32 against symbol `inv' defined in .bss section in /tmp/cc570eMN.o
a.cc:(.text+0x1c5): relocation truncated to fit: R_X86_64_PC32 against symbol `finv' defined in .bss section in /tmp/cc570eMN.o
/tmp/cc570eMN.o: in function `COM(int, int)':
a.cc:(.text+0x23c): relocation truncated to fit: R_X86_64_PC32 against symbol `finv' defined in .bss section in /tmp/cc570eMN.o
a.cc:(.text+0x257): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  ll a_i = a[n-1];
  ll res = a[0];
  for(int i = 0; i < n-1; i++){
    ll tmp = min(res, a_i - res);
    ll tmp2 = min(a[i], a_i - res);
    if(tmp2 > tmp) res = a[i];
  }
  cout << a_i << " " << res << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:18: error: no matching function for call to 'min(__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&, ll)'
   17 |     ll tmp2 = min(a[i], a_i - res);
      |               ~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:17:18: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   17 |     ll tmp2 = min(a[i], a_i - res);
      |               ~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:17:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   17 |     ll tmp2 = min(a[i], a_i - res);
      |               ~~~^~~~~~~~~~~~~~~~~
Language: C++

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

int main(){
    int n; cin >> n;
    vector<double> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    double ans = a[n-1];
    cout  << ans << endl;
    double mid = 100000000000;
    double ans2 = -1;
    for(int i = 0; i < n-1; i++){
        if(mid > abs(a[i] - b)){
            ans2 = a[i];
            mid = abs(a[i] - b);
        }
    }

    cout << ans << " " << ans2 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:29: error: 'b' was not declared in this scope
   17 |         if(mid > abs(a[i] - b)){
      |                             ^
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPP(i, n) for(int i = 1; i <= n; ++i)
#define REPR(i, n) for(int i = n-1; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int MOD = 1000000007;

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b) {if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b) {if(a<b) a=b;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> a(n);
    int m = 0;
    REP(i,n) {
        cin >> a[i];
        chmax(m,a[i]);
    }
    sort(ALL(a));
    pair<int,int> ans;
    ans.first = m;
    int diff = INT_MAX;
    REP(i,n-1) {
        int tmp = abs(n-2*a[i];
        chmin(diff, tmp);
        if(diff==tmp) {
          ans.second=a[i];
        }
    }
    cout << max(ans.first, ans.second) << ' ' << min(ans.first,ans.second) << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:31: error: expected ')' before ';' token
   29 |         int tmp = abs(n-2*a[i];
      |                      ~        ^
      |                               )
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPP(i, n) for(int i = 1; i <= n; ++i)
#define REPR(i, n) for(int i = n-1; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int MOD = 1000000007;

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b) {if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b) {if(a<b) a=b;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> a(n);
    int m = 0;
    REP(i,n) {
        cin >> a[i];
        chmax(m,a[i]);
    }
    sort(ALL(a));
    pair<int,int> ans;
    ans.first = m;
    int diff = INT_MAX
    REP(i,n-1) {
        int tmp = abs(n-2*a[i];
        chmin(diff, tmp);
        if(diff=tmp) {
          ans.second=a[i];
        }
    }
    cout << max(ans.first, ans.second) << ' ' << min(ans.first,ans.second) << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:2:19: error: expected ',' or ';' before 'for'
    2 | #define REP(i, n) for(int i = 0; i < n; ++i)
      |                   ^~~
a.cc:28:5: note: in expansion of macro 'REP'
   28 |     REP(i,n-1) {
      |     ^~~
a.cc:28:9: error: 'i' was not declared in this scope
   28 |     REP(i,n-1) {
      |         ^
a.cc:2:34: note: in definition of macro 'REP'
    2 | #define REP(i, n) for(int i = 0; i < n; ++i)
      |                                  ^
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;

ll table[1e9+1][1e9+1];

ll comb(int n, int k)
{
  for (int i = 0; i <= n; i++)
    table[i][0] = 1;
  for (int i = 1; i <= k; i++)
    table[i][i] = 1;

  for (int i = 2; i <= n; i++)
  {
    for (int j = 1; j < min(i, k + 1); j++)
    {
      table[i][j] = table[i - 1][j - 1] + table[i - 1][j];
    }
  }
  return table[n][k];
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<int> a(n);
  REP(i,n) cin >> a[i];
  sort(ALL(a));
  ll res = 0;
  int k = a[n-1];
  int b;
  REP(i,n-1){
    ll co = comb(a[n-1],a[i]);
    if(res<co){
      res = co;
      b = a[i];
    }
  }
  cout << k << " " << b << endl;
  return 0;
}


Compiler output:
a.cc:10:20: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
   10 | ll table[1e9+1][1e9+1];
      |                 ~~~^~
a.cc:10:20: error: could not convert '(1.0e+9 + (double)1)' from 'double' to 'long unsigned int'
   10 | ll table[1e9+1][1e9+1];
      |                 ~~~^~
      |                    |
      |                    double
a.cc:10:20: error: size of array 'table' has non-integral type 'double'
a.cc:10:13: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
   10 | ll table[1e9+1][1e9+1];
      |          ~~~^~
a.cc:10:13: error: could not convert '(1.0e+9 + (double)1)' from 'double' to 'long unsigned int'
   10 | ll table[1e9+1][1e9+1];
      |          ~~~^~
      |             |
      |             double
a.cc:10:13: error: size of array 'table' has non-integral type 'double'
Language: C++

#include<bits/stdc++.h>

using namespace std;

int main(){
    int n;
    int *a;
    long long max=0;
    a = new int[n];

    cin >> n;
    for(int i=0;i++;i<n){
        cin >> a[i];
    }
    sort(a,a+n,greater);
    int left = a[n-1];
    int right = min(a[0],left - a[0]);
    for(int i=0;i<n-1;i++){
        int tmp = min(a[i],left - a[i]);
        if(tmp > right){
            right = a[i];
        }
    }
    cout << left << " " << right << endl;
    delete[] a;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:23: error: missing template arguments before ')' token
   15 |     sort(a,a+n,greater);
      |                       ^
Language: C++

#include <bits/stdc++.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define IOS cin.tie(0); ios::sync_with_stdio(false)
const int INF = 1e9;
using namespace std;

main() {
    init();
    int N; cin >> N;
    int A[N];
    rep(i,N) cin >> A[i];
    sort(A,A+N);
    int ans=0;
    double pos; double hanbun=(double)A[N-1]/2;
    for(int i=N-2; i>=0; i--){
        if(i==N-2) {
            ans=A[i]; pos=fabs(hanbun-A[i]);  
        }
        else if(pos>fabs(hanbun-A[i])){
            ans=A[i]; pos=fabs(hanbun-A[i]);
        }
    }
    cout << A[N-1] <<" "<< ans << endl;
}

Compiler output:
a.cc:9:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    9 | main() {
      | ^~~~
a.cc: In function 'int main()':
a.cc:10:5: error: 'init' was not declared in this scope; did you mean 'int'?
   10 |     init();
      |     ^~~~
      |     int
Language: C++

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

int main(){
  int N; cin >> N;
  vector<int> a(N);
  int max =0;
  int med;
  int jud = 1000000000;
  
  rep(i,N){
    cin >> a[i];
    if(a[i] > max){
      max = a[i];
    }
  }
  
  rep(i,N){
    if(abs(a[i] *2 - max) < jud){
      if(a[i] != max){
        med = a[i];
        jud = abs(a[i] *2 - max);
      }
    }
  }
  
  cout << max << '' << med << endl;
}

  


Compiler output:
a.cc:29:18: error: empty character constant
   29 |   cout << max << '' << med << endl;
      |                  ^~
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<iterator>
#include<complex>
#include<stack>
#include "stdio.h"
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const long long mod_const = 1e9+7;
using MIte = multimap<long, long, greater<long> >::iterator;

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

	//
	int N;
	cin >> N;

	vector<int> vA(N, 0);
	rep(i, N) cin >> vA[i];

	set<int> setA(vA.begin(), vA.end());
	vector<int> vA2(setA.begin(), setA.end()););

	int maxelem = *prev(vA2.end());

	vector<int> vCombiPair(N);
	for (int i = 0; i != N; ++i) {
		vector<int>::iterator it = lower_bound(vA2.begin(), vA2.end(), vA[i] / 2);
		int a = *it;
		if (a != vA[i]) {
			vCombiPair[i] = a;
		}
		else {
			vCombiPair[i] = (it == prev(vA2.end())) ? *(it - 1) : *(it + 1);
		}
	}

	vector<double> vLog(maxelem+1, 0);
	vLog[0] = 0;
	for (int i = 0; i != maxelem; ++i) {
		vLog[i + 1] = vLog[i] + log(i+1);
	}

	double maxans = -1;
	int maxn = 0;
	int maxr = 0;
	for (int i = 0; i != N; ++i) {
		int n = vA[i];
		int r = vCombiPair[i];
		if (n < r) continue;
		double tmp = vLog[n] - vLog[r] - vLog[n - r];
		if (maxans < tmp) {
			maxans = tmp;
			maxn = n;
			maxr = r;
		}
	}

	cout << maxn << " " << maxr << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:51: error: expected primary-expression before ')' token
   43 |         vector<int> vA2(setA.begin(), setA.end()););
      |                                                   ^
Language: C++

#include <iostream>
#include <cmath>

using namespace std;

typedef long long ll;

ll N;
ll A[100000];

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

    sort(A, A + N);

    ll n = A[N-1];
    ll half = n / 2;

    ll min = 100000;
    ll candidate = 0;
    for (int i=N; 0<=i; i--) {
        ll diff = abs(A[i] - half);
        if (diff < min) {
            candidate = A[i];
            min = diff;
        }
    }

    cout << n << " " << candidate << endl;
}


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

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

using namespace std;

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

    vector<int> vec(n);
    for (auto &num : vec) {
        cin >> num;
    }
    sort(vec.begin(), vec.end());

    double mid = vec[n - 1] / 2.0;
    double best_dist = abs<double>(mid - vec[0]);
    int best_match = vec[0];

    for (const auto &num : vec) {
        if (abs<double>(mid - num) < best_dist) {
            best_dist = abs<double>(mid - num);
            best_match = num;
        }
    }

    cout << vec[n - 1] << " " << best_match << "\n";
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:28: error: expected primary-expression before 'double'
   19 |     double best_dist = abs<double>(mid - vec[0]);
      |                            ^~~~~~
a.cc:23:17: error: expected primary-expression before 'double'
   23 |         if (abs<double>(mid - num) < best_dist) {
      |                 ^~~~~~
a.cc:23:17: error: expected ')' before 'double'
   23 |         if (abs<double>(mid - num) < best_dist) {
      |            ~    ^~~~~~
      |                 )
a.cc:24:29: error: expected primary-expression before 'double'
   24 |             best_dist = abs<double>(mid - num);
      |                             ^~~~~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cstdint>
#include <unordered_map>
#include <sstream>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define pb push_back
#define pf push_front

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;

typedef pair<int, int> P;
bool sr(cpp_int a, cpp_int b)
{
	return a > b;
}
bool ps1(const P &element1, const P &element2)
{ //first昇順
	return element1.first < element2.first;
}
bool ps2(const P &element1, const P &element2)
{ //first降順
	return element1.first > element2.first;
}
bool ps3(const P &element1, const P &element2)
{ //second昇順
	return element1.second < element2.second;
}
bool ps4(const P &element1, const P &element2)
{ //second降順
	return element1.second > element2.second;
}
int digits(ll n)
{
	int count = 0;
	while (n > 0)
	{
		n /= 10;
		count++;
	}
	return count;
}
template <class T>
void print(const T &value)
{
	std::cout << value << std::endl;
}
cpp_int combination(cpp_int n, cpp_int r) {
	if (r * 2 > n) r = n - r;
	cpp_int dividend = 1;
    cpp_int divisor = 1;
	for (unsigned int i = 1; i <= r; ++i) {
		dividend *= (n - i + 1);
		divisor *= i;
	}
	return dividend / divisor;
}
int main()
{
	int n;
	cin>>n;
	vector<cpp_int>a(n);
	rep(i,n)cin>>a[i];
	sort(all(a),sr);
	cpp_int m=a[0];
	cpp_int ans=0;
	cpp_int m2=0;
	rep(i,n){
		cpp_int c= min(m-a[i],a[i]);
		if(c>ans){
			ans=c;
			m2=a[i];
		}
	}
	cout<<m<<" "<<m2<<endl;
}

Compiler output:
a.cc:19:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
   19 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cstdint>
#include <unordered_map>
#include <sstream>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define pb push_back
#define pf push_front

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;

typedef pair<int, int> P;
bool sr(ll a, ll b)
{
	return a > b;
}
bool ps1(const P &element1, const P &element2)
{ //first昇順
	return element1.first < element2.first;
}
bool ps2(const P &element1, const P &element2)
{ //first降順
	return element1.first > element2.first;
}
bool ps3(const P &element1, const P &element2)
{ //second昇順
	return element1.second < element2.second;
}
bool ps4(const P &element1, const P &element2)
{ //second降順
	return element1.second > element2.second;
}
int digits(ll n)
{
	int count = 0;
	while (n > 0)
	{
		n /= 10;
		count++;
	}
	return count;
}
template <class T>
void print(const T &value)
{
	std::cout << value << std::endl;
}
cpp_int combination(cpp_int n, cpp_int r) {
	if (r * 2 > n) r = n - r;
	cpp_int dividend = 1;
    cpp_int divisor = 1;
	for (unsigned int i = 1; i <= r; ++i) {
		dividend *= (n - i + 1);
		divisor *= i;
	}
	return dividend / divisor;
}
int main()
{
	int n;
	cin>>n;
	vector<cpp_int>a(n);
	rep(i,n)cin>>a[i];
	sort(all(a),sr);
	cpp_int m=a[0];
	cpp_int ans=0;
	cpp_int m2=0;
	rep(i,n){
		ans=max(ans,combination(m,a[i]));
		if(ans==combination(m,a[i])){
			m2=a[i];
		}
	}
	cout<<m<<" "<<m2<<endl;
}

Compiler output:
a.cc:19:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
   19 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

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

int main() {
	int n; cin >> n;
	vector<int>a(n); for (auto&& x : a)cin >> x;
	
	sort(a.begin(), a.end());
	int ai = a[n - 1];
	double aj = INT_MAX;
	for (int i = 0; i < n - 1; i++) {
		if (aj > abs(a[i] * 2 - a[n - 1]))aj = a[i];
	}
	
	cout << ai << ' ' << aj << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:21: error: 'INT_MAX' was not declared in this scope
   12 |         double aj = INT_MAX;
      |                     ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include<algorithm>
  +++ |+#include <climits>
    4 | using namespace std;
Language: C++

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

int main(){
  int n;
  cin >> n;
  vector <int> v(n);
  int a,b;
  for(int i=0;i<n;i++){
    cin >> v.at(i);
  }
  sort(v.begin(),v.end());
  reverse(v.begin()v.end());
  a=v.at(0);
  vector< pair<int,int> > vp(n);
  for(int i=0;i<n;i++){
  vp.at(i).first=abs(a-v.at(i));
  vp.at(i).second=v.at(i);
 }
 sort(vp.begin(),vp.end());
 cout << a << vp.at(0).second << endl;
 return 0;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:20: error: expected ')' before 'v'
   13 |   reverse(v.begin()v.end());
      |          ~         ^
      |                    )
a.cc:13:10: error: no matching function for call to 'reverse(std::vector<int>::iterator)'
   13 |   reverse(v.begin()v.end());
      |   ~~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:1083:5: note: candidate: 'template<class _BIter> void std::reverse(_BIter, _BIter)'
 1083 |     reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
      |     ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1083:5: note:   candidate expects 2 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate: 'template<class _ExecutionPolicy, class _BidirectionalIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::reverse(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator)'
  249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last);
      | ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note:   candidate expects 3 arguments, 1 provided
Language: C++

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

#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REP1(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREP1(i, x) for (int i = ((int)(x)); i > 0; i--)
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << ": " << x << '\n';
const int MOD = (int)1e9 + 7;
const int INF = 1145141919;
using ll = long long;
using ull = unsigned long long;
using
    // typedef long long ll;
    // typedef unsigned long long ull;
    // typedef pair<int, int> i_i;
    // typedef pair<ll, int> ll_i;
    // typedef pair<double, int> d_i;
    // typedef pair<ll, ll> ll_ll;
    // typedef pair<double, double> d_d;
    // struct edge {
    //     int u, v;
    //     ll w;
    // };
    //
    // #define all(x) (x).begin(), (x).end()

    int
    main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (auto &ai : a) {
        cin >> ai;
    }
    int maxn = *max_element(ALL(a));
    int k = INF;
    for (auto &ai : a) {
        if (maxn <= ai)
            continue;
        k = (abs((float)maxn / 2 - ai) < abs((float)maxn / 2 - k) ? ai : k);
    }
    cout << maxn << " " << k;
}

Compiler output:
a.cc:29:5: error: expected nested-name-specifier before 'int'
   29 |     int
      |     ^~~
Language: C++

#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_D main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LLONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using psi = pair<string, int>;
// functions

#endif


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

    int N; cin >> N;
    vi A(N); REP(i, N) cin >> A[i];

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

    ll res = 0;
    pii ans;
    for(ll j=1; j<N; j++) {
        ll cb = combi_mod(A[0], A[j], LINF);
        if (res < cb) {
            res = cb;
            ans.first = A[0];
            ans.second = A[j];
        }
    }

    cout << ans.first << " " << ans.second << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:17: error: 'combi_mod' was not declared in this scope
   41 |         ll cb = combi_mod(A[0], A[j], LINF);
      |                 ^~~~~~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
using ll = long long;
constexpr ll INF = 1LL << 60;

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    ll N;
    cin >> N;
    vector<ll> A(N);
    REP(i,N) cin >> A[i];
    sort(A.rbegin(),A.rend());
    // n+1Ck > nCk
    ll K = A[0] / 2;
    ll t = INF, ans = 0;
    rep(i,1,N) if(chmin(t,abs(A[i]-K))) ans = A[i];
    cout << A[0] << " " << ans << '\n';
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:19: error: 'chmin' was not declared in this scope
   20 |     rep(i,1,N) if(chmin(t,abs(A[i]-K))) ans = A[i];
      |                   ^~~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int main(){
  int n;cin>>n;
  vector<int> a;
  for(int i = 0; n > i; i++){
    int tmp;cin>>tmp;
    a.push_back(tmp);
  }
  sort(a.begin(),a.end());
  int o1 = a[a.size()-1];
  int o2 = -1;
  //5 2 3
  for(int i = 0; n > i; i++){
    if(o1%2==1){
      if(min(a[i]-o1/2,a[i]-(o1/2+1)) < min(o2-o1/2,o2-(o1/2+1)){
        o2 = a[i];
      }
    }else{
      if(abs(a[i]-o1/2) < abs(o2-o1/2)){
        o2 = a[i];
      }
    }
  }
  cout << o1 << " " << o2 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   11 |   sort(a.begin(),a.end());
      |   ^~~~
      |   short
a.cc:17:65: error: expected ')' before '{' token
   17 |       if(min(a[i]-o1/2,a[i]-(o1/2+1)) < min(o2-o1/2,o2-(o1/2+1)){
      |         ~                                                       ^
      |                                                                 )
a.cc:20:5: error: expected primary-expression before '}' token
   20 |     }else{
      |     ^
Language: C++

#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
using namespace std;

int main()
{
	int n;
	cin >> n;
	vector<long long> a(n);
	for (auto i = 0; i < n; ++i)
	{
		cin >> a[i];
	}

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

	auto left = *a.rbegin();
	auto mid = (double)left / 2;
	auto right = -1ll;
	auto m = DBL_MAX;
	for (auto i = 0; i < a.size() - 1; ++i)
	{
		auto temp = a[i];
		auto diff = abs(temp - mid);
		if (diff < m)
		{
			right = temp;
			m = diff;
		}
	}

	cout << left << " " << right << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:18: error: 'DBL_MAX' was not declared in this scope
   31 |         auto m = DBL_MAX;
      |                  ^~~~~~~
a.cc:14:1: note: 'DBL_MAX' is defined in header '<cfloat>'; this is probably fixable by adding '#include <cfloat>'
   13 | #include <map>
  +++ |+#include <cfloat>
   14 | using namespace std;
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;

int main() {

    int N; cin >> N;
    vector<int> v(N);
    for (int i = 0; i < N; i++) scanf("%d", &v[i]);
    int max_v = *max_element(v.begin(), v.end(), 0);
    int r = 0;
    for (int i = 0; i < N-1; i++) {
        if (r <  min(v[i], max_v - v[i])) 
            r = v[i];
    }
    cout << max_v << ' ' << r << '\n';


}


Compiler output:
In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
                 from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_comp_iter<_Compare>::operator()(_Iterator1, _Iterator2) [with _Iterator1 = __gnu_cxx::__normal_iterator<int*, std::vector<int> >; _Iterator2 = __gnu_cxx::__normal_iterator<int*, std::vector<int> >; _Compare = int]':
/usr/include/c++/14/bits/stl_algo.h:5626:12:   required from 'constexpr _ForwardIterator std::__max_element(_ForwardIterator, _ForwardIterator, _Compare) [with _ForwardIterator = __gnu_cxx::__normal_iterator<int*, vector<int> >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<int>]'
 5626 |         if (__comp(__result, __first))
      |             ~~~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5677:43:   required from 'constexpr _FIter std::max_element(_FIter, _FIter, _Compare) [with _FIter = __gnu_cxx::__normal_iterator<int*, vector<int> >; _Compare = int]'
 5677 |       return _GLIBCXX_STD_A::__max_element(__first, __last,
      |                                           ^
a.cc:12:29:   required from here
   12 |     int max_v = *max_element(v.begin(), v.end(), 0);
      |                  ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:158:30: error: expression cannot be used as a function
  158 |         { return bool(_M_comp(*__it1, *__it2)); }
      |                       ~~~~~~~^~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <map>
#define ll long long
#define REP(i, x) for(int (i) = 0; (i) < (x); (i) ++)
#define pi 3.1415926535
const int MOD = 1000000007;
using namespace std;

int main() {
	int n, k;
	ll ans1, ans2;
	ll m =LLONG_MAX, num;
	cin >> n;
	vector<ll>a(n);
	REP(i, n) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	ans1 = a[n - 1];
	num = (a[n - 1] + 1) / 2;
	REP(i, n) {
		ll l = abs(num - a[i]);
		if (l < m) {
			m = l;
			k = i;
		}
	}
	ans2 = a[k];
	cout << ans1 << " " << ans2 << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:15: error: 'LLONG_MAX' was not declared in this scope
   18 |         ll m =LLONG_MAX, num;
      |               ^~~~~~~~~
a.cc:9:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    8 | #include <map>
  +++ |+#include <climits>
    9 | #define ll long long
a.cc:26:9: error: 'num' was not declared in this scope; did you mean 'enum'?
   26 |         num = (a[n - 1] + 1) / 2;
      |         ^~~
      |         enum