Language: C++

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int,int>
#define pll pair<LL,LL>
#define vi vector<int>
#define vl vector<LL>
#define vii vector<vi>
#define vll vector<vl>

const double pi = 3.14159265358979323846264;
const int mod=1000000007;
int dx[4]={-1,0,1,0};
int dy[4]={0,1,0,-1};

int main(){
	int h,w,ch,cw,dh,dw;
    cin>>h>>w>>ch>>cw>>dh>>dw;
    ch+=9;
    cw+=9;
    dh+=9;
    dw+=9;
    vii b(h+100,vi(w+100,1));
    vii ans(h+100,vi(w+100,mod));
    FOR(i,0,h){
        string s;
        cin>>s;
        FOR(j,0,w){
            if(s[j]=='.'){
                b[i+10][j+10]=0;
            }
        }
    }
    cerr<<"t"<<endl;
    priority_queue<array<int,3>> pq;
    pq.push({0,ch,cw});
    while (pq.size())
    {
        auto tpl=pq.top();
        pq.pop();
        int sc=-tpl[0];
        int nh=tpl[1];
        int nw=tpl[2];
        if(sc>=ans[nh][nw])continue;
        ans[nh][nw]=sc;
        //cerr<<nh<<" "<<nw<<" "<<sc<<endl;
        FOR(di,0,4){
            int nxsc=sc;
            int nxw=nw+dx[di];
            int nxh=nh+dy[di];
            if(b[nxh][nxw])continue;
            if(nxsc>=ans[nxh][nxw])continue;
            pq.push({-nxsc,nxh,nxw});
        }
        FOR(nxh,nh-2,nh+3){
            FOR(nxw,nw-2,nw+3){
                int nxsc=sc+1;
                if(b[nxh][nxw])continue;
                if(nxsc>=ans[nxh][nxw])continue;
                pq.push({-nxsc,nxh,nxw});
            }
        }
    }
    if(ans[dh][dw]!=mod){
        cout<<ans[dh][dw]<<endl;
    }else{
        cout<<-1<<endl;
    }


}


Compiler output:
a.cc: In function 'int main()':
a.cc:68:12: error: no matching function for call to 'std::priority_queue<std::array<int, 3> >::push(<brace-enclosed initializer list>)'
   68 |     pq.push({0,ch,cw});
      |     ~~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/14/queue:66,
                 from a.cc:15:
/usr/include/c++/14/bits/stl_queue.h:736:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::array<int, 3>; _Sequence = std::vector<std::array<int, 3>, std::allocator<std::array<int, 3> > >; _Compare = std::less<std::array<int, 3> >; value_type = std::array<int, 3>]'
  736 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:736:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::priority_queue<std::array<int, 3> >::value_type&' {aka 'const std::array<int, 3>&'}
  736 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_queue.h:744:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(value_type&&) [with _Tp = std::array<int, 3>; _Sequence = std::vector<std::array<int, 3>, std::allocator<std::array<int, 3> > >; _Compare = std::less<std::array<int, 3> >; value_type = std::array<int, 3>]'
  744 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:744:25: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<std::array<int, 3> >::value_type&&' {aka 'std::array<int, 3>&&'}
  744 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~
a.cc:71:14: error: deduced type 'std::array<int, 3>' for 'tpl' is incomplete
   71 |         auto tpl=pq.top();
      |              ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_pair.h:99:12: note: declaration of 'struct std::array<int, 3>'
   99 |     struct array;
      |            ^~~~~
a.cc:85:20: error: no matching function for call to 'std::priority_queue<std::array<int, 3> >::push(<brace-enclosed initializer list>)'
   85 |             pq.push({-nxsc,nxh,nxw});
      |             ~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:736:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::array<int, 3>; _Sequence = std::vector<std::array<int, 3>, std::allocator<std::array<int, 3> > >; _Compare = std::less<std::array<int, 3> >; value_type = std::array<int, 3>]'
  736 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:736:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::priority_queue<std::array<int, 3> >::value_type&' {aka 'const std::array<int, 3>&'}
  736 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_queue.h:744:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(value_type&&) [with _Tp = std::array<int, 3>; _Sequence = std::vector<std::array<int, 3>, std::allocator<std::array<int, 3> > >; _Compare = std::less<std::array<int, 3> >; value_type = std::array<int, 3>]'
  744 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:744:25: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<std::array<int, 3> >::value_type&&' {aka 'std::array<int, 3>&&'}
  744 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~
