criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include<bits/stdc++.h>
#define ll long long int
#define loop(i,a,b) for(i=a;i<b;i++)
#define INF 10000000000
#define pb push_back
#define lim 100001

using namespace std;
ll n,m,k;
char s[lim][lim];
ll dist[lim][lim];
bool ok(ll r,ll c)
{
	return (r>=0 && c>=0 && r<n && c<m && s[r][c]=='.');
}
void bfs(ll x,ll y)
{
    ll i;
	ll row[4]={0,0,1,-1};
	ll col[4]={1,-1,0,0};
	queue<pair<ll,ll> > q;
	q.push({x,y});
	dist[x][y]=0;
	while(!q.empty())
	{
		pair<ll,ll> el=q.front();
		q.pop();

		loop(i,0,4)
		{
			ll r=el.first+row[i],c=el.second+col[i],cnt=k;
			while(ok(r,c) && dist[r][c]>=INF && cnt--)
			{
				dist[r][c]=dist[el.first][el.second]+1;
				q.push({r,c});

				r+=row[i]; c+=col[i];
			}

		}

	}
}

int main()
{ll i,j;
	cin>>n>>m>>k;
    ll x[2],y[2];
    loop(i,0,n+1)
    loop(j,0,m+1)
    dist[i][j]=INF;
	cin>>x[0]>>y[0]>>x[1]>>y[1];
    loop(i,0,2){ x[i]--; y[i]--;}
	loop(i,0,n)
      cin>>s[i];
      //cout<<123<<endl;
      bfs(x[0],y[0]);
     if(dist[x[1]][y[1]]<INF)
     	cout<<dist[x[1]][y[1]]<<endl;
     else
     	cout<<-1<<endl;
     return 0;}

Compiler output:
/tmp/ccY759AN.o: in function `bfs(long long, long long)':
a.cc:(.text+0x124): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccY759AN.o
a.cc:(.text+0x1dc): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccY759AN.o
a.cc:(.text+0x20b): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccY759AN.o
a.cc:(.text+0x2ba): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccY759AN.o
/tmp/ccY759AN.o: in function `main':
a.cc:(.text+0x3d0): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccY759AN.o
a.cc:(.text+0x50f): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccY759AN.o
a.cc:(.text+0x543): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccY759AN.o
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
#define ll long long int
#define loop(i,a,b) for(i=a;i<b;i++)
#define INF 10000000000
#define pb push_back
#define lim 1000001

using namespace std;
ll n,m,k;
char s[lim][lim];
ll dist[lim][lim];
bool ok(ll r,ll c)
{
	return (r>=0 && c>=0 && r<n && c<m && s[r][c]=='.');
}
void bfs(ll x,ll y)
{
    ll i;
	ll row[4]={0,0,1,-1};
	ll col[4]={1,-1,0,0};
	queue<pair<ll,ll> > q;
	q.push({x,y});
	dist[x][y]=0;
	while(!q.empty())
	{
		pair<ll,ll> el=q.front();
		q.pop();

		loop(i,0,4)
		{
			ll r=el.first+row[i],c=el.second+col[i],cnt=k;
			while(ok(r,c) && dist[r][c]>=INF && cnt--)
			{
				dist[r][c]=dist[el.first][el.second]+1;
				q.push({r,c});

				r+=row[i]; c+=col[i];
			}

		}

	}
}

int main()
{ll i,j;
	cin>>n>>m>>k;
    ll x[2],y[2];
    loop(i,0,n+1)
    loop(j,0,m+1)
    dist[i][j]=INF;
	cin>>x[0]>>y[0]>>x[1]>>y[1];
    loop(i,0,2){ x[i]--; y[i]--;}
	loop(i,0,n)
      cin>>s[i];
      //cout<<123<<endl;
      bfs(x[0],y[0]);
     if(dist[x[1]][y[1]]<INF)
     	cout<<dist[x[1]][y[1]]<<endl;
     else
     	cout<<-1<<endl;
     return 0;}

Compiler output:
/tmp/cccctcq6.o: in function `bfs(long long, long long)':
a.cc:(.text+0x124): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cccctcq6.o
a.cc:(.text+0x1dc): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cccctcq6.o
a.cc:(.text+0x20b): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cccctcq6.o
a.cc:(.text+0x2ba): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cccctcq6.o
/tmp/cccctcq6.o: in function `main':
a.cc:(.text+0x3d0): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cccctcq6.o
a.cc:(.text+0x50f): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cccctcq6.o
a.cc:(.text+0x543): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cccctcq6.o
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <string>
#include <queue>
#include <tuple>

using namespace std;

using PII = pair<int, int>;
using TUP = tuple<int, int, int>;

const int inf = 1e9;

void show(vector<vector<int>> &vv) {
	printf("-------\n");
	for (auto v: vv) {
		for (auto x: v) {
			if (x == inf) {
				// printf(" inf");
				printf(" --");
			} else {
				printf(" %2d", x);
			}
		}
		printf("\n");
	}
}

void show(vector<vector<int>> &vv, int r1, int r2, int c1, int c2) {
	printf("-------\n");
	assert(0 <= r1 && r1 < r2 && r2 < vv.size());
	assert(0 <= c1 && c1 < c2 && c2 < vv[0].size());
	for (int i = r1; i <= r2; i++) {
		for (int j = c1; j <= c2; j++) {
			if (vv[i][j] == inf) {
				// printf(" inf");
				printf(" --");
			} else {
				// printf(" %3d", vv[i][j]);
				printf(" %2d", vv[i][j]);
			}
		}
		printf("\n");
	}
}

int main() {
	int h, w, k;
	int sx, sy, gx, gy;
	cin >> h >> w >> k;
	cin >> sx >> sy >> gx >> gy;
	sx--;
	sy--;
	gx--;
	gy--;

	vector<string> grid(h);
	for (int i = 0; i < h; i++) {
		cin >> grid[i];
	}

	grid[sx][sy] = 'S';
	grid[gx][gy] = 'G';

	vector<vector<int>> dist(h, vector<int>(w, inf));

	priority_queue<TUP, vector<TUP>, greater<TUP>> que;  // walk, row, col
	que.emplace(0, sx, sy);

	int walk, r, c;
	auto push = [&](int walk, int row, int col) {
		if (row < 0 || h <= row || col < 0 || w <= col) {
			return false;
		}
		if (grid[row][col] == '@' || walk >= dist[row][col]) {
			return false;
		}
		que.emplace(walk, row, col);
		return true;
	};

	while (!que.empty()) {
		tie(walk, r, c) = que.top();
		que.pop();

		if (walk >= dist[r][c]) {
			continue;
		}
		dist[r][c] = walk;
		if (grid[r][c] == 'G') {
			break;
		}

		for (int i = 1; i <= k; i++) {
			auto to_next = push(walk + 1, r + i, c);
			if (!to_next) { break; }
		}
		for (int i = 1; i <= k; i++) {
			auto to_next = push(walk + 1, r - i, c);
			if (!to_next) { break; }
		}

		for (int i = 1; i <= k; i++) {
			auto to_next = push(walk + 1, r, c + i);
			if (!to_next) { break; }
		}
		for (int i = 1; i <= k; i++) {
			auto to_next = push(walk + 1, r, c - i);
			if (!to_next) { break; }
		}
	}

	int ans = dist[gx][gy] == inf ? -1 : dist[gx][gy];
	cout << ans << endl;
	// show(dist);
	return 0;
}


