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

#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
#include <random>
#include <queue>
#include <deque>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;

const int INF = (1 << 30) - 1;
const ll INFLL= (1LL << 61) - 1;
const int MOD = 1000000007;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin>>N;
  vector<int> X(N);
  for(int i=0;i<N;i++)cin>>X[i];
  vector<int> Y(N){X};
  sort(ALL(X));
  for(int i=0;i<N;i++){
    if(Y[i]<=X[N/2-1])cout<<X[N/2]<<endl;
    else cout<<X[N/2-1]<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:19: error: expected ',' or ';' before '{' token
   32 |   vector<int> Y(N){X};
      |                   ^
Language: C++

#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
#include <random>
#include <queue>
#include <deque>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;

const int INF = (1 << 30) - 1;
const ll INFLL= (1LL << 61) - 1;
const int MOD = 1000000007;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin>>N;
  vector<int> X(N);
  for(int i=0;i<N;i++)cin>>X[i];
  vector<int> Y(N)=X;
  sort(ALL(X));
  for(int i=0;i<N;i++){
    if(Y[i]<=X[N/2-1])cout<<X[N/2]<<endl;
    else cout<<X[N/2-1]<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:19: error: expected ',' or ';' before '=' token
   32 |   vector<int> Y(N)=X;
      |                   ^
Language: C++

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


Compiler output:
a.cc: In function 'int main()':
a.cc:8:52: error: no match for 'operator=' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
    8 |   for(int i = 0 ;i < N ;i++)cin >> X.at(i) = Y.at(i);
      |                                                    ^
In file included from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
                 from a.cc:1:
/usr/include/c++/14/istream:718:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator=(std::basic_istream<_CharT, _Traits>&&) [with _CharT = char; _Traits = std::char_traits<char>]'
  718 |       operator=(basic_istream&& __rhs)
      |       ^~~~~~~~
/usr/include/c++/14/istream:718:33: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} to 'std::basic_istream<char>&&'
  718 |       operator=(basic_istream&& __rhs)
      |                 ~~~~~~~~~~~~~~~~^~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <list>

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
typedef long long ll;
int main() {
    int n;
    cin >> n;
    vector<int> a(n),b(n);
    rep(i, n) {
        int ai;
        cin >> ai;
        a[i] = ai;
        b[i] = ai;
    }
    sort(a.begin(), a.end());
    int ans1 = a[n/2-1];
    int ans2 = a[n/2];#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <list>

    using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
    typedef long long ll;
    int main() {
        int n;
        cin >> n;
        vector<int> a(n),b(n);
        rep(i, n) {
            int ai;
            cin >> ai;
            a[i] = ai;
            b[i] = ai;
        }
        sort(a.begin(), a.end());
        int ans1 = a[n/2-1];
        int ans2 = a[n/2];
        rep(i, n) {
            int num = b[i];
            if(num < ans2) cout << ans2 << endl;
            else cout << ans1 << endl;
        }

    }


    rep(i, n) {
        int num = b[i];
        if(num < ans2) cout << ans2 << endl;
        else cout << ans1 << endl;
    }

}



Compiler output:
a.cc:26:23: error: stray '#' in program
   26 |     int ans2 = a[n/2];#include <iostream>
      |                       ^
a.cc: In function 'int main()':
a.cc:26:24: error: 'include' was not declared in this scope
   26 |     int ans2 = a[n/2];#include <iostream>
      |                        ^~~~~~~
a.cc:26:41: error: expected primary-expression before '>' token
   26 |     int ans2 = a[n/2];#include <iostream>
      |                                         ^
a.cc:36:5: error: expected primary-expression before 'using'
   36 |     using namespace std;
      |     ^~~~~
a.cc:39:13: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   39 |     int main() {
      |             ^~
a.cc:39:13: note: remove parentheses to default-initialize a variable
   39 |     int main() {
      |             ^~
      |             --
a.cc:39:13: note: or replace parentheses with braces to value-initialize a variable
a.cc:39:16: error: a function-definition is not allowed here before '{' token
   39 |     int main() {
      |                ^
Language: C++

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

int main(){
  int n; cin>>n;
  long long x[n];
  for(int i=0;i<n;i++)cin>>x[i];
  for(int i=0;i<n;i++){
    x[i]=0;
    sort(x.begin(),x.end());
    cout<<x[n/2]<<endl;
  }
  return 0;
}

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

#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    int N;
    vector<long long> X(N);
    vector<long long> S(N);
    REP(i, N) { cin >> X[i]; }
    S = X;
    sort(S.begin(), S.end());
    long long tmp = S[(l + 1 / 2) - 1];
    REP(i, N) {
        if(X[i] <= S[(l + 1 / 2) - 1]) {
            cout << S[(l + 1 / 2) - 2] << endl;
        } else {
            cout << tmp << endl;
        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:24: error: 'l' was not declared in this scope
   39 |     long long tmp = S[(l + 1 / 2) - 1];
      |                        ^
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:10:10: error: expected unqualified-id before '=' token
   10 |   for(int=0;i<n;i++){
      |          ^
a.cc:10:10: error: expected ';' before '=' token
   10 |   for(int=0;i<n;i++){
      |          ^
      |          ;
a.cc:10:10: error: expected primary-expression before '=' token
a.cc:10:13: error: 'i' was not declared in this scope
   10 |   for(int=0;i<n;i++){
      |             ^
a.cc:10:16: error: expected ')' before ';' token
   10 |   for(int=0;i<n;i++){
      |      ~         ^
      |                )
a.cc:10:17: error: 'i' was not declared in this scope
   10 |   for(int=0;i<n;i++){
      |                 ^
Language: C++

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

int main() {
    int N;
    cin >> N;
    vector<int> X(N);
    for (int i = 0; i < N; i++)
        cin >> X[i];
    vector<int> v(N);
    copy(X.begin(), X.end(), v.begin());
    sort(X.begin(), X.end());

    int mid_1 = X[N / 2 - 1], mid_2 = X[N / 2];
    for (int i = 0; i < N; i++) {
        if (v[i] <= mid_1)
            cout << mid_2 << endl;
        else
            cout << mid_1 << 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(X.begin(), X.end());
      |     ^~~~
      |     short
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<bitset>
using namespace std;
const int INF = 1e9;
const long long LINF = 1e18;


int main(){
  int N;cin >> N;
  vector<pair<int,int>> X(N);
  for(int i = 0; i < N; i++){
    cin >> X[i].first();
    X[i].second() = X[i].first();
  }
  sort(X.becgin(),X.end());
  int m1 = X[N/2-1].first();
  int m2 = X[N/2].first();
  
  int ans = 0;
  for(int i = 0; i < N; i++){
    if(X[i].second() <= m1) ans = m2;
    if(X[i].second() >= m2) ans = m1;
    cout << ans << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:22: error: expression cannot be used as a function
   15 |     cin >> X[i].first();
      |            ~~~~~~~~~~^~
a.cc:16:16: error: expression cannot be used as a function
   16 |     X[i].second() = X[i].first();
      |     ~~~~~~~~~~~^~
a.cc:16:31: error: expression cannot be used as a function
   16 |     X[i].second() = X[i].first();
      |                     ~~~~~~~~~~^~
a.cc:18:10: error: 'class std::vector<std::pair<int, int> >' has no member named 'becgin'; did you mean 'begin'?
   18 |   sort(X.becgin(),X.end());
      |          ^~~~~~
      |          begin
a.cc:19:26: error: expression cannot be used as a function
   19 |   int m1 = X[N/2-1].first();
      |            ~~~~~~~~~~~~~~^~
a.cc:20:24: error: expression cannot be used as a function
   20 |   int m2 = X[N/2].first();
      |            ~~~~~~~~~~~~^~
a.cc:24:19: error: expression cannot be used as a function
   24 |     if(X[i].second() <= m1) ans = m2;
      |        ~~~~~~~~~~~^~
a.cc:25:19: error: expression cannot be used as a function
   25 |     if(X[i].second() >= m2) ans = m1;
      |        ~~~~~~~~~~~^~
Language: C++

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

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


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

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

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


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

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


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

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


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

import java.util.Arrays;
import java.util.Scanner;
public class At94 {
	public static void main(String[] args) {
		Scanner sc= new Scanner(System.in);
		int n = Integer.parseInt(sc.next()); //N
		int number[]= new int [n];
		int sub[] =new int [n];
		int a=0;
		for(int i=0;i<n;i++) {
			number[i]= Integer.parseInt(sc.next()); 
			sub[i]=number[i];
		}
		sc.close();
		for(int k=0;k<n;k++) {
			for(int i=0;i<n;i++) {
				number[i]=sub[i];
			}
			number[k]=0;
			Arrays.sort(number);
		}
		System.out.println(number[n/2]);
	}
}


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

import java.util.Scanner;
import java.io.*;
public class At94 {
	public static void main(String[] args) {
		Scanner sc= new Scanner(System.in);
		int n = Integer.parseInt(sc.next()); //N
		int number[]= new int [n];
		int sub[] =new int [n];
		int a=0;
		for(int i=0;i<n;i++) {
			number[i]= Integer.parseInt(sc.next()); 
			sub[i]=number[i];
		}
		for(int k=0;k<n;k++) {
			for(int i=0;i<n;i++) {
				number[i]=sub[i];
			}
			number[k]=0;
			for(int j=0;j<n-1;j++) {
				for(int i=0;i<n-1;i++) {
					if(number[i+1]>number[i]) {
						a = number[i];
						number[i]= number[i+1];
						number[i+1] =a;
					}		
				}
			}
			System.out.println(number[n/2-1]);
		}
	}
}


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

import java.util.Scanner;
import java.io.*;
public class At94 {
	public static void main(String[] args) {
		Scanner sc= new Scanner(System.in);
		int n = Integer.parseInt(sc.next()); //N
		int number[]= new int [n];
		int sub[] =new int [n];
		int a=0;
		for(int i=0;i<n;i++) {
			number[i]= Integer.parseInt(sc.next()); 
			sub[i]=number[i];
		}
		
		for(int k=0;k<n;k++) {
			for(int i=0;i<n;i++) {
				number[i]=sub[i];
			}
			number[k]=0;
			for(int j=0;j<n-1;j++) {
				for(int i=0;i<n-1;i++) {
					if(number[i+1]>number[i]) {
						a = number[i];
						number[i]= number[i+1];
						number[i+1] =a;
					}		
				}
			}
			System.out.println(number[n/2-1]);
		}
	}
}


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

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

public class C094 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int[] b = new int [a];
		for(int i = 0;i<a;i++) {
			b[i] = sc.nextInt();
		}
		int[] c = b.clone();
		Arrays.sort(c);
		int ookii = c[a/2-1];
		int tiisai = c[a/2];
		for(int i=0;i<a;i++) {
			if(b[i]<=ookii) {
				System.out.println(tiisai);
			}else{
				System.out.println(ookii);
			}
		}
	}
}

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

#include<bits/stdc++.h>
using namespace std;
int main(){
  int ぬ;
  cin>>ぬ;
  vector<int> えー(ぬ),びー(ぬ);
  for(int あい=0;あい<ぬ;あい++){
    cin>>えー[あい];
    びー[あい]=えー[あい];
  }
  sort(えー.begin(),えー.end());
  int しー=えー[ぬ/2-1],でー=えー[ぬ/2];
  for(int あい=0;あい<えぬ;あい++){
    if(びー[あい]<=しー){
      cout<<でー<<endl;
    }else{
      cout<<しー<<endl;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:23: error: '\U00003048\U0000306c' was not declared in this scope; did you mean 'あい'?
   13 |   for(int あい=0;あい<えぬ;あい++){
      |                       ^~~~
      |                       あい
Language: C++

#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;

ll gcd(ll x,ll y){
if(x==0) return y;
return gcd(y%x, x);
}
ll lcm(ll x,ll y) {return x*y/gcd(x,y);}

int main() {
 int n; cin>>n;
  int que[n]; 
  int quem[n];
  rep(i, n){cin>>que[i];
           quem[i]=que[i];}
  
  sort(que,que+n,greater<int>());
  int med=que[n-1];
  
 rep(i, n){
   if(quem[i]>=que[n-1])cout<<que[n]<<endl;
   else (quem[i]<que[i])cout<<que[n-1]<<endl;
  
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:25:25: error: expected ';' before 'cout'
   25 |    else (quem[i]<que[i])cout<<que[n-1]<<endl;
      |                         ^~~~
      |                         ;
a.cc:27:4: error: expected '}' at end of input
   27 |   }
      |    ^
a.cc:13:12: note: to match this '{'
   13 | int main() {
      |            ^
Language: C++

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

int main() {
	int N;
	cin>>N;
	vector<int> X(N);
	vector<int> Y(N);
	rep(i,N){
		cin>>X[i];
		Y[i]=X[i];
	}
	sort(all(Y));
	int ans = 0;
	rep(i,N){
		if(X[i]<=Y[N/2-1])ans = Y[N/2];
		else ans = Y[N/2-1];
		cout<<ans<<endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:14: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'?
   14 |         sort(all(Y));
      |              ^~~
      |              std::filesystem::perms::all
In file included from /usr/include/c++/14/filesystem:51,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200,
                 from a.cc:1:
/usr/include/c++/14/bits/fs_fwd.h:158:7: note: 'std::filesystem::perms::all' declared here
  158 |       all               =  0777,
      |       ^~~
Language: C++

#include <vector>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
  sync_with_stdio(false);
  int n;
  cin >> n;
  vector<ll> x(n), y(n);
  for(int i=0;i<n;i++) {
    cin >> x[i];
    y[i] = x[i];
  }

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

  for(int i=0;i<n;i++) {
    if(x[i] >= y[n/2]) {
      cout << y[n/2-1] << endl;
    } else {
      cout << y[n/2] << endl;
    }
  }

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:3: error: 'sync_with_stdio' was not declared in this scope
   15 |   sync_with_stdio(false);
      |   ^~~~~~~~~~~~~~~
Language: C++

#include <vector>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
  sync_with_stdio(false);
  int n;
  cin >> n;
  vector<ll> x(n), y(n);
  for(int i=0;i<n;i++) {
    cin >> x[i];
    y[i] = x[i];
  }

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

  for(int i=0;i<n;i++) {
    if(x[i] >= y[n/2]) {
      cout << y[n/2-1] << endl;
    } else {
      cout << y[n/2] << endl;
    }
  }

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:3: error: 'sync_with_stdio' was not declared in this scope
   14 |   sync_with_stdio(false);
      |   ^~~~~~~~~~~~~~~
Language: C++

#include <iostream>
using namespace std;
typedef long long ll;

int main()
{
    int n;
    cin >> n;
    ll x[200001], y[200001];
    for(int i = 0; i < n; i++){
        cin >> x[i];
        y[i] = x[i];
    }
    sort(y, y + n);
    int mid1 = y[n / 2 - 1];
    int mid2 = y[n / 2];
    for(int i = 0; i < n; i++){
        if(x[i] <= mid1){
            cout << mid2 << endl;
        }
        else{
            cout << mid1 << 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(y, y + n);
      |     ^~~~
      |     short
Language: C++

#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <algorithm>
#include <utility>
#include <vector>
#include <map>
using namespace std;
#define mp  std::make_pair
#define ll long long int
#define abs(n) ((n>0)?(n):((n)*(-1)))
#define CEIL(a,b) (((a) + ((b)-1)) / (b))
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
#define VREP(v) for(std::vector<ll>::iterator itr = (v).begin(); itr != (v).end();itr++)
#define VALL(v) ((v).begin(),(v).end())
#define errln(v) cerr << (v) << endl;
#define println(v) cout << (v) << endl;



int main(int argc, const char * argv[]) {
	int N;
	ll buf;
	cin >> N;
	int val[N];
	map<ll,int> xgr;
	int one=1;
	REP(i,N){
		cin >> buf;
		val[i] = buf;
		if(xgr.find(buf)!=xgr.end()){
			xgr.find(buf)->second++;
		}else{
			xgr.insert(mp<ll,int>(buf,one));
		}
	}

	ll a1=-1, a2=-1;
	int sum=0,prev_sum=0;
	for(std::map<ll,int>::iterator itr = xgr.begin();
			itr != xgr.end();itr++){
//		printf("%d %d\n",itr->first,itr->second);
		sum += itr-> second;
		if(sum==N/2){
			a1 = itr->first;
			cerr << "a1 : " << a1 << endl;
		}else if(sum > N/2){
			if(a1==-1){
				a1 =a2 = itr->first;
				cerr << "a1 & a2 : " << a1 << endl;
			}else{
				a2 = itr->first;
				cerr << "a2 : " << a2 << endl;
			}
			break;
		}
	}

	REP(i,N){
		if(val[i]<=a1){
			println(a2);
		}else{
			println(a1);
		}
	}


	return 0;

}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:36:47: error: cannot bind rvalue reference of type 'long long int&&' to lvalue of type 'long long int'
   36 |                         xgr.insert(mp<ll,int>(buf,one));
      |                                               ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_pair.h:1132:21: note:   initializing argument 1 of 'constexpr std::pair<typename std::__strip_reference_wrapper<typename std::decay<_Tp>::type>::__type, typename std::__strip_reference_wrapper<typename std::decay<_Tp2>::type>::__type> std::make_pair(_T1&&, _T2&&) [with _T1 = long long int; _T2 = int; typename __strip_reference_wrapper<typename decay<_Tp>::type>::__type = long long int; typename decay<_Tp>::type = long long int; typename __strip_reference_wrapper<typename decay<_Tp2>::type>::__type = int; typename decay<_Tp2>::type = int]'
 1132 |     make_pair(_T1&& __x, _T2&& __y)
      |               ~~~~~~^~~
Language: C++

#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <algorithm>
#include <utility>
#include <vector>
#include <map>
using namespace std;
#define mp  std::make_pair
#define ll long long int
#define abs(n) ((n>0)?(n):((n)*(-1)))
#define CEIL(a,b) (((a) + ((b)-1)) / (b))
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
#define VREP(v) for(std::vector<ll>::iterator itr = (v).begin(); itr != (v).end();itr++)
#define VALL(v) ((v).begin(),(v).end())
#define errln(v) cerr << (v) << endl;
#define println(v) cout << (v) << endl;



int main(int argc, const char * argv[]) {
	int N;
	ll buf;
	cin >> N;
	int val[N];
	map<ll,int> xgr;
	REP(i,N){
		cin >> buf;
		val[i] = buf;
		if(xgr.find(buf)!=xgr.end()){
			xgr.find(buf)->second++;
		}else{
			xgr.insert(mp<ll,int>(buf,(int)1));
		}
	}

	ll a1=-1, a2=-1;
	int sum=0,prev_sum=0;
	for(std::map<ll,int>::iterator itr = xgr.begin();
			itr != xgr.end();itr++){
//		printf("%d %d\n",itr->first,itr->second);
		sum += itr-> second;
		if(sum==N/2){
			a1 = itr->first;
			cerr << "a1 : " << a1 << endl;
		}else if(sum > N/2){
			if(a1==-1){
				a1 =a2 = itr->first;
				cerr << "a1 & a2 : " << a1 << endl;
			}else{
				a2 = itr->first;
				cerr << "a2 : " << a2 << endl;
			}
			break;
		}
	}

	REP(i,N){
		if(val[i]<=a1){
			println(a2);
		}else{
			println(a1);
		}
	}


	return 0;

}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:35:47: error: cannot bind rvalue reference of type 'long long int&&' to lvalue of type 'long long int'
   35 |                         xgr.insert(mp<ll,int>(buf,(int)1));
      |                                               ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_pair.h:1132:21: note:   initializing argument 1 of 'constexpr std::pair<typename std::__strip_reference_wrapper<typename std::decay<_Tp>::type>::__type, typename std::__strip_reference_wrapper<typename std::decay<_Tp2>::type>::__type> std::make_pair(_T1&&, _T2&&) [with _T1 = long long int; _T2 = int; typename __strip_reference_wrapper<typename decay<_Tp>::type>::__type = long long int; typename decay<_Tp>::type = long long int; typename __strip_reference_wrapper<typename decay<_Tp2>::type>::__type = int; typename decay<_Tp2>::type = int]'
 1132 |     make_pair(_T1&& __x, _T2&& __y)
      |               ~~~~~~^~~
Language: C++

#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <algorithm>
#include <utility>
#include <vector>
#include <map>
using namespace std;
#define mp  std::make_pair
#define ll long long int
#define abs(n) ((n>0)?(n):((n)*(-1)))
#define CEIL(a,b) (((a) + ((b)-1)) / (b))
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
#define VREP(v) for(std::vector<ll>::iterator itr = (v).begin(); itr != (v).end();itr++)
#define VALL(v) ((v).begin(),(v).end())
#define errln(v) cerr << (v) << endl;
#define println(v) cout << (v) << endl;



int main(int argc, const char * argv[]) {
	int N;
	ll buf;
	cin >> N;
	int val[N];
	map<ll,int> xgr;
	REP(i,N){
		cin >> buf;
		val[i] = buf;
		if(xgr.find(buf)!=xgr.end()){
			xgr.find(buf)->second++;
		}else{
			xgr.insert(mp<ll,int>(buf,1));
		}
	}

	ll a1=-1, a2=-1;
	int sum=0,prev_sum=0;
	for(std::map<ll,int>::iterator itr = xgr.begin();
			itr != xgr.end();itr++){
//		printf("%d %d\n",itr->first,itr->second);
		sum += itr-> second;
		if(sum==N/2){
			a1 = itr->first;
			cerr << "a1 : " << a1 << endl;
		}else if(sum > N/2){
			if(a1==-1){
				a1 = a2 = itr->first;
				cerr << "a1 & a2 : " << a1 << endl;
			}else{
				a2 = itr->first;
				cerr << "a2 : " << a2 << endl;
			}
			break;
		}
	}

	REP(i,N){
		if(val[i]<=a1){
			println(a2);
		}else{
			println(a1);
		}
	}


	return 0;

}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:35:47: error: cannot bind rvalue reference of type 'long long int&&' to lvalue of type 'long long int'
   35 |                         xgr.insert(mp<ll,int>(buf,1));
      |                                               ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_pair.h:1132:21: note:   initializing argument 1 of 'constexpr std::pair<typename std::__strip_reference_wrapper<typename std::decay<_Tp>::type>::__type, typename std::__strip_reference_wrapper<typename std::decay<_Tp2>::type>::__type> std::make_pair(_T1&&, _T2&&) [with _T1 = long long int; _T2 = int; typename __strip_reference_wrapper<typename decay<_Tp>::type>::__type = long long int; typename decay<_Tp>::type = long long int; typename __strip_reference_wrapper<typename decay<_Tp2>::type>::__type = int; typename decay<_Tp2>::type = int]'
 1132 |     make_pair(_T1&& __x, _T2&& __y)
      |               ~~~~~~^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main () {
  int N;
  cin >> N;
  vector<int> dataa(N), datab(N);
  int a;
  for(int i = 0; i < N; i++) {
    cin >> a;
    dataa.at(i) = a;
    datab.at(i) = a;
  }
  sort(dataa.begin(), dataa.end());
  int med1, med2;
  med1 = dataa.at(N/2 - 1);
  med2 = dataa.at(N/2);
  for(int i = 0; i < N; i++) {
    if (data.at(i) <= med1) cout << med2 << endl;
    else if (data.at(i) >= med2) cout << med1 << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:14: error: overloaded function with no contextual type information
   18 |     if (data.at(i) <= med1) cout << med2 << endl;
      |              ^~
a.cc:19:19: error: overloaded function with no contextual type information
   19 |     else if (data.at(i) >= med2) cout << med1 << endl;
      |                   ^~
Language: C++

'use strict'

let maxnum = 109

function countingSort(arr) {
  const sorted = []
  let tmp = Array.apply(null, { length: maxnum + 1 }).map(v => 0)
  // console.log(tmparr.length)
  for (let i in arr) {
    tmp[arr[i]]++
  }
  for (let i in tmp) {
    while (tmp[i]) {
      sorted.push(~~i)
      tmp[i]--
    }
  }
  // console.log(sorted)

  return sorted
}

function main(input) {
  input = input.split(/\n|\s/).map(v => ~~v)
  const n = input[0]
  const arr = input.slice(1, n + 1)
  const sorted = countingSort(arr)

  const mid = sorted[n / 2]
  // console.log(arr, sorted, mid)
  // console.log('-------')

  // console.log(mid)

  // let ans = []
  for (let i = 0; i < n; i++) {
    if (arr[i] < mid) {
      console.log(mid)
    } else {
      console.log(sorted[n / 2 - 1])
    }
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))

Compiler output:
a.cc:1:1: warning: multi-character literal with 10 characters exceeds 'int' size of 4 bytes
    1 | 'use strict'
      | ^~~~~~~~~~~~
a.cc:24:24: error: stray '\' in program
   24 |   input = input.split(/\n|\s/).map(v => ~~v)
      |                        ^
a.cc:24:27: error: stray '\' in program
   24 |   input = input.split(/\n|\s/).map(v => ~~v)
      |                           ^
a.cc:45:14: warning: multi-character character constant [-Wmultichar]
   45 | main(require('fs').readFileSync('/dev/stdin', 'utf8'))
      |              ^~~~
a.cc:45:33: warning: multi-character literal with 10 characters exceeds 'int' size of 4 bytes
   45 | main(require('fs').readFileSync('/dev/stdin', 'utf8'))
      |                                 ^~~~~~~~~~~~
a.cc:45:47: warning: multi-character character constant [-Wmultichar]
   45 | main(require('fs').readFileSync('/dev/stdin', 'utf8'))
      |                                               ^~~~~~
a.cc:1:1: error: expected unqualified-id before '\x72696374'
    1 | 'use strict'
      | ^~~~~~~~~~~~
a.cc:23:1: error: 'function' does not name a type; did you mean 'union'?
   23 | function main(input) {
      | ^~~~~~~~
      | union
a.cc:45:5: error: expected constructor, destructor, or type conversion before '(' token
   45 | main(require('fs').readFileSync('/dev/stdin', 'utf8'))
      |     ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define lint long long

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

Compiler output:
a.cc:27:1: error: 'v' does not name a type
   27 | v
      | ^
Language: C++

#include <iostream>
using namespace std;

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

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

    sort(sort_x, sort_x + n);

    int a = sort_x[n/2 - 1];
    int b = sort_x[n/2];

    for (int i = 0; i < n; i++) {
        if (x[i] < b) {
            cout << b << endl;
        }
        else {
            cout << a << 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(sort_x, sort_x + n);
      |     ^~~~
      |     short
Language: C++

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

int main() {
	int N;
	cin >> N;
	vector<int> vec(N);
	vector<int> hoge;
	for(int a=0;a<N;a++){
		cin >> vec[a];
	}
	hoge=vec;
	sort(vec.begin(),vec.end());
	int median=vec.at(N/2-1);
	int median2=vec.at(N/2);
	for(int a=0 : hoge){
		if(a>median){
			cout << median << " " << endl;
		}else{
			cout << median2 << " " << endl;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:18: error: initializer in range-based 'for' loop
   16 |         for(int a=0 : hoge){
      |                  ^
Language: C++

#include <iostream>
using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int> vec(N);
	vector<int> hoge;
	for(int a=0;a<N;a++){
		cin >> vec[a];
	}
	hoge=vec;
	sort(vec.begin(),vec.end());
	int median=vec.at(N/2-1);
	int median2=vec.at(N/2);
	for(int a=0 : hoge){
		if(a>median){
			cout << median << " " << endl;
		}else{
			cout << median2 << " " << endl;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'vector' was not declared in this scope
    7 |         vector<int> vec(N);
      |         ^~~~~~
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:16: error: expected primary-expression before 'int'
    7 |         vector<int> vec(N);
      |                ^~~
a.cc:8:16: error: expected primary-expression before 'int'
    8 |         vector<int> hoge;
      |                ^~~
a.cc:10:24: error: 'vec' was not declared in this scope
   10 |                 cin >> vec[a];
      |                        ^~~
a.cc:12:9: error: 'hoge' was not declared in this scope
   12 |         hoge=vec;
      |         ^~~~
a.cc:12:14: error: 'vec' was not declared in this scope
   12 |         hoge=vec;
      |              ^~~
a.cc:13:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   13 |         sort(vec.begin(),vec.end());
      |         ^~~~
      |         short
a.cc:16:18: error: initializer in range-based 'for' loop
   16 |         for(int a=0 : hoge){
      |                  ^
Language: C++

#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
    int n,c;
    vector<int> a,b;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&c);
        a.push_back(c);
    }
    for(int i=0;i<n;i++){
        b=a;
        b.elase(b.begin()+i)
        sort(b.begin(),b.end());
        
        printf("%d\n",b[(n-1)/2]);
    }
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:11: error: 'class std::vector<int>' has no member named 'elase'; did you mean 'erase'?
   15 |         b.elase(b.begin()+i)
      |           ^~~~~
      |           erase
Language: C++

#include<iostream>
#include <vector>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<long> x(n+1);
    for(int i = 1; i <=n; i++){
        cin >> x[i];
    }
    vector<long> y = x;
    sort(y.begin()+1, y.end());

    for(int i = 1; i <=n; i++) {
        if (x[i] <= y[n / 2]) cout << y[n / 2 + 1];
        else cout << y[n / 2];
    }
    return 0;
}

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

#include<iostream>
#include <vector>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<long> x(n+1);
    for(int i = 1; i <=n; i++){
        cin >> x[i];
    }
    vector<long> y = x;
    sort(y.begin()+1, y.end());

    for(int i = 1; i <=n; i++) {
        if (x[i] <= y[n / 2]) cout << y[n / 2 + 1];
        else cout << y[n / 2];
    }
    return 0;

}

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

import java.io.IOException;
import java.util.NoSuchElementException;

import java.io.InputStream;

import java.util.Arrays;
import java.util.Comparator;

@SuppressWarnings("unchecked")
public class Main {
    public static void main(String[] args) throws IOException {
        FastScanner fs = new FastScanner();

        final int N = fs.nextInt();

        Integer[] X = new Integer[N];
        Integer[] Y = new Integer[N];

        for (int i = 0; i < N; i++) {
            X[i] = fs.nextInt();
            Y[i] = A[i];
        }

        Arrays.sort(Y, Comparator.reverseOrder());

        Integer left = Y[N / 2 - 1];
        Integer right = Y[N / 2];

        for (int i = 0; i < N; i++)
            System.out.println(left.compareTo(X[i]) <= 0 ? right : left);
    }
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() {
        if (hasNextByte()) return buffer[ptr++];
        else return -1;
    }
    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }
    public boolean hasNext() {
        while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
        return hasNextByte();
    }
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if(b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


Compiler output:
Main.java:21: error: cannot find symbol
            Y[i] = A[i];
                   ^
  symbol:   variable A
  location: class Main
1 error
Language: Java

import java.io.IOException;
import java.util.NoSuchElementException;

import java.io.InputStream;

import java.util.Arrays;
import java.util.Comparator;

@SuppressWarnings("unchecked")
public class Main {
    public static void main(String[] args) throws IOException {
        FastScanner fs = new FastScanner();

        final int N = fs.nextInt();

        Integer[] X = new Integer[N];

        for (int i = 0; i < N; i++) X[i] = fs.nextInt();

        Integer[] Y = new Integer[N];

        System.arraycopy(X, 0, Y, 0, X.length);

        Arrays.sort(Y, Comparator.reverseOrder());

        Integer left = Y[N / 2 - 1];
        Integer right = Y[N / 2];

        for (int i = 0; i < N; i++)
            System.out.println(left.compareTo(X[i]) <= 0 ? right : left);
        }
    }
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() {
        if (hasNextByte()) return buffer[ptr++];
        else return -1;
    }
    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }
    public boolean hasNext() {
        while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
        return hasNextByte();
    }
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if(b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


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

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

const int N = 2e5 + 5;
pair< int, int> p[N];
int index[N];

int main() {
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) {
        scanf("%d", &p[i].first);
        p[i].second = i;
    }
    sort(p + 1, p + 1 + n);
    for (int i = 1; i <= n; ++i) index[p[i].second] = i;
    for (int i = 1; i <= n; ++i) {
        if (index[i] <= n / 2) printf("%d\n", p[n / 2 + 1].first);
        else printf("%d\n", p[n / 2].first);
    }
}

Compiler output:
a.cc:6:12: error: 'int index [200005]' redeclared as different kind of entity
    6 | int index[N];
      |            ^
In file included from /usr/include/string.h:462,
                 from /usr/include/c++/14/cstring:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
                 from a.cc:1:
/usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)'
   50 | extern const char *index (const char *__s, int __c)
      |                    ^~~~~
a.cc: In function 'int main()':
a.cc:16:39: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   16 |     for (int i = 1; i <= n; ++i) index[p[i].second] = i;
      |                                       ^
a.cc:18:18: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   18 |         if (index[i] <= n / 2) printf("%d\n", p[n / 2 + 1].first);
      |                  ^
Language: Java

import java.util.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(in);
int n = Integer.parseInt(sc.next());
int[] x=new int[n+1];
    for (int i = 1; i <= n; i++) {
        x[i]=Integer.parseInt(sc.next());
    }
  Arrays.sort(x);
  int ans=0;
    for (int i = 1; i <= n; i++) {
      if(i<=n/2){ans=n/2+1;}else{ans=n/2;}
    out.prinntln(x[ans]);
    }
}
}


Compiler output:
Main.java:16: error: cannot find symbol
    out.prinntln(x[ans]);
       ^
  symbol:   method prinntln(int)
  location: variable out of type PrintStream
1 error
Language: C++

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

int main() {
	int N;
	cin >> N;
	int x[N];
	int c[N];
	for (int i = 0;i < N;i++) {
		cin >> x[N];
		c[N] = x[N];
	}
	int b[i];
	sort(c,c+N);
	for (int i = 0;i < N;i++) {
		if (x[i] <= c[N/2-1]) {
			cout << c[N/2] << endl;
		} else {
			cout << c[N/2-1] << endl;
		}
	}
}

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

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

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

}


int main(void){
  int N;
  scanf("%d",&N);
  int R[N];
  int X[N];
  }
  
  qsort(X,N,sizeof(int),compare);
  for(int i=0;i<N;i++){
    printf("%d",X[i]);
  }
  for(int i=0;i<N;i++){
    if(R[i]<=X[N/2]){
      printf("%d",X[N/2+1]);
    }
    else{
      printf("%d",X[N/2]);
    }
  }
  return 0;
}


Compiler output:
a.cc:18:8: error: expected constructor, destructor, or type conversion before '(' token
   18 |   qsort(X,N,sizeof(int),compare);
      |        ^
a.cc:19:3: error: expected unqualified-id before 'for'
   19 |   for(int i=0;i<N;i++){
      |   ^~~
a.cc:19:15: error: 'i' does not name a type
   19 |   for(int i=0;i<N;i++){
      |               ^
a.cc:19:19: error: 'i' does not name a type
   19 |   for(int i=0;i<N;i++){
      |                   ^
a.cc:22:3: error: expected unqualified-id before 'for'
   22 |   for(int i=0;i<N;i++){
      |   ^~~
a.cc:22:15: error: 'i' does not name a type
   22 |   for(int i=0;i<N;i++){
      |               ^
a.cc:22:19: error: 'i' does not name a type
   22 |   for(int i=0;i<N;i++){
      |                   ^
a.cc:30:3: error: expected unqualified-id before 'return'
   30 |   return 0;
      |   ^~~~~~
a.cc:31:1: error: expected declaration before '}' token
   31 | }
      | ^
Language: C++

// Many Medians

#include <iostream>

using namespace std;

int main(){
	int N;
	cin >> N;
	int X[N];
	int sortedX[N];

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

	sort(sortedX, sortedX+N);

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

	return 0;
}

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