Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int; //int:2*10**9
typedef long double ld;
#define REP(i,n) for(ll i = 0; i<(ll)(n); i++)
#define REPS(i,n) for (ll i = 1; i<=(ll)(n); i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define vec2(name,i,j) vector<vector<ll>> name(i,vector<ll>(j))
#define vec2f(name,i,j,k) vector<vector<ll>> name(i,vector<ll>(j,k))
#define vec3(name,i,j,k) vector<vector<vector<ll>>> name(i,vector<vector<ll>>(j,vector<ll>(k)))
#define vec3f(name,i,j,k,l) vector<vector<vector<ll>>> name(i,vector<vector<ll>>(j,vector<ll>(k,l)))
#define vec4(name,i,j,k,l) vector<vector<vector<vector<ll>>>> name(i,vector<vector<vector<ll>>>(j,vector<vector<ll>>(k,vector<ll>(l))))
#define vec4f(name,i,j,k,l,m) vector<vector<vector<vector<ll>>>> name(i,vector<vector<vector<ll>>>(j,vector<vector<ll>>(k,vector<ll>(l,m))))
#define pb push_back
#define MOD 1000000007
#define MOD2 998244353
#define PI 3.141592653
#define INF 100000000 //8
#define N 210000

vector<ll> dx={-1,0,1,0};
vector<ll> dy={0,-1,0,1};

int main(){
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    ll h, w, k; cin >> h >> w >> k;
    ll xs, ys, xg, yg; cin >> xs >> ys >> xg >> yg;
    vec2f(pond,h+2,w+2,-1);
    FOR(i,1,h)FOR(j,1,w) pond[i][j]=INF;
    REP(i,h){
        string s; cin >> s;
        REP(j,w) if(s[j]=='@') pond[i+1][j+1]=-1;
    }
    priority_queue<vector<ll>,vector<vector<ll>>,greater<vector<ll>>> q;
    q.push({0,0,-1,xs,ys});
    while(q.size()>0){
        ll l = q.top().at(0);
        ll z = q.top().at(1);
        ll dir = q.top().at(2);
        ll x = q.top().at(3);
        ll y = q.top().at(4);
        /*FOR(i,1,h){
            FOR(j,1,w) cout << pond[i][j] << " ";
            cout << endl;
        }*/
        pond[x][y]=l;
        if (x==xg&&y==yg){
            cout << pond[xg][yg] << endl;
            return 0;
        }
        if (z==k){
            REP(i,4)if (pond[x+dx[i]][y+dy[i]]==INF){
                q.push({l+1,1,i,x+dx[i],y+dy[i]});
            }
        }
        else {
            REP(i,4)if (pond[x+dx[i]][y+dy[i]]==INF){
                if (i==dir){
                    q.push({l,z+1,dir,x+dx[i],y+dy[i]});
                }
                else{
                    q.push({l+1,1,i,x+dx[i],y+dy[i]});
                }
            }
        }
        q.pop();
    }
    cout << -1 << endl;
    return 0;
}


Compiler output:
a.cc:3:19: error: declaration does not declare anything [-fpermissive]
    3 | typedef long long int; //int:2*10**9
      |                   ^~~
a.cc:23:8: error: 'll' was not declared in this scope; did you mean 'ld'?
   23 | vector<ll> dx={-1,0,1,0};
      |        ^~
      |        ld
a.cc:23:10: error: template argument 1 is invalid
   23 | vector<ll> dx={-1,0,1,0};
      |          ^
a.cc:23:10: error: template argument 2 is invalid
a.cc:23:12: error: scalar object 'dx' requires one element in initializer
   23 | vector<ll> dx={-1,0,1,0};
      |            ^~
a.cc:24:8: error: 'll' was not declared in this scope; did you mean 'ld'?
   24 | vector<ll> dy={0,-1,0,1};
      |        ^~
      |        ld
a.cc:24:10: error: template argument 1 is invalid
   24 | vector<ll> dy={0,-1,0,1};
      |          ^
a.cc:24:10: error: template argument 2 is invalid
a.cc:24:12: error: scalar object 'dy' requires one element in initializer
   24 | vector<ll> dy={0,-1,0,1};
      |            ^~
a.cc: In function 'int main()':
a.cc:28:5: error: 'll' was not declared in this scope; did you mean 'ld'?
   28 |     ll h, w, k; cin >> h >> w >> k;
      |     ^~
      |     ld
a.cc:28:24: error: 'h' was not declared in this scope
   28 |     ll h, w, k; cin >> h >> w >> k;
      |                        ^
a.cc:28:29: error: 'w' was not declared in this scope
   28 |     ll h, w, k; cin >> h >> w >> k;
      |                             ^
a.cc:28:34: error: 'k' was not declared in this scope
   28 |     ll h, w, k; cin >> h >> w >> k;
      |                                  ^
