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

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (auto &&i : v) scanf("%d", &i);
    sort(v.begin(), v.end());
    int a = v[n-1], b = 0;
    for (int j = 1; j < n-1; ++j) {
        if(std::abs(a/2.0-v[j]) < std::abs(a/2.0-v[b])) b = j;
    }
    cout << a << " " << v[b] << "\n";
    return 0;
}


Compiler output:
a.cc:14:21: error: '::numeric_limits' has not been declared
   14 | constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;
      |                     ^~~~~~~~~~~~~~
a.cc:14:37: error: expected primary-expression before '>' token
   14 | constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;
      |                                     ^
a.cc:14:43: error: no matching function for call to 'max()'
   14 | constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;
      |                                      ~~~~~^~
In file included 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/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 0 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   candidate expects 2 arguments, 0 provided
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (auto &&i : v) scanf("%d", &i);
    sort(v.begin(), v.end());
    int a = v[n-1], b = 0;
    for (int j = 1; j < n-1; ++j) {
        if(abs(a/2.0-v[j]) < abs(a/2.0-v[b])) b = j;
    }
    cout << a << " " << v[b] << "\n";
    return 0;
}


Compiler output:
a.cc:14:21: error: '::numeric_limits' has not been declared
   14 | constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;
      |                     ^~~~~~~~~~~~~~
a.cc:14:37: error: expected primary-expression before '>' token
   14 | constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;
      |                                     ^
a.cc:14:43: error: no matching function for call to 'max()'
   14 | constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;
      |                                      ~~~~~^~
In file included 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/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 0 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   candidate expects 2 arguments, 0 provided
Language: C++

#include <bits/stdc++.h>

using namespace std;
const int maxn = 100005;

int a[maxn];
double b[maxn];

int main() {
	int n, maxa = -1;

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

	sort(a + 1, a + 1 + n);
	double mid = 1.0 * a[n] / 2, m1 = 1000000009.0;

	int ans;

	for (int i = 1; i < n; ++i) {
		if (fabs(mid - (1.0 * a[n] - 1.0 * a[i])) < m1) {
			ans = a[i];
			minb = fabs(mid - (1.0 * a[n] - 1.0 * a[i]));
		}
	}
    printf("%d %d\n",a[n],ans);

}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:25: error: 'minb' was not declared in this scope
   25 |                         minb = fabs(mid - (1.0 * a[n] - 1.0 * a[i]));
      |                         ^~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;
const int maxn = 100005;

int a[maxn];
double b[maxn];

int main() {
	int n, maxa = -1;

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

	sort(a + 1, a + 1 + n);
	double mid = 1.0 * a[n] / 2, m1 = 1000000009.0;

	int ans;

	for (int i = 1; i < n; ++i) {
		if (fabs(mid - (1.0 * a[n] - 1.0 * a[i])) < minb) {
			ans = a[i];
			minb = fabs(mid - (1.0 * a[n] - 1.0 * a[i]));
		}
	}
    printf("%d %d\n",a[n],ans);

}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:61: error: 'minb' was not declared in this scope
   23 |                 if (fabs(mid - (1.0 * a[n] - 1.0 * a[i])) < minb) {
      |                                                             ^~~~
Language: C++

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

using namespace std;
using llint = long long int;
int n;
vector<int> va;
using vecitr = vector<int>::iterator;
map<pair<llint, llint>, llint> memo;

llint comb(llint n, llint r)
{
  llint num = 1;
  for (llint i = 1; i <= r; i++)
  {
    num = num * (n - i + 1) / i;
  }
  return num;
}

int nearest(vecitr begin, vecitr end, int x)
{
  bool first = true;
  for (; begin != end; begin++)
  {
    if (*begin >= x)
    {
      int res = *begin;
      if (!first)
      {
        int diff = res - x;
        if (diff > x - *(begin - 1))
        {
          res = *(begin - 1);
        }
      }
      return res;
    }
    first = false;
  }
  return *(end - 1);
}

int main()
{
  cin >> n;
  va.reserve(n);
  for (int i = 0; i < n; i++)
  {
    int a;
    cin >> a;
    va.push_back(a);
  }
  sort(va.begin(), va.end());

  llint max = 0;
  pair<int, int> ans;
  int b = nearest(va, va.back() / 2);
  cout << va.back() << " " << b << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:60:19: error: could not convert 'va' from 'std::vector<int>' to 'vecitr' {aka 'std::vector<int>::iterator'}
   60 |   int b = nearest(va, va.back() / 2);
      |                   ^~
      |                   |
      |                   std::vector<int>
Language: C++

Last login: Tue Apr 17 16:49:13 on console
pc131039m:~ 2169472048$ vim pro.cpp
pc131039m:~ 2169472048$ g++ pro.cpp
pro.cpp:25:1: error: extraneous closing brace ('}')
}
^
1 error generated.
pc131039m:~ 2169472048$ vim pro.cpp
pc131039m:~ 2169472048$ g++ pro.cpp
pc131039m:~ 2169472048$ pbpaste || cat pro.cpp
5
6 9 4 2 11pc131039m:~ 2169472048$ pbpaste || pro.cpp
5
6 9 4 2 11pc131039m:~ 2169472048$ pbpaste
5
6 9 4 2 11pc131039m:~ 2169472048$ pbpaste||pro.cpp
5
6 9 4 2 11pc131039m:~ 2169472048$ pbpaste||./a.out
5
6 9 4 2 11pc131039m:~ 2169472048$ g++ pro.cpp
pc131039m:~ 2169472048$ pbpaste||./a.out
5
6 9 4 2 11pc131039m:~ 2169472048$ vim pro.cpp
pc131039m:~ 2169472048$ g++ pro.cpp
pc131039m:~ 2169472048$ pbpaste || ./a.out
5
6 9 4 2 11pc131039m:~ 2169472048$ pbpaste  ./a.out
5
6 9 4 2 11pc131039m:~ 2169472048$ pbpaste || ./a.out
5
6 9 4 2 11pc131039m:~ 2169472048$ ./a.out || pbpaste
/c                          
0 0pc131039m:~ 2169472048$ 
pc131039m:~ 2169472048$ ./a.out
5
6 9 4 2 1
9 4pc131039m:~ 2169472048$ ./a.out
5
6 9 4 2 11
11 6pc131039m:~ 2169472048$ pbpaste||./a.out
5
6 9 4 2 11pc131039m:~ 2169472048$ vim pro.cpp

#include<cstdio>
int main(){
        int n,a[100000],b[100000],max=0,min=1000000000,m;
        scanf("%d",&n);
        for(int i=0;i<n;i++){
                scanf("%d",&a[i]);
                if(a[i]>max){
                        max=a[i];
                }
        }
        for(int i=0;i<n;i++){
                if(max>=2*a[i]){
                        b[i]=max-2*a[i];
                }
                else{
                        b[i]=2*a[i]-max;
                }
                if(min>=b[i]){
                        min=b[i];
                        m=i;
                }
        }
        printf("%d %d",max,a[m]);
}

Compiler output:
a.cc:1:1: error: 'Last' does not name a type
    1 | Last login: Tue Apr 17 16:49:13 on console
      | ^~~~
a.cc:5:1: error: expected declaration before '}' token
    5 | }
      | ^
