stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include <bits/stdc++.h>

// #include <atcoder/all>

#define ll long long int

#define ld long double

#define yorn(f) std::cout<<((f)?"Yes":"No")<<endl;

#define YORN(f) std::cout<<((f)?"YES":"NO")<<endl;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

#define repi(i, n) for (int i = 1; i < (int)(n); i++)

#define all(x) (x).begin(), (x).end()

#define put(x) std::cout << x << endl;

#define println(x) std::cout << x << endl;

template<typename T>bool mins(T& x,const T&y){if(x>y){x=y;return true;}else return false;}

template<typename T>bool maxs(T& x,const T&y){if(x<y){x=y;return true;}else return false;}

using namespace std;

// using namespace atcoder;

int N;

ll A[303];



void Main()

{

	int i,j,k,l,r,x,y; string s;

	

	cin>>N;

	rep(i,N) cin>>A[i];

	ll xo=0;

	for(i=2;i<N;i++) xo^=A[i];

	

	vector<int> cand;

	rep(i,1<<20) if(i<A[0]) {

		ll v=(A[0]-i)^(A[1]+i)^xo;

		if((v&((1<<20)-1))==0) cand.push_back(i);

	}

	

	ll mi=1LL<<50;

	for(auto c : cand) {

		for(ll a=c;a<min(mi,A[0]);a+=1<<20) {

			ll v=(A[0]-a)^(A[1]+a)^xo;

			if(v==0) mi=min(mi,a);

		}

	}

	

	if(mi==1LL<<50) mi=-1;

	cout<<mi<<endl;

}

signed main(){ Main();return 0;}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

// #include <atcoder/all>

#define ll long long int

#define ld long double

#define yorn(f) std::cout<<((f)?"Yes":"No")<<endl;

#define YORN(f) std::cout<<((f)?"YES":"NO")<<endl;

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

#define repi(i, n) for (ll i = 1; i < (ll)(n); i++)

#define all(x) (x).begin(), (x).end()

#define put(x) std::cout << x << endl;

#define println(x) std::cout << x << endl;

template<typename T>bool mins(T& x,const T&y){if(x>y){x=y;return true;}else return false;}

template<typename T>bool maxs(T& x,const T&y){if(x<y){x=y;return true;}else return false;}

using namespace std;

// using namespace atcoder;



ll A[301];



void Main()

{

    ll n;

    cin >> n;

    rep(i, n) cin >> A[i];



    ll X = 0; // target xor

    for (ll i = 2; i < n; i++) X ^= A[i];



	// vector<int> cand;

	// rep(i,1<<20) if(i<A[0]) {

	// 	ll v=(A[0]-i)^(A[1]+i)^X;

	// 	if((v&((1<<20)-1))==0) cand.push_back(i);

	// }

	

	// ll mi=1LL<<50;

	// for(auto c : cand) {

	// 	for(ll a=c;a<min(mi,A[0]);a+=1<<20) {

	// 		ll v=(A[0]-a)^(A[1]+a)^X;

	// 		if(v==0) mi=min(mi,a);

	// 	}

	// }



	// if(mi==1LL<<50) mi=-1;

	// cout<<mi<<endl;



    vector<ll> cand;

    ll mask = (1LL << 20) - 1;

    rep(a, 1LL << 20) {

        if (a > A[0]) {

            break;

        }

        ll v = (A[0]-a)^(A[1]+a)^X;

        if ((v & mask) == 0) {

            cand.push_back(a);

        }

    }



    ll ma = -1;

    for (ll a1: cand) {

        for (ll a = a1; a < A[0]; a += 1LL << 20) {

            ll v = (A[0]-a)^(A[1]+a)^X;

            if (v == 0) {

                ma = max(ma, A[0]-a);

                break;

            }

        }

    }



    if (ma < 0) {

        put(-1);

        return;        

    }



    ll res = A[0] - ma;

    put(res);

}

signed main(){ Main();return 0;}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int N;

long A,B,S;

long ok[2][2];

main()

