Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include <iterator>
#include<queue>
#include <functional>
#include <string>
#include <numeric>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) v.begin(),v.end()
using namespace std;
const int dx[4] = { -1, 1, 0, 0 };
const int dy[4] = { 0, 0, -1, 1 };
struct data
{
	bool memo[20][20][16][4] = {};
};
int R=0, C=0;
bool a(int ax, int ay, vector<string> Fi,int Memory, int Muki,data aa){
	ax=(ax+C)% C;ay=(ay+R) % R;
	if (aa.memo[ax][ay][Memory][Muki])return false;
	aa.memo[ax][ay][Memory][Muki] = true;
	switch (Fi[ay][ax]){
	case '<':Muki = 0; return a(ax + dx[Muki], ay + dy[Muki], Fi, Memory, Muki,aa);
	case '>':Muki = 1;; return a(ax + dx[Muki], ay + dy[Muki], Fi, Memory, Muki, aa);
	case '^':Muki = 2; return a(ax + dx[Muki], ay + dy[Muki], Fi, Memory, Muki, aa);
	case 'v':Muki = 3; return a(ax + dx[Muki], ay + dy[Muki], Fi, Memory, Muki, aa);
	case '_':Muki = Memory ? 0 : 1; return a(ax + dx[Muki], ay + dy[Muki], Fi, Memory, Muki, aa);
	case '|':Muki = Memory ? 2 : 3; return a(ax + dx[Muki], ay + dy[Muki], Fi, Memory, Muki, aa);
	case '?': return a(ax + dx[0], ay + dy[0], Fi, Memory, 0, aa) || a(ax + dx[1], ay + dy[1], Fi, Memory, 1, aa) || a(ax + dx[2], ay + dy[2], Fi, Memory, 2, aa) || a(ax + dx[3], ay + dy[3], Fi, Memory, 3, aa);
	case '.':return a(ax + dx[Muki], ay + dy[Muki], Fi,Memory, Muki, aa);
	case '@':return true;
	case '+':return a(ax + dx[Muki], ay + dy[Muki], Fi, (Memory + 1) % 16, Muki, aa);
	case '-':return a(ax + dx[Muki], ay + dy[Muki], Fi, (Memory+15) % 16, Muki, aa);
	default:return a(ax + dx[Muki], ay + dy[Muki], Fi, Fi[ay][ax]-48, Muki, aa);
	}
	return 0;
}

int main(){
	cin >> R >> C;
	vector<string> Field(R);
	REP(i, R){
		string st;
		cin >> Field[i];
	}
	data adata;
	if (a(0, 0, Field, 0, 1,adata)){
		cout << "YES" << endl;
	}
	else{
		cout << "NO" << endl;
	}
		
	return 0;
}

Compiler output:
a.cc:20:63: error: reference to 'data' is ambiguous
   20 | bool a(int ax, int ay, vector<string> Fi,int Memory, int Muki,data aa){
      |                                                               ^~~~
In file included from /usr/include/c++/14/string:53,
                 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/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:15:8: note:                 'struct data'
   15 | struct data
      |        ^~~~
a.cc:20:63: error: 'data' has not been declared
   20 | bool a(int ax, int ay, vector<string> Fi,int Memory, int Muki,data aa){
      |                                                               ^~~~
a.cc: In function 'bool a(int, int, std::vector<std::__cxx11::basic_string<char> >, int, int, int)':
a.cc:22:16: error: request for member 'memo' in 'aa', which is of non-class type 'int'
   22 |         if (aa.memo[ax][ay][Memory][Muki])return false;
      |                ^~~~
a.cc:23:12: error: request for member 'memo' in 'aa', which is of non-class type 'int'
   23 |         aa.memo[ax][ay][Memory][Muki] = true;
      |            ^~~~
a.cc: In function 'int main()':
a.cc:48:9: error: reference to 'data' is ambiguous
   48 |         data adata;
      |         ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:15:8: note:                 'struct data'
   15 | struct data
      |        ^~~~
a.cc:49:33: error: 'adata' was not declared in this scope; did you mean 'data'?
   49 |         if (a(0, 0, Field, 0, 1,adata)){
      |                                 ^~~~~
      |                                 data