Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)
#define PB push_back
#define CL(a,x) memset(a, x, sizeof(a))
typedef long long LL;
const int P = 1e9+7;
const int N = 2e5+5;
const double PI = acos(-1);
mt19937 rng(time(0));

struct dat{
	int a,b;
	double r;
	void in(){
		scanf("%d%d",&a,&b);
		r = 1.0 * a / (b+1);
	}
}a[N];

int n, m;
LL t, dp[20], b[N];

int main(){
	scanf("%d%lld",&n,&t);
	rep(i,1,n) a[i].in();
	sort(a+1,a+n+1,[](dat x,dat y){return x.r>y.r;});
	
	for(m=1; m<=n && a[m].a; m++);
	m--, b[0] = 0;
	rep(i,m+1,n) b[i-m] = a[i].b;
	n -= m;
	sort(b+1,b+n+1);
	
	rep(j,0,19) dp[j] = t+1;
	dp[0] = 0;
	rep(i,1,m)
		rrep(j,18,1) dp[j] = min(dp[j], (dp[j-1]+1) * a[i].a + a[i].b );
	
	LL ans = 0;
	rep(i,1,n) b[i] += (b[i-1] + 1);
	rep(j,0,18){
		LL x = t - dp[j];
		if(x<0) break;
		ans = max(ans, j + (upper_bound(b+1,b+n+1,x) - b - 1) );
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:26: error: no matching function for call to 'max(LL&, long int)'
   46 |                 ans = max(ans, j + (upper_bound(b+1,b+n+1,x) - b - 1) );
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/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:46:26: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long int')
   46 |                 ans = max(ans, j + (upper_bound(b+1,b+n+1,x) - b - 1) );
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:
/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:46:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   46 |                 ans = max(ans, j + (upper_bound(b+1,b+n+1,x) - b - 1) );
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~