Language: C++

#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
typedef int64_t llo;
#define a first
#define  b second
#define endl "\n"
bool comp(pair<llo,llo> ac, pair<llo,llo> cc){
	return (cc.b+1)*ac.a>=(ac.b+1)*cc.a;
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	llo n,t;
	cin>>n>>t;
	vector<pair<llo,llo>> it;
	vector<llo> tt;
	llo aa,bb;
	for(llo i=0;i<n;i++){
		cin>>aa>>bb;
		if(aa==0){
			tt.pb(bb);
		}
		else{
			it.pb({aa,bb});
		}
	}
	if(it.size()){
		sort(it.begin(),it.end(),comp);
	}
	llo dp[31];
	memset(dp,-1,sizeof(dp));
	dp[0]=0;
	for(llo i=0;i<it.size();i++){
//	cout<<it[i].a<<" "<<it[i].b<<endl;
		for(llo j=30;j>=1;j--){
			if(dp[j-1]==-1){
				continue;
			}
			//cout<<i<<" "<<j<<endl;
			llo co=(dp[j-1]+1)*it[i].a+it[i].b+dp[j-1]+1;
			if(dp[j]==-1){
				dp[j]=co;
			}
			dp[j]=min(dp[j],co);
		}
	}	
/*	for(llo i=0;i<20;i++){
		cout<<dp[i]<<" ";
	}
	cout<<endl;*/
	llo ma=0;
	llo ind=0;
	llo su=0;
	if(tt.size()){
		sort(tt.begin(),tt.end());
	}
	for(llo i=30;i>=0;i--){
		if(dp[i]==-1){
			continue;
		}
		if(dp[i]>t){
			continue;
		}
		while(ind<tt.size()){
			if(tt[ind]+1+dp[i]+su<=t){
				ind+=1;
				su+=dp[i];
				continue;
			}
			break;
		}
		ma=max(ma,i+ind);
	}	
	cout<<ma<<endl;

















#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
typedef int64_t llo;
#define a first
#define  b second
#define endl "\n"
bool comp(pair<llo,llo> ac, pair<llo,llo> cc){
	return (cc.b+1)*ac.a>=(ac.b+1)*cc.a;
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	llo n,t;
	cin>>n>>t;
	vector<pair<llo,llo>> it;
	vector<llo> tt;
	llo aa,bb;
	for(llo i=0;i<n;i++){
		cin>>aa>>bb;
		if(aa==0){
			tt.pb(bb);
		}
		else{
			it.pb({aa,bb});
		}
	}
	if(it.size()){
		sort(it.begin(),it.end(),comp);
	}
	llo dp[31];
	memset(dp,-1,sizeof(dp));
	dp[0]=0;
	for(llo i=0;i<it.size();i++){
//	cout<<it[i].a<<" "<<it[i].b<<endl;
		for(llo j=30;j>=1;j--){
			if(dp[j-1]==-1){
				continue;
			}
			//cout<<i<<" "<<j<<endl;
			llo co=(dp[j-1]+1)*it[i].a+it[i].b+dp[j-1]+1;
			if(dp[j]==-1){
				dp[j]=co;
			}
			dp[j]=min(dp[j],co);
		}
	}	
/*	for(llo i=0;i<20;i++){
		cout<<dp[i]<<" ";
	}
	cout<<endl;*/
	/*llo ma=0;
	llo ind=0;
	llo su=0;
	if(tt.size()){
		sort(tt.begin(),tt.end());
	}
	for(llo i=30;i>=0;i--){
		if(dp[i]==-1){
			continue;
		}
		if(dp[i]>t){
			continue;
		}
		while(ind<tt.size()){
			if(tt[ind]+1+dp[i]+su<=t){
				ind+=1;
				su+=dp[i];
				continue;
			}
			break;
		}
		ma=max(ma,i+ind);
	}	
	cout<<ma<<endl;*/




















	return 0;
}


	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:104:46: error: a function-definition is not allowed here before '{' token
  104 | bool comp(pair<llo,llo> ac, pair<llo,llo> cc){
      |                                              ^
a.cc:107:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
  107 | int main(){
      |         ^~
a.cc:107:9: note: remove parentheses to default-initialize a variable
  107 | int main(){
      |         ^~
      |         --
a.cc:107:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:107:11: error: a function-definition is not allowed here before '{' token
  107 | int main(){
      |           ^