Language: C++

# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
using namespace std;
using LL = long long;
constexpr int MOD = 1000000000 + 7;
constexpr int INF = 2000000000;
const double PI = acos(-1);

int n;
int w[100];
int v[100];
int W;
int dp[101][10001];
int main() {
	cin >> n >> W;
	for (int i = 0; i < n; i++) {
		cin >> v[i] >> w[i];
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= W; j++) {
			if (j >= w[i]) {
				dp[i + 1][j] = max(dp[i][j - w[i]] + v[i], dp[i][j]);
			}
			else {
				dp[i + 1][j] = dp[i][j];
			}
		}
	}
	cout << dp[n][W] << endl;
}
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
using namespace std;
using LL = long long;
constexpr int MOD = 1000000000 + 7;
constexpr int INF = 2000000000;
const double PI = acos(-1);

int n;
int w[100];
int v[100];
int W;
int dp[101][10001];
int main() {
	cin >> n >> W;
	for (int i = 0; i < n; i++) {
		cin >> v[i] >> w[i];
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= W; j++) {
			if (j >= w[i]) {
				dp[i + 1][j] = max(dp[i][j - w[i]] + v[i], dp[i][j]);
			}
			else {
				dp[i + 1][j] = dp[i][j];
			}
		}
	}
	cout << dp[n][W] << endl;
}

Compiler output:
a.cc:57:15: error: redefinition of 'constexpr const int MOD'
   57 | constexpr int MOD = 1000000000 + 7;
      |               ^~~
a.cc:16:15: note: 'constexpr const int MOD' previously defined here
   16 | constexpr int MOD = 1000000000 + 7;
      |               ^~~
a.cc:58:15: error: redefinition of 'constexpr const int INF'
   58 | constexpr int INF = 2000000000;
      |               ^~~
a.cc:17:15: note: 'constexpr const int INF' previously defined here
   17 | constexpr int INF = 2000000000;
      |               ^~~
a.cc:59:14: error: redefinition of 'const double PI'
   59 | const double PI = acos(-1);
      |              ^~
a.cc:18:14: note: 'const double PI' previously defined here
   18 | const double PI = acos(-1);
      |              ^~
a.cc:61:5: error: redefinition of 'int n'
   61 | int n;
      |     ^
a.cc:20:5: note: 'int n' previously declared here
   20 | int n;
      |     ^
a.cc:62:5: error: redefinition of 'int w [100]'
   62 | int w[100];
      |     ^
a.cc:21:5: note: 'int w [100]' previously declared here
   21 | int w[100];
      |     ^
a.cc:63:5: error: redefinition of 'int v [100]'
   63 | int v[100];
      |     ^
a.cc:22:5: note: 'int v [100]' previously declared here
   22 | int v[100];
      |     ^
a.cc:64:5: error: redefinition of 'int W'
   64 | int W;
      |     ^
a.cc:23:5: note: 'int W' previously declared here
   23 | int W;
      |     ^
a.cc:65:5: error: redefinition of 'int dp [101][10001]'
   65 | int dp[101][10001];
      |     ^~
a.cc:24:5: note: 'int dp [101][10001]' previously declared here
   24 | int dp[101][10001];
      |     ^~
a.cc:66:5: error: redefinition of 'int main()'
   66 | int main() {
      |     ^~~~
a.cc:25:5: note: 'int main()' previously defined here
   25 | int main() {
      |     ^~~~