Language: C++

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
#define rep(i, n) for (i32 i = 0; i < (i32)(n); i++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using P = pair<i64,i64>;

int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
i64 n,w;
cin >> n >> w;
vector<i64> weight(n),value(n);
rep(i,n){
    cin >> weight[i] >> value[i];
}
vector<i64> dp(w + 1,-1);
dp[0] = 0;
rep(i,n) {
    for (i64 j = w; 0 < j; j--) {
        if(j - weight[i] >= 0 && dp[j - weight[i]] != -1){
            dp[j] = max(dp[j - weight[i]] + value[i],dp[j]);
        }else{
            dp[j] = max(dp[j],dp[j - 1]);
        }
    }
}
/*for(auto v:dp){
    cout << v << endl;
}*/
cout << max(dp[w],0) << endl;
}

Compiler output:
a.cc:8:13: error: 'int_fast32_t' does not name a type
    8 | using i32 = int_fast32_t;
      |             ^~~~~~~~~~~~
a.cc:9:13: error: 'int_fast64_t' does not name a type
    9 | using i64 = int_fast64_t;
      |             ^~~~~~~~~~~~
a.cc:13:16: error: 'i64' was not declared in this scope
   13 | using P = pair<i64,i64>;
      |                ^~~
a.cc:13:20: error: 'i64' was not declared in this scope
   13 | using P = pair<i64,i64>;
      |                    ^~~
a.cc:13:23: error: template argument 1 is invalid
   13 | using P = pair<i64,i64>;
      |                       ^
a.cc:13:23: error: template argument 2 is invalid
a.cc: In function 'int main()':
a.cc:18:1: error: 'i64' was not declared in this scope
   18 | i64 n,w;
      | ^~~
a.cc:19:8: error: 'n' was not declared in this scope
   19 | cin >> n >> w;
      |        ^
a.cc:19:13: error: 'w' was not declared in this scope
   19 | cin >> n >> w;
      |             ^
a.cc:20:11: error: template argument 2 is invalid
   20 | vector<i64> weight(n),value(n);
      |           ^
a.cc:10:24: error: 'i32' was not declared in this scope
   10 | #define rep(i, n) for (i32 i = 0; i < (i32)(n); i++)
      |                        ^~~
a.cc:21:1: note: in expansion of macro 'rep'
   21 | rep(i,n){
      | ^~~
a.cc:21:5: error: 'i' was not declared in this scope
   21 | rep(i,n){
      |     ^
a.cc:10:35: note: in definition of macro 'rep'
   10 | #define rep(i, n) for (i32 i = 0; i < (i32)(n); i++)
      |                                   ^
a.cc:24:11: error: template argument 2 is invalid
   24 | vector<i64> dp(w + 1,-1);
      |           ^
a.cc:24:24: error: expression list treated as compound expression in initializer [-fpermissive]
   24 | vector<i64> dp(w + 1,-1);
      |                        ^
a.cc:25:3: error: invalid types 'int[int]' for array subscript
   25 | dp[0] = 0;
      |   ^
a.cc:10:24: error: 'i32' was not declared in this scope
   10 | #define rep(i, n) for (i32 i = 0; i < (i32)(n); i++)
      |                        ^~~
a.cc:26:1: note: in expansion of macro 'rep'
   26 | rep(i,n) {
      | ^~~
a.cc:26:5: error: 'i' was not declared in this scope
   26 | rep(i,n) {
      |     ^
a.cc:10:35: note: in definition of macro 'rep'
   10 | #define rep(i, n) for (i32 i = 0; i < (i32)(n); i++)
      |                                   ^
a.cc:27:13: error: expected ';' before 'j'
   27 |     for (i64 j = w; 0 < j; j--) {
      |             ^~
      |             ;
a.cc:27:25: error: 'j' was not declared in this scope
   27 |     for (i64 j = w; 0 < j; j--) {
      |                         ^