Language: C++

                                    #include <bits/stdc++.h>

                                    typedef long long ll;
                                    typedef  double ld;
                                    #define rep(i,a,n) for(ll i=(a); i<(n); i++)
                                    #define per(i,a,n) for(ll i=(n-1); i>=(a); i--)
                                    #define F first
                                    #define S second
                                    #define maxx(a,b) a=max(a,b)
                                    #define minn(a,b) a=min(a,b)
                                    #define db(x) cerr<<#x<<" = "<<x<<endl
                                    #define N 1111111
                                    #define mod 1000000007
                                    #define rt return
                                    #define inf 12345678908761

                                    using namespace std;

                                    ll w[111],v[111];
                                    map<ll,ll> a[111];

                                    int main(){

                                        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

                                        //freopen("Ulug'bek","r",stdin);
                                        //freopen("Abdimanabov","w",stdout);

                                        int n,W; cin>>n>>W;
                                        rep(i,1,n+1)cin>>w[i]>>v[i];

                                        a[0][0]=0;

                                        rep(i,1,n+1)
                                        {
                                            a[i]=a[i-1];
                                            for(auto x: a[i-1])
                                                if(x.F+w[i]<=W)
                                                maxx(a[i][x.F+w[i]].S,x.S+v[i]);
                                                else break;
                                        }

                                        ll ans=0;
                                        for(auto x: a[n])
                                            maxx(ans,x.S);

                                        cout<<ans;

                                    rt 0;
                                    }



















Compiler output:
a.cc: In function 'int main()':
a.cc:8:47: error: request for member 'second' in 'a[i].std::map<long long int, long long int>::operator[]((((long long int)x.std::pair<const long long int, long long int>::first) + w[i]))', which is of non-class type 'std::map<long long int, long long int>::mapped_type' {aka 'long long int'}
    8 |                                     #define S second
      |                                               ^~~~~~
a.cc:9:55: note: in definition of macro 'maxx'
    9 |                                     #define maxx(a,b) a=max(a,b)
      |                                                       ^
a.cc:39:69: note: in expansion of macro 'S'
   39 |                                                 maxx(a[i][x.F+w[i]].S,x.S+v[i]);
      |                                                                     ^
a.cc:8:47: error: request for member 'second' in 'a[i].std::map<long long int, long long int>::operator[]((((long long int)x.std::pair<const long long int, long long int>::first) + w[i]))', which is of non-class type 'std::map<long long int, long long int>::mapped_type' {aka 'long long int'}
    8 |                                     #define S second
      |                                               ^~~~~~
a.cc:9:61: note: in definition of macro 'maxx'
    9 |                                     #define maxx(a,b) a=max(a,b)
      |                                                             ^
a.cc:39:69: note: in expansion of macro 'S'
   39 |                                                 maxx(a[i][x.F+w[i]].S,x.S+v[i]);
      |                                                                     ^