Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(0);cin.tie(0)
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
typedef long long ll;
#define pri(n) printf("%d\n",n)
#define lpri(n) printf("%lld\n",n);
#define rep(i,st,ed) for(int i=st;i<ed;i++)
#define F first
#define S second 
#define pb(n) push_back(n)
const int N=1e5+6;
const ll M=1e9+7;

int main()
{
	int n,w;
	scn(n);scn(w);
	ll dp[n+1][N];
	for(int i=0;i<=n;i++)
	{
		for(int j=0;j<N;j++)
			dp[i][j]=M;
	}

	// think of it as minimum weight for a particular value
	// the value can be at max 1e5. this if the key of the 
	// problem
	for(int i=1;i<=n;i++)
	{
		int wt,val;
		scn(wt);scn(val);
		if(dp[i-1][val]==M)
			dp[i][val]=wt;
		else dp[i][val]=min(dp[i][val],wt);
		for(int j=0;j<N;j++)
		{
			dp[i][j]=min(dp[i-1][j],dp[i][j]);
			if(j>=val)
			{
				if(dp[i-1][j-val]!=M)
					dp[i][j]=min(dp[i][j],dp[i-1][j-val]+wt);				
			}
		}
	}
	ll ans=0;
	for(int i=N-1;i>=0;i--)
	{
		if(dp[n][i]<=w)
		{			
			// lpri(dp[n][i]);
			ans=i;
			break;
		}
	}
	lpri(ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:36: error: no matching function for call to 'min(ll&, int&)'
   36 |                 else dp[i][val]=min(dp[i][val],wt);
      |                                 ~~~^~~~~~~~~~~~~~~
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: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:36:36: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   36 |                 else dp[i][val]=min(dp[i][val],wt);
      |                                 ~~~^~~~~~~~~~~~~~~
/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:
/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:36:36: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   36 |                 else dp[i][val]=min(dp[i][val],wt);
      |                                 ~~~^~~~~~~~~~~~~~~