criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int N=110;
const int L=N*1e3+10;
int we[N],v[N];
long long dp[N][L];
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
    int n,W;
    cin>>n>>W;
    for(int i=0;i<n;i++)
        cin>>we[i]>>v[i];
    dp[0][0]=0;
    for(int i=1;i<=n;i++)
        dp[0][i]=1e10;
    int Max=0;
    for(int i=1;i<=n;i++){
        for(int j=0;j<L;j++)      
            dp[i][j]=dp[i - 1][j];
            if(j-v[i]>=0)
                dp[i][j] = min(dp[i][j], dp[i-1][j - v[i]] + w[i]);
            if(Max<j&&dp[i][j]<=W)
                Max=j;
    }
    cout<<Max;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:16: error: 'j' was not declared in this scope
   21 |             if(j-v[i]>=0)
      |                ^
a.cc:22:62: error: 'w' was not declared in this scope
   22 |                 dp[i][j] = min(dp[i][j], dp[i-1][j - v[i]] + w[i]);
      |                                                              ^
a.cc:23:20: error: 'j' was not declared in this scope
   23 |             if(Max<j&&dp[i][j]<=W)
      |                    ^
Language: C++

#include<iostream>
#include<cstdio>
#define MAX 1000000005
using namespace std;
int w[MAX];
int v[MAX];
int dp[MAX]={0};
int main(){
	int n,maxW;
	scanf("%d %d",&n,&maxW);
	for(int i=0;i<n;i++){
		scanf("%d %d",&w[i],&v[i]);
	}
	for(int i=0;i<=maxW;i++){
		dp[i]=0;
	}
	for(int i=1;i<=n;i++){
		for(int j=maxW;j>=1;j--){
			if(j>=w[i-1]) dp[j]= max(dp[j-w[i-1]]+v[i-1],dp[j]);
		}
	}
	int res=0;
	for(int j=1;j<=maxW;j++){
		res=max(res,dp[j]);
	}
	printf("%d",res); 
	return 0;
}

Compiler output:
/tmp/ccQUBfBc.o: in function `main':
a.cc:(.text+0x40): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccQUBfBc.o
a.cc:(.text+0x9a): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccQUBfBc.o
a.cc:(.text+0xfb): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccQUBfBc.o
a.cc:(.text+0x12f): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccQUBfBc.o
a.cc:(.text+0x149): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccQUBfBc.o
a.cc:(.text+0x177): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccQUBfBc.o
a.cc:(.text+0x1bc): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccQUBfBc.o
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<cstdio>
#define MAX 1000000005
using namespace std;
int w[MAX];
int v[MAX];
int dp[MAX]={0};
int main(){
	int n,maxW;
	scanf("%d %d",&n,&maxW);
	for(int i=0;i<n;i++){
		scanf("%d %d",&w[i],&v[i]);
	}
	for(int i=0;i<=maxW;i++){
		dp[i]=0;
	}
	for(int i=1;i<=n;i++){
		for(int j=maxW;j>=1;j--){
			if(j>=w[i-1]) dp[j]= max(dp[j-w[i-1]]+v[i-1],dp[j]);
		}
	}
	int res=0;
	for(int j=1;j<=maxW;j++){
		res=max(res,dp[j]);
	}
	printf("%lld",res); 
	return 0;
}

Compiler output:
/tmp/cciZNyIn.o: in function `main':
a.cc:(.text+0x40): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cciZNyIn.o
a.cc:(.text+0x9a): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/cciZNyIn.o
a.cc:(.text+0xfb): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/cciZNyIn.o
a.cc:(.text+0x12f): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/cciZNyIn.o
a.cc:(.text+0x149): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cciZNyIn.o
a.cc:(.text+0x177): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/cciZNyIn.o
a.cc:(.text+0x1bc): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/cciZNyIn.o
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
#define forn(i,a,b) for(long long i=a;i<=b;i++)
#define fork(i,a,b,k) for(long long i=a;i<=b;i+=k)
using namespace std;
typedef long long ll;
ll n,G,w[105],v[105];
vector<ll>dp(105)(1000000005);
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n>>G;
	for(ll i=1;i<=n;i++)cin>>w[i]>>v[i];
	for(ll i=0;i<=G;i++)dp[0][i]=0;
	for(ll i=0;i<=n;i++)dp[i][0]=0;
	for(ll i=1;i<=n;i++){
		for(ll j=1;j<=G;j++){
			if(w[i]<=j){
				dp[i][j]=max(dp[i-1][j],dp[i-1][j-w[i]]+v[i]);
			} else {
				dp[i][j]=dp[i-1][j];
			}
		}
	}
	cout<<dp[n][G];
}

Compiler output:
a.cc:7:18: error: expected ',' or ';' before '(' token
    7 | vector<ll>dp(105)(1000000005);
      |                  ^
a.cc: In function 'int main()':
a.cc:12:34: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type {aka long long int}[ll {aka long long int}]' for array subscript
   12 |         for(ll i=0;i<=G;i++)dp[0][i]=0;
      |                                  ^
a.cc:13:34: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type {aka long long int}[int]' for array subscript
   13 |         for(ll i=0;i<=n;i++)dp[i][0]=0;
      |                                  ^
a.cc:17:38: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type {aka long long int}[ll {aka long long int}]' for array subscript
   17 |                                 dp[i][j]=max(dp[i-1][j],dp[i-1][j-w[i]]+v[i]);
      |                                      ^
