Language: C++

#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long

vector<vector >v;
vector<vector >dp;

bool compare(vector&a,vector&b){
ll w1 = a[0],s1=a[1],w2=b[0],s2=b[1];
return w1+s1 >= w2+s2;
}
void solve(){
ll n;cin>>n;
v.resize(n,vector(3));
dp.resize(n,vector(10001));
for(ll i=0;i<n;i++){
cin>>v[i][0]>>v[i][1]>>v[i][2];
}
sort(v.begin(),v.end(),compare);
for(ll i=0;i<=v[0][1];i++){
dp[0][i]=v[0][2];
}
for(ll i=1;i<n;i++){
for(ll j=0;j<=10001;j++){
dp[i][j] = dp[i-1][j];
if(j<=v[i][1]){
dp[i][j] = max(dp[i-1][j],v[i][2]+(j+v[i][0]<=10000 ? (dp[i-1][j+v[i][0]]):0));
}
}
}
cout <<dp[n-1][0]<<"\n";

}

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

cout.precision(10);
int t=1;//cin>>t;
while(t--){
    solve();
}
return 0;
}

Compiler output:
a.cc:6:15: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp, class _Alloc> class std::vector'
    6 | vector<vector >v;
      |               ^
a.cc:6:15: note:   expected a type, got 'vector'
a.cc:6:15: error: template argument 2 is invalid
a.cc:7:15: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp, class _Alloc> class std::vector'
    7 | vector<vector >dp;
      |               ^
a.cc:7:15: note:   expected a type, got 'vector'
a.cc:7:15: error: template argument 2 is invalid
a.cc:9:14: error: missing template argument list after 'std::vector'; template placeholder not permitted in parameter
    9 | bool compare(vector&a,vector&b){
      |              ^~~~~~
      |                    <>
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:428:11: note: 'template<class _Tp, class _Alloc> class std::vector' declared here
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
a.cc:9:23: error: missing template argument list after 'std::vector'; template placeholder not permitted in parameter
    9 | bool compare(vector&a,vector&b){
      |                       ^~~~~~
      |                             <>
/usr/include/c++/14/bits/stl_vector.h:428:11: note: 'template<class _Tp, class _Alloc> class std::vector' declared here
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
a.cc: In function 'bool compare(...)':
a.cc:10:9: error: 'a' was not declared in this scope
   10 | ll w1 = a[0],s1=a[1],w2=b[0],s2=b[1];
      |         ^
a.cc:11:11: error: 's1' was not declared in this scope; did you mean 'w1'?
   11 | return w1+s1 >= w2+s2;
      |           ^~
      |           w1
a.cc:11:17: error: 'w2' was not declared in this scope; did you mean 'w1'?
   11 | return w1+s1 >= w2+s2;
      |                 ^~
      |                 w1
a.cc:11:20: error: 's2' was not declared in this scope
   11 | return w1+s1 >= w2+s2;
      |                    ^~
a.cc: In function 'void solve()':
a.cc:15:3: error: request for member 'resize' in 'v', which is of non-class type 'int'
   15 | v.resize(n,vector(3));
      |   ^~~~~~
a.cc:15:20: error: class template argument deduction failed:
   15 | v.resize(n,vector(3));
      |                    ^
a.cc:15:20: error: no matching function for call to 'vector(int)'
/usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate: 'template<class _Tp, class _Alloc, class _InputIterator, class> vector(_InputIterator, _InputIterator, const _Alloc&)-> std::vector<_Tp, _Alloc>'
  707 |         vector(_InputIterator __first, _InputIterator __last,
      |         ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:707:9: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::initializer_list<_Tp>, const _Alloc&)-> std::vector<_Tp, _Alloc>'
  678 |       vector(initializer_list<value_type> __l,
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:678:7: note:   template argument deduction/substitution failed:
a.cc:15:20: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   15 | v.resize(n,vector(3));
      |                    ^
/usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&)-> std::vector<_Tp, _Alloc>'
  659 |       vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:659:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, const _Alloc&, std::false_type)-> std::vector<_Tp, _Alloc>'
  640 |       vector(vector&& __rv, const allocator_type& __m, false_type)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:640:7: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, const _Alloc&, std::true_type)-> std::vector<_Tp, _Alloc>'
  635 |       vector(vector&& __rv, const allocator_type& __m, true_type) noexcept
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:635:7: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const std::vector<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&)-> std::vector<_Tp, _Alloc>'
  624 |       vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:624:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&)-> std::vector<_Tp, _Alloc>'
  620 |       vector(vector&&) noexcept = default;
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:620:7: note:   template argument deduction/substitution failed:
a.cc:15:20: note:   mismatched types 'std::vector<_Tp, _Alloc>' and 'int'
   15 | v.resize(n,vector(3));
      |                    ^
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const std::vector<_Tp, _Alloc>&)-> std::vector<_Tp, _Alloc>'
  601 |       vector(const vector& __x)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:601:7: note:   template argument deduction/substitution failed:
