Language: C++

#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define ll long long
vector< vector<ll> > ans;
int vacation(vector<vector<ll>> vac,int N,int i){
  if(N==0){
      return vac[N][i];
  }
  for(int j=0;j<3;j++){
    if(ans[N-1][i]==-1 && i!=j){
      ans[N-1][i] = max(vacation(vac,N-1,j),ans[N-1][i]);
    }
  }
  return ans[N][i];
}
int main(){
  ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  
  ll N;
  cin>>N;
  vector< vector<ll> > vac(N, vector<ll>(3));
  ans.resize(N);
  for(int i=0;i<N;i++){
    ans[i].resize(3);
  }
  for(int i=0;i<N;i++){
    for(int j=0;j<3;j++){
      ans[i][j] = -1;
    }
  }
  for(int i=0;i<N;i++){
    for(int j=0;j<3;j++){
      cin>>vac[i][j];
      //cout<<vacation[i][j]<<" ";
    }
  }
  int final_ans = max(vacation(vac,N-1,0),max(vacation(vac,N-1,1),vacation(vac,N-1,2)));
  cout<<final_ans<<endl;
  return 0;
  /*
  for(int i=0;i<1e5;i++){
    cout<<i+1<<endl;
  }*/
}


Compiler output:
a.cc: In function 'int vacation(std::vector<std::vector<long long int> >, int, int)':
a.cc:12:24: error: no matching function for call to 'max(int, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&)'
   12 |       ans[N-1][i] = max(vacation(vac,N-1,j),ans[N-1][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:12:24: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'})
   12 |       ans[N-1][i] = max(vacation(vac,N-1,j),ans[N-1][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:12:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   12 |       ans[N-1][i] = max(vacation(vac,N-1,j),ans[N-1][i]);
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~