Language: C++

#include <iostream>
#include <queue>

using namespace std;
struct node
{
	char c;
	int x,y;
	int length;
};
int move[5][3];
bool vis[1005][1005];
node a[1005][1005];
queue<node> q;
int main()
{
	move[1][1]=-1;move[1][2]=0;
	move[2][1]=0;move[2][2]=1;
	move[3][1]=1;move[3][2]=0;
	move[4][1]=0;move[4][2]=-1;
	int h,w;
	cin>>h>>w;
	int sum=0;
	for(int i=1;i<=h;i++)
	{
		for(int j=1;j<=w;j++) 
		{
			cin>>a[i][j].c;	
			if(a[i][j].c=='.') sum++;
			a[i][j].x=i;
			a[i][j].y=j;
			a[i][j].length=1;
		}
	}
	q.push(a[1][1]);
	a[1][1].length=1;
	vis[1][1]=true;
	int step=0;
	while(!q.empty())
	{
		for(int i=1;i<=4;i++)
		{
			int x=q.front().x+move[i][1];
			int y=q.front().y+move[i][2];
			if(a[x][y].c=='.'&&!vis[x][y])
			{
				a[x][y].length=q.front().length+1;
				if(x==h&&y==w) 
				{
					cout<<sum-a[x][y].length<<endl;
					return 0;
				}
				q.push(a[x][y]);
				vis[x][y]=true;
			}
		}
		q.pop();
	}	
	cout<<-1<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:9: error: reference to 'move' is ambiguous
   17 |         move[1][1]=-1;move[1][2]=0;
      |         ^~~~
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:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
In file included from /usr/include/c++/14/bits/exception_ptr.h:41,
                 from /usr/include/c++/14/exception:166,
                 from /usr/include/c++/14/ios:41:
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:11:5: note:                 'int move [5][3]'
   11 | int move[5][3];
      |     ^~~~
a.cc:17:23: error: reference to 'move' is ambiguous
   17 |         move[1][1]=-1;move[1][2]=0;
      |                       ^~~~
/usr/include/c++/14/bits/stl_algobase.h:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:11:5: note:                 'int move [5][3]'
   11 | int move[5][3];
      |     ^~~~
a.cc:18:9: error: reference to 'move' is ambiguous
   18 |         move[2][1]=0;move[2][2]=1;
      |         ^~~~
/usr/include/c++/14/bits/stl_algobase.h:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:11:5: note:                 'int move [5][3]'
   11 | int move[5][3];
      |     ^~~~
a.cc:18:22: error: reference to 'move' is ambiguous
   18 |         move[2][1]=0;move[2][2]=1;
      |                      ^~~~
/usr/include/c++/14/bits/stl_algobase.h:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:11:5: note:                 'int move [5][3]'
   11 | int move[5][3];
      |     ^~~~
a.cc:19:9: error: reference to 'move' is ambiguous
   19 |         move[3][1]=1;move[3][2]=0;
      |         ^~~~
/usr/include/c++/14/bits/stl_algobase.h:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:11:5: note:                 'int move [5][3]'
   11 | int move[5][3];
      |     ^~~~
a.cc:19:22: error: reference to 'move' is ambiguous
   19 |         move[3][1]=1;move[3][2]=0;
      |                      ^~~~
/usr/include/c++/14/bits/stl_algobase.h:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:11:5: note:                 'int move [5][3]'
   11 | int move[5][3];
      |     ^~~~
a.cc:20:9: error: reference to 'move' is ambiguous
   20 |         move[4][1]=0;move[4][2]=-1;
      |         ^~~~
/usr/include/c++/14/bits/stl_algobase.h:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:11:5: note:                 'int move [5][3]'
   11 | int move[5][3];
      |     ^~~~
a.cc:20:22: error: reference to 'move' is ambiguous
   20 |         move[4][1]=0;move[4][2]=-1;
      |                      ^~~~
/usr/include/c++/14/bits/stl_algobase.h:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:11:5: note:                 'int move [5][3]'
   11 | int move[5][3];
      |     ^~~~
a.cc:43:43: error: reference to 'move' is ambiguous
   43 |                         int x=q.front().x+move[i][1];
      |                                           ^~~~
/usr/include/c++/14/bits/stl_algobase.h:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:11:5: note:                 'int move [5][3]'
   11 | int move[5][3];
      |     ^~~~
a.cc:44:43: error: reference to 'move' is ambiguous
   44 |                         int y=q.front().y+move[i][2];
      |                                           ^~~~
/usr/include/c++/14/bits/stl_algobase.h:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:11:5: note:                 'int move [5][3]'
   11 | int move[5][3];
      |     ^~~~