Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define N 150
ll n,k,w[N],v[N],memo[N][(int)2e5];

ll dp(int curr , int val) {
    if (curr > n) return val == 0 ? 0 : INT_MAX;
    ll &sol = memo[curr][val];
    if (sol != -1) return sol;
    sol = dp(curr + 1 , val);
    if (val >= v[curr]) {
        sol = min(
            dp(curr + 1 , val - v[curr]) + w[curr] ,
            sol
        );
    }
    return sol;
}

int main() {
    scanf("%lld%lld" , &n , &k);
    ll sum = 0, highestw = LLONG_MIN;
    for (int i = 1 ; i <= n ; i++) {
        scanf("%lld%lld" , &w[i] , &v[i]);
        sum += v[i];
        highestw = max(highestw , w[i]);
    }
    memset (memo , -1 , sizeof memo);
    ll sol = LLONG_MIN;
    for (ll i = 1 ; i <= sum ; i++) {
        ll DP = dp(1 , i);
        if (DP == INT_MAX) continue;
        if (DP <= k)
            sol = max(sol , i);
    }
    printf("%lld\n" , sol);
}
vvvvvvvvvvvvvvvvvvvvvvvv#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define N 150
ll n,k,w[N],v[N],memo[N][(int)2e5];

ll dp(int curr , int val) {
    if (curr > n) return val == 0 ? 0 : INT_MAX;
    ll &sol = memo[curr][val];
    if (sol != -1) return sol;
    sol = dp(curr + 1 , val);
    if (val >= v[curr]) {
        sol = min(
            dp(curr + 1 , val - v[curr]) + w[curr] ,
            sol
        );
    }
    return sol;
}

int main() {
    scanf("%lld%lld" , &n , &k);
    ll sum = 0, highestw = LLONG_MIN;
    for (int i = 1 ; i <= n ; i++) {
        scanf("%lld%lld" , &w[i] , &v[i]);
        sum += v[i];
        highestw = max(highestw , w[i]);
    }
    memset (memo , -1 , sizeof memo);
    ll sol = LLONG_MIN;
    for (ll i = 1 ; i <= sum ; i++) {
        ll DP = dp(1 , i);
        if (DP == INT_MAX) continue;
        if (DP <= k)
            sol = max(sol , i);
    }
    printf("%lld\n" , sol);
}


Compiler output:
a.cc:39:25: error: stray '#' in program
   39 | vvvvvvvvvvvvvvvvvvvvvvvv#include <bits/stdc++.h>
      |                         ^
a.cc:39:1: error: 'vvvvvvvvvvvvvvvvvvvvvvvv' does not name a type
   39 | vvvvvvvvvvvvvvvvvvvvvvvv#include <bits/stdc++.h>
      | ^~~~~~~~~~~~~~~~~~~~~~~~
a.cc:43:4: error: redefinition of 'll n'
   43 | ll n,k,w[N],v[N],memo[N][(int)2e5];
      |    ^
a.cc:5:4: note: 'll n' previously declared here
    5 | ll n,k,w[N],v[N],memo[N][(int)2e5];
      |    ^
a.cc:43:6: error: redefinition of 'll k'
   43 | ll n,k,w[N],v[N],memo[N][(int)2e5];
      |      ^
a.cc:5:6: note: 'll k' previously declared here
    5 | ll n,k,w[N],v[N],memo[N][(int)2e5];
      |      ^
a.cc:43:8: error: redefinition of 'll w [150]'
   43 | ll n,k,w[N],v[N],memo[N][(int)2e5];
      |        ^
a.cc:5:8: note: 'll w [150]' previously declared here
    5 | ll n,k,w[N],v[N],memo[N][(int)2e5];
      |        ^
a.cc:43:13: error: redefinition of 'll v [150]'
   43 | ll n,k,w[N],v[N],memo[N][(int)2e5];
      |             ^
a.cc:5:13: note: 'll v [150]' previously declared here
    5 | ll n,k,w[N],v[N],memo[N][(int)2e5];
      |             ^
a.cc:43:18: error: redefinition of 'll memo [150][200000]'
   43 | ll n,k,w[N],v[N],memo[N][(int)2e5];
      |                  ^~~~
a.cc:5:18: note: 'll memo [150][200000]' previously declared here
    5 | ll n,k,w[N],v[N],memo[N][(int)2e5];
      |                  ^~~~
a.cc:45:4: error: redefinition of 'll dp(int, int)'
   45 | ll dp(int curr , int val) {
      |    ^~
a.cc:7:4: note: 'll dp(int, int)' previously defined here
    7 | ll dp(int curr , int val) {
      |    ^~
a.cc:59:5: error: redefinition of 'int main()'
   59 | int main() {
      |     ^~~~
a.cc:21:5: note: 'int main()' previously defined here
   21 | int main() {
      |     ^~~~