a.cc:17:53: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type {aka long long int}[ll {aka long long int}]' for array subscript
   17 |                                 dp[i][j]=max(dp[i-1][j],dp[i-1][j-w[i]]+v[i]);
      |                                                     ^
a.cc:17:64: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type {aka long long int}[ll {aka long long int}]' for array subscript
   17 |                                 dp[i][j]=max(dp[i-1][j],dp[i-1][j-w[i]]+v[i]);
      |                                                                ^
a.cc:19:38: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type {aka long long int}[ll {aka long long int}]' for array subscript
   19 |                                 dp[i][j]=dp[i-1][j];
      |                                      ^
a.cc:19:49: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type {aka long long int}[ll {aka long long int}]' for array subscript
   19 |                                 dp[i][j]=dp[i-1][j];
      |                                                 ^
a.cc:23:20: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type {aka long long int}[ll {aka long long int}]' for array subscript
   23 |         cout<<dp[n][G];
      |                    ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define INF 1000000005
int main()
{
	int n,W;
	cin >>n>>W;
	vector<vector<int> > v(n+1,vector<int>(2));
	int sum=0;
	for(int i=1;i<=n;i++)
	{
		cin>>v[i][0]>>v[i][1];
		sum+=v[i][1];
	}

	vector<long long int> dp(sum+1,INF);
	for(int item=0;item<=n;item++)
	{
		dp[0]=0;
		for (int val = sum; val>=0 ;--val)
		{
			dp[val] = min(dp[val],dp[val-v[item][1]]+v[item][0]);
		}
	}
	long long int ans=0;
	for (int i=0;i<sum+1;i++)
	{
		if(dp[i] <= W)
			ans = max(ans,i);
	}
	cout << ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:34: error: no matching function for call to 'max(long long int&, int&)'
   29 |                         ans = max(ans,i);
      |                               ~~~^~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:29:34: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   29 |                         ans = max(ans,i);
      |                               ~~~^~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:29:34: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   29 |                         ans = max(ans,i);
      |                               ~~~^~~~~~~
Language: C++

#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <random>
#include <set>
#include <stack>

//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater<int>())
#define rn return
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#include <time.h>
typedef std::pair<int,int> pii;
using namespace std;
using ll = long long;


int main(){
    ll n,w;
    cin >> n >> w;
    vector<ll> ws(n);
    vector<ll> vs(n);
    rep(i,n) cin >> ws[i] >> vs[i];
    ll dp[200000][n+1];
    memset(dp,0,sizeof dp);
    
    for(int i = 1; i <= n; i++){
        for(int j = 0; j <= 100000; j++){
            // not chosen
            dp[j][i] = max(dp[j][i],dp[j][i-1]);
            
            // chosen
            ll nw = dp[j][i-1] + ws[i-1];
            int nv = j + vs[i-1];  
            if (nw <= w　&& (j == 0 || dp[j][i-1]!=0LL)) {
                dp[nv][i] = max(dp[nv][i], nw);
            }
        }
    }

    ll ans = 0LL;
    for(ll i = 0LL; i <= 100000;i++){
        if (dp[i][n]!=0LL) ans = max(ans,i);
    }
    cout << ans;
    
}









Compiler output:
a.cc:59:23: error: extended character 　 is not valid in an identifier
   59 |             if (nw <= w　&& (j == 0 || dp[j][i-1]!=0LL)) {
      |                       ^
a.cc: In function 'int main()':
a.cc:59:23: error: 'w\U00003000' was not declared in this scope
   59 |             if (nw <= w　&& (j == 0 || dp[j][i-1]!=0LL)) {
      |                       ^~~
Language: C++

#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <random>
#include <set>
#include <stack>

//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater<int>())
#define rn return
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#include <time.h>
typedef std::pair<int,int> pii;
using namespace std;
using ll = long long;


int main(){
    ll n,w;
    cin >> n >> w;
    vector<ll> ws(n);
    vector<ll> vs(n);
    rep(i,n) cin >> ws[i] >> vs[i];
    ll dp[200000][n+1];
    memset(dp,0,sizeof dp);
    
    for(int i = 1; i <= n; i++){
        for(int j = 0; j <= 100000; j++){
            // not chosen
            dp[j][i] = max(dp[j][i],dp[j][i-1]);
            
            // chosen
            ll nw = dp[j][i-1] + ws[i-1];
            int nv = j + vs[i-1];  
            if (nw <= w　&& (j == 0 || dp[j][i-1]!=0)) dp[nv][i] = max(dp[nv][i], nw);
        }
    }

    ll ans = 0LL;
    for(ll i = 0LL; i <= 100000;i++){
        if (dp[i][n]!=0LL) ans = max(ans,i);
    }
    cout << ans;
    
}









Compiler output:
a.cc:59:23: error: extended character 　 is not valid in an identifier
   59 |             if (nw <= w　&& (j == 0 || dp[j][i-1]!=0)) dp[nv][i] = max(dp[nv][i], nw);
      |                       ^
a.cc: In function 'int main()':
a.cc:59:23: error: 'w\U00003000' was not declared in this scope
   59 |             if (nw <= w　&& (j == 0 || dp[j][i-1]!=0)) dp[nv][i] = max(dp[nv][i], nw);
      |                       ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 1001001001
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int N;
  long long W;
  vector<int> w(110);
  vector<int> v(110);
  vector<vector<ll>> dp(110, vector<ll>(1010));

  ll res = 0;

  cin >> N >> W;
  rep(i,N){
    cin >> w.at(i) >> v.at(i);
  } 
  
  rep(i,110){
    rep(j,1010){
      dp.at(i).at(j) = INF;
    }
  } 
  dp.at(0).at(0) = 0;
  
  rep(i,N){
    rep(j,110){
      if(v.at(i) <= j){
        dp.at(i+1).at(j) = min(dp.at(i).at(j-v.at(i)) + w.at(i), dp.at(i).at(j));
      }
      else{
        dp.at(i+1).at(j) = dp.at(i).at(j);
      }
    }
  }

  rep(i,1010){
    //cout << dp.at(N).at(i) << endl;
    if(dp.at(N).at(i) <= W){
      res = max(res, i);
    }
    //res = min(res, dp.at(N).at(i));
  }

  cout << res << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:16: error: no matching function for call to 'max(ll&, int&)'
   42 |       res = max(res, i);
      |             ~~~^~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:42:16: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   42 |       res = max(res, i);
      |             ~~~^~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:42:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   42 |       res = max(res, i);
      |             ~~~^~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#include m 1000000007
int main()
{
  int n;
  long long int w;
  cin>>n>>w;
  long long int dp[n+1][w+1];
  for(int i=0;i<=n;i++)
  {
    for(long long int j=0;j<=w;j++)
    {
     
       dp[i][j]=0;
    }
  }
  
  for(int i=1;i<=n;i++)
  {
      long long int w1;
       int c;
      cin>>w1>>c;
      
    for(long long int j=1;j<=w;j++)
    {
     
      if(w1<=j)
      {
        dp[i][j]=(max(c+dp[i-1][j-w1],dp[i-1][j]))%m;
      }
      else
        dp[i][j]=dp[i-1][j];
    }
  }
  cout<<dp[n][w];
  return 0;
  
}

Compiler output:
a.cc:3:10: error: #include expects "FILENAME" or <FILENAME>
    3 | #include m 1000000007
      |          ^
a.cc: In function 'int main()':
a.cc:30:52: error: 'm' was not declared in this scope
   30 |         dp[i][j]=(max(c+dp[i-1][j-w1],dp[i-1][j]))%m;
      |                                                    ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  long long int w;
  cin>>n>>w;
  long long int dp[n+1][w+1];
  for(int i=0;i<=n;i++)
  {
    for(long long int j=0;j<=w;j++)
    {
     
       dp[i][j]=0;
    }
  }
  
  for(int i=1;i<=n;i++)
  {
      long long int w1
       int c;
      cin>>w1>>c;
      
    for(long long int j=1;j<=w;j++)
    {
     
      if(w1<=j)
      {
        dp[i][j]=max(c+dp[i-1][j-w1],dp[i-1][j]);
      }
      else
        dp[i][j]=dp[i-1][j];
    }
  }
  cout<<dp[n][w];
  return 0;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:8: error: expected initializer before 'int'
   21 |        int c;
      |        ^~~
a.cc:22:12: error: 'w1' was not declared in this scope; did you mean 'w'?
   22 |       cin>>w1>>c;
      |            ^~
      |            w
a.cc:22:16: error: 'c' was not declared in this scope
   22 |       cin>>w1>>c;
      |                ^
Language: C++

#include <iostream> 
#include <vector> 

using namespace std; 

int main() { 
  int n, w;
  cin>>n>>w; 
  long int a[n][2];
  vector<long int> pdp(w+1, 0); 
  vector<long int> dp(w+1, 0);
  for (int i=0;i<n;i++) { 
    cin>>a[i][0]>>a[i][1]; 
  } 
  
  for (int i=1;i<=n;i++) { 
    for (int j=1;j<=w;j++) { 
      if (a[i-1][0] <= j) {
          dp[j] = max(dp[j], pdp[j-a[i-1][0]] + a[i-1][1]); 
      }
      else 
        dp[j] = pdp[j];
     // cout<<dp[i][j]<<" ";
    }
    for (int j=1; j<=w; j++) 
      pdp[j] = dp[j];
   // cout<<endl;
  }
  cout<<dp[n][w]<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:14: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type {aka long int}[int]' for array subscript
   29 |   cout<<dp[n][w]<<endl;
      |              ^
Language: C++

#include<bits/stdc++.h>
using namespace std;

vector<vector<long long> >dp;
vector<int>v,w;
int minwt(int n,int val){
        //cout<<n<<" "<<val<<"\n";
        //int x;cin>>x;
        if(dp[n][val]!=-1){
            //cout<<n<<" "<<val<<" "<<dp[n][val]<<"\n";
            return dp[n][val];
        }
        long long mn = minwt(n-1,val);
        if(val>=v[n]){
            mn = min(mn,minwt(n-1,val-v[n])+w[n]);
        }
        //cout<<n<<" "<<val<<" "<<mn<<"\n";
        //int r;cin>>r;
        return mn;
}
void solve(){
	int n,wt;cin>>n>>wt;
	v.resize(n);
	w.resize(n);
	dp.resize(n,vector<long long>(1001,-1));
	for(int i=0;i<n;i++){
        cin>>w[i]>>v[i];
	}
	for(int i=0;i<=1000;i++){
        dp[0][i]=INT_MAX;
	}
	dp[0][v[0]]=w[0];
	dp[0][0]=0;
	int ans=0;
	for(int i=0;i<=1000;i++){
        if(minwt(n-1,i)<=wt){
            ans = i;
        }
	}
	cout << ans<<"\n";
}
int main(){
	int t=1;//cin>>t;
	while(t--){
		solve();
	}
	return 0;
}


Compiler output:
a.cc: In function 'int minwt(int, int)':
a.cc:15:21: error: no matching function for call to 'min(long long int&, int)'
   15 |             mn = min(mn,minwt(n-1,val-v[n])+w[n]);
      |                  ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:15:21: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   15 |             mn = min(mn,minwt(n-1,val-v[n])+w[n]);
      |                  ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:15:21: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   15 |             mn = min(mn,minwt(n-1,val-v[n])+w[n]);
      |                  ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define vi vector <ll> v
#define vii vector<pair<ll,ll>>v
#define pb push_back
#define mod 1000000007
#define f(i,a,b) for(ll i=a;i<b;i++)
#define while_ int t;cin>>t;while(t--)
#define vmax 100000
using namespace std;

ll dp[105][vmax];

ll maxP(ll V, ll n, ll w[], ll v[])
{
   if(n==0 || V==0) return 0;
   if(n==1 && V==v[0]) return w[0];
   if(n==1 && V!=v[0]) return 1e9+6;
   if(dp[V][n]!=-1) return dp[V][n];
   if(v[n-1]>V) return dp[V][n]=dp[V][n-1];
   else 
   return dp[V][n]=min(dp[V][n-1],w[n-1]+dp[V-v[n-1]][n-1]);
}

int main() {
    fastio
    memset(dp,-1,sizeof(dp));
    ll n,W;
    cin>>n>>W;
    ll w[n],v[n];
    f(i,0,n) cin>>w[i]>>v[i];
    ll V=n*1000;
    maxP(V,n,w,v);
    ll ans=0;
    f(i,0,vmax)
    if(dp[n][i]<=W)
     ans=i;
    cout<<i;
}













Compiler output:
a.cc: In function 'int main()':
a.cc:39:11: error: 'i' was not declared in this scope
   39 |     cout<<i;
      |           ^
Language: C++

#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define vi vector <ll> v
#define vii vector<pair<ll,ll>>v
#define pb push_back
#define mod 1000000007
#define f(i,a,b) for(ll i=a;i<b;i++)
#define while_ int t;cin>>t;while(t--)
#define vmax 1e5
using namespace std;

ll dp[105][vmax];

ll maxP(ll V, ll n, ll w[], ll v[])
{
   if(n==0 || V==0) return 0;
   if(n==1 && V==v[0]) return w[i];
   if(n==1 && V!=v[0]) return 1e9+6;
   if(dp[V][n]!=-1) return dp[V][n];
   if(v[n-1]>V) return dp[V][n]=dp[V][n-1];
   else 
   return dp[V][n]=min(dp[V][n-1],w[n-1]+dp[V-v[n-1]][n-1]);
}

int main() {
    fastio
    memset(dp,-1,sizeof(dp));
    ll n,W;
    cin>>n>>W;
    ll w[n],v[n];
    f(i,0,n) cin>>w[i]>>v[i];
    ll V=n*1000;
    maxP(V,n,w,v);
    ll ans=0;
    f(i,0,vmax)
    if(dp[n][i]<=W)
     ans=i;
    cout<<i;
}













Compiler output:
a.cc:10:14: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
   10 | #define vmax 1e5
      |              ^~~
a.cc:13:12: note: in expansion of macro 'vmax'
   13 | ll dp[105][vmax];
      |            ^~~~
a.cc:10:14: error: could not convert '1.0e+5' from 'double' to 'long unsigned int'
   10 | #define vmax 1e5
      |              ^~~
      |              |
      |              double
a.cc:13:12: note: in expansion of macro 'vmax'
   13 | ll dp[105][vmax];
      |            ^~~~
a.cc:10:14: error: size of array 'dp' has non-integral type 'double'
   10 | #define vmax 1e5
      |              ^~~
a.cc:13:12: note: in expansion of macro 'vmax'
   13 | ll dp[105][vmax];
      |            ^~~~
a.cc: In function 'long long int maxP(long long int, long long int, long long int*, long long int*)':
a.cc:18:33: error: 'i' was not declared in this scope
   18 |    if(n==1 && V==v[0]) return w[i];
      |                                 ^
a.cc: In function 'int main()':
a.cc:39:11: error: 'i' was not declared in this scope
   39 |     cout<<i;
      |           ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;

long long INF = 1LL << 60;
long long MAXV = 100000+1;


long long dp[100+1][MAXV];

int main() {
  long long N, W;
  cin >> N >> W;
  vector<long long> w(N), v(N);
  for (long long i = 0; i < N; i++) {
    cin >> w[i] >> v[i];
    for (long long j = 0; j < MAXV; j++) {
      dp[i][j] = INF;
    }
  }
  dp[0][0] = 0;
  
  for (long long i = 0; i < N; i++) {
    for (long long j = 0; j < MAXV; j++) {
      if (v[i] <= j) 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]);
    }
  }
  long long result = 0;
  for (long long j = 0; j < MAXV; j++) {
    if (dp[N-1][j] <= W) {
      result = j;
    }
  }
  cout << result << endl;
  return 0;
}

Compiler output:
a.cc:9:21: error: size of array 'dp' is not an integral constant-expression
    9 | long long dp[100+1][MAXV];
      |                     ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
static const int INF=1000000000;
int main(){
int N; int64_t W;
  cin>>N>>W;
  vector<int64_t>w(N);
  vector<int>v(N);
  for(int i=0;i<N;i++){
  cin>>w.at(i);
    cin>>v.at(i);
  }vector<vector<int64_t>>dp(1+N,vector<int64_t>(100001,0));
  for(int j=1;j<=100000;j++)
    dp[0][j]=INF;
  for(int i=1;i<=N;i++){
  for(int j=1;j<=100000;j++){
  if(v[i-1]<=j)
    dp[i][j]=min(dp[i-1][j],dp[i-1][j-v[i-1]]+w[i-1]);
  else
    dp[i][j]=min(dp[i-1][j],w[i-1]);
  }
  
  }auto itr=upper_bound(dp[N].begin(),dp[N].end(),W)
    int ans=distance(dp[N].begin(),itr);
  cout<<ans<<endl;
   return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:5: error: expected ',' or ';' before 'int'
   24 |     int ans=distance(dp[N].begin(),itr);
      |     ^~~
a.cc:25:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   25 |   cout<<ans<<endl;
      |         ^~~
      |         abs
Language: C++

#include<bits/stdc++.h>
using namespace std;
static const int INF=1000000000;
int main(){
int N, int64_t W;
  cin>>N>>W;
  vector<int64_t>w(N);
  vector<int>v(N);
  for(int i=0;i<N;i++){
  cin>>w.at(i);
    cin>>v.at(i);
  }vector<vector<int64_t>>dp(1+N,vector<int64_t>(100001,0));
  for(int j=1;j<=100000;j++)
    dp[0][j]=INF;
  for(int i=1;i<=N;i++){
  for(int j=1;j<=100000;j++){
  if(v[i-1]<=j)
    dp[i][j]=min(dp[i-1][j],dp[i-1][j-v[i-1]]+w[i-1]);
  else
    dp[i][j]=min(dp[i-1][j],w[i-1]);
  }
  
  }auto itr=upper_bound(dp[N].begin(),dp[N].end(),W)
    int ans=distance(dp[N].begin(),itr);
  cout<<ans<<endl;
   return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:16: error: expected initializer before 'W'
    5 | int N, int64_t W;
      |                ^
a.cc:6:11: error: 'W' was not declared in this scope
    6 |   cin>>N>>W;
      |           ^
a.cc:25:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   25 |   cout<<ans<<endl;
      |         ^~~
      |         abs
Language: C++

#include <iostream>

using namespace std;

int const inf = 1000000000 + 5;

struct itm{
  int price, weight;
};

itm v[101];

int dp[101][100001];//minimum weight using I items and a maximum value of J

int main() {

  int n, k;
  cin >> n >> k;
  for(int i = 1;i <= n;i++){
    cin >> v[i].weight >> v[i].price;
  }
  for(int i = 1; i <= 100; i++)//initializing values with a very big value so that if we can't make a sum of it we don't need special cases
    for(int j = 0; j <= 100000; j++){//like the previous version
      dp[i][j] = inf;//initialized at line 5
    }
  }
  dp[0][0] = 0;// in case the difference is (j - v[i].price) 0

  for(int i = 1;i <= n;i++){
    for(int j = 0;j <= 100000;j++){//sum can also be 0 if nothing is affordable + we can build line 1 using it
      dp[i][j] = dp[i - 1][j];//knapsack formula
      if(v[i].price <= j){//self-explanatory: j - v[i].price
        dp[i][j] = min(dp[i][j], dp[i - 1][j - v[i].price] + v[i].weight);
      }
    }
  }

  //this did not change
  for(int j = 100000;j > 0;j--){
    if(dp[n][j] <= k && dp[n][j] != 0){
      cout << j;
      return 0;
    }
  }
  cout << 0;
  return 0;
}


Compiler output:
a.cc:27:3: error: 'dp' does not name a type
   27 |   dp[0][0] = 0;// in case the difference is (j - v[i].price) 0
      |   ^~
a.cc:29:3: error: expected unqualified-id before 'for'
   29 |   for(int i = 1;i <= n;i++){
      |   ^~~
a.cc:29:17: error: 'i' does not name a type
   29 |   for(int i = 1;i <= n;i++){
      |                 ^
a.cc:29:24: error: 'i' does not name a type
   29 |   for(int i = 1;i <= n;i++){
      |                        ^
a.cc:39:3: error: expected unqualified-id before 'for'
   39 |   for(int j = 100000;j > 0;j--){
      |   ^~~
a.cc:39:22: error: 'j' does not name a type
   39 |   for(int j = 100000;j > 0;j--){
      |                      ^
a.cc:39:28: error: 'j' does not name a type
   39 |   for(int j = 100000;j > 0;j--){
      |                            ^
a.cc:45:3: error: 'cout' does not name a type
   45 |   cout << 0;
      |   ^~~~
a.cc:46:3: error: expected unqualified-id before 'return'
   46 |   return 0;
      |   ^~~~~~
a.cc:47:1: error: expected declaration before '}' token
   47 | }
      | ^
Language: C++

//Author: kaiyu
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cstring>
#include <string>
#include <queue>
#include <stack>
#include <numeric>
#include <iomanip>
#include <climits>
using namespace std;
typedef long long ll;
#define sz(x) ((long long)(x).size())
#define all(x)  x.begin(),x.end()
#define endl "\n"
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define pii pair<int,int>
#define tt ll t;cin >> t;while(t--)
#define int3(x,y,z) ll x,y,z;cin >> x >> y >> z;
#define int2(x,y) ll x,y;cin >> x >>y;
#define int1(x) ll x;cin>>x;
#define  fio ios::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
ll power(ll a,ll b,ll m=mod){ ll ans=1; a=a%m;  while(b>0) {  if(b&1)  ans=(1ll*a*ans)%m; b>>=1;a=(1ll*a*a)%m;}return ans;}

ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}


bool cmp(pair<string,int>p1,pair<string,int>p2) {
    return p1.ss > p2.ss;
}

const int MAXN = 5 * 100000 + 10;


using ll = long long;

void max_self(ll& a, ll b) {
    a = max(a, b);
}
void min_self(ll& a, ll b) {
    a = min(a, b);
}


// O(n * W)
const ll INF = 1e18L + 5;

int main() {
    int n, W;
    scanf("%d%d", &n, &W);
    vector<int> weight(n), value(n);
    for(int i = 0; i < n; ++i) {
        scanf("%d%d", &weight[i], &value[i]);
    }
    int sum_value = 0;
    for(int x : value) {
        sum_value += x;
    }
    vector<ll> dp(sum_value + 1, INF); // 0 ... W
    dp[0] = 0;
    // dp[i] - the minimum total weight of items with total value exactly i
    for(int item = 0; item < n; ++item) {
        for(int value_already = sum_value - value[item]; value_already >= 0; --value_already) {
            //~ for(int weight_already = 0; weight_already <= W - weight; ++weight_already) {
            min_self(dp[value_already+value[item]], dp[value_already] + weight[item]);
        }
    }
    ll answer = 0;
    for(int i = 0; i <= sum_value; ++i) {
        if(dp[i] <= W) {
            answer = max(answer, (ll) i);
        }
        //~ min_self(answer, dp[i]);
    }
    printf("%lld\n", answer);

Compiler output:
a.cc: In function 'int main()':
a.cc:89:30: error: expected '}' at end of input
   89 |     printf("%lld\n", answer);
      |                              ^
a.cc:62:12: note: to match this '{'
   62 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
#define ll long long

const int mxn = 100;
const ll inf = 1e18+5;

ll val[mxn], w[mxn];

int n, wt;
using namespace std;

int main(){
    cin>>n>>wt;
  	ll sum_val = 0;
  
    for(int i=0; i<n; ++i){
        ll weight, v;
        cin>>weight>>v;
        val[i] = v;
        w[i] = weight;
      	sum_val += v;
    }
  
  	ll dp[n+1][sum_val+1];
  	dp[0][0] = 0
    for(int i=1; i <= sum_val; i++)
    	dp[0][i]=1e18;
  	ll ans = 0LL;
  
  	for(int i=0; i < n; i++){
    	for(ll j=0; j <= sum_val; j++){
          	if(j >= val[i])
        		dp[i+1][j] = min(dp[i][j], dp[i-1][j-val[i]]+w[i]);
          	else
              	dp[i+1][j] = dp[i][j];
          
          	if(dp[i+1][j] <= wt)
              	ans = max(ans, j);
        }
    }
   
    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:21: error: expected ';' before 'for'
   25 |         dp[0][0] = 0
      |                     ^
      |                     ;
   26 |     for(int i=1; i <= sum_val; i++)
      |     ~~~              
a.cc:26:18: error: 'i' was not declared in this scope
   26 |     for(int i=1; i <= sum_val; i++)
      |                  ^
Language: C++

#include <bits/stdc++.h>
#define ll long long

const int mxn = 100;
const ll inf = 1e18+5;

ll val[mxn], w[mxn];

int n, wt;
using namespace std;

int main(){
    cin>>n>>wt;
  	ll sum_val = 0;
  
    for(int i=0; i<n; ++i){
        ll weight, v;
        cin>>weight>>v;
        val[i] = v;
        w[i] = weight;
      	sum_val += v;
    }
  
  	ll dp[n+1][sum_val+1] = ;
  	dp[0][0] = 0
    for(int i=1; i <= sum_val; i++)
    	dp[0][i]=1e18;
  	ll ans = 0LL;
  
  	for(int i=0; i < n; i++){
    	for(ll j=0; j <= sum_val; j++){
          	if(j >= val[i])
        		dp[i+1][j] = min(dp[i][j], dp[i-1][j-val[i]]+w[i]);
          	else
              	dp[i+1][j] = dp[i][j];
          
          	if(dp[i+1][j] <= wt)
              	ans = max(ans, j);
        }
    }
   
    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:33: error: expected primary-expression before ';' token
   24 |         ll dp[n+1][sum_val+1] = ;
      |                                 ^
a.cc:25:21: error: expected ';' before 'for'
   25 |         dp[0][0] = 0
      |                     ^
      |                     ;
   26 |     for(int i=1; i <= sum_val; i++)
      |     ~~~              
a.cc:26:18: error: 'i' was not declared in this scope
   26 |     for(int i=1; i <= sum_val; i++)
      |                  ^
Language: C++

#include <bits/stdc++.h>
#define ll long long

const int mxn = 100;
const ll inf = 1e9+5;

ll val[mxn], w[mxn];

int n, wt;
using namespace std;

int main(){
    cin>>n>>wt;
  	ll sum_val = 0;
  
    for(int i=0; i<n; ++i){
        ll weight, v;
        cin>>weight>>v;
        val[i] = v;
        w[i] = weight;
      	sum_val += v;
    }
  
  	ll dp[n+1][sum_val+1] = {inf};
  	ll ans = 0LL;
  
  	for(int i=0; i < n; i++){
    	for(int j=0; j <= sum_val; j++){
          	if(j >= val[i])
        		dp[i+1][j] = min(dp[i][j], dp[i-1][j-val[i]]+w[i]);
          	else
              	dp[i+1][j] = dp[i][j];
          
          	if(dp[i+1][j] <= wt)
              	ans = max(ans, j);
        }
    }
   
    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:26: error: no matching function for call to 'max(long long int&, int&)'
   35 |                 ans = max(ans, j);
      |                       ~~~^~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:35:26: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   35 |                 ans = max(ans, j);
      |                       ~~~^~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:35:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   35 |                 ans = max(ans, j);
      |                       ~~~^~~~~~~~
Language: C++

#include<bits/stdc++.h>
#define MAXN 105
using namespace std;

int dp[MAXN][MAXN];
long long peso[MAXN],valor[MAXN];

long lobg mochila(int i,int libre)
{
    if(libre < 0)return -1000005;
    if(i == 0)return 0;

    if(dp[i][libre] != -1)
        return dp[i][libre];

    long long op1 = mochila(i-1,libre);
    long long op2 = valor[i] + mochila(i-1,libre - peso[i]);

    return dp[i][libre] = max(op1,op2);
}

int main()
{
    int n,w;

    cin>>n>>w;

    memset(dp,-1,sizeof(dp));

    for(int i=1;i<=n;i++)
        cin>>peso[i]>>valor[i];

    cout<<mochila(n,w);


    return 0;
}

Compiler output:
a.cc:8:11: error: expected initializer before 'mochila'
    8 | long lobg mochila(int i,int libre)
      |           ^~~~~~~
a.cc: In function 'int main()':
a.cc:33:11: error: 'mochila' was not declared in this scope
   33 |     cout<<mochila(n,w);
      |           ^~~~~~~
Language: C++

#include<iostream>
//#define ll long long int
using namespace std;
#include<math.h>
#include <boost/multiprecision/cpp_int.hpp>
#include<bits/stdc++.h>
cp_int max(cp_int a,cp_int b)
{
  return a > b ? (a) : (b);
}
int main()
{
    
    cp_int n,wt;
    cin >> n >> wt;
    cp_int w[n],v[n];
    for(int i = 0;i < n;i++)
        cin >> w[i] >> v[i];
    cp_int dp[n+1][wt+1];
    for(int i = 0; i <= n;i++)
        dp[i][0] = 0;
    for(int i = 0; i <= wt;i++)
        dp[0][i] = 0;
    for(int i = 1;i <= n;i++)
    {
        for(int j = 1;j <= wt;j++)
        {
            if(w[i-1] <= j)
                dp[i][j] = max(dp[i-1][j], v[i-1] + dp[i-1][j - w[i-1]]);
            else
                dp[i][j] = dp[i-1][j];
        }
    }
    cout << dp[n][wt];
 	return 0;
}


Compiler output:
a.cc:5:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
    5 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
//#define ll long long int
using namespace std;
#include<math.h>
#include <boost/multiprecision/cpp_int.hpp>
#include<bits/stdc++.h>
ll max(ll a,ll b)
{
  return a > b ? (a) : (b);
}
int main()
{
    cp_int n,wt;
    cin >> n >> wt;
    cp_int w[n],v[n];
    for(int i = 0;i < n;i++)
        cin >> w[i] >> v[i];
    cp_int dp[n+1][wt+1];
    for(int i = 0; i <= n;i++)
        dp[i][0] = 0;
    for(int i = 0; i <= wt;i++)
        dp[0][i] = 0;
    for(int i = 1;i <= n;i++)
    {
        for(int j = 1;j <= wt;j++)
        {
            if(w[i-1] <= j)
                dp[i][j] = max(dp[i-1][j], v[i-1] + dp[i-1][j - w[i-1]]);
            else
                dp[i][j] = dp[i-1][j];
        }
    }
    cout << dp[n][wt];
 	return 0;
}


Compiler output:
a.cc:5:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
    5 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#define ll long long int
using namespace std;
#include<math.h>
#include <boost/multiprecision/cpp_int.hpp>
#include<bits/stdc++.h>
ll max(ll a,ll b)
{
  return a > b ? (a) : (b);
}
int main()
{
    cp_int n,wt;
    cin >> n >> wt;
    cp_int w[n],v[n];
    for(int i = 0;i < n;i++)
        cin >> w[i] >> v[i];
    cp_int dp[n+1][wt+1];
    for(int i = 0; i <= n;i++)
        dp[i][0] = 0;
    for(int i = 0; i <= wt;i++)
        dp[0][i] = 0;
    for(int i = 1;i <= n;i++)
    {
        for(int j = 1;j <= wt;j++)
        {
            if(w[i-1] <= j)
                dp[i][j] = max(dp[i-1][j], v[i-1] + dp[i-1][j - w[i-1]]);
            else
                dp[i][j] = dp[i-1][j];
        }
    }
    cout << dp[n][wt];
 	return 0;
}


Compiler output:
a.cc:5:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
    5 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;

#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#define ms(x, y) memset(x, y, sizeof(x))
#define FOR(i, a, b) for(int i = a; i < (b); i++)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define INF (int) 1e9
#define sz(x) (int)(x).size()
#define ri(x) scanf("%d", &x)
#define pi(x) printf("%d", x)
#define rii(x, y) scanf("%d%d", &x, &y)
#define pii(x, y) printf("%d%d", x, y)
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef queue<int> qi;

int items, capacity, weight, value;
long long dp[100001];

int main() {
    //ios_base::sync_with_stdio(false); cin.tie(0);
    
    scanf("%d%d", &items, &capacity);
    ms(dp, 0x3f);

    FOR(i, 0, items) {
        scanf("%d%d", &weight, &value);
        for (int j = capacity; j <= weight; j--) {
            dp[j] = min(dp[j], dp[j-weight] + value);    
        }

    int best = -1;
    FOR(i, 0, 100001) {
        if (dp[i] <= capacity) {
            best = i;
        }
    }
    
    pi(best);

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:2: error: expected '}' at end of input
   47 | }
      |  ^
a.cc:25:12: note: to match this '{'
   25 | int main() {
      |            ^
Language: C++

#include<iostream>
#define ll long long
#include<algorithm>
#include<vector>
using namespace std;

int main()
{
    ll n,w;
    cin>>n>>w;
    vector<vector<ll>> knapsack(n);
    ll temp;
    ll total = 0;
    for(ll i=0; i<n; ++i)
    {
        cin>>temp;
        knapsack[i].push_back(temp);
        cin>>temp;
        total += temp;
        knapsack[i].push_back(temp);

    }

    vector<ll> *ptr1 = new vector<ll> (total+1, 1000000000+1);
    vector<ll> *ptr2 = new vector<ll> (total+1, 1000000000+1);

    sort(knapsack.begin(), knapsack.end());
    (*ptr1)[0] = 0;
    for(ll i=0; i<n; ++i)
    {
        (*ptr2)[0] = 0;
        for(ll j=1; j<=total; ++j)
        {
            if(knapsack[i][1] <= j)
            {
                if((*ptr1)[j-knapsack[i][1]] != INT_MAX)
                {
                    (*ptr2)[j] = min((*ptr1)[j], knapsack[i][0] + (*ptr1)[j-knapsack[i][1]]);
                }
                else
                {
                    (*ptr2)[j] = (*ptr1)[j];
                }

            }
            else
            {
                (*ptr2)[j] = (*ptr1)[j];
            }
        }
        if(i != n-1)
        {
            vector<ll> *temp = ptr1;
            ptr1 = ptr2;
            ptr2 = temp;
        }
    }
    for(ll i=0; i<=total; ++i)
    {
        //cout<<(*ptr2)[i]<<endl;
        if((*ptr2)[i] == w)
        {
            cout<<i<<endl;
            break;
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:49: error: 'INT_MAX' was not declared in this scope
   36 |                 if((*ptr1)[j-knapsack[i][1]] != INT_MAX)
      |                                                 ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include<vector>
  +++ |+#include <climits>
    5 | using namespace std;
Language: C++

#include<iostream>
#define ll long long
#include<algorithm>
#include<vector>
using namespace std;

int main()
{
    ll n,w;
    cin>>n>>w;
    vector<vector<ll>> knapsack(n);
    ll temp;
    ll total = 0;
    for(ll i=0; i<n; ++i)
    {
        cin>>temp;
        knapsack[i].push_back(temp);
        cin>>temp;
        total += temp;
        knapsack[i].push_back(temp);

    }

    vector<ll> *ptr1 = new vector<ll> (total+1, INT_MAX);
    vector<ll> *ptr2 = new vector<ll> (total+1, INT_MAX);

    sort(knapsack.begin(), knapsack.end());
    (*ptr1)[0] = 0;
    for(ll i=0; i<n; ++i)
    {
        (*ptr2)[0] = 0;
        for(ll j=1; j<=total; ++j)
        {
            if(knapsack[i][1] <= j)
            {
                if((*ptr1)[j-knapsack[i][1]] != INT_MAX)
                {
                    (*ptr2)[j] = min((*ptr1)[j], knapsack[i][0] + (*ptr1)[j-knapsack[i][1]]);
                }
                else
                {
                    (*ptr2)[j] = (*ptr1)[j];
                }

            }
            else
            {
                (*ptr2)[j] = (*ptr1)[j];
            }
        }
        if(i != n-1)
        {
            vector<ll> *temp = ptr1;
            ptr1 = ptr2;
            ptr2 = temp;
        }
    }
    for(ll i=0; i<=total; ++i)
    {
        //cout<<(*ptr2)[i]<<endl;
        if((*ptr2)[i] == w)
        {
            cout<<i<<endl;
            break;
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:49: error: 'INT_MAX' was not declared in this scope
   24 |     vector<ll> *ptr1 = new vector<ll> (total+1, INT_MAX);
      |                                                 ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include<vector>
  +++ |+#include <climits>
    5 | using namespace std;
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n,w;
int arr[100][2];
long long dp[105][10001000];
long long inf;
long long go(int i , int sum){
 
    for(int i = 1 ; i <= n ; i++){
        for(int j = 1 ; j <= w ; j++){
            if(arr[i-1][0] <= j)
            dp[i][j] = max(arr[i-1][1] + dp[i-1][j - arr[i-1][0]] , dp[i-1][j]);
            else
            dp[i][j] = dp[i-1][j];
        }
    }
    return dp[n][w];
}
int main(){
    cin >> n >> w;
    inf = 5 * 100000000000000;
    for(int i = 0 ; i < n ; i++)
        for(int j = 0 ; j < 2 ; j++)
            cin >> arr[i][j];
    long long res = go(0,0);
    if(res > 0)
        cout<<res;
    else
        cout<<0;
}

Compiler output:
/tmp/ccYwsBrS.o: in function `main':
a.cc:(.text+0x20a): relocation truncated to fit: R_X86_64_PC32 against symbol `inf' defined in .bss section in /tmp/ccYwsBrS.o
collect2: error: ld returned 1 exit status