Language: C++

#include <bits/stdc++.h>
using namespace std;long long cnt[400005];
long long n,m,i,j,l,r,mid,ans;long long num[400015],s[400015],sum[400015],f[400015];
int lowbit(int x){return x&(-x);}void add(int x){for (int i=x;i<=400005;i+=lowbit(i))arr[i]++;}
long long query(int x){long long s=0;for (int i=x;i>0;i-=lowbit(i)) +=arr[i];return s;}}vector<long long> all;bit cnt;bool _(long long x){	long long i,j,ans=0;	s[0]=200002;	fz1(i,n)
	{		if (num[i]<x) f[i]=-1;		if (num[i]>=x) f[i]=1;	}	fz1(i,n) s[i]=s[i-1]+f[i];	memset(cnt,0,sizeof(cnt));	fd1(i,n)	{
		add(s[i]);		ans+=query(s[i-1]-1);	}	return ans<((n*(n+1)/2)/2+1);}int main(){
	scanf("%lld",&n);
	fz1(i,n)	{		scanf("%lld",&num[i]);		all.push_back(num[i]);
	}	sort(all.begin(),all.end());	all.resize(unique(all.begin(),all.end())-all.begin());	fz1(i,n) num[i]=upper_bound(all.begin(),all.end(),num[i])-all.begin();	l=ans=1;r=((int)all.size())+1;
	while (l<r)	{		mid=(l+r)/2;		if (_(mid))		{			l=mid+1;
			ans=mid;		}
		else r=mid;	}
	cout<<all[ans-1]<<endl;	return 0;
}

Compiler output:
a.cc: In function 'void add(int)':
a.cc:4:86: error: 'arr' was not declared in this scope
    4 | int lowbit(int x){return x&(-x);}void add(int x){for (int i=x;i<=400005;i+=lowbit(i))arr[i]++;}
      |                                                                                      ^~~
a.cc: In function 'long long int query(int)':
a.cc:5:69: error: expected primary-expression before '+=' token
    5 | long long query(int x){long long s=0;for (int i=x;i>0;i-=lowbit(i)) +=arr[i];return s;}}vector<long long> all;bit cnt;bool _(long long x){      long long i,j,ans=0;    s[0]=200002;    fz1(i,n)
      |                                                                     ^~
a.cc:5:71: error: 'arr' was not declared in this scope
    5 | long long query(int x){long long s=0;for (int i=x;i>0;i-=lowbit(i)) +=arr[i];return s;}}vector<long long> all;bit cnt;bool _(long long x){      long long i,j,ans=0;    s[0]=200002;    fz1(i,n)
      |                                                                       ^~~
a.cc: At global scope:
a.cc:5:88: error: expected declaration before '}' token
    5 | long long query(int x){long long s=0;for (int i=x;i>0;i-=lowbit(i)) +=arr[i];return s;}}vector<long long> all;bit cnt;bool _(long long x){      long long i,j,ans=0;    s[0]=200002;    fz1(i,n)
      |                                                                                        ^
a.cc:5:111: error: 'bit' does not name a type
    5 | long long query(int x){long long s=0;for (int i=x;i>0;i-=lowbit(i)) +=arr[i];return s;}}vector<long long> all;bit cnt;bool _(long long x){      long long i,j,ans=0;    s[0]=200002;    fz1(i,n)
      |                                                                                                               ^~~
a.cc: In function 'bool _(long long int)':
a.cc:5:185: error: 'fz1' was not declared in this scope
    5 | long long query(int x){long long s=0;for (int i=x;i>0;i-=lowbit(i)) +=arr[i];return s;}}vector<long long> all;bit cnt;bool _(long long x){      long long i,j,ans=0;    s[0]=200002;    fz1(i,n)
      |                                                                                                                                                                                         ^~~
a.cc:6:153: error: 'fd1' was not declared in this scope
    6 |         {               if (num[i]<x) f[i]=-1;          if (num[i]>=x) f[i]=1;  }       fz1(i,n) s[i]=s[i-1]+f[i];      memset(cnt,0,sizeof(cnt));      fd1(i,n)        {
      |                                                                                                                                                         ^~~
a.cc: In function 'int main()':
a.cc:9:9: error: 'fz1' was not declared in this scope
    9 |         fz1(i,n)        {               scanf("%lld",&num[i]);          all.push_back(num[i]);
      |         ^~~