Language: C++

#include <bits/stdc++.h>
#include <vector>
using namespace std;
using ll = long long;
#define rep(i,n) for (ll i=0; i < (ll)(n); i++)
using P = pair<int,int>

const int di[]={-1,0,1,0};
const int dj[]={0,-1,0,1};

int main(void){
    int h,w,ch,cw,dh,dw;
    cin>>h>>w;
    cin>>ch>>cw;
    cin>>dh>>dw;
    ch--; cw--; dh--; dw--;
    vector<string> s(h);
    rep(i,h) cin>>s[i];
    const int INF=10e9;
    vector<vector<int>> dist(h,vector<int>(w,INF));
    deque<P> q;
    dist[ch][cw]=0;
    q.emplace_back(ch,cw);
    while(!q.empty()){
        int i=q.front().first;
        int j=q.front().second;
        int d=dist[i][j];
        q.pip_front();
        rep(v,4){
            int ni=i+di[v],nj=j+dj[v];
            if(ni<0||ni>=h||nj<0||nj>=w)continue;
            if(s[ni][nj]=='#')continue;
            if(dist[ni][nj]<=d)continue;
            dist[ni][nj]=d;
            q.emplace_front(ni,nj);
        }
        for(int ei=-2;ei<=2;ei++){
            for(int ej=-2;2j<=2;ej++){
                int ni=i+ei,nj=j+ej;
                if(ni<0||ni>=h||nj<0||nj>=w)continue;
                if(s[ni][nj]=='#')continue;
                if(dist[ni][nj]<=d+1)continue;
                dist[ni][nj]=d+1;
                q.emplace_front(ni,nj);
            }
        }
    }
    int ans=dist[dh][dw];
    if(ans==INF)ans=-1;
    cout<<ans<<endl;
}

Compiler output:
a.cc:6:11: error: two or more data types in declaration of 'type name'
    6 | using P = pair<int,int>
      |           ^~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:19:19: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+10' to '2147483647' [-Woverflow]
   19 |     const int INF=10e9;
      |                   ^~~~
a.cc:21:11: error: 'P' was not declared in this scope
   21 |     deque<P> q;
      |           ^
a.cc:21:12: error: template argument 1 is invalid
   21 |     deque<P> q;
      |            ^
a.cc:21:12: error: template argument 2 is invalid
a.cc:23:7: error: request for member 'emplace_back' in 'q', which is of non-class type 'int'
   23 |     q.emplace_back(ch,cw);
      |       ^~~~~~~~~~~~
a.cc:24:14: error: request for member 'empty' in 'q', which is of non-class type 'int'
   24 |     while(!q.empty()){
      |              ^~~~~
a.cc:25:17: error: request for member 'front' in 'q', which is of non-class type 'int'
   25 |         int i=q.front().first;
      |                 ^~~~~
a.cc:26:17: error: request for member 'front' in 'q', which is of non-class type 'int'
   26 |         int j=q.front().second;
      |                 ^~~~~
a.cc:28:11: error: request for member 'pip_front' in 'q', which is of non-class type 'int'
   28 |         q.pip_front();
      |           ^~~~~~~~~
a.cc:30:22: error: 'di' was not declared in this scope; did you mean 'ni'?
   30 |             int ni=i+di[v],nj=j+dj[v];
      |                      ^~
      |                      ni
a.cc:31:29: error: 'nj' was not declared in this scope; did you mean 'ni'?
   31 |             if(ni<0||ni>=h||nj<0||nj>=w)continue;
      |                             ^~
      |                             ni
a.cc:32:22: error: 'nj' was not declared in this scope; did you mean 'ni'?
   32 |             if(s[ni][nj]=='#')continue;
      |                      ^~
      |                      ni
a.cc:33:25: error: 'nj' was not declared in this scope; did you mean 'ni'?
   33 |             if(dist[ni][nj]<=d)continue;
      |                         ^~
      |                         ni
a.cc:34:22: error: 'nj' was not declared in this scope; did you mean 'ni'?
   34 |             dist[ni][nj]=d;
      |                      ^~
      |                      ni
a.cc:35:15: error: request for member 'emplace_front' in 'q', which is of non-class type 'int'
   35 |             q.emplace_front(ni,nj);
      |               ^~~~~~~~~~~~~
a.cc:38:29: error: invalid operands of types '__complex__ int' and 'int' to binary 'operator<='
   38 |             for(int ej=-2;2j<=2;ej++){
      |                           ~~^~~
      |                           |   |
      |                           |   int
      |                           __complex__ int
a.cc:44:19: error: request for member 'emplace_front' in 'q', which is of non-class type 'int'
   44 |                 q.emplace_front(ni,nj);
      |                   ^~~~~~~~~~~~~