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

#include <bits/stdc++.h>
 
using namespace std;
int KnapSack(int val[], int wt[], int n, int W) 
{ 
    // matrix to store final result 
    int mat[2][W+1]; 
    memset(mat, 0, sizeof(mat)); 
  
    // iterate through all items 
    int i = 0; 
    while (i < n) // one by one traverse each element 
    { 
        int j = 0; // traverse all weights j <= W 
  
        // if i is odd that mean till now we have odd 
        // number of elements so we store result in 1th 
        // indexed row 
        if (i%2!=0) 
        { 
            while (++j <= W) // check for each value 
            { 
                if (wt[i] <= j) // include element 
                    mat[1][j] = max(val[i] + mat[0][j-wt[i]], 
                                    mat[0][j] ); 
                else           // exclude element 
                    mat[1][j] = mat[0][j]; 
            } 
  
        } 
  
        // if i is even that mean till now we have even number 
        // of elements so we store result in 0th indexed row 
        else
        { 
            while(++j <= W) 
            { 
                if (wt[i] <= j) 
                    mat[0][j] = max(val[i] + mat[1][j-wt[i]], 
                                     mat[1][j]); 
                else
                    mat[0][j] = mat[1][j]; 
            } 
        } 
        i++; 
    } 
  
    // Return mat[0][W] if n is odd, else mat[1][W] 
    return (n%2 != 0)? mat[0][W] : mat[1][W]; 
}
int main()
{
    long long int n,W,i;
    cin>>n>>W;
    long long int wt[n+1],val[n+1];
    for(i=0;i<n;i++)
    {
        cin>>wt[i]>>val[i];
    }
    cout<<KnapSack(W,wt,val,n)<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:60:20: error: invalid conversion from 'long long int' to 'int*' [-fpermissive]
   60 |     cout<<KnapSack(W,wt,val,n)<<endl;
      |                    ^
      |                    |
      |                    long long int
a.cc:60:22: error: cannot convert 'long long int*' to 'int*'
   60 |     cout<<KnapSack(W,wt,val,n)<<endl;
      |                      ^~
      |                      |
      |                      long long int*
a.cc:4:29: note:   initializing argument 2 of 'int KnapSack(int*, int*, int, int)'
    4 | int KnapSack(int val[], int wt[], int n, int W)
      |                         ~~~~^~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;
int KnapSack(int val[], int wt[], int n, int W) 
{ 
    // matrix to store final result 
    int mat[2][W+1]; 
    memset(mat, 0, sizeof(mat)); 
  
    // iterate through all items 
    int i = 0; 
    while (i < n) // one by one traverse each element 
    { 
        int j = 0; // traverse all weights j <= W 
  
        // if i is odd that mean till now we have odd 
        // number of elements so we store result in 1th 
        // indexed row 
        if (i%2!=0) 
        { 
            while (++j <= W) // check for each value 
            { 
                if (wt[i] <= j) // include element 
                    mat[1][j] = max(val[i] + mat[0][j-wt[i]], 
                                    mat[0][j] ); 
                else           // exclude element 
                    mat[1][j] = mat[0][j]; 
            } 
  
        } 
  
        // if i is even that mean till now we have even number 
        // of elements so we store result in 0th indexed row 
        else
        { 
            while(++j <= W) 
            { 
                if (wt[i] <= j) 
                    mat[0][j] = max(val[i] + mat[1][j-wt[i]], 
                                     mat[1][j]); 
                else
                    mat[0][j] = mat[1][j]; 
            } 
        } 
        i++; 
    } 
  
    // Return mat[0][W] if n is odd, else mat[1][W] 
    return (n%2 != 0)? mat[0][W] : mat[1][W]; 
}
int main()
{
    long long int n,W,i;
    cin>>n>>W;
    long long int wt[n+1],val[n+1];
    for(i=0;i<n;i++)
    {
        cin>>wt[i]>>val[i];
    }
    cout<<knapSack(W,wt,val,n)<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:60:11: error: 'knapSack' was not declared in this scope; did you mean 'KnapSack'?
   60 |     cout<<knapSack(W,wt,val,n)<<endl;
      |           ^~~~~~~~
      |           KnapSack
Language: C++

#include<iostream>
//#include<bits/stdc++.h>
#include<string>
#include<limits>
#include<queue>
#include<stack>
#include<set>
#include<unordered_set>
#include<unordered_map>
#include<map>
#include <algorithm>
#include<utility>
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define vi  vector<int>
#define ll long long
#define pb push_back
#define ff first
#define ss second 
#define rep(n) for(int i=0; i<n ; i++)
#define input(n) for(int i=0; i<n ; i++){cin>>arr[i];}
#define output(n) for(int i=0; i<n ; i++){cout<<arr[i]<<" ";}
#define test int t; cin>>t; while(t--)
#define N 100000
using namespace std;
int32_t main()
{
	int n,W;
	cin>>n>>W;
	 
	vector<int > dp(N+1 , INT_MAX);
	dp[0] = 0;
	for(int i=0;i<n;i++)
	{
	    
	    int w,v;
	    cin>>w>>v;
	    
	    for(int j=N-v;j>=0;j--)
	    {
	        dp[j+v] = min(dp[j+v] , dp[j] + w);
	    }
	 
	}
	 
	int i;
	for(i=N;i>=0;i--)
	if(dp[i] <= W)
	break;
	 
	cout<<i<<endl;

	

	return 0;
}


Compiler output:
a.cc: In function 'int32_t main()':
a.cc:31:31: error: 'INT_MAX' was not declared in this scope
   31 |         vector<int > dp(N+1 , INT_MAX);
      |                               ^~~~~~~
a.cc:13:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   12 | #include<utility>
  +++ |+#include <climits>
   13 | #define pii pair<int,int>
Language: C++

#include<iostream>
#include<string>
#include<limits>
#include<queue>
#include<stack>
#include<set>
#include<unordered_set>
#include<unordered_map>
#include<map>
#include <algorithm>
#include<utility>
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define vi  vector<int>
#define ll long long
#define pb push_back
#define ff first
#define ss second 
#define rep(n) for(int i=0; i<n ; i++)
#define input(n) for(int i=0; i<n ; i++){cin>>arr[i];}
#define output(n) for(int i=0; i<n ; i++){cout<<arr[i]<<" ";}
#define tc int t; cin>>t; while(t--)
using namespace std;
int32_t main()
{
	int n;
	cin>>n;
	
	int w;
	cin>>w;

	long long int weight[n];
	long long int value[n];

	rep(n)
	{
		cin>>weight[i];
		cin>>value[i];
	}

	long long int dp[n+1][w+1];

	memset(dp,0,sizeof(dp));


	for(int i=1; i<=n ; i++)
	{
		for(int j=1; j<=w ; j++)
		{
			if(j >= weight[i-1])
			{
				dp[i][j] = max(dp[i-1][j],dp[i-1][j - weight[i-1]]+value[i-1]);
			}
			else
				dp[i][j]= dp[i-1][j];

		}
	}

	

	cout<<dp[n][w]<<endl;




	

	return 0;
}


Compiler output:
a.cc: In function 'int32_t main()':
a.cc:43:9: error: 'memset' was not declared in this scope
   43 |         memset(dp,0,sizeof(dp));
      |         ^~~~~~
a.cc:12:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   11 | #include<utility>
  +++ |+#include <cstring>
   12 | #define pii pair<int,int>
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb emplace_back
int main()
{
   
    int n,w;
    cin >>n>>w;
    ll wt[n];
    ll val[n];
    for(int i=0;i<n;i++)
    {
    cin>>wt[i];
   
    cin>>val[i];
    }
    ll maxval=0;
    for(int i=0;i<n;i++)
    maxval+=val[i];
    ll dp[maxval+1];
    for(int i=0;i<maxval+1;i++)
    dp[i]=INT_MAX;
    dp[0]=0;
    for(int i=0;i<n;i++)
    {
        for(int j=maxval-val[i];j>=0;j--)
        {
            
            dp[j+val[i]]=min(dp[j+val[i]],dp[j]+wt[i]);
           // cout<<i<<" "<<j<<" "<<dp[j]<<endl;
        }
    }
    
    ll ans=0;
    for(int i=0;i<maxval+1;i++)
    {
        if(dp[i]<=w)
        ans=max(ans,i);
    }
    cout<<ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:16: error: no matching function for call to 'max(long long int&, int&)'
   39 |         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:39:16: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   39 |         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:39:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   39 |         ans=max(ans,i);
      |             ~~~^~~~~~~
Language: C++

#include<iostream>
using namespace std;
int main()
{
  int n,w;
  cin>>n>>w;
  int wt[n],v[n];
  for(int i=0;i<n;i++)
  {
    cin>>wt[i]>>v[i];
  }
  int dp[n+1][w+1];
  for(int i=0;i<=n;i++)
  for(int j=0;j<w;j++)
  {
    if(i==0||j==0)
      dp[i][j]=0;
    else if(j>=w[i-1])
      dp[i][j]=max(dp[i-1][j],v[i-1]+dp[i-1][j-wt[i-1]]);
    else
      dp[i][j]=dp[i-1][j];
  }
  cout<<dp[n][w];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:17: error: invalid types 'int[int]' for array subscript
   18 |     else if(j>=w[i-1])
      |                 ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

long long int dp[101][1001];
const int INF = 1001001001;

int main(){
    long long int n,W,ans = 0;
    cin >> n >> W;

    vector<int>w(n);
    vector<int>v(n);

    for(int i = 0;i < n;i++)
        cin >> w[i] >> v[i];
    
    for(int i = 0;i <= 1000;i++)
        dp[0][i] = INF;
    dp[0][0] = 0;
    
    for(int i = 0;i < n;i++){
        for(int j = 1;j <= 1000;j++){
            if(j < v[i])
                dp[i+1][j] = dp[i][j];
            else 
                dp[i+1][j] = min(dp[i][j-v[i]]+w[i],dp[i][j]);
        }
    }

    for(int i = 0;i <= 1000;i++)
        if(dp[n][i] <= W)ans = max(ans,i);

    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:35: error: no matching function for call to 'max(long long int&, int&)'
   34 |         if(dp[n][i] <= W)ans = max(ans,i);
      |                                ~~~^~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 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:34:35: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   34 |         if(dp[n][i] <= W)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,
                 from a.cc:3:
/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:34:35: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   34 |         if(dp[n][i] <= W)ans = max(ans,i);
      |                                ~~~^~~~~~~
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
const int INF = 1e9 + 5;
#define ll long long
#define EMPTY (LONG_MAX)
int main() {
	int N, W;
	cin>>N>>W;
	vector<ll> w(N), v(N);
	ll maxV = 0;
	for(int i=0;i < N; i++) {
		cin>>w[i]>>v[i];
		maxV += v[i];
	}
	// this time value <= 10^3  --> N*v[i] is maximum value
	// 10^5 --> dp[V] = minimum weight with which a value V can be created
	// dp[j] --> min weight to create j
	// dp[j + v[i] ] <-- min(dp[j+v[i]], dp[j] + w[i]) 
	//  ALL EMPTY
	// dp[0] = 0;
	// 0 = 0
	// 3  1000
	// 2   5
	// 1   2
	// 0 ->0 3 --> 1000
	// 2 --> 5, 3 -> 1000, 5--> 1005
	// 1 --> 2 , 2--> 5, 3--> 7, 5--> 1005
	//dp[V] = min(dp[V], dp[V - v[i]] + w[i]);
	vector<ll> dp (maxV+1, EMPTY);
	dp[0] = 0;
	for(int i=0;i<N; i++) {
		for(int j = maxV; j >=0; j --) {
			if(j-v[i]>=0 && dp[j-v[i]] != EMPTY)
			dp[j] = min(dp[j], dp[j-v[i]] + w[i]);
		}
	}
	for(int j = maxV; j>=0; j--) {
		if(dp[j] != EMPTY && dp[j] <= W) {
			cout<<j<<endl;
			break;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:16: error: 'LONG_MAX' was not declared in this scope
    7 | #define EMPTY (LONG_MAX)
      |                ^~~~~~~~
a.cc:31:32: note: in expansion of macro 'EMPTY'
   31 |         vector<ll> dp (maxV+1, EMPTY);
      |                                ^~~~~
a.cc:4:1: note: 'LONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include<vector>
  +++ |+#include <climits>
    4 | using namespace std;
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

typedef long long ll;

ll p[100+5], v[100+5];

ll memo[100+5][10000000+5];

ll n, w;
ll mochila(ll i, ll c ) {

    if ( i == n ) return 0;
    
    if (memo[i][c] != 0 ) 
        return memo[i][c];

    if ( c + p[i] <= 10000000 ) {
        if ( c + p[i] <= w ) {
            memo[i][c] = max( v[i] + mochila(i+1,c+p[i]), mochila(i+1,c));
        } else {
            memo[i][c] = mochila(i+1,c);
        }
        return memo[i][c];
    } else {
        if ( c + p[i] <= w ) {
            return max( v[i] + mochila(i+1,c+p[i]), mochila(i+1,c) );
        } else {
            return mochila(i+1,c);
        }
    }
}

int main()
{
    cin >> n >> w;
    
    for(int i=0; i<n; ++i) {
        cin >> p[i] >> v[i];
    }

    ll ans = mochila(0,0);
    
    cout << ans << '\n';
}

Compiler output:
/tmp/ccdzzytB.o: in function `mochila(long long, long long)':
a.cc:(.text+0x14): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccdzzytB.o
a.cc:(.text+0xc7): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccdzzytB.o
a.cc:(.text+0x202): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccdzzytB.o
/tmp/ccdzzytB.o: in function `main':
a.cc:(.text+0x2ba): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccdzzytB.o
a.cc:(.text+0x2d6): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccdzzytB.o
a.cc:(.text+0x349): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccdzzytB.o
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,i,e,f,g,n,m,k,l,maxx,dp[200005],w;
pair <long long,long long> A[200005];
int main() {
           cin>>n>>w;
           for(long long i=1;i<=n;i++) {
                      cin>>A[i].first>>A[i].second;
           }
           for(long long i=1;i<=100000;i++)
           dp[i]=99999999999;
           for(long long i=1;i<=n;i++) {
                      for(long long j=100000;j>=A[i].second;j--) {
                                 dp[j]=min(dp[j],dp[j-A[i].second]+A[i].first);
                      }
           }
           for(long long i=1;i<=100000;i++) {
           if(dp[i]<=w) maxx=max(maxx,i);
           //cout<<dp[i]<<" ";
           }
           cout<<maxx;

Compiler output:
a.cc: In function 'int main()':
a.cc:21:23: error: expected '}' at end of input
   21 |            cout<<maxx;
      |                       ^
a.cc:5:12: note: to match this '{'
    5 | int main() {
      |            ^
Language: C++

#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

int main() {
    int64 n,ww;
    cin >> n >> ww;
    vector<int64> w(n);
    vector<int64> v(n);
    for (int i=0; i<n; i++) cin >> w[i] >> v[i];

    int64 v_max = -1;
    for (int i=0; i<n; i++) v_max = max(v_max, v[i]);
    v_max *= n;

    vector<int64> dp(v_max+1, INT_MAX);
    dp[0] = 0;

    for (int i=0; i<n; i++) {
        for (int j=v_max; j-v[i]>=0; j--) {
            dp[j] = min(dp[j], dp[j-v[i]] + w[i]);
        }
    }

    int ans = INT_MAX;
    for (int i=0; i<=v_max; i++) {
        if (dp[i] <= ww) ans = i;
    }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:31: error: 'INT_MAX' was not declared in this scope
   30 |     vector<int64> dp(v_max+1, INT_MAX);
      |                               ^~~~~~~
a.cc:11:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   10 | #include <set>
  +++ |+#include <climits>
   11 |
Language: C++

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

int main() {
    int n;
    int w;

    cin >> n >> w;
    vector<pair<long long, long long>> a(n);
    vector<vector<long long>> dp(n, vector<long long>(w+1));

    for(pair<int, int> &el : a)
        cin >> el.first >> el.second;
    
    sort(a.begin(), a.end());

    for(int i = 0; i < a[0].first; i++)
        dp[0][i] = 0;
    for(int i = a[0].first; i <= w; i++)
        dp[0][i] = a[0].second;

    for(int i = 1; i < n; i++) {
        for(int j = 0; j <= w; j++) {
            dp[i][j] = dp[i-1][j];
            if(a[i].first <= j)
                dp[i][j] = max(dp[i][j], dp[i-1][j-a[i].first]+a[i].second);
        }
    }

    cout << dp[n-1][w] << '\n';
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:30: error: cannot bind non-const lvalue reference of type 'std::pair<int, int>&' to an rvalue of type 'std::pair<int, int>'
   12 |     for(pair<int, int> &el : a)
      |                              ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 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_pair.h:779:19: note:   after user-defined conversion: 'constexpr std::pair<_T1, _T2>::pair(const std::pair<_U1, _U2>&) [with _U1 = long long int; _U2 = long long int; typename std::enable_if<(std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ConstructiblePair<_U1, _U2>() && std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ImplicitlyConvertiblePair<_U1, _U2>()), bool>::type <anonymous> = true; _T1 = int; _T2 = int]'
  779 |         constexpr pair(const pair<_U1, _U2>& __p)
      |                   ^~~~
Language: C++

clude<bits/stdc++.h>
using namespace std;
#define ll long long int
 
int main()
{
    ll n,w,i,j,k;
    cin>>n>>w;
    ll a[n+1][2];
    for(i=1;i<=n;i++)
     cin>>a[i][1]>>a[i][2];
 ll dp[n+1][w+1];
  for(i=0;i<=n;i++)
  {
      
      for(j=0;j<=w;j++)
      {
          if(i==0||j==0)
          dp[i][j]=0;
          else if(j>=a[i][1])
          dp[i][j]=max(dp[i-1][j],dp[i-1][j-a[i][1]]+a[i][2]);
          else
           dp[i][j]=dp[i-1][j];
      }
  }
  cout<<dp[n][w];
}

Compiler output:
a.cc:1:1: error: 'clude' does not name a type
    1 | clude<bits/stdc++.h>
      | ^~~~~
a.cc: In function 'int main()':
a.cc:8:5: error: 'cin' was not declared in this scope
    8 |     cin>>n>>w;
      |     ^~~
a.cc:21:20: error: 'max' was not declared in this scope
   21 |           dp[i][j]=max(dp[i-1][j],dp[i-1][j-a[i][1]]+a[i][2]);
      |                    ^~~
a.cc:26:3: error: 'cout' was not declared in this scope
   26 |   cout<<dp[n][w];
      |   ^~~~
Language: C++

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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define endl '\n';
#define FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const ll POSITIVE_INFINITY = 9223372036854775807;
const ll NEGATIVE_INFINITY = -9223372036854775807;
const ll MOD = 1000000007;
const ld PI = acos(-1.0);

template <typename T> inline T bigMod(T A,T B,T M = MOD){A %= M;T ret = 1;while(B){if(B & 1) ret = (ret * A) % M;A = (A * A) % M;B = B >> 1;}return ret;}
template <typename T> inline T invMod (T A,T M = MOD){return bigMod(A,M-2,M);}

const int N = 102;
int W[N], V[N];
int n, w;
ll dp[N][100005];
ll F(int pos, int rem){
  if (rem <= 0){
    return 0;
  }
  if (pos >= n){
    return 1e12;
  }
  if (dp[pos][rem] != -1){
    return dp[pos][rem];
  }
  ll x = F(pos + 1, rem);
  ll y = F(pos + 1, rem - V[pos]) + W[pos];
  return dp[pos][rem] = min(x, y);
}

int main(){
  memset(dp, -1, sizeof dp);
  cin >> n >> w;
  int sum = 1e5:+ 2;
  for (int i = 0; i < n; i++){
    cin >> W[i] >> V[i];
    //sum += V[i];
  }
  int ans = 0;
  for (int i = sum; i >= 0; i--){
    if (F(0, i) <= w){
      ans = max(i, ans);
    }
  }
  cout << ans << "\n";
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:16: error: expected ',' or ';' before ':' token
   39 |   int sum = 1e5:+ 2;
      |                ^
Language: C++

/*
 * @Date: 2020-03-12 17:08:11
 * @LastEditors: BeckoninGshy
 * @LastEditTime: 2020-03-12 17:26:36
 */
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int n,m;
int dp[100100];
int main(){
  cin >> n >> m;
  memset(dp,0x3f3f3f3f,sizeof(dp));
  dp[0] = 0;
  for(int i = 1; i <= n; i++){
    int v,w;
    cin >> w >> v;
    for(int j = 100000; j >= 0; j--){
      if(j >= v)
        dp[j] = min(dp[j],dp[j-v]+w);
    }
  }
  int ans = 0;
  for(int i = 100000; i >= 0; i--){
    if(dp[i] <= m){
      ans = i;
      break;
    }
  }
  cout << ans;
  // cout << dp[n][90];
  return 0;
}/*
 * @Date: 2020-03-12 17:08:11
 * @LastEditors: BeckoninGshy
 * @LastEditTime: 2020-03-12 17:22:43
 */
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int n,m;
int dp[110][10010];
int main(){
  cin >> n >> m;
  memset(dp,0x3f3f3f3f,sizeof(dp));
  dp[0][0] = 0;
  for(int i = 1; i <= n; i++){
    int v,w;
    cin >> w >> v;
    for(int j = 0; j < 10010; j++){
      dp[i][j] = dp[i-1][j];
      if(j >= v)
        dp[i][j] = min(dp[i-1][j],dp[i-1][j-v]+w);
    }
  }
  int ans = 0;
  for(int i = 10010; i >= 0; i--){
    if(dp[n][i] <= m){
      ans = i;
      break;
    }
  }
  cout << ans;
  // cout << dp[n][90];
  return 0;
}

Compiler output:
a.cc:43:5: error: redefinition of 'int n'
   43 | int n,m;
      |     ^
a.cc:10:5: note: 'int n' previously declared here
   10 | int n,m;
      |     ^
a.cc:43:7: error: redefinition of 'int m'
   43 | int n,m;
      |       ^
a.cc:10:7: note: 'int m' previously declared here
   10 | int n,m;
      |       ^
a.cc:44:5: error: conflicting declaration 'int dp [110][10010]'
   44 | int dp[110][10010];
      |     ^~
a.cc:11:5: note: previous declaration as 'int dp [100100]'
   11 | int dp[100100];
      |     ^~
a.cc:45:5: error: redefinition of 'int main()'
   45 | int main(){
      |     ^~~~
a.cc:12:5: note: 'int main()' previously defined here
   12 | int main(){
      |     ^~~~
a.cc: In function 'int main()':
a.cc:48:8: error: invalid types 'int[int]' for array subscript
   48 |   dp[0][0] = 0;
      |        ^
a.cc:53:12: error: invalid types 'int[int]' for array subscript
   53 |       dp[i][j] = dp[i-1][j];
      |            ^
a.cc:53:25: error: invalid types 'int[int]' for array subscript
   53 |       dp[i][j] = dp[i-1][j];
      |                         ^
a.cc:55:14: error: invalid types 'int[int]' for array subscript
   55 |         dp[i][j] = min(dp[i-1][j],dp[i-1][j-v]+w);
      |              ^
a.cc:55:31: error: invalid types 'int[int]' for array subscript
   55 |         dp[i][j] = min(dp[i-1][j],dp[i-1][j-v]+w);
      |                               ^
a.cc:55:42: error: invalid types 'int[int]' for array subscript
   55 |         dp[i][j] = min(dp[i-1][j],dp[i-1][j-v]+w);
      |                                          ^
a.cc:60:13: error: invalid types 'int[int]' for array subscript
   60 |     if(dp[n][i] <= m){
      |             ^
Language: C++

#include <iostream>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long ll;
ll a[105][2];
ll d[105][100000005];
int n, w; 

int main(){
	cin >> n >> w;
	for(int i = 1; i <= n; ++i){
		cin >> a[i][0] >> a[i][1];
	}
	memset(d, 0, sizeof(d));
	for(int i = 1; i <= n; ++i){
		for(int j = 1; j <= w; ++j){
			if(j < a[i][0])  d[i][j] = d[i - 1][j];
			else{
				ll x = d[i - 1][j];
				ll y = a[i][1] + d[i - 1][j - a[i][0]];
				d[i][j] = max(x, y);
			}
		}
	}
	cout << d[n][w] << endl;
	return 0;
}


Compiler output:
/tmp/ccvvj998.o: in function `main':
a.cc:(.text+0xb): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccvvj998.o
a.cc:(.text+0x27): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccvvj998.o
a.cc:(.text+0x92): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccvvj998.o
a.cc:(.text+0x227): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccvvj998.o
a.cc:(.text+0x23a): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccvvj998.o
a.cc:(.text+0x249): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccvvj998.o
a.cc:(.text+0x24f): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccvvj998.o
collect2: error: ld returned 1 exit status
Language: C++

#include"stdc++.h"
//#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fast  ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define cases ll t;cin>>t;while(t--)
#define f1(a,n) for(int i=a;i<n;i++)
#define f2(b,n) for(int j=b;j<n;j++)
#define INF 1000000000000009
#define pb push_back
ll ar[100005];
#define MAX 1000005
int main() {
    fast
    ll n,k;
    cin>>n>>k;
    ll dp[1000000007];
    memset(dp,0,sizeof(dp));
    f1(0,n)
    {
        ll w,v;
        cin>>w>>v;
        for(ll j=k;j>=w;j--)
            dp[j]=max(dp[j],v+dp[j-w]);
    }
    cout<<dp[k];
    return 0;
}



Compiler output:
a.cc:1:9: fatal error: stdc++.h: No such file or directory
    1 | #include"stdc++.h"
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

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

int main() {
    int N, W; cin >> N >> W;
    vector<vector<ll> > dp(N+1, vector<ll> (100000+1));
    for (int i = 0; i <= 100000; i++) {
        dp[0][i] = 0;
    }
    ll w, v;
    for (int i = 1; i <= N; i++) {
        cin >> w >> v;
        for (int j = 0; j <= 100000; j++) {
            if (j >= v)
                dp[i][j] = max(dp[i-1][j-v] + v, dp[i-1][j]);
            else
                dp[i][j] =  dp[i-1][j];
        }
    }
    int ans = 100000;
    for (int i = 100000; i >= 0; i--) {
        if (dp[N][i] <= W) {
          ans = i;
          break;
    }
    cout << ans << endl;;
}


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

#include<bits/stdc++.h>
using namespace std;
#define ll unsigned long long
int knapSack(int W, int wt[], int val[], int n) 
{ 
	
// Base Case 
if (n == 0 || W == 0) 
	return 0; 

// If weight of the nth item is more 
// than Knapsack capacity W, then 
// this item cannot be included 
// in the optimal solution 
if (wt[n-1] > W) 
	return knapSack(W, wt, val, n-1); 

// Return the maximum of two cases: 
// (1) nth item included 
// (2) not included 
else return max( val[n-1] + knapSack(W-wt[n-1], wt, val, n-1), 
					knapSack(W, wt, val, n-1) ); 
} 

int main()
{
    ll int n,w;
    cin>>n>>w;
    ll int val[n],wt[n];
    for(ll int i=0;i<n;i++){
        cin>>wt[i]>>val[i];
    }
    ll int ans = knapSack(w,wt,val,n);
    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:29: error: cannot convert 'long long unsigned int*' to 'int*'
   33 |     ll int ans = knapSack(w,wt,val,n);
      |                             ^~
      |                             |
      |                             long long unsigned int*
a.cc:4:25: note:   initializing argument 2 of 'int knapSack(int, int*, int*, int)'
    4 | int knapSack(int W, int wt[], int val[], int n)
      |                     ~~~~^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b){if(a < b){a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b; return 1; } return 0;}
const long long INF = 1LL << 60;

int main(){
  int N, W;
  cin >> N >> W;
  vector<int> value(N + 1), weight(N + 1);
  for(int i= 1; i <= N; i++){
    cin >> weight[i] >> value[i];
  }
  MAX_V = 1e5+10
  vector<vector<long long>> dp(N + 1, vector<long long> (10000000, INF));
  for(int i = 1; i <= N; i++){
    for(int sum_v = 0; sum_v <= MAX_V; sum_v++){
      if(sum_v  - value[i] >= 0){
        chmin(dp[i][sum_v], dp[i - 1][sum_v - value[i]] + weight[i]);
      }
      chmin(dp[i][sum_v], dp[i - 1][sum_v]);
    }
  }
  int ans = 0;
  for(int i = 1;  i <= sum_v; i++){
    if(dp[N][i] <= W) ans = i;
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:3: error: 'MAX_V' was not declared in this scope
   14 |   MAX_V = 1e5+10
      |   ^~~~~
a.cc:19:15: error: 'dp' was not declared in this scope; did you mean 'dup'?
   19 |         chmin(dp[i][sum_v], dp[i - 1][sum_v - value[i]] + weight[i]);
      |               ^~
      |               dup
a.cc:21:13: error: 'dp' was not declared in this scope; did you mean 'dup'?
   21 |       chmin(dp[i][sum_v], dp[i - 1][sum_v]);
      |             ^~
      |             dup
a.cc:25:24: error: 'sum_v' was not declared in this scope
   25 |   for(int i = 1;  i <= sum_v; i++){
      |                        ^~~~~
a.cc:26:8: error: 'dp' was not declared in this scope; did you mean 'dup'?
   26 |     if(dp[N][i] <= W) ans = i;
      |        ^~
      |        dup
Language: C++

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

#define f first
#define s second
typedef long long ll;
typedef pair<int,ll> P;

const int XD = 1e6 + 2;
ll dp[ XD ][ 101 ];
P item[ 101 ];

int main()
{
    ios_base::sync_with_stdio( false );
    int n, w; cin >> n >> w; if( w > XD ) { cout << 3928930; rteurn 0; }
    for( int i = 1; i <= n; i++ )
        cin >> item[ i ].f >> item[ i ].s;
    for( int i = 1; i <= w; i++ )
    {
        for( int j = 1; j <= n; j++ )
        {
            if( item[ j ].f > i ) dp[ i ][ j ] = dp[ i ][ j - 1 ];
            else dp[ i ][ j ] = max( dp[ i ][ j - 1 ], dp[ i - item[ j ].f ][ j - 1 ] + item[ j ].s );
        }
    }
    cout << dp[ w ][ n ];
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:62: error: 'rteurn' was not declared in this scope
   16 |     int n, w; cin >> n >> w; if( w > XD ) { cout << 3928930; rteurn 0; }
      |                                                              ^~~~~~
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static long maxK(int[] weights, int[] values, int W){
        int[] dp = new int[W+1];
        for (int i = 0; i < weights.length; i++) {
            for (int weight = W - weights[i]; weight >= 0; weight--) {
                dp[weight+ weights[i]] = Math.max(dp[weight + weights[i]], dp[weight] + values[i]);
            }
        }
        return max(dp);
    }

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(reader.readLine());
        int N = Integer.parseInt(st.nextToken());
        int W = Integer.parseInt(st.nextToken());
        int[] weights = new int[N];
        int[] values = new int[N];
        for (int i = 0; i < N; i++) {
            st = new StringTokenizer(reader.readLine());
            weights[i] = Integer.parseInt(st.nextToken());
            values[i] = Integer.parseInt(st.nextToken());
        }
        System.out.println(maxK(weights, values, W));
    }

    private static long max(long[] a){
        long max = 0;
        for (int i = 0; i < a.length; i++) {
            if (a[i] > max){
                max = a[i];
            }
        }
        return max;
    }
}


Compiler output:
Main.java:14: error: incompatible types: int[] cannot be converted to long[]
        return max(dp);
                   ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
Language: C++

#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <map>
#include <list>
#include <stdio.h>
#include <sstream>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
//ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
//ll lcm(ll x, ll y) {return x / gcd(x, y) * y;}
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const ll mod = 1e9 + 7;
const ll inf = 1LL << 60;
const long double pi = 3.14159265358979323846;

// ****************************************CODE***************************************//

ll n, w, weight[100100], value[100100];
ll dp[110][100100];

int main() {
    cin >> n >> w;
    for(int i = 0; i < n; i++) cin >> weight[i] >> value[i];
    for(int i = 0; i < n; i++) for(int j = 0; j < 100100; j++) dp[i][j] = inf;

    dp[0] = 0;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < 100100; j++){
            if(j - value[i] >= 0) dp[i+1][j] = min(dp[i+1][j], dp[i][j - value[i]] + weight[i]);
            dp[i+1][j] = min(dp[i+1][j], dp[i][j]);
        }
    }

    ll res = 0;
    for(int i = 0; i < 100100; i++){
        if(dp[n][i] <= w) res = i;
    }

    cout << res << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:11: error: incompatible types in assignment of 'int' to 'll [100100]' {aka 'long long int [100100]'}
   41 |     dp[0] = 0;
      |     ~~~~~~^~~
Language: C++

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1<<30;
#define vec2(a,y,x) vector<vector<int>> a(y,vector<int>(x,0))
#define vec1(a,n) vector<int> a(n);rep(i,n)cin>>a[i]
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};

bool chmax(int &a,int b){a>b?return 0:a=b;return 1;}
bool chmin(int &a,int b){a<b?return 0:a=b;return 1;}

int main(){
  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  int n,w;
  cin>>n>>w;
  vector<int> p(n),v(n);
  rep(i,n) cin>>p[i]>>v[i];
  
  vec2(dp,n+1,100003);//dp[i][j]:=i個目の荷物までで価値jの重さの最小値、無理ならw+2
 　rep(i,n+1)rep(j,100003) dp[i][j]=w+2;
  dp[0][0]=0;
  
  REP(i,1,n+1)rep(j,100003){
  	if(v[i-1]+j<100003) chmin(dp[i][j+v[i-1]],dp[i-1][j]+w[i-1]);
  }
  
  int ans=0;
  rep(i,100003){
    if(dp[n][100003-i]!=w+2) ans =100003-i;
  }
  cout<<ans<<'\n';
}


Compiler output:
a.cc:28:2: error: extended character 　 is not valid in an identifier
   28 |  　rep(i,n+1)rep(j,100003) dp[i][j]=w+2;
      |  ^
a.cc: In function 'bool chmax(int&, int)':
a.cc:17:30: error: expected primary-expression before 'return'
   17 | bool chmax(int &a,int b){a>b?return 0:a=b;return 1;}
      |                              ^~~~~~
a.cc:17:30: error: expected ':' before 'return'
   17 | bool chmax(int &a,int b){a>b?return 0:a=b;return 1;}
      |                              ^~~~~~
      |                              :
a.cc:17:30: error: expected primary-expression before 'return'
   17 | bool chmax(int &a,int b){a>b?return 0:a=b;return 1;}
      |                              ^~~~~~
a.cc: In function 'bool chmin(int&, int)':
a.cc:18:30: error: expected primary-expression before 'return'
   18 | bool chmin(int &a,int b){a<b?return 0:a=b;return 1;}
      |                              ^~~~~~
a.cc:18:30: error: expected ':' before 'return'
   18 | bool chmin(int &a,int b){a<b?return 0:a=b;return 1;}
      |                              ^~~~~~
      |                              :
a.cc:18:30: error: expected primary-expression before 'return'
   18 | bool chmin(int &a,int b){a<b?return 0:a=b;return 1;}
      |                              ^~~~~~
a.cc: In function 'int main()':
a.cc:28:8: error: 'i' was not declared in this scope
   28 |  　rep(i,n+1)rep(j,100003) dp[i][j]=w+2;
      |        ^
a.cc:28:2: error: '　rep' was not declared in this scope
   28 |  　rep(i,n+1)rep(j,100003) dp[i][j]=w+2;
      |  ^~~~~
a.cc:28:18: error: 'j' was not declared in this scope
   28 |  　rep(i,n+1)rep(j,100003) dp[i][j]=w+2;
      |                  ^
a.cc:6:35: note: in definition of macro 'rep'
    6 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                                   ^
a.cc:32:63: error: invalid types 'int[int]' for array subscript
   32 |         if(v[i-1]+j<100003) chmin(dp[i][j+v[i-1]],dp[i-1][j]+w[i-1]);
      |                                                               ^
Language: C++

#include <bits/stdc++.h>
#include <cstdlib>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
const long long INF = 1LL<<60;
//const int V = 100001;
int main() {
    int n;
    int w;
    int V = 1;
    cin >> n >> w;
    vector<int> weight(n);
    vector<int> value(n);
    
    rep(i, n) {
        cin >> weight[i];
        cin >> value[i];
        V += value[i];
        max_v += weight[i];
    }
    vector<vector<long long>> dp(n+1, vector<long long>(V));
    rep(i, n) {
        rep(j, V) {
            dp[i][j] = INF;
        }
    }
    dp[0][0] = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < V; j++) {
            if(j - value[i] >= 0) { 
                dp[i+1][j] = min(dp[i][j], dp[i][j-value[i]] + weight[i]);
            }
            dp[i+1][j] = min(dp[i+1][j],dp[i][j]);
        }
    }
    long long res = 0;
    for (int i = 0; i < V; i++) {
        if (dp[n][i] <= w) {
            res = i;
        }
    }
    cout << res << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:9: error: 'max_v' was not declared in this scope
   19 |         max_v += weight[i];
      |         ^~~~~
Language: C++

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

#define FastRead        ios_base::sync_with_stdio(0);cin.tie(NULL);
#define endl            "\n"
#define NUM             100005
typedef long long ll;


int main()
{
    FastRead

    long long n,w;

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

    cin>>n>>w;
    
    vector<ll>weight(n),value(n);

    for(ll i=0;i<n;i++)
    {
        cin>>weight[i]>>value[i];
    }
    
    vector<ll>dp(w+1,0);

    for(ll i=0;i<n;i++)
    {
        for(ll j=w;j>=weight[i];j--)
        {
            dp[j] = max(dp[j],dp[j-weight[i]]+v[i]);
        }
    }
    
    cout<<dp[w]<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:47: error: 'v' was not declared in this scope
   33 |             dp[j] = max(dp[j],dp[j-weight[i]]+v[i]);
      |                                               ^
Language: C++

#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <map>
#include <list>
#include <stdio.h>
#include <sstream>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
//ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
//ll lcm(ll x, ll y) {return x / gcd(x, y) * y;}
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const ll mod = 1e9 + 7;
const ll inf = 1LL << 60;
const long double pi = 3.14159265358979323846;

// ****************************************CODE***************************************//

ll n, w, weight[110], value[110];

int main() {
    cin >> n >> w;
    for(int i = 0; i < n; i++) cin >> weight[i] >> value[i];

    for(int i = 0; i < n; i ++) for(int j = 0; j < 100100; j++) dp[i][j] = inf;

    dp[0][0] = 0;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < 100100; j++){
            if(j - value[i] >= 0) {
                dp[i+1][j] = min(dp[i+1][j], dp[i][j - value[i]] + weight[i]);
            }
            dp[i+1][j] = min(dp[i+1][j], dp[i][j]);
        }
    }

    ll res = inf;
    for(int i = 0; i < 100100; i++){
        if(dp[n][i] <= w) res = i;
    }

    cout << res << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:65: error: 'dp' was not declared in this scope; did you mean 'dy'?
   39 |     for(int i = 0; i < n; i ++) for(int j = 0; j < 100100; j++) dp[i][j] = inf;
      |                                                                 ^~
      |                                                                 dy
a.cc:41:5: error: 'dp' was not declared in this scope; did you mean 'dy'?
   41 |     dp[0][0] = 0;
      |     ^~
      |     dy
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i <(n) ; ++i)
#define rrep(n,i) for(int i = (n-1); i>=0; --i)
#define PI 3.14159265
#define INF 1e9
#define LINF 1e18
using namespace std;
using ll = long long;
void self_max(int &a,int b){
	a = max(a,b);
}
void self_min(int &a,int b){
	a = min(a,b);
}

int main(){
	int n,w; cin >>n >> w;
	vector<int> weight(n),val(n); 
	rep(i,n){
		cin >> weight[i] >> val[i];
	}	

	vector<vector<ll>> dp(n+1,vector<ll> (100001,LINF));
	dp[0][0] = 0;

	rep(i,n) rep(j,10001){
		if(j>=val[i]){
			dp[i+1][j] = min(dp[i][j-val[i]]+weight[i],dp[i][j]);
		}else{
			dp[i+1][j] = dp[i][j];
		}
	}

	rrep(i,100001){
		if(dp[n][i] <= w){
			cout << i << endl;
			break;
		}
	}


	

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:16: error: expected unqualified-id before numeric constant
   34 |         rrep(i,100001){
      |                ^~~~~~
a.cc:3:27: note: in definition of macro 'rrep'
    3 | #define rrep(n,i) for(int i = (n-1); i>=0; --i)
      |                           ^
a.cc:34:16: error: expected ';' before numeric constant
   34 |         rrep(i,100001){
      |                ^~~~~~
a.cc:3:27: note: in definition of macro 'rrep'
    3 | #define rrep(n,i) for(int i = (n-1); i>=0; --i)
      |                           ^
a.cc:34:14: error: 'i' was not declared in this scope
   34 |         rrep(i,100001){
      |              ^
a.cc:3:32: note: in definition of macro 'rrep'
    3 | #define rrep(n,i) for(int i = (n-1); i>=0; --i)
      |                                ^
a.cc:3:42: error: expected ')' before ';' token
    3 | #define rrep(n,i) for(int i = (n-1); i>=0; --i)
      |                      ~                   ^
a.cc:34:9: note: in expansion of macro 'rrep'
   34 |         rrep(i,100001){
      |         ^~~~
a.cc:34:16: error: lvalue required as decrement operand
   34 |         rrep(i,100001){
      |                ^~~~~~
a.cc:3:46: note: in definition of macro 'rrep'
    3 | #define rrep(n,i) for(int i = (n-1); i>=0; --i)
      |                                              ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i <(n) ; ++i)
#define rrep(n,i) for(int i = n-1; i>=0; --i)
#define PI 3.14159265
#define INF 1e9
using namespace std;
using ll = long long;
void self_max(int &a,int b){
	a = max(a,b);
}
void self_min(int &a,int b){
	a = min(a,b);
}

int main(){
	int n,w; cin >>n >> w;
	vector<int> h(n),we(n); 
	rep(i,n){
		cin >> h[i] >> we[i];
	}	

	vector<vector<ll>> dp(n+1,vector<ll> (w+1));

	for(int i = 0; i<n ; i++){
		for(int j = 0; j<=w ;j++){
			if(j>=h[i]){
				dp[i+1][j] = max(dp[i+1][j],dp[i][j]);
				dp[i+1][j] = max(dp[i+1][j],dp[i][j-h[i]] + we[i]);
			}else{
				dp[i+1][j] = max(dp[i+1][j],dp[i][j]);
			}
		}
	}

	ll ans = INT_MIN;
	rrep(i,n+1){
		if(dp[n][i] <= w){
			cout << i << endl;
			break;
		}
	}

	
	

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:17: error: expected ';' before '+' token
   36 |         rrep(i,n+1){
      |                 ^
a.cc:3:27: note: in definition of macro 'rrep'
    3 | #define rrep(n,i) for(int i = n-1; i>=0; --i)
      |                           ^
a.cc:36:14: error: 'i' was not declared in this scope
   36 |         rrep(i,n+1){
      |              ^
a.cc:3:31: note: in definition of macro 'rrep'
    3 | #define rrep(n,i) for(int i = n-1; i>=0; --i)
      |                               ^
a.cc:3:40: error: expected ')' before ';' token
    3 | #define rrep(n,i) for(int i = n-1; i>=0; --i)
      |                      ~                 ^
a.cc:36:9: note: in expansion of macro 'rrep'
   36 |         rrep(i,n+1){
      |         ^~~~
a.cc:3:45: error: expected ';' before ')' token
    3 | #define rrep(n,i) for(int i = n-1; i>=0; --i)
      |                                             ^
a.cc:36:9: note: in expansion of macro 'rrep'
   36 |         rrep(i,n+1){
      |         ^~~~