Language: C++

#include<iostream>
#include<cstring>

using namespace std;

int max(int a,int b)
{
  if(a>=b)
    return a;
  return b;
}
  
int main()
{

  int n;
  cin>>n;
  int dp[n][3];
  
  for(int i=0;i<n;i++)
  {
    for(int j=0;j<3;j++)
    {
      cin>>dp[i][j];   
    }
  }
  
 
  for(int i=1;i<n;i++)
  {
    dp[i][0]=dp[i][0]+max(dp[i-1][1],max(dp[i-1][2]);                          
    dp[i][1]=dp[i][1]+max(dp[i-1][0],max(dp[i-1][2]);                          
    dp[i][2]=dp[i][2]+max(dp[i-1][0],max(dp[i-1][1]);
  }
  
   int m=max(dp[n-1][0],dp[n-1][1]);
        m=max(m,dp[n-1][2]);
        cout<<m;
  
  return 0;  
  }



Compiler output:
a.cc: In function 'int main()':
a.cc:31:41: error: no matching function for call to 'max(int&)'
   31 |     dp[i][0]=dp[i][0]+max(dp[i-1][1],max(dp[i-1][2]);
      |                                      ~~~^~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 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:   candidate expects 2 arguments, 1 provided
/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, 1 provided
a.cc:6:5: note: candidate: 'int max(int, int)'
    6 | int max(int a,int b)
      |     ^~~
a.cc:6:5: note:   candidate expects 2 arguments, 1 provided
a.cc:32:41: error: no matching function for call to 'max(int&)'
   32 |     dp[i][1]=dp[i][1]+max(dp[i-1][0],max(dp[i-1][2]);
      |                                      ~~~^~~~~~~~~~~~
/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:   candidate expects 2 arguments, 1 provided
/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, 1 provided
a.cc:6:5: note: candidate: 'int max(int, int)'
    6 | int max(int a,int b)
      |     ^~~
a.cc:6:5: note:   candidate expects 2 arguments, 1 provided
a.cc:33:41: error: no matching function for call to 'max(int&)'
   33 |     dp[i][2]=dp[i][2]+max(dp[i-1][0],max(dp[i-1][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:   candidate expects 2 arguments, 1 provided
/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, 1 provided
a.cc:6:5: note: candidate: 'int max(int, int)'
    6 | int max(int a,int b)
      |     ^~~
a.cc:6:5: note:   candidate expects 2 arguments, 1 provided