Language: C++

#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;

//Knapsack1はWが小さく、vが大きい
//　→ wに注目してDP

vector<vector<ll>> dp(200, vector<ll>(110000, 0));

int main(){
  ll N, W;
  cin >> N >> W;
  vector<ll> w(N), v(N);
  for(int i = 0; i < N; i++){
    cin >> w.at(i) >> v.at(i);
  }

  for(int i = 0; i <= W; i++){
    if(w.at(0) <= i) dp.at(0).at(i) = v.at(0);
  }

  for(int i = 0; i <= W; i++){
    for(int j = 1; j < N; j++){
      chmax(dp.at(j).at(i), dp.at(j-1).at(i));
      if(i - w.at(j) >= 0) chmax(dp.at(j).at(i), dp.at(j-1).at(i - w.at(j)) + v.at(j));
    }
  }

  cout << dp.at(N-1).at(W) << endl;


}#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;

//Knapsack1はWが小さく、vが大きい
//　→ wに注目してDP

vector<vector<ll>> dp(200, vector<ll>(110000, 0));

int main(){
  ll N, W;
  cin >> N >> W;
  vector<ll> w(N), v(N);
  for(int i = 0; i < N; i++){
    cin >> w.at(i) >> v.at(i);
  }

  for(int i = 0; i <= W; i++){
    if(w.at(0) <= i) dp.at(0).at(i) = v.at(0);
  }

  for(int i = 0; i <= W; i++){
    for(int j = 1; j < N; j++){
      chmax(dp.at(j).at(i), dp.at(j-1).at(i));
      if(i - w.at(j) >= 0) chmax(dp.at(j).at(i), dp.at(j-1).at(i - w.at(j)) + v.at(j));
    }
  }

  cout << dp.at(N-1).at(W) << endl;


}

Compiler output:
a.cc:38:2: error: stray '#' in program
   38 | }#include <bits/stdc++.h>
      |  ^
a.cc:38:3: error: 'include' does not name a type
   38 | }#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc:44:31: error: redefinition of 'template<class T> bool chmax(T&, T)'
   44 | template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
      |                               ^~~~~
a.cc:7:31: note: 'template<class T> bool chmax(T&, T)' previously declared here
    7 | template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
      |                               ^~~~~
a.cc:45:31: error: redefinition of 'template<class T> bool chmin(T&, T)'
   45 | template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
      |                               ^~~~~
a.cc:8:31: note: 'template<class T> bool chmin(T&, T)' previously declared here
    8 | template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
      |                               ^~~~~
a.cc:46:17: error: redefinition of 'const long long int INF'
   46 | const long long INF = 1LL << 60;
      |                 ^~~
a.cc:9:17: note: 'const long long int INF' previously defined here
    9 | const long long INF = 1LL << 60;
      |                 ^~~
a.cc:51:20: error: redefinition of 'std::vector<std::vector<long long int> > dp'
   51 | vector<vector<ll>> dp(200, vector<ll>(110000, 0));
      |                    ^~
a.cc:14:20: note: 'std::vector<std::vector<long long int> > dp' previously declared here
   14 | vector<vector<ll>> dp(200, vector<ll>(110000, 0));
      |                    ^~
a.cc:53:5: error: redefinition of 'int main()'
   53 | int main(){
      |     ^~~~
a.cc:16:5: note: 'int main()' previously defined here
   16 | int main(){
      |     ^~~~