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

#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <functional>
#include <limits>
#include <cstdlib>
#include <cassert>
#include <iostream>
#include <boost/foreach.hpp>
using namespace std;

int main() {
	int N;
    vector<int> dif(N+1);
    int ans = 0;
	cin >> N;
	for (int i = 0; i < N; i++) cin >> dif[i];
    std::sort(&dif0],&dif[N]);
    ans = dif[N/2] - dif[N/2 - 1];
	cout << ans << endl;
    return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,count=0;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  int m=n/2;
  sort(a.began(), a.end());

    cout<<a[m-1]-a[m]<<endl;
  return 0;
}

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

#include <bits/stdc++.h>
using namespace std;typedef long long ll;typedef string str;
typedef vector<str> vst;typedef vector<ll> vll;
ll mod = 1000000007, INF = 10000000000000000;
ll gcd(ll a, ll b){if(b==0){return a;}return gcd(b, a%b);}
ll fac[200100];
ll inv[200100];
ll facinv[200100];
void C_init(){
    fac[0] = 1;
    for(int i = 1;i < 200100;i++)fac[i] = (fac[i-1] * i)%mod;
    inv[1] = 1;
    for(int i = 2;i < 200100;i++)inv[i] = ((-(mod/i)*inv[mod%i])%mod+mod)%mod;
    facinv[0] = 1;
    for(int i = 1;i < 200100;i++)facinv[i] = (facinv[i-1] * inv[i])%mod;
    return;
}
ll nCr(ll n, ll r){
    return max((ll)0,((fac[n] * facinv[n-r])%mod * facinv[r])%mod);
}
// for (ll i = 0; i < n; i++) {
// sort(.begin(),.end());