a.cc:29:7: error: expected ';' before 'xs'
   29 |     ll xs, ys, xg, yg; cin >> xs >> ys >> xg >> yg;
      |       ^~~
      |       ;
a.cc:29:31: error: 'xs' was not declared in this scope
   29 |     ll xs, ys, xg, yg; cin >> xs >> ys >> xg >> yg;
      |                               ^~
a.cc:29:37: error: 'ys' was not declared in this scope; did you mean 'yn'?
   29 |     ll xs, ys, xg, yg; cin >> xs >> ys >> xg >> yg;
      |                                     ^~
      |                                     yn
a.cc:29:43: error: 'xg' was not declared in this scope
   29 |     ll xs, ys, xg, yg; cin >> xs >> ys >> xg >> yg;
      |                                           ^~
a.cc:29:49: error: 'yg' was not declared in this scope; did you mean 'yn'?
   29 |     ll xs, ys, xg, yg; cin >> xs >> ys >> xg >> yg;
      |                                                 ^~
      |                                                 yn
a.cc:11:41: error: template argument 2 is invalid
   11 | #define vec2f(name,i,j,k) vector<vector<ll>> name(i,vector<ll>(j,k))
      |                                         ^~
a.cc:30:5: note: in expansion of macro 'vec2f'
   30 |     vec2f(pond,h+2,w+2,-1);
      |     ^~~~~
a.cc:11:43: error: template argument 1 is invalid
   11 | #define vec2f(name,i,j,k) vector<vector<ll>> name(i,vector<ll>(j,k))
      |                                           ^~
a.cc:30:5: note: in expansion of macro 'vec2f'
   30 |     vec2f(pond,h+2,w+2,-1);
      |     ^~~~~
a.cc:11:43: error: template argument 2 is invalid
   11 | #define vec2f(name,i,j,k) vector<vector<ll>> name(i,vector<ll>(j,k))
      |                                           ^~
a.cc:30:5: note: in expansion of macro 'vec2f'
   30 |     vec2f(pond,h+2,w+2,-1);
      |     ^~~~~
a.cc:11:62: error: template argument 2 is invalid
   11 | #define vec2f(name,i,j,k) vector<vector<ll>> name(i,vector<ll>(j,k))
      |                                                              ^
a.cc:30:5: note: in expansion of macro 'vec2f'
   30 |     vec2f(pond,h+2,w+2,-1);
      |     ^~~~~
a.cc:11:68: error: expression list treated as compound expression in initializer [-fpermissive]
   11 | #define vec2f(name,i,j,k) vector<vector<ll>> name(i,vector<ll>(j,k))
      |                                                                    ^
a.cc:30:5: note: in expansion of macro 'vec2f'
   30 |     vec2f(pond,h+2,w+2,-1);
      |     ^~~~~
a.cc:31:9: error: expected ';' before 'i'
   31 |     FOR(i,1,h)FOR(j,1,w) pond[i][j]=INF;
      |         ^
a.cc:8:27: note: in definition of macro 'FOR'
    8 | #define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
      |                           ^
a.cc:31:9: error: 'i' was not declared in this scope
   31 |     FOR(i,1,h)FOR(j,1,w) pond[i][j]=INF;
      |         ^
a.cc:8:33: note: in definition of macro 'FOR'
    8 | #define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
      |                                 ^
a.cc:31:19: error: expected ';' before 'j'
   31 |     FOR(i,1,h)FOR(j,1,w) pond[i][j]=INF;
      |                   ^
a.cc:8:27: note: in definition of macro 'FOR'
    8 | #define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
      |                           ^
a.cc:31:19: error: 'j' was not declared in this scope; did you mean 'jn'?
   31 |     FOR(i,1,h)FOR(j,1,w) pond[i][j]=INF;
      |                   ^
a.cc:8:33: note: in definition of macro 'FOR'
    8 | #define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
      |                                 ^
