Language: C++

#include<bits/stdc++.h>
using namespace std;
const int move[4][2]={{0,1},{0,-1},{1,0},{-1,0}};
#define INF 0x3f3f3f3f
template<typename T>
void read(T &x)
{
    char ch=getchar();
    int f=1;
    for (x=0;ch!='-'&&(ch<'0'||ch>'9');ch=getchar());
    if (ch=='-') f=-1,ch=getchar();
    for (;ch>='0'&&ch<='9';x=x*10+ch-'0',ch=getchar());
    x*=f;
}
int n,m,k,ans,x,y;
char mp[810][810];
bool vis[810][810];
char getopt()
{
	char ch=getchar();
	while (ch!='#'&&ch!='.'&&ch!='S') ch=getchar();
	return ch;
}
int calc(int x,int y)
{
	return min(min(x-1,n-x),min(y-1,m-y))/k;
}
void dfs(int x,int y,int deep)
{
	vis[x][y]=1;
	ans=min(ans,calc(x,y));
	for (int i=0;i<4;i++)
	{
		int newx=x+move[i][0];
		int newy=y+move[i][1];
		if (deep<k&&newx>=1&&newx<=n&&newy>=1&&newy<=m&&mp[newx][newy]=='.'&&!vis[newx][newy])
			dfs(newx,newy,deep+1);
	}
}
int main()
{
	read(n),read(m),read(k);
	for (int i=1;i<=n;i++)
		for (int j=1;j<=m;j++)
		{
			mp[i][j]=getopt();
			if (mp[i][j]=='S')
				x=i,y=j;
		}
	ans=INF;
	dfs(x,y,0);
	printf("%d",ans+1);
	return 0;
} 

Compiler output:
a.cc: In function 'void dfs(int, int, int)':
a.cc:34:28: error: reference to 'move' is ambiguous
   34 |                 int newx=x+move[i][0];
      |                            ^~~~
In file included from /usr/include/c++/14/algorithm:86,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:353:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2> std::move(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2)'
  353 | move(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __d_first);
      | ^~~~
In file included from /usr/include/c++/14/algorithm:60:
/usr/include/c++/14/bits/stl_algobase.h:675:5: note:                 '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/stl_pair.h:61,
                 from /usr/include/c++/14/bits/stl_algobase.h:64:
/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:3:11: note:                 'const int move [4][2]'
    3 | const int move[4][2]={{0,1},{0,-1},{1,0},{-1,0}};
      |           ^~~~
a.cc:35:28: error: reference to 'move' is ambiguous
   35 |                 int newy=y+move[i][1];
      |                            ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:353:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2> std::move(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2)'
  353 | move(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __d_first);
      | ^~~~
/usr/include/c++/14/bits/stl_algobase.h:675:5: note:                 '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:3:11: note:                 'const int move [4][2]'
    3 | const int move[4][2]={{0,1},{0,-1},{1,0},{-1,0}};
      |           ^~~~