int main(){
  ll n,k,i,j;
  cin>>n>>k;
  
  C_init();
  
  for(i=0;i<k;i++){
    if(n-k>i){
	cout<<(nCr(k-1,i)*(nCr(n-k-1,i+1)+2*nCr(n-k-1,i)%mod+nCr(n-k-1,i-1))%mod)%mod<<endl;
    }else if(n-k==i){
	cout<<(nCr(k-1,i)*((nCr(n-k-1,i-1)+(2*nCr(n-k-1,i))%mod)%mod))%mod<<endl;
    }else{
      cout<<(nCr(k-1,i)*nCr(n-k-1,i-1))%mod<<endl;
   
  }
}

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

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

int asc(const void *d, const void *b) {
  return *(int *)d - *(int *)b;
}

int main(){
  int n;
  scanf("%d",&n);
  if(n%2!=0 || n<2 || n>100000){
    return 0;
  }

  int d[n];
  int i,j;
  int tmp;

  for(i=0;i<n;i++){
    scanf("%d",&d[i]);
    if(d[i]<1 || d[i]>100000){
      return 0;
    }
  }

  void qsort(
  d, sizeof(n), sizeof(int),
  asc);
  int a = d[n/2] - d[n/2-1];

  printf("%d\n",a);

  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:27:5: error: expected ')' before 'sizeof'
   27 |   d, sizeof(n), sizeof(int),
      |     ^~~~~~~
      |     )
Language: C

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

int main(){
  int n;
  scanf("%d",&n);
  if(n%2!=0 || n<2 || n>100000){
    return 0;
  }

  int d[n];
  int i,j;
  int tmp;

  for(i=0;i<n;i++){
    scanf("%d",&d[i]);
    if(d[i]<1 || d[i]>100000){
      return 0;
    }
  }

  void qsort(
  d, sizeof(n), sizeof(int),
  asc);
  int a = d[n/2] - d[n/2-1];

  printf("%d\n",a);

  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:23:5: error: expected ')' before 'sizeof'
   23 |   d, sizeof(n), sizeof(int),
      |     ^~~~~~~
      |     )
Language: C++

#include <stdio.h>

int main()
{
	int d[100000];
	int	i = 0,j=0, r=0, b=0,a=0;
	float N=0, K, max = 0;
	scanf("%f", &N);
	for (i = 0; i < N; i++)
	{
		scanf_s("%d", &d[i]);
		if (max < d[i])
		{
			max = d[i];
		}
	}
	for (K = 2; K < max; K++)
	{
		r = 0;
		b = 0;
		for (j = 0; j < N; j++)
		{
			if (d[j] >= K)
			{
				r = r + 1;
			}
			else
			{
				b = b + 1;
			}
		}
		if (r == b)
		{
			a = a + 1;
		}
	}
	printf("%d", a);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   11 |                 scanf_s("%d", &d[i]);
      |                 ^~~~~~~
      |                 scanf
Language: C

#include<stdio.h>
#include<string.h>
int main(){
  int n;
  scanf("%d",&n);
  int d[n];
  for (int i=0;i<n;i++){
    scanf("%d",&d[i]);
  }
  
  for (int i=0; i<n; i++) {
    for (int j=i+1; j<n; j++) {
      if (d[i] > d[j]) {
        int tmp =  d[i];
        d[i] = d[j];
        d[j] = tmp;
      }
    }

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

#include <iostream>
#include <vector>
#include <algolithm>
using namespace std;
#define REP(i, n)   for(int i = 0; i < (int)(n); i++)
#define MAX_N   100000

void solve(){

}

int main (){
    int n;
    cin >> n;
    int d[n];
    REP(i, n)
        cin >> d[i];
    sort(d, d + n - 1);
    if(n % 2)
        cout << 0 << endl;
    else{
        cout << d[n / 2] - d[n / 2 - 1] << endl;
    }
    
    return 0;
}

Compiler output:
a.cc:3:10: fatal error: algolithm: No such file or directory
    3 | #include <algolithm>
      |          ^~~~~~~~~~~
compilation terminated.
Language: Java

import java.util.Scanner;
public class mergeSort {

    public static void sort(int[] array, int low, int high){
        if(low < high){
            int middle = (low + high) >>> 1;
            mergeSort.sort(array, low , middle);
            mergeSort.sort(array, middle+1, high);
            mergeSort.merge(array, low, middle, high);
        }

    }
    public static void merge(int[] array, int low, int middle, int high){
        int[] helper = new int[array.length];

        for (int i = low; i <= high; i++){
            helper[i] = array[i];
        }
        int helperLeft = low;
        int helperRight = middle + 1;
        int current = low;

        while (helperLeft <= middle && helperRight <= high){
            if (helper[helperLeft] <= helper[helperRight]){
                array[current] = helper[helperLeft];
                helperLeft ++;
            }
            else {
                array[current] = helper[helperRight];
                helperRight ++;

            }
            current ++;
        }
        int remaining = middle - helperLeft;
        for (int i = 0; i <= remaining; i++){
            array[current + i] = helper[helperLeft + i];
        }



    }

 
}

public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int n = sc.nextInt();
   int[] p = new int[n];
   for(int i = 0; i<n ; i++){
   p[i] = sc.nextInt();
   }
   int K = 0;
   mergeSort.sort( p,0, p.length-1);
   K = p[(N/2)] - p[(N/2)-1];
  System.out.println(K);   
 }
}

Compiler output:
Main.java:2: error: class mergeSort is public, should be declared in a file named mergeSort.java
public class mergeSort {
       ^
Main.java:57: error: cannot find symbol
   K = p[(N/2)] - p[(N/2)-1];
          ^
  symbol:   variable N
  location: class Main
Main.java:57: error: cannot find symbol
   K = p[(N/2)] - p[(N/2)-1];
                     ^
  symbol:   variable N
  location: class Main
3 errors
Language: C++

#include <iostream>
#include <vector>


using namespace std;

int main() {
  vector<int> v;
  int n;
  int m;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> m;
    v.push_back(m);
  }

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

  int s = n/2;
  cout << v[s] - v[s-1] << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   17 |   sort(v.begin(),v.end());
      |   ^~~~
      |   short
Language: Java

public class mergeSort {

    public static void sort(int[] array, int low, int high){
        if(low < high){
            int middle = (low + high) >>> 1;
            mergeSort.sort(array, low , middle);
            mergeSort.sort(array, middle+1, high);
            mergeSort.merge(array, low, middle, high);
        }

    }
    public static void merge(int[] array, int low, int middle, int high){
        int[] helper = new int[array.length];

        for (int i = low; i <= high; i++){
            helper[i] = array[i];
        }
        int helperLeft = low;
        int helperRight = middle + 1;
        int current = low;

        while (helperLeft <= middle && helperRight <= high){
            if (helper[helperLeft] <= helper[helperRight]){
                array[current] = helper[helperLeft];
                helperLeft ++;
            }
            else {
                array[current] = helper[helperRight];
                helperRight ++;

            }
            current ++;
        }
        int remaining = middle - helperLeft;
        for (int i = 0; i <= remaining; i++){
            array[current + i] = helper[helperLeft + i];
        }



    }

 
}
import java.util.Scanner;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int n = sc.nextInt();
   int[] p = new int[n];
   for(int i = 0; i<n ; i++){
   p[i] = sc.nextInt();
   }
   int K = 0;
   mergeSort.sort( p,0, p.length-1);
   K = p[(N/2)] - p[(N/2)-1];
  System.out.println(K);   
 }
}

Compiler output:
Main.java:45: error: class, interface, enum, or record expected
import java.util.Scanner;
^
1 error
Language: C

#include<stdio.h>
#include<stdlib.H>

int count=0;

void mergeSort(int A[],int left,int right){
  int i,mid;
  if(left+1<right){
    mid=(left+right)/2;
    mergeSort(A,left,mid);
    mergeSort(A,mid,right);
    merge(A,left,mid,right);
  }
}



void merge(int A[],int left,int mid,int right){
  int n1,n2,i,j,k;
  int *L,*R;
  n1=mid-left;
  n2=right-mid;
  L=(int *)malloc(sizeof(int)*(n1+1));
  R=(int *)malloc(sizeof(int)*(n2+1));
  for(i=0;i<=n1-1;i++){
    L[i]=A[left+i];
  }
  for(j=0;j<=n2-1;j++){
    R[j]=A[mid+j];
  }
  L[n1]=1000000000;
  R[n2]=1000000000;
  i=0;
  j=0;
  for(k=left;k<=right-1;k++){
   if(L[i]<=R[j]){
      A[k]=L[i];
      i++;
      count++;
    }
    else{
      A[k]=R[j];
      j++;
      count++;
    }
  }
  free(L);
  free(R);
}

int main(){

    int N;
    scanf("%d", &N);

    int d[N];
    for (int i = 0; i < N; i++){
        scanf("%d", &d[i]);
    }

    mergeSort(d, 0, N);

    int ans = 0;

    if(d[N/2 - 1] != d[N/2]){
        ans = d[N / 2] - d[N / 2 - 1];
    }

    printf("%d", ans);

    return 0;
}

Compiler output:
main.c:2:9: fatal error: stdlib.H: No such file or directory
    2 | #include<stdlib.H>
      |         ^~~~~~~~~~
compilation terminated.
Language: Java

public class mergeSort {

    public static void sort(int[] array, int low, int high){
        if(low < high){
            int middle = (low + high) >>> 1;
            mergeSort.sort(array, low , middle);
            mergeSort.sort(array, middle+1, high);
            mergeSort.merge(array, low, middle, high);
        }

    }
    public static void merge(int[] array, int low, int middle, int high){
        int[] helper = new int[array.length];

        for (int i = low; i <= high; i++){
            helper[i] = array[i];
        }
        int helperLeft = low;
        int helperRight = middle + 1;
        int current = low;

        while (helperLeft <= middle && helperRight <= high){
            if (helper[helperLeft] <= helper[helperRight]){
                array[current] = helper[helperLeft];
                helperLeft ++;
            }
            else {
                array[current] = helper[helperRight];
                helperRight ++;

            }
            current ++;
        }
        int remaining = middle - helperLeft;
        for (int i = 0; i <= remaining; i++){
            array[current + i] = helper[helperLeft + i];
        }



    }

 
}
import java.util.Scanner;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int n = sc.nextInt();
   int[] p = new int[n];
   for(int i = 0; i<n ; i++){
   p[i] = sc.nextInt();
   }
   int K = 0;
 　mergeSort.sort(p,0,p.length-1);
   K = p[(N/2)] - p[(N/2)-1]
  System.out.println(K);   
 }
}

