Language: C++

#include<bits/stdc++.h>
#include<cmath>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
typedef vector<string> vs;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef pair <double,double> dd;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define inf=1000000000
ll ipow(ll base, ll exp)
{
    ll result = 1;
    for (;;)
    {
        if (exp & 1)
            result *= base;
        exp >>= 1;
        if (!exp)
            break;
        base *= base;
    }

    return result;
}
ll p(ll d){
    ull s=1;
    ll cnt{0};
    while(d>s)s=ipow(2,cnt);
    return s-d;

}
vector<pair<ll,ll>> AJ;
vector<vector<ll>> knap;
ll W;
ll ma(ll a,ll b){
if(a>b)return a;
return b;
}
void nap(int in){
    if(knap[in][0]>=0)return ;
    nap(in-1);
    for(int i=0;i<=W;i++)
        if(AJ[in].first>i)
            knap[in][i]=knap[in-1][i];
        else
            knap[in][i]=ma(knap[in-1][i],(knap[in-1][i-AJ[in].first]+AJ[in].second));
}
int main(){
    ll n;
    cin>>n>>W;
    for(int i=0;i<n;i++){
        ll w,v;
        cin>>w>>v;
        AJ.push_back({w,v});
    }
    //for(int i=0;i<n;i++)cout<<AJ[i].first<<" "<<AJ[i].second<<endl;
    for(int i=0;i<n;i++)
        knap.push_back(vector<int> (W+1,-1));

    for(int i=0;i<=W;i++)
        if(i>=AJ[0].first)
            knap[0][i]=AJ[0].second;
        else
            knap[0][i]=0;
    nap(n-1);
//    for(int i=0;i<n;i++){
//        for(int j=0;j<=W;j++)cout<<knap[i][j]<<" ";
//        cout<<endl;
//    }
    cout<<knap[n-1][W];

return 0;
}


Compiler output:
a.cc:12:9: warning: ISO C++11 requires whitespace after the macro name
   12 | #define inf=1000000000
      |         ^~~
a.cc: In function 'int main()':
a.cc:61:23: error: no matching function for call to 'std::vector<std::vector<long long int> >::push_back(std::vector<int>)'
   61 |         knap.push_back(vector<int> (W+1,-1));
      |         ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >; value_type = std::vector<long long int>]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from 'std::vector<int>' to 'const std::vector<std::vector<long long int> >::value_type&' {aka 'const std::vector<long long int>&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >; value_type = std::vector<long long int>]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<std::vector<long long int> >::value_type&&' {aka 'std::vector<long long int>&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~