Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
int gcd(int a, int b) 
{ 
	if (a == 0) 
		return b; 
	return gcd(b % a, a); 
} 
int invertBits(int num) 
{  
    int x = log2(num) + 1; 
    for (int i = 0; i < x; i++)  
       num = (num ^ (1 << i));  
   
    return num; 
} 
///////////////////////////////////////////////////////////////////////////////////////////////////////////
int hash[100000][3];
int solve(int s[][3],int n,int curr,int i)
{
	if(curr==n-1)
	{
		return s[curr][i];
	}
	if(hash[curr][i]!=0)
	{
		return hash[curr][i];
	}
	int a1,a2;
	if(i==0)
	{
		a1=solve(s,n,curr+1,i+1)+s[curr][i];
	    a2=solve(s,n,curr+1,i+2)+s[curr][i];
	    hash[curr][i]=max(a1,a2);
	}
	else if(i==1)
	{
		a1=solve(s,n,curr+1,i-1)+s[curr][i];
	    a2=solve(s,n,curr+1,i+1)+s[curr][i];
	    hash[curr][i]=max(a1,a2);
	}
	else
	{
		a1=solve(s,n,curr+1,i-1)+s[curr][i];
	    a2=solve(s,n,curr+1,i-2)+s[curr][i];
		hash[curr][i]=max(a1,a2);
	}
	return hash[curr][i];
}
int main()
{
	int n,i,j;
	cin>>n;
	int s[n][3];
	for(i=0;i<n;i++)
	{
		cin>>s[i][0]>>s[i][1]>>s[i][2];
	}
	int ans=0;
	for(i=0;i<3;i++)
	{
		ans=max(ans,solve(s,n,0,i));	
	}
	cout<<ans;
	return 0;
}

Compiler output:
a.cc: In function 'int solve(int (*)[3], int, int, int)':
a.cc:29:12: error: reference to 'hash' is ambiguous
   29 |         if(hash[curr][i]!=0)
      |            ^~~~
In file included from /usr/include/c++/14/string_view:50,
                 from /usr/include/c++/14/bits/basic_string.h:47,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:22:5: note:                 'int hash [100000][3]'
   22 | int hash[100000][3];
      |     ^~~~
a.cc:31:24: error: reference to 'hash' is ambiguous
   31 |                 return hash[curr][i];
      |                        ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:22:5: note:                 'int hash [100000][3]'
   22 | int hash[100000][3];
      |     ^~~~
a.cc:38:13: error: reference to 'hash' is ambiguous
   38 |             hash[curr][i]=max(a1,a2);
      |             ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:22:5: note:                 'int hash [100000][3]'
   22 | int hash[100000][3];
      |     ^~~~
a.cc:44:13: error: reference to 'hash' is ambiguous
   44 |             hash[curr][i]=max(a1,a2);
      |             ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:22:5: note:                 'int hash [100000][3]'
   22 | int hash[100000][3];
      |     ^~~~
a.cc:50:17: error: reference to 'hash' is ambiguous
   50 |                 hash[curr][i]=max(a1,a2);
      |                 ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:22:5: note:                 'int hash [100000][3]'
   22 | int hash[100000][3];
      |     ^~~~
a.cc:52:16: error: reference to 'hash' is ambiguous
   52 |         return hash[curr][i];
      |                ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:22:5: note:                 'int hash [100000][3]'
   22 | int hash[100000][3];
      |     ^~~~