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

#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second

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

  int n; cin >> n;
  int a[100100]; 
  rep(i, n) {
      cin >> a[i];
      a[i];
  }

  sort(a, a + n);
  int x = a[n - 1];
  rep(i, n) a[i] *= 2;

  int b = *lower_bound(a, a + n, x);
  int c = (lower_bound(a, a + n, x) != a.begin() ? *(lower_bound(a, a + n, x) - 1) : b);
  b /= 2; c /= 2;
  if(abs(x - b) >= abs(x - c)) {
      cout << x << " " << c << "\n";
  } else {
      cout << x << " " << b << "\n";
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:57:42: error: request for member 'begin' in 'a', which is of non-class type 'int [100100]'
   57 |   int c = (lower_bound(a, a + n, x) != a.begin() ? *(lower_bound(a, a + n, x) - 1) : b);
      |                                          ^~~~~
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second

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

  int n; cin >> n;
  int a[100100]; rep(i, n) cin >> a[i];

  sort(a, a + n);
  int b = *lower_bound(a, a + n, (a[n - 1] + 1) / 2);
  int c = *lower_bound(a, a + n, a[n - 1] / 2);
  int d = *(lower_bound(a, a + n, a[n - 1] / 2) - 1);

  if(a[n - 1] % 2 == 0) {
      if(abs(a[n - 1] / 2- c) >= abs(a[n - 1] / 2 - d)) {
          cout << a[n - 1] << " " << d << endl;
          return 0;
      } else {
          cout << a[n - 1] << " " << c << endl;
          return 0;
      }
  }
  if(a[n - 1] % 1 == 0) {
      int e;
      if(abs(a[n - 1] / 2- c) >= abs(a[n - 1] / 2 - d)) {
          e = d;
      } else {
          e = c;
      }

      if(abs(a[n - 1]  - 2 * e) >= abs(a[n - 1] - 2 * a)) {
          e = a;
      }
      cout << a[n - 1] << e << endl;
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:70:53: error: invalid operands of types 'int' and 'int [100100]' to binary 'operator*'
   70 |       if(abs(a[n - 1]  - 2 * e) >= abs(a[n - 1] - 2 * a)) {
      |                                                   ~ ^ ~
      |                                                   |   |
      |                                                   int int [100100]
a.cc:71:15: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   71 |           e = a;
      |               ^
      |               |
      |               int*
Language: C++

#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <iostream>
#include <algorithm>

typedef char                SINT8;
typedef unsigned char       UINT8;
typedef short               SINT16;
typedef unsigned short      UINT16;
typedef int                 SINT32;
typedef unsigned int        UINT32;
typedef long long           SINT64;
typedef unsigned long long  UINT64;
typedef double              DOUBLE;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))
#define rep(i,a,b) for(int (i)=int(a);(i)<int(b);(i)++)

#define INF 1e9;
#define MOD 1e9+7;
#define INF64 1e18;


using namespace std;

int main() {

	SINT32 N = 0;
	SINT32 ma = 0;
	SINT32 co = INF;
	SINT32 ANS = 0;

	cin >> N;

	vector<SINT32> DATA(N);
	
	rep(i,0,N) {
		cin >> DATA[i];
		ma = MAX(ma,DATA[i]);
	}

	rep(i,0,N) {
		if (DATA[i] != ma) {
			if (DATA[i] > ma/2) {
				if (co > (DATA[i]- ma/2 -1)) {
					co = (DATA[i]- ma/2 -1);
					ANS = DATA[i];
				}
			} else {
				if ((ma/2-DATA[i]) =< co) {
					co = (ma/2)-DATA[i];
					ANS = DATA[i];
				}
			}
		}
	}

	cout << ma <<" " << ANS <<endl;
	return 0;
}

//	sort(DATA.begin(),DATA.end());
//	sort(DATA.begin(),DATA.end(),std::greater<SINT32>());
//	__gcd(ANS,DATA[i]);

//	// DATA.emplace_back(BUF);	//後ろに追加

//  DATA.erase(std::unique(DATA.begin(), DATA.end()), DATA.end());	//ソート後に使用

//	DATA.insert(DATA.begin() + X, 0);	//X番目の要素に0を挿入


//	vector<vector<SINT32>> DP(N,vector<SINT32>(3));　//2次元配列

/*
	SINT32 M = 3;
	vector<pair<SINT32,SINT32>> DATA2(M);
	for (SINT32 i = 0; i < M; i++) {
		cin >> DATA2[i].first;
		cin >> DATA2[i].second;
	}
	sort(DATA2.begin(),DATA2.end());
	cout << DATA2[0].first << endl;
	cout << DATA2[0].second << endl;
*/

// 	vector<pair<int,pair<int,int>>> DATA(M);
//	cin >> DATA[i].first;
//	cin >> DATA[i].second.first;
//	cin >> DATA[i].second.second;


//		APOSI = lower_bound(ADATA.begin(),ADATA.end(),QDATA[i]) - ADATA.begin();
//		BPOSI = lower_bound(BDATA.begin(),BDATA.end(),QDATA[i]) - BDATA.begin();


/* 文字列回転
	string N;
	cin >> N;
	N = N[N.length()-1] + N.substr(0,N.length()-1);
*/

/* SET コンテナ
	set<SINT32> DATA;
	for (SINT32 i = 0; i < N; i++) {
		SINT32 buf;
		cin >> buf;
		DATA.insert(buf);
	}

	//全表示
    set<string>::iterator it; //  イテレータを用意
    for(it = DATA.begin(); it != DATA.end(); it++) {
        cout << *it << endl;
    }

	//N番目を一部表示
	set<string>::iterator it; //  イテレータを用意
	it = DATA.begin();
	rep (i,0,N) {
		it++;
	}
	cout << *it << endl;
*/

/* map
	map<string,SINT32> mp;
	SINT32 N = 0;
	SINT32 mx = 0;

	cin >> N;
	for (SINT32 i = 0; i < N; i++) {
		string s;
		cin >> s;
		mp[s]++;
	}
	for(auto it=mp.begin();it!=mp.end();it++) {
		mx=max(mx,it->second);
	}

*/

Compiler output:
a.cc: In function 'int main()':
a.cc:54:53: error: expected primary-expression before '<' token
   54 |                                 if ((ma/2-DATA[i]) =< co) {
      |                                                     ^
Language: C++

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

#define INF 1000000001
#define MOD 998244353
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

int main(){
  int n;
  cin>>n;
  vector<int>a(n);
  for(int i=0;i<n;i++)cin>>a[i];
  sort(rng(a));
  int ans=0;
  int d=INF;
  if(a[n-1]%2){
    for(int i=0;i<n-1;i++){
      int dd1=abs(a[n-1]/2-a[i]);
      int dd2=abs(a[n-1]/2+1-a[i]);
      if(dd1<=d)d=dd1,ans=i;
      else if(dd2<=d)d=dd2,ans=i;
    }
  }
  else{
    for(int i=0;i<n-1;i++){
      int dd=abs(a[n-1]/2-a[i]);
      if(dd<=d)d=dd,ans=i;
    }
  }
  cout<<a[n-1]<<" "<<a[ans]<<endl;
  return 0;
}

j

Compiler output:
a.cc:39:1: error: 'j' does not name a type
   39 | j
      | ^
Language: C++

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

const ll MOD = 1000000007;
const int MAX = 1000000001;
ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void comb_init() {
  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;
  }
}

// 二項係数計算 (combination. nCkを求める.)
ll comb(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;
vector<int> a;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N;
  a.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end(), greater<int>());
  comb_init();

  int ans_n = 0, ans_r = 0;
  ll comb_max = 0;
  int n = a[0];
  for (int i = 1; i < N; i++) {
    int r = a[i];
    ll c = comb(n, r);
    if (c > comb_max) {
      comb_max = c;
      ans_n = n;
      ans_r = r;
    }
  }

  cout << ans_n << " " << ans_r << endl;
  return 0;
}

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

