Language: C++

#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind 
#define Pint pair<int,int>
#define keta(a)  fixed << setprecision(a)
constexpr auto INF = 10000000000;
constexpr auto mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！
llint gcd(llint a, llint b) {
	if (b > a)swap(a, b);
	if (a % b == 0)return b;
	return gcd(b, a % b);
}
llint Tow(int n) {//2のn乗
	if (n == 0)return 1;
	llint x = Tow(n / 2);
	x %= mod;
	x *= x;
	x %= mod;
	if (n % 2 == 1)x *= 10;
	x %= mod;
	return x;
}


int  main() {
	int N, W;
	cin >> N >> W;
	hei(llint) w(N), v(N);
	int sumV = 0;
	rep(i, 0, N) {
		cin >> w[i] >> v[i];
		sumV += v[i];
	}
	whei(llint) dp(N + 1, hei(llint)(sumV + 1, INF));
	dp[0][0] = 0;
	rep(i, 0, N) {
		rep(j, 0, sumV) {
			if (j >= v[i])dp[i + 1][j] = min(dp[i + 1][j], dp[i][j - v[i]] + w[i]);
			dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
		}
	}
	int ans = 0;
	rep(i, 0, sumV + 1)if (dp[N][i] <= W)ans = i;
	cout << ans << endl;
	return 0;
}
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind 
#define Pint pair<int,int>
#define keta(a)  fixed << setprecision(a)
constexpr auto INF = 1000000000;
constexpr auto mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！

int main() {
	int N, W;
	cin >> N >> W;
	hei(llint) w(N), v(N);
	int sumV = 0;
	rep(i, 0, N) {
		cin >> w[i] >> v[i];
		sumV += v[i];
	}
	whei(llint) dp(N + 1, hei(llint)(sumV + 1, INF));
	rep(i, 0, N+1)dp[i][0] = 0;
	rep(i, 0, N) {
		rep(j, 0, sumV) {
			if (j >= v[i])dp[i + 1][j] = min(dp[i + 1][j], dp[i][j - v[i]] + w[i]);
			dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
		}
	}
	int ans = 0;
	rep(i, 0, sumV + 1)if (dp[N][i] <= W)ans = i;
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc:97:16: error: conflicting declaration 'constexpr const auto INF'
   97 | constexpr auto INF = 1000000000;
      |                ^~~
a.cc:28:16: note: previous declaration as 'constexpr const long int INF'
   28 | constexpr auto INF = 10000000000;
      |                ^~~
a.cc:98:16: error: conflicting declaration 'constexpr const auto mod'
   98 | constexpr auto mod = 1000000007;
      |                ^~~
a.cc:29:16: note: previous declaration as 'constexpr const int mod'
   29 | constexpr auto mod = 1000000007;
      |                ^~~
a.cc:101:5: error: redefinition of 'int main()'
  101 | int main() {
      |     ^~~~
a.cc:48:6: note: 'int main()' previously defined here
   48 | int  main() {
      |      ^~~~