Language: C++

#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstring>
#include<cctype>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<iomanip>
#include<sstream>
#include<cstdlib>
#include<ctime>
#include<list>
#include<deque>
#include<bitset>
#include<fstream>
#define ld double
#define ull unsigned long long
#define ll long long
#define pii pair<int,int >
#define iiii pair<int,pii >
#define mp make_pair
#define INF 1000000000
#define MOD 1000000007
#define rep(i,x) for(int (i)=0;(i)<(x);(i)++)
inline int getint()
{
	int x=0,p=1;char c=getchar();
	while (c<=32)c=getchar();
	if(c==45)p=-p,c=getchar();
	while (c>32)x=x*10+c-48,c=getchar();
	return x*p;
}
using namespace std;
//
int n;
ll pre[4][1000];
vector<ll>cnt[4];
ll res=0,xx,yy,w;
//
int main()
{
	n=getint();w=1ll*getint();
	xx=getint();yy=getint();
	cnt[0].push_back(yy);
	rep(i,n-1)
	{
		int x=getint(),y=getint();
		cnt[x-xx].push_back(y);
	}
	rep(i,4)
	{
		sort(cnt[i].begin(),cnt[i].end());
		reverse(cnt[i].begin(),cnt[i].end());
		pre[i][0]=0;
		for(int j=1;j<=cnt[i].size();j++)
			pre[i][j]=pre[i][j-1]+1ll*cnt[i][j-1];
	}
	rep(i,cnt[0].size()+1)
		rep(j,cnt[1].size()+1)
			rep(k,cnt[2].size()+1)
			{
				ll l=w-1ll*i*xx-1ll*j*(xx+1)-1ll*k*(xx+2);
				if(l<0)continue;
				l=min(l,1ll*cnt[3].size());
				ll ans=pre[0][i]+pre[1][j]+pre[2][k]+pre[3][l];
				res=max(res,ans);
			}
	cout<<res<<endl;		
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:68:38: error: no matching function for call to 'min(long long int&, long long unsigned int)'
   68 |                                 l=min(l,1ll*cnt[3].size());
      |                                   ~~~^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:68:38: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
   68 |                                 l=min(l,1ll*cnt[3].size());
      |                                   ~~~^~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:68:38: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   68 |                                 l=min(l,1ll*cnt[3].size());
      |                                   ~~~^~~~~~~~~~~~~~~~~~~~~