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

#include<iostream>
#include<set>
#include<stack>
#include<queue>
#include<string>
#include<algorithm>//min,max,swap,rand,reverse,sort,lower_bound
#include<functional>
#include<vector>
#include<list>
#include<map>
#include<tuple>
#include<cmath>//abs, sin, cos
#include<bitset>
using namespace std;

int main()
{
	int N;
	int prev = 0, target = 0;
	int t = 0;
	int count = 0;
	cin >> N;
	vector<int> d[N - 1];
	for (int i = 0; i < N; i++)
	{
		cin >> t;
		d.push_back(t);
	}

	sort(d.begin(), d.end());
	int mid = 0;
	mid = N / 2 - 1; //mid left
	prev = mid;
	target = prev + 1;
	if (d[mid] == d[mid + 1])
		cout << 0 << endl;
	else {
		while (d[prev] != d[target]) {
			target++;
			prev++;
			count++;
		}
		cout << count << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:19: error: request for member 'push_back' in 'd', which is of non-class type 'std::vector<int> [(N + -1)]'
   27 |                 d.push_back(t);
      |                   ^~~~~~~~~
a.cc:30:16: error: request for member 'begin' in 'd', which is of non-class type 'std::vector<int> [(N + -1)]'
   30 |         sort(d.begin(), d.end());
      |                ^~~~~
a.cc:30:27: error: request for member 'end' in 'd', which is of non-class type 'std::vector<int> [(N + -1)]'
   30 |         sort(d.begin(), d.end());
      |                           ^~~
Language: C++

#define _GLIBCXX_DEBUG
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<string>
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep2(i,s,n) for(int i=s;i< (int)n; i++)
#define ll long long 
#define all(v) v.begin(),v.end()
using namespace std;
const ll inf = 1000000007;
int main() {
  ll n;cin >>n;
  vector<ll> d(n);
  rep(i,n) cin  >>d[i];
  sort(all(d));
  cout <<a[n/2]-a[n/2-1]<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:10: error: 'a' was not declared in this scope
   26 |   cout <<a[n/2]-a[n/2-1]<<endl;
      |          ^
Language: C++

#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;n>i;++i)
#define MOD 1000000007
using namespace std;
using ll=int64_t;
using pii=pair<int,int>;
using vi=vector<int>;
using VI=vector<ll>;
using vis=vector<string>;
using vvi=vector<vi>;
//最大公約数
int gcd(int a,int b){
    if(a%b==0)
    return b;
    return gcd(b,a%b);
}
//最小公倍数
int lcm(int a,int b){
   return a*b/gcd(a,b);
}
bool prime(int num){
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2){
        if (num % i == 0)
        return false;
    }
    return true;
}
int random(){
    srand((unsigned)time(NULL));
    return rand();
}
int main(){
    ll n; cin>>n;
    VI d(n);
    rep(i,n) cin>>d[i];
    sort(d.begin(),d.end());
    ll b=d.size()/2;
    if(d[b-1]==d[b]){
        cout<<"0"<<endl;
        return 0;
    }
    cout<<d[b]-d[b-1]<<endl;
}

Compiler output:
a.cc:32:5: error: ambiguating new declaration of 'int random()'
   32 | int random(){
      |     ^~~~~~
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42,
                 from a.cc:1:
/usr/include/stdlib.h:521:17: note: old declaration 'long int random()'
  521 | extern long int random (void) __THROW;
      |                 ^~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <set>
#include <map>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
int main() {
    int N;
    cin >> N;
    
    vector<int> D(N);
    rep(i, 0, N) {
        cin >> D[i];
    }
    
    sort(D.begin(), D.end());
    int ans = D[N/2] - D[N/2-1];
    cout << ans << 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.begin(), D.end());
      |     ^~~~
      |     short
Language: C++

#include <iostream>
#include <vector>
#include <set>
#include <map>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
int main() {
    int N;
    cin >> N;
    
    vector<int> D(N, 0);
    rep(i, 0, N) {
        cin >> D[i];
    }
    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:15:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   15 |     sort(D.begin(), D.end());
      |     ^~~~
      |     short
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N; cin>>N;
  vector<int> A(N);
  for(int i=0; i<N; i++){
    cin>>A.at(i);
  }
  sort(A.begin(),A.end());
  int K=S.at(N/2-1);
  int L=0;
  for(int i=0; i<A.at(N-1)+1; i++){
    K++;
    if(K<=S.at(N/2))
      L++;
    else break;
  }
  cout<<L<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'S' was not declared in this scope
   11 |   int K=S.at(N/2-1);
      |         ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N; cin>>N;
  vec<int> A(N);
  for(int i=0; i<N; i++){
    cin>>A.at(i);
  }
  sort(A.begin(),A.end());
  int K=S.at(N/2-1);
  int L=0;
  for(int i=0; i<A.at(N-1)+1; i++){
    K++;
    if(K<=S.at(N/2))
      L++;
    else break;
  }
  cout<<L<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'vec' was not declared in this scope
    6 |   vec<int> A(N);
      |   ^~~
a.cc:6:7: error: expected primary-expression before 'int'
    6 |   vec<int> A(N);
      |       ^~~
a.cc:8:10: error: 'A' was not declared in this scope
    8 |     cin>>A.at(i);
      |          ^
a.cc:10:8: error: 'A' was not declared in this scope
   10 |   sort(A.begin(),A.end());
      |        ^
a.cc:11:9: error: 'S' was not declared in this scope
   11 |   int K=S.at(N/2-1);
      |         ^
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(),a d.end());
    cout << d[N/2] - d[N/2 - 1] << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:20: error: 'a' was not declared in this scope
   10 |     sort(d.begin(),a d.end());
      |                    ^
Language: C

#include <stdio.h>

int main()
{
	int i, N, d[100001];
	scanf("%d", &N);
	for (i = 1; i <= N; i++) scanf("%d", &(d[i]));

	int lb = 100000, ub = 1;
	for (i = 1; i <= N; i++) {
		if (d[i] < lb) lb = d[i];
		if (d[i] > ub) ub = d[i];
	}
	
	int K, easy, hard;
	while (1) {
		if (lb > ub) break;
		K = (lb + ub) / 2;
		easy = 0;
		hard = 0;
		for (i = 1, i <= N; i++) {
			if (d[i] < K) easy++;
			else hard++;
		}
		if (easy == hard) break;
		else if (easy < hard) lb = K + 1;
		else ub = K - 1;
	}
	
	if (lb > ub) printf("0\n");
	else {
		lb = 1;
		ub = 100000;
		for (i = 1; i <= N; i++) {
			if (d[i] < K && d[i] > lb) lb = d[i];
			if (d[i] > K && d[i] < ub) ub = d[i];
		}
		printf("%d\n", ub - lb);
	}
	fflush(stdout);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:21:40: error: expected ';' before ')' token
   21 |                 for (i = 1, i <= N; i++) {
      |                                        ^
      |                                        ;
Language: C++

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

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

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

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

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000000
#define MOD 1000000007
#define MAXR 100000
#define _GLIBCXX_DEBUG

int threemax(int a, int b, int c) {
	if (a >= b && a >= c) {
		return a;
	}
	else if (b >= a && b >= c) {
		return b;
	}
	else {
		return c;
	}
}

int threemin(int a, int b, int c) {
	if (a <= b && a <= c) {
		return a;
	}
	else if (b <= a && b <= c) {
		return b;
	}
	else {
		return c;
	}
}

void chmaxl(ll &a,ll b){
	if(a<b){
		a=b;
	}
	return;
}

void chminl(ll &a,ll b){
	if(a>b){
		a=b;
	}
	return;
}

void chmaxi(int &a,int b){
	if(a<b){
		a=b;
	}
	return;
}

void chmini(int &a,int b){
	if(a>b){
		a = b;
	}
	return;
}



int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for(int i=0;i<N;i++){
    cin >> vec.at(i);
  }
  sort(ALL(vec));
  int ans=vec.at(vec.size()/2)-vec.at(vec.size/2-1);
  cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:80:43: error: invalid use of member function 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = int; _Alloc = std::allocator<int>; size_type = long unsigned int]' (did you forget the '()' ?)
   80 |   int ans=vec.at(vec.size()/2)-vec.at(vec.size/2-1);
      |                                       ~~~~^~~~
      |                                               ()
Language: C

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main (void){
	int n,a;
	cin >> n;
	vector<int>v1;
	for(int i=0;i<n;i++){
		cin >>a;
		v1.push_back(a);
	}
	sort(v1.begin(),v1.end());
	cout << v1[n/2]-v1[n/2-1] <<endl ;
	return 0;
}

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

import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        int n = sc.nextInt();
        int[] a = sc.nextIntArray();
        Arrays.sort(a);
        System.out.println(a[n/2]-a[n/2-1]);
        
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
            return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }
    
    public int nextInt() {
        return Integer.parseInt(next());
    }
    public double nextDouble() {
         return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++) a[i] = nextLong();
        return a;
    } 
}


Compiler output:
Main.java:8: error: method nextIntArray in class FastScanner cannot be applied to given types;
        int[] a = sc.nextIntArray();
                    ^
  required: int
  found:    no arguments
  reason: actual and formal argument lists differ in length
1 error
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,count=0,a[n];
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  while(a[n/3]<a[n/2]){
    if(n%2==0){
    for(int i=(n/3)+1;i<=n/2;i++){
      count++;
    }
    else{
      cout<<0;
      return 0;
    }
  }
    cout<<count;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:5: error: expected '}' before 'else'
   14 |     else{
      |     ^~~~
a.cc:10:15: note: to match this '{'
   10 |     if(n%2==0){
      |               ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,count=0;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  while(a[n/3]<a[n/2]){
    if(n%2==0){
    for(int i=(n/3)+1;i<=n/2;i++){
      count++;
    }
    else{
      cout<<0;
      return 0;
    }
  }
    cout<<count;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:10: error: 'a' was not declared in this scope
    7 |     cin>>a[i];
      |          ^
a.cc:9:9: error: 'a' was not declared in this scope
    9 |   while(a[n/3]<a[n/2]){
      |         ^
a.cc:14:5: error: expected '}' before 'else'
   14 |     else{
      |     ^~~~
a.cc:10:15: note: to match this '{'
   10 |     if(n%2==0){
      |               ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n,a[100000];
int main(){
  for(cin>>n;i<n;i++)cin>>a[i];
  sort(a,a+n);
  cout<<a[n/2]-a[n/2-1];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:14: error: 'i' was not declared in this scope
    5 |   for(cin>>n;i<n;i++)cin>>a[i];
      |              ^
Language: C++


#define fastio ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)

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

Compiler output:
a.cc: In function 'int main()':
a.cc:2:16: error: 'ios_base' has not been declared
    2 | #define fastio ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
      |                ^~~~~~~~
a.cc:5:5: note: in expansion of macro 'fastio'
    5 |     fastio;
      |     ^~~~~~
a.cc:2:46: error: 'cin' was not declared in this scope
    2 | #define fastio ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
      |                                              ^~~
a.cc:5:5: note: in expansion of macro 'fastio'
    5 |     fastio;
      |     ^~~~~~
a.cc:2:58: error: 'cout' was not declared in this scope
    2 | #define fastio ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
      |                                                          ^~~~
a.cc:5:5: note: in expansion of macro 'fastio'
    5 |     fastio;
      |     ^~~~~~
a.cc:11:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   11 |     sort(v, v+n);
      |     ^~~~
      |     short
a.cc:12:34: error: 'endl' was not declared in this scope
   12 |     cout << v[n/2]-v[(n/2)-1] << endl;
      |                                  ^~~~
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.at(n);
  }
  sort(d.begin(),d.end());
  int t;
  if(n>1){
    t=d.at((n/2)-1)-d.at(n/2);
  }
  cout<<t<<endl;
  

Compiler output:
a.cc: In function 'int main()':
a.cc:16:17: error: expected '}' at end of input
   16 |   cout<<t<<endl;
      |                 ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

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

int main() {
  int n, k;
  cin>>n;
  int a[n];
  rep(i,n){
    cin>>k;
    a[i]=k;
  }
  sort(a[n].begin(), a[n].end());
  
  cout<<a[n/2+1]-a[n/2]<<endl;
  
}

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

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

int main() {
  int n, k;
  cin>>n;
  int a[n];
  rep(i,n){
    cin>>k;
    a[i]=k;
  }
  sort(a.begin(), a.end());
  
  cout<<a[n/2+1]-a[n/2]<<endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:10: error: request for member 'begin' in 'a', which is of non-class type 'int [n]'
   13 |   sort(a.begin(), a.end());
      |          ^~~~~
a.cc:13:21: error: request for member 'end' in 'a', which is of non-class type 'int [n]'
   13 |   sort(a.begin(), a.end());
      |                     ^~~
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.at(i);
  sort(d.begin(),d.end());
  cout<<d.at(N/2)-d.at(N/2-1)<<endl;

return 0;
}

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

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> d(n);
  for (int i = 0; i < n; i++) cin >> d[i];
  sort(d.begin(), d.end());
  int m = n / 2;
  int l = d[m-1], r = d[m];
  cout << r - l << '\n';
  return 0;
}v

Compiler output:
a.cc:16:2: error: 'v' does not name a type
   16 | }v
      |  ^
Language: C

#include <stdio.h>

in main(void)
{
  int n;
  scanf("%d", &n);
  int d[n];
  int i = 0;
  while (i < n)
  {
    scanf("%d", &d[i]);
    i++;
  }
  
  int flg = 1;
  int tmp;
  i = 0;
  while (flg == 1)
  {
    flg = 0;
    while (i < n)
    {
      if (d[i] > d[i + 1])
      {
        flg = 1;
        tmp = d[i];
        d[i] = d[i + 1];
        d[i + 1] = tmp;
      }
      i++;
    }
  }
  
  if (d[n / 2 - 1] == d[n / 2])
  {
    printf("0");
    return 0;
  }
  
  int cnt = 0;
  i = d[n / 2 - 1] + 1;
  while (i <= d[n / 2])
  {
    cnt++;
    i++;
  }
  printf("%d", cnt);
  return 0;
}


Compiler output:
main.c:3:1: error: unknown type name 'in'; did you mean 'int'?
    3 | in main(void)
      | ^~
      | int
Language: C

#include <stdio.h>

in main(void)
{
  int n;
  scanf("%d", &n);
  int d[n];
  int i = 0;
  while (i < n)
  {
    scanf("%d", &d[i]);
    i++;
  }
  
  int flg = 1;
  int tmp;
  i = 0;
  while (flg == 1)
  {
    flg = 0;
    while (i < n)
    {
      if (d[i] > d[i + 1])
      {
        flg = 1;
        tmp = d[i];
        d[i] = d[i + 1];
        d[i + 1] = tmp;
      }
      i++;
    }
  }
  
  if (d[n / 2 - 1] == d[n / 2])
  {
    printf("0");
    return 0;
  }
  
  i = d[n / 2 - 1] + 1;
  while (i <= d[n / 2])
  {
    printf("%d", i);
    i++;
  }
  return 0;
}

Compiler output:
main.c:3:1: error: unknown type name 'in'; did you mean 'int'?
    3 | in main(void)
      | ^~
      | int
Language: C++

#include <iostream>
#include <Vector>
#include <algorithm>

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

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

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

using ll=long long;
const ll MOD=1000000007;

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/2]-a[n/2-1] << endl;
}

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

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

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) (v.begin(),v.end())
#define COUT(x) cout<<(x)<<endl

int main(){
    int n;
    cin >> n;
    int a[n];
    REP(i,n){
        cin >> a[i];
    }
    sort(a,a+n);
    int num = a.size()/2;
    cout << (a[num]-a[num-1]) << endl;
    return 0;
}    


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

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

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) (v.begin(),v.end())
#define COUT(x) cout<<(x)<<endl

int main(){
    int n;
    cin >> n;
    int a[n];
    REP(i,n){
        cin >> a[i];
    }
    sort(a,a+n);
    cout << (a[a.size()/2]-a[a.size()/2-1]) << endl;
    return 0;
}    

Compiler output:
a.cc: In function 'int main()':
a.cc:23:18: error: request for member 'size' in 'a', which is of non-class type 'int [n]'
   23 |     cout << (a[a.size()/2]-a[a.size()/2-1]) << endl;
      |                  ^~~~
a.cc:23:32: error: request for member 'size' in 'a', which is of non-class type 'int [n]'
   23 |     cout << (a[a.size()/2]-a[a.size()/2-1]) << endl;
      |                                ^~~~
Language: C++

#include <bits/stdc++.h>
#include<vector>
using namespace std;
#define rep(i, n)        for(int i=0; i<(int)(n); ++i)
int main() {
  int a;
  cin>>a;
  vector<int>b(a);
  rep(i,a)cin>>b[i];
  	sort(b.begin(), b.end());
  cout<<c[a/2+1]-c[a/2];
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'c' was not declared in this scope
   11 |   cout<<c[a/2+1]-c[a/2];
      |         ^
Language: C

#include <stdio.h>
#include <string.h>
#define lop(i, n) for(i=0; i<n; i++)

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

int main()
{
	int n, k=0, l=0, i, j, d[100000];
	
	scanf("%d", &n);
	
	lop(i, n){ scanf("%d", &d[i]); }
	
	qsort(d, n, sizeof(int), com);
	
	printf("%d", d[m]-d[m-1]);
	
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:17:9: error: implicit declaration of function 'qsort' [-Wimplicit-function-declaration]
   17 |         qsort(d, n, sizeof(int), com);
      |         ^~~~~
main.c:19:24: error: 'm' undeclared (first use in this function)
   19 |         printf("%d", d[m]-d[m-1]);
      |                        ^
main.c:19:24: note: each undeclared identifier is reported only once for each function it appears in
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()) ;
   int n/2=k ;
   if(n%2!=0)
   cout <<0 <<endl ;
   else if( d[k]==d[k+1])
   cout <<0 <<endl ;
   else
   
  cout << d[k+1]-d[k] << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: expected initializer before '/' token
   12 |    int n/2=k ;
      |         ^
a.cc:15:15: error: 'k' was not declared in this scope
   15 |    else if( d[k]==d[k+1])
      |               ^
Language: Java

import java.util.*;

public class Main {
    public static void main(String args[]) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for(int i = 0; i < n; i++)
        	arr[i] = sc.nextInt();
        Arrays.sort(arr);
        System.out.println(arr[i] - arr[i-1]);
    }
}


Compiler output:
Main.java:11: error: cannot find symbol
        System.out.println(arr[i] - arr[i-1]);
                               ^
  symbol:   variable i
  location: class Main
Main.java:11: error: cannot find symbol
        System.out.println(arr[i] - arr[i-1]);
                                        ^
  symbol:   variable i
  location: class Main
2 errors
Language: C++

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

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

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int arr[n];
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	sort(arr,arr+n);
	int p=arr[n/2];
	int q=arr[n/2-1];
	if(p==q)
		cout<<0<<endl;
	else cout<<p-q<<endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:17:30: error: expected '}' at end of input
   17 |         else cout<<p-q<<endl;
      |                              ^
a.cc:4:1: note: to match this '{'
    4 | {
      | ^
Language: C++

{
    int n;

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


    sort(a,a+n);
    /*int start = a[n/2-1];
    int finish =a[(n/2)];*/
    int k;
    k=a[n/2]- a[n/2-1];
    printf("%d",k);

    return 0;
}


Compiler output:
a.cc:1:1: error: expected unqualified-id before '{' token
    1 | {
      | ^
Language: C++

#include<iostream>
using namespace std;
int main(){
    int t,i,ans;
    cin>>t;
    int p=t/2;
    int a[t],b[t];
    for(i=0;i<t;i++){
        cin>>a[i];

    }
    sort(a,a+t);
    for(i=0;i<t;i++){
        ans=a[p]-a[p-1];

    }
    cout<<ans<<endl;
}



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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:11:8: error: 'vec' was not declared in this scope
   11 |   sort(vec.begin(), vec.end());
      |        ^~~
Language: Java

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

public class C_132 {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			
			int N = scan.nextInt();
			int[]d = new int[N];
			
			for(int i = 0;i<N;i++) {
				d[i] = scan.nextInt();
			}
			
			
			Arrays.sort(d);
			
			int s = d[N/2]-d[N/2-1];
			
			
			System.out.println(s);
			
			
			
			
			
		}
		
		
	}
		

}


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

#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<math.h>
using namespace std;
#define ll long long
int main(){
    ll n;
    cin >> n;
    ll d[n];
    for(i=0;i<n;i++){
        cin >> d[i];
    }
    sort(d,d+n);
    cout<<d[n/2]-d[n/2-1];
    return 0;
}

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

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: expected ',' or ';' before 'cout'
   12 |     cout << answer << endl;
      |     ^~~~
Language: C++

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

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());
    int half = d.size()/2;
    int left = d[half-1];
    int right = d[half];

    int count = 0;

    if (left == right) count = 0;
    else count = right-left;

    cout << count << endl;
 

Compiler output:
a.cc: In function 'int main()':
a.cc:23:27: error: expected '}' at end of input
   23 |     cout << count << endl;
      |                           ^
a.cc:5:12: note: to match this '{'
    5 | int main() {
      |            ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
typedef long long ll;
#define vint vector<int>
#define vstring vector<string>

int main(){
    int a;
    cin >> a;
    vint A(a);
    rep(i,n) cin >> A[i];
    sort(A.begin(),A.end());
    if(A[a/2-1] != A[a/2]){
        cout << A[a/2] - A[(a/2)-1] << endl; 
    }
    else cout << 0 << endl;
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:11: error: 'n' was not declared in this scope
   12 |     rep(i,n) cin >> A[i];
      |           ^
a.cc:3:34: note: in definition of macro 'rep'
    3 | #define rep(i,n) for(int i = 0;i<n;i++)
      |                                  ^
Language: C++

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

int main()
{
  int n,ans=0,mid;
  vector<int> all;
  cin>>n;
  for(int i = 0;i<n;i++)
  {
    int tmp;
    cin>>tmp;
    all.push_back(tmp);
  }
  sort(all.begin(),all.end());
  mid=n/2 - 1;
  ans=all.at(mid+1)-all.at(mid);
  if(ans<0)
    ans=0;
  cout<<ans<<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(all.begin(),all.end());
      |   ^~~~
      |   short
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int n;
    vector<int> d;

    cin >> n;

    d.resize(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:20:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   20 |     sort(d.begin(), d.end());
      |     ^~~~
      |     short
Language: C++

# include <bits/stdc++.h>
# define pb push_back
# define ll long long
# define fi first
# define se second
# define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
# define mkp make_pair
//# define time cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"

using namespace std;

ll q , w , e , z ;


int main()
{
	speed;

    int n ;
    cin >> n ;
    int a[n];
    for(int i = 0 ; i < n ; i ++ ){
        cin >> a[i] ;
    }
    sort(a,a+n);
    int k = n / 2 ;
    if(n % 2 != 0 ){
        cout<<0<<endl;
        return 0;
    }
    if(a[k-1] == a[k]){
        cout<<0<<endl;
        return 0 ;
    }
    int j = a[k]-a[k-1];
    else{
        cout<<j<<endl;
        return 0 ;
    }

	time;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:5: error: 'else' without a previous 'if'
   36 |     else{
      |     ^~~~
Language: C++

int main() {
  int n,ans=0;
  cin >> n;
  vector<int> vec(n);
  for(int i=0; i<n; i++) cin >> vec[i];
  for(int i=0; i<100001; i++) {
    int count=0;
    for(int j : vec) {
      if(j >= i) {
        count++;
        if(count > n/2) break;
      }
    }
    if(count == n/2) ans++;
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:3: error: 'cin' was not declared in this scope
    3 |   cin >> n;
      |   ^~~
a.cc:4:3: error: 'vector' was not declared in this scope
    4 |   vector<int> vec(n);
      |   ^~~~~~
a.cc:4:10: error: expected primary-expression before 'int'
    4 |   vector<int> vec(n);
      |          ^~~
a.cc:5:33: error: 'vec' was not declared in this scope
    5 |   for(int i=0; i<n; i++) cin >> vec[i];
      |                                 ^~~
a.cc:8:17: error: 'vec' was not declared in this scope
    8 |     for(int j : vec) {
      |                 ^~~
a.cc:16:3: error: 'cout' was not declared in this scope
   16 |   cout << ans << endl;
      |   ^~~~
a.cc:16:18: error: 'endl' was not declared in this scope
   16 |   cout << ans << endl;
      |                  ^~~~
Language: C++

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

int main() {
  int n,ans=0;
  cin >> n;
  vector<int> vec(n);
  for(int i=0; i<n; i++) cin >> vec[i];
  for(int i=0; i<9999; i++) {
    int count=0;
    for(int j : vec) {
      if(j >= i) {
      count++;
      if(count > n/2) break;
    }
    if(count == n/2) ans++;
  }
  cout << ans << endl;
}

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

#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
  int n;
  cin >> n;
  vector<int>d;
  for(int i = 0; i < n; i++){
    int x;
    cin >> x;
    d.push_back(x);
  }
  sort(d.begin(),d.end());
  int hn = n / 2;
  cout << d[hn] - d[hn-1];
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'vector' was not declared in this scope
    8 |   vector<int>d;
      |   ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include <algorithm>
  +++ |+#include <vector>
    3 | using namespace std;
a.cc:8:10: error: expected primary-expression before 'int'
    8 |   vector<int>d;
      |          ^~~
a.cc:12:5: error: 'd' was not declared in this scope
   12 |     d.push_back(x);
      |     ^
a.cc:14:8: error: 'd' was not declared in this scope
   14 |   sort(d.begin(),d.end());
      |        ^
Language: C++

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

int main(){
  int n;
  cin >> n;
  
  int a[n];
  
  for(auto &i:a)cin >> i;
  
  sort(a,a+n);
  
  int m = (n/2)-1;
  int ans = a[m+1]-a[m]+1;
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc:1:8: error: macro names must be identifiers
    1 | #define<bits/stdc++.h>
      |        ^
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope
    6 |   cin >> n;
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #define<bits/stdc++.h>
a.cc:12:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   12 |   sort(a,a+n);
      |   ^~~~
      |   short
a.cc:16:3: error: 'cout' was not declared in this scope
   16 |   cout << ans << endl;
      |   ^~~~
a.cc:16:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:16:18: error: 'endl' was not declared in this scope
   16 |   cout << ans << endl;
      |                  ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | #define<bits/stdc++.h>
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll= long long;
using vi= vector<int>;
using vvi= vector<vi>;
using vd= vector<double>;
using vvd= vector<vd>;
using vc= vector<char>;
#define rep(i,x,n) for(int i=x; i<n; i++)
#define all(x) x.begin(), x.end()

int main(){
  int n,num;
  cin >> n;
  vi d(n);
  rep(i,0,n){
    cin >> d[i];
  }

  sort(all(d));
  num= d[n/2]- d[n/2-1];
  cout << num << endl;
}
#include <bits/stdc++.h>
using namespace std;
using ll= long long;
using vi= vector<int>;
using vvi= vector<vi>;
using vd= vector<double>;
using vvd= vector<vd>;
using vc= vector<char>;
#define rep(i,x,n) for(int i=x; i<n; i++)
#define all(x) x.begin(), x.end()

int main(){
  int n,num;
  cin >> n;
  vi d(n);
  rep(i,0,n){
    cin >> d[i];
  }

  sort(all(d));
  num= d[n/2]- d[n/2-1];
  cout << num << endl;
}


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

/** omgursocute **/
#include <bits/stdc++.h>

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n;
	cin >> n;
	int d[n+1];
	for(int i = 1; i <= n; i++) cin >> d[i];

	int ct = 0;
	sort(a+1, a+1+n);

	cout << a[n >> 1] - a[(n >> 1)-1];

	return 0;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:16:14: error: 'a' was not declared in this scope
   16 |         sort(a+1, a+1+n);
      |              ^
Language: C++

#include <bits/stdc++.h>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
using namespace std;
using lint = long long;
using pi = pair<lint, lint>;

int main(){
	int n; cin >> n; avector<int> v(n);
	for(auto &i : v) scanf("%d",&i);
	sort(all(v));
	printf("%d\n", v[n] - v[n-1]);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:26: error: 'avector' was not declared in this scope
    9 |         int n; cin >> n; avector<int> v(n);
      |                          ^~~~~~~
a.cc:9:34: error: expected primary-expression before 'int'
    9 |         int n; cin >> n; avector<int> v(n);
      |                                  ^~~
a.cc:10:23: error: 'v' was not declared in this scope
   10 |         for(auto &i : v) scanf("%d",&i);
      |                       ^
a.cc:11:18: error: 'v' was not declared in this scope
   11 |         sort(all(v));
      |                  ^
a.cc:3:17: note: in definition of macro 'all'
    3 | #define all(v) (v).begin(), (v).end()
      |                 ^
Language: C

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

int compare (const void *x, const void *y){

	const int *a = x, *b = y;
	
	if (x > y)
		return 1;
	else if (x < y)
		return -1;
	return 0;
}

int main(){

	int n, sum = 0;
	
	scanf("%d", &n);
	int a[n];
	for (int i = 0; i < n; i++)
		scanf("%d", &a[i]);
	qsort(a,n,sizeof(int),compare);=
	if (a[(n/2)-1] >= a[n/2]){
		printf("0\n");
		return 0;
	}
	for (int i = a[(n/2)-1]; i < a[n/2]; i++)
		sum++;
	printf("%d\n", sum);

	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:23:40: error: expected expression before '=' token
   23 |         qsort(a,n,sizeof(int),compare);=
      |                                        ^
Language: C

#include <stdio.h>
#include <std.lib>

int gio(const void *a, const void *b){
	int x = *((int *) a), y = *((int *) b);
	
	if(x > y)
		return -1;
		
	if(x < y)
		return 1;

	return 0;
}


int main(){
	int n;	
	scanf("%d", &n);
	
	int v[n];
	for(int i = 0; i < n; ++i)
		scanf("%d", &v[i]);
		
	qsort(v, n, sizeof(v[0]), gio);	
	
	int m = n/2;
	
	for(int g = 0; g < n; ++g){
		
	
	}

	return 0;
}


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

#include <stdio.h>
#include <stlib.h>

int ordena(const int *x, const int *y){
	const int *a = x;
	const int *b = y;
	if(a < b)
		return -1;
	else if(a > b)
		return 1;
	else return 0;
}

int main(){
	int n, k = 0;
	scanf("%d", &n);
	int vetor[n];
	int *vet = malloc(1 * sizeof(int)); 
	for(int i = 0; i < n; i++)
		scanf("%d", &vetor[i]);
	qsort(vetor,n,sizeof(int),ordena);
	int cont = 0;
	for(; cont < n/2; cont++){
		vet[cont] = vetor[cont]
		cont++;
		vet = realloc(vet,(cont+1) * sizeof(int)); 
	}
	if(cont == n/2
	


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

import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int[] d = new int[N+1];
		for( int i=1; i<=N; i++ ){
			d[i] = sc.nextInt();
		}
		Arrays.sort(d);
		System.out.pritnln(d[N/2]-d[N/2+1]);
	}
}


Compiler output:
Main.java:12: error: cannot find symbol
		System.out.pritnln(d[N/2]-d[N/2+1]);
		          ^
  symbol:   method pritnln(int)
  location: variable out of type PrintStream
1 error
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());

	int m = n/2;
	ans = d[m]-d[m-1];

	if(n%2 != 0){
		cout << 0 << endl;
	}

	else{
		cout << ans << endl;
	}

	
}

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

#include <iostream> 
#include <vector>
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());
  if (d[n/2-1]==d[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:10:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   10 |   sort(d.begin(),d.end());
      |   ^~~~
      |   short
Language: C++

// Compiled with: g++ -Wall -std=c++14 -pthread

#include <bits/stdc++.h>

using namespace std;
const int N = 1e5+5;

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


Compiler output:
a.cc: In function 'int main()':
a.cc:15:10: error: 'a' was not declared in this scope
   15 |     sort(a, a+n);
      |          ^
Language: C++

#include <bits/stdc++.h>

using  namespace std;

int main(){
    int N,ans;
    cin >> N;
    vector<int> D(N);

    for(int i=0;i<N;i++){
        cin >> D[i];
    }
    sort(D.begin(), D.end());
    int harfPoint = N/2;
    ans = D[harfPoint]-D[harfPoint-1];
    cout << ans << endl;
    return 0;
}
#include <bits/stdc++.h>

using  namespace std;

int main(){
    int N,ans;
    cin >> N;
    vector<int> D(N);

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


Compiler output:
a.cc:23:5: error: redefinition of 'int main()'
   23 | int main(){
      |     ^~~~
a.cc:5:5: note: 'int main()' previously defined here
    5 | int main(){
      |     ^~~~
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.at(i);
  }
  if(n%2==1){
    cout << 0 << endl;
  }
  int abc=0;
  int arc=0;
  int count=0;
  for(int k=1; k<1e5+1; k++){
    for(int i=0; i<n; i++){
      if(d.at(i) < k){
        abc++;
      }
      else if(d.at(i) >= k){
        arc++;
      }
    }
    if(abc == arc){
      count++
    }
  }
  cout << count << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:14: error: expected ';' before '}' token
   27 |       count++
      |              ^
      |              ;
   28 |     }
      |     ~
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());int mid1=(n-1)/2,mid2=mid1+1;cout<<d[mid2]-d[mid1]}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:3:146: error: expected ';' before '}' token
    3 | 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());int mid1=(n-1)/2,mid2=mid1+1;cout<<d[mid2]-d[mid1]}
      |                                                                                                                                                  ^
      |                                                                                                                                                  ;
a.cc: At global scope:
a.cc:4:1: error: expected declaration before '}' token
    4 | }
      | ^
Language: C

#include<stdio.h>
#include<algorithm>
using namespace std;
int main()
{
	long long n,i,t,ans;
	long long a[100010]={};
	while(~scanf("%lld",&n)){
		for(i=0;i<n;i++){
			scanf("%lld",&a[i]);
		}sort(a,a+n);
		t=n/2;
		ans=a[t]-a[t-1];
		printf("%lld\n",ans);
	}
}

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

#include<iostream>
using namespace std;
int main()
{
    int n,m;
    cin>>n>>m;
    int ans=0;
    int n1=n/2,m1=m/2;
    ans = n1*m1;
    int rem_n,rem_m;
    rem_n  = n-n1*2;
    rem_m = m-m1*2;
    if(rem_n==0 && rem_m==0)
    {
        ans=ans;
    }
    else if(rem_n==1 && rem_m==0)
    {
        ans+= m/2;
    }
    else if(rem_n==0 && rem_m==1)
    {
        ans+= n/2;
    }
    else
    {
        ans+=n/2+m/2+1;
    }
    cout<<ans<<endl;
}


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

n = int(input())
d = list(map(int,input().split()))
count = 0

d.sort()
m = int(n / 2)
i = d[m-2] + 1

while i<= d[m-1]:
  count +=1
  i +=1
  
print(count)

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n = 0;
	cin >> n;
	vector<int> v(n, 0);
	for (int i = 0; i < 100; i++)
	{
		cin >> v[i];
	}
	sort(v.begin(), v.end());
	d = v.size() / 2;
	k = v[d - 1] - v[d];
	cout << k;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: 'd' was not declared in this scope
   13 |         d = v.size() / 2;
      |         ^
a.cc:14:9: error: 'k' was not declared in this scope
   14 |         k = v[d - 1] - v[d];
      |         ^
Language: C++

#include <iostream>

using namespace std;

int main(void){
  int n, d[100000];
  int i, j, n;
  cin >> n;
  for(i = 0; i < n; i++){
    cin >> d[i];
  }
  for(i = 0; i < n; i++){
    for(j = i + 1; j < n; j++){
      if(d[i] < d[j]){
        n = d[i];
        d[i] = d[j];
        d[j] = n;
      }
    }
  }
  cout << d[n / 2 - 1] - d[ n / 2];

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:13: error: redeclaration of 'int n'
    7 |   int i, j, n;
      |             ^
a.cc:6:7: note: 'int n' previously declared here
    6 |   int n, d[100000];
      |       ^
Language: C

#include<stdio.h>

int main(void){
    int n;
    int i, j;
    int ans = 0;
    int a=0, k;
    int ave, sum = 0;
    scanf("%d",&n);
    int d[n];
    for(i=0;i<n;i++){
        scanf("%d",&d[i]);
        sum = sum + d[i];
    }
    ave = sum/n;

    for(k=ave/2;k<ave*3/2;k++){
        for(i=0;i<n;i++){    
            if(k-d[i]>=0){
                a = a + 1;
            }
            if(k-d[i]<0){
                a = a - 1;
            }
            if(a == 0){
                ans = ans + 1;
            }
    }
    printf("%d",ans);
    return 0;
    
}


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

#include<stdio.h>

int main(void){
    int n;
    int i, j;
    int ans = 0;
    int a=0, k;
    int ave, sum = 0;
    scanf("%d",&n);
    int d[n];
    for(i=0;i<n;i++){
        scanf("%d",&d[i]);
        sum = sum + d[i];
    }
    ave = sum/n;

    for(k=ave/2;k<ave*3/2;k++){
        for(i=0;i<n;i++){    
            if(k-d[i]>=0){
                a = a + 1;
            }
            if(k-d[i]<0){
                a = a - 1
            }
            if(a == 0){
                ans = ans +1
            }
    }
    printf("%d",ans);
    return 0;
    
}


Compiler output:
main.c: In function 'main':
main.c:23:26: error: expected ';' before '}' token
   23 |                 a = a - 1
      |                          ^
      |                          ;
   24 |             }
      |             ~             
main.c:26:29: error: expected ';' before '}' token
   26 |                 ans = ans +1
      |                             ^
      |                             ;
   27 |             }
      |             ~                
main.c:32:1: error: expected declaration or statement at end of input
   32 | }
      | ^