Language: C++

#include<iostream>
#include<vector>
#include<queue>
#include<climits>
#include<cmath>

typedef std::pair<int,int> index;
typedef std::pair<index,char> indexWithDirect;
typedef std::pair<indexWithDirect,double> priorityNode;

class grid{
public:
    bool isBarier;              // lotus or not
    bool isSearched;            // once searched or not
    long double cost[4];
    grid(){
        isBarier=0;
        isSearched=0;
        for(int i=0;i<4;++i){
            cost[i]=INT_MAX;
        }
    }
};

enum DIRECT{
    EAST,
    WEST,
    SOUTH,
    NORTH,
    NUM_DIRECT,
};

index moveV(index pos,int direct,int distance){
    index movedPos=pos;
    switch (direct){
    case EAST:
        movedPos.second+=distance;
        break;
    case WEST:
        movedPos.second-=distance;
        break;
    case SOUTH:
        movedPos.first+=distance;
        break;
    case NORTH:
        movedPos.first-=distance;
        break;
    default:
        break;
    }
    return movedPos;
}

bool isEnableMove(index movedPos,std::vector<std::vector<grid> > pond){
    if(movedPos.first>=0 && movedPos.second>=0){
        if(movedPos.first<pond.size() && movedPos.second<pond[0].size()){
            if(pond[movedPos.first][movedPos.second].isBarier==0){
                return 1;
            }
        }
    }
    return 0;
}
/*



*/

double calcCost(double preCost,char movingDirect,char movedDirect,int distance,int K){
    double cost=preCost+distance/(double)K;
    if(movingDirect!=movedDirect){
        cost=ceil(cost);
    }
    return cost;
}

void print(index id,char end='\n'){
    std::cout<<"("<<id.first<<","<<id.second<<")"<<end;
}

void print(indexWithDirect iwd,char end='\n'){
    print(iwd.first,' ');
    std::cout<<"direct:"<<iwd.second<<end;
}

void print(priorityNode n,char end='\n'){
    print(n.first,' ');
    std::cout<<"cost:"<<n.second<<end;
}

void print(std::vector<std::vector<grid> >pond){
    for(auto r:pond){
        for(auto g:r){
            double cost=g.cost[0];
            for(int i=1;i<4;++i)
                if(cost>g.cost[i])
                    cost=g.cost[i];
            std::cout<<cost<<"("<<g.isBarier<<")\t";
        }
        std::cout<<std::endl;
    }
}

void dijkstra(){
    int H,W,K;
    std::cin>>H>>W>>K;
    index start,goal;
    std::vector<std::vector<grid>> pond(H,std::vector<grid>(W));
    auto compare=[](priorityNode l,priorityNode r){return l.second>r.second;};
    std::priority_queue<priorityNode,std::vector<priorityNode>,decltype(compare)> q{compare};
    std::cin>>start.first>>start.second;
    std::cin>>goal.first>>goal.second;

    start.first-=1;
    start.second-=1;
    goal.first-=1;
    goal.second-=1;

    for(int i=0;i<H;++i){
        for(int j=0;j<W;++j){
            char buf;
            std::cin>>buf;
            grid& p=pond[i][j];
            if (buf=='.'){
                p.isBarier=0;
                if(start.first==i && start.second==j){
                    for(int direct=0;direct<NUM_DIRECT;++direct){
                        q.push(priorityNode(indexWithDirect(index(i,j),(char)direct),0));
                        p.cost[direct]=0;
                    }
                }
            }else{
                p.isBarier=1;
                p.isSearched=1;
            }
        }
    }

    while(!q.empty()){
        priorityNode    node=q.top();
        indexWithDirect iwd=node.first;
        index           id=iwd.first;
        char            direct=iwd.second;
        double          cost=node.second;
        auto&           minCost=pond[id.first][id.second].cost[direct];
        double          goalCost=pond[goal.first][goal.second].cost[direct]
        q.pop();
        // print(node);
        if(minCost<cost){
            continue;
        }
        if(goalCost<cost){
            continue;
        }
        minCost=cost;

        for(int j=1;j<=K;++j){
            auto calcIndex=moveV(id,direct,j);
            if(isEnableMove(calcIndex,pond)==1){
                auto& calcGrid=pond[calcIndex.first][calcIndex.second];
                auto& calcGridCost=calcGrid.cost;
                for(char k=0;k<NUM_DIRECT;++k){
                    double movedCost=calcCost(cost,direct,k,j,K);
                    if(calcGridCost[k]>movedCost){
                        calcGridCost[k]=movedCost;
                        q.push(priorityNode(indexWithDirect(calcIndex,k),movedCost));
                        calcGrid.isSearched=1;
                    }
                }
            }
            else{
                break;
            }
        }
    }
    grid goalGrid=pond[goal.first][goal.second];
    if(goalGrid.isSearched==0){
        std::cout<<-1<<std::endl;
    }else{
        double ans=goalGrid.cost[0];
        for(int i=0;i<NUM_DIRECT;++i){
            if(ans>goalGrid.cost[i]){
                ans=goalGrid.cost[i];
            }
        }
        std::cout<<(int)(ceil(ans))<<std::endl;
    }
    // print(pond);
}

int main(){
    dijkstra();
    return 0;
}

Compiler output:
a.cc: In function 'void dijkstra()':
a.cc:148:9: error: expected ',' or ';' before 'q'
  148 |         q.pop();
      |         ^