Language: C++

#include<bits/stdc++.h>
using namespace std;
long long n,t,b1[200001],f[200001],max1,tot1,tot2;
struct hzy{
	long long a,b;
}b2[200001];
bool mycmp(hzy a,hzy b){
	return a.a*(b.b+1)>a.b*(b.a+1);
}
int main(){
	cin>>n>>t;
	for(long long i=1,x,y;i<=n;i++){
		cin>>x>>y;
		if(x==0){
			b1[++tot1]=y;
		}
		else{
			b2[++tot2]=(hzy){x,y};
		}
	}
	sort(b1+1,b1+tot1+1);
	sort(b2+1,b2+tot2+1,mycmp);
	memset(f,10,sizeof(f));
	f[0]=0;
	for(int i=1;i<=tot2;i++){
		for(int j=30;j>=1;j--){
			f[j]=min(f[j],(f[j-1]+1)*(b2[i].a+1)+b2[i].b);
		}
	}
	for(int i=1;i<=tot1;i++){
		b1[i]+=b1[i-1]+1;
	}
	for(int i=1;i<=30;i++){
		if(f[i]>t)break;
		int l=0,r=tot1;
		while(l+1<r){
			int mid=(l+r)>>1;
			if(b1[mid]+f[i]<=t){
				l=mid;
			}
			else{
				r=mid;
			}
		}
		if(f[i]+b1[r]<=t){
			max1=max(max1,i+r);
		}
		else{
			max1=max(max1,i+l);
		}
	}
	cout<<max1;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:33: error: no matching function for call to 'max(long long int&, int)'
   46 |                         max1=max(max1,i+r);
      |                              ~~~^~~~~~~~~~
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:33: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   46 |                         max1=max(max1,i+r);
      |                              ~~~^~~~~~~~~~
/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:33: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   46 |                         max1=max(max1,i+r);
      |                              ~~~^~~~~~~~~~
a.cc:49:33: error: no matching function for call to 'max(long long int&, int)'
   49 |                         max1=max(max1,i+l);
      |                              ~~~^~~~~~~~~~
/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:49:33: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   49 |                         max1=max(max1,i+l);
      |                              ~~~^~~~~~~~~~
/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
/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:49:33: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   49 |                         max1=max(max1,i+l);
      |                              ~~~^~~~~~~~~~