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

#include <stdio.h>
#include <stdlib.h>
#define MAX(x,y) x>y?x:y
typedef long long ll;
ll **memo,*a,N,rep_n,rep_r;

int cmpfunc (const void * a, const void * b) {
   return ( *(int*)a - *(int*)b );
}

ll cbn(ll n, ll r){
	if(r<0 || n<r) return 0;
	if(n==0) return 1;
	if(memo[n][r]==0 && memo[n][n-r]==0){
        memo[n][r]=cbn(n-1,r)+cbn(n-1,r-1); 
        printf("memo[%lld][%lld] just has been created!\n",n,r);
    }
	return MAX(memo[n][r],memo[n][n-r]);
}

int main(){
        ll max=0,Max=0;
	scanf("%lld",&N);
	a=malloc(sizeof(ll)*N);
	for(ll i=0;i<N;i++){
   	  scanf("%lld",&a[i]);
   	  max=MAX(max,a[i]);
   	}
        qsort(a,N,sizeof(ll),cmpfunc);
   	ll Size=a[N-1]+1;
	memo=malloc(sizeof(ll *) * Size);
	for(ll i=0;i<Size;i++) memo[i]=malloc(sizeof(ll)*Size);
	for(ll i=0;i<Size;i++)
	{
		for(ll j=0;j<Size;j++) memo[i][j]=0;
	}
	for(ll i=1;i<=N-1;i++){
            for(ll j=0;j<i;j++){
                if(cbn(a[i],a[j])>Max){
                   Max=cbn(a[i],a[j]);
                   rep_n=a[i];
                   rep_r=a[j];
        }
        printf("%lld %lld",rep_n,rep_r);
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:46:1: error: expected declaration or statement at end of input
   46 | }
      | ^
main.c:46:1: error: expected declaration or statement at end of input
Language: C

#include <stdio.h>
#include <stdlib.h>
#define MAX(x,y) x>y?x:y
typedef long long ll;
ll **memo,*a,N,rep_n,rep_r;

int cmpfunc (const void * a, const void * b) {
   return ( *(int*)a - *(int*)b );
}

ll cbn(ll n, ll r){
	if(r<0 || n<r) return 0;
	if(n==0) return 1;
	if(memo[n][r]==0 && memo[n][n-r]==0){
        memo[n][r]=cbn(n-1,r)+cbn(n-1,r-1); 
        printf("memo[%lld][%lld] just has been created!\n",n,r);
    }
	return MAX(memo[n][r],memo[n][n-r]);
}

int main(){
        ll max=0,Max=0;
	scanf("%lld",&N);
	a=malloc(sizeof(ll)*N);
	for(ll i=0;i<N;i++){
   	  scanf("%lld",&a[i]);
   	  max=MAX(max,a[i]);
   	}
        qsort(a,N,sizeof(ll),compfunc);
   	ll Size=a[N-1]+1;
	memo=malloc(sizeof(ll *) * Size);
	for(ll i=0;i<Size;i++) memo[i]=malloc(sizeof(ll)*Size);
	for(ll i=0;i<Size;i++)
	{
		for(ll j=0;j<Size;j++) memo[i][j]=0;
	}
	for(ll i=1;i<=N-1;i++){
            for(ll j=0;j<i;j++){
                if(cbn(a[i],a[j])>Max){
                   Max=cbn(a[i],a[j]);
                   rep_n=a[i];
                   rep_r=a[j];
        }
        printf("%lld %lld",rep_n,rep_r);
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:29:30: error: 'compfunc' undeclared (first use in this function); did you mean 'cmpfunc'?
   29 |         qsort(a,N,sizeof(ll),compfunc);
      |                              ^~~~~~~~
      |                              cmpfunc
main.c:29:30: note: each undeclared identifier is reported only once for each function it appears in
main.c:46:1: error: expected declaration or statement at end of input
   46 | }
      | ^
main.c:46:1: error: expected declaration or statement at end of input
Language: C

#include <stdio.h>
#include <stdlib.h>
#define MAX(x,y) x>y?x:y
typedef long long ll;
ll **memo,*a,N,rep_n,rep_r;

int cmpfunc (const void * a, const void * b) {
   return ( *(int*)a - *(int*)b );
}

ll cbn(ll n, ll r){
	if(r<0 || n<r) return 0;
	if(n==0) return 1;
	if(memo[n][r]==0 && memo[n][n-r]==0){
        memo[n][r]=cbn(n-1,r)+cbn(n-1,r-1); 
        printf("memo[%lld][%lld] just has been created!\n",n,r);
    }
	return MAX(memo[n][r],memo[n][n-r]);
}

int main(){
        ll max=0,Max=0;
	scanf("%lld",&N);
	a=malloc(sizeof(ll)*N);
	for(ll i=0;i<N;i++){
   	  scanf("%lld",&a[i]);
   	  max=MAX(max,a[i]);
   	}
        qsort(a,N,sizeof(ll),compfunc);
   	ll Size=a[N-1]+1;
	memo=malloc(sizeof(ll *) * Size);
	for(ll i=0;i<Size;i++) memo[i]=malloc(sizeof(ll)*Size);
	for(ll i=0;i<Size;i++)
	{
		for(ll j=0;j<Size;j++) memo[i][j]=0;
	}
	for(ll i=1;i<=N-1i++){
            for(ll j=0;j<i;j++){
                if(cbn(a[i],a[j])>Max){
                   Max=cbn(a[i],a[j]));
                   rep_n=a[i];
                   rep_r=a[j];
        }
        printf("%lld %lld",rep_n,rep_r);
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:29:30: error: 'compfunc' undeclared (first use in this function); did you mean 'cmpfunc'?
   29 |         qsort(a,N,sizeof(ll),compfunc);
      |                              ^~~~~~~~
      |                              cmpfunc
main.c:29:30: note: each undeclared identifier is reported only once for each function it appears in
main.c:37:27: error: lvalue required as increment operand
   37 |         for(ll i=1;i<=N-1i++){
      |                           ^~
main.c:37:29: error: expected ';' before ')' token
   37 |         for(ll i=1;i<=N-1i++){
      |                             ^
      |                             ;
main.c:40:38: error: expected ';' before ')' token
   40 |                    Max=cbn(a[i],a[j]));
      |                                      ^
      |                                      ;
main.c:40:38: error: expected statement before ')' token
main.c:46:1: error: expected declaration or statement at end of input
   46 | }
      | ^
main.c:46:1: error: expected declaration or statement at end of input
Language: C

#include <stdio.h>
#include <stdlib.h>
#define MAX(x,y) x>y?x:y
typedef long long ll;
ll **memo,*a,N,rep_n,rep_r;

int cmpfunc (const void * a, const void * b) {
   return ( *(int*)a - *(int*)b );
}

ll cbn(ll n, ll r){
	if(r<0 || n<r) return 0;
	if(n==0) return 1;
	if(memo[n][r]==0 && memo[n][n-r]==0){
        memo[n][r]=cbn(n-1,r)+cbn(n-1,r-1); 
        printf("memo[%lld][%lld] just has been created!\n",n,r);
    }
	return MAX(memo[n][r],memo[n][n-r]);
}

int main(){
        ll max=0,ans=0;
	scanf("%lld",&N);
	a=malloc(sizeof(ll)*N);
	for(ll i=0;i<N;i++){
   	  scanf("%lld",&a[i]);
   	  max=MAX(max,a[i]);
   	}
        qsort(a,N,sizeof(ll),compfunc);
   	ll Size=a[N-1]+1;
	memo=malloc(sizeof(ll *) * Size);
	for(ll i=0;i<Size;i++) memo[i]=malloc(sizeof(ll)*Size);
	for(ll i=0;i<Size;i++)
	{
		for(ll j=0;j<Size;j++) memo[i][j]=0;
	}
	for(ll i=1;i<=N-1i++){
            for(ll j=0;j<i;j++){
                if(cbn(a[i],a[j])>Max){
                   Max=cbn(a[i],a[j]));
                   rep_n=a[i];
                   rep_r=a[j];
        }
        printf("%lld %lld",rep_n,rep_r);
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:29:30: error: 'compfunc' undeclared (first use in this function); did you mean 'cmpfunc'?
   29 |         qsort(a,N,sizeof(ll),compfunc);
      |                              ^~~~~~~~
      |                              cmpfunc
main.c:29:30: note: each undeclared identifier is reported only once for each function it appears in
main.c:37:27: error: lvalue required as increment operand
   37 |         for(ll i=1;i<=N-1i++){
      |                           ^~
main.c:37:29: error: expected ';' before ')' token
   37 |         for(ll i=1;i<=N-1i++){
      |                             ^
      |                             ;
main.c:39:35: error: 'Max' undeclared (first use in this function); did you mean 'max'?
   39 |                 if(cbn(a[i],a[j])>Max){
      |                                   ^~~
      |                                   max
main.c:40:38: error: expected ';' before ')' token
   40 |                    Max=cbn(a[i],a[j]));
      |                                      ^
      |                                      ;
main.c:40:38: error: expected statement before ')' token
main.c:46:1: error: expected declaration or statement at end of input
   46 | }
      | ^
main.c:46:1: error: expected declaration or statement at end of input
Language: C

#include <stdio.h>
#include <stdlib.h>
#define MAX(x,y) x>y?x:y
typedef long long ll;
ll **memo,*a,N;

int cmpfunc (const void * a, const void * b) {
   return ( *(int*)a - *(int*)b );
}

ll cbn(ll n, ll r){
	if(r<0 || n<r) return 0;
	if(n==0) return 1;
	if(memo[n][r]==0 && memo[n][n-r]==0){
        memo[n][r]=cbn(n-1,r)+cbn(n-1,r-1); 
        printf("memo[%lld][%lld] just has been created!\n",n,r);
    }
	return MAX(memo[n][r],memo[n][n-r]);
}

int main(){
        ll max=0,ans=0;
	scanf("%lld",&N);
	a=malloc(sizeof(ll)*N);
	for(ll i=0;i<N;i++){
   	  scanf("%lld",&a[i]);
   	  max=MAX(max,a[i]);
   	}
        qsort(a,N,sizeof(ll),compfunc);
   	ll Size=a[N-1]+1;
	memo=malloc(sizeof(ll *) * Size);
	for(ll i=0;i<Size;i++) memo[i]=malloc(sizeof(ll)*Size);
	for(ll i=0;i<Size;i++)
	{
		for(ll j=0;j<Size;j++) memo[i][j]=0;
	}
	for(ll i=1;i<=N-1i++){
            for(ll j=0;j<i;j++) ans=MAX(ans,cbn(a[i],a[j]));
        }
        printf("%lld",ans);
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:29:30: error: 'compfunc' undeclared (first use in this function); did you mean 'cmpfunc'?
   29 |         qsort(a,N,sizeof(ll),compfunc);
      |                              ^~~~~~~~
      |                              cmpfunc
main.c:29:30: note: each undeclared identifier is reported only once for each function it appears in
main.c:37:27: error: lvalue required as increment operand
   37 |         for(ll i=1;i<=N-1i++){
      |                           ^~
main.c:37:29: error: expected ';' before ')' token
   37 |         for(ll i=1;i<=N-1i++){
      |                             ^
      |                             ;
Language: C++

#include<iostream>
#include<algorithm>
#define NUMBER 100001
using namespace std;
int a[NUMBER];

int comb(int n, int r){
 if (r == 0 || r == n){
  return 1;
 } else {
  return comb(n-1, r-1) + comb(n-1, r);
 }
}

int serach_half(int x){
 int key = x/2;
 int i = 0;
 do {
  if (a[i] < key){
   i++;
  } else {
   break;
  }
 } while (a[i] < key);
 if (a[i] == key){
  return a[i];
 } else {
  return (a[i+1]-key > key-a[i]) ? a[i] : a[i+1];
 }
}

int main(){
 int n;
 cin >> n;
 int v[n], r[n];
 for (int i = 0; i < n; i++){
  cin >> a[i];
 }
 sort(a, a+n);
 for (int i = 1; i < n; i++){
  v[i] = comb(n, search_half(a[i]));
  r[i] = search_half(a[i]);
 }
 int tmp = v[0];
 int tmp_r = r[0], tmp_n = a[n-1];
 for (int i = 1; i < n; i++){
  if (v[i] > tmp){
   tmp = v[i];
   tmp_r = r[i];
   tmp_n = a[i];
  }
 }
 cout << tmp_n << tmp_r << endl;
 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:18: error: 'search_half' was not declared in this scope; did you mean 'serach_half'?
   41 |   v[i] = comb(n, search_half(a[i]));
      |                  ^~~~~~~~~~~
      |                  serach_half
Language: C++

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

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

	// 選ぶ２つの値 (x > y)
	int x = -1, y = -1;

	std::vector<int> a(n);
	for(int i = 0; i < n; i++) {
		std::cin >> a[i];

	}

	auto itr = std::max_element(a.begin(), a.end());
	x = *itr;
	a.erase(itr);
	
	int minDiff = INT_MAX;
	for(int i : a) {
		if(std::abs(x / 2 - i) < minDiff) {
			minDiff = std::abs(x / 2 - i);
			y = i;
		}
	}

	std::cout << x << " " << y << std::endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:23: error: 'INT_MAX' was not declared in this scope
   23 |         int minDiff = INT_MAX;
      |                       ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include <vector>
  +++ |+#include <climits>
    5 |
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a[100001];
	int maxx=0;
	long long minn=0x7fffffff;
    	int ans;
    	int n,i;
    	scanf("%d",&n);
    	for(i=0;i<n;i++)
    	{
    		scanf("%d",&a[i]);
    		maxx=max(maxn,a[i]);
    	}
	sort(a,a+n);
    	for(i=0;i<n-1;i++)
    	{
    		if(abs(a[n-1]/2-a[i])<=minn)
    		{
    			minn=abs(a[n-1]/2-a[i]);
    			ans=a[i];
    		}
    	}
    	printf("%d %d",maxx,ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:26: error: 'maxn' was not declared in this scope; did you mean 'maxx'?
   14 |                 maxx=max(maxn,a[i]);
      |                          ^~~~
      |                          maxx
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a[100001];
	int maxx=0;
	long long minn=0x7fffffff;
    	int ans;
    	int n,i;
    	scanf("%d",&n);
    	for(i=0;i<n;i++)
    	{
    		scanf("%d",&a[i]);
    		maxx=max(maxn,a[i]);
    	}
	sort(a,a+n);
    	for(i=0;i<n-1;i++)
    	{
    		if(abs(a[n-1]/2-a[i])<=minn)
    		{
    			minn=fabs(a[n-i]/2-a[i]);
    			ans=a[i];
    		}
    	}
    	printf("%d %d",maxx,ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:26: error: 'maxn' was not declared in this scope; did you mean 'maxx'?
   14 |                 maxx=max(maxn,a[i]);
      |                          ^~~~
      |                          maxx
Language: C++

#include<iostream>
#include<cstdio>
typedef long long ll;
#define max(x,y) ((x)>(y)?(x):(y))
#define dfr(x,y) ((x)>(y)?((x)-(y)):((y)-(x)))
int main()
{
ll max=0,mind=200001,p,n,i;
ll inv[100000];
cin>>n;
for(i=0;i<n;i++)
{
cin>>inv[i];
if(inv[i]>max)max=inv[i];
int ndfr=dfr(inv[i]*2,max);
if(ndfr<mind)
{
mind=ndfr;
p=inv[i];
}
}
cout<<max<<" "<<p;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:1: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   10 | cin>>n;
      | ^~~
      | std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:22:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   22 | cout<<max<<" "<<p;
      | ^~~~
      | std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C++

#include"bits/stdc++.h"
using namespace std;
int a[100000];
int main()
{
	int n,t1,t2;
	int v,m=100000001;
	int cmax=-1;
	int i,j,dis;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
		if(cmax<a[i])
		{
			j=i;
			cmax=a[i];
		}
	}
	if(cmax%2==1)
	{
		t1=cmax/2;
		t2=t1+1;
	}
	else
		t1=t2=cmax/2;
	for(i=0;i<n;i++)
	{
		if(i==j)
			continuel;
		dis=min(abs(a[i]-t1),abs(a[i]-t2));
		if(m>=dis)
		{
				m=dis;
				v=a[i];
		}
	}
	printf("%d %d",cmax,v);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:25: error: 'continuel' was not declared in this scope
   30 |                         continuel;
      |                         ^~~~~~~~~
Language: C++

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

int nCr(int n[], int j) {
  int max = 1;
  int m[2];
  for (int s = j - 1; s >= 0; s--) {
    for (int t = 0; t < s; t++) {
      int ans = 1;
      for (int i = n[s]; i > n[s] - n[t]; --i) {
        ans = ans * i;
      }
      for (int i = 1; i < n[t] + 1; ++i) {
        ans = ans / i;
      }
      if (max < ans) {
        max = ans;
        m[0] = s;
        m[1] = t;
      }
    }
  }
  cout << s << t;
  return 0;
}

int main() {
  int n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  int max[2];
  int s, t;
  nCr(a[], n);
  return 0;
}


Compiler output:
a.cc: In function 'int nCr(int*, int)':
a.cc:24:11: error: 's' was not declared in this scope
   24 |   cout << s << t;
      |           ^
a.cc:24:16: error: 't' was not declared in this scope
   24 |   cout << s << t;
      |                ^
a.cc: In function 'int main()':
a.cc:37:9: error: expected primary-expression before ']' token
   37 |   nCr(a[], n);
      |         ^
Language: C++

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

int nCr(int n,int r){
  int ans = 1;
    for (int i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (int i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}

int main(){
  int n;
  int a[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  sort(a,a+n);
  int max[2];
  for(int i=n;i>=0;i--){
    for(int j=0;j<i;j++){
      if(nCr(a[i],a[j])>max){
        max[0]=i;
        max[1]=j;
    }
  }
}
  cout << max[0] << max[1] << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:24: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   26 |       if(nCr(a[i],a[j])>max){
      |          ~~~~~~~~~~~~~~^~~~
Language: C++

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

int nCr(int n,int r){
  int ans = 1;
    for (int i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (int i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}

int main(){
  int n;
  int a[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  sort(a,a+n);
  int max[2];
  for(int i=n;i>=0;i--){
    for(int j=0;j<i;j++){
      if(nCr(&a[i],&a[j])>max){
        max[0]=i;
        max[1]=j;
    }
  }
  cout << max[0] << max[1] << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:14: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   26 |       if(nCr(&a[i],&a[j])>max){
      |              ^~~~~
      |              |
      |              int*
a.cc:5:13: note:   initializing argument 1 of 'int nCr(int, int)'
    5 | int nCr(int n,int r){
      |         ~~~~^
a.cc:26:20: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   26 |       if(nCr(&a[i],&a[j])>max){
      |                    ^~~~~
      |                    |
      |                    int*
a.cc:5:19: note:   initializing argument 2 of 'int nCr(int, int)'
    5 | int nCr(int n,int r){
      |               ~~~~^
a.cc:26:26: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   26 |       if(nCr(&a[i],&a[j])>max){
      |          ~~~~~~~~~~~~~~~~^~~~
a.cc:33:2: error: expected '}' at end of input
   33 | }
      |  ^
a.cc:16:11: note: to match this '{'
   16 | int main(){
      |           ^
Language: C++

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

int nCr(int n,int r){
  int ans = 1;
    for (int i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (int i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}

int main(){
  int n;
  int a[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  sort(a,a+n);
  int max[2];
  for(int i=n;i>=0;i--){
    for(int j=0;j<i;j++){
      if(nCr(a[i],a[j])>max){
        max[0]=i;
        max[1]=j;
    }
  }
  cout << max[0] << max[1] << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:24: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   26 |       if(nCr(a[i],a[j])>max){
      |          ~~~~~~~~~~~~~~^~~~
a.cc:33:2: error: expected '}' at end of input
   33 | }
      |  ^
a.cc:16:11: note: to match this '{'
   16 | int main(){
      |           ^
Language: C++

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

int main() {
	int N;
	std::cin >> N;
	std::vector<int> v(N);
	for (int i = 0; i < N; ++i) std::cin >> v[i];
	std::sort(v.begin(), v.end());
	double max = static_cast<double>(v.back());
	double min = max / 2.0;
	int target;
	for (int i = 0; i < N - 1; ++i) {
		double diff = std::fabs(max / 2.0 - static_cast<double>(v[i]));
		if (diff <= min) {
			min = diff;
			target = i;
		}
	}
	std::cout << v.back() << " " << v[target] << "\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:36: error: 'fabs' is not a member of 'std'; did you mean 'labs'?
   16 |                 double diff = std::fabs(max / 2.0 - static_cast<double>(v[i]));
      |                                    ^~~~
      |                                    labs
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
  long long  n;
  cin >> n;
  long long a[n];
  for (int i =0; i<n; i++) cin >> a[i];
  sort(a,a+n);
  long  max = a[n-1];
  long double  dif = 1000000000;
  long double  target  = max/2.0;
  long  ans = a[0];a
  for (int i =0; i<n; i++){
    long double c = abs(a[i]-target);
    if(dif> c)  ans = a[i];
    dif = min(dif,c);
  }
    
  
  cout << max <<" "<< ans  << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:21: error: expected ';' before 'for'
   13 |   long  ans = a[0];a
      |                     ^
      |                     ;
   14 |   for (int i =0; i<n; i++){
      |   ~~~                
a.cc:14:18: error: 'i' was not declared in this scope
   14 |   for (int i =0; i<n; i++){
      |                  ^
Language: C++

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

int main()
{
  int N;
  cin >> N;
  std::vector<int> X;
  for (int i=0; i < N; i++) {
    int n;
    cin >> n;
    X.push_back(n);
  }
  int max = *std::max_element(X.begin(), X.end());
  float mid = 0;
  mid = max / 2.0;

  int max_b = 0;
  float min_diff = 1000000000;
  for (int n : X) {
    if (n == max) {
      continue;
    }
    if (fabs(mid - n) < min_diff)  {
      min_diff = fabs(mid - n);
      max_b = n;
    }
  }
  std::cout << max << " " << max_b << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:9: error: 'fabs' was not declared in this scope; did you mean 'labs'?
   26 |     if (fabs(mid - n) < min_diff)  {
      |         ^~~~
      |         labs
Language: C++

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

int main() {
    int n;
    cin >> n;
    int arr[n];
    for (int i = 0; i < n; i++) {
        cin >> arr[i];
    }
    sort(arr, arr+n);
    
    int l, r;
    long long min = 1145141919810;
    for (int i = 0; i < n-1; i++) {
        long long mid = arr[n-1] / 2;
        if ((mid-arr[i])*(mid-arr[i]) <= min && mid * 2 = arr[n-1]) {
            l = arr[n-1];
            r = arr[i];
            min = (mid-arr[i])*(mid-arr[i]);
        }
        else if ((mid-arr[i]-1)*(mid-arr[i]-1) <= min && mid * 2 != arr[n-1]) {
            l = arr[n-1];
            r = arr[i];
            min = (mid-arr[i]-1)*(mid-arr[i]-1);
        }
    }
    cout << l << " " << r << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:46: error: lvalue required as left operand of assignment
   20 |         if ((mid-arr[i])*(mid-arr[i]) <= min && mid * 2 = arr[n-1]) {
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
Language: C++

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

int main() {
    int n;
    cin >> n;
    int arr[n];
    for (int i = 0; i < n; i++) {
        cin >> arr[i];
    }
    sort(arr, arr+n);
    
    int l, r;
    long long min = 1145141919810;
    for (int i = 0; i < n-1; i++) {
        long long mid = arr[n-1] / 2 - arr[i];
        if ((mid)*(mid) < min) {
            l = arr[n-1];
            r = arr[i];
            min = (mid)*(mid);
        }
        else {
            
    }
    cout << l << " " << r << endl;
}


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

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

int main(){
	int n, a, x, y, z;
	vector<int> v;
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> a;
		v.push_back(a);
	}
	int max = *max_element(v.begin(), v.end());
	
	y = max
	for(int j = 0; j < n; j++){
		z = abs(v[j] - max/2.0);
		if(y>v[j]){
			y = v[j];
			x = j;
		}
	}
	printf("%d %d", max, v[j]);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:16: error: expected ';' before 'for'
   14 |         y = max
      |                ^
      |                ;
   15 |         for(int j = 0; j < n; j++){
      |         ~~~     
a.cc:15:24: error: 'j' was not declared in this scope
   15 |         for(int j = 0; j < n; j++){
      |                        ^
Language: C++

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

int kai(int k) {
    int sum = 1;
    for (int i = 1; i <= k; i++) {
        sum *= i;
    }
    return sum;
}

int comb(int l,int r) {
    int c = (kai(l)) / ((kai(l-r))*(kai(r)));
    return c;
}

int main() {
    int n;
    cin >> n;
    int arr[n];
    for (int i = 0; i < n; i++) {
        cin >> arr[i];
    }
    sort(arr, arr+n);
    
    long long max = 1;
    int l, r;
    for (int i = 0; i < n-1; i++) {
        for (int j = i; j < n; j++ ) {
            if (comb(arr[j],arr[i]) > max) {
                max = comb(arr[j],arr[i]);
                l = arr[j];
                r = arr[i];
            }
        }
    }
    cout << l << " " << r << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:40:35: error: expected '}' at end of input
   40 |     cout << l << " " << r << endl;
      |                                   ^
a.cc:20:12: note: to match this '{'
   20 | int main() {
      |            ^
Language: C++

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

int kai(int k) {
    int sum = 1;
    for (int i = 1; i <= k; i++) {
        sum *= i;
    }
    return sum;
}

int comb(int l,int r) {
    int c = (kai(l)) / ((kai(l-r))*(kai(r)));
    return c;
}

int main() {
    int n;
    //scanf("%d", &n);
    cin >> n;
    int arr[n];
    for (int i = 0; i < n; i++) {
        cin >> arr[i];
    }
    sort(arr, arr+n);
    
    long long max = 1;
    int l, r;
    for (int i = 0; i < n-1; i++) {
        for (int j = i; j < n; j++ ) {
            if (comb(arr[j],arr[i]) > max) {
                max = comb(arr[j],arr[i]);
                l = arr[j];
                r = arr[i];
            }
        }
    }
    printf("%d %d",l,r);
    return 0;
}

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

#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
int main(void){
	int n,i,a[1000000],max=0,h=1,r=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
		if(a[i]>max) max=a[i];
	}
	for(i=0;i<n;i++){
		if(a[i]==max/2){
			printf("%d %d\n",max,a[i]);
			return 0;
		}
	}
	for(i=0;i<n;i++){
		if(a[i]==max/2+h){
			printf("%d %d\n",max,a[i]);
			return 0;
		}
		if(a[i]==max/2+r){
			printf("%d %d\n",max,a[i]);
			return 0;
		}
		h++;
		r--;
	}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:10: error: expected '}' at end of input
   31 |         }
      |          ^
a.cc:7:15: note: to match this '{'
    7 | int main(void){
      |               ^
Language: C++

#include <vector>
#include <list>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <iterator>
#include <math.h>
#include <cstdlib>
#include <cmath>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define dump(x)  cerr << #x << " = " << (x) << endl;
using namespace std;
int main(){
  int n;
  cin >> n;
  int a[n];
  FOR(i,0,n){
    cin >> a[i];
  }
  sort(a,a + n);
  cout << a[n -1] << " ";
  double half = (a[n -1] / 2.0);
  double dist = half;
  int ind = 0;
  //dump(dist);
  FOR(i,0,n-1){
    if(abs(a[i] * 1.0 - half) < dist){
      dist = abs(a[i]* 1.0 - half);
      ind = i;
      //dump(dist);
    }
  }
  //dump(a[ind]);
  cout << a[ind] << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:3: error: 'cin' was not declared in this scope
   17 |   cin >> n;
      |   ^~~
a.cc:11:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
   10 | #include <cmath>
  +++ |+#include <iostream>
   11 | 
a.cc:23:3: error: 'cout' was not declared in this scope
   23 |   cout << a[n -1] << " ";
      |   ^~~~
a.cc:23:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:36:21: error: 'endl' was not declared in this scope
   36 |   cout << a[ind] << endl;
      |                     ^~~~
a.cc:11:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
   10 | #include <cmath>
  +++ |+#include <ostream>
   11 |
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main () {
	int n, e;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	int mx = a[n - 1].first;
	auto itu = upper_bound(a.begin(), a.end(), mx / 2);
	auto itl = lower_bound(a.begin(), a.end(), mx / 2);
	int mn = min(mn, mx - it->first);
	cout << mx << " " << mn;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:27: error: request for member 'first' in 'a.std::vector<int>::operator[](((std::vector<int>::size_type)(n - 1)))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   13 |         int mx = a[n - 1].first;
      |                           ^~~~~
a.cc:16:31: error: 'it' was not declared in this scope; did you mean 'itl'?
   16 |         int mn = min(mn, mx - it->first);
      |                               ^~
      |                               itl
Language: C++

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

int main() {
    int n, max, d, k;
    int arr[110000];
    cin >> n;
    for(int i=0; i<n; i++) cin >> arr[i];
    sort(arr, arr+n);
    max = arr[n-1];
    int min_dir = max;
    for(int i=0; i<n-1; i++){
        d = abs(arr[i] - max/2); 
        if(d <= dir) {
            min_dir = d;
            k = i;
        }
    }
    cout << max << " " << arr[k] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:17: error: 'dir' was not declared in this scope; did you mean 'div'?
   16 |         if(d <= dir) {
      |                 ^~~
      |                 div
Language: C++

#include <iostream>
#include <fstream>
#include <cstdio>
#include <cassert>
#include <complex>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <sstream>
#include <ctime>
#include <cctype>
#include <set>
#include <map>
#include <queue>
#include <bitset>
#include <deque>
#include <stack>
#include <memory.h>
using namespace std;
#define ll long long
#define mp make_pair
onst int Maxx = 1e5 + 7;
const int Inf = 1e9 + 7;
int n;
int a[Maxx];
 
int main() {
	scanf("%d", &n);
	for(int i = 1; i <= n; i++) scanf("%d", &a[i]);
	sort(a + 1, a + n + 1);
	int t = a[n] / 2;
	int min = Inf;
	int p;
	for(int i = 1; i <= n; i++) {
		if(abs(a[i] - t) <= min) {
			min = abs(a[i] - t);
			p = a[i];
		}
	}
	if(n == 2) printf("%d %d\n", a[2], a[1]);
	else printf("%d %d\n", a[n], p);
}

Compiler output:
a.cc:27:1: error: 'onst' does not name a type; did you mean 'const'?
   27 | onst int Maxx = 1e5 + 7;
      | ^~~~
      | const
a.cc:30:7: error: 'Maxx' was not declared in this scope
   30 | int a[Maxx];
      |       ^~~~
a.cc: In function 'int main()':
a.cc:34:50: error: 'a' was not declared in this scope
   34 |         for(int i = 1; i <= n; i++) scanf("%d", &a[i]);
      |                                                  ^
a.cc:35:14: error: 'a' was not declared in this scope
   35 |         sort(a + 1, a + n + 1);
      |              ^
Language: C++

#include <iostream>
#include <fstream>
#include <cstdio>
#include <cassert>
#include <complex>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <sstream>
#include <ctime>
#include <cctype>
#include <set>
#include <map>
#include <queue>
#include <bitset>
#include <deque>
#include <stack>
#include <memory.h>
using namespace std;
#define ll long long
#define mp make_pair
const int Inf=1e9+7;
int n;
int a[100005];
int main() {
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a+1,a+n+1);
	int t=a[n]/2;
	int min=Inf;
	int p;
	for(int i=0;i<n;i++) {
		if(abs(a[i]-t)<min) {
			min=abs(a[i]-t);
			p=a[i];
		}
	}
	if(n==2){
		cout<<a[2]<<" "<<a[i];
	}  
	else cout<<a[n-1]<<" "<<p;
}

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

#include <iostream>
#include <stdlib.h>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
  int n;
  cin >> n;
  int ain[n];
  vector<int> a;
  for (int i = 0; i < n; i++) {
    cin >> ain[i];
    a.push_back(ain[i]);
  }
  sort(a.begin(), a.end());
  int k = a[a.size() - 1] / 2;
  int sa = a * k;
  int temp;
  for (int i = 0, i < n; i++) {
    if (abs(a[i] - k) < sa) {
      temp = i;
      sa = abs(a[i] - k);
    }
  }
  cout << a[a.size() - 1] << " " << a[temp] << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:14: error: no match for 'operator*' (operand types are 'std::vector<int>' and 'int')
   18 |   int sa = a * k;
      |            ~ ^ ~
      |            |   |
      |            |   int
      |            std::vector<int>
a.cc:20:20: error: expected ';' before '<' token
   20 |   for (int i = 0, i < n; i++) {
      |                    ^~
      |                    ;
a.cc:20:21: error: expected primary-expression before '<' token
   20 |   for (int i = 0, i < n; i++) {
      |                     ^
Language: Java

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

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc1 = new Scanner(System.in);

		int n = sc1.nextInt();

		int[] a = new int[n];

		for (int i = 0 ; i < n ; i++ ) {
			a[i] = sc1.nextInt();
		}

		Arrays.sort(a);

		//rの最大値
		double m = (double)a[n-1] / 2;
		//System.out.println("m=" + m);
		//rの最大値からの差分
		double c;
		//rが最大となるa
		int b = a[0];

		for (int i = 0 ; i < n-1 ; i++ ) {
			double x = m - a[i];
			c = Math.abs(x);
			if (c <= Math.abs(m-b)) {
				b = a[i];
				//System.out.println("c=" + c + ",b=" + b);
			}
		}

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

		sc1.close();

	}

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

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

int main(){
  int n;
  int a[10000];
  cin >> n;

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

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

  int id_1,id_2;
  if(max % 2 != 0){
    id_1 = max / 2;
    id_2 = max / 2 + 1;
  }else{
    id_1 = id_2 = max/2;
  }

  int r = -1;
  while(1){
    for(int i = 0;i < n;i++){
      if(i != max_id){
        if(a[i] == id_1 || a[i] == id_2){
          r = i;
          break;
        }
      }
    }
    if(r != -1){
      break;
    }else{
      id_1++;
      id_2--;
    }
  }

  cout << max << " " << a[r] << endl;
  return(0);
}


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

#include<iostream>
#include<string>
#include<cstdlib>

using namespace std;

long X[200010]={};

void swap(long *x, long *y);
void quicksort(long X[], long low, long high);

int main(void)
{
	int N,tmp;

	cin >> N;
	for(int i =0; i<N; i++){
	 cin >> X[i];
	}
	quicksort(X,0,N-1);

/*
	for(int i=0;i<N; i++){
		cout << i << "=" << X[i] << endl;
	}
	*/
	int mid1; int mid2=0;
		mid1 = X[N-1]/2;
		int tmp = X[N-1];
		long min;
		for(int i = 0; i < N-1; i++){
			if(abs(mid1 - X[i]) < tmp){
				tmp = abs(mid1 - X[i]);
				min = X[i];
			}
		}
		
		cout << X[N-1] << " " <<  X[min] << endl;

	
	
	return 0;
}

void quicksort(long X[], long low, long high){
	if(low < high){
		int mid = (low + high) /2;
		long x= X[mid];
		long i = low; long j = high;
		while(i <= j){
			while(X[i] < x) i = i+1;
			while(X[j] > x) j = j-1;
			if(i<=j) swap(&X[i++], &X[j--]);
		}
		quicksort(X,low,j);
		quicksort(X,i,high);
	}
}

void swap(long *x, long *y){
	long tmp;
	tmp = *x;
	*x = *y;
	*y = tmp;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:21: error: redeclaration of 'int tmp'
   29 |                 int tmp = X[N-1];
      |                     ^~~
a.cc:14:15: note: 'int tmp' previously declared here
   14 |         int N,tmp;
      |               ^~~
Language: Java

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

public class Main {

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

    void solve() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] a = new long[n];
        long max = 0;
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        Arrays.sort(a);
        long abs = a[n - 1] / 2;
        if (a[n - 1] % 2 != 0) {
            abs++;
        }
        long ans = a[i-1];
        long A = 0;
        for (int i = 0; i < n - 1; i++) {
            long b = Math.abs(a[i] - abs);
            if (ans > b) {
                ans = b;
                A = a[i];
            }
        }
        System.out.println(a[n - 1] + " " + A);
    }
}

Compiler output:
Main.java:23: error: cannot find symbol
        long ans = a[i-1];
                     ^
  symbol:   variable i
  location: class Main
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n,s,e;
	scanf("%d",&n);
	scanf("%d",&s);
	for(i=1;i<n;i++)
	{
		scanf("%d",&e);
	}
	printf("%d %d",s,e);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:13: error: 'i' was not declared in this scope
    8 |         for(i=1;i<n;i++)
      |             ^
Language: Java

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

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] x = new int[n];
		for(int i = 0; i < n; i++) {
			x[i] = scanner.nextInt();
		}
		Arrays.sort(x);
		int maxkey = n-1;
		int max = x[maxkey];
		int minkey = 0;
		int min = x[minkey];
		int midkey = 0;
//		int idealint = x[n-1]/2;
				
		do{
			midkey = (maxkey + minkey)/2;
			if( x[midkey] == x[n-1]/2){

				break;
			}else if(x[midkey] > x[n-1]/2 ) {
				maxkey = midkey - 1;
			}else  {
				minkey = midkey +1;
			}
			
		}while (minkey < maxkey);
		if(Math.max(x[n-1] - x[minkey],x[minkey]) >= Math.max(x[n-1] - x[minkey-1],x[minkey-1])) {
			minkey--;
		}else if(Math.max(x[n-1] - x[minkey],x[minkey]) >= Math.max(x[n-1] - x[minkey+1],x[minkey+1])) {
			minkey++;
		}
		System.out.printf("%d%s%d", x[n-1], " ", x[minkey]);
	}

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


#include <iostream>
#include<algorithm>
#include<vector>
#include <unordered_map>
#include <cstdint>
#include <cstring>

using namespace std;
int main(){
    
    int n;
    int a[100000];
    cin>>n;
    for(int i=0;i<n;i++) cin>>a[i];
    sort(a,a+n);
    int a_i,a_j;
    a_i=a[n-1];
    int min_idx=0;
    float cost;
    int min_cost=1000000000;
    for(int i=0;i<n-1;i++){
        cost=sqrt((float(a_i)/2-a[i])*(a_i/2-a[i]));
        if(cost<min_cost){
            min_cost=cost;
            min_idx=i;
        }
    }
    cout<<a_i<<" "<<a[min_idx]<<endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:14: error: 'sqrt' was not declared in this scope
   23 |         cost=sqrt((float(a_i)/2-a[i])*(a_i/2-a[i]));
      |              ^~~~
Language: C++


#include <iostream>
#include<algorithm>
#include<vector>
#include <unordered_map>
#include <cstdint>
#include <cstring>

using namespace std;
int main(){
    
    int n;
    int a[100000];
    cin>>n;
    for(int i=0;i<n;i++) cin>>a[i];
    sort(a,a+n);
    int a_i,a_j;
    a_i=a[n-1];
    int min_idx=0;
    float cost;
    int min_cost=1000000000;
    for(int i=0;i<n-1;i++){
        cost=sqrt((a_i/2-a[i])*(a_i/2-a[i]));
        if(cost<min_cost){
            min_cost=cost;
            min_idx=i;
        }
    }
    cout<<a_i<<" "<<a[min_idx]<<endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:14: error: 'sqrt' was not declared in this scope
   23 |         cost=sqrt((a_i/2-a[i])*(a_i/2-a[i]));
      |              ^~~~
Language: C++

//#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int combination(int n,int r){
    int sum=1;
    for(int i=1;i<=r;i++) //注意i的取值
        //P(n,r)=n*(n-1)...(n-r+1)
        //C(n,r)=P(n,r)/r!
        sum = sum*(n-i+1)/i;
    return sum;
}


int main()  
{  
    int n;
    int a[100002];
    memset(a,0,sizeof(a));
    cin >> n;
    for(int i = 0; i<n;i++) cin >> a[i];
    sort(a,a+n);

    int b[100002][100002];
    memset(b,0,sizeof(b));

   // for(int i = 0; i<n;i++) cout << a[i] <<" ";
    //cout << endl;
    
    int ans = 0;
    int max = 0;
    int A,B;
    A = B = 0;
    for(int i=0; i<n-1; i++)
        for(int j=i+1; j<n; j++)
            if(a[i]<a[j]){
                if(!b[a[j]][a[i]]){
                    ans = combination(a[j],a[i]);
                    b[a[j]][a[i]] = ans;
                }
                else
                    ans = b[a[j]][a[i]];
               // cout << a[j] <<" " << a[i] << " " << ans <<endl;
                if(max < ans){
                    max = ans; A = a[i]; B = a[j];
                }
            }
    cout << B << " " << A <<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:5: error: 'memset' was not declared in this scope
   18 |     memset(a,0,sizeof(a));
      |     ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<iostream>
  +++ |+#include <cstring>
    3 | using namespace std;
a.cc:21:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   21 |     sort(a,a+n);
      |     ^~~~
      |     short
Language: C++

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

int main() {
  long long int comb(int x, int y);
  int n;
  cin >> n;
  int ain[n];
  vector<int> a;
  for (int i = 0; i < n; i++) {
    cin >> ain[i];
    a.push_back(ain[i]);
  }
  sort(a.begin(), a.end());
  int mae = 0
  int ato = 0;
  long long int ima = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (ima < comb(a[j], a[i])) {
        mae = a[j];
        ato = a[i];
        ima = comb(a[j], a[i]);
      }
    }
  }
  cout << mae << " " << ato << endl;
}

long long int comb(int x, int y) {
  long long int kaijou(int x, int y);
  return kaijou(y + 1, x) / kaijou(1, y);
}

long long int kaijou(int x, int y) {
  long long int a = 1;
  for (int i = x; i <= y; i++) {
    a = a * i;
  }
  return a;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:3: error: expected ',' or ';' before 'int'
   18 |   int ato = 0;
      |   ^~~
a.cc:24:9: error: 'ato' was not declared in this scope; did you mean 'atol'?
   24 |         ato = a[i];
      |         ^~~
      |         atol
a.cc:29:25: error: 'ato' was not declared in this scope; did you mean 'atol'?
   29 |   cout << mae << " " << ato << endl;
      |                         ^~~
      |                         atol
Language: C

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

#define LINE_BUF_SIZE 256

int main(){

    int i,j,k;
    long int N;
    char line[LINE_BUF_SIZE];

    fgets(line,sizeof(line),stdin);
    sscanf(line,"%ld", &N);

    long long int *a = malloc(sizeof(long long int)*(N+1));
    long long int *a_hold = malloc(sizeof(long long int)*(N+1));

    for(i=1;i<=N;i++){
        scanf("%lld ",&a[i]);
        a_hold[i] = a[i];
    }

    long long int max = 0;
    long long int j_hold = 0;
    
    for(j=N;j>=1;j--){
            if(max <= a[j]){
                max = a[j];
                j_hold = j;
            }
    }
    
    max = X[j_hold];

    printf("%d\n",max);
    printf("%d",max/2);

    return 0;

}

Compiler output:
main.c: In function 'main':
main.c:35:11: error: 'X' undeclared (first use in this function)
   35 |     max = X[j_hold];
      |           ^
main.c:35:11: note: each undeclared identifier is reported only once for each function it appears in
Language: Java

Copy
Copy
import java.util.*;
 
class Main{
	
	public static void main(String args[]){
 
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int x[] = new int[N];
 
		for(int n=0;n<N;n++){
			int v = sc.nextInt();
			x[n] = v;
		}
 
		Arrays.sort(x);
 
		int max = x[N-1];
		long dist = -1;
 
		int t=-1;
		for(int n=0;n<N;n++){
			
			if(dist == -1){
				dist = Math.abs((long)max/2-x[n]);
				t = x[n];
			}
			else if(dist > Math.abs((long)max/2-x[n])){
				dist = Math.abs((long)max/2-x[n]);
				t = x[n];
			}
			if(x[n] > (long)max/2) break;
		}
		System.out.println(max+" "+t);
	}
}

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
Copy
^
1 error
Language: C++

using namespace std;
long long a[101],n,total;
void comb(int i,int j)
{
	for(int k=i;k>=j;--k)
	n*=k;
}
void qqsort(int l,int r)
{
	int i=l,j=r,mid=(l+r)/2;
	while(a[i]<a[mid])++i;
	while(a[j]>a[mid])--j;
	int temp;
	temp=a[i];
	a[i]=a[j];
	a[j]=temp;
	++i;--j;
	if(j>l)qqsort(l,j);
	if(i<r)qqsort(i,r);
}
int main()
{
	int s=0,k,l,d=0,f=0;
	cin>>s;
	for(int i=1;i<=s;++i)
	cin>>a[i];
	qqsort(1,s);
	for(k=1;k<=n;++k)
		for(l=1;l<=k;++l)
		{
			comb(a[k],a[l]);
			if(n>total)
			{
				total=n;
				d=k;f=l;
			}
		}
	cout<<d<<f<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:9: error: 'cin' was not declared in this scope
   24 |         cin>>s;
      |         ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:38:9: error: 'cout' was not declared in this scope
   38 |         cout<<d<<f<<endl;
      |         ^~~~
a.cc:38:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:38:21: error: 'endl' was not declared in this scope
   38 |         cout<<d<<f<<endl;
      |                     ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
Language: C++

using namespace std;
long long a[101],n,total;
void comb(int i,int j)
{
	for(int k=i;k>=j;--k)
	n*=k;
}
void qqsort(int l,int r)
{
	int i=l,j=r,mid=(l+r)/2;
	while(a[i]<a[mid])++i;
	while(a[j]>a[mid])--j;
	int temp;
	temp=a[i];
	a[i]=a[j];
	a[j]=temp;
	++i;--j;
	if(j>l)qqsort(l,j);
	if(i<r)qqsort(i,r);
}
int main()
{
	int s=0,k,l,d=0,f=0;
	cin>>s;
	for(int i=1;i<=s;++i)
	cin>>a[i];
	qqsort(1,s);
	for(k=1;k<=n;++k)
		for(l=1;i<=k;++l)
		{
			comb(a[k],a[l]);
			if(n>total)
			{
				total=n;
				d=k;f=l;
			}
		}
	cout<<d<<f<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:9: error: 'cin' was not declared in this scope
   24 |         cin>>s;
      |         ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:29:25: error: 'i' was not declared in this scope
   29 |                 for(l=1;i<=k;++l)
      |                         ^
a.cc:38:9: error: 'cout' was not declared in this scope
   38 |         cout<<d<<f<<endl;
      |         ^~~~
a.cc:38:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:38:21: error: 'endl' was not declared in this scope
   38 |         cout<<d<<f<<endl;
      |                     ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;