Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < n; i++)
static const long long INF = 1000000;
using p = pair<int64_t,int64_t>;
struct trio{
    int xvalue;
    int yvalue;
    int64_t score;
};

//引数として２つのpをとって移動の可否、更には魔法の有無を調べる
int cost(p p1, p p2,vector<vector<char>> & road){
    if (p1 == p2){
        return -100;
    }
    else if (road[p1.first][p1.second] == '#' or road[p2.first][p2.second] == '#'){
        return -100;
    }
    else if (p1.first == p2.first and abs(p1.second - p2.second) < 2){
        return 0;
    }
    else if (p1.second == p2.second and abs(p1.first - p2.first) < 2){
        return 0;
    }
    else if (abs(p1.first - p2.first) < 3 and abs(p1.second - p2.second) < 3){
        return 1;
    }
    else{
        return -100;
    }
}
bool c = [](trio x, trio y){
    if (x.score < y.score){
        return false;
    }
    else if(x.score > y.score){
        return true;
    }
    else if (x.xvalue > y.xvalue){
        return true;
    }
    else if (x.xvalue < y.xvalue){
        return false;
    }
    else if (x.yvalue > y.yvalue){
        return true;
    }
    else {
        return false;
    }
    return false;
};

//ダイクストラのアルゴリズム
int dijkstra(int h,int w,int xs,int ys,int xg, int yg,vector<vector<char>> & road){
    int64_t min = INF;
    //優先度付きキューで高速化してみる
    vector<vector<int>> color(h,vector<int>(w,0));
    vector<vector<int64_t>> d(h,vector<int64_t>(w,INF));
    priority_queue <trio,decltype(c)> pq(c);
    trio f = {xs,ys,0};
    pq.push(f);
    color[xs][ys] = 1;

    
    p u;
    //キューが空欄でない限りtrio.scoreが一番小さい座標を取り出してその隣接点の情報を更新する
        while(!pq.empty()){
            trio tt = pq.top();
            pq.pop();
            if (color[tt.xvalue][tt.yvalue] == 0){
                color[tt.xvalue][tt.yvalue] = 1;
                u = {tt.xvalue, tt.yvalue};
                rep(i,h){    
                    rep(j,w){
                        p pp = {i,j};
                        if (cost(u,pp,road) != -100 and d[i][j] > tt.score + cost(u,pp,road)){
                            d[i][j] = tt.score + cost(u,pp,road);
                            trio ss = {i,j,d[i][j]};
                            pq.push(ss);
                        }
                    }
                }
            }
            else {
                continue;
            }
        }
    //キューが空欄ならループを終えてゴールの値を返す
        if(d[xg][yg] == INF){
            return -1;
        }
        else {
            return d[xg][yg];
        }
        
    
    return 0;
}


int main(){
    int h,w,xs,ys,xg,yg;
    cin >> h >> w >> xs >> ys >> xg >> yg;
    vector<vector<char>> road (h,vector<char>(w));
    rep(i,h){
        rep(j,w){
            cin >> road[i][j];
        }
    }
    int k = dijkstra(h,w,xs-1,ys-1,xg-1,yg-1,road);
    cout << k << endl;
    
}


Compiler output:
a.cc: In function 'int dijkstra(int, int, int, int, int, int, std::vector<std::vector<char> >&)':
a.cc:61:37: error: 'bool' is not a class, struct, or union type
   61 |     priority_queue <trio,decltype(c)> pq(c);
      |                                     ^
a.cc:61:37: error: template argument 3 is invalid
a.cc:63:8: error: request for member 'push' in 'pq', which is of non-class type 'int'
   63 |     pq.push(f);
      |        ^~~~
a.cc:69:19: error: request for member 'empty' in 'pq', which is of non-class type 'int'
   69 |         while(!pq.empty()){
      |                   ^~~~~
a.cc:70:26: error: request for member 'top' in 'pq', which is of non-class type 'int'
   70 |             trio tt = pq.top();
      |                          ^~~
a.cc:71:16: error: request for member 'pop' in 'pq', which is of non-class type 'int'
   71 |             pq.pop();
      |                ^~~
a.cc:81:32: error: request for member 'push' in 'pq', which is of non-class type 'int'
   81 |                             pq.push(ss);
      |                                ^~~~