Language: C++

#include<bits/stdc++.h>
using namespace std;
const int N=1e6+5;
struct node{
	int x,y,num,count,t;
}p,f;
int move[3][5]={0,0,0,0,0,0,0,1,0,-1,0,1,0,-1,0};
queue<node> q;

int main(){
	int n,m,k,i,j,x1,x2,y1,y2,x,y;
	scanf("%d%d%d",&n,&m,&k);
	scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
	int a[n+1][m+1];
	int visited[n+1][m+1];
	char c;
	
	for(i=1;i<=n;++i)
		for(j=1;j<=m;++j){
			cin>>c;
			if(c=='.') a[i][j]=1;
			else a[i][j]=0;
		}
	
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++) 
			visited[i][j]=0;
	f.x=x1,f.y=y1,f.count=1,f.num=0;f.t=0;
	visited[x1][y1]=true;
	q.push(f);
	
	while(!q.empty()){
		f=q.front();
		for(i=1;i<=4;++i){
			x=f.x+move[1][i];y=f.y+move[2][i];
			if(!visited[x][y] && a[x][y] && x>=1 && x<=n && y>=1 && y<=m){
				p.x=x;p.y=y;
				if(f.t==i || f.t==0){
					p.t=i;
					if(f.num>=k){
						p.num=1;p.count=f.count+1;
					}
					else{
						p.num=f.num+1;p.count=f.count;
					}
				}
				else{
					p.t=i;
					p.num=1;p.count=f.count+1;
				}
				q.push(p);
				visited[x][y]=true;
				if(x==x2 && y==y2){
					printf("%d",p.count);
					return 0;
				}
			}
		}
		q.pop();
	}
	
	printf("%d",-1);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:31: error: reference to 'move' is ambiguous
   35 |                         x=f.x+move[1][i];y=f.y+move[2][i];
      |                               ^~~~
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:7:5: note:                 'int move [3][5]'
    7 | int move[3][5]={0,0,0,0,0,0,0,1,0,-1,0,1,0,-1,0};
      |     ^~~~
a.cc:35:48: error: reference to 'move' is ambiguous
   35 |                         x=f.x+move[1][i];y=f.y+move[2][i];
      |                                                ^~~~
/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:7:5: note:                 'int move [3][5]'
    7 | int move[3][5]={0,0,0,0,0,0,0,1,0,-1,0,1,0,-1,0};
      |     ^~~~