Compiler output:
a.cc: In function 'void show(std::vector<std::vector<int> >&, int, int, int, int)':
a.cc:35:9: error: 'assert' was not declared in this scope
   35 |         assert(0 <= r1 && r1 < r2 && r2 < vv.size());
      |         ^~~~~~
a.cc:9:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
    8 | #include <queue>
  +++ |+#include <cassert>
    9 | #include <tuple>
Language: C++

//	ZapZu's code hohoho
//	#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;a
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define dfs_black 1
#define dfs_white -1
#define pr pair
#define vt vector
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef double db;
typedef long long li;
typedef long double ld;

typedef pr<int, int> ii;
typedef pr<ld,ld> dd;

typedef vt<int> vi;
typedef vt<li> vli;
typedef vt<ld> vld;
typedef vt<ii> vii;

typedef map<int, int> mii;
typedef map<int, bool> mib;
typedef map<int, char> mic;

typedef set<int> s_i;
typedef set<char> s_c;

const int MOD = 1e9+7;
const li INF = 1e18;
const ld PI = 4*atan((ld)1);
int dx[]={1, 0, -1, 0};
int dy[]={0,1, 0,-1};

signed main()
{
//	freopen(".inp", "r", stdin);
//	freopen(".out", "w", stdout);
	fastio;
	int n,m,k;
	cin>>n>>m>>k;
	int d[n+5][m+5];
	int x1, x2, y1,y2;
	cin>>x1>>y1>>x2>>y2;
	for(int i=1; i<=n; i++)
	{
		for(int j=1; j<=m; j++)
		{
			char c;
			cin>>c;
			if(c=='.') d[i][j]=INT_MAX;
			else d[i][j]=-1;
		}
	}
	d[x1][y1]=0;
	queue<pr<int, ii> > q;
	q.push({0, {x1, y1}});
	while(!q.empty())
	{
		int xu=q.front().se.fi, yu=q.front().se.se,dist=q.front().fi;
		q.pop();
		if(dist>d[xu][yu]) continue;
		for(int i=0; i<4; i++)
		{
			for(int j=1; j<=k; j++)
			{
				int xv=xu+dx[i]*j, yv=yu+dy[i]*j;
				if(1<=xv and xv<=n and 1<=yv and yv<=m and d[xv][yv]!=-1 and d[xv][yv]>=d[xu][yu]+1)
				{
					d[xv][yv]=d[xu][yu]+1;
					q.push({d[xv][yv], {xv, yv}});
				}
				else break;
			}
		}
	}
	if(-1<d[x2][y2] and d[x2][y2]<INT_MAX) cout<<d[x2][y2];
	else cout<<-1;
}




Compiler output:
a.cc:4:21: error: 'a' does not name a type
    4 | using namespace std;a
      |                     ^
Language: C++

#include <bits/stdc++.h>
#define int long long

using namespace std;
using ll = long long;

const int N = (int)1e6;

vector <char> a[N];

main() {
  ios :: sync_with_stdio(0);
  cin.tie(0);
  int h, w, k;
  cin >> h >> w >> k;
  int x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  for (int i = 1; i <= h;8 ++i) {
    a[i].push_back(0);
    for (int j = 1; j <= w; ++j) {
      char x;
      cin >> x;
      a[i].push_back(x);
    }
  } 
  queue <pair <int, int> > q;
  q.push({x1, y1});
  map <pair <int, int>, int> used, d;
  used[{x1, y1}] = 1;
  d[{x2, y2}] = -1;
  while (!q.empty()) {
    auto v = q.front();
    q.pop();
    for (int i = 1; i <= k; ++i) {
      if (v.first + i > h) break;
      if (v.first + i <= h && a[v.first + i][v.second] == '@') {
        break;
      }
      if (v.first + i <= h && a[v.first + i][v.second] != '@' && !used[{v.first + i, v.second}]) {
        used[{v.first + i, v.second}] = 1;
        d[{v.first + i, v.second}] = d[{v.first, v.second}] + 1; 
        q.push({v.first + i, v.second});
      }
    }
    for (int i = 1; i <= k; ++i) {
      if (v.first - i < 1) break;
      if (a[v.first - i][v.second] == '@') {
        break;
      }
      if (!used[{v.first - i, v.second}]) {
        used[{v.first - i, v.second}] = 1;
        d[{v.first - i, v.second}] = d[{v.first, v.second}] + 1; 
        q.push({v.first - i, v.second});
      }
    }
    for (int i = 1; i <= k; ++i) {
      if (v.second + i > w) break;
      if (a[v.first][v.second + i] == '@') {
        break;
      }
      if (!used[{v.first, v.second + i}]) {
        used[{v.first, v.second + i}] = 1;
        d[{v.first, v.second + i}] = d[{v.first, v.second}] + 1; 
        q.push({v.first, v.second + i});
      }
    }
    for (int i = 1; i <= k; ++i) {
      if (v.second - i < 1) break;
      if (a[v.first][v.second - i] == '@') {
        break;
      }
      if (!used[{v.first, v.second - i}]) {
        used[{v.first, v.second - i}] = 1;
        d[{v.first, v.second - i}] = d[{v.first, v.second}] + 1; 
        q.push({v.first, v.second - i});
      }
    }
    
  }
  cout << d[{x2, y2}];
  return 0;
}

