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

int main(void){
    int N;
    scanf("%d",&N);
    for (int i =0; i<N;i++){
        int a[i];
        scanf("%d",&a[i]);
    }
        for(int i =0;i<N-1; i++){
            int j =i;
            for(int k =i;k<N;k++){
                if(a[k]<a[j]){j = k;
                }
                if(i<j){
                    double v =a[i];
                    a[i] = a[j];
                    a[j] = v;
                }
            }
        }
            for(int i =0;i<N;i++){
                int a[i];
                if(a[i]>a[N/2]){
                    printf("%d",a[N/2]);
                }else{printf("%d",a[N/2+1]);
                             }
                             }
    
                             
                             
                             return 0;
                             }


Compiler output:
a.cc: In function 'int main()':
a.cc:3:5: error: 'scanf' was not declared in this scope
    3 |     scanf("%d",&N);
      |     ^~~~~
a.cc:11:20: error: 'a' was not declared in this scope
   11 |                 if(a[k]<a[j]){j = k;
      |                    ^
a.cc:14:31: error: 'a' was not declared in this scope
   14 |                     double v =a[i];
      |                               ^
a.cc:23:21: error: 'printf' was not declared in this scope
   23 |                     printf("%d",a[N/2]);
      |                     ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int main(void){
a.cc:24:23: error: 'printf' was not declared in this scope
   24 |                 }else{printf("%d",a[N/2+1]);
      |                       ^~~~~~
a.cc:24:23: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
Language: C

int main(void){
    int N;
    scanf("%d",&N);
    for (int i =0; i<N;i++){
        int a[i];
        scanf("%d",&a[i]);
    }
        for(int i =0;i<N-1; i++){
            int j =i;
            for(int k =i;k<N;k++){
                if(a[k]<a[j]){j = k;
                }
                if(i<j){
                    double v =a[i];
                    a[i] = a[j];
                    a[j] = v;
                }
            }
        }
            for(int i =0;i<N;i++){
                int a[i];
                if(a[i]>a[N/2]){
                    printf("%d",a[N/2]);
                }else{printf("%d",a[N/2+1]);
                             }
                             }
    
                             
                             
                             return 0;
                             }


Compiler output:
main.c: In function 'main':
main.c:3:5: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    3 |     scanf("%d",&N);
      |     ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | int main(void){
main.c:3:5: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    3 |     scanf("%d",&N);
      |     ^~~~~
main.c:3:5: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:11:20: error: 'a' undeclared (first use in this function)
   11 |                 if(a[k]<a[j]){j = k;
      |                    ^
main.c:11:20: note: each undeclared identifier is reported only once for each function it appears in
main.c:23:21: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   23 |                     printf("%d",a[N/2]);
      |                     ^~~~~~
main.c:23:21: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:23:21: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:23:21: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:24:23: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   24 |                 }else{printf("%d",a[N/2+1]);
      |                       ^~~~~~
main.c:24:23: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C++

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

int main(){
    int N;
    cin >> N;
    int Z;
    Z = N/2;
    int a[N];
    std::vector<int> v;
    std::vector<int> x;
    for(int i = 0;i<N;++i){
        int N[i];
        cin >> N[i];
        v.push_back(N[i]);
    }
    for(int j = 0;j<N;++j) {
        std::vector<int> x(v);
        x[j]=0;
        sort(x.begin(), x.end());
        cout << v[Z] << endl;

    }




}

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

#include <iostream>
#include <vector>


int main() {
    int i, N = 0;
    std::vector<int> xn, xi;
    std::cin >> N;
    for (i = 0; i < N; i++) {
        int x;
        std::cin >> x;
        xn.push_back(x);
        xi.push_back(x);
    }
    std::sort(xn.begin(), xn.end());
    for (i = 0; i < N; i++) {
        int median = xn[N / 2];
        if (xi[i] == median) {
            if (i < N / 2) {
                std::cout << xn[N /2 - 1] << std::endl;
            } else {
                std::cout << xn[N /2 + 1] << std::endl;
            }
        } else {
            std::cout << median << std::endl;
        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   15 |     std::sort(xn.begin(), xn.end());
      |          ^~~~
      |          qsort
Language: C++

#include <iostream>
#include <vector>


int main() {
    int i, N = 0;
    std::vector<int> xn, xi;
    std::cin >> N;
    for (i = 0; i < N; i++) {
        int x;
        std::cin >> x;
        xn.push_back(x);
        xi.push_back(x);
    }
    std::sort(xn.begin(), xn.end(), std::less<int>());
    for (i = 0; i < N; i++) {
        int median = xn[N / 2];
        if (xi[i] == median) {
            std::cout << xn[N /2 - 1] << std::endl;
        } else {
            std::cout << median << std::endl;
        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   15 |     std::sort(xn.begin(), xn.end(), std::less<int>());
      |          ^~~~
      |          qsort
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int n;
  cin>>n;
  int x[n];
  for(int i=0;i<n;i++){
    cin>>x[i];
  }
  int c[n];
  for(int i=0;i<n;i++){
    c[i]=x[i];
  }
  sort(c,c+n);
  ml=c[n/2];
  mr=c[n/2+1];
  for(int i=0;i<n;i++){
    if(x[i]<mr)cout<<mr<<endl;
    else cout<<ml<<endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:3: error: 'ml' was not declared in this scope
   16 |   ml=c[n/2];
      |   ^~
a.cc:17:3: error: 'mr' was not declared in this scope
   17 |   mr=c[n/2+1];
      |   ^~
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <numeric>
#include <climits>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, k, n) for(int i = (k); i < (int)(n); i++)
using namespace std;
using ll = long long;
int N, M;
int cnt = 0;
int ans = 0;
int main(){
    int cw = 0;
    cin >> N;
    int X[N], Y[N];
    rep(i, N) cin >> X[i];
    int count = N / 2;
    memcpy(Y, X, sizeof(int) * N);
    rep(i, N){
        X[cw] = 0;
        sort(X, X + N);
        cout << X[count] << endl;
        memcpy(X, Y, sizeof(int) * N);
        cw++;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:5: error: 'memcpy' was not declared in this scope
   22 |     memcpy(Y, X, sizeof(int) * N);
      |     ^~~~~~
a.cc:9:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    8 | #include <math.h>
  +++ |+#include <cstring>
    9 | #define rep(i, n) for(int i = 0; i < (int)(n); i++)
Language: C

#include<stdio.h>

int main(){
	int N;
	scanf("%d", &N);
	
	for(i=0; i<N; i++){
		scanf("%d", &X[i]);
	}
	
	int a;
	for(j=0; j<N; j++){
		for(i=0; i<N; i++){
			if(X[i]>X[i+1]){
				a = X[i];
				X[i] = X[i+1];
				X[i+1] = a;
			}
		}
	}
	
	for(i=0; i<N/2; i++){
		printf("%d\n", X[N/2+1]);
	}
	for(i=N/2; i<N; i++){
		printf("%d\n", X[N/2]);
	}
	
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:7:13: error: 'i' undeclared (first use in this function)
    7 |         for(i=0; i<N; i++){
      |             ^
main.c:7:13: note: each undeclared identifier is reported only once for each function it appears in
main.c:8:30: error: 'X' undeclared (first use in this function)
    8 |                 scanf("%d", &X[i]);
      |                              ^
main.c:12:13: error: 'j' undeclared (first use in this function)
   12 |         for(j=0; j<N; j++){
      |             ^
Language: Java

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

public class Ex1 {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int a[] = new int[N];
		int b[] = new int[N];

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

		int c = 0;
		for (int i = 0; i < N; i++) {
			c = 0;
			for (int j = 0; j < N; j++) {
				if (i != j) {
					b[j] = a[j];
				}
			}
			Arrays.sort(b);

			System.out.println(b[(N + 1) / 2]);
		}
	}

}

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

#include<stdio.h>

int main(){
	int N;
	scanf("%d", &N);
	
	for(i=0; i<N; i++){
		scanf("%d", &X[i]);
	}
	
	int a;
	for(j=0; j<N; j++){
		for(i=0; i<N; i++){
			if(X[i]>X[i+1]){
				a = X[i];
				X[i] = X[i+1];
				X[i+1] = a;
			}
		}
	}
	
	for(i=0; i<N/2; i++){
		printf("%d\n", X[N/2]);
	}
	for(i=N/2; i<N; i++){
		printf("%d\n", X[N/2]);
	}
	
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:7:13: error: 'i' undeclared (first use in this function)
    7 |         for(i=0; i<N; i++){
      |             ^
main.c:7:13: note: each undeclared identifier is reported only once for each function it appears in
main.c:8:30: error: 'X' undeclared (first use in this function)
    8 |                 scanf("%d", &X[i]);
      |                              ^
main.c:12:13: error: 'j' undeclared (first use in this function)
   12 |         for(j=0; j<N; j++){
      |             ^
Language: C++


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

using namespace std;
int main(){
    
    int N,a;
    int X[200000],X_dash[200000];
    vector<int> X_vector,X_copy;
    std::unordered_map<int, int> mp;
    cin>>N;
//    for(int i=0;i<N;i++)cin>>X[i];
    for(int i=0;i<N;i++){
        cin>>X[i];
    }

    memcpy(X_dash, X, sizeof(int) * 200000);
    sort(X_dash,X_dash+N);
    for(int i=0;i<N;i++){
        mp[X_dash[i]]=i;
        X_vector.push_back(X_dash[i]);
    }

    for(int i=0;i<N;i++){
        X_copy=X_vector;
        X_copy.erase(X_copy.begin() + mp[X[i]]);
        cout<<X_copy[N/2-1]<<endl;
    }
    return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:5: error: 'memcpy' was not declared in this scope
   20 |     memcpy(X_dash, X, sizeof(int) * 200000);
      |     ^~~~~~
a.cc:6:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include <unordered_map>
  +++ |+#include <cstring>
    6 |
Language: C++


#include <iostream>
#include<algorithm>
#include<vector>
#include <unordered_map>       // ヘッダファイルインクルード

using namespace std;
int main(){
    
    int N,a;
    int X[200000],X_dash[200000];
    vector<int> X_vector,X_copy;
    std::unordered_map<int, int> mp;
    cin>>N;
//    for(int i=0;i<N;i++)cin>>X[i];
    for(int i=0;i<N;i++){
        cin>>X[i];
    }

    memcpy(X_dash, X, sizeof(int) * 200000);
    sort(X_dash,X_dash+N);
    for(int i=0;i<N;i++){
        mp[X_dash[i]]=i;
        X_vector.push_back(X_dash[i]);
    }

    for(int i=0;i<N;i++){
        X_copy=X_vector;
        X_copy.erase(X_copy.begin() + mp[X[i]]);
        cout<<X_copy[N/2-1]<<endl;
    }
    return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:5: error: 'memcpy' was not declared in this scope
   20 |     memcpy(X_dash, X, sizeof(int) * 200000);
      |     ^~~~~~
a.cc:6:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include <unordered_map>       // ヘッダファイルインクルード
  +++ |+#include <cstring>
    6 |
Language: C++

#include<iostream>
#include<algorithm>

using namespace std;

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

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

	sort(Y, Y + N, greater<int>());
	int f = N / 2
	int middlegreat = Y[f];
	
	int middlelittle = Y[f + 1];

	for (int i = 1; i <= N; ++i) {
		if (middlelittle >= X[i])
			cout << middlegreat << '\n';
		else 
			cout << middlelittle << '\n';
		
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:9: error: expected ',' or ';' before 'int'
   18 |         int middlegreat = Y[f];
      |         ^~~
a.cc:24:33: error: 'middlegreat' was not declared in this scope
   24 |                         cout << middlegreat << '\n';
      |                                 ^~~~~~~~~~~
Language: C++

#include<iostream>
using namespace std;
int a[101];
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 n=0;
	cin>>n;
	for(int i=1,i<=n;++i)
	cin>>a[i];
	qqsort(1,n);
	int mid=n/2+1;
	for(int i=1;i<mid;++i)
	cout<<a[mid]<<endl;
	--mid;
	for(int i=mid+1,i<=n;++i)
	cout<<a[mid]<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:22: error: expected ';' before '<=' token
   21 |         for(int i=1,i<=n;++i)
      |                      ^~
      |                      ;
a.cc:21:22: error: expected primary-expression before '<=' token
   21 |         for(int i=1,i<=n;++i)
      |                      ^~
a.cc:28:26: error: expected ';' before '<=' token
   28 |         for(int i=mid+1,i<=n;++i)
      |                          ^~
      |                          ;
a.cc:28:26: error: expected primary-expression before '<=' token
   28 |         for(int i=mid+1,i<=n;++i)
      |                          ^~
Language: C++

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

int main(){
	int n, a;
	vector<int> v;
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> a;
		v.push_back(a);
	}
	for(int j = 0; j < n; j++){
		v.erase(v.begin()+i);
		sort(v.begin(), v.end());
		int len = n-1;
		if(len%2!=0){
			cout << v[len/2] << endl;
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:35: error: 'i' was not declared in this scope
   13 |                 v.erase(v.begin()+i);
      |                                   ^
Language: C++

#include<algorithm>
#include<string.h>
using namespace std;

long int N, m, tmp;
long long unsigned int X[200000], Y[200000];

void show(int N, long long unsigned int array[], int m){
    memcpy(Y, X, sizeof X);
    sort(Y,  Y+N);
    cout << Y[m] << endl;
}

int main(){
    cin >> N;
    m = N/2;
    for(int i = 0; i < N; i++) cin >> X[i];

    for(int i = 0; i < N; i++){
        tmp = X[i];
        X[i] = 0;
        show(N, X, m);
        X[i] = tmp;
    }

    return 0;
}

Compiler output:
a.cc: In function 'void show(int, long long unsigned int*, int)':
a.cc:11:5: error: 'cout' was not declared in this scope
   11 |     cout << Y[m] << endl;
      |     ^~~~
a.cc:3:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include<string.h>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:11:21: error: 'endl' was not declared in this scope
   11 |     cout << Y[m] << endl;
      |                     ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include<string.h>
  +++ |+#include <ostream>
    3 | using namespace std;
a.cc: In function 'int main()':
a.cc:15:5: error: 'cin' was not declared in this scope
   15 |     cin >> N;
      |     ^~~
a.cc:15:5: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

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

int main()
{
    int n,i,j,l,k,w;
    int a[200005];
    int b[200005];
    cin>>n;
    for(i=0; i<n; i++)
        cin>>a[i];
    for(w=1; w<=n; w++)
    {
        for(j=w-1; j<n-1; j++)
            b[j]=a[j+1];
        for(l=0; l<w-1; l++)
            b[l]=a[l];
        sort(b,b+n-1);
        k=(n-2)/2;
        cout<<b[k]<<endl;
    }
}


Compiler output:
a.cc:4:10: fatal error: algorithm>sor: No such file or directory
    4 | #include <algorithm>sort
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<algorithm>

using namespace std;

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

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

	sort(Y, Y + N - 1, greater<int>());
	int middlegreat = Y[N/2];
	int middlelittle = Y[N / 2 + 1];

	for (int i = 1; i <= N, ++i) {
		if (middlegreat > X[i])
			cout << middlegreat << '\n';
		else
			cout << middlelittle << '\n';
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:36: error: expected ';' before ')' token
   11 |         for (int i = 1; i <= N, ++i) {
      |                                    ^
      |                                    ;
a.cc:20:36: error: expected ';' before ')' token
   20 |         for (int i = 1; i <= N, ++i) {
      |                                    ^
      |                                    ;
Language: C++

#include <iostream>
using namespace std;

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

    int x[200100];
    int y[200100];
    int z;
    for ( int i = 0; i < n; i++){
         cin >> z;
         x[i] = z;
         y[i] = z;
    }

    sort(x, x + n);
    int ans1 = x[n / 2 - 1];
    int ans2 = x[n / 2];



    for ( int i = 0; i < n; i++){
        if (y[i] <= ans1) cout << ans2 << endl;
        else cout << ans1 << endl;
    }
}

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

#include <stdio.h>
#include <string.h>
#include <algorithm>
//sort(a, a + N, greater<int>());
//n：数の個数、偶数
int main(void){
	int n,i;
	int *x;
	int center;
	scanf("%d",&n);
	x = new int[n];
	
	scanf("%d",&n);
	for(i = 0; i< n; i++)
		scanf("%d",&x[i]);
	center = (n+1)/2;
	for(i = 0; i < n; i++){
		x[i] = -1;
		sort(x,x+n,greater<int>());
		printf("%d\n",x[center-1]);
	}
	delete x;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:28: error: 'greater' was not declared in this scope
   19 |                 sort(x,x+n,greater<int>());
      |                            ^~~~~~~
a.cc:19:36: error: expected primary-expression before 'int'
   19 |                 sort(x,x+n,greater<int>());
      |                                    ^~~
a.cc:19:17: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   19 |                 sort(x,x+n,greater<int>());
      |                 ^~~~
      |                 std::sort
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:3:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
Language: C++

#include <stdio.h>
#include <string.h>
#include <algorithm>
//sort(a, a + N, greater<int>());
//n：数の個数、偶数
int main(void){
	int n,i;
	int center;
	scanf("%d",&n);
	x = new int[n];
	int x[10];
	
	scanf("%d",&n);
	for(i = 0; i< n; i++)
		scanf("%d",&x[i]);
	center = (n+1)/2;
	for(i = 0; i < n; i++){
		x[i] = -1;
		sort(a,a+n,greater<int>());
		printf("%d\n",x[center-1]);
	}
	delete n;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'x' was not declared in this scope
   10 |         x = new int[n];
      |         ^
a.cc:19:22: error: 'a' was not declared in this scope
   19 |                 sort(a,a+n,greater<int>());
      |                      ^
a.cc:19:28: error: 'greater' was not declared in this scope
   19 |                 sort(a,a+n,greater<int>());
      |                            ^~~~~~~
a.cc:19:36: error: expected primary-expression before 'int'
   19 |                 sort(a,a+n,greater<int>());
      |                                    ^~~
a.cc:19:17: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   19 |                 sort(a,a+n,greater<int>());
      |                 ^~~~
      |                 std::sort
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:3:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
a.cc:22:16: error: type 'int' argument given to 'delete', expected pointer
   22 |         delete n;
      |                ^
Language: C++

#include <stdio.h>
#include <string.h>
#include <algorithm>
//sort(a, a + N, greater<int>());
//n：数の個数、偶数
int main(void){
	int n,i;
	int center;
	scanf("%d",&n);
	//x = new int[n];
	int n[10];
	
	scanf("%d",&n);
	for(i = 0; i< n; i++)
		scanf("%d",&x[i]);
	center = (n+1)/2;
	for(i = 0; i < n; i++){
		x[i] = -1;
		sort(a,a+n,greater<int>());
		printf("%d\n",x[center-1]);
	}
	delete n;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:13: error: conflicting declaration 'int n [10]'
   11 |         int n[10];
      |             ^
a.cc:7:13: note: previous declaration as 'int n'
    7 |         int n,i;
      |             ^
a.cc:15:29: error: 'x' was not declared in this scope
   15 |                 scanf("%d",&x[i]);
      |                             ^
a.cc:18:17: error: 'x' was not declared in this scope
   18 |                 x[i] = -1;
      |                 ^
a.cc:19:22: error: 'a' was not declared in this scope
   19 |                 sort(a,a+n,greater<int>());
      |                      ^
a.cc:19:28: error: 'greater' was not declared in this scope
   19 |                 sort(a,a+n,greater<int>());
      |                            ^~~~~~~
a.cc:19:36: error: expected primary-expression before 'int'
   19 |                 sort(a,a+n,greater<int>());
      |                                    ^~~
a.cc:19:17: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   19 |                 sort(a,a+n,greater<int>());
      |                 ^~~~
      |                 std::sort
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:3:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
a.cc:22:16: error: type 'int' argument given to 'delete', expected pointer
   22 |         delete n;
      |                ^
Language: C++

ll X[200000];
ll Y[200000];
int main() {
	int N; cin >> N;

	rep(i, 0, N) {
		ll a; cin >> a;
		X[i] = a;
		Y[i] = a;
	}

	sort(X, X + N);

	ll ma, mb;
	ma = X[N / 2 - 1];
	mb = X[N / 2];

	rep(i, 0, N) {
		if (Y[i] > ma) cout << ma << endl;
		else if (Y[i] == ma) cout << mb << endl;
		else if (Y[i] < mb) cout << mb << endl;
		else if (Y[i] == mb) cout << ma << endl;
	}
	return 0;
}

Compiler output:
a.cc:1:1: error: 'll' does not name a type
    1 | ll X[200000];
      | ^~
a.cc:2:1: error: 'll' does not name a type
    2 | ll Y[200000];
      | ^~
a.cc: In function 'int main()':
a.cc:4:16: error: 'cin' was not declared in this scope
    4 |         int N; cin >> N;
      |                ^~~
a.cc:6:13: error: 'i' was not declared in this scope
    6 |         rep(i, 0, N) {
      |             ^
a.cc:6:9: error: 'rep' was not declared in this scope
    6 |         rep(i, 0, N) {
      |         ^~~
a.cc:12:14: error: 'X' was not declared in this scope
   12 |         sort(X, X + N);
      |              ^
a.cc:12:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   12 |         sort(X, X + N);
      |         ^~~~
      |         short
a.cc:14:9: error: 'll' was not declared in this scope
   14 |         ll ma, mb;
      |         ^~
a.cc:15:9: error: 'ma' was not declared in this scope
   15 |         ma = X[N / 2 - 1];
      |         ^~
a.cc:16:9: error: 'mb' was not declared in this scope
   16 |         mb = X[N / 2];
      |         ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;

int main() {
	int n;
	
	cin >> n;
	
	ull lm = 0, rm = 0;
	vector<ull> x;
	for(int i=0;i<n;i++){
		ull tmp;
		cin >> tmp;
		v.push_back(tmp);
	}
	sort(v.begin(), v.end());
	lm = v[n/2-1];
	rm = v[n/2];
	for(int i=0;i<n;i++){
		cout << ((v[i]<=lm)?rm:lm) << endl;
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:17: error: 'v' was not declared in this scope
   15 |                 v.push_back(tmp);
      |                 ^
a.cc:17:14: error: 'v' was not declared in this scope
   17 |         sort(v.begin(), v.end());
      |              ^
Language: C++

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

int main() {
  int N;
  int x[N];
  vector<int> X;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> x[i];
  }
  for (int i = 0; i < N; i++) {
    X.push_back(x[i]);
  }
  for (int i = 0; i < N; i++) {
    X[i] = 0;
    X.sort(X.begin(), X.end());
    cout << X[N / 2] << endl;
  }
}


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

#include <iostream>

using namespace std;

int main(){
    int n;
    cin >> n;
    int lmax=0;
    int rmin=0;
    int nums[200000];
    for(int i=0;i<n;i++){
        cin >> nums[i];
    }
    sort(nums,nums+n);
    lmax=nums[n/2-1];
    rmin=nums[n/2];
    for(int i=0;i<n/2;i++){
        cout << rmin << endl;
    }
    for(int i=0;i<n/2;i++){
        cout << lmax << endl;
    }
    return 0;
}

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

#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int n;
  cin>>n;
  int x[n];
  for(int i=0;i<n;i++){
    cin>>x[i];
  }
  int c[n];
  for(int i=0;i<n;i++){
    for(int i=0;i<n;i++){
      c[i]=x[i];
    }
    c[i]=0;
    c.sort();
    cout<<c[n/2]<<endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:7: error: request for member 'sort' in 'c', which is of non-class type 'int [n]'
   17 |     c.sort();
      |       ^~~~
Language: C++

#include <iostream>
#include <cmath>

using namespace std;

int main(){
  int n,m,xt;
  int a[200005],b[200005];
  cin >>n;
  int temp;
  for(int i=0;i < n; ++i){
    cin >> a[i];
    b[i]=a[i];
  }
  sort(b, b+n);
  int low = b[n/2-1], hi =b[n/2];
  for(int i=0;i < n; ++i){
     cout << (a[i] <= low ? hi: low) << endl;
  }
return 0;
}


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

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

int main(){
  int n;
  cin >> n;
  vector<int>X(n);
  vector<int>Xsort(n);
  for(int i=0; i<n; i++){
    cin >> X[i];
  }
  Xsort = X;
  sort(Xsort.begin(), Xsort.end());
  int lmed=Xsort[N/2-1], rmed=Xsort[N/2];
  for(int i=0; i<n; i++){
    if(X[i]<=lmed)cout << rmed << endl;
    if(X[i]>=rmed)cout << lmed << endl;
  }
  return 0;
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:16:18: error: 'N' was not declared in this scope
   16 |   int lmed=Xsort[N/2-1], rmed=Xsort[N/2];
      |                  ^
a.cc:18:27: error: 'rmed' was not declared in this scope; did you mean 'lmed'?
   18 |     if(X[i]<=lmed)cout << rmed << endl;
      |                           ^~~~
      |                           lmed
a.cc:19:14: error: 'rmed' was not declared in this scope; did you mean 'lmed'?
   19 |     if(X[i]>=rmed)cout << lmed << endl;
      |              ^~~~
      |              lmed
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main(int argc, char *argv[]) {
	int N;
	cin >> N;
	vector<int> X(N), Y(N);
	for (int i = 0; i < N; i++) {
		cin >> X[i];
		Y[i] = X[i];
	}

	sort(begin(X), end(X));

	for (int i = 0; i < N; i++) {
		if (Y[i] < X[N/2]) cout << X[N/2] << endl;
		else cout << X[N/2-1] << endl;
	}

	return 0;
}

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

#include<bits/stdc++.h>
#define rep(i,n) for (int i=0; i<n; i++)
#define REP(i,x,n) for (int i=x; i<n; i++)
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
const int mod = 1e9+9;
const int INF = 1e9;

int main(){
    int n;
    cin >> n;
    vi vec(n);
    rep(i,n) cin >> vec[i];

    sort(vec.rbegin(), vec.rend());
    int A_MAX = vec[0];
    double r = (double)A_MAX / 2;
    double res = 1e9;
    int index = ;
    rep(i,n){
        if (fabs(vec[i] - r) < res && A_MAX > vec[i]){
            res = abs(vec[i] - r);
            index = vec[i];
        }
    }
    printf("%d %d\n", A_MAX, index);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:17: error: expected primary-expression before ';' token
   21 |     int index = ;
      |                 ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1e9+7;
#define rep1(i, n) for (ll i=0; i<(n); i++) 
#define rep2(i, k, n) for (ll i=k; i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() {
    ll n;
    cin >> n;
    vector<ll> a(n, 0);
    rep1(i, n) cin >> a[i];
    sort(a.begin(), a.end());
    ll ai = a[a.size()-1];
    ll aj;
    P p = make_pair(INF, 0);
    rep1(i, n-1){
        if (p.first>abs(ai-a[i]*2)){
            p = make_pair(abs(ai-a[i]*2), a[i]);
        }
    }
    ll aj = p.second;
    cout << ai << " " << aj << endl;
    //printf("%.12f", ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:8: error: redeclaration of 'll aj'
   26 |     ll aj = p.second;
      |        ^~
a.cc:19:8: note: 'll aj' previously declared here
   19 |     ll aj;
      |        ^~
Language: C++

//きれいな解説コード
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
using ll = long long;
const int INF = 2147483647;
const ll MOD = 1000000007;
// const ll INF = 1000000000000000000LL;

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    sort(a.begin(),a.end(),greater<ll>());
    ll l = floor(a[0]/2.lf);
    ll r = ceil(a[0]/2.lf);
    int near_i=-1;
    ll nin = INF;
    for(int i=1;i<n;i++){
        if(nin>abs(r-a[i])+abs(l-a[i])){
            nin = abs(r-a[i])+abs(l-a[i]);
            near_i = i;
        }
    }
    cout << a[0] << ' ' << a[near_i] << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:23: error: unable to find numeric literal operator 'operator""lf'
   16 |     ll l = floor(a[0]/2.lf);
      |                       ^~~~
a.cc:17:22: error: unable to find numeric literal operator 'operator""lf'
   17 |     ll r = ceil(a[0]/2.lf);
      |                      ^~~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <sstream>
#include <iomanip>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int iINF = 100100100;
const ll llINF = 1LL << 60;
string s = "";
int Size;
ll chmin(ll a, ll b)
{
	return a > b ? b : a;
}
int main()
{
	int n;
	cin >> n;
	vector<int> v(n);
	rep(i, n)	cin >> v[i];
	sort(v.begin(), v.end());
	int m = v.back();
	int r;
	double min_abs = iINF;
	double cur_abs;
	rep(i, n) {
		cur_abs = fabs(double(m) / 2 - v[i]);
		if (cur_abs < min_abs) {
			min_abs = cur_abs;
			r = v[i];
		}
	}
	cout << m << " " << r << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:27: error: 'fabs' was not declared in this scope; did you mean 'labs'?
   32 |                 cur_abs = fabs(double(m) / 2 - v[i]);
      |                           ^~~~
      |                           labs
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    int a[n];
    for(int i=0;i<n;i++)cin >> a[i];
    sort(a,a+n);
    int ans=a[0];
    for(int i=1;i<n-1;i++)if(abs((double)ans-(double)(a[n-1]*1.0/2)>abs((double)a[i]-(double)(a[n-1]*1.0/2))ans=a[i];
    cout << a[n-1] << " " << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:109: error: expected ')' before 'ans'
   10 |     for(int i=1;i<n-1;i++)if(abs((double)ans-(double)(a[n-1]*1.0/2)>abs((double)a[i]-(double)(a[n-1]*1.0/2))ans=a[i];
      |                                 ~                                                                           ^~~
      |                                                                                                             )
a.cc:10:117: error: expected ')' before ';' token
   10 |     for(int i=1;i<n-1;i++)if(abs((double)ans-(double)(a[n-1]*1.0/2)>abs((double)a[i]-(double)(a[n-1]*1.0/2))ans=a[i];
      |                             ~                                                                                       ^
      |                                                                                                                     )
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin >> n;
    vector<int>a(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a.begin(),a.end());
    cout << a[n-1] << " ";
    int cnt = 1e7;
    int ans = 0;
    for(int i = 0; i < n; i++) {
        if(cnt > abs(a[n-1]/2-a[i])) {
            cnt = abs(a[n-1]/2-a[i]));
            ans = a[i];
        }
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:37: error: expected ';' before ')' token
   16 |             cnt = abs(a[n-1]/2-a[i]));
      |                                     ^
      |                                     ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll, vl/*, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, n) for(ll i = 1; i <= ll(n); i++)
//#define rep(i, k, n) for(ll i = k-1; i < ll(n); i++)
//#define rep2(i, k, n) for(ll i = k; i <= ll(n); i++)
#define all(v) (v).begin(), (v).end()
bool chmin(ll &a, ll b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 1e9;
const char newl = '\n';

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

  ll n;
  cin >> n;
  vl a(n);
  rep(i, n) cin >> a[i];
  ll M=-1;
  rep(i, n) chmax(M, a[i]);
  ll m=INF, num;
  rep(i, n) if(chmin(m, abs(a[j]*2-M))) num=j;
  cout << M << " " << a[num] << newl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:31: error: 'j' was not declared in this scope
   39 |   rep(i, n) if(chmin(m, abs(a[j]*2-M))) num=j;
      |                               ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll, vl/*, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, n) for(ll i = 1; i <= ll(n); i++)
//#define rep(i, k, n) for(ll i = k-1; i < ll(n); i++)
//#define rep2(i, k, n) for(ll i = k; i <= ll(n); i++)
#define all(v) (v).begin(), (v).end()
bool chmin(ld &a, ld b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ld &a, ld b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 1e9;
const char newl = '\n';

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

  ll n;
  cin >> n;
  vector<ld> a(n);
  rep(i, n) cin >> a[i];
  ld M=-1, num;
  rep(i, n) if(chmax(M, a[i])) I=i;
  ld half=M/2, m=M;
  rep(i, n) if(a[num]!=M && chmin(m, abs(a[num]-half))) num=i;
  cout << M << " " << a[num] << newl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:32: error: 'I' was not declared in this scope
   37 |   rep(i, n) if(chmax(M, a[i])) I=i;
      |                                ^
Language: C++

#include <bits/stdc++.h>

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

int main() {
	ll n;
	cin >> n;
	vector<ll> a(n);
	rep(i, n) cin >> a[i];
	int ans1 = 0;
	rep(i, n) {
		if (a[i] > a[ans1]) {
			ans1 = i;
		}
	}
	ll temp = a[ans1] / 2;
	int ans2;
	if(ans1 == 0) ans2 = 1;
	else ans2 = 0;
	if (temp % 2 == 0) {
		rep(i, n) {
			if (i != ans1 && abs(temp - a[i]) < abs(temp - a[ans2])) ans2 = i;
		}
	} else {
		ll temp2 = temp + 1;
		rep(i, n) {
			if (i != ans1 && abs(temp - a[i]) < abs(temp - a[ans2])) ans2 = i;
			if (i != ans1 && abs(temp2 - a[i]) < abs(temp2 - a[ans2])) ans2 = i;
		}
	}
	cout << a[ans1] << " " << a[ans2] << endl;
	return 0;
}

#include <bits/stdc++.h>

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

int main() {
	ll n;
	cin >> n;
	vector<ll> a(n);
	rep(i, n) cin >> a[i];
	int ans1 = 0;
	rep(i, n) {
		if (a[i] > a[ans1]) {
			ans1 = i;
		}
	}
	ll temp = a[ans1] / 2;
	int ans2;
	if(ans1 == 0) ans2 = 1;
	else ans2 = 0;
	if (temp % 2 == 0) {
		rep(i, n) {
			if (i != ans1 && abs(temp - a[i]) < abs(temp - a[ans2])) ans2 = i;
		}
	} else {
		ll temp2 = temp + 1;
		rep(i, n) {
			if (i != ans1 && abs(temp - a[i]) < abs(temp - a[ans2])) ans2 = i;
			if (i != ans1 && abs(temp2 - a[i]) < abs(temp2 - a[ans2])) ans2 = i;
		}
	}
	cout << a[ans1] << " " << a[ans2] << endl;
	return 0;
}



Compiler output:
a.cc:45:5: error: redefinition of 'int main()'
   45 | int main() {
      |     ^~~~
a.cc:8:5: note: 'int main()' previously defined here
    8 | int main() {
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll=long long int;
using ld=long double;
using VI=vector<ll>;
using VD=vector<ld>;
using VVI=vector<VI>;
using VC=vector<char>;
using VVC=vector<VC>;
using VS=vector<string>;
using PLL =pair<ll,ll>;
using PLD=pair<ld,ld>;
using VPLL=vector<PLL>;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element((x).begin(),(x).end())
#define MIN(x) *min_element((x).begin(),(x).end())
#define SORTR(x) sort((x).rbegin(),(x).rend())
#define SORT(x) sort((x).begin(),(x).end())
#define SUM(x) accumulate((x).begin(),(x).end(), 0)
#define FILL(x,a) fill(x.begin(),x.end(),a)
#define EACH(i,x) for(typeof((x).begin()) i=(x).begin(); i!=(x).end(); ++i)
#define COUT(x) cout<<x<<"\n"

const ll INF = 1e18;
const ld EPS   = 1e-10;
const int MOD  = int(1e9)+7;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template <class BidirectionalIterator>
bool next_partial_permutation(BidirectionalIterator first, BidirectionalIterator middle,BidirectionalIterator last){reverse(middle, last); return next_permutation(first , last);}
ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll GCD(VI v){ll a = v[0]; for (ll i = 1; i<SIZE(v); i++) {a = gcd(a, v[i]);} return a;}
ll LCM(VI v){ll a = v[0]; for (ll i = 1; i<SIZE(v); i++) {a = lcm(a, v[i]);} return a;}


void Main()
{
	ll N;
	ll res=INF;
	string sres;
	cin>>N;
	VI A(N);
	REP(i, N) cin >> A[i];
	SORTR(A);
	ll maxi=A[0];
	ld mid=maxi*0.5;
	ll par=0;
	REP(i,N){
		ld tmp=pow(A[i]-mid,2);
		bool change=chmin(res,tmp);
		if(change){
			par=i;
		}
	}
	COUT(maxi<<" "<<par);
	return;
}

int main()
{
	std::cin.tie(0);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}


Compiler output:
a.cc: In function 'void Main()':
a.cc:55:34: error: no matching function for call to 'chmin(ll&, ld&)'
   55 |                 bool change=chmin(res,tmp);
      |                             ~~~~~^~~~~~~~~
a.cc:32:23: note: candidate: 'template<class T> bool chmin(T&, const T&)'
   32 | template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
      |                       ^~~~~
a.cc:32:23: note:   template argument deduction/substitution failed:
a.cc:55:34: note:   deduced conflicting types for parameter 'const T' ('long long int' and 'ld' {aka 'long double'})
   55 |                 bool change=chmin(res,tmp);
      |                             ~~~~~^~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll=long long int;
using ld=long double;
using VI=vector<ll>;
using VD=vector<ld>;
using VVI=vector<VI>;
using VC=vector<char>;
using VVC=vector<VC>;
using VS=vector<string>;
using PLL =pair<ll,ll>;
using PLD=pair<ld,ld>;
using VPLL=vector<PLL>;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element((x).begin(),(x).end())
#define MIN(x) *min_element((x).begin(),(x).end())
#define SORTR(x) sort((x).rbegin(),(x).rend())
#define SORT(x) sort((x).begin(),(x).end())
#define SUM(x) accumulate((x).begin(),(x).end(), 0)
#define FILL(x,a) fill(x.begin(),x.end(),a)
#define EACH(i,x) for(typeof((x).begin()) i=(x).begin(); i!=(x).end(); ++i)
#define COUT(x) cout<<x<<"\n"

const ll INF = 1e18;
const ld EPS   = 1e-10;
const int MOD  = int(1e9)+7;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template <class BidirectionalIterator>
bool next_partial_permutation(BidirectionalIterator first, BidirectionalIterator middle,BidirectionalIterator last){reverse(middle, last); return next_permutation(first , last);}
ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll GCD(VI v){ll a = v[0]; for (ll i = 1; i<SIZE(v); i++) {a = gcd(a, v[i]);} return a;}
ll LCM(VI v){ll a = v[0]; for (ll i = 1; i<SIZE(v); i++) {a = lcm(a, v[i]);} return a;}


void Main()
{
	ll N;
	ll res=INF;
	string sres;
	cin>>N;
	VI A(N);
	REP(i, N) cin >> A[i];
	SORTR(A);
	ll maxi=A[0];
	ld mid=maxi*0.5;
	ll par=0;
	REP(i,N){
		ld tmp=pow(A[i]-mid,2);
		bool change=chmin(res,tmp);
		if(change){
			par=i;
		}
	}
	COUT(maxi" "<<par);
	return;
}

int main()
{
	std::cin.tie(0);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}


Compiler output:
a.cc: In function 'void Main()':
a.cc:55:34: error: no matching function for call to 'chmin(ll&, ld&)'
   55 |                 bool change=chmin(res,tmp);
      |                             ~~~~~^~~~~~~~~
a.cc:32:23: note: candidate: 'template<class T> bool chmin(T&, const T&)'
   32 | template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
      |                       ^~~~~
a.cc:32:23: note:   template argument deduction/substitution failed:
a.cc:55:34: note:   deduced conflicting types for parameter 'const T' ('long long int' and 'ld' {aka 'long double'})
   55 |                 bool change=chmin(res,tmp);
      |                             ~~~~~^~~~~~~~~
a.cc:60:18: error: expected ';' before string constant
   60 |         COUT(maxi" "<<par);
      |                  ^~~
a.cc:26:23: note: in definition of macro 'COUT'
   26 | #define COUT(x) cout<<x<<"\n"
      |                       ^
Language: C++

#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>

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

int a[212345];

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


Compiler output:
a.cc: In function 'int main()':
a.cc:25:5: error: 'cin' was not declared in this scope
   25 |     cin >> n;
      |     ^~~
a.cc:14:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
   13 | #include <iomanip>
  +++ |+#include <iostream>
   14 | 
a.cc:39:5: error: 'cout' was not declared in this scope
   39 |     cout << a[n-1] << " " << ans << endl;
      |     ^~~~
a.cc:39:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>

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

int a[212345];

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


Compiler output:
a.cc: In function 'int main()':
a.cc:23:15: error: 'sync_with_studio' is not a member of 'std::ios' {aka 'std::basic_ios<char>'}
   23 |     std::ios::sync_with_studio(false);
      |               ^~~~~~~~~~~~~~~~
a.cc:25:5: error: 'cin' was not declared in this scope
   25 |     cin >> n;
      |     ^~~
a.cc:14:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
   13 | #include <iomanip>
  +++ |+#include <iostream>
   14 | 
a.cc:39:5: error: 'cout' was not declared in this scope
   39 |     cout << a[n-1] << " " << ans << endl;
      |     ^~~~
a.cc:39:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'