a.cc:6:1: error: expected unqualified-id before '^' token
    6 | ^
      | ^
Language: C++

#include <stdio.h>
int comb(int x,int y)
{
	if (x>y)
	{
		if(x-y<y)
            y=x-y;
        int num[y],den[y];
        for(int v1=0;v1<y;v1++)
        {
            num[v1]=x-v1;
            den[v1]=v1+1;
        }
        for(int v2=0;v2<y;v2++)
            for(int v3=0;v3<y;v3++)
                for(int var=1;var<=den[v3];var++)
                    if ((den[v3]%var)==0 && (num[v2]%var)==0)
                    {
                        den[v3]/=var;
                        num[v2]/=var;
                    }
        for(int v1=0, finnum=1; v1<y; finnum*=num[v1], v1++);
        return finnum;
	}
}

int main()
{
	int N,max=0,ans[2],num;
	scanf("%d",&N);
	int list[N];
	for(int i=0;i<N;i++)
		scanf("%d",&list[i]);
	for(int i=0;i<N-1;i++)
	{
		for(int j=i+1;j<N;j++)
		{
			num = list[i]>list[j] ? comb(list[i],list[j]) : comb(list[j],list[i])
			if(num>max)
			{
				max=num;
				ans[0] = list[i]>list[j] ? list[i] : list[j];
				ans[1] = list[i]>list[j] ? list[j] : list[i];
			}
		}
	}
	printf("%d %d",ans[0],ans[1]);
	return 0;
}


Compiler output:
a.cc: In function 'int comb(int, int)':
a.cc:23:16: error: 'finnum' was not declared in this scope
   23 |         return finnum;
      |                ^~~~~~
a.cc: In function 'int main()':
a.cc:38:94: error: expected ';' before 'if'
   38 |                         num = list[i]>list[j] ? comb(list[i],list[j]) : comb(list[j],list[i])
      |                                                                                              ^
      |                                                                                              ;
   39 |                         if(num>max)
      |                         ~~
Language: C++

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
using namespace std;
const int M=100000+5;
cmp(int a,int b)
{
	if(a>b)return 1;
	else return 0;
}
int main()
{
	int array[M];
	int a[M];
	int n;
	while(cin>>n)
	{
		for(int i=1;i<=n;i++)
		{
			scanf("%d",&array[i]);
		}
		sort(array+1,array+n+1,cmp);
		int flag,t;
		for(int i=1;i<=n;i++)
		{
		    flag=array[i]/2;
		    int j,re,index1,index2,k;
		    index1=0xffff;
			j=(n-1+i)/2+1;
			while(1)
			{
				index1=abs(array[j]-array[flag]);
		        if(re<index1)index1=re;
		        else break;
		        if(j-1<1)break;
		        j--;
			}
			index2=0xffff;
			k=(n-1+i)/2;
			while(1)
			{
			    re=abs(array[k]-array[flag]);
		        if(re<index2)index2=re;
		        else break;
		        if(k+1>n)break;
		        k++;
			}
			if(index2>index1)a[i]=j;
			else a[i]=k;
		}
		cout<<array[1]<<" "<<array[a[1]]<<endl;
	}
}

Compiler output:
a.cc:7:1: error: ISO C++ forbids declaration of 'cmp' with no type [-fpermissive]
    7 | cmp(int a,int b)
      | ^~~
Language: C++

#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#define vi vector<int>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
using ll = long long;
//#define int ll
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
int cp[800][800];
int main(){
int n;
cin >> n;
vi v (n);
rep(i,n) cin >> v[i];
sort(all(v));
int ans =0;
rep(i,n)if (v[i]<=ans/2)ans =v[i];
cout << v[i].back << " " << ans<<endl;
}

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

