knapsack.cpp:10:11: error: reference to 'data' is ambiguous
10 | bool comp(data a, data b){
| ^~~~
In file included from /usr/include/c++/10/string:54,
from /usr/include/c++/10/bits/locale_classes.h:40,
from /usr/include/c++/10/bits/ios_base.h:41,
from /usr/include/c++/10/ios:42,
from /usr/include/c++/10/istream:38,
from /usr/include/c++/10/sstream:38,
from /usr/include/c++/10/complex:45,
from /usr/include/c++/10/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
from knapsack.cpp:1:
/usr/include/c++/10/bits/range_access.h:319:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(std::initializer_list<_Tp>)'
319 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/10/bits/range_access.h:310:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
310 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/10/bits/range_access.h:300:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
300 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/10/bits/range_access.h:290:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
290 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
knapsack.cpp:5:8: note: 'struct data'
5 | struct data{
| ^~~~
knapsack.cpp:10:19: error: reference to 'data' is ambiguous
10 | bool comp(data a, data b){
| ^~~~
In file included from /usr/include/c++/10/string:54,
from /usr/include/c++/10/bits/locale_classes.h:40,
from /usr/include/c++/10/bits/ios_base.h:41,
from /usr/include/c++/10/ios:42,
from /usr/include/c++/10/istream:38,
from /usr/include/c++/10/sstream:38,
from /usr/include/c++/10/complex:45,
from /usr/include/c++/10/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
from knapsack.cpp:1:
/usr/include/c++/10/bits/range_access.h:319:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(std::initializer_list<_Tp>)'
319 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/10/bits/range_access.h:310:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
310 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/10/bits/range_access.h:300:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
300 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/10/bits/range_access.h:290:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
290 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
knapsack.cpp:5:8: note: 'struct data'
5 | struct data{
| ^~~~
knapsack.cpp:10:25: error: expression list treated as compound expression in initializer [-fpermissive]
10 | bool comp(data a, data b){
| ^
knapsack.cpp: In function 'int main()':
knapsack.cpp:18:13: error: template argument 1 is invalid
18 | vector<data> d(n);
| ^
knapsack.cpp:18:13: error: template argument 2 is invalid
knapsack.cpp:21:9: error: invalid types 'int[int]' for array subscript
21 | cin>>d[i].v>>d[i].w>>d[i].k;
| ^
knapsack.cpp:21:17: error: invalid types 'int[int]' for array subscript
21 | cin>>d[i].v>>d[i].w>>d[i].k;
| ^
knapsack.cpp:21:25: error: invalid types 'int[int]' for array subscript
21 | cin>>d[i].v>>d[i].w>>d[i].k;
| ^
knapsack.cpp:22:4: error: invalid types 'int[int]' for array subscript
22 | d[i].r=double(d[i].v)/d[i].w;
| ^
knapsack.cpp:22:18: error: invalid types 'int[int]' for array subscript
22 | d[i].r=double(d[i].v)/d[i].w;
| ^
knapsack.cpp:22:26: error: invalid types 'int[int]' for array subscript
22 | d[i].r=double(d[i].v)/d[i].w;
| ^
knapsack.cpp:24:9: error: request for member 'begin' in 'd', which is of non-class type 'int'
24 | sort(d.begin(), d.end(), comp);
| ^~~~~
knapsack.cpp:24:20: error: request for member 'end' in 'd', which is of non-class type 'int'
24 | sort(d.begin(), d.end(), comp);
| ^~~
knapsack.cpp:32:22: error: invalid types 'int[int]' for array subscript
32 | for (int j=0; j<d[i].k && x+(j+1)*d[i].w<=s; j++){
| ^
knapsack.cpp:32:40: error: invalid types 'int[int]' for array subscript
32 | for (int j=0; j<d[i].k && x+(j+1)*d[i].w<=s; j++){
| ^
knapsack.cpp:33:18: error: invalid types 'int[int]' for array subscript
33 | dp[x+(j+1)*d[i].w]=max(dp[x]+(j+1)*d[i].v, dp[x+(j+1)*d[i].w]);
| ^
knapsack.cpp:33:42: error: invalid types 'int[int]' for array subscript
33 | dp[x+(j+1)*d[i].w]=max(dp[x]+(j+1)*d[i].v, dp[x+(j+1)*d[i].w]);
| ^
knapsack.cpp:33:61: error: invalid types 'int[int]' for array subscript
33 | dp[x+(j+1)*d[i].w]=max(dp[x]+(j+1)*d[i].v, dp[x+(j+1)*d[i].w]);
| ^