a.cc:32:9: error: expected ';' before 'i'
   32 |     REP(i,h){
      |         ^
a.cc:5:25: note: in definition of macro 'REP'
    5 | #define REP(i,n) for(ll i = 0; i<(ll)(n); i++)
      |                         ^
a.cc:32:9: error: 'i' was not declared in this scope
   32 |     REP(i,h){
      |         ^
a.cc:5:32: note: in definition of macro 'REP'
    5 | #define REP(i,n) for(ll i = 0; i<(ll)(n); i++)
      |                                ^
a.cc:34:13: error: expected ';' before 'j'
   34 |         REP(j,w) if(s[j]=='@') pond[i+1][j+1]=-1;
      |             ^
a.cc:5:25: note: in definition of macro 'REP'
    5 | #define REP(i,n) for(ll i = 0; i<(ll)(n); i++)
      |                         ^
a.cc:34:13: error: 'j' was not declared in this scope
   34 |         REP(j,w) if(s[j]=='@') pond[i+1][j+1]=-1;
      |             ^
a.cc:5:32: note: in definition of macro 'REP'
    5 | #define REP(i,n) for(ll i = 0; i<(ll)(n); i++)
      |                                ^
a.cc:36:29: error: template argument 2 is invalid
   36 |     priority_queue<vector<ll>,vector<vector<ll>>,greater<vector<ll>>> q;
      |                             ^
a.cc:36:45: error: template argument 2 is invalid
   36 |     priority_queue<vector<ll>,vector<vector<ll>>,greater<vector<ll>>> q;
      |                                             ^~
a.cc:36:47: error: template argument 1 is invalid
   36 |     priority_queue<vector<ll>,vector<vector<ll>>,greater<vector<ll>>> q;
      |                                               ^~
a.cc:36:47: error: template argument 2 is invalid
a.cc:36:65: error: template argument 2 is invalid
   36 |     priority_queue<vector<ll>,vector<vector<ll>>,greater<vector<ll>>> q;
      |                                                                 ^~
a.cc:36:67: error: template argument 1 is invalid
   36 |     priority_queue<vector<ll>,vector<vector<ll>>,greater<vector<ll>>> q;
      |                                                                   ^~
a.cc:36:69: error: template argument 1 is invalid
   36 |     priority_queue<vector<ll>,vector<vector<ll>>,greater<vector<ll>>> q;
      |                                                                     ^
a.cc:36:69: error: template argument 2 is invalid
a.cc:36:69: error: template argument 3 is invalid
a.cc:37:7: error: request for member 'push' in 'q', which is of non-class type 'int'
   37 |     q.push({0,0,-1,xs,ys});
      |       ^~~~
a.cc:38:13: error: request for member 'size' in 'q', which is of non-class type 'int'
   38 |     while(q.size()>0){
      |             ^~~~
a.cc:39:11: error: expected ';' before 'l'
   39 |         ll l = q.top().at(0);
      |           ^~
      |           ;
a.cc:40:11: error: expected ';' before 'z'
   40 |         ll z = q.top().at(1);
      |           ^~
      |           ;
a.cc:41:11: error: expected ';' before 'dir'
   41 |         ll dir = q.top().at(2);
      |           ^~~~
      |           ;
a.cc:42:11: error: expected ';' before 'x'
   42 |         ll x = q.top().at(3);
      |           ^~
      |           ;
a.cc:43:11: error: expected ';' before 'y'
   43 |         ll y = q.top().at(4);
      |           ^~
      |           ;
a.cc:48:14: error: 'x' was not declared in this scope
   48 |         pond[x][y]=l;
      |              ^
a.cc:48:17: error: 'y' was not declared in this scope
   48 |         pond[x][y]=l;
      |                 ^
a.cc:48:20: error: 'l' was not declared in this scope
   48 |         pond[x][y]=l;
      |                    ^
a.cc:53:13: error: 'z' was not declared in this scope
   53 |         if (z==k){
      |             ^
a.cc:54:17: error: expected ';' before 'i'
   54 |             REP(i,4)if (pond[x+dx[i]][y+dy[i]]==INF){
      |                 ^
a.cc:5:25: note: in definition of macro 'REP'
    5 | #define REP(i,n) for(ll i = 0; i<(ll)(n); i++)
      |                         ^
a.cc:54:17: error: 'i' was not declared in this scope
   54 |             REP(i,4)if (pond[x+dx[i]][y+dy[i]]==INF){
      |                 ^
a.cc:5:32: note: in definition of macro 'REP'
    5 | #define REP(i,n) for(ll i = 0; i<(ll)(n); i++)
      |                                ^
a.cc:55:19: error: request for member 'push' in 'q', which is of non-class type 'int'
   55 |                 q.push({l+1,1,i,x+dx[i],y+dy[i]});
      |                   ^~~~
a.cc:59:17: error: expected ';' before 'i'
   59 |             REP(i,4)if (pond[x+dx[i]][y+dy[i]]==INF){
      |                 ^
a.cc:5:25: note: in definition of macro 'REP'
    5 | #define REP(i,n) for(ll i = 0; i<(ll)(n); i++)
      |                         ^
a.cc:59:17: error: 'i' was not declared in this scope
   59 |             REP(i,4)if (pond[x+dx[i]][y+dy[i]]==INF){
      |                 ^
a.cc:5:32: note: in definition of macro 'REP'
    5 | #define REP(i,n) for(ll i = 0; i<(ll)(n); i++)
      |                                ^
a.cc:60:24: error: 'dir' was not declared in this scope; did you mean 'div'?
   60 |                 if (i==dir){
      |                        ^~~
      |                        div
a.cc:61:23: error: request for member 'push' in 'q', which is of non-class typ