{

	for(int i=0;i<2;i++)for(int j=0;j<2;j++)ok[i][j]=-1;

	cin>>N>>A>>B;

	for(int i=2;i<N;i++)

	{

		long T;cin>>T;S^=T;

	}

	long uA=A>>20,dA=A&(1<<20)-1;

	long uB=B>>20,dB=B&(1<<20)-1;

	long uS=S>>20,dS=S&(1<<20)-1;

	for(long k=0;k<=uA;k++)

	{

		for(int i=0;i<2;i++)for(int j=0;j<2;j++)

		{

			if(k+i>uA)continue;

			if((uA-k-i^uB+k+j)==uS&&ok[i][j]==-1)ok[i][j]=k;

		}

	}

	long ans=A;

	for(long k=0;k<1<<20;k++)

	{

		if(dA>=k)

		{

			if(((dA-k)^(dB+k)&(1<<20)-1)==dS)

			{

				int j=dB+k>=1<<20;

				if(ok[0][j]!=-1)

				{

					long tmp=ok[0][j]<<20|k;

					if(ans>tmp)ans=tmp;

				}

			}

		}

		else

		{

			if(((dA+(1<<20)-k)^(dB+k)&(1<<20)-1)==dS)

			{

				int j=dB+k>=1<<20;

				if(ok[1][j]!=-1)

				{

					long tmp=ok[1][j]<<20|k;

					if(ans>tmp)ans=tmp;

				}

			}

		}

	}

	if(ans==A)ans=-1;

	cout<<ans<<endl;

}


// Optimized solution to the same problem (faster):
#include<iostream>

#include<algorithm>

using namespace std;

int N;

long A,B,S;

long dp[50][2][2];

main()

{

	cin>>N>>A>>B;

	for(int i=2;i<N;i++)

	{

		long x;cin>>x;S^=x;

	}

	for(int i=0;i<50;i++)

	{

		int a=A>>i&1,b=B>>i&1;

		for(int j=0;j<2;j++)for(int k=0;k<2;k++)

		{

			long now=A;

			for(int J=0;J<2;J++)for(int K=0;K<2;K++)for(int x=0;x<2;x++)

			{

				int aa=a+2*j-x-J,bb=b-2*k+x+K;

				if(0<=aa&&aa<=1&&0<=bb&&bb<=1&&(aa^bb)==(S>>i&1))

				{

					if(i==0)

					{

						if(J==0&&K==0)now=min(now,(long)x);

					}

					else

					{

						now=min(now,dp[i-1][J][K]+((long)x<<i));

					}

				}

			}

			dp[i][j][k]=now;

		}

	}

	long ans=dp[49][0][0];

	cout<<(ans<A?ans:-1)<<endl;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):


#include <cstdio>

#include <map>

using namespace std;

map<int,int> m;

int a[200001];

