Language: C++

#include <bits/stdc++.h>
using namespace std;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
constexpr int NMAX = 105;
constexpr int WMAX = 10005;
enum Color { TOP = 0, DIAGONAL};
struct Item { int value, weight; };
int N, W;
vector<Item> items(NMAX + 1);
vv(int, C, NMAX + 1, WMAX + 1, 0);
vv(int, G, NMAX + 1, WMAX + 1, DIAGONAL);
void compute(int &maxValue, vi &selection) {
    rep(i, 1, N + 1) {
        rep(w, 1, W + 1) {
            C[i][w] = C[i -1][w];
            G[i][w] = TOP;
            if(items[i].weight > w) continue;
            if(items[i].value + C[i - 1][w - items[i].weight] > C[i - 1][w]) {
                C[i][w] = items[i].value + C[i - 1][w - items[i].weight];
                G[i][w] = DIAGONAL;
            }
        }
    }
    maxValue = C[N][W];
    selection.clear();
    int w = W;
    rrep(i, N, 0) {
        if(G[i][w] == DIAGONAL) {
            selection.eb(i);
            w -= items[i].weight;
        }
    }
    reverse(all(selection));
}
int main() {
    int maxValue;
    vi selection;
    cin >> N >> W;
    rep(i, 1, N + 1) {
        cin >> items[i].value >> items[i].weight;
    }
    compute(maxValue, selection);
    P(maxValue);
    return 0;
}

Compiler output:
a.cc:19:9: error: 'C' has not been declared
   19 | vv(int, C, NMAX + 1, WMAX + 1, 0);
      |         ^
a.cc:19:12: error: 'NMAX' is not a type
   19 | vv(int, C, NMAX + 1, WMAX + 1, 0);
      |            ^~~~
a.cc:19:17: error: expected ',' or '...' before '+' token
   19 | vv(int, C, NMAX + 1, WMAX + 1, 0);
      |                 ^
a.cc:19:34: error: expected constructor, destructor, or type conversion before ';' token
   19 | vv(int, C, NMAX + 1, WMAX + 1, 0);
      |                                  ^
a.cc:20:9: error: 'G' has not been declared
   20 | vv(int, G, NMAX + 1, WMAX + 1, DIAGONAL);
      |         ^
a.cc:20:12: error: 'NMAX' is not a type
   20 | vv(int, G, NMAX + 1, WMAX + 1, DIAGONAL);
      |            ^~~~
a.cc:20:17: error: expected ',' or '...' before '+' token
   20 | vv(int, G, NMAX + 1, WMAX + 1, DIAGONAL);
      |                 ^
a.cc:20:41: error: expected constructor, destructor, or type conversion before ';' token
   20 | vv(int, G, NMAX + 1, WMAX + 1, DIAGONAL);
      |                                         ^
a.cc: In function 'void compute(int&, vi&)':
a.cc:22:9: error: 'i' was not declared in this scope; did you mean 'vi'?
   22 |     rep(i, 1, N + 1) {
      |         ^
      |         vi
a.cc:22:5: error: 'rep' was not declared in this scope
   22 |     rep(i, 1, N + 1) {
      |     ^~~
a.cc:33:16: error: 'C' was not declared in this scope
   33 |     maxValue = C[N][W];
      |                ^
a.cc:36:5: error: 'rrep' was not declared in this scope
   36 |     rrep(i, N, 0) {
      |     ^~~~
a.cc:42:13: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'?
   42 |     reverse(all(selection));
      |             ^~~
      |             std::filesystem::perms::all
In file included from /usr/include/c++/14/filesystem:51,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200,
                 from a.cc:1:
/usr/include/c++/14/bits/fs_fwd.h:158:7: note: 'std::filesystem::perms::all' declared here
  158 |       all               =  0777,
      |       ^~~
a.cc: In function 'int main()':
a.cc:48:9: error: 'i' was not declared in this scope; did you mean 'vi'?
   48 |     rep(i, 1, N + 1) {
      |         ^
      |         vi
a.cc:48:5: error: 'rep' was not declared in this scope
   48 |     rep(i, 1, N + 1) {
      |     ^~~
a.cc:52:5: error: 'P' was not declared in this scope
   52 |     P(maxValue);
      |     ^