#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
using ll = long long;
//#define int ll
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
int cp[800][800];
int main(){
int n;
cin >> n;
vi v (n);
rep(i,n) cin >> v[i];
sort(all(v));
int ans =0;
rep(i,n)if (v[i]<=ans/2)ans =v[i];
cout << v[i].back << " " << ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:1: error: 'vi' was not declared in this scope
   40 | vi v (n);
      | ^~
a.cc:41:17: error: 'v' was not declared in this scope
   41 | rep(i,n) cin >> v[i];
      |                 ^
a.cc:42:10: error: 'v' was not declared in this scope
   42 | sort(all(v));
      |          ^
a.cc:30:17: note: in definition of macro 'all'
   30 | #define all(in) in.begin(), in.end()
      |                 ^~
a.cc:45:11: error: 'i' was not declared in this scope
   45 | cout << v[i].back << " " << ans<<endl;
      |           ^
Language: C++

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

const int maxn = int(1e5)+5;

int A[maxn];

int main(void)
{
	int n;
	scanf("%d", &n);
	for(int i = 0;i < n;i++) scanf("%d", &A[i]);
	sort(A, A+n);

	int res = 0;
	for(int i = 0;i < n;i++)
	{
		if(fabs(A[n-1]/2.0-A[i]) < fabs(A[n-1]/2.0-res)) res = A[i];
	}
	printf("%d %d\n", A[n-1], res);
}

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

#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<cstring>
#include<sstream>
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define C(i) cin>>i
#define C2(i,j) cin>>i>>j
#define C3(i,j,k) cin>>i>>j>>k
#define C4(i,j,k,m) cin>>i>>j>>k>>m
////////////////////////////////////////////////////////////

long long  nCr(long n, long r) {
  if ( r * 2 > n ) r = n - r;
	long long  dividend = 1;
  long long  divisor  = 1;
  for ( long i = 1; i <= r; ++i ) {
    dividend *= (n-i+1);
    divisor  *= i;
  }
	
  return dividend / divisor;
}

int main(){
	int n;
	cin >> n;
	vector<long> a(n);
	rep(i,0,n)
		cin >> a[i];

	vsort(a);
	
	long long ans = 0;
	long ans_l = 0;
	long ans_r = 0;
	auto r = upper_bound(a.begin() , a.end() , a[i]/2);
	auto l = r-1;
	long k;
	
	if( l < a.begin() ){
		l = a.begin();
		r = l;
	}

	long long rr = nCr(a[i],*r);
	long long ll = nCr(a[i],*l); 
	if( rr > ll ){
		if( ans < rr ){
			ans = rr;
			ans_l = a[i];
			ans_r = *r;
		}
		else{
			break;
		}
	}
	else{
		if( ans < ll ){
			ans = ll;
			ans_l = a[i];
			ans_r = *l;
		}
		else{
			break;
		}
	}

	cout << ans_l << " " << ans_r << endl;

	ret 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:57:54: error: 'i' was not declared in this scope
   57 |         auto r = upper_bound(a.begin() , a.end() , a[i]/2);
      |                                                      ^
a.cc:75:25: error: break statement not within loop or switch
   75 |                         break;
      |                         ^~~~~
a.cc:85:25: error: break statement not within loop or switch
   85 |                         break;
      |                         ^~~~~
Language: C++

#include<vector>
#include<stack>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<sstream>
#include<cmath>
#include<iterator>
#include<bitset>
using namespace std;
#define _for(i,a,b) for(int i=(a);i<(b);++i)
#define _rep(i,a,b) for(int i=(a);i<=(b);++i)
typedef long long ll;
int readint() { int x; cin >> x; return x; }
const int INF = 1 << 30;
const int maxn = 100005;
int a[maxn];

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

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

		int x, y = a[n - 1], mm = 1e9;
		if (y & 1) {
			for (int i = 0; i < n - 1; ++i) {
				int tmp = min(abs(a[i] - y / 2), abs(a[i] - (y / 2 + 1)));
				if (tmp< mm) {
					mm = tmp;
					x = a[i];
				}
			}
		}
		else {
			for (int i = 0; i < n - 1; ++i) {
				int tmp = abs(a[i] - y / 2);
				if (tmp < mm) {
					mm = tmp;
					x = a[i];
				}
			}
		}
		cout << y << " " << x << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int readint()':
a.cc:15:24: error: 'cin' was not declared in this scope
   15 | int readint() { int x; cin >> x; return x; }
      |                        ^~~
a.cc:11:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
   10 | #include<bitset>
  +++ |+#include <iostream>
   11 | using namespace std;
a.cc: In function 'int main()':
a.cc:22:16: error: 'cin' was not declared in this scope
   22 |         while (cin >> n) {
      |                ^~~
a.cc:22:16: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:48:17: error: 'cout' was not declared in this scope
   48 |                 cout << y << " " << x << endl;
      |                 ^~~~
a.cc:48:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

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

#define all(v) v.begin(),v.end()
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
class Solver {
  public:
    bool solve() {
        int N; cin >> N;
        vector<int> A(N); cin >> A;
        sort(all(A));

        int n = A[N - 1];
        int r = A[0];
        int dist = 1e9;
        for(int i = 0; i < N; i++) {
            if(n % 2 == 0 and set_min(dist, abs(n / 2 - A[i]))) r = A[i];
            if(set_min(dist, abs(n / 2 + 1 - A[i]))) r = A[i];
        }
        cout << n << " " << r << endl;
        return 0;
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    Solver s;
    s.solve();
    return 0;
}


Compiler output:
a.cc: In member function 'bool Solver::solve()':
a.cc:17:31: error: 'set_min' was not declared in this scope; did you mean 'stdin'?
   17 |             if(n % 2 == 0 and set_min(dist, abs(n / 2 - A[i]))) r = A[i];
      |                               ^~~~~~~
      |                               stdin
a.cc:18:16: error: 'set_min' was not declared in this scope; did you mean 'stdin'?
   18 |             if(set_min(dist, abs(n / 2 + 1 - A[i]))) r = A[i];
      |                ^~~~~~~
      |                stdin
Language: C++

#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
long long a[1000000001];

long long fanctional(long long x){
    if(x==0)return long long(1);
    else return x*fanctional(x-1);
}

int main(void){
    int max_n,n;
    cin>>n;
    for(int i=0;i<n;i++){cin>>a[i];}
    sort(a,a+n);
    
    //cout<<a[n-1]<<endl;
    long long ans=-1;
    if(a[0]==0){cout<<a[0]<<" "<<a[n-1]<<endl;return 0;}
    else{
        int ma=a[n-1],i=0;long long si=1;
        while(a[i]<=(a[n-1]+1)/2&&i<n){
            long long bo=fanctional(i);
            for(int j=0;j<abs(a[n-1]-a[i]);j++){
                si*=(ma-j);
            }
            ans=max(ans,si/bo);
            
            //cout<<a[i]<<" "<<i<<" "<<ans<<endl;
            
            if(ans==si/bo){
                max_n=a[i];
            }
            i++;
        }
        cout<<max_n<<" "<<a[n-1]<<endl;
    }
    
}

Compiler output:
a.cc: In function 'long long int fanctional(long long int)':
a.cc:8:20: error: expected primary-expression before 'long'
    8 |     if(x==0)return long long(1);
      |                    ^~~~
a.cc:8:19: error: expected ';' before 'long'
    8 |     if(x==0)return long long(1);
      |                   ^~~~~
      |                   ;
a.cc:8:20: error: expected primary-expression before 'long'
    8 |     if(x==0)return long long(1);
      |                    ^~~~
a.cc:9:5: error: 'else' without a previous 'if'
    9 |     else return x*fanctional(x-1);
      |     ^~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
long long a[1000000001]={};

long long fanctional(long long x){
    if(x==0)return long long(1);
    else return x*fanctional(x-1);
}

int main(void){
    int max_n,n;
    cin>>n;
    for(int i=0;i<n;i++){cin>>a[i];}
    sort(a,a+n);
    
    //cout<<a[n-1]<<endl;
    long long ans=-1;
    if(a[0]==0){cout<<a[0]<<" "<<a[n-1]<<endl;return 0;}
    else{
        int ma=a[n-1],i=0;long long si=1;
        while(a[i]<=(a[n-1]+1)/2&&i<n){
            long long bo=fanctional(i);
            for(int j=0;j<abs(a[n-1]-a[i]);j++){
                si*=(ma-j);
            }
            ans=max(ans,si/bo);
            
            //cout<<a[i]<<" "<<i<<" "<<ans<<endl;
            
            if(ans==si/bo){
                max_n=a[i];
            }
            i++;
        }
        cout<<max_n<<" "<<a[n-1]<<endl;
    }
    
}

Compiler output:
a.cc: In function 'long long int fanctional(long long int)':
a.cc:8:20: error: expected primary-expression before 'long'
    8 |     if(x==0)return long long(1);
      |                    ^~~~
a.cc:8:19: error: expected ';' before 'long'
    8 |     if(x==0)return long long(1);
      |                   ^~~~~
      |                   ;
a.cc:8:20: error: expected primary-expression before 'long'
    8 |     if(x==0)return long long(1);
      |                    ^~~~
a.cc:9:5: error: 'else' without a previous 'if'
    9 |     else return x*fanctional(x-1);
      |     ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=1e9+7;
#define inf 0x3f3f3f3f
int a[100050];

int main()
{
	int n;
	scanf("%d",&n);
	for(int ia=0;i<n;i++)
	scanf("%d",&a[i]);
	sort(a,a+n);
	int maxn=1e9;
	int ans;
	for(int i=0;i<n-1;i++)
	{
		int x=abs(a[i]-(a[n-1]+1)/2); 
		if(x<maxn)
		{
			maxn=abs(a[i]-(a[n-1]+1)/2);
			ans=a[i];
		}
	}
	cout<<a[n-1]<<" "<<ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:22: error: 'i' was not declared in this scope; did you mean 'ia'?
   12 |         for(int ia=0;i<n;i++)
      |                      ^
      |                      ia
Language: Java

import java.util.*;
import java.math;
public class Main{

  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long[] a = new long[n+10];
    for(int i =1;i<=n;i++){
      a[i] = sc.nextLong();
    }
    quicksort(a,1,n);
    Point po = new Point(n,n-1);
    double rad = math.abs(2-n/(n-1));
    for(double i = n;i>=1;i--){
      for(double j = n-1;j>=1;j--){
        s = math.abs(2-i/j);
        if(s<rad){
          po = new Point(i,j);
          rad = s;
        }
      }
    }

    System.out.println(po.x + " " + po.y);
    sc.close();
    }


    
    public static void quickSort(long[] array, int left, int right) {
        int curleft = left;
        int curright = right;
        long pivot = array[(curleft + curright) / 2];
        
        do {
            while (array[curleft] < pivot) {
                curleft++;
            }
            
            while (array[curright] > pivot) {
                curright--;
            }
            if (curleft <= curright) {
                swap (array, curleft++, curright--);
            }
        } while (curleft <= curright);
        
        if (left < curright) {
            quickSort(array, left, curright);
        }
        
        if (curleft < right) {
            quickSort(array, curleft, right);
        }
    }
    
    private static void swap (long[] array, int idx1, int idx2) {
        long tmp = array[idx1];
        array[idx1] = array[idx2];
        array[idx2] = tmp;
    }
  }

Compiler output:
Main.java:2: error: cannot find symbol
import java.math;
           ^
  symbol:   class math
  location: package java
Main.java:12: error: cannot find symbol
    quicksort(a,1,n);
    ^
  symbol:   method quicksort(long[],int,int)
  location: class Main
Main.java:13: error: cannot find symbol
    Point po = new Point(n,n-1);
    ^
  symbol:   class Point
  location: class Main
Main.java:13: error: cannot find symbol
    Point po = new Point(n,n-1);
                   ^
  symbol:   class Point
  location: class Main
Main.java:14: error: cannot find symbol
    double rad = math.abs(2-n/(n-1));
                 ^
  symbol:   variable math
  location: class Main
Main.java:17: error: cannot find symbol
        s = math.abs(2-i/j);
        ^
  symbol:   variable s
  location: class Main
Main.java:17: error: cannot find symbol
        s = math.abs(2-i/j);
            ^
  symbol:   variable math
  location: class Main
Main.java:18: error: cannot find symbol
        if(s<rad){
           ^
  symbol:   variable s
  location: class Main
Main.java:19: error: cannot find symbol
          po = new Point(i,j);
                   ^
  symbol:   class Point
  location: class Main
Main.java:20: error: cannot find symbol
          rad = s;
                ^
  symbol:   variable s
  location: class Main
10 errors
Language: C++

#include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 1000000000;
const long long int llINF = 1000000000000000000;
#define rep(n) for (ll i = 0; i < (n); i++)

using namespace std;
using ll = long long int;
using P = pair<int, int>;
using edge = struct {
  int to;
  int cost;
};

void comb(vector<vector<ll>> v) {
  for (ll i = 0; i < v.size(); i++) {
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for (ll k = 1; k < v.size(); k++) {
    for (ll j = 1; j < 1 + (k / 2); j++) {
      v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]);
    }
  }
}
ll c(ll n, ll r) {
  if (r * 2 > n)
    r = n - r;
  ll dividend = 1;
  ll divisor = 1;
  for (ll i = 1; i <= r; ++i) {
    dividend *= (n - i + 1);
    divisor *= i;
  }
  return dividend / divisor;
}

int main() {
  ll n, tmp;
  vector<ll> a;
  cin >> n;
  rep(n) {
    cin >> tmp;
    a.push_back(tmp);
  }

  sort(a.begin(), a.end());
  ll max = a.back();
  a.erase(a.begin() + n - 1);
  ll mid = -1;
  for (ll i = 0; i < n - 1; i++) {
    if (a[i] >= (long long double)(max / 2)) {
      if (i == 0) {
        mid = a[i];
        break;
      } else if (a.size() == 1) {
        mid = a[i];
        break;
      } else if (a[i - 1] <= (long long double)(max / 2) &&
                 ((long long double)(max / 2) - (long long double)a[i - 1]) >
                     ((long long double)a[i] - (long long double)(max / 2))) {
        mid = a[i];
        break;
      } else {
        mid = a[i - 1];
        break;
      }
    }
  }
  if (mid == -1) {
    mid = a.back();
  }
  cout << max << " " << mid << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:63:23: error: 'long long' specified with 'double'
   63 |     if (a[i] >= (long long double)(max / 2)) {
      |                       ^~~~
a.cc:70:36: error: 'long long' specified with 'double'
   70 |       } else if (a[i - 1] <= (long long double)(max / 2) &&
      |                                    ^~~~
a.cc:71:25: error: 'long long' specified with 'double'
   71 |                  ((long long double)(max / 2) - (long long double)a[i - 1]) >
      |                         ^~~~
a.cc:71:55: error: 'long long' specified with 'double'
   71 |                  ((long long double)(max / 2) - (long long double)a[i - 1]) >
      |                                                       ^~~~
a.cc:72:29: error: 'long long' specified with 'double'
   72 |                      ((long long double)a[i] - (long long double)(max / 2))) {
      |                             ^~~~
a.cc:72:54: error: 'long long' specified with 'double'
   72 |                      ((long long double)a[i] - (long long double)(max / 2))) {
      |                                                      ^~~~
Language: C++

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

using namespace std;

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

	vector<long long int> A;
	for (int ii = 0; ii < N; ii++) {
		long long int a;
		cin >> a;
		A.push_back(a);
	}

	sort(A.begin(), A.end(), [](const auto& item1, const auto& item2) {
		return item1 < item2;
	});

	long long int n = A.back();
	long long int r = -1;
	double b = (double) n;
	for (auto& a : A) {
		if (b > fabs((double)a - (double)n / 2.0)) {
			r = a;
			b = fabs((double)a - (double)n / 2.0);
		}
	}
	cout << n << " " << r << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:25: error: 'fabs' was not declared in this scope; did you mean 'labs'?
   26 |                 if (b > fabs((double)a - (double)n / 2.0)) {
      |                         ^~~~
      |                         labs
Language: C++

#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<cstring>
#include<sstream>
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define C(i) cin>>i
#define C2(i,j) cin>>i>>j
#define C3(i,j,k) cin>>i>>j>>k
#define C4(i,j,k,m) cin>>i>>j>>k>>m
////////////////////////////////////////////////////////////

long long  nCr(long n, long r) {
  if ( r * 2 > n ) r = n - r;
	long long  dividend = 1;
  long long  divisor  = 1;
  for ( long i = 1; i <= r; ++i ) {
    dividend *= (n-i+1);
    divisor  *= i;
  }
	
  return dividend / divisor;
}

int main(){
	int n;
	cin >> n;
	vector<long> a(n);
	rep(i,0,n)
		cin >> a[i];

	vsort(a);
	
	long long ans = 0;
	long ans_l = 0;
	long ans_r = 0;
	rrep(i,n-1,n/2){
		auto r = upper_bound(a.begin() , a.end() , a[i]/2);
		auto l = r-1;
		long k;
		if( l < v.begin() ){
			l = v.begin();
			r = l;
		}

		long long rr = nCr(a[i],*r);
		long long ll = nCr(a[i],*l); 
		if( rr > ll ){
			if( ans < rr ){
				ans = rr;
				ans_l = a[i];
				ans_r = *r;
			}
			else{
				break;
			}
		}
		else{
			if( ans < ll ){
				ans = ll;
				ans_l = a[i];
				ans_r = *l;
			}
			else{
				break;
			}
		}
	}

	cout << ans_l << " " << ans_r << endl;

	ret 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:61:25: error: 'v' was not declared in this scope
   61 |                 if( l < v.begin() ){
      |                         ^
Language: C++

#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<vector>
using namespace std;
#define rep2(x,from,to) for(int x=from;x<to;x++)
#define rep(x,to) rep2(x,0,to)
int a[200005];
int p;
int b[200005];
int q;
int qq;
int main()
{
  int n;
  cin>>n;
  rep(i,n)
    {
      cin>>a[i];
      if(p<a[i])p=a[i];
    }
    if(p!=a[0])
    {
  q=a[0];
  qq=abs(p-2*a[0]);}
  else
  {
    q=a[1];
  qq=abs(p-2*a[1]);}
  

  }
  rep(i,n)
    {
      if(abs(p-2*a[i])<qq&&a[i]!=p)
	{
	  q=a[i];
	  qq=abs(p-2*a[i]);
	}
    }
  cout<<p<<" "<<q<<endl;
    return 0;
}


Compiler output:
a.cc:8:25: error: expected unqualified-id before 'for'
    8 | #define rep2(x,from,to) for(int x=from;x<to;x++)
      |                         ^~~
a.cc:9:19: note: in expansion of macro 'rep2'
    9 | #define rep(x,to) rep2(x,0,to)
      |                   ^~~~
a.cc:35:3: note: in expansion of macro 'rep'
   35 |   rep(i,n)
      |   ^~~
a.cc:35:7: error: 'i' does not name a type
   35 |   rep(i,n)
      |       ^
a.cc:8:40: note: in definition of macro 'rep2'
    8 | #define rep2(x,from,to) for(int x=from;x<to;x++)
      |                                        ^
a.cc:35:3: note: in expansion of macro 'rep'
   35 |   rep(i,n)
      |   ^~~
a.cc:35:7: error: 'i' does not name a type
   35 |   rep(i,n)
      |       ^
a.cc:8:45: note: in definition of macro 'rep2'
    8 | #define rep2(x,from,to) for(int x=from;x<to;x++)
      |                                             ^
a.cc:35:3: note: in expansion of macro 'rep'
   35 |   rep(i,n)
      |   ^~~
a.cc:43:3: error: 'cout' does not name a type
   43 |   cout<<p<<" "<<q<<endl;
      |   ^~~~
a.cc:44:5: error: expected unqualified-id before 'return'
   44 |     return 0;
      |     ^~~~~~
a.cc:45:1: error: expected declaration before '}' token
   45 | }
      | ^
Language: C++

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

int main() {
    int n; cin >> n;
    vector<int> x;
    for (int i = 0; i < n; i++) {
        int a; cin >> a;
        x.push_back(a);
    }
    sort(x.begin(), x.end());
    int diff_min = INT_MAX;
    int min_idx = n - 1;
    int target = x[n-1] / 2;
    for (int i = 0; i < n; i++) {
        if (abs(target - x[i]) < diff_min) {
            diff_min = target - x[i];
            min_idx = i;
        } else if (n % 2 != 0 && abs((x[n-1]+1)/2 - x[i]) < diff_min) {
            diff_min = x[(n+1)/2]/2 - x[i];
            min_idx = i;
        }
    }
    cout << x[n - 1] << ' ' << x[min_idx] << endl;
    return 0;
}


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

import javafx.util.Pair;

import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Created by Santa on 2016/10/16.
 */
public class Main {

    static int A;
    static int B;
    static int C;
    static class pair {
            public int a;
            public int b;

            pair(){
                this.a = 0;
                this.b = 0;
            }

            pair(int a, int b){
                this.a = a;
                this.b = b;
            }

            public void set(int a, int b) {
                this.a = a;
                this.b = b;
            }
        }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);


        A = scanner.nextInt();

        int[] map = new int[A];


        for (int i = 0; i < A; i++) {
            map[i] = scanner.nextInt();
        }

        Arrays.sort(map);
        int max = -99;

        pair ans = null;
        for (int i = 0; i < A; i++) {
            for (int j = 0; map[j] < map[i]; j++) {
                if(max < map[i] - map[j] && max < map[j]){
                    ans = new pair(map[i], map[j]);
                    max = Math.min(map[j],map[i] - map[j]);
                }
            }
        }

        System.out.println(ans.a + " " + ans.b);








    }





}



Compiler output:
Main.java:1: error: package javafx.util does not exist
import javafx.util.Pair;
                  ^
1 error
Language: C++

import Data.List
import Data.Ord
solve a = (minimumBy (comparing abs.(\x -> 2 * x - m)) $ a, m)
  where m = maximum a
main = do
  getLine
  a <- getLine >>= return. map read. words :: IO [Int]
  let (x, y) = solve a
  putStrLn $ show y ++ " " ++ show x


Compiler output:
a.cc:3:38: error: stray '\' in program
    3 | solve a = (minimumBy (comparing abs.(\x -> 2 * x - m)) $ a, m)
      |                                      ^
a.cc:1:1: error: 'import' does not name a type
    1 | import Data.List
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <bitset>
#include <cmath>
#include <string>
#include <fstream>
#define FI first
#define SE second
#define VE vector<int>
#define PB push_back
#define PA pair<int,int>
#define MA make_pair
#define LL long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int INF=1e9+7;
const int MOD=1e9+7;
//
int main(){
  int N;
  VE V;
  cin>>N;
  FOR(i,0,N){
    int A;
    cin>>A;
    V.PB(A);
  }
  if(N==2){
    cout<<A[0]<<" "<<A[1]<<endl;
    return 0;
  }
  sort(V.begin(),V.end());
  int M=V[N-1];
  int mid=M/2;
  VE::iterator it=lower_bound(V.begin(),V.end(),mid);
  int a=*it;
  int num=it-V.begin();
  num--;
  int b=V[num];
  if(M-a>M-b){
    cout<<M<<" "<<b<<endl;
  }else{
    cout<<M<<" "<<a<<endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:11: error: 'A' was not declared in this scope
   36 |     cout<<A[0]<<" "<<A[1]<<endl;
      |           ^
Language: C++

#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <cstring>
#include <queue>
#include <map>
#define pb push_back
using namespace std;
typedef pair<int,int> pii;
typedef long long int lli;


int main(void){
  int n,t;
  cin>>n;

  vector<int> a;
  int maxa=0;
  for(int i=0;i<n;i++){
    cin>>t;
    a.pb(t);
    maxa=max(maxa,t);
  }

  int tmp;
  if(maxa==a[0]) tmp=a[1];
  else tmp=a[0];

  for(int i=0;i<n;i++){
    if(fabs(maxa/2 - tmp) > fabs(maxa/2 - a[i])) tmp=a[i];
  }
  cout<<maxa<<" "<<tmp<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:8: error: 'fabs' was not declared in this scope; did you mean 'labs'?
   31 |     if(fabs(maxa/2 - tmp) > fabs(maxa/2 - a[i])) tmp=a[i];
      |        ^~~~
      |        labs
Language: C++

/**
* Sources: various
*/

#pragma GCC optimize("O3")
#pragma GCC target("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
template<typename T>
ostream& operator<< (ostream& out, const pair<T, T>& v) {
    out << "{" << v.first << ", " << v.second << "}";
    return out;
}

template<typename T>
ostream& operator<< (ostream& out, const vector<T>& v) {
    out << "[";
    size_t last = v.size() - 1;
    for(size_t i = 0; i < v.size(); ++i) {
        out << v[i];
        if (i != last) 
            out << ", ";
    }
    out << "]";
    return out;
}

template<typename T>
ostream& operator<< (ostream& out, const set<T>& v) {
    out << "[";
    auto pen = v.end();
    pen--;
    for (auto it = v.begin(); it != v.end(); it++){
		out << *it;
		if (it != pen){
			out << ", ";
		}
	}
	out << "]";
    return out;
}

template<typename T>
ostream& operator<< (ostream& out, const Tree<T>& v) {
    out << "[";
    auto pen = v.end();
    pen--;
    for (auto it = v.begin(); it != v.end(); it++){
		out << *it;
		if (it != pen){
			out << ", ";
		}
	}
	out << "]";
    return out;
}
vector<int> v;
int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	int N; cin >> N;
	for (int i = 0; i < N; i++){
		int k; cin >> k; v.push_back(k);
	}
	sort(all(v));
	int top = v[N - 1];
	int bes = -1;
	for (int i = 0; i < N - 1; i++){
		if (abs(top - 2*v[i]) < abs(top - 2*bes)){
			bes = a[i];
		}
	}
	cout << top << ' ' << bes << endl;
}

// read!read!read!read!read!read!read!
// ll vs. int!


Compiler output:
a.cc: In function 'int main()':
a.cc:95:31: error: 'a' was not declared in this scope
   95 |                         bes = a[i];
      |                               ^
Language: C++

#include<bits/stdc++.h>
#define LL long long
using namespace std;
int VisCol[15],VisRow[15],N,M,Compos[15];
char Ch[15][15];
bool Mirrored(int C1,int C2){
	for(int J=1;J<=N;J++) if((Ch[VisRow[J]][C1]!=Ch[J][C2])||(Ch[J][C1]!=Ch[VisRow[J]][C2])) return 0;
	return 1;
}
void DFS2(int X,bool Can){
	if(X==N+1)  exit(!printf("YES\n"));
	if(VisCol[X]) return void(DFS2(X+1,Can));
	for(int I=X+1;I<=M;I++)
		if(Mirrored(I,X)&&(!VisCol[I])){
			VisCol[I]=X,VisCol[X]=I;
			DFS2(X+1,Can);
			VisCol[I]=VisCol[X]=0;
		}
	if(Mirrored(X,X)&&Can) VisCol[X]=X,DFS2(X+1,0),VisCol[x]=0;
}
void DFS1(int X,bool Can){
	if(X==N+1) return void(DFS2(1,M&1));
	if(VisRow[X]) return void(DFS1(X+1,Can));
	for(int I=X+1;I<=N;I++)
		if(!VisRow[I]&&(Compos[I]==Compos[X])){
			VisRow[I]=X,VisRow[X]=I;
			DFS1(X+1,Can);
			VisRow[I]=VisRow[X]=0;
		}
	if(Can) VisRow[X]=X,DFS1(X+1,0),VisRow[X]=0;
}
int main(){
	scanf("%d%d",&N,&M);
    for(int I=1;I<=N;I++){
    	for(int J=1;J<=M;J++){
    		char Str='\0';
    		while(!isalpha(Str)) Str=getchar();
    		Ch[I][J]=Str;
    		Compos[I]|=(1<<(Ch[I][J]-'a'));
		}
	}
	DFS1(1,N&1);
	printf("NO\n");
	return 0;
}

Compiler output:
a.cc: In function 'void DFS2(int, bool)':
a.cc:19:63: error: 'x' was not declared in this scope
   19 |         if(Mirrored(X,X)&&Can) VisCol[X]=X,DFS2(X+1,0),VisCol[x]=0;
      |                                                               ^
Language: C++

#include <bits/stdc++.h>
#define INF 1000000000
#define LINF 1000000000000000000
#define MOD 1000000007
#define mod 1000007
#define INF63 1061109567
#define INF127 9187201950435737471
#define UINF 18446744073709551615
#define F first
#define S second
#define ll long long
#define N 15
#define M 5010
using namespace std;
ll n,m;
bool dp[M],rc[N][N];
string s[N];
int main(){
	ll i,j,k,mask,tran;
	//srand(time(NULL));
	random_device rd;
	mt19937 mt(rd());
	cin>>n>>m;
	for(i=0;i<n;i++)
	{
		cin>>s[i];
	}
	tran=1000000;
	while(tran--)
	{
		//mkrand();
		memset(rc,true,sizeof(rc));
		memset(dp,false,sizeof(dp));
		for(i=0;i<m;i++)
		{
			for(j=0;j<m;j++)
			{
				for(k=0;k<n;k++)
				{
					if(s[seq[k]][i]!=s[n-seq[k]-1][j])
					{
						rc[i][j]=false;
					}
				}
			}
		}
		dp[0]=true;
		for(mask=0;mask<(1<<m);mask++)
		{
			if(!dp[mask])
			{
				continue;
			}
			for(i=0;i<m;i++)
			{
				for(j=i+1;j<m;j++)
				{
					if((mask&(1<<i))||(mask&(1<<j)))
					{
						continue;
					}
					if(rc[i][j])
					{
						dp[mask|(1<<i)|(1<<j)]=true;
					}
				}
			}
		}
		mask--;
		if(m%2==0)
		{
			if(dp[mask])
			{
				puts("YES");
				return 0;
			}
		}
		else
		{
			for(i=0;i<m;i++)
			{
				if(dp[mask^(1<<i)]&&rc[i][i])
				{
					puts("YES");
					return 0;
				}
			}
		}
		shuffle(s,s+n,mt);
	}
	puts("NO");
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:46: error: 'seq' was not declared in this scope; did you mean '__pstl::execution::v1::seq'?
   40 |                                         if(s[seq[k]][i]!=s[n-seq[k]-1][j])
      |                                              ^~~
      |                                              __pstl::execution::v1::seq
In file included from /usr/include/c++/14/pstl/glue_algorithm_defs.h:15,
                 from /usr/include/c++/14/algorithm:86,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/pstl/execution_defs.h:42:46: note: '__pstl::execution::v1::seq' declared here
   42 | _GLIBCXX17_INLINE constexpr sequenced_policy seq{};
      |                                              ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define i_i pair<int,int>
#define d_i pair<double,int>
int n,m;
int main() {wq
	cin>>n>>m;
	vector<string> a(n);
	for(int i=0;i<n;i++) cin>>a[i];
	for(int t=0;t<100000;t++){
		vector<vector<bool> > b(m,vector<bool>(m,1));
		for(int j1=0;j1<m;j1++)
		    for(int j2=j1;j2<m;j2++)
			    for(int i=0;i<n;i++)
			        if(a[i][j1]!=a[n-1-i][j2])
			            b[j1][j2]=0;
		vector<bool> dp(1<<m);
		dp[0]=1;
		for(int s=0;s<(1<<m);s++)
		    if(dp[s])
			    for(int j1=0;j1<m;j1++)
			        for(int j2=j1+1;j2<m;j2++)
				        if(!(s>>j1&1)&&!(s>>j2&1)&&b[j1][j2])
					        dp[s|1<<j1|1<<j2]=1;
		bool ok=0;
		if(m%2==0) ok=dp.back();
		else for(int j=0;j<m;j++)
	        if(dp[(1<<m)-1-(1<<j)]&&b[j][j]) ok=1;
		if(ok) {puts("YES");return 0;}
	}puts("NO");
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:13: error: 'wq' was not declared in this scope
    8 | int main() {wq
      |             ^~