int main(int argc, const char * argv[]) {

   

    int n;

    

    scanf("%d\n",&n);

    

    for(int i=0;i<n;i++){

        

        int tmp;

        scanf("%d",&tmp);

        m[tmp]++;//첫글자로 자동정렬

        a[i]=tmp;

    }

    int med = n/2;

    int sum = 0;

    int num = 0;

    int next = -1;

    for(map<int,int>::iterator it = m.begin(); it!=m.end();it++){

        map<int,int>::iterator tmp=it;

        next = (++tmp)->first;

        sum += it->second;

        if(sum >=med) {

            num = it->first;

            break;

        }

        

    }

    for(int i=0;i<n;i++){

        

        int v = a[i];

        

        if(v <= num){

            if(sum-1 >= med) printf("%d\n",num);//다음위치

            else printf("%d\n",next);

        }else{

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

        }

        

        

    }

    

    

    return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include <algorithm>

using namespace std;



int x[200001];

int y[200001];



int main(){

    

    

    int n;

    scanf("%d",&n);

    

    for(int i=1;i<=n;i++){

        scanf("%d",&x[i]);

        y[i] = x[i];

    }

    

    sort(y+1,y+n+1);

    int med = y[n/2];

    

    for(int i=1;i<=n;i++){

        if(x[i] > med) printf("%d\n",med);

        else printf("%d\n",y[n/2+1]);

    }

    

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <algorithm>

using namespace std;



int a[200010], b[200010], n;



int main() {

    ios::sync_with_stdio(0);

    cin.tie(NULL);

    cin >> n;

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

    sort(a + 1, a + n + 1);

    int mid = n / 2 + 1;

    for(int i = 1; i <= n; ++i) {

        if(b[i] < a[mid]) cout << a[mid];

        else cout << a[mid - 1];

        cout << endl;

    }

    return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<algorithm>

using namespace std;

#define fup(i,a,b) for(int i=a;i<=b;++i)



int x[200004],y[200004];

void Main()

{

    int n,nn;

    scanf("%d",&n);

    nn=n/2;

    fup(i,1,n)scanf("%d",&x[i]),y[i]=x[i];

    sort(y,y+1+n);

    int t=y[nn],tz=y[nn-1],ty=y[nn+1],sz=0,sy=0;

    {

        int i=nn,j=nn;

        while(y[--i]==t)++sz;

        while(y[++j]==t)++sy;

    }

    if(sz&&sy)fup(i,1,n)printf("%d\n",t);

    else if(!sz&&sy)fup(i,1,n)printf("%d\n",t);

    else if(sz&&!sy)fup(i,1,n)

    {

        if(x[i]<=t)printf("%d\n",ty);

        else printf("%d\n",t);

    }

    else fup(i,1,n)

    {

        if(x[i]<=t)printf("%d\n",ty);

        else printf("%d\n",t);

    }

}

int main()

{

Main();

return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
	#include <iostream>

	#include <string>

	#include <stdio.h>

	#include <queue>

	#include <stack>

	#include <string.h>

	#include <algorithm>

	#include <math.h>

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

	#define ll long long

	#define wtcl return

	using namespace std;

	

	inline int read()

	{

	    ll s = 0, f = 1;

	    char ch = getchar();

	    for(; ch < '0' || ch > '9'; ch = getchar()) if(ch == '-') f = - 1;

	    for(; ch >= '0' && ch <= '9'; ch = getchar()) s = ((s << 3ll) + (s << 1ll) + (ch ^ 48ll));

	    return s * f ;

	}

	

	int main()

	{

	    int n;

	    while(cin>>n)

	    {

	    	int num[200005];

	    	int a[200005];

	    	for(int i=0;i<n;i++)

	    	{

	    		num[i] = read();

	    		a[i] = num[i];

			}

			sort(a,a+n);

			for(int i=0;i<n;i++)

			{

				int pos = upper_bound(a,a+n,num[i])-a;

				//cout<<pos<<" ";

				if(pos<=(n/2))

					cout<<a[n/2]<<endl;

				else cout<<a[n/2-1]<<endl;

			}

	    		

		}

	    wtcl 0;

	}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<algorithm>

using namespace std;

#define fup(i,a,b) for(int i=a;i<=b;++i)



int x[200004],y[200004];

void Main()

{

    int n,nn;

    scanf("%d",&n);

    nn=n/2;

    fup(i,1,n)scanf("%d",&x[i]),y[i]=x[i];

    sort(y,y+1+n);

    int t=y[nn],tz=y[nn-1],ty=y[nn+1],sz=0,sy=0;

    {

        int i=nn,j=nn;

        while(y[--i]==t)++sz;

        while(y[++j]==t)++sy;

    }

    if(sz&&sy)fup(i,1,n)printf("%d\n",t);

    else if(!sz&&sy)fup(i,1,n)printf("%d\n",t);

    else if(sz&&!sy)fup(i,1,n)

    {

        if(x[i]<=t)printf("%d\n",ty);

        else printf("%d\n",t);

    }

    else fup(i,1,n)

    {

        if(x[i]<=t)printf("%d\n",ty);

        else printf("%d\n",t);

    }

}

int main()

{

Main();

return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<algorithm>

#include<string.h>

using namespace std;

int a[200000];

int b[200000];

/*int sort(int a[],int low,int high)

{

	int i=low,j=high,base=a[low];

	if(i>=j)

		return 0;

	while(i<j)

	{

		while(i<j&&a[j]>=base)

			j--;

		a[i]=a[j];

		while(i<j&&a[i]<=base)

			i++;

		a[j]=a[i];

	}

	a[i]=base;

	sort(a,low,i-1);

	sort(a,i+1,high);

	return 0;

}*/

int main()

{

	int i,k,n;

	scanf("%d",&n);

	for(i=0;i<n;i++)

	{

		scanf("%d",&a[i]);

		b[i]=a[i];

	}

	sort(a,a+n);

	k=(n-1)/2;

	for(i=0;i<n;i++)

	{

		if(b[i]>a[k])

			printf("%d\n",a[k]);

		else

			printf("%d\n",a[k+1]);

	}

	return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<algorithm>

using namespace std;

#define fup(i,a,b) for(int i=a;i<=b;++i)



int x[200004],y[200004];

void Main()

{

    int n,nn;

    scanf("%d",&n);

    nn=n/2;

    fup(i,1,n)scanf("%d",&x[i]),y[i]=x[i];

    sort(y,y+1+n);

    int t=y[nn],tz=y[nn-1],ty=y[nn+1],sz=0,sy=0;

    {

        int i=nn,j=nn;

        while(y[--i]==t)++sz;

        while(y[++j]==t)++sy;

    }

    if(sz&&sy)fup(i,1,n)printf("%d\n",t);

    else if(!sz&&sy)fup(i,1,n)printf("%d\n",t);

    else if(sz&&!sy)fup(i,1,n)

    {

        if(x[i]<=t)printf("%d\n",ty);

        else printf("%d\n",t);

    }

    else fup(i,1,n)

    {

        if(x[i]<=t)printf("%d\n",ty);

        else printf("%d\n",t);

    }

}

int main()

{

Main();

return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<stdio.h>

#include<math.h>

#include<iostream>

#include<algorithm>

#include<string.h>

#define ll long long

using namespace std;

int a[200004];

int b[200004];

int main()

{

	int n;

	scanf("%d",&n);

	for(int i=1;i<=n;i++)

	{

		scanf("%lld",&a[i]);

		b[i]=a[i];

	}

	sort(a+1,a+1+n);

	int m=n/2;

	for(int i=1;i<=n;i++)

	{

		if(b[i]<=a[m])

		printf("%d\n",a[m+1]);

		else

		printf("%d\n",a[m]);

	}

	return 0;

}

//const int maxm=100+10; 

//bool   f[maxm],   //f[i]表示切割在j位置时1~j是否存在i字符  

//q[maxm];   //q[i]表示切割在j位置时j+1~n是否存在i字符 

//int main(){

//    int n, //字符串长度 

//        now,  //当前不同字符数 

//        ans;  //已知最大不同字符数(初始值为0) 

//    register int i,j;

//    char s[maxm]; 

//    scanf("%d",&n);    //读入字符串的长度 

//    scanf("%s",s);     //读入的字符串 

//    for(i=0;i<n;i++){  //枚举切割点 

//        f[s[i]-'a']=true;     

//        //当前i位置的字符在f中标记为存在 

//        memset(q,false,sizeof(q));    //初始化q数组 

//        for(j=i+1;j<n;j++){   

//            //当前j位置的字符在q中标记为存在 

//            q[s[j]-'a']=true;  

//        }

//        now=0;    //初始化now 

//        for(j=0;j<26;j++){

//            if(f[j] && q[j]){    

//                //如果两串中拥有相同字符那么记入到now中 

//                now++; 

//            } 

//        } 

//        ans=max(ans,now); 

//        //若当前不同字符数大于已知不同字符则更新答案 

//    }

//    printf("%d",ans);  //打印答案 

//    return 0; 

//}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<algorithm>

using namespace std;

#define fup(i,a,b) for(int i=a;i<=b;++i)



int x[200004],y[200004];

void Main()

{

    int n,nn;

    scanf("%d",&n);

    nn=n/2;

    fup(i,1,n)scanf("%d",&x[i]),y[i]=x[i];

    sort(y,y+1+n);

    int t=y[nn],tz=y[nn-1],ty=y[nn+1],sz=0,sy=0;

    {

        int i=nn,j=nn;

        while(y[--i]==t)++sz;

        while(y[++j]==t)++sy;

    }

    if(sz&&sy)fup(i,1,n)printf("%d\n",t);

    else if(!sz&&sy)fup(i,1,n)printf("%d\n",t);

    else if(sz&&!sy)fup(i,1,n)

    {

        if(x[i]<=t)printf("%d\n",ty);

        else printf("%d\n",t);

    }

    else fup(i,1,n)

    {

        if(x[i]<=t)printf("%d\n",ty);

        else printf("%d\n",t);

    }

}

int main()

{

Main();

return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

#define ll long long int

#define ld long double

#define pii pair<int,int>

#define pll pair<ll,ll>

#define rep(n) for(int i=0;i<n;i+=1)

#define prarr(a,n) rep(n) cout<<a[i]<<endl printf("%s\n"," " );

#define sc(a) scanf("%d",&a);

#define scl(a) scanf("%lld",&a);

#define scf(a) ascanf("%f",&a);

#define fi first

#define se second

#define pu push_back

#define inf 1000000001

#define MOD 1000000007 

#define INF 100000000000001

const int MAXN = 2e5+10;

int main()

{

    ios::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);

    map<int,vector<int>> m;

    map<int,int> ans;

    int n;

    pii a[MAXN];

    int b[MAXN]={0};

    cin>>n;

    rep(n) 

    {

        cin>>a[i].fi;

        a[i].se = i;

        // m[a[i]].pu(i);

    }

    sort(a,a+n);

    rep(n)

    {

        if((i+1)<=n/2)

            ans[a[i].se] = a[n/2].fi;

        else

            ans[a[i].se] = a[n/2-1].fi;     

    }

    rep(n)

    {

        cout<<ans[i]<<endl; 

    }

    return 0;



}

    

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<stdlib.h>

int a[200005],temp[200005];

int inc(const void *a, const void *b)

{

    return *(int*)a-*(int*)b;

}

int main()

{

	int n;

	scanf("%d",&n);

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

	for(int i=0;i<n;i++)temp[i]=a[i];

	qsort(a,n,sizeof(int),inc);

	for(int i=0;i<=n/2-1;i++)

	{

		if(temp[i]>=a[n/2])printf("%d\n",a[n/2-1]);

		else printf("%d\n",a[n/2]);

	}

	for(int i=n/2;i<n;i++)

	{

		if(temp[i]>a[n/2-1])printf("%d\n",a[n/2-1]);

		else printf("%d\n",a[n/2]);

	}

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp> // Common file

#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update



using namespace std ;

using namespace __gnu_pbds;



typedef tree<

pair<int , int> ,

null_type,

less< pair<int , int> >,

rb_tree_tag,

tree_order_statistics_node_update>

ordered_set;



int main()

{

	ios_base::sync_with_stdio(0) ;

	cin.tie(0) ;

	int n ;

	cin>>n ;

	int arr[n] ;

	for(int i = 0 ; i < n ; ++i)

		cin>>arr[i] ;

	ordered_set s ;

	for(int i = 0 ; i < n ; ++i)

		s.insert({arr[i] , i}) ;

	for(int i = 0 ; i < n ; ++i)

	{

		s.erase({arr[i] , i}) ;

		cout<<(*s.find_by_order(n/2-1)).first<<"\n";

		s.insert({arr[i], i}) ;

	}

	return 0 ;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<stdlib.h>

int a[200005],temp[200005];

int inc(const void *a, const void *b)

{

    return *(int*)a-*(int*)b;

}

int main()

{

	int n;

	scanf("%d",&n);

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

	for(int i=0;i<n;i++)temp[i]=a[i];

	qsort(a,n,sizeof(int),inc);

	for(int i=0;i<=n/2-1;i++)

	{

		if(temp[i]>=a[n/2])printf("%d\n",a[n/2-1]);

		else printf("%d\n",a[n/2]);

	}

	for(int i=n/2;i<n;i++)

	{

		if(temp[i]>a[n/2-1])printf("%d\n",a[n/2-1]);

		else printf("%d\n",a[n/2]);

	}

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;



int main() {

    ios_base::sync_with_stdio(0);

    cin.tie(0);



    int n, med;

    cin >> n;

    int arr[n], neww[n];



    for (int i = 0; i < n; i++)

        cin >> arr[i], neww[i] = arr[i];



    sort(neww, neww + n);

    med = neww[n / 2 - 1];



    for (int i = 0; i < n; i++)

        cout << (arr[i] <= med ? neww[n / 2] : neww[n / 2 - 1]) << '\n';



    return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<stdlib.h>

int a[200005],temp[200005];

int inc(const void *a, const void *b)

{

    return *(int*)a-*(int*)b;

}

int main()

{

	int n;

	scanf("%d",&n);

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

	for(int i=0;i<n;i++)temp[i]=a[i];

	qsort(a,n,sizeof(int),inc);

	for(int i=0;i<=n/2-1;i++)

	{

		if(temp[i]>=a[n/2])printf("%d\n",a[n/2-1]);

		else printf("%d\n",a[n/2]);

	}

	for(int i=n/2;i<n;i++)

	{

		if(temp[i]>a[n/2-1])printf("%d\n",a[n/2-1]);

		else printf("%d\n",a[n/2]);

	}

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
//In The Name Of GOD



#include <bits/stdc++.h>



using namespace std;



typedef long long ll ;

typedef long double ld ;



const ll mod = 998244353;

const ll inf = 2000000000;

const ll infll = (ll)2*1000*1000*1000*1000*1000*1000;

const ll maxn = 2*1001+1;



#define pb push_back

#define pp pop_back

#define X first

#define Y second

#define IO ios_base::sync_with_stdio(false);



int main(){

	int n;

	cin >> n;

	const int m = n;

	pair<int,int> A[m];

	int where[m];

	for(int i=0;i<m;i++){

		cin>>A[i].X;

		A[i].Y=i;

	}

	sort(A,A+m);

	for(int i=0;i<n;i++){

		where[ A[i].Y ] = i;

	}

	int l = A[n/2-1].X, r = A[n/2].X;

	for(int i=0;i<n;i++){

		if(where[i]<n/2){

			cout << r << endl;

		}else{

			cout << l << endl;

		}

	}







}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<stdlib.h>

int a[200005],temp[200005];

int inc(const void *a, const void *b)

{

    return *(int*)a-*(int*)b;

}

int main()

{

	int n;

	scanf("%d",&n);

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

	for(int i=0;i<n;i++)temp[i]=a[i];

	qsort(a,n,sizeof(int),inc);

	for(int i=0;i<=n/2-1;i++)

	{

		if(temp[i]>=a[n/2])printf("%d\n",a[n/2-1]);

		else printf("%d\n",a[n/2]);

	}

	for(int i=n/2;i<n;i++)

	{

		if(temp[i]>a[n/2-1])printf("%d\n",a[n/2-1]);

		else printf("%d\n",a[n/2]);

	}

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



#define ft first

#define sd second

#define sz(x) ((int)x.size())



using namespace std;



typedef long long ll;

typedef pair<int, int> pii;

typedef pair<ll, ll> pll;



const int MAXN = 200 * 1000 + 321;













int n, ans[MAXN];

pii x[MAXN];



int main() {

	cin >> n;

	for (int i = 0; i < n; i++)

		cin >> x[i].ft, x[i].sd = i;

	sort(x, x + n);

	for (int i = 0; i < (n >> 1); i++)

		ans[x[i].sd] = x[n >> 1].ft;

	for (int i = n / 2; i < n; i++)

		ans[x[i].sd] = x[(n >> 1) - 1].ft;

	for (int i = 0; i < n; i++)

		cout << ans[i] << '\n';

	return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<stdlib.h>

int a[200005],temp[200005];

int inc(const void *a, const void *b)

{

    return *(int*)a-*(int*)b;

}

int main()

{

	int n;

	scanf("%d",&n);

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

	for(int i=0;i<n;i++)temp[i]=a[i];

	qsort(a,n,sizeof(int),inc);

	for(int i=0;i<=n/2-1;i++)

	{

		if(temp[i]>=a[n/2])printf("%d\n",a[n/2-1]);

		else printf("%d\n",a[n/2]);

	}

	for(int i=n/2;i<n;i++)

	{

		if(temp[i]>a[n/2-1])printf("%d\n",a[n/2-1]);

		else printf("%d\n",a[n/2]);

	}

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<algorithm>

#define NUM 200003

using namespace std;



int main() {

	int n;

	cin >> n ;

	int a[NUM] = { 0 };

	for (int i = 1;i <= n;i++) {

		cin >> a[i];

	}

	int v[NUM] = { 0 };

	copy(a, a + n + 1, v);

	sort(a + 1, a + n +1);

	for (int i = 1;i <= n;i++) {

		if (v[i] > a[n/2])

			cout << a[ n / 2] << endl;

		else

			cout << a[(n / 2) + 1 ] << endl;



	}

	



	return 0;

}


// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

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

#define repk(i,k,n) for (ll i = k; i <= (ll)(n); ++i)

#define MAX 500010

#define MOD 1000000007

typedef long long  ll;



using namespace std;



ll ans;



int main() {

	cin.tie(0);

	ios::sync_with_stdio(false);



	ll N;

	cin >> N;



	vector<ll> X(N),cop(N);

	rep(i,N){

		cin >> X[i];

		cop[i] = X[i];

	}



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

	ll l = N/2 - 1;

	ll lx = cop[l];



	rep(i,N){

		if(X[i]<=lx){

			cout << cop[l+1] << endl;

		}

		else{

			cout << cop[l] << endl;

		}

	}





	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



int main()

{ 

   int n;

   int a[200010]={};

   int b[200010]={};

   cin>>n;

   for(int i=0;i<n;i++){

       cin>>a[i];

       b[i]=a[i];

   }

   sort(b,b+n);

   int l=b[n/2-1],r=b[n/2];

   for(int i=0;i<n;i++){

       if(a[i]<=l) cout<<r<<endl;

       else cout<<l<<endl;

   }



}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

using ll = long long;

#define rep(i,n) for(int i = 0; i < (n); i++)

#define all(v) v.begin(), v.end()

#define MOD 1000000007

const int INF = 1LL<<30;



int main(){

    int n;

    cin>>n;

    vector<ll> l(n),h(n);

    rep(i,n) cin>>l[i],h[i]=l[i];

    sort(all(h));

    ll a=h[n/2],b=h[n/2-1];



    //cout<<a<<" "<<b<<endl;

    rep(i,n){

        if(l[i]<=b) cout<<a<<endl;

        else cout<<b<<endl;

    }

    

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <algorithm>

#include <cstring>



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



using namespace std;



typedef long long int ll;



int main() {

    ll n,x[200000],y[200000];

    cin >> n;

    loop(n) cin >> x[i];

    memcpy(y,x,sizeof(ll[200000]));

    sort(y,y+n);

    ll a[2] = {y[n/2-1],y[n/2]};

    loop(n) if(x[i] <= a[0]) cout << a[1] << endl; else cout << a[0] << endl;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

#include <algorithm>

#include <cstring>



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



using namespace std;



typedef long long int ll;



int main() {

    ll n,x[200000],y[200000];

    scanf("%ld",&n);

    loop(n) scanf("%ld",&x[i]);

    memcpy(y,x,sizeof(ll[200000]));

    sort(y,y+n);

    ll a[2] = {y[n/2-1],y[n/2]};

    loop(n) if(x[i] <= a[0]) printf("%ld\n",a[1]); else printf("%ld\n",a[0]);

}

// Fastest known solution for this problem: