Language: C++

#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define pf push_front
#define ar array
typedef long long ll;

const int maxn=1e3+5;
const int di[4]={1, 0, -1, 0}, dj[4]={0, 1, 0, -1};
const int mdi[20]{2, 2, 2, 2, 2, 1, 1, 1, 1 0, 0, -1, -1, -1, -1, -2, -2, -2, -2, -2}, mdj[20]={-2, -1, 0, 1, 2, -2, -1, 1, 2, -2, 2, -2, -1, 1, 2, -2, -1, 0, 1, 2};
int n, m;
string s[maxn];



bool e(int i, int j) {
	return i>=0&&j>=0&&i<n&&j<m&&s[i][j]=='.';
}

void print(vector< vector<int> > &d) {
	for(int i=0; i<n; ++i) {
		for(int j=0; j<m; ++j)
			cout << d[i][j] << " ";
		cout << endl;
	}
}
	
int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n >> m;
	int mi, mj;
	int wi, wj;
	cin >> mi >> mj; --mi; --mj;
	cin >> wi >> wj; --wi; --wj;

	for(int i=0; i<n; ++i) {
		cin >> s[i];
	}

	priority_queue<pair<int, pair<int, int> > > q;
	q.push({1, {mi, mj}});
	vector< vector<int> > d(n, vector<int>(m, INT_MAX));
	d[mi][mj]=0;

	while(q.size()) {
		auto v=q.top().second;
		q.pop();
		for(int k=0; k<4; ++k) {
			int ni=v.first+di[k];
			int nj=v.second+dj[k];
			if(!e(ni,nj))
				continue;
			if(d[ni][nj]>d[v.first][v.second]) {
				d[ni][nj]=d[v.first][v.second];
				q.push({1, {ni, nj}});
			}
		}

		for(int k=0; k<20; ++k) {
			int ni=v.first+mdi[k];
			int nj=v.second+mdj[k];
			if(!e(ni,nj))
				continue;
			if(d[ni][nj]>d[v.first][v.second]+1) {
				d[ni][nj]=d[v.first][v.second]+1;
				q.push({0, {ni, nj}});
			}
		}

		//print(d);
	}

	if(d[wi][wj]==INT_MAX) {
		cout << "-1";
	}
	else
		cout << d[wi][wj];
}


Compiler output:
a.cc:11:45: error: expected '}' before numeric constant
   11 | const int mdi[20]{2, 2, 2, 2, 2, 1, 1, 1, 1 0, 0, -1, -1, -1, -1, -2, -2, -2, -2, -2}, mdj[20]={-2, -1, 0, 1, 2, -2, -1, 1, 2, -2, 2, -2, -1, 1, 2, -2, -1, 0, 1, 2};
      |                  ~                          ^
a.cc:11:45: error: expected ',' or ';' before numeric constant
a.cc:11:85: error: expected declaration before '}' token
   11 | const int mdi[20]{2, 2, 2, 2, 2, 1, 1, 1, 1 0, 0, -1, -1, -1, -1, -2, -2, -2, -2, -2}, mdj[20]={-2, -1, 0, 1, 2, -2, -1, 1, 2, -2, 2, -2, -1, 1, 2, -2, -1, 0, 1, 2};
      |                                                                                     ^
a.cc:11:86: error: expected unqualified-id before ',' token
   11 | const int mdi[20]{2, 2, 2, 2, 2, 1, 1, 1, 1 0, 0, -1, -1, -1, -1, -2, -2, -2, -2, -2}, mdj[20]={-2, -1, 0, 1, 2, -2, -1, 1, 2, -2, 2, -2, -1, 1, 2, -2, -1, 0, 1, 2};
      |                                                                                      ^
a.cc:11:95: error: expected constructor, destructor, or type conversion before '=' token
   11 | const int mdi[20]{2, 2, 2, 2, 2, 1, 1, 1, 1 0, 0, -1, -1, -1, -1, -2, -2, -2, -2, -2}, mdj[20]={-2, -1, 0, 1, 2, -2, -1, 1, 2, -2, 2, -2, -1, 1, 2, -2, -1, 0, 1, 2};
      |                                                                                               ^
a.cc: In function 'int main()':
a.cc:62:41: error: 'mdj' was not declared in this scope; did you mean 'mj'?
   62 |                         int nj=v.second+mdj[k];
      |                                         ^~~
      |                                         mj