a.cc:15:20: note:   mismatched types 'const std::vector<_Tp, _Alloc>' and 'int'
   15 | v.resize(n,vector(3));
      |                    ^
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::size_t, const _Tp&, const _Alloc&)-> std::vector<_Tp, _Alloc>'
  569 |       vector(size_type __n, const value_type& __value,
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:569:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::size_t, const _Alloc&)-> std::vector<_Tp, _Alloc>'
  556 |       vector(size_type __n, const allocator_type& __a = allocator_type())
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:7: note:   template argument deduction/substitution failed:
a.cc:15:20: note:   couldn't deduce template parameter '_Tp'
   15 | v.resize(n,vector(3));
      |                    ^
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const _Alloc&)-> std::vector<_Tp, _Alloc>'
  542 |       vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:542:7: note:   template argument deduction/substitution failed:
a.cc:15:20: note:   couldn't deduce template parameter '_Tp'
   15 | v.resize(n,vector(3));
      |                    ^
/usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate: 'template<class _Tp, class _Alloc> vector()-> std::vector<_Tp, _Alloc>'
  531 |       vector() = default;
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:531:7: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:428:11: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>)-> std::vector<_Tp, _Alloc>'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   template argument deduction/substitution failed:
a.cc:15:20: note:   mismatched types 'std::vector<_Tp, _Alloc>' and 'int'
   15 | v.resize(n,vector(3));
      |                    ^
/usr/include/c++/14/bits/stl_vector.h:2033:5: note: candidate: 'template<class _InputIterator, class _ValT, class _Allocator, class, class> std::vector(_InputIterator, _InputIterator, _Allocator)-> vector<_ValT, _Allocator>'
 2033 |     vector(_InputIterator, _InputIterator, _Allocator = _Allocator())
      |     ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:2033:5: note:   candidate expects 2 arguments, 1 provided
a.cc:16:4: error: request for member 'resize' in 'dp', which is of non-class type 'int'
   16 | dp.resize(n,vector(10001));
      |    ^~~~~~
a.cc:16:25: error: class template argument deduction failed:
   16 | dp.resize(n,vector(10001));
      |                         ^
a.cc:16:25: error: no matching function for call to 'vector(int)'
/usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate: 'template<class _Tp, class _Alloc, class _InputIterator, class> vector(_InputIterator, _InputIterator, const _Alloc&)-> std::vector<_Tp, _Alloc>'
  707 |         vector(_InputIterator __first, _InputIterator __last,
      |         ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:707:9: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::initializer_list<_Tp>, const _Alloc&)-> std::vector<_Tp, _Alloc>'
  678 |       vector(initializer_list<value_type> __l,
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:678:7: note:   template argument deduction/substitution failed:
a.cc:16:25: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   16 | dp.resize(n,vector(10001));
      |                         ^
/usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&)-> std::vector<_Tp, _Alloc>'
  659 |       vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:659:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, const _Alloc&, std::false_t