Language: C++

#include<iostream>
using namespace std;
int a[10][10];
int n; 
int rec(int idx, int prev)
{
	if(idx==n){return 0;}
	if(prev==0)
	{
		 int x=rec(idx+1,1)+a[idx][1];
		 int y=rec(idx+1,2)+a[idx][2];
		 return max({x,y});
	}
	if(prev==1)
	{
		int x=rec(idx+1,0)+a[idx][0];
		 int y=rec(idx+1,2)+a[idx][2];
		 return max({x,y});
	}
	if(prev==2)
	{
		int x=rec(idx+1,0)+a[idx][0];
		 int y=rec(idx+1,1)+a[idx][1];
		 return max({x,y});
	}
	
	
}
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{for(int j=0;j<3;j++)
	{
		cin>>a[i][j];
	}
	}
	cout<<rec(0,0);
}
	

Compiler output:
a.cc: In function 'int rec(int, int)':
a.cc:12:28: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   12 |                  return max({x,y});
      |                         ~~~^~~~~~~
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:18:28: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   18 |                  return max({x,y});
      |                         ~~~^~~~~~~
/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:24:28: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   24 |                  return max({x,y});
      |                         ~~~^~~~~~~
/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