Language: C++

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
 
using namespace __gnu_pbds;
using namespace std;
 
#define ll long long
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set; 
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define VPLL vector<PLL>
#define VPII vector<PII>
#define PQ priority_queue<PLL,VPLL, greater<PLL> > 
#define PQI priority_queue<PII,VPII,greater<PII> >
#define S second
#define F first
#define PB push_back
 
const ll MAX=1000000000000000;
ll dp[101][100001];
 
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
 
 
    ll n,W;
    cin>>n>>W;
    ll i,v[n],w[n],sm=0;
    for(i=0;i<n;i++) {
        cin>>w[i]>>v[i];
        sm+=v[i];
    }
    ll ans=0;
    for(i=1;i<=sm;i++)
        dp[0][i]=MAX;
    for(ll i=1;i<=n;i++)
    {
        for(ll j=1;j<=sm;j++)
        {
            if(v[i-1]>j)
                dp[i][j]=dp[i-1][j];
            else
                dp[i][j]=min(dp[i-1][j-v[i-1]]+w[i-1],dp[i-1][j]);
            //cout << dp[i][j] << " ";
            if(dp[i][j]<=W)
            {
                if(j>ans)
                    ans=j;
            }
        }
        //cout << "\n";
    }
    cout << ans;
    return 0;
}
/*
 
 * This code is written by Sanskar Agarwal
 
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace __gnu_pbds;
using namespace std;

#define ll long long
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set; 
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define VPLL vector<PLL>
#define VPII vector<PII>
#define PQ priority_queue<PLL,VPLL, greater<PLL> > 
#define PQI priority_queue<PII,VPII,greater<PII> >
#define S second
#define F first
#define PB push_back

const ll MAX=1000000000000000;
ll dp[101][100001];

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);


    ll n,W;
    cin>>n>>W;
    ll i,v[n],w[n],sm=0;
    for(i=0;i<n;i++) {
        cin>>w[i]>>v[i];
        sm+=v[i];
    }
    ll ans=0;
    for(i=1;i<=sm;i++)
        dp[0][i]=MAX;
    for(ll i=1;i<=n;i++)
    {
        for(ll j=1;j<=sm;j++)
        {
            if(v[i-1]>j)
                dp[i][j]=dp[i-1][j];
            else
                dp[i][j]=min(dp[i-1][j-v[i-1]]+w[i-1],dp[i-1][j]);
            //cout << dp[i][j] << " ";
            if(dp[i][j]<=W)
            {
                if(j>ans)
                    ans=j;
            }
        }
        //cout << "\n";
    }
    cout << ans;
    return 0;
}
Submission Info

Compiler output:
a.cc:84:10: error: redefinition of 'const long long int MAX'
   84 | const ll MAX=1000000000000000;
      |          ^~~
a.cc:20:10: note: 'const long long int MAX' previously defined here
   20 | const ll MAX=1000000000000000;
      |          ^~~
a.cc:85:4: error: redefinition of 'long long int dp [101][100001]'
   85 | ll dp[101][100001];
      |    ^~
a.cc:21:4: note: 'long long int dp [101][100001]' previously declared here
   21 | ll dp[101][100001];
      |    ^~
a.cc:87:5: error: redefinition of 'int main()'
   87 | int main()
      |     ^~~~
a.cc:23:5: note: 'int main()' previously defined here
   23 | int main()
      |     ^~~~
a.cc:124:1: error: 'Submission' does not name a type
  124 | Submission Info
      | ^~~~~~~~~~