Language: C++

//Bokan ga bokka--nn!!
//Daily Lunch Special Tanoshii !!
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
#define s(x) scanf("%d",&x)
#define rep(i,x) for(int i=0;i<x;i++)
#define a first
#define b second
P bug[300005];

ll bit[(1<<17)+1]={};
ll bit2[(1<<17)+1]={};
void add(int i,ll x)
{
	while(i<=(1<<17))
	{
		bit[i]+=x;
		i += (i & -i);
	}
}
ll sum(int i)
{
	ll s=0LL;
	while(i>0)
	{
		s+=bit[i];
		i -= (i & -i);
	}
	return s;
}
void add2(int i,ll x)
{
	while(i<=(1<<17))
	{
		bit2[i]+=x;
		i += (i & -i);
	}
}
ll sum2(int i)
{
	ll s=0LL;
	while(i>0)
	{
		s+=bit2[i];
		i -= (i & -i);
	}
	return s;
}
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		ll x,y;
		scanf("%lld %lld",&x,&y);
		bug[i]=mp(y,x);
	}
	sort(bug,bug+n,greater<P>());
	int ret=0;
	for(int i=0;i<n;i++)
	{
//printf("%d %d\n",bug[i].a,bug[i].b);
		ll bord=bug[i].first;
		add(bug[i].second,bug[i].second);
		add2(bug[i].second,1LL);
		int lb=0;
		int ub=(1<<17);
		while(ub-lb>1)
		{
			int mid=(lb+ub)>>1;
			ll s1=sum(mid);
			ll s2=sum2(mid);
			if(s1<=s2*bord)  lb=mid;
			else ub=mid;
		}
		ret=max(ret,sum2(lb));
		//printf("%d\n",maxv);
		
	}
	printf("%d\n",ret);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:98:24: error: no matching function for call to 'max(int&, ll)'
   98 |                 ret=max(ret,sum2(lb));
      |                     ~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/specfun.h:43,
                 from /usr/include/c++/14/cmath:3906,
                 from a.cc:6:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:98:24: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   98 |                 ret=max(ret,sum2(lb));
      |                     ~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:8:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:98:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   98 |                 ret=max(ret,sum2(lb));
      |                     ~~~^~~~~~~~~~~~~~