a.cc:92:24: error: no matching function for call to 'std::priority_queue<std::array<int, 3> >::push(<brace-enclosed initializer list>)'
   92 |                 pq.push({-nxsc,nxh,nxw});
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:736:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::array<int, 3>; _Sequence = std::vector<std::array<int, 3>, std::allocator<std::array<int, 3> > >; _Compare = std::less<std::array<int, 3> >; value_type = std::array<int, 3>]'
  736 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:736:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::priority_queue<std::array<int, 3> >::value_type&' {aka 'const std::array<int, 3>&'}
  736 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_queue.h:744:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(value_type&&) [with _Tp = std::array<int, 3>; _Sequence = std::vector<std::array<int, 3>, std::allocator<std::array<int, 3> > >; _Compare = std::less<std::array<int, 3> >; value_type = std::array<int, 3>]'
  744 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:744:25: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<std::array<int, 3> >::value_type&&' {aka 'std::array<int, 3>&&'}
  744 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:8:
/usr/include/c++/14/bits/stl_vector.h: In instantiation of 'std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = std::array<int, 3>; _Alloc = std::allocator<std::array<int, 3> >]':
/usr/include/c++/14/bits/stl_vector.h:531:7:   required from 'std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue() [with _Seq = std::vector<std::array<int, 3>, std::allocator<std::array<int, 3> > >; _Requires = void; _Tp = std::array<int, 3>; _Sequence = std::vector<std::array<int, 3>, std::allocator<std::array<int, 3> > >; _Compare = std::less<std::array<int, 3> >]'
  531 |       vector() = default;
      |       ^~~~~~
a.cc:67:34:   required from here
   67 |     priority_queue<array<int,3>> pq;
      |                                  ^~
/usr/include/c++/14/bits/stl_vector.h:369:49: error: invalid use of incomplete type 'struct std::array<int, 3>'
  369 |                       _M_impl._M_end_of_storage - _M_impl._M_start);
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: declaration of 'struct std::array<int, 3>'
   99 |     struct array;
      |            ^~~~~
/usr/include/c++/14/bits/stl_vector.h: In instantiation of 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = std::array<int, 3>; _Alloc = std::allocator<std::array<int, 3> >; size_type = long unsigned int]':
/usr/include/c++/14/bits/stl_queue.h:713:22:   required from 'std::priority_queue<_Tp, _Sequence, _Compare>::size_type std::priority_queue<_Tp, _Sequence, _Compare>::size() const [with _Tp = std::array<int, 3>; _Sequence = std::vector<std::array<int, 3>, std::allocator<std::array<int, 3> > >; _Compare = std::less<std::array<int, 3> >; size_type = long unsigned int]'
  713 |       { return c.size(); }
      |                ~~~~~~^~
a.cc:69:19:   required from here
   69 |     while (pq.size())
      |            ~~~~~~~^~
/usr/include/c++/14/bits/stl_vector.h:993:50: error: invalid use of incomplete type 'struct std::array<int, 3>'
  993 |       { return size_type(this->_M_impl._M_finish - this->_M_impl._M_start); }
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: declaration of 'struct std::array<int, 3>'
   99 |     struct array;
      |            ^~~~~
/usr/include/c++/14/bits/stl_vector.h: In instantiation of 'void std::vector<_Tp, _Alloc>::pop_back() [with _Tp = std::array<int, 3>; _Alloc = std::allocator<std::array<int, 3> >]':
/usr/include/c++/14/bits/stl_queue.h:775:12:   required from 'void std::priority_queue<_Tp, _Sequence, _Compare>::pop() [with _Tp = std::array<int, 3>; _Sequence = std::vector<std::array<int, 3>, std::allocator<std::array<int, 3> > >; _Compare = std::less<std::array<int, 3> >]'
  775 |         c.pop_back();
      |         ~~~~~~~~~~^~
a.cc:72:15:   required from here
   72 |         pq.pop();
      |         ~~~~~~^~
/usr/include/c++/14/bits/stl_vector.h:1327:25: error: cannot decrement a pointer to incomplete type 'std::array<int, 3>'
 1327 |         --this->_M_impl._M_finish;
      |           ~~~~~~~~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/bits/move.h:37,
                 from /usr/include/c++/14/bits/exception_ptr.h:41,
                 from /usr/include/c++/14/exception:166,
                 from /usr/include/c++/14/ios:41:
/usr/include/c++/14/type_traits: In instantiation of 'struct std::is_destructible<std::array<int, 3> >':
/usr/include/c++/14/bits/stl_construct.h:188:51:   required from 'void std::_Destroy(_ForwardIterator, _ForwardIterator) [with _ForwardIterator = array<int, 3>*]'
  188 |       static_assert(is_destructible<_Value_type>::value,
      |                                                   ^~~~~
/usr/include/c++/14/bits/alloc_traits.h:993:20:   required from 'void std::_Destroy(_ForwardIterator, _ForwardIterator, allocator<_T2>&) [with _ForwardIterator = array<int, 3>*; _Tp = array<int, 3>]'
  993 |       std::_Destroy(__first, __last);
      |       ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:735:15:   required from 'std::vector<_Tp, _Alloc>::~vector() [with _Tp = std::array<int, 3>; _Alloc = std::allocator<std::array<int, 3> >]'
  735 |         std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
      |         ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  736 |                       _M_get_Tp_allocator());
      |                       ~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14