Language: C++

#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))

using P = pair<s64, int>;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    s64 h, w, k;
    cin >> h >> w >> k;

    int si, sj, ti, tj;
    cin >> si >> sj >> ti >> tj;
    --si, --sj, --ti, --tj;
    vector< string > field(h);
    rep (i, h) cin >> field[i];

    const s64 inf = 1e18;
    vs64 d(h * w, inf);
    inline auto id = [&](int i, int j) { return i * w + j; };

    queue<int> q;
    q.push(id(si, sj));
    d[id(si, sj)] = 0;
    int dy[] = {-1, 0, 1, 0};
    int dx[] = {0, -1, 0, 1};
    while (!q.empty())
    {
        int from = q.front(); q.pop();
        int fi = from / w;
        int fj = from % w;
        rep (i, 4)
        {
            rep (j, k)
            {
                s64 ni = fi + dy[i] * (j + 1);
                s64 nj = fj + dx[i] * (j + 1);
                if (!(IN(0, h, ni) && IN(0, w, nj))) break;
                int to = id(ni, nj);
                if (d[to] < d[from] + 1 || field[ni][nj] == '@') break;
                if (d[to] != inf) continue;
                d[to] = d[from] + 1;
                q.push(to);
            }
        }
    }

    s64 ans = d[id(ti, tj)];
    if (ans == inf) cout << "-1\n";
    else cout << ans << "\n";

    return 0;
}



Compiler output:
a.cc:20:9: error: 'uint64_t' does not name a type
   20 | typedef uint64_t u64;
      |         ^~~~~~~~
a.cc:17:1: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
   16 | #include <numeric>
  +++ |+#include <cstdint>
   17 | 
a.cc:22:9: error: 'uint32_t' does not name a type
   22 | typedef uint32_t u32;
      |         ^~~~~~~~
a.cc:22:9: note: 'uint32_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
a.cc:25:16: error: 'u32' was not declared in this scope; did you mean 's32'?
   25 | typedef vector<u32> vu32;
      |                ^~~
      |                s32
a.cc:25:19: error: template argument 1 is invalid
   25 | typedef vector<u32> vu32;
      |                   ^
a.cc:25:19: error: template argument 2 is invalid
a.cc:27:16: error: 'u64' was not declared in this scope; did you mean 's64'?
   27 | typedef vector<u64> vu64;
      |                ^~~
      |                s64
a.cc:27:19: error: template argument 1 is invalid
   27 | typedef vector<u64> vu64;
      |                   ^
a.cc:27:19: error: template argument 2 is invalid
a.cc: In function 'int main()':
a.cc:59:5: error: 'inline' specifier invalid for variable 'id' declared at block scope
   59 |     inline auto id = [&](int i, int j) { return i * w + j; };
      |     ^~~~~~