Language: C++

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<typename T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}
#define itn int
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>=1;i--)
#define all(vec) vec.begin(),vec.end()
#define sort(vec) sort((vec).begin(),(vec).end())
#define rsort(vec) sort((vec).rbegin(), (vec).rend())
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef tuple<ll,ll,ll> tlll;
typedef tuple<int,int,int> tiii;
const ll mod=1e9+7;
const int inf=2e9;
const ll lnf=9e18;

ll dp[110][10000100];

int main(){
  rep(i,110)rep(j,100010){
    dp[i][j]=inf;
  }
  ll n,W; cin >> n >> W;
  vector<ll> w(n);
  vector<ll> v(n);
  rep(i,n) cin >> w[i] >> v[i];
  dp[0][0]=0;
  rep(i,n)rep(j,10000010){
    if(j+v[i]<10000010) chmin(dp[i+1][j+v[i]],dp[i][j]+w[i]);
    chmin(dp[i+1][j],dp[i][j]);
  }
  ll ans=0;
  rep(j,100010){
    if(dp[n][j]<=W) ans=j;
  }
  cout << ans << endl;
}


Compiler output:
/tmp/ccmx7e45.o: in function `__gnu_debug::_Error_formatter::_S_at(char const*, unsigned int, char const*)':
a.cc:(.text._ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_[_ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_]+0x16): relocation truncated to fit: R_X86_64_PC32 against symbol `guard variable for __gnu_debug::_Error_formatter::_S_at(char const*, unsigned int, char const*)::__formatter' defined in .bss._ZGVZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter[_ZGVZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter] section in /tmp/ccmx7e45.o
a.cc:(.text._ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_[_ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_]+0x26): relocation truncated to fit: R_X86_64_PC32 against symbol `guard variable for __gnu_debug::_Error_formatter::_S_at(char const*, unsigned int, char const*)::__formatter' defined in .bss._ZGVZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter[_ZGVZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter] section in /tmp/ccmx7e45.o
a.cc:(.text._ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_[_ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_]+0x4c): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_debug::_Error_formatter::_S_at(char const*, unsigned int, char const*)::__formatter' defined in .bss._ZZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter[_ZZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter] section in /tmp/ccmx7e45.o
a.cc:(.text._ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_[_ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_]+0x5b): relocation truncated to fit: R_X86_64_PC32 against symbol `guard variable for __gnu_debug::_Error_formatter::_S_at(char const*, unsigned int, char const*)::__formatter' defined in .bss._ZGVZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter[_ZGVZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter] section in /tmp/ccmx7e45.o
a.cc:(.text._ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_[_ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_]+0x6a): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_debug::_Error_formatter::_S_at(char const*, unsigned int, char const*)::__formatter' defined in .bss._ZZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter[_ZZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter] section in /tmp/ccmx7e45.o
collect2: error: ld returned 1 exit status