Compiler output:
a.cc:11:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   11 | main() {
      | ^~~~
a.cc: In function 'int main()':
a.cc:18:26: error: lvalue required as increment operand
   18 |   for (int i = 1; i <= h;8 ++i) {
      |                          ^
a.cc:18:30: error: expected ')' before 'i'
   18 |   for (int i = 1; i <= h;8 ++i) {
      |       ~                      ^
      |                              )
a.cc:18:31: error: expected ';' before ')' token
   18 |   for (int i = 1; i <= h;8 ++i) {
      |                               ^
      |                               ;
Language: C++

#include<bits/stdc++.h>
using namespace std;

int main()
{
int n,m,k;
cin>>n>>m>>k;
int sx,sy,dx,dy;
cin>>sx>>sy>>dx>>dy;

vector<vector<char>> arr(n,vector<char>(m,'.'));
for(int i=0;i<n;i++)
{
    for(int j=0;j<m;j++)
    {
        cin>>arr[i][j];
    }
}

vector<int> dirx={1,0,-1,0};
vector<int> diry={0,-1,0,1};
vector<vector<int>> dist(n,vector<int>(m,INT_MAX));
vector<vector<bool>> vis(n,vector<bool>(m,INT_MAX));

queue<pair<int,int>> q;
q.push({sx,sy});
vis[sx][sy]=true;
dist[sx][sy]=0;
while(!q.empty())
{
    int x = q.front().first;
    int y=  q.front().second;
    q.pop();
    for(int p=0;p<4;p++)
    {
        for(int t=1;t<=k;t++)
        {
        
        int nx =  x + t*dirx[p];
        int ny  =  y + t*diry[p];
        if(nx>=0&&ny>=0&&nx<n&&ny<m&&arr[nx][ny]=='.'&&vis[nx][ny]==false)
        {
            dist[nx][ny]= dp[x][y]+1;
            vis[nx][ny]=true;
            q.push({nx,ny});
            
        }
        }
        
    }
    
}    
 if(dist[dx][dy]==INT_MAX)
 cout<<-1<<endl;
 else
 cout<<dist[dx][dy]<<endl;
    
    
}




Compiler output:
a.cc: In function 'int main()':
a.cc:43:27: error: 'dp' was not declared in this scope; did you mean 'p'?
   43 |             dist[nx][ny]= dp[x][y]+1;
      |                           ^~
      |                           p
Language: C++

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

int main() {
    int h, w, k;
    cin >> h >> w >> k;

    pair<int, int> s, g;
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    x1--; y1--; x2--; y2--;
    s = make_pair(x1, y1);
    g = make_pair(x2, y2);

    vector<string> pond(h);
    for (int i = 0; i < h; i++) cin >> pond[i];

    queue<pair<int, int>> que;
    que.push({s.first, s.second});

    vector<vector<ll>> dist(h, vector<ll> (w, 1e+18));
    dist[s.first][s.second] = 0;

    vector<int> addx = {-1, 0, 1, 0};
    vector<int> addy = {0, 1, 0, -1};

    while (!que.empty()) {
        int x = que.front().first;
        int y = que.front().second;
        que.pop();
        
        for (int i = 0; i < 4; i++) {
            int newx = x;
            int newy = y;
            for (int j = 0; j < k; j++) {
                newx += addx[i];
                newy += addy[i];
                if (newx < 0 || h <= newx || newy < 0 || w <= newy) break;
                if (pond[newx][newy] == '@') break;
                if (dist[newx][newy] != 1e+18) break;

                ll d = dist[x][y] + 1;
                if (dist[newx][newy] =< d) break;

                dist[newx][newy] = d;
                que.push({newx, newy});
            }
        }
    }

    if (dist[g.first][g.second] == 1e+18) cout << -1 << endl;
    else cout << dist[g.first][g.second] << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:39: error: expected primary-expression before '<' token
   46 |                 if (dist[newx][newy] =< d) break;
      |                                       ^
Language: C++

3 3 1
2 1 2 3
.@.
.@.
.@.

Compiler output:
a.cc:3:2: error: stray '@' in program
    3 | .@.
      |  ^
a.cc:4:2: error: stray '@' in program
    4 | .@.
      |  ^
a.cc:5:2: error: stray '@' in program
    5 | .@.
      |  ^
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 3 3 1
      | ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<n;i++)
#define Rep(i,a,b) for(ll i=a;i<b;i++)
#define pb emplace_back
#define allv v.begin(),v.end()
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
#define FASTio ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define deb(x) cout<<(#x)<<" "<<x<<endl
ll mod=1e9+7;
template<typename t>
ll Max(ll a,ll b)
{
    return (a>b)?a:b;
    
}
ll Min(ll a,ll b)
{
    return (a>b)?b:a;
}
ll power(ll a,ll b)
{
    ll p=1;
    a=a%mod;
    b=b%mod;
    while(b)
    {
        if(b&1)
        {
            p=((p%mod)*(a%mod))%mod;
        }
        a=((a%mod)*(a%mod))%mod;
        b=(b/2);
    }
    return p%mod;
}
ll h,w,k;
bool isValid(ll i,ll j)
{
    return (i>=1 && i<=h && j>=1 && j<=w);
}
ll direc[4][2]={{1,0},{-1,0},{0,1},{0,-1}};
int main()
{
    int t;
    t=1;
  //  cin>>t;
    while(t--)
    {
      //  ll h,w,k;
      cin>>h>>w>>k;
        ll x1,y1,x2,y2;
        cin>>x1>>y1>>x2>>y2;
        char mat[h+1][w+1];
        Rep(i,1,h+1)
        {
            Rep(j,1,w+1)
            cin>>mat[i][j];
        }
        ll dist[h+1][w+1];
        bool visited[h+1][w+1]={false};
        memset(dist,INT_MAX,sizeof(dist));
        dist[x1][y1]=0;
        visited[x1][y1]=true;
        queue<pair<ll,ll>> q;
        q.push(make_pair(x1,y1));
        while(!q.empty())
        {
            pair<ll,ll> curr=q.front();
            q.pop();
            ll i=curr.first;
            ll j=curr.second;
          cout<<i<<" "<<j<<endl;
            for(ll p=0;p<4;p++)
            {
              for(ll q=1;q<=k;q++)
              {
                ll i1=(i+direc[p][0]*q);
                ll j1=(j+direc[p][1]*q);
                if(isValid(i1,j1) && mat[i1][j1]!='@' && !visited[i1][j1] )
                {
                    if(dist[i1][j1]>(dist[i][j]+1))
                    {
                        dist[i1][j1]=dist[i][j]+1;
                        visited[i1][j1]=true;
                        q.push(make_pair(i1,j1));
                    }
                    

                }
                else
                break;
              }
            }
            
        }
        cout<<dist[x2][y2]<<endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:88:27: error: request for member 'push' in 'q', which is of non-class type 'll' {aka 'long long int'}
   88 |                         q.push(make_pair(i1,j1));
      |                           ^~~~
Language: Java

import java.util.*;
import java.io.*;
public class F {
	static int[][] dp;
	static int h;
	static int w;
	static int k;
	public static void main(String[] args) throws Exception{
		int num = 998244353;
 
		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
 		StringTokenizer st = new StringTokenizer(bf.readLine());
 		h = Integer.parseInt(st.nextToken());
 		w = Integer.parseInt(st.nextToken());
 		k = Integer.parseInt(st.nextToken());
 		StringTokenizer coords = new StringTokenizer(bf.readLine());
 		int x1 = Integer.parseInt(coords.nextToken());
 		int y1 = Integer.parseInt(coords.nextToken());
 		int x2 = Integer.parseInt(coords.nextToken());
 		int y2 = Integer.parseInt(coords.nextToken());
 		char[][] c = new char[h+1][w+1];
 		dp = new int[h+1][w+1];
 		for(int i = 1;i<=h;i++){
 			String line = bf.readLine().trim();
 			for(int j = 1;j<=w;j++){
 				c[i][j] = line.charAt(j-1);
 			}
 		}
 		// EVERYTHING IS INFLATED BY ONE
 		dp[x1][y1] = 1;
 		
 		Queue<Integer> bfs = new ArrayDeque<Integer>();
 		ArrayList<Integer> first = new ArrayList<Integer>();
 		bfs.add((x1-1)*w+(y1-1));
 		while(!bfs.isEmpty()){
 			int p = bfs.remove();
 			int tx = p/w+1;
 			int ty = p%w+1;
 			for(int i = tx+1;i<=Math.min(tx+k,h);i++){
 				if (c[i][ty] == '@')
 					break;
 				if (dp[i][ty] != 0)
 					continue;
 				dp[i][ty] = dp[tx][ty]+1;
 				bfs.add((i-1)*w+(ty-1));
 			}
 			
 			for(int i = tx-1;i>=Math.max(tx-k,1);i--){
 				if (c[i][ty] == '@')
 					break;
 				if (dp[i][ty] != 0)
 					continue;
 				dp[i][ty] = dp[tx][ty]+1;
 				bfs.add((i-1)*w+(ty-1));

 			}
 			
 			for(int i = ty+1;i<=Math.min(ty+k,w);i++){
 				if (c[tx][i] == '@')
 					break;
 				if (dp[tx][i] != 0)
 					continue;
 				dp[tx][i] = dp[tx][ty]+1;
 				bfs.add((tx-1)*w+(i-1));
 			}
 			
 			for(int i = ty-1;i>=Math.max(ty-k,1);i--){
 				if (c[tx][i] == '@')
 					break;
 				if (dp[tx][i] != 0)
 					continue;
 				dp[tx][i] = dp[tx][ty]+1;
 				bfs.add((tx-1)*w+(i-1));
 			}
 		}
 		out.println(dp[x2][y2]-1);
 		
 		
 		out.println();
	 		
 		out.close();
 		
 		
 		
 	}
public static PrintWriter out;
	
	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}
		int nextInt() {
			return Integer.parseInt(next());
		}
		long nextLong() {
			return Long.parseLong(next());
		}
		double nextDouble() {
			return Double.parseDouble(next());
		}
		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			}
			catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}
}

Compiler output:
Main.java:3: error: class F is public, should be declared in a file named F.java
public class F {
       ^
1 error
Language: Java

import java.util.*;
import java.io.*;
public class F {
	static int[][] dp;
	static int h;
	static int w;
	static int k;
	public static void main(String[] args) throws Exception{
		int num = 998244353;

		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
 		StringTokenizer st = new StringTokenizer(bf.readLine());
 		h = Integer.parseInt(st.nextToken());
 		w = Integer.parseInt(st.nextToken());
 		k = Integer.parseInt(st.nextToken());
 		StringTokenizer coords = new StringTokenizer(bf.readLine());
 		int x1 = Integer.parseInt(coords.nextToken());
 		int y1 = Integer.parseInt(coords.nextToken());
 		int x2 = Integer.parseInt(coords.nextToken());
 		int y2 = Integer.parseInt(coords.nextToken());
 		char[][] c = new char[h+1][w+1];
 		dp = new int[h+1][w+1];
 		for(int i = 1;i<=h;i++){
 			String line = bf.readLine().trim();
 			for(int j = 1;j<=w;j++){
 				c[i][j] = line.charAt(j-1);
 			}
 		}
 		// EVERYTHING IS INFLATED BY ONE
 		dp[x1][y1] = 1;
 		
 		Queue<ArrayList<Integer>> bfs = new LinkedList<ArrayList<Integer>>();
 		ArrayList<Integer> first = new ArrayList<Integer>();
 		first.add(x1);
 		first.add(y1);
 		first.add(0);
 		bfs.add(first);
 		while(!bfs.isEmpty()){
 			ArrayList<Integer> p = bfs.remove();
 			int tx = p.get(0);
 			int ty = p.get(1);
 			int dir = p.get(2);
 			if (dir != 2){
 			for(int i = tx+1;i<=Math.min(tx+k,h);i++){
 				if (c[i][ty] == '@')
 					break;
 				if (dp[i][ty] != 0)
 					continue;
 				dp[i][ty] = dp[tx][ty]+1;
 				ArrayList<Integer> ar = new ArrayList<Integer>();
 				ar.add(i);
 				ar.add(ty);
 				ar.add(1);
 				bfs.add(ar);
 			}}
 			if (dir != 1){
 			for(int i = tx-1;i>=Math.max(tx-k,1);i--){
 				if (c[i][ty] == '@')
 					break;
 				if (dp[i][ty] != 0)
 					continue;
 				dp[i][ty] = dp[tx][ty]+1;
 				ArrayList<Integer> ar = new ArrayList<Integer>();
 				ar.add(i);
 				ar.add(ty);
 				ar.add(2);
 				bfs.add(ar);
 			}}
 			if (dir != 4){
 			for(int i = ty+1;i<=Math.min(ty+k,w);i++){
 				if (c[tx][i] == '@')
 					break;
 				if (dp[tx][i] != 0)
 					continue;
 				dp[tx][i] = dp[tx][ty]+1;
 				ArrayList<Integer> ar = new ArrayList<Integer>();
 				ar.add(tx);
 				ar.add(i);
 				ar.add(3);
 				bfs.add(ar);
 			}}
 			
 			if (dir!= 3){
 			for(int i = ty-1;i>=Math.max(ty-k,1);i--){
 				if (c[tx][i] == '@')
 					break;
 				if (dp[tx][i] != 0)
 					continue;
 				dp[tx][i] = dp[tx][ty]+1;
 				ArrayList<Integer> ar = new ArrayList<Integer>();
 				ar.add(tx);
 				ar.add(i);
 				ar.add(4);
 				bfs.add(ar);
 			}}
 		}
 		out.println(dp[x2][y2]-1);
 		
 		
 		out.println();
	 		
 		out.close();
 		
 		
 		
 	}
}
 	
 
//StringJoiner sj = new StringJoiner(" "); 
//sj.add(strings)
//sj.toString() gives string of those stuff w spaces or whatever that sequence is

 		
 		
 		
 		
	




Compiler output:
Main.java:3: error: class F is public, should be declared in a file named F.java
public class F {
       ^
1 error
Language: Java

import java.util.*;
import java.io.*;
public class F {
	static int[][] dp;
	static int h;
	static int w;
	static int k;
	public static void main(String[] args) throws Exception{
		int num = 998244353;

		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
 		StringTokenizer st = new StringTokenizer(bf.readLine());
 		h = Integer.parseInt(st.nextToken());
 		w = Integer.parseInt(st.nextToken());
 		k = Integer.parseInt(st.nextToken());
 		StringTokenizer coords = new StringTokenizer(bf.readLine());
 		int x1 = Integer.parseInt(coords.nextToken());
 		int y1 = Integer.parseInt(coords.nextToken());
 		int x2 = Integer.parseInt(coords.nextToken());
 		int y2 = Integer.parseInt(coords.nextToken());
 		char[][] c = new char[h+1][w+1];
 		dp = new int[h+1][w+1];
 		for(int i = 1;i<=h;i++){
 			String line = bf.readLine().trim();
 			for(int j = 1;j<=w;j++){
 				c[i][j] = line.charAt(j-1);
 			}
 		}
 		// EVERYTHING IS INFLATED BY ONE
 		dp[x1][y1] = 1;
 		
 		Queue<ArrayList<Integer>> bfs = new LinkedList<ArrayList<Integer>>();
 		ArrayList<Integer> first = new ArrayList<Integer>();
 		first.add(x1);
 		first.add(y1);
 		bfs.add(first);
 		while(!bfs.isEmpty()){
 			ArrayList<Integer> p = bfs.remove();
 			int tx = p.get(0);
 			int ty = p.get(1);
 			for(int i = tx+1;i<=Math.min(tx+k,h);i++){
 				if (c[i][ty] == '@')
 					break;
 				if (dp[i][ty] != 0)
 					continue;
 				dp[i][ty] = dp[tx][ty]+1;
 				ArrayList<Integer> ar = new ArrayList<Integer>();
 				ar.add(i);
 				ar.add(ty);
 				bfs.add(ar);
 			}
 			
 			for(int i = tx-1;i>=Math.max(tx-k,1);i--){
 				if (c[i][ty] == '@')
 					break;
 				if (dp[i][ty] != 0)
 					continue;
 				dp[i][ty] = dp[tx][ty]+1;
 				ArrayList<Integer> ar = new ArrayList<Integer>();
 				ar.add(i);
 				ar.add(ty);
 				bfs.add(ar);
 			}
 			
 			for(int i = ty+1;i<=Math.min(ty+k,w);i++){
 				if (c[tx][i] == '@')
 					break;
 				if (dp[tx][i] != 0)
 					continue;
 				dp[tx][i] = dp[tx][ty]+1;
 				ArrayList<Integer> ar = new ArrayList<Integer>();
 				ar.add(tx);
 				ar.add(i);
 				bfs.add(ar);
 			}
 			
 			for(int i = ty-1;i>=Math.max(ty-k,1);i--){
 				if (c[tx][i] == '@')
 					break;
 				if (dp[tx][i] != 0)
 					continue;
 				dp[tx][i] = dp[tx][ty]+1;
 				ArrayList<Integer> ar = new ArrayList<Integer>();
 				ar.add(tx);
 				ar.add(i);
 				bfs.add(ar);
 			}
 		}
 		out.println(dp[x2][y2]-1);
 		
 		
 		out.println();
	 		
 		out.close();
 		
 		
 		
 	}
}
 	
 
//StringJoiner sj = new StringJoiner(" "); 
//sj.add(strings)
//sj.toString() gives string of those stuff w spaces or whatever that sequence is

 		
 		
 		
 		
	




Compiler output:
Main.java:3: error: class F is public, should be declared in a file named F.java
public class F {
       ^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll=long long;

struct Z{
  ll y;
  ll x;
  ll depth;
};

ll H,W,K,y,x,depth,oo=1e12,xs,ys,xg,yg;
vector<ll> y_vec={1,0,-1,0};
vector<ll> x_vec={0,1,0,-1};
vector<vector<ll>> A;
queue<Z> q;

ll bfs(){
  while(!q.empty()){
    Z now=q.front(); q.pop();
    y=now.y, x=now.x, depth=now.depth;
    if(y==yg && x==xg) return depth;
    }
    for(ll i=0; i<4; i++){
      for(ll k=1; k<=K; k++){
        Z next={y+y_vec[i]*k, x+x_vec[i]*k, depth+1};
//cout<<"ny:"<<next.y<<" nx:"<<next.x<<endl;        
        if(A[next.y][next.x]==-1) break;
        if(A[next.y][next.x]<next.depth) break;
        if(A[next.y][next.x]==next.depth) continue;
        A[next.y][next.x]=next.depth;
        q.push(next);
//cout<<" d:"<<next.depth<<endl;          
      }
    }
  }
  return oo;
}

//A[y][x], A(x,y)として管理
int main(){
  cin>>H>>W>>K;
  cin>>ys>>xs>>yg>>xg;
  A.assign(H+2, vector<ll>(W+2,-1));
  for(int i=1; i<=H; i++){
    for(int j=1; j<=W; j++){
      char a; cin>>a;
      if(a=='@') continue;
      A[i][j]=oo;
    }
  }
  A[ys][xs]=0;
  Z start={ys,xs,0};
  q.emplace(start);
  ll ans=bfs();
  if(ans==oo) ans=-1;
  cout<<ans<<endl;
}


Compiler output:
a.cc:36:3: error: expected unqualified-id before 'return'
   36 |   return oo;
      |   ^~~~~~
a.cc:37:1: error: expected declaration before '}' token
   37 | }
      | ^
a.cc: In function 'll bfs()':
a.cc:35:3: warning: control reaches end of non-void function [-Wreturn-type]
   35 |   }
      |   ^
Language: C++

#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
int H,w,k,X,Y,xx,yy,maxx=23333333;
int q[4]={-1,0,1,0};
int p[4]={0,1,0,-1};
vector<int>l[3];
int main(void)
{
    cin>>H>>w>>k>>xx>>yy>>X>>Y;
    xx--;yy--;X--;Y--;
    char c[H][w];
    int f[H][w];
    for(int i=0;i<H;i++)
    {
        for(int j=0;j<w;j++)
        {
            cin>>c[i][j];
            f[i][j]=maxx;
        }
    }
    int h=0,r=1;
    l[0].push_back(xx);l[1].push_back(yy);l[2].push_back(0);
    f[xx][yy]=0;
    while(h<r)
    {
        for(int i=0;i<4;i++)
        {
            int x1=l[0][h],y1=l[1][h];
            for(int j=0;j<k;j++)
            {
                x1+=q[i];y1+=p[i];
                if(x1<0||x1>=H||y1<0||y1>=w||c[x1][y1]=='@'||f[x1][y1]=<l[2][h]+1)break;
                f[x1][y1]=l[2][h]+1;
                l[0].push_back(x1);l[1].push_back(y1);l[2].push_back(l[2][h]+1);
                r++;
            }
        }
        h++;
    }
    if(f[X][Y]==maxx)cout<<"-1"<<endl;
    else cout<<f[X][Y]<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:72: error: expected primary-expression before '<' token
   34 |                 if(x1<0||x1>=H||y1<0||y1>=w||c[x1][y1]=='@'||f[x1][y1]=<l[2][h]+1)break;
      |                                                                        ^
Language: C++

#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;

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

    int h, w, k;
    cin >> h >> w >> k;
    int si, sj, gi, gj;
    cin >> si >> sj >> gi >> gj;
    --si;
    --sj;
    --gi;
    --gj;

    vector<string> c(h);
    rep(i, h) cin >> c[i];

    queue<pair<int, int>> q;
    q.push(make_pair(si, sj));
    
    const int INF = 1001001001;
    vector<vector<int>> dist(h, vector<int>(w, INF));
    dist[si][sj] = 0;

    const int di[] = {0, 1, 0, -1};
    const int dj[] = {1, 0, -1, 0};

    while(!q.empty()){
        pair<int, int> p = q.front();
        q.pop();
        int y = p.first;
        int x = p.second;

        rep(dir, 4){
            int y_ = y;
            int x_ = x;
            rep(i, k){
                int ny = y_ + di[dir];
                int nx = x_ + dj[dir];

                if(ny>=h || ny<0 || nx>=w || nx<0) break;
                if(c[ny][nx] == '@') break;
                if(dist[ny][nx] != INF){
                    if(dist[ny][nx] <= dist[y_][x_]) break;
                    else continue;

                dist[ny][nx] = dist[y_][x_];
                if(i==0) ++dist[ny][nx];

                q.push(make_pair(ny, nx));

                y_ = ny;
                x_ = nx;
            }
        }
    }

    // rep(i, h){
    //     rep(j, w) {
    //         if(dist[i][j] != INF) cout << dist[i][j] << " ";
    //         else cout << '@' << " ";
    //     }
    //     cout << endl;
    // }

    if(dist[gi][gj] != INF) cout << dist[gi][gj] << endl;
    else cout << -1 << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:76:2: error: expected '}' at end of input
   76 | }
      |  ^
a.cc:8:11: note: to match this '{'
    8 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<vector<ll> > Graph;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e18;

ll h,w,k;
ll X1,Y1,X2,Y2;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> h >> w >> k;
    cin >> X1 >> Y1 >> X2 >> Y2;
    X1--;Y1--;X2--;Y2--;
    vector<vector<char> >field(h+1,vector<char>(w+1));
    vector<vector<ll> > dist(h+1,vector<ll>(w+1));
    rep(i,h){
        rep(j,w){
            cin >> field[i][j];
            dist[i][j]=-1;
        }
    }
    queue<pair<ll,ll> >que;
    dist[X1][Y1]=0;
    int dx[4] = {1,0,-1,0};
    int dy[4] = {0,1,0,-1};
    que.push({X1,Y1});
    from[X1][Y1]={0,0};
    while(!que.empty()){
        ll xnow = que.front().first;
        ll ynow = que.front().second;
        que.pop();
        rep(dir,4){
            rep(i,k){//進めるマスは1~k
                if(from[xnow][ynow].first==dx[dir]&&from[xnow][ynow].second==dy[dir])break;
                ll xnx = xnow + dx[dir]*(i+1);
                ll ynx = ynow + dy[dir]*(i+1);
                if(xnx<0||xnx>=h)break;
                if(ynx<0||ynx>=w)break;
                if(field[xnx][ynx]=='@'){
                    break;
                }
                if(dist[xnx][ynx]!=-1&&(dist[xnx][ynx]<=dist[xnow][ynow]))break;
                dist[xnx][ynx]=dist[xnow][ynow]+1;
                que.push({xnx,ynx});
            }
        }
    }
    cout << dist[X2][Y2] << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:5: error: 'from' was not declared in this scope; did you mean 'fromfp'?
   34 |     from[X1][Y1]={0,0};
      |     ^~~~
      |     fromfp
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using ll = long long int;
using vec = vector<ll>;
using P = pair<int,int>;
using LP = pair<ll,int>;
const ll INF = 1e18+7;

// 未解決
int main() {
  int h, w, k;
  cin >> h >> w >> k;
  int si, sj, ti, tj;
  cin >> si >> sj >> ti >> tj;
  si--; sj--; ti--; tj--;
  vector<string> c(h);
  rep(i,h) {
    cin >> c[i];
  }

  auto toId = [&](int i, int j, int v) {
    return (i*w+j)*4+v;
  };
  auto modCeilK = [&](int x) {
    return (x+k-1)/k*k;
  }

  // start dijkstra
  int di[4] = {1, 0, -1, 0}, di[4] = {0, 1, 0, -1};
  priority_queue<LP, vector<LP>, greater<LP> > q;
  vector<ll> dist(h*w*4);
  auto push = [&](int i, int j, int v, ll x) {
    int id = toId(i,j,v);
    if (dist[id] <= x) return;
    dist[id] = x;
    q.emplace(x, id);
  };
  rep(v,4) push(si,sj,v,0);

  while (!que.empty()) {
    ll d = q.top().first;
    int id = q.top().second;
    q.pop();

    if (dist[id] < d) continue;

    int v = id % 4;
    int j = id / 4 % w;
    int i = id / 4 / w;

    rep(nv, 4) {
      push(i,j,nv,modCeilK(d));
      int ni = i + di[v], nj = j + dj[v];
      if (c[ni][nj] == '.') {
        push(ni,nj,v,d+1);
      }
    }
  }
  // end dijkstra

  ll ans = INF;
  rep(v,4) {
    int id = toId(ti,tj,v);
    ans = min(ans, d[id]);
  }
  if (ans == INF) cout << ans << endl;
  else cout << modCeilK(d)/k << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:3: error: expected ',' or ';' before 'int'
   31 |   int di[4] = {1, 0, -1, 0}, di[4] = {0, 1, 0, -1};
      |   ^~~
a.cc:31:28: error: expected primary-expression before ',' token
   31 |   int di[4] = {1, 0, -1, 0}, di[4] = {0, 1, 0, -1};
      |                            ^
a.cc:31:30: error: 'di' was not declared in this scope; did you mean 'ti'?
   31 |   int di[4] = {1, 0, -1, 0}, di[4] = {0, 1, 0, -1};
      |                              ^~
      |                              ti
a.cc:42:11: error: 'que' was not declared in this scope
   42 |   while (!que.empty()) {
      |           ^~~
a.cc:56:17: error: 'nj' was not declared in this scope; did you mean 'ni'?
   56 |       if (c[ni][nj] == '.') {
      |                 ^~
      |                 ni
a.cc:66:20: error: 'd' was not declared in this scope; did you mean 'id'?
   66 |     ans = min(ans, d[id]);
      |                    ^
      |                    id
a.cc:69:25: error: 'd' was not declared in this scope
   69 |   else cout << modCeilK(d)/k << endl;
      |                         ^
Language: C

#include <stdio.h>
#include <string.h>
#define bufsize 1<<22
char ibuf[bufsize];
char *ptr=ibuf;

void readint(int *i)
{
    *i=0;
    while(*ptr>='0')
    {
        *i=*i*10+*ptr-'0';
        ++ptr;
    }
    ++ptr;
}

int h,w;
int obs(int i,int j)
{
    if(i<0 or j<0 or i>=h or j>=w) return 1;
    return ptr[i*(w+1)+j]=='@';
}

main()
{
    fread(ibuf,1,bufsize,stdin);

    int k,sx,sy,tx,ty;
    readint(&h);
    readint(&w);
    readint(&k);
    readint(&sx);
    readint(&sy);
    readint(&tx);
    readint(&ty);
    sx--,sy--,tx--,ty--;

    struct po {int x,y;};
    struct po qu[1<<20];
    struct po *beg=qu,*end=qu+1;
    beg->x=sx,beg->y=sy;
    unsigned int dist[1<<20];
    memset(dist,-1,sizeof(dist));
    dist[sx*w+sy]=0;
    while(beg!=end)
    {
        int x=beg->x,y=beg->y;
        unsigned int d=dist[x*w+y];
        ++beg;
        for(int i=1,a=x,b=y,z=a*w+y; i<=k; i++)
        {
            a++,z+=w;
            if(obs(a,b)||dist[z]<=d) break;
            if(a==tx && b==ty)
            {
                printf("%u\n",d+1);
                return 0;
            }
            if(dist[z]!=d+1)
            {
                end->x=a,end->y=b;
                dist[z]=d+1;
                ++end;
            }
        }
        for(int i=1,a=x,b=y,z=a*w+y; i<=k; i++)
        {
            b++,z++;
            if(obs(a,b)||dist[z]<=d) break;
            if(a==tx && b==ty)
            {
                printf("%u\n",d+1);
                return 0;
            }
            if(dist[z]!=d+1)
            {
                end->x=a,end->y=b;
                dist[z]=d+1;
                ++end;
            }
        }
        for(int i=1,a=x,b=y,z=a*w+y; i<=k; i++)
        {
            a--,z-=w;
            if(obs(a,b)||dist[z]<=d) break;
            if(a==tx && b==ty)
            {
                printf("%u\n",d+1);
                return 0;
            }
            if(dist[z]!=d+1)
            {
                end->x=a,end->y=b;
                dist[z]=d+1;
                ++end;
            }
        }
        for(int i=1,a=x,b=y,z=a*w+y; i<=k; i++)
        {
            b--,z--;
            if(obs(a,b)||dist[z]<=d) break;
            if(a==tx && b==ty)
            {
                printf("%u\n",d+1);
                return 0;
            }
            if(dist[z]!=d+1)
            {
                end->x=a,end->y=b;
                dist[z]=d+1;
                ++end;
            }
        }
    }
    puts("-1");
}


Compiler output:
main.c: In function 'obs':
main.c:21:11: error: expected ')' before 'or'
   21 |     if(i<0 or j<0 or i>=h or j>=w) return 1;
      |       ~   ^~~
      |           )
main.c: At top level:
main.c:25:1: error: return type defaults to 'int' [-Wimplicit-int]
   25 | main()
      | ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(){
    int h, w, k;
    int x1, y1, x2, y2;
    static string s[1000002];
    cin >> h >> w >> k;
    cin >> x1 >> y1 >> x2 >> y2;
    for(int i=1;i<=h;++i){
        string c;
        cin >> c;
        s[i] = "@" + c + "@";
    }
    s[0] = ""; s[h+1] = "";
    for(int j=0;j<=w+1;++j){ s[0].push_back('@'); s[h+1].push_back('@'); }

    auto idx = [&](int i, int j){ return (i-1)*w+(j-1)+1; };
    static bool vis[1000001];
    priority_queue<pair<int, int>> q;
    vis(idx(x1, y1)) = true;
    q.emplace(0, idx(x1, y1));

    static int tl[1000001], tr[1000001], tu[1000001], td[1000001];
    for(int i=1;i<=h;++i){
        for(int j=1;j<=w;++j){
            if(i < h) td[idx(i, j)] = idx(i+1, j);
            if(j < w) tr[idx(i, j)] = idx(i, j+1);
            if(i > 1) tu[idx(i, j)] = idx(i-1, j);
            if(j > 1) tl[idx(i, j)] = idx(i, j-1);
        }
    }
    for(int i=1;i<=h;++i){
        for(int j=1;j<=w;++j){
            if(s[i][j] == '@'){
                if(i > 1) td[idx(i-1, j)] = 0;
                if(j > 1) tr[idx(i, j-1)] = 0;
                if(i < h) tu[idx(i+1, j)] = 0;
                if(j < w) tl[idx(i, j+1)] = 0;
            }
        }
    }
    
    while(!q.empty()){
        auto [c, pos] = q.top();
        q.pop();
        if(pos == idx(x2, y2)){ cout << -c << endl; return 0; }

        for(int p=td[pos];p!=0&&p<=pos+k*w;p=td[p]){
            if(tl[p] != 0) tr[tl[p]] = tr[p];
            if(tr[p] != 0) tl[tr[p]] = tl[p];
            if(tu[p] != 0) td[tu[p]] = td[p];
            if(td[p] != 0) tu[td[p]] = tu[p];
            if(!vis[p]){ vis[p] = true; q.emplace(c-1, p); }
        }
        for(int p=tu[pos];p!=0&&pos-k*w<=p;p=tu[p]){
            if(tl[p] != 0) tr[tl[p]] = tr[p];
            if(tr[p] != 0) tl[tr[p]] = tl[p];
            if(tu[p] != 0) td[tu[p]] = td[p];
            if(td[p] != 0) tu[td[p]] = tu[p];
            if(!vis[p]){ vis[p] = true; q.emplace(c-1, p); }
        }
        for(int p=tr[pos];p!=0&&p<=pos+k;p=tr[p]){
            if(tl[p] != 0) tr[tl[p]] = tr[p];
            if(tr[p] != 0) tl[tr[p]] = tl[p];
            if(tu[p] != 0) td[tu[p]] = td[p];
            if(td[p] != 0) tu[td[p]] = tu[p];
            if(!vis[p]){ vis[p] = true; q.emplace(c-1, p); }
        }
        for(int p=tl[pos];p!=0&&pos-k<=p;p=tl[p]){
            if(tl[p] != 0) tr[tl[p]] = tr[p];
            if(tr[p] != 0) tl[tr[p]] = tl[p];
            if(tu[p] != 0) td[tu[p]] = td[p];
            if(td[p] != 0) tu[td[p]] = tu[p];
            if(!vis[p]){ vis[p] = true; q.emplace(c-1, p); }
        }
    }
    cout << -1 << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:8: error: 'vis' cannot be used as a function
   21 |     vis(idx(x1, y1)) = true;
      |     ~~~^~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)

const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};

int main(){
    int h, w, k;
    cin >> h >> w >> k;
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    x1--, y1--, x2--, y2--;
    vector<string> field(h);
    rep(i,h) cin >> field[i]; 

    vector<vector<int>> dist(h, vector<int>(w, -1));
    dist[x1][y1] = 0;

    queue<pair<int, int>> que;
    que.push(make_pair(x1, y1));

    while(!que.empty()){
        pair<int, int> current_pos = que.front();
        int x = current_pos.first;
        int y = current_pos.second;
        que.pop();
        
        rep(d,4){
            rep(i, k){
                int next_x = x + (i+1)*dx[d];
                int next_y = y + (i+1)*dy[d];
                if(next_x < 0 || next_x >= h || next_y < 0 || next_y >= w) break;
                if(field[next_x][next_y] == '@') break;
                if(dist[next_x][next_y] <= dist[x][y] && dist[next_x][next_y] != -1) break;

                que.push(make_pair(next_x, next_y));
                dist[next_x][next_y] = dist[x][y] + 1;
            }
        }
    }

    /*for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cout << dist[i][j] << ' ';
        }
        cout << endl;
    }*/

    if(dist[x2][y2] == INF){
        cout << -1 << endl;
        return 0;
    }
 
    cout << dist[x2][y2] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:24: error: 'INF' was not declared in this scope
   50 |     if(dist[x2][y2] == INF){
      |                        ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define finish(x) return cout << x << endl, 0;
#define ll long long
#define f first
#define s second
 
int n, m, k;
string s;
vector <string> a;
deque <pair <int, int> > ready;
int ans[1001][1001];
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
 
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> n >> m >> k;
    int x1, y1, x2, y2
    cin >> x1 >> y1 >> x2 >> y2;
    for(int i = 0 ; i < n ; i++)
        for(int j = 0 ; j < m ; j++)
            ans[i][j] = 1e9;
    for(int i = 0 ; i < n && cin >> s ; i++)
        a.push_back(s);
    x1--; y1--;
    x2--; y2--;
    ready.push_back(make_pair(x1, y1));
    ans[x1][y1] = 0;
    while(ready.size()){
        auto top = ready.front();
        ready.pop_front();
        for(int i = 0 ; i < 4 ; i++){
            int curx = top.f, cury = top.s;
            for(int j = 1 ; j <= k ; j++){
                curx += dx[i];
                cury += dy[i];
                if(curx >= n || curx < 0 || cury >= m || cury < 0) break;
                if(a[curx][cury] == '@') break;
                if(ans[top.f][top.s] + 1 > ans[curx][cury]) break;
                if(ans[top.f][top.s] + 1 == ans[curx][cury]) continue;
                ans[curx][cury] = ans[top.f][top.s] + 1;
                ready.push_back(make_pair(curx, cury));
            }
        }
    }
    if(ans[x2][y2] == 1e9) cout << -1 << endl;
    else cout << ans[x2][y2] << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:5: error: expected initializer before 'cin'
   22 |     cin >> x1 >> y1 >> x2 >> y2;
      |     ^~~
a.cc:29:11: error: 'y2' was not declared in this scope; did you mean 'x2'?
   29 |     x2--; y2--;
      |           ^~
      |           x2
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll inf=100000000;
ll px[]=  { 1, 0, -1, 0 };
ll py[]=  { 0, 1, 0, -1 };
int main() {
    ios::sync_with_stdio(0);cin.tie(NULL); cout.tie(NULL);
    ll n,m,i,j,x,y,k,sx,sy;
    cin>>n>>m>>k;
    cin>>x>>y>>sx>>sy;
    
    ll dist[n+5][m+5];
    char arr[n+5][m+5];
    bool vis[n+5][m+5];
    memset(vis,false,sizeof(vis));
    
    for(i=0;i<=n;i++)
     for(j=0;j<=m;j++)
      dist[i][j]=inf;
      
    dist[x][y]=0;vis[x][y]=true;
    
    for(i=1;i<=n;i++)
     for(j=1;j<=m;j++)
      cin>>arr[i][j];
    
    queue< pair<ll,ll> > pq;
    
    pq.push(make_pair(x,y));
    
    while(!pq.empty()){
       pair<ll,ll> p=pq.top(); pq.pop();
       x=p.first, y=p.second;
       
       for(i=0;i<4;i++){
            for(j=1;j<=k;j++){
                ll dx= x +px[i]*j    , dy= y+ py[i]*j ;
                if(dx<1||dy<1||dx>n||dy>m)break;
                if(arr[dx][dy]=='@')break;
                if(vis[dx][dy] && dist[dx][dy]<=dist[x][y])break;
                if(vis[dx][dy])continue;
                vis[dx][dy]=true;
                dist[dx][dy]= 1 + dist[x][y];
                pq.push( make_pair(dx,dy));
            }    
       }
    }
    
    if(!vis[sx][sy])cout<<"-1";
    else cout<<dist[sx][sy];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:25: error: 'class std::queue<std::pair<long long int, long long int> >' has no member named 'top'; did you mean 'pop'?
   33 |        pair<ll,ll> p=pq.top(); pq.pop();
      |                         ^~~
      |                         pop
Language: C++

3 3 1
2 1 2 3
.@.
.@.
.@.
-1


Compiler output:
a.cc:3:2: error: stray '@' in program
    3 | .@.
      |  ^
a.cc:4:2: error: stray '@' in program
    4 | .@.
      |  ^
a.cc:5:2: error: stray '@' in program
    5 | .@.
      |  ^
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 3 3 1
      | ^