Compiler output:
Main.java:45: error: class, interface, enum, or record expected
import java.util.Scanner;
^
Main.java:55: error: illegal character: '\u3000'
 ?mergeSort.sort(p,0,p.length-1);
 ^
Main.java:56: error: ';' expected
   K = p[(N/2)] - p[(N/2)-1]
                            ^
3 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a;
  cin>>a
  vector<int> b(a);
    for(int i=0;i<a;i++)
      cin>>b.at(i);
  sort(b.begin(), b.end());
  if(a%2==0){
    if(b.at(a/2-1)==b.at(a/2))
       cout<<0;
      else
       cout<<b.at(a/2)-b.at(a/2-1)+1;
    }
  if(a%2==1){
    cout<<0;
    }
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: expected ';' before 'vector'
    6 |   cin>>a
      |         ^
      |         ;
    7 |   vector<int> b(a);
      |   ~~~~~~ 
a.cc:9:12: error: 'b' was not declared in this scope
    9 |       cin>>b.at(i);
      |            ^
a.cc:10:8: error: 'b' was not declared in this scope
   10 |   sort(b.begin(), b.end());
      |        ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a;
  vector<int> b(a);
    for(int i=0;i<a;i++)
      cin>>b.at(i);
  sort(b.begin(), b.end());
  if(a%2==0){
    if(b.at(a/2-1)==b.at(a/2))
       cout<<0
      else
       cout<<b.at(a/2)-b.at(a/2-1)+1;
    }
  if(a%2==1){
    cout<<0;
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:12:15: error: expected ';' before 'else'
   12 |        cout<<0
      |               ^
      |               ;
   13 |       else
      |       ~~~~     
a.cc:18:6: error: expected '}' at end of input
   18 |     }
      |      ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a;
  vector<int> b(a);
    for(int i=0;i<a;i++)
      cin>>b.at(i);
  sort(b.begin(), b.end());
  if(a%2=0){
    if(b.at(a/2-1)==b.at(a/2))
       cout<<0
      else
       cout<<b.at(a/2)-b.at(a/2-1)+1;
    }
  if(a%2=1){
    cout<<0;
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:10:7: error: lvalue required as left operand of assignment
   10 |   if(a%2=0){
      |      ~^~
a.cc:12:15: error: expected ';' before 'else'
   12 |        cout<<0
      |               ^
      |               ;
   13 |       else
      |       ~~~~     
a.cc:16:7: error: lvalue required as left operand of assignment
   16 |   if(a%2=1){
      |      ~^~
a.cc:18:6: error: expected '}' at end of input
   18 |     }
      |      ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

int main() {

	int n;
	int max = 0;

	//vector<int> sort(3);
	int count = 0;
	int bunkatu;

	cin >> n;
	vector<int> d(n);
	for (int i = 0; i < n; i++) {
		cin >> d.at(i);
	}

	//for (int i = 0; i < n; i++) {
	//	if (d.at(i) > max) {
	//		max = d.at(i);
	//	}
	//}

	std::sort(d.begin(), d.end());

	//max = d.at(n);

	bunkatu = n / 2;


	/*d.at(bunkatu)- d.at(bunkatu+1) >= k)*/
		//sort.at(0) = S.at(i);
		//sort.at(1) = S.at(i+1);
		//sort.at(2) = S.at(i+2);

		////for (int j = i; j < 3; j++) {
		//	std::sort(sort.begin(), sort.end());
		//	if (sort.at(1) == S.at(i + 1)) count++;
		////}

	if (d.at(bunkatu) != d.at(bunkatu - 1)) {
		cout << d.at(bunkatu) - d.at(bunkatu - 1) << endl;
	}
	else {
		cout << 0 << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'cin' was not declared in this scope
   10 |         cin >> n;
      |         ^~~
a.cc:11:9: error: 'vector' was not declared in this scope
   11 |         vector<int> d(n);
      |         ^~~~~~
a.cc:11:16: error: expected primary-expression before 'int'
   11 |         vector<int> d(n);
      |                ^~~
a.cc:13:24: error: 'd' was not declared in this scope
   13 |                 cin >> d.at(i);
      |                        ^
a.cc:22:14: error: 'sort' is not a member of 'std'
   22 |         std::sort(d.begin(), d.end());
      |              ^~~~
a.cc:22:19: error: 'd' was not declared in this scope
   22 |         std::sort(d.begin(), d.end());
      |                   ^
a.cc:40:17: error: 'cout' was not declared in this scope; did you mean 'count'?
   40 |                 cout << d.at(bunkatu) - d.at(bunkatu - 1) << endl;
      |                 ^~~~
      |                 count
a.cc:40:62: error: 'endl' was not declared in this scope
   40 |                 cout << d.at(bunkatu) - d.at(bunkatu - 1) << endl;
      |                                                              ^~~~
a.cc:43:17: error: 'cout' was not declared in this scope; did you mean 'count'?
   43 |                 cout << 0 << endl;
      |                 ^~~~
      |                 count
a.cc:43:30: error: 'endl' was not declared in this scope
   43 |                 cout << 0 << endl;
      |                              ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std ;
#define rep(i,n) for(int i =0;i<n;i++)
const int maxN=100000;
int a[maxN];
int main(){
    int n,count=0;
	cin>>n;
	rep(i,n)
	{cin>>a[i];
	}
	sort(a,a+n);
	ans=a[n/2]-a[(n/2)-1];
	cout<<ans<<endl;
	return 0;	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   13 |         ans=a[n/2]-a[(n/2)-1];
      |         ^~~
      |         abs
Language: C++

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

int main()
{
		int n;
		int count = 0;

		cin >> n;

		vector<int> d(n);

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

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

		if ((n / 2) - 2 == (n / 2) - 1 || n / 2 == (n / 2) - 1)
		{
			cout << 0 << endl;
			break;
		}
		else
		{
			count = d[n / 2] - d[(n / 2) - 1];
		}

		cout << count << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:25: error: break statement not within loop or switch
   25 |                         break;
      |                         ^~~~~
Language: C++

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

int main(int argc, const char * argv[]) {
    int n;
    cin >> n;
    
    vector<int> p;
    for (int i = 0; i < n; i++) {
        int t;
        cin >> t;
        p.push_back(t);
    }
    
    sort(p.begin(), p.end());
    
    
    int a = 0;
    for (int i = 0; i < p.size(); i++) {
        int K = p[i];
        int ARC = 0;
        int ABC = 0;
        for (int i = 0; i < p.size(); i++) {
            if (p[i] >= K) {
                ARC++;
            }else {
                ABC++;
            }
        }
        
        if (ARC == ABC) {
            a = i;
            break;
        }
    }
    
    if (a == 0) {
        cout << a << endl;
        return 0;
    }
    
    cout << p[a] - p[a-1] << endl;
    
    return 0;
}

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

#include <iostream>
#include <array>

int main()
{
    int N;
    std::cin>>N;
    std::array<int, 100000>d;
    for(int a=0; a<N; ++a){
        std::cin>>d.at(a);
    }
    
    int b=0;
    for (int K=0; K<100000; ++K){
        int d=0;
        for (int c=0; c<N; ++c){
            if (d.at(c)==0){
                break;
            } else if (d.at(c)<K){
                ++d;
            }
        }
        if (d==N/2){
            ++b;
        }
    }

    std::cout<<b<<std::endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:19: error: request for member 'at' in 'd', which is of non-class type 'int'
   17 |             if (d.at(c)==0){
      |                   ^~
a.cc:19:26: error: request for member 'at' in 'd', which is of non-class type 'int'
   19 |             } else if (d.at(c)<K){
      |                          ^~
Language: C

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

int main(){
    int N;
    cin>>N;
    vector<int> Q(N);
    for(int i=0;i<N;i++)cin>>Q[i];
    sort(Q.begin(), Q.end());
    cout<<Q[N/2]-Q[N/2-1];
    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<stdio.h>
#include<stdlib.h>
int asc(const void *a, const void *b) {
  return *(int *)a - *(int *)b;
}
int main(){
    int N;
    scanf("%d",&N);
    int d[100000];
    int i;
   // int *d;
	//d=(int*)malloc((N+1)*sizeof(int));
    for(i=0;i<N;i++){
        scanf("%d",&d[i]);
    }
    qsort(d,sizeof(d),sizeof(int),sizeof(int),asc);
    //merge_sort(d,1,N);
    // for(i=1;i<=N;i++){
      // printf("%d ",d[i]);
    //}
    int K;
    if(d[N/2+1]!=d[N/2+2]){
        K=d[N/2+2]-d[N/2+1];
    }
    else {
        K=0;
    }
    printf("%d\n",K);
   // free(d);
    return 0;
}



Compiler output:
main.c: In function 'main':
main.c:16:35: error: passing argument 4 of 'qsort' makes pointer from integer without a cast [-Wint-conversion]
   16 |     qsort(d,sizeof(d),sizeof(int),sizeof(int),asc);
      |                                   ^~~~~~~~~~~
      |                                   |
      |                                   long unsigned int
In file included from main.c:2:
/usr/include/stdlib.h:971:34: note: expected '__compar_fn_t' {aka 'int (*)(const void *, const void *)'} but argument is of type 'long unsigned int'
  971 |                    __compar_fn_t __compar) __nonnull ((1, 4));
      |                    ~~~~~~~~~~~~~~^~~~~~~~
main.c:16:5: error: too many arguments to function 'qsort'
   16 |     qsort(d,sizeof(d),sizeof(int),sizeof(int),asc);
      |     ^~~~~
/usr/include/stdlib.h:970:13: note: declared here
  970 | extern void qsort (void *__base, size_t __nmemb, size_t __size,
      |             ^~~~~
Language: C++

#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(void){
    int count = 0;
    int N, tmp;

    cin >> N;
    vector<int> d;
    for(int i=0;i<N;i++){
        cin >> tmp;
        d.push_back(tmp);
    }
    std::sort(d.begin(), d.end());
    for(int i=1; i<10001; i++){
        if(d[N/2-1] < i && d[N/2] >= i){
            count++;
        }
    }
    if(d[N/2-1] == d[N/2]) count = 0;

    cout << count << endl;
}

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

#include <iostream>
#include <vector>

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> v;
  for (int i = 0; i < n; i++) {
    int input;
    cin >> input;
    v.push_back(input);
  }
  sort(v.begin(), v.end());
  int center_upper_index = v.size() / 2;
  int center_upper = v[center_upper_index];
  // cout << "center_upper: " << center_upper << "\n";
  int center_lower_index = center_upper_index - 1;
  int center_lower = v[center_lower_index];
  // cout << "center_lower: " << center_lower << "\n";
  int counter = center_upper - center_lower;
  cout << counter;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   15 |   sort(v.begin(), v.end());
      |   ^~~~
      |   short
Language: Java

import java.util.Arrays;
import java.util.Scanner;
public class Wain {
	public static void main(String[] args) {		
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int len=n/2;
		int p[]=new int[n];
		int cnt=0;
		for(int i=0;i<n;i++) {p[i]=sc.nextInt();}	
		Arrays.sort(p);	
		if(p[len]>p[len-1])System.out.println(p[len]-p[len-1]);
		else System.out.println(0);
	}
}

Compiler output:
Main.java:3: error: class Wain is public, should be declared in a file named Wain.java
public class Wain {
       ^
1 error
Language: Java

import java.util.Arrays;
import java.util.Scanner;
public class ac132a {
	public static void main(String[] args) {		
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int len=n/2;
		int p[]=new int[n];
		int cnt=0;
		for(int i=0;i<n;i++) {p[i]=sc.nextInt();}	
		Arrays.sort(p);	
		if(p[len]>p[len-1])System.out.println(p[len]-p[len-1]);
		else System.out.println(0);
	}
}

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

#include <iostream>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <algorithm>
#include <set>

using namespace std;

using ll = long long;

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, res = 0;
	cin >> n;
	vector<int> d(n);
	for (int i = 0; i < n; ++i) {
		cin >> d[i];
	}
	sort(d.begin(), d.end());
	cout << d[n / 2] - d[n / 2 - 1];
	//system("pause");
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:9: error: 'vector' was not declared in this scope
   18 |         vector<int> d(n);
      |         ^~~~~~
a.cc:8:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    7 | #include <set>
  +++ |+#include <vector>
    8 | 
a.cc:18:16: error: expected primary-expression before 'int'
   18 |         vector<int> d(n);
      |                ^~~
a.cc:20:24: error: 'd' was not declared in this scope
   20 |                 cin >> d[i];
      |                        ^
a.cc:22:14: error: 'd' was not declared in this scope
   22 |         sort(d.begin(), d.end());
      |              ^
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main() {
    size_t N;
    cin >> N;
    vector<int> d;
    d.resize(N);
    for (int i = 0; i < N; ++i) {
        cin >> d[i];
    }
    sort(d.begin(), d.end());
    int left = N / 2 - 1, right = N / 2;
    if (d[right] - d[left] > 0) cout << d[right] - d[left] << endl;
    else cout << 0 << endl;
}


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(d.begin(), d.end());
      |     ^~~~
      |     short
Language: C++

#include<iostream>
#include <boost/foreach.hpp>
#include<vector>
using namespace std;
int main()
{
  int N; // 2 <= N <= 10^5, even number
  cin >> N;
  vector<int> d;
  int temp;
  for (int i = 0; i < N; i++) {
    cin >> temp;
    d.push_back(temp);
  }
  //classify d[i] >= K or d[i] < K
  //subtract d's N/2 and N/2-1 factor d[N/2]-d[N/2-1]
  std::sort(d.begin(), d.end());
  cout << d[N/2] - d[N/2 - 1] << endl;
  return 0;
}


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

#include <iostream>

using namespace std;

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

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


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


int main() {
  int n;
  cin >> n;
  //int d[n];
  vector<int> d;
  int cnt = 0;
  int a;
  for (int i = 0; i < n; i++) {
    cin >> a;
    d.push_back(a);
  }
  //mergeSort(d, n, 0, n);
  sort(d.begin(), d.end());


  int mid = -1 + (d.size() / 2) ;
  cnt = d[mid + 1] - d[mid];
  cout << cnt << endl;

  return 0;
}


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

#include<iostream>
#include <boost/foreach.hpp>
#include<vector>
using namespace std;
int main()
{
  int N; // 2 <= N <= 10^5, even number
  cin >> N;
  vector<int> d;
  int temp;
  for (int i = 0; i < N; i++) {
    cin >> temp;
    d.push_back(temp);
  }
  //classify d[i] >= K or d[i] < K
  //subtract d's N/2 and N/2-1 factor d[N/2]-d[N/2-1]
  sort(d.begin(), d.end());
  cout << d[N/2] - d[N/2 - 1] << endl;
  return 0;
}


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

#include<stdio.h>
 
int main(void)
{
  int N = 0;
  scanf("%d", &N);
  
  int d[100000]; //10^5
  for(int i = 0; i < N; i++)
  {
    scanf("%d", &d[i]);
  }
  
  int tmp = 0;
  for(int i = 0; i < N; i++)
  {
    for(j = i+1; j < N; j++)
    {
      if( d[i] > d[j] )
      {
        tmp = d[i];
      	d[i] = d[j];
      	d[j] = tmp;
      }
    }
  }
  
  printf("%d", d[N/2 + 1] - d[N/2] );
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:9: error: 'j' was not declared in this scope
   17 |     for(j = i+1; j < N; j++)
      |         ^
Language: C++

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

typedef long value_type; /* ソートするキーの型 */

/* x, y, z の中間値を返す */
value_type med3(value_type x, value_type y, value_type z) {
  if (x < y) {
    if (y < z) return y; else if (z < x) return x; else return z;
  } else {
    if (z < y) return y; else if (x < z) return x; else return z;
  }
}

/* クイックソート
     * a     : ソートする配列
     * left  : ソートするデータの開始位置
     * right : ソートするデータの終了位置
     */
void quicksort(value_type a[], long left, long right) {
  if (left < right) {
    long i = left, j = right;
    value_type tmp, pivot = med3(a[i], a[i + (j - i) / 2], a[j]); /* (i+j)/2 ではオーバーフローしてしまう */
    while (1) { /* a[] を pivot 以上と以下の集まりに分割する */
      while (a[i] < pivot) i++; /* a[i] >= pivot となる位置を検索 */
      while (pivot < a[j]) j--; /* a[j] <= pivot となる位置を検索 */
      if (i >= j) break;
      tmp = a[i]; a[i] = a[j]; a[j] = tmp; /* a[i], a[j] を交換 */
      i++; j--;
    }
    quicksort(a, left, i - 1);  /* 分割した左を再帰的にソート */
    quicksort(a, j + 1, right); /* 分割した右を再帰的にソート */
  }
}

int main(){

  long N; cin >> N;
  long *d;
  d = (long *)malloc(N * sizeof(long));
  for(long i=0; i<N; i++) cin >> d[i];
  quicksort(&d, 0, N-1);
  cout << d[N/2 - 1] - d[N/2 + 1] << endl;
  return 0; 

}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:13: error: cannot convert 'long int**' to 'value_type*' {aka 'long int*'}
   43 |   quicksort(&d, 0, N-1);
      |             ^~
      |             |
      |             long int**
a.cc:21:27: note:   initializing argument 1 of 'void quicksort(value_type*, long int, long int)'
   21 | void quicksort(value_type a[], long left, long right) {
      |                ~~~~~~~~~~~^~~
Language: C++

#include<stdio.h>
 
int main(void)
{
  int N = 0;
  scanf("%d", &N);
  
  int d[100000]; //10^5
  for(int i = 0; i < N; i++)
  {
    scanf("%d", &d[i]);
  }
  
  int tmp = 0;
  for(int i = 0; i < N; i++)
  {
    for(j = i+1; j < N; j++)
    {
      if( d[i] > d[j] )
      {
        tmp = d[i];
      	d[i] = d[j];
      	d[j] = tmp;
      }
    }
  }
  
  print("%d", d[N/2 + 1] - d[N/2] );
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:9: error: 'j' was not declared in this scope
   17 |     for(j = i+1; j < N; j++)
      |         ^
a.cc:28:3: error: 'print' was not declared in this scope; did you mean 'printf'?
   28 |   print("%d", d[N/2 + 1] - d[N/2] );
      |   ^~~~~
      |   printf
Language: C++

#include<iostream>
#include<vector>
using namespace std;
int main()
{
  int N; // 2 <= N <= 10^5, even number
  cin >> N;
  vector<int> d;
  int temp;
  for (int i = 0; i < N; i++) {
    cin >> temp;
    d.push_back(temp);
  }
  //classify d[i] >= K or d[i] < K
  //subtract d's N/2 and N/2-1 factor d[N/2]-d[N/2-1]
  sort(d.begin(), d.end());
  cout << d[N/2] - d[N/2 - 1] << endl;
  return 0;
}


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

#include<stdio.h>

int main(void)
{
  int N = 0;
  scanf("%d", &N);
  
  int d[100000]; //10^5
  for(int i = 0; i < N; i++)
  {
    scanf("%d", &d[i]);
  }
  
  int tmp = 0;
  for(int i = 0; i < N; i++)
  {
    for(j = i+1; j < N; j++)
    {
      if( d[i] > d[j] )
      {
        tmp = d[i];
      	d[i] = d[j];
      	d[j] = tmp;
      }
    }
  }
  
  print("%d", d[N/2 + 1] - d[N/2] )
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:9: error: 'j' was not declared in this scope
   17 |     for(j = i+1; j < N; j++)
      |         ^
a.cc:28:3: error: 'print' was not declared in this scope; did you mean 'printf'?
   28 |   print("%d", d[N/2 + 1] - d[N/2] )
      |   ^~~~~
      |   printf
Language: C++

#include<iostream>
#include<vector>
using namespace std;
int main()
{
  int N; // 2 <= N <= 10^5, even number
  cin >> N;
  vector<int> d;
  int temp;
  for (int i = 0; i < n; i++) {
    cin >> temp;
    d.push_back(temp);
  }
  //classify d[i] >= K or d[i] < K
  //subtract d's N/2 and N/2-1 factor d[N/2]-d[N/2-1]
  sort(v.begin(), v.end());
  cout << d[N/2] - d[N/2 - 1] << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:23: error: 'n' was not declared in this scope
   10 |   for (int i = 0; i < n; i++) {
      |                       ^
a.cc:16:8: error: 'v' was not declared in this scope
   16 |   sort(v.begin(), v.end());
      |        ^
a.cc:16:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   16 |   sort(v.begin(), v.end());
      |   ^~~~
      |   short
Language: C++

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

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

  if(N % 2 == 1)
  {
    cout << 0 << endl;
    return 0;
  }
  else
  {
    vector<long long> q(N);
    for (long long i = 0; i < N; i++)
    {
      cin >> q[i];
    }

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

    cout << q[N / 2] - q[N / 2 - 1] << endl;
  }

  return 0;
}

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

#include<iostream>
using namespace std;
int main()
{
  int N; // 2 <= N <= 10^5, even number
  cin >> N;
  vector<int> d;
  int temp;
  for (int i = 0; i < n; i++) {
    cin >> temp;
    d.push_back(temp);
  }
  //classify d[i] >= K or d[i] < K
  //subtract d's N/2 and N/2-1 factor d[N/2]-d[N/2-1]
  sort(v.begin(), v.end());
  cout << d[N/2] - d[N/2 - 1] << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'vector' was not declared in this scope
    7 |   vector<int> d;
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include<iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:7:10: error: expected primary-expression before 'int'
    7 |   vector<int> d;
      |          ^~~
a.cc:9:23: error: 'n' was not declared in this scope
    9 |   for (int i = 0; i < n; i++) {
      |                       ^
a.cc:11:5: error: 'd' was not declared in this scope
   11 |     d.push_back(temp);
      |     ^
a.cc:15:8: error: 'v' was not declared in this scope
   15 |   sort(v.begin(), v.end());
      |        ^
a.cc:15:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   15 |   sort(v.begin(), v.end());
      |   ^~~~
      |   short
a.cc:16:11: error: 'd' was not declared in this scope
   16 |   cout << d[N/2] - d[N/2 - 1] << endl;
      |           ^
Language: C

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

int main(){
    int N;
    cin>>N;
    vector<int> Q(N);
    for(int i=0;i<N;i++)cin>>Q[i];
    sort(Q.begin(), Q.end());
    cout<<Q[N/2]-Q[N/2-1];
    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>

int main(){
    int n;
    std::cin >> n;
    int d[n];
    for(int i=0;i<n;i++){
        std::cin >> d[i];
    }
    std::sort(d,d+n);
    int sum=d[n/2]-d[n/2-1];
    std::cout << sum << std::endl;
    return 0;
}

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

#include <iostream>
using namespace std;

int main(int argc, const char * argv[]) {
    int n;
    cin >> n;
    
    int *p = new int[n];
    int max = INT_MIN;
    int min = INT_MAX;
    for (int i = 0; i < n; i++) {
        cin >> p[i];
        if (max < p[i]) { max = p[i]; }
        if (min > p[i]) { min = p[i]; }
    }
    
    int kcount = 0;
    for (int k = min; k < max; k++) {
        int ARCcount = 0;
        int ABCcount = 0;
        for (int i = 0; i < n; i++) {
            if (p[i] >= k) {
                ARCcount++;
            }else {
                ABCcount++;
            }
        }
        
        if (ARCcount == ABCcount) {
            kcount++;
        }
    }
    
    cout << kcount << endl;
    
    return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:9:15: error: 'INT_MIN' was not declared in this scope
    9 |     int max = INT_MIN;
      |               ^~~~~~~
a.cc:2:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include <iostream>
  +++ |+#include <climits>
    2 | using namespace std;
a.cc:10:15: error: 'INT_MAX' was not declared in this scope
   10 |     int min = INT_MAX;
      |               ^~~~~~~
a.cc:10:15: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
using namespace std;
int main(void){
    int n,i;
    cin>>n;
    int d[n];
    for(i=0;i<n;i++0)cin>>d[i];
    sort(d,d+n);
    cout<<d[n/2]-d[n/2-1]<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:20: error: expected ')' before numeric constant
   11 |     for(i=0;i<n;i++0)cin>>d[i];
      |        ~           ^
      |                    )
a.cc:11:21: error: expected ';' before ')' token
   11 |     for(i=0;i<n;i++0)cin>>d[i];
      |                     ^
      |                     ;
Language: C

N=int(input())
li=list(map(int,input().split()))

li.sort()
ans=li[int(N/2)]-li[int(N/2-1)]
print(ans)

Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | N=int(input())
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'N' [-Wimplicit-int]
main.c:1:3: error: expected expression before 'int'
    1 | N=int(input())
      |   ^~~
Language: C

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

int main(){
    int N;
    cin>>N;
    vector<int> Q(N);
    for(int i=0;i<N;i++)cin>>Q[i];
    sort(Q.begin(), Q.end());
    cout<<Q[N/2]-Q[N/2-1];
    return 0;
}

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

#include<stdio.h>
int main(void){
  int n,i;
  scanf("%d",&n);
  int d[n];
  for(i==0;i<n;i++){
    scanf("%d",&d[i]);
  }
  for (i=0; i<n; i++) {
    for (j=i+1; j<n; j++) {
      if (d[i] > d[j]) {
        int tmp =  d[i];
        d[i] = d[j];
        d[j] = tmp;
      }
    }
  }
  printf("%d",d[n/2+1]-d[n/2]);
}


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

#include <bits/stdc++.h>
#include <vector>
#include <string.h>
#include <math.h>
#include <stdlib.h>
using namespace std;

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

    sort(a,a+n);

    ans=a[n/2]-a[n/2-1];

    printf("%d",ans);
}



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<stdio.h>
int main(void){
  int n;
  scanf("%d",&n);
  int d[n];
  for(i==0;i<n;i++){
    scanf("%d",&d[i]);
  }
  for (i=0; i<n; i++) {
    for (j=i+1; j<n; j++) {
      if (d[i] > d[j]) {
        int tmp =  d[i];
        d[i] = d[j];
        d[j] = tmp;
      }
    }
  }
  printf("%d",d[n/2+1]-d[n/2]);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:7: error: 'i' was not declared in this scope
    6 |   for(i==0;i<n;i++){
      |       ^
a.cc:9:8: error: 'i' was not declared in this scope
    9 |   for (i=0; i<n; i++) {
      |        ^
a.cc:10:10: error: 'j' was not declared in this scope
   10 |     for (j=i+1; j<n; j++) {
      |          ^
Language: C++

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

using namespace std;

int main(){
    int N;
    cin>>N;
    vector<int> d;
    for(int i=0; i<N; i++){
        int tmp;
        cin >> tmp;
        d.push_back(tmp);
    }
    std::sort(d.begin(), d.end());

    int median = d[N/2-1];
    int median_next = d[N/2];

    cout<<median_next-median<<endl;

    return 0;

}

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

#include <cstdio>
#include <iostream>
#include <vector>

using namespace std;

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

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

//#include <bits/stdc++.h>
#include <iostream>
#include <vector>

using namespace std;

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

    int N;

    cin >> N;

    vector<int> d(N);

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

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

    cout << d[N / 2] - d[N / 2 - 1] << endl;
}

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

#include <iostream>
using namespace std;
#define REP(i, n)   for(int i = 0; i < (int)(n); i++)
#define MAX_N   100000

void solve(){

}

int main (){
    int n;
    cin >> n;
    int d[n];
    REP(i, n)
        cin >> d[i];
    sort(d, d + n);
    if(n % 2)
        cout << 0 << endl;
    else{
        cout << d[n / 2] - d[n / 2 - 1] << endl;
    }
    
    return 0;
}

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

import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Scanner;
import java.util.AbstractMap.SimpleEntry;

public class DivideTheProblem {

    static final int modnum = 1000000000 + 7;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        ArrayList<Integer> list = new ArrayList<Integer>(N);
        for(int i=0;i<N;i++){
            list.add(sc.nextInt());
        }
        list.sort(Comparator.naturalOrder());

        int a = list.get(N/2-1);
        int b = list.get(N/2);

        System.out.println(b-a);
    }
}

Compiler output:
Main.java:11: error: class DivideTheProblem is public, should be declared in a file named DivideTheProblem.java
public class DivideTheProblem {
       ^
1 error
Language: Java

import java.util.*;

public class Main{
	public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
      	int k = scan.nextInt();
      	int[] a = new int[k];
      	int ans = 0;
      	for(int i = 0; i < k; i ++){
        	a[i] = n
             scan.nextInt();
        }
      	Arrays.sort(a);
      	int b = k / 2;
      	if(a[b - 1] == a[b]){
        	ans = 0;
        }
      	else{
        	ans = a[b] - a[b-1] + 1;
        }
      	System.out.print(ans);
    }

}

Compiler output:
Main.java:10: error: ';' expected
        	a[i] = n
        	        ^
1 error
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007 // 10^9+7
#define INF 99999999999 //10^12-1
#define dev 998244353 //tenka1
#define P pair<int,int>
#define F first
#define S second
int n,d[200000];
int ans=0;
signed main(){
    cin>>n;
    rep(i,n)cin>>d[i];
    sort(d,d+n);
    rep(i,100000){
        int x=upper_bound(d,d+n,i)-d;
        if(x==n/2){
            ans++
            
        }
    }
    cout<<ans<<endl;
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:21:18: error: expected ';' before '}' token
   21 |             ans++
      |                  ^
      |                  ;
   22 | 
   23 |         }
      |         ~
Language: C++

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

int main(){
  int N;
  cin >> N;
  vector<int> d(N);
  for(int i=0; i<N; i++){
    cin >> d(i);
  }
  sort(d.begin(), d.end());
  cout << d.at(N/2)-d.at(N/2-1) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:13: error: no match for call to '(std::vector<int>) (int&)'
    9 |     cin >> d(i);
      |            ~^~~
Language: C++

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

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

    int d[n];

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

    sort(d,d+n);

    cout << d[n/2]-d[n/2-1] << endl;

    return 0;
}


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

#include <string>
#include <algorithm>
#include <stdlib.h>
#include <iomanip>
#include <vector>
using namespace std;
typedef long long unsigned int ll;

int main() {
  ll n;
  cin >> n;
  ll d[n];
  for (ll i=0;i<n;i++) cin >> d[i];
  sort(d,d+n);
  int n2 = n/2;
  int ans = d[n2] - d[n2-1];
  cout << ans << endl; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:3: error: 'cin' was not declared in this scope
   11 |   cin >> n;
      |   ^~~
a.cc:6:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    5 | #include <vector>
  +++ |+#include <iostream>
    6 | using namespace std;
a.cc:17:3: error: 'cout' was not declared in this scope
   17 |   cout << ans << endl;
      |   ^~~~
a.cc:17:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

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

using namespace std;
typedef long long int ll;

#define REP(i, n) for(ll i = 0; i < (ll)(n); i++)

int main(int argc, const char * argv[]) {
    
    ll N;
    cin >> N;
    
    vector<ll> data(N);
    REP(i, N) cin >> data[i];
    
    sort(data.begin(), data.end());
    
    cout << data[N/2] - data[-1 + N/2];
    
    return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:18:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   18 |     sort(data.begin(), data.end());
      |     ^~~~
      |     short