#include #include using namespace std; using ll = long long; using ld = long double; using mint = atcoder::modint998244353; const ll inf = 9e18; pair calc(pair x,pair y,ll add=0){ auto[vx,cx]=x; auto[vy,cy]=y; if(vx>vy+add) return x; if(vx==vy+add) return {vx,cx+cy}; else return {vy+add,cy}; } int main(){ ios::sync_with_stdio(0); cin.tie(0); ll n,W; cin >> n >> W; vector v(n),w(n); for(ll i=0;i> v[i] >> w[i]; vector dp(n+1,vector>(30001,{-inf,0})); dp[0][10000]={0,1}; for(ll i=0;iv) continue; if(mxv==v) cnt+=c; if(mxv