Language: C++

	}

	ll s = 0;
	for (int i = 0;i <= N;i++){
		s += sum(dat[i]);
		add(dat[i],1);
	}
	
	ll all = (N*(N+1))/2;

	if(s*2 >= all) return true;
	else return false;

}

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

	cin >> N;

	low  = INT_MAX;
	high = INT_MIN;

	for (int i = 0;i < N;i++){
		cin >> A[i];
		low = min(low, A[i]);
		high = max(high, A[i]);
	}

	high++;

	while(high-low > 1){
		int mid = (low+high)/2;
		if(is_bigger(mid)) low = mid;
		else high = mid;
	}

	cout << low << endl;

	return 0;

}


Compiler output:
a.cc:1:9: error: expected declaration before '}' token
    1 |         }
      |         ^
a.cc:3:9: error: 'll' does not name a type
    3 |         ll s = 0;
      |         ^~
a.cc:4:9: error: expected unqualified-id before 'for'
    4 |         for (int i = 0;i <= N;i++){
      |         ^~~
a.cc:4:24: error: 'i' does not name a type
    4 |         for (int i = 0;i <= N;i++){
      |                        ^
a.cc:4:31: error: 'i' does not name a type
    4 |         for (int i = 0;i <= N;i++){
      |                               ^
a.cc:9:9: error: 'll' does not name a type
    9 |         ll all = (N*(N+1))/2;
      |         ^~
a.cc:11:9: error: expected unqualified-id before 'if'
   11 |         if(s*2 >= all) return true;
      |         ^~
a.cc:12:9: error: expected unqualified-id before 'else'
   12 |         else return false;
      |         ^~~~
a.cc:14:1: error: expected declaration before '}' token
   14 | }
      | ^
a.cc: In function 'int main()':
a.cc:17:9: error: 'cin' was not declared in this scope
   17 |         cin.tie(0);
      |         ^~~
a.cc:18:9: error: 'ios' has not been declared
   18 |         ios::sync_with_stdio(false);
      |         ^~~
a.cc:20:16: error: 'N' was not declared in this scope
   20 |         cin >> N;
      |                ^
a.cc:22:9: error: 'low' was not declared in this scope
   22 |         low  = INT_MAX;
      |         ^~~
a.cc:22:16: error: 'INT_MAX' was not declared in this scope
   22 |         low  = INT_MAX;
      |                ^~~~~~~
a.cc:1:8: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
  +++ |+#include <climits>
    1 |         }
a.cc:23:9: error: 'high' was not declared in this scope
   23 |         high = INT_MIN;
      |         ^~~~
a.cc:23:16: error: 'INT_MIN' was not declared in this scope
   23 |         high = INT_MIN;
      |                ^~~~~~~
a.cc:23:16: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
a.cc:26:24: error: 'A' was not declared in this scope
   26 |                 cin >> A[i];
      |                        ^
a.cc:27:23: error: 'min' was not declared in this scope; did you mean 'main'?
   27 |                 low = min(low, A[i]);
      |                       ^~~
      |                       main
a.cc:28:24: error: 'max' was not declared in this scope
   28 |                 high = max(high, A[i]);
      |                        ^~~
a.cc:35:20: error: 'is_bigger' was not declared in this scope
   35 |                 if(is_bigger(mid)) low = mid;
      |                    ^~~~~~~~~
a.cc:39:9: error: 'cout' was not declared in this scope
   39 |         cout << low << endl;
      |         ^~~~
a.cc:39:24: error: 'endl' was not declared in this scope
   39 |         cout << low << endl;
      |                        ^~~~