Language: C++

#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll dp[105][105],w[105][105],v[105][105];
int n,W;
ll max_stone(int i,int amount)
{
    if(i>=n)
        return 0;
    if(dp[i][amount])
        return dp[i][amount];
    ll x;
    if(amount+w[i]<=W)
        x = max_stone(i+1,amount+w[i])+v[i];
    x = max(x,max_stone(i+1,amount)+v[i]);
    return dp[i][amount] = x;
}
int main()
{
    cin>>n>>W;
    for(int i=0; i<n; i++)
        cin>>w[i]>>v[i];
    cout<<max_stone(0,0)<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'long long int max_stone(int, int)':
a.cc:13:19: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   13 |     if(amount+w[i]<=W)
      |        ~~~~~~~~~~~^~~
a.cc:14:33: error: invalid conversion from 'long long int*' to 'int' [-fpermissive]
   14 |         x = max_stone(i+1,amount+w[i])+v[i];
      |                           ~~~~~~^~~~~
      |                                 |
      |                                 long long int*
a.cc:6:24: note:   initializing argument 2 of 'long long int max_stone(int, int)'
    6 | ll max_stone(int i,int amount)
      |                    ~~~~^~~~~~
a.cc:14:39: error: invalid conversion from 'long long int*' to 'long long int' [-fpermissive]
   14 |         x = max_stone(i+1,amount+w[i])+v[i];
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
      |                                       |
      |                                       long long int*
a.cc:15:12: error: no matching function for call to 'max(long long int&, long long int*)'
   15 |     x = max(x,max_stone(i+1,amount)+v[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:15:12: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long int*')
   15 |     x = max(x,max_stone(i+1,amount)+v[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:15:12: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   15 |     x = max(x,max_stone(i+1,amount)+v[i]);
      |         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:22:12: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'long long int [105]')
   22 |         cin>>w[i]>>v[i];
      |         ~~~^~~~~~
      |         |       |
      |         |       long long int [105]
      |         std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  170 |       operator>>(bool& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:170:7: note:   conversion of argument 1 would be ill-formed:
a.cc:22:17: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'long long int*'
   22 |         cin>>w[i]>>v[i];
      |              ~~~^
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
  174 |       operator>>(short& __n);
      |       ^~~~~~~~
/usr/include/c++/14/istream:174:7: note:   conversion of argument 1 would be ill-formed:
a.cc:22:17: error: invalid conversion from 'long long int*' to 'short int' [-fpermissive]
   22 |         cin>>w[i]>>v[i];
      |              ~~~^
      |                 |
      |                 long long int*
a.cc:22:17: error: cannot bind rvalue '(short int)((long long int*)(& w[i]))' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  177 |       operator>>(unsigned short& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:177:7: note:   conversion of argument 1 would be ill-formed:
a.cc:22:17: error: invalid conversion from 'long long int*' to 'short unsigned int' [-fpermissive]
   22 |         cin>>w[i]>>v[i];
      |              ~~~^
      |                 |
      |                 long long int*
a.cc:22:17: error: cannot bind rvalue '(short unsigned int)((long long int*)(& w[i]))' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
  181 |       operator>>(int& __n);
      |       ^~~~~~~~
/usr/include/c++/14/istream:181:7: note:   conversion of argument 1 would be ill-formed:
a.cc:22:17: error: invalid conversion from 'long long int*' to 'int' [-fpermissive]
   22 |         cin>>w[i]>>v[i];
      |              ~~~^
      |                 |
      |                 long long int*
a.cc:22:17: error: cannot bind rvalue '(int)((long long int*)(& w[i]))' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  184 |       operator>>(unsigned int& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:184:7: note:   conversion of argument 1 would be ill-formed:
a.cc:22:17: error: invalid conversion from 'long long int*' to 'unsigned int' [-fpermissive]
   22 |         cin>>w[i]>>v[i];
      |              ~~~^
      |                 |
      |                 long long int*
a.cc:22:17: error: cannot bind rvalue '(unsigned int)((long long int*)(& w[i]))' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  188 |       operator>>(long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:188:7: note:   conversion of argument 1 would be ill-formed:
a.cc:22:17: error: invalid conversion from 'long long int*' to 'long int' [-fpermissive]
   22 |         cin>>w[i]>>v[i];
      |              ~~~^
      |                 |
      |                 long long int*
a.cc:22:17: error: cannot bind rvalue '(long int)((long long int*)(& w[i]))' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  192 |       operator>>(unsigned long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:192:7: note:   conversion of argument 1 would be ill-formed:
a.cc:22:17: error: invalid conversion from 'long long int*' to 'long unsigned int' [-fpermissive]
   22 |         cin>>w[i]>>v[i];
      |              ~~~^
      |                 |
      |                 long long int*
a.cc:22:17: error: cannot bind rvalue '(long unsigned int)((long long int*)(& w[i]))' to 'long unsigned int&'
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  199 |       operator>>(long long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:199:7: note:   conversion of argument 1 would be ill-formed:
a.cc:22:17: error: invalid conversion from 'long long int*' to 'long long int' [-fpermissive]
   22 |         cin>>w[i]>>v[i];
      |              ~~~^
      |                 |
      |                 long long int*
a.cc:22:17: error: cannot bind rvalue '(long long int)((long long int*)(& w[i]))' to 'long long int&'
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  203 |       operator>>(unsigned long long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:203:7: note:   conversion of argument 1 would be ill-formed:
a.cc:22:17: error: invalid conversion from 'long long int*' to 'long long unsigned int' [-fpermissive]
   22 |         cin>>w[i]>>v[i];
      |              ~~~^
      |                 |
      |                 long long int*
a.cc:22:17: error: cannot bind rvalue '(long long unsigned int)((long long int*)(& w[i]))' to 'long long unsigned int&'
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_ty