Language: C++

#include <bits/stdc++.h>
#define N 1e3+5
using namespace std;
char S[N][N];
int f[N][N],dr[4][2]={{1,0},{-1,0},{0,1},{0,-1}},que[N*N],s,t;
int main() {
	int h,w,sx,sy,tx,ty;
	cin>>h>>w>>sx>>sy>>tx>>ty;
	for(int i=0;i<h;i++) {
		cin>>S[i];
		for(int j=0;j<w;j++)
			f[i][j]=S[i][j]=='#';
	}
	f[--sx][--sy]=1;
	tx--,ty--;
	que[t++]=sx*N+sy;
	while(s<t){
		int s1=s;
		while(s<t){
			int x=que[s++],y=x%N;
			x/=N;
			for(int i=0;i<4;i++){
				int x1=x+dr[i][0],y1=y+dr[i][1];
				if((unsigned)x1>=h||(unsigned)y1>=w||f[x1][y1])
					continue;
				f[x1][y1]=f[x][y];
				que[t++]=x1*N+y1;
			}
		}
		while(s1<s){
			int x=que[s1++],y=x%N;
			x/=N;
			for (int i=-2;i<3;i++) {
				for (int j=-2;j<3;j++) {
					int x1=x+i,y1=y+j;
					if((unsigned)x1>=h||(unsigned)y1>=w||f[x1][y1])
						continue;
					f[x1][y1]=f[x][y]+1;
					que[t++]=x1*N+y1;
				}
			}
		}
	}
	cout<<(f[tx][ty]?f[tx][ty]-1:-1);
	return 0;
}

Compiler output:
a.cc:2:14: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    2 | #define N 1e3+5
      |           ~~~^~
a.cc:4:11: note: in expansion of macro 'N'
    4 | char S[N][N];
      |           ^
a.cc:2:14: error: could not convert '(1.0e+3 + (double)5)' from 'double' to 'long unsigned int'
    2 | #define N 1e3+5
      |           ~~~^~
      |              |
      |              double
a.cc:4:11: note: in expansion of macro 'N'
    4 | char S[N][N];
      |           ^
a.cc:2:14: error: size of array 'S' has non-integral type 'double'
    2 | #define N 1e3+5
      |           ~~~^~
a.cc:4:11: note: in expansion of macro 'N'
    4 | char S[N][N];
      |           ^
a.cc:2:14: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    2 | #define N 1e3+5
      |           ~~~^~
a.cc:4:8: note: in expansion of macro 'N'
    4 | char S[N][N];
      |        ^
a.cc:2:14: error: could not convert '(1.0e+3 + (double)5)' from 'double' to 'long unsigned int'
    2 | #define N 1e3+5
      |           ~~~^~
      |              |
      |              double
a.cc:4:8: note: in expansion of macro 'N'
    4 | char S[N][N];
      |        ^
a.cc:2:14: error: size of array 'S' has non-integral type 'double'
    2 | #define N 1e3+5
      |           ~~~^~
a.cc:4:8: note: in expansion of macro 'N'
    4 | char S[N][N];
      |        ^
a.cc:2:14: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    2 | #define N 1e3+5
      |           ~~~^~
a.cc:5:10: note: in expansion of macro 'N'
    5 | int f[N][N],dr[4][2]={{1,0},{-1,0},{0,1},{0,-1}},que[N*N],s,t;
      |          ^
a.cc:2:14: error: could not convert '(1.0e+3 + (double)5)' from 'double' to 'long unsigned int'
    2 | #define N 1e3+5
      |           ~~~^~
      |              |
      |              double
a.cc:5:10: note: in expansion of macro 'N'
    5 | int f[N][N],dr[4][2]={{1,0},{-1,0},{0,1},{0,-1}},que[N*N],s,t;
      |          ^
a.cc:2:14: error: size of array 'f' has non-integral type 'double'
    2 | #define N 1e3+5
      |           ~~~^~
a.cc:5:10: note: in expansion of macro 'N'
    5 | int f[N][N],dr[4][2]={{1,0},{-1,0},{0,1},{0,-1}},que[N*N],s,t;
      |          ^
a.cc:2:14: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    2 | #define N 1e3+5
      |           ~~~^~
a.cc:5:7: note: in expansion of macro 'N'
    5 | int f[N][N],dr[4][2]={{1,0},{-1,0},{0,1},{0,-1}},que[N*N],s,t;
      |       ^
a.cc:2:14: error: could not convert '(1.0e+3 + (double)5)' from 'double' to 'long unsigned int'
    2 | #define N 1e3+5
      |           ~~~^~
      |              |
      |              double
a.cc:5:7: note: in expansion of macro 'N'
    5 | int f[N][N],dr[4][2]={{1,0},{-1,0},{0,1},{0,-1}},que[N*N],s,t;
      |       ^
a.cc:2:14: error: size of array 'f' has non-integral type 'double'
    2 | #define N 1e3+5
      |           ~~~^~
a.cc:5:7: note: in expansion of macro 'N'
    5 | int f[N][N],dr[4][2]={{1,0},{-1,0},{0,1},{0,-1}},que[N*N],s,t;
      |       ^
a.cc:2:14: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    2 | #define N 1e3+5
      |              ^
a.cc:5:56: note: in expansion of macro 'N'
    5 | int f[N][N],dr[4][2]={{1,0},{-1,0},{0,1},{0,-1}},que[N*N],s,t;
      |                                                        ^
a.cc:2:14: error: could not convert '((1.0e+3 + ((double)5 * 1.0e+3)) + (double)5)' from 'double' to 'long unsigned int'
    2 | #define N 1e3+5
      |              ^
      |              |
      |              double
a.cc:5:56: note: in expansion of macro 'N'
    5 | int f[N][N],dr[4][2]={{1,0},{-1,0},{0,1},{0,-1}},que[N*N],s,t;
      |                                                        ^
a.cc:2:14: error: size of array 'que' has non-integral type 'double'
    2 | #define N 1e3+5
      |              ^
a.cc:5:56: note: in expansion of macro 'N'
    5 | int f[N][N],dr[4][2]={{1,0},{-1,0},{0,1},{0,-1}},que[N*N],s,t;
      |                                                        ^
a.cc: In function 'int main()':
a.cc:20:43: error: invalid operands of types 'int' and 'double' to binary 'operator%'
   20 |                         int x=que[s++],y=x%N;
      |                                          ~^
      |                                          |
      |                                          int
a.cc:31:44: error: invalid operands of types 'int' and 'double' to binary 'operator%'
   31 |                         int x=que[s1++],y=x%N;
      |                                           ~^
      |                                           |
      |                                           int