Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define in insert
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
vector<ll> w, v;
int a[101];
ll f(int n, int W){
    if(n == 0 || W == 0) return 0;
    else if(w[n] > W) f(n-1, W);
    else{
        if(a[n] != -1) return a[n];
        else {
            ll ans = max(f(n-1, W), v[n] + f(n-1, W-w[n]));
            a[n] = ans;
            return ans;
        }
    }
}
int main(){
    forn(i, 101) a[i] = -1;#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define in insert
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
vector<ll> w, v;
vector<vector<ll> > a;
ll f(int n, int W){
    if(n == 0 || W == 0) return 0;
    else if(w[n] > W) f(n-1, W);
    else{
        if(a[n][W] != -1) return a[n][W];
        else {
            ll ans = max(f(n-1, W), v[n] + f(n-1, W-w[n]));
            a[n][W] = ans;
            return ans;
        }
    }
}
int main(){
    int n, W;
    scanf("%d%d", &n, &W);
    forn(i, n+1) {
        vector<ll> q;
        forn(j, W+1) q.pb(-1);
        a.pb(q); 
    }
    w.pb(0);
    v.pb(0);
    forn(i, n) {
        ll x, y;
        scanf("%lld%lld", &x, &y);
        w.pb(x);
        v.pb(y);
    }
    printf("%lld", f(n, W));
}
    int n, W;
    scanf("%d%d", &n, &W);
    w.pb(0);
    v.pb(0);
    forn(i, n) {
        ll x, y;
        scanf("%lld%lld", &x, &y);
        w.pb(x);
        v.pb(y);
    }
    printf("%lld", f(n, W));
}

Compiler output:
a.cc:27:28: error: stray '#' in program
   27 |     forn(i, 101) a[i] = -1;#include <bits/stdc++.h>
      |                            ^
a.cc: In function 'int main()':
a.cc:27:29: error: 'include' was not declared in this scope
   27 |     forn(i, 101) a[i] = -1;#include <bits/stdc++.h>
      |                             ^~~~~~~
a.cc:27:38: error: 'bits' was not declared in this scope
   27 |     forn(i, 101) a[i] = -1;#include <bits/stdc++.h>
      |                                      ^~~~
a.cc:27:43: error: 'stdc' was not declared in this scope; did you mean 'std'?
   27 |     forn(i, 101) a[i] = -1;#include <bits/stdc++.h>
      |                                           ^~~~
      |                                           std
a.cc:28:1: error: expected primary-expression before 'using'
   28 | using namespace std;
      | ^~~~~
a.cc:40:19: error: a function-definition is not allowed here before '{' token
   40 | ll f(int n, int W){
      |                   ^
a.cc:52:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   52 | int main(){
      |         ^~
a.cc:52:9: note: remove parentheses to default-initialize a variable
   52 | int main(){
      |         ^~
      |         --
a.cc:52:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:52:11: error: a function-definition is not allowed here before '{' token
   52 | int main(){
      |           ^
a.cc: In function 'long long int first(int, int)':
a.cc:25:1: warning: control reaches end of non-void function [-Wreturn-type]
   25 | }
      | ^