Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <cstring>

using namespace std;

class Node{
public:
	int x, y, face, dir;
	Node(int x, int y, int face, int dir) : x(x), y(y), face(face), dir(dir) {}
};

int dx[2][3] = { {1, -1, 0}, {1, 0, -1} };
int dy[2][3] = { {0,  0, 1}, {0, -1,  0} };
int next[20][3] = {
	{1, 4, 5}, {2, 0, 6}, {3, 1, 7}, {4, 2, 8}, {0, 3, 9},
	{0, 10, 11}, {1, 11, 12}, {2, 12, 13}, {3, 13, 14}, {4, 14, 10},
	{5, 9, 15}, {6, 5, 16}, {7, 6, 17}, {8, 7, 18}, {9, 8, 19},
	{10, 19, 16}, {11, 15, 17}, {12, 16, 18}, {13, 17, 19}, {14, 18, 15}
};

int main(){
	int n;
	static int res[3][20][201][201]; // [dir][face][x][y]
	memset(res, -1, sizeof(res));
	queue<Node> qu; qu.push(Node(100, 100, 0, 0));
	res[0][0][100][100] = 0;
	while(!qu.empty()){
		Node nd = qu.front(); qu.pop();
		int px = nd.x, py = nd.y, face = nd.face, dir = nd.dir;
		if(res[dir][face][px][py]==100) continue;
		for(int i=0;i<3;i++){
			int x = px+dx[(px+py)%2][i], y = py+dy[(px+py)%2][i];
			int nface = next[face][(i+dir)%3];
			int ndir = 0;
			for(int j=0;j<3;j++){
				int nx = x+dx[(x+y)%2][j], ny = y+dy[(x+y)%2][j];
				if(nx==px && ny == py){
					for(int k=0;k<3;k++)
						if(next[nface][k] == face) ndir = (k-j+3)%3;
				}
			}
			if(res[ndir][nface][x][y]==-1){
				res[ndir][nface][x][y] = res[dir][face][px][py]+1;
				qu.push(Node(x, y, nface, ndir));
			}
		}
	}

	int x, y, f;
	while(cin >> x >> y >> f, x|y|f)ne
		int step = 100;
		for(int i=0;i<3;i++){
			if(res[i][f][x+100][y+100]!=-1)
				step = min(step, res[i][f][x+100][y+100]);
		}
		cout << step << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:37: error: reference to 'next' is ambiguous
   35 |                         int nface = next[face][(i+dir)%3];
      |                                     ^~~~
In file included from /usr/include/c++/14/string:47,
                 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_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:16:5: note:                 'int next [20][3]'
   16 | int next[20][3] = {
      |     ^~~~
a.cc:41:52: error: reference to 'next' is ambiguous
   41 |                                                 if(next[nface][k] == face) ndir = (k-j+3)%3;
      |                                                    ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:16:5: note:                 'int next [20][3]'
   16 | int next[20][3] = {
      |     ^~~~
a.cc:52:41: error: 'ne' was not declared in this scope; did you mean 'n'?
   52 |         while(cin >> x >> y >> f, x|y|f)ne
      |                                         ^~
      |                                         n
a.cc:56:33: error: 'step' was not declared in this scope; did you mean 'strsep'?
   56 |                                 step = min(step, res[i][f][x+100][y+100]);
      |                                 ^~~~
      |                                 strsep
a.cc:58:25: error: 'step' was not declared in this scope; did you mean 'strsep'?
   58 |                 cout << step << endl;
      |                         ^~~~
      |                         strsep
a.cc: At global scope:
a.cc:60:1: error: expected declaration before '}' token
   60 | }
      | ^