#include<iostream>
#include<cmath>
#include<numeric>
#include<string>
#include<algorithm>
#include<vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define int64 long long
#define yokuwaruprime (10*10*10*10*10*10*10*10*10+7)
using namespace std;

int main(){
  int64 n;
  cin>>n;
  int64 a[n];
  rep(i,n){
    cin>>a[i];
  }
  sort(a,a+n);
  int64 pos=0,maximum=a[n-1];
  rep(i,n-1){
    if(a[i]<=maximum/2 && a[i+1]>maximum/2){
      pos=i;
    }
  }
  int64 ans;
  if(pos!=n-2){
  if(abs(a[pos]-maximum/2)>abs(a[pos+1]-maximum/2)){
    ans=a[pos+1];
  }else{
    ans=a[pos];
  }
  cout<<maximum<<" "<<ans<<endl;
  }else{
  cout<<maximum<<" "<<a[n-2]<<endl;
}


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

#include<iostream>
#include<cmath>
#include<numeric>
#include<string>
#include<algorithm>
#include<vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define int64 long long
#define yokuwaruprime (10*10*10*10*10*10*10*10*10+7)
using namespace std;

int main(){
  int64 n;
  cin>>n;
  int64 a[n];
  rep(i,n){
    cin>>a[i];
  }
  sort(a,a+n);
  int64 pos=0,maximum=a[n-1];
  rep(i,n-1){
    if(a[i]<=maximum/2 && a[i+1]>maximum/2){
      pos=i;
    }
  }
  int ans;
  if(abs(a[pos]-maximum/2)>=abs(a[pos+1]-maximum/2){
    ans=a[pos+1];
  }else{
    ans=a[pos];
  }
  cout<<maximum<<" "<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:52: error: expected ';' before '{' token
   28 |   if(abs(a[pos]-maximum/2)>=abs(a[pos+1]-maximum/2){
      |                                                    ^
      |                                                    ;
a.cc:30:4: error: expected primary-expression before 'else'
   30 |   }else{
      |    ^~~~
a.cc:30:4: error: expected ')' before 'else'
   30 |   }else{
      |    ^~~~
      |    )
a.cc:28:5: note: to match this '('
   28 |   if(abs(a[pos]-maximum/2)>=abs(a[pos+1]-maximum/2){
      |     ^
Language: C++

#include<iostream>
#include<cmath>
#include<numeric>
#include<string>
#include<algorithm>
#include<vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define int64 long long
#define yokuwaruprime (10*10*10*10*10*10*10*10*10+7)
using namespace std;

int64 binom(int64 x,int64 y){
  int ans=1;
  rep(i,y){
    ans*=x-i;
    ans/=i+1;
  }
  return ans;
}

int main(){
  int64 n;
  cin>>n;
  int64 a[n];
  sort(a,a+n);
  int64 pos=0,maximum=a[n-1];
  rep(i,n-1){
    if(a[i]<=max/2 && a[i+1]>max/2){
      pos=i;
    }
  }
  cout<<max(binom(maximum,a[i]),binom(maximum,a[i+1]))<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:17: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator/'
   29 |     if(a[i]<=max/2 && a[i+1]>max/2){
      |              ~~~^~
a.cc:29:33: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator/'
   29 |     if(a[i]<=max/2 && a[i+1]>max/2){
      |                              ~~~^~
a.cc:33:29: error: 'i' was not declared in this scope
   33 |   cout<<max(binom(maximum,a[i]),binom(maximum,a[i+1]))<<endl;
      |                             ^
Language: C++

#include<iostream>
#include<cmath>
#include<numeric>
#include<string>
#include<algorithm>
#include<vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define int64 long long
#define yokuwaruprime (10*10*10*10*10*10*10*10*10+7)
using namespace std;

int64 binom(int64 x,int64 y){
  int ans=1;
  rep(i,y){
    ans*=x-i;
    ans/=i+1;
  }
  return ans;
}

int main(){
  int64 n;
  cin>>n;
  int64 a[n];
  sort(a,a+n);
  int64 pos=0,max=a[n-1];
  rep(i,n-1){
    if(a[i]<=max/2 && a[i+1]>max/2){
      pos=i;
    }
  }
  cout<<max(binom(max,a[i]),binom(max,a[i+1]))<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:25: error: 'i' was not declared in this scope
   33 |   cout<<max(binom(max,a[i]),binom(max,a[i+1]))<<endl;
      |                         ^
a.cc:33:46: error: 'max' cannot be used as a function
   33 |   cout<<max(binom(max,a[i]),binom(max,a[i+1]))<<endl;
      |                                              ^
Language: C++

include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;

int main(){
  int n;
  cin >> n;
  int a[n];
  int M = 0;
  for(int i = 0; i < n; i++){
    cin >> a[i];
    M = max(M, a[i]);
  }
  int m = INF, ans;
  if(M % 2){
    int l = M/2, r = M/2 + 1;
    for(int i = 0; i < n; i++){
      int d = min(abs(l-a[i]), abs(r-a[i]));
      if(d < m && a[i] < M){
        m = d;
        ans = a[i];
      }
    }
  } else {
    for(int i = 0; i < n; i++){
      int d = abs(a[i] - M/2);
      if(d < m && a[i] < M){
        m = d;
        ans = a[i];
      }
    }
  }
  cout << M << " " << ans << endl;
  return 0;
}


Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:7:3: error: 'cin' was not declared in this scope
    7 |   cin >> n;
      |   ^~~
a.cc:12:9: error: 'max' was not declared in this scope
   12 |     M = max(M, a[i]);
      |         ^~~
a.cc:18:19: error: 'abs' was not declared in this scope; did you mean 'ans'?
   18 |       int d = min(abs(l-a[i]), abs(r-a[i]));
      |                   ^~~
      |                   ans
a.cc:18:15: error: 'min' was not declared in this scope; did you mean 'main'?
   18 |       int d = min(abs(l-a[i]), abs(r-a[i]));
      |               ^~~
      |               main
a.cc:26:15: error: 'abs' was not declared in this scope; did you mean 'ans'?
   26 |       int d = abs(a[i] - M/2);
      |               ^~~
      |               ans
a.cc:33:3: error: 'cout' was not declared in this scope
   33 |   cout << M << " " << ans << endl;
      |   ^~~~
a.cc:33:30: error: 'endl' was not declared in this scope
   33 |   cout << M << " " << ans << endl;
      |                              ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,a=0,b,d=-1;
  cin>>n;
  int c[n];
  for(int i=0;i<n;i++){
    cin>>c[i];
    a=max(a,c[i]);
  }
  for(int i=0;i<n;i++){
    if(c[i]!=a){
      if(d<min(c[i],a-c[i]){
        b=c[i];
        d=min(c[i],a-c[i]);
      }
    }
  }
  cout<<a<<" "<<b;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:28: error: expected ')' before '{' token
   13 |       if(d<min(c[i],a-c[i]){
      |         ~                  ^
      |                            )
a.cc:17:5: error: expected primary-expression before '}' token
   17 |     }
      |     ^
Language: C++

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

ll gcd(ll x,ll y){
if(x==0) return y;
return gcd(y%x, x);
}
ll lcm(ll x,ll y) {return x*y/gcd(x,y);}

ll nikou(int n, int m) {
	ll qqq = 1;
	for (ll i = 1; i <= m; i++) 
		qqq = qqq * (n - i + 1) / i;
		return qqq;
	}


int main() {
 int n; cin>>n;
  int que[n];
  int quep[n];
  rep(i, n){cin>>que[i];
        quep[i]=que[i];}
  
  sort(que,que+n,greater<int>());
  
  int maxs[n];
  rep(i, n){
      maxs[i]=abs(que[0]/2-quep[i]);
      int mind=-1;
      int maxdif=1000000001;
  rep(i, n){if (maxs[i]<maxdif){mind=i;maxdif=maxs[i];}}
            cout<<que[0]<<" "<<quep[mind]<<endl;
    

  }


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

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

ll gcd(ll x,ll y){
if(x==0) return y;
return gcd(y%x, x);
}
ll lcm(ll x,ll y) {return x*y/gcd(x,y);}

ll nikou(int n, int m) {
	ll qqq = 1;
	for (ll i = 1; i <= m; i++) 
		qqq = qqq * (n - i + 1) / i;
		return qqq;
	}


int main() {
 int n; cin>>n;
  int que[n];
  int quep[n];
  rep(i, n){cin>>que[i];
        quep[i]=que[i];}
  
  sort(que,que+n,greater<int>());
  
  int maxs[n];
  rep(i, n){
    if(
    maxs[i]=abs(que[0]/2-quep[i]);
      int mind=-1;
      int maxdif=1000000001;
  rep(i, n){if (maxs[i]<maxdif){mind=i;maxdif=maxs[i];}
            cout<<que[0]<<" "<<quep[mind]<<endl;
    

  }


Compiler output:
a.cc: In function 'int main()':
a.cc:34:18: error: expected ')' before ';' token
   34 |       int mind=-1;
      |                  ^
      |                  )
a.cc:32:7: note: to match this '('
   32 |     if(
      |       ^
a.cc:36:33: error: 'mind' was not declared in this scope
   36 |   rep(i, n){if (maxs[i]<maxdif){mind=i;maxdif=maxs[i];}
      |                                 ^~~~
a.cc:37:37: error: 'mind' was not declared in this scope
   37 |             cout<<que[0]<<" "<<quep[mind]<<endl;
      |                                     ^~~~
a.cc:40:4: error: expected '}' at end of input
   40 |   }
      |    ^
a.cc:31:12: note: to match this '{'
   31 |   rep(i, n){
      |            ^
a.cc:40:4: error: expected '}' at end of input
   40 |   }
      |    ^
a.cc:21:12: note: to match this '{'
   21 | int main() {
      |            ^
Language: C++

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

ll gcd(ll x,ll y){
if(x==0) return y;
return gcd(y%x, x);
}
ll lcm(ll x,ll y) {return x*y/gcd(x,y);}

ll nikou(int n, int m) {
	ll qqq = 1;
	for (ll i = 1; i <= m; i++) 
		qqq = qqq * (n - i + 1) / i;
		return qqq;
	}


int main() {
 int n; cin>>n;
  int que[n];
  int quep[i];
  rep(i, n){cin>>que[i];
        quep[i]=que[i];}
  
  sort(que,que+n;greater<int>());
  
  int maxs[n];
  rep(i, n){
    if(
    maxs[i]=abs(que[0]/2-quep[i]);
      int mind=-1;
      int maxdif=1000000001;
  rep(i, n){if (maxs[i]<maxdif){mind=i;maxdif=maxs[i];}
            cout<<que[0]<<" "<<quep[mind]<<endl;
    

  }


Compiler output:
a.cc: In function 'int main()':
a.cc:24:12: error: 'i' was not declared in this scope
   24 |   int quep[i];
      |            ^
a.cc:26:9: error: 'quep' was not declared in this scope; did you mean 'que'?
   26 |         quep[i]=que[i];}
      |         ^~~~
      |         que
a.cc:28:17: error: expected ')' before ';' token
   28 |   sort(que,que+n;greater<int>());
      |       ~         ^
      |                 )
a.cc:28:32: error: expected ';' before ')' token
   28 |   sort(que,que+n;greater<int>());
      |                                ^
      |                                ;
a.cc:33:26: error: 'quep' was not declared in this scope; did you mean 'que'?
   33 |     maxs[i]=abs(que[0]/2-quep[i]);
      |                          ^~~~
      |                          que
a.cc:34:18: error: expected ')' before ';' token
   34 |       int mind=-1;
      |                  ^
      |                  )
a.cc:32:7: note: to match this '('
   32 |     if(
      |       ^
a.cc:36:33: error: 'mind' was not declared in this scope
   36 |   rep(i, n){if (maxs[i]<maxdif){mind=i;maxdif=maxs[i];}
      |                                 ^~~~
a.cc:37:32: error: 'quep' was not declared in this scope; did you mean 'que'?
   37 |             cout<<que[0]<<" "<<quep[mind]<<endl;
      |                                ^~~~
      |                                que
a.cc:37:37: error: 'mind' was not declared in this scope
   37 |             cout<<que[0]<<" "<<quep[mind]<<endl;
      |                                     ^~~~
a.cc:40:4: error: expected '}' at end of input
   40 |   }
      |    ^
a.cc:31:12: note: to match this '{'
   31 |   rep(i, n){
      |            ^
a.cc:40:4: error: expected '}' at end of input
   40 |   }
      |    ^
a.cc:21:12: note: to match this '{'
   21 | int main() {
      |            ^
Language: C++

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

int main(){
  int N;
  cin >> N;
  vector<int> a(N);
  for(int i=0;i<N;i++){
    cin >> a.at(i);
  }
  sort(a.begin(),a.end());
  int max=a.at(N-1);
  cout << max << " ";
  int c,C,ans;
  for(int i=0;i<N;i++){
    c=a.at(i)*2-max;
    if(c>=0){
      ans=i;
      break;
    }
    C=c;
  }
  if(abs(C)>abs(c))
    //iが最小
    cout << a.at(i);
  else
    cout << a.at(i-1);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:18: error: 'i' was not declared in this scope
   25 |     cout << a.at(i);
      |                  ^
a.cc:27:18: error: 'i' was not declared in this scope
   27 |     cout << a.at(i-1);
      |                  ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define MM = 1000000000;
#define mod = MM + 7;
#define INF (ll)1e18
#define pi acos(-1.0)
#define MAX 100005
#define NIL -1
#define rep(i, n) for(int i = 0; i < n; i++)
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
int func(ll m){
    ll sum = 1;
    while(m > 0){
        sum *= m;
        m--;
    }
    return sum;
}
int main(){
    ll n; cin >> n;
    ll a[n];
    ll mx = 0;
    rep(i, n){
        cin >> a[i];
        mx = max(mx, a[i]);
    }
    sort(a,a+n);
    ll ans1 = 0, ans2 = 0;
    rep(i, n){
        if(mx-a[i] <= a[i]+1){
            ans1 = mx;
            ans2 = a[i];
        }
    }
    cout << ans1 << " " << a[i] << endl;;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:37:30: error: 'i' was not declared in this scope
   37 |     cout << ans1 << " " << a[i] << endl;;
      |                              ^
Language: C++

# your code goes here
import numpy as np
n = int(input())
a = np.zeros(n, dtype=int)
buf = input().split()
for i in range(n):
	a[i] = int(buf[i])
alpha = np.max(a)
bata = a[np.argmin(np.abs(a-alpha/2))]
print(alpha, bata)

Compiler output:
a.cc:1:3: error: invalid preprocessing directive #your
    1 | # your code goes here
      |   ^~~~
a.cc:2:1: error: 'import' does not name a type
    2 | import numpy as np
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include <bits/stdc++.h>

#define vec(v) vector<int>(v)
#define be(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define mapci(mp) map<char*,int>(mp)
#define mapcc(mp) map<char*,char*>(mp)
typedef long long ll;
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    ll a[n],mi,ma=-1,y,x;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
    ma=a[n-1];
    mi=1e9+1;
    if(ma%2==0){
        ma/=2;
        for(int i=0;i<n-1;i++){
            mi=min(mi,abs(a[i]-ma));
            x=a[i];
        }
        cout <<ma*2<<" "<<x<<endl;
    }
    else{
        assert(m%2==0);
        ma/=2;
        for(int i=0;i<n-1;i++){
            y=abs(a[i]-ma);
            if(mi>y){
                mi=y;
                x=a[i];
            }
            else if(mi==y){
                if(a[i]>ma){
                    mi=y;
                    x=a[i];
                }
            }
        }
        cout <<ma*2+1<<" "<<x<<endl;
    }
    return 0;
}


Compiler output:
In file included from /usr/include/c++/14/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:106,
                 from a.cc:1:
a.cc: In function 'int main()':
a.cc:32:16: error: 'm' was not declared in this scope
   32 |         assert(m%2==0);
      |                ^
Language: C++

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



int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin>>n;
    vector<int>a(n);
    rep(i,n)cin>>a[i];
    sort(a.begin(),a.end());
    cout<<a[n-1]<<' ';

    int dif=1e9+7,k=0;
    rep(i,n-1){
        if(dif>abs(a[n-1]/2-a[i])){
            dif=abs(a[n-1]/2-a[i]);
            k=i;
        }
    }
    cout<<a[k]]<<endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:15: error: expected ';' before ']' token
   28 |     cout<<a[k]]<<endl;
      |               ^
      |               ;
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a.at(i);
    int pi = distance(a.begin(), max_element(a.begin(), a.end()));
    int ai = a.at(pi);
    a.erase(a.begin() + pi);
    vector<int> b = a;
    for (int i = 0; i < n - 1; i++) b.at(i) = abs(b.at(i) * 2 - ai);
    int aj = a.at(distance(b.begin(), min_element(b.begin(), b.end())));
    cout << ai << " " << aj << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:34: error: 'max_element' was not declared in this scope
   11 |     int pi = distance(a.begin(), max_element(a.begin(), a.end()));
      |                                  ^~~~~~~~~~~
a.cc:16:39: error: 'min_element' was not declared in this scope
   16 |     int aj = a.at(distance(b.begin(), min_element(b.begin(), b.end())));
      |                                       ^~~~~~~~~~~
Language: C++

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

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

#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
using namespace std;

#define rep(i,a) for(int i=0; i<a; i++)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define loop3(i,j,k,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)
#define loop4(i,j,k,l,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)for(int l=0; l<a; l++)if(i!=l&&j!=l&&k!=l)
#define rep1(i,a) for(int i=1; i<=a; i++)

#define scnd1(a) scanf("%d", &a)
#define scnd2(a,b) scanf("%d%d", &a,&b)
#define scnd3(a,b,c) scanf("%d%d%d", &a,&b,&c)
#define scnd4(a,b,c,d) scanf("%d%d%d%d", &a,&b,&c,&d)

#define cin1(a) cin >> a;
#define cin2(a,b) cin >> a >> b;
#define cin3(a,b,c) cin >> a >> b >> c;
#define cin4(a,b,c,d) cin >> a >> b >> c >> d;
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define prtd1(a) printf("%d\n", a)
#define prtd2(a,b) printf("%d %d\n", a,b)
#define prtd3(a,b,c) printf("%d %d %d\n", a,b,c)
#define prtd4(a,b,c,d) printf("%d %d %d %d\n", a,b,c,d)

#define mem(a,n) memset( a, n, sizeof(a))

typedef long long ll;

int main() {
    int N, A, B;
    vector<int> nums;
    scnd1(N);
    int n;
    rep( i, N) {
        scnd1( n);
        nums.push_back(n);
    }
    
    sort( nums.begin(), nums.end());
    
    A = nums[N-1];
    B = nums[0];
    double d = A*1.0/2;
    
    int i = 1;
    while ( i<N-1 && abs(B-d) > abs(nums[i]-d)) {
        B = nums[i++];
    }
    cout2(A,B);
}

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

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



long nCr(int n, int r)
{
  long dp[111111111111][111111111111];
       if(n==r) return dp[n][r] = 1;
       if(r==0) return dp[n][r] = 1;
       if(r==1) return dp[n][r] = n;
       if(dp[n][r]) return dp[n][r];
       return dp[n][r] = nCr(n-1,r) + nCr(n-1,r-1);
}

int main(){

  int n,i,j,m,max=0;

  int B[2];

  std::vector<int> A;

std::cin >> n;

  for(i=0;i<n;i++){
    std::cin >> m;
    A.push_back(m);
  }

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

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(A[i]<A[j]){
        if(max<nCr(A[j],A[i])){
           max=nCr(A[j],A[i]);
           B[0]=A[j];
           B[1]=A[i];
         }
      }
    }
  }



std::cout << B[0] <<" " <<B[1];

return 0;

}



Compiler output:
a.cc: In function 'long int nCr(int, int)':
a.cc:12:8: error: size of array 'dp' exceeds maximum object size '9223372036854775807'
   12 |   long dp[111111111111][111111111111];
      |        ^~
a.cc:13:24: error: 'dp' was not declared in this scope
   13 |        if(n==r) return dp[n][r] = 1;
      |                        ^~
a.cc:14:24: error: 'dp' was not declared in this scope
   14 |        if(r==0) return dp[n][r] = 1;
      |                        ^~
a.cc:15:24: error: 'dp' was not declared in this scope
   15 |        if(r==1) return dp[n][r] = n;
      |                        ^~
a.cc:16:11: error: 'dp' was not declared in this scope
   16 |        if(dp[n][r]) return dp[n][r];
      |           ^~
a.cc:17:15: error: 'dp' was not declared in this scope
   17 |        return dp[n][r] = nCr(n-1,r) + nCr(n-1,r-1);
      |               ^~
Language: C++

#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
 
int main() {
    long long int N; 
    cin >> N; 
    int a[114514];
    for(int i = 0; i < N; ++i){
    cin >> a[i];
    }
    sort(a, a + N, greater<int>());
    int M = a[0]; 
    int b[114514]; 
    for(int i = 0; i < N; ++i){
    b[i] = abs(M - a[i] * 2);  
    }
    long long int m = 2 * M; 
    for(int i = 1; i < N; ++i){
    m = min(m, b[i]);
    }
    string ans = "No"; 
    for(int i = 1; i < N; ++i){
    if(2 * a[i] == M - m)
    ans = "Yes"; 
    break; 
    }
    if(ans == "Yes") 
      cout << M << " " << (M-m)/2 << endl; 
    else if(ans == "No") 
      cout << M << " " << (M+m)/2 << endl; 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:12: error: no matching function for call to 'min(long long int&, int&)'
   20 |     m = min(m, b[i]);
      |         ~~~^~~~~~~~~
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:20:12: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   20 |     m = min(m, b[i]);
      |         ~~~^~~~~~~~~
/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:20:12: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   20 |     m = min(m, b[i]);
      |         ~~~^~~~~~~~~
Language: C++

#include<bits/stdc++.h>
#define PI acos(-1.0)
#define pb push_back
#define F first
#define S second
using namespace std;
typedef long long ll;
const int N=2e5+5;
const int MOD=1e9+7;
ll a[N];
int main(void){
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);

    int n;
    cin >> n;
    for(int i=1;i<=n;i+)    cin >> a[i];
    sort(a+1,a+1+n);
    ll ans,dis=1e18;
    ll pos=upper_bound(a+1,a+n,a[n]/2);
    for(int i=1;i<=n-1;i++){
        if(a[n]%2==0){
            if(abs(a[i]-a[n]/2)<dis)    ans=a[i],dis=abs(a[i]-a[n]/2);
        }
        else{
            if(abs(a[i]-a[n]/2)<dis)    ans=a[i],dis=abs(a[i]-a[n]/2);
            if(abs(a[i]-a[n]/2-1)<dis)    ans=a[i],dis=abs(a[i]-a[n]/2-1);
        }
    }
    cout << ans <<" "<<a[n]<<endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:24: error: expected primary-expression before ')' token
   17 |     for(int i=1;i<=n;i+)    cin >> a[i];
      |                        ^
a.cc:20:23: error: invalid conversion from 'long long int*' to 'll' {aka 'long long int'} [-fpermissive]
   20 |     ll pos=upper_bound(a+1,a+n,a[n]/2);
      |            ~~~~~~~~~~~^~~~~~~~~~~~~~~~
      |                       |
      |                       long long int*
Language: C++

#include <iostream>
#include <cmath>
#include <string>
#include <set>
#include <vector>
#include <map>
#include <list>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
int main(void) {
    ll i, n;
    cin >> n;
    ll t;
    vector<ll> a;
    for(i=0; i<n; i++) {
        scanf("%lld", &t);
        a.push_back(t);
    }
    sort(a.begin(), a.end());
    ll mx=a[n-1];
    ll mi=mx, tmp=-1;
    for(i=0; i<n; i++) {
        if(mi>=abs(mx/2-a[i]) && mx!=a[i]) {
            mi = abs(mx/2-a[i]);
            tmp = a[i];
        }
        
    }
    cout << mx << ' ' << tmp << endl;
}


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

#include <iostream>
#include "bits/stdc++.h"
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a) for(int i=0;i<a;i++)
#define debug int debug = 0;
#define RREP(i,a) for(int i=a-1;i>=0;i--)
#define rrep(i,a,b) for(int i=a-1;i>=b;i--)
#define printall(n,array) {for(int i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;}
#define U() cout<<endl;
typedef long long ll;
typedef pair<int, int> PI;
typedef pair<int, PI> V;
typedef vector<int> VE;
const ll mod = 1000000007; //10^9+7

int main() {
    int n;
    vector<ll> a;
    ll V;
    ll max_ = 0;
    int mindex = 0;
    cin >> n;
    REP(i, n){
        cin >> V;
        a.push_back(V);
        if(V > max_){
            max_ = V;
            mindex = i;
        }
    }
    float double diff = mod;
    float double center = float(max_) / 2;
    int index = 0;
    REP(i, a.size()){
        if(i == mindex)continue;
        if(abs(a[i] - center) < diff){
            diff = abs(a[i] - center);
            index = i;
//            print("a[i] = " << a[i]);
        }
        print(i << " " << diff);
    }
    print(max_ << " " << a[index]);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:5: error: two or more data types in declaration of 'diff'
   33 |     float double diff = mod;
      |     ^~~~~
a.cc:34:5: error: two or more data types in declaration of 'center'
   34 |     float double center = float(max_) / 2;
      |     ^~~~~
a.cc:38:23: error: 'center' was not declared in this scope
   38 |         if(abs(a[i] - center) < diff){
      |                       ^~~~~~
a.cc:38:33: error: 'diff' was not declared in this scope
   38 |         if(abs(a[i] - center) < diff){
      |                                 ^~~~
a.cc:43:27: error: 'diff' was not declared in this scope
   43 |         print(i << " " << diff);
      |                           ^~~~
a.cc:4:24: note: in definition of macro 'print'
    4 | #define print(x) cout<<x<<endl;
      |                        ^
Language: Java

import java.util.*;

class Main
{
    public static void main (String[] args)
    {
        int r;

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int[] a = new int[n];
        for(int i = 0; i < n; ++i){
            a[i] = sc.nextInt();
        }
        Arrays.sort(a);

        r = a[n-1] / 2;
        int r_index = 0;;

        int i = 1;

        r_index = Arrays.binarySearch(a, r);
        if(r_index >= 0){
            r = a[r_index];
        }else{
            r_index = -r_index - 1;
            if(r_index != 0){
                r = ( ( Math.abs( a[n-1] / 2 - a[r_index] ) ) < Math.abs( ( a[r_index - 1] - a[n-1] / 2) ) ) ?  a[r_index] : a[r_index - 1];
            }else{
                r = a[r_index];
            }
        }

        System.out.println(a[n-1] + " " + r);
    }


Compiler output:
Main.java:36: error: reached end of file while parsing
    }
     ^
1 error
Language: C++

#include <iostream>
#include <algorithm>
#include <functional>
#include<vector>
#include<math.h>
#include<bitset>
#include<string>
#include <deque>
#include<queue>
#include<map>
using namespace std;





int main() {
	long long int N;
	cin >> N;
	long long int A[100005];
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	sort(A, A + N);
	int Y;
	long long   Z = 100000000;
	for (int i = 0; i < N - 1; i++) {
		if (abs(A[N - 1] + 1 / 2 - A[i]) < Z) {
			Z = abs(A[N - 1] + 1 / 2 - A[i];
			Y = A[i];
		}
		
	}

	cout << A[N - 1] << " " <<Y<< endl;
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:29:56: error: expected ')' before ';' token
   29 |                         Z = abs(A[N - 1] + 1 / 2 - A[i];
      |                                ~                       ^
      |                                                        )
Language: C++

#include <stack>
#include <queue>
#include <cstdio>
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
 
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n0,n) for(int i=n0;i<n;i++)
#define Com(i,j,n) for(int i=0;i<n-1;i++)for(int j=i+1;j<n;j++)
#define INF (1<<29)
#define test cout << "test" << endl;
#define NNN_MAX 100010
typedef pair<int,int> P;

float abs(int a, int b){
	if(a>b) return a-b;
	else return b-a;
}

int main (){

	int NNN;
	cin >>NNN;
	int temp;
	vector <int> a;
	bool po[NNN];
	rep(i,NNN){
		cin >> temp;
		a.push_back(temp);
		po[i]=true;
	}
	if(NNN==2){
		cout << a[0] << " " << a[1] << endl;
		return 0;
	}
	//NNN>2

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

	a.unique(a.begin(),a.end());
	if(a.size()==1){
		cout << a[0] <<" " << a[0] << endl;
	}

	//maxの半分に一番近い数字を探そう
	int temp1,temp2;
	int pointer=0;
	int halfmax = (max+max%2)/2;


	//最初に真ん中にポインターを置く
	pointer=(a.size()-a.size()%2)/2; 

	int count =1;
	//終了条件 = abs(a[pointer-1],max/2)
	while(count<40){
		
		//po[pointer]=false;
		//丁度半分、0にきちゃった、上から2番めのところまで来ちゃった
		if(a[pointer]==halfmax){
			break;
		}
		if(pointer <= 0){
			if(abs(halfmax,a[0])>=abs(halfmax,a[1])){
				pointer =1;
				break;
			}
			else {
				pointer =0;
				break;
			}
		}
		if(pointer == a.size()-2){
			if(abs(halfmax,a[pointer])>=abs(halfmax,a[pointer-1])){
				pointer --;
				break;
			}
			else {
				break;
			}
		}

		//前後が今よりも悪くなる＝今が最適
		if(abs(a[pointer],halfmax)<=abs(a[pointer-1],halfmax) && abs(a[pointer],halfmax)<=abs(a[pointer+1],halfmax)){
			break;
		}

		if(a[pointer] < halfmax){
			count ++;
			pointer = pointer - floor(a.size()/pow(2,count))-1;
			if(po[pointer] == false){
				break;
			}

		}
		if(a[pointer] > halfmax){
			count ++;
			pointer = pointer + floor(a.size()/pow(2,count))+1;
			if(po[pointer] == false ){
				break;
			}

		}



	}

	if(count==40){
		cout << a[0] <<" " << a[pointer+2] << endl;
		return 0;
	}

	cout << a[0] << " " << a[pointer] << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:11: error: 'class std::vector<int>' has no member named 'unique'
   46 |         a.unique(a.begin(),a.end());
      |           ^~~~~~
Language: C++

#include <stack>
#include <queue>
#include <cstdio>
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
 
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n0,n) for(int i=n0;i<n;i++)
#define Com(i,j,n) for(int i=0;i<n-1;i++)for(int j=i+1;j<n;j++)
#define INF (1<<29)
#define test cout << "test" << endl;
#define NNN_MAX 100010
typedef pair<int,int> P;

float abs(int a, int b){
	if(a>b) return a-b;
	else return b-a;
}

int main (){

	int NNN;
	cin >>NNN;
	int temp;
	vector <int> a;
	bool po[NNN];
	rep(i,NNN){
		cin >> temp;
		a.push_back(temp);
		po[i]=true;
	}
	if(NNN==2){
		cout << a[0] << " " << a[1] << endl;
		return 0;
	}
	//NNN>2

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

	//maxの半分に一番近い数字を探そう
	int temp1,temp2;
	int pointer=0;
	int halfmax = (max-max%2)/2;


	//最初に真ん中にポインターを置く
	pointer=(a.size()-a.size()%2)/2; 

	int count =1;
	//終了条件 = abs(a[pointer-1],max/2)
	while(count<40){
		
		//po[pointer]=false;
		//丁度半分、0にきちゃった、上から2番めのところまで来ちゃった
		if(a[pointer]==halfmax){
			break;
		}
		if(pointer <= 0){
			if(abs(halfmax,a[0])>=abs(halfmax,a[1])){
				pointer =1;
				break;
			}
			else {
				pointer =0;
				break;
			}
		}
		if(pointer == a.size()-2){
			if(abs(halfmax,a[pointer])>=abs(halfmax,a[pointer-1])){
				pointer --;
				break;
			}
			else {
				break;
			}
		}

		//前後が今よりも悪くなる＝今が最適
		if(abs(a[pointer],halfmax)<=abs(a[pointer-1],halfmax) && abs(a[pointer],halfmax)<=abs(a[pointer+1],halfmax)){
			break;
		}

		if(a[pointer] < halfmax){
			count ++;
			pointer = pointer - floor(a.size()/pow(2,count))-1;
			if(po[pointer] == false){
				break;
			}

		}
		if(a[pointer] > halfmax){
			count ++;
			pointer = pointer + floor(a.size()/pow(2,count))+1;
			if(po[pointer] == false ){
				break;
			}

		}



	}

	if(count==40){
		cout << a[0] <<" " << a[pointer-1] << endl;/
		return 0;
	}

	cout << a[0] << " " << a[pointer] << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:111:60: error: expected primary-expression before '/' token
  111 |                 cout << a[0] <<" " << a[pointer-1] << endl;/
      |                                                            ^
a.cc:112:17: error: expected primary-expression before 'return'
  112 |                 return 0;
      |                 ^~~~~~
Language: C++

#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define rep(N) for (int i = 0; i < N; ++i)
#define Rep(a, b) for (int i = a; i < b; ++i)
#define For(i, N) for (int i = 0; i < N; ++i)
#define all(v) v.begin(), v.end()
#define rev(v) v.rbegin(), v.rend()
#define makei(N) int N; cin >> N;
#define makel(N) ll N; cin >> N;
#define makes(s) string s; cin >> s;
#define maked(d) double d; cin >> d;
#define makev(v, N) vi v(N); rep(N)cin >> v[i];
#define mod 1000000007
#define re return 0

using namespace std;
using ll = long long int;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vs = vector<string>;
using pii = pair<int, int>;
using pis = pair<int, string>;
using msi = map<string, int>;

template<typename T>
void say(T s) {
	cout << s << "\n";
}

template<typename T>
void say(vector<T> s) {
	auto itr = s.begin();
	cout << *(itr++);
	while (itr != s.end()) {
		cout << " " << *(itr++);
	}
	cout << "\n";
}

void yn(bool b) {
	if (b)say("Yes");
	else say("No");
}

void YN(bool b) {
	if (b)say("YES");
	else say("NO");
}
template<typename T>
void maxi(T &a, T &b) {
	a = max(a, b);
}

template<typename T>
void mini(T &a, T &b) {
	a = min(a, b);
}

int main() {
	makei(N);
	makev(a, N);
	sort(all(a));
	int N = a.back();
	double min = INT_MAX;
	int index;
	rep(N) {
		if (abs((double)N / 2 - a[i]) < min) {
			index = i;
			min = abs((double)N / 2 - a[i]);
		}
	}
	cout << N << " " << a[index] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:66:13: error: redeclaration of 'int N'
   66 |         int N = a.back();
      |             ^
a.cc:63:15: note: 'int N' previously declared here
   63 |         makei(N);
      |               ^
a.cc:8:22: note: in definition of macro 'makei'
    8 | #define makei(N) int N; cin >> N;
      |                      ^
Language: C++

n = gets.to_i
a = gets.chomp.split.map(&:to_i)

a.sort!
x = a.last
a.pop
a.map!{|y| [y, [x - y, y].min]}
a.sort_by!{|y| y.last}

puts "#{x} #{a.last.first}"

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = gets.to_i
      | ^
a.cc:8:1: error: 'a' does not name a type
    8 | a.sort_by!{|y| y.last}
      | ^
a.cc:10:1: error: 'puts' does not name a type
   10 | puts "#{x} #{a.last.first}"
      | ^~~~
Language: C++

#include <iostream>
#include <math.h>
using namespace std;
int main() {
    int n,a[100000],an=0,ar=0,i,work=0,mh;
    cin>>n;
    for(i=0;i<n;i++){
        cin>>a[i];
        if(a[i]>work)an=a[i];
    }
    mh=an/2;
    work=INT_MAX;
    for(i=0;i<n;i++){
        if(abs(a[i]-mh)<work&&a[i]!=an){
            work=abs(a[i]-mh);
            ar=a[i];
        }
    }
    cout<<an<<" "<<ar<<endl;
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:10: error: 'INT_MAX' was not declared in this scope
   12 |     work=INT_MAX;
      |          ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <math.h>
  +++ |+#include <climits>
    3 | using namespace std;