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

#include "bits/stdc++.h"
using namespace std;
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 Sx,Sy,Gx,Gy;
  cin>>Sx>>Sy>>Gx>>Gy;
  --Sx,--Sy,--Gx,--Gy;
  
  vector<string> S(H);
  for(int i=0; i<H; ++i) cin>>S[n];
  
  vector<vector<int>> D(H, vector<int>(W,1e9));
  vector<vector<bool>> Data(H, vector<bool>(W,false));
  queue<pair<int,int>> q;
  q.push(make_pair(Sx, Sy));
  D[Sx][Sy]=0;
  
  while(!q.empty()){
    int x=q.front().first;
    int y=q.front().second;
    q.pop();
    if((x==Gx)&&(y==Gy)){
      cout<<D[Gx][Gy]<<endl;
      return 0;
    }
    
    for(int l=0; l<4; ++l){
      int x1=x;
      int y1=y;
      for(int m=1; m<=K; ++m){
        x1+=dx[l];
        y1+=dy[l];
        if((0>x1)||(H<=x1)||(0>y1)||(W<=y1)) break;
        if(S[x1][y1]=='@') break;
        if(Data[x1][y1] && (D[x1][y1]!=(D[x][y]+1))) break;
        if(!Data[x1][y1]){
          D[x1][y1]=D[x][y]+1;
          q.push(make_pair(x1,y1));
          Data[x1][y1]=true;
        }
      }
    }
  }
  
  cout<<-1<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:33: error: 'n' was not declared in this scope
   14 |   for(int i=0; i<H; ++i) cin>>S[n];
      |                                 ^
Language: C++

#include<bits/stdc++.h>
int H, W, K, sx, sy, tx, ty;
string c[1010101];
int mi[1010101];
bool vis[1010101];
int dx[4] = { 0, 1, 0, -1 }, dy[4] = { -1, 0, 1, 0 };
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> H >> W >> K >> sx >> sy >> tx >> ty;
    rep(y, 0, H) cin >> c[y];
    sx--; sy--; tx--; ty--;

    queue<int> que;
    rep(i, 0, 1010101) mi[i] = inf;

    que.push(sx * W + sy);
    vis[sx * W + sy] = true;
    mi[sx * W + sy] = 0;

    while (!que.empty()) {
        int q = que.front(); que.pop();

        int x = q / W;
        int y = q % W;

        if (x == tx && y == ty) {
            printf("%d\n", mi[q]);
            return;
        }

        rep(d, 0, 4) {
            int xx = x, yy = y;
            rep(k, 0, K) {
                xx += dx[d];
                yy += dy[d];

                if (xx < 0 || H <= xx || yy < 0 || W <= yy) break;
                if (c[xx][yy] == '@') break;
                
                int id = xx * W + yy;
                if (vis[id] && mi[q] + 1 != mi[id]) break;

                if (!vis[id]) {
                    vis[id] = true;
                    mi[id] = mi[q] + 1;
                    que.push(id);
                }
            }
        }
    }

    printf("-1\n");
}


Compiler output:
a.cc:3:1: error: 'string' does not name a type; did you mean 'stdin'?
    3 | string c[1010101];
      | ^~~~~~
      | stdin
a.cc: In function 'void _main()':
a.cc:9:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    9 |     cin >> H >> W >> K >> sx >> sy >> tx >> ty;
      |     ^~~
      |     std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:10:9: error: 'y' was not declared in this scope; did you mean 'yn'?
   10 |     rep(y, 0, H) cin >> c[y];
      |         ^
      |         yn
a.cc:10:5: error: 'rep' was not declared in this scope
   10 |     rep(y, 0, H) cin >> c[y];
      |     ^~~
a.cc:13:5: error: 'queue' was not declared in this scope; did you mean 'std::queue'?
   13 |     queue<int> que;
      |     ^~~~~
      |     std::queue
In file included from /usr/include/c++/14/queue:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:157:
/usr/include/c++/14/bits/stl_queue.h:96:11: note: 'std::queue' declared here
   96 |     class queue
      |           ^~~~~
a.cc:13:11: error: expected primary-expression before 'int'
   13 |     queue<int> que;
      |           ^~~
a.cc:14:9: error: 'i' was not declared in this scope; did you mean 'mi'?
   14 |     rep(i, 0, 1010101) mi[i] = inf;
      |         ^
      |         mi
a.cc:16:5: error: 'que' was not declared in this scope
   16 |     que.push(sx * W + sy);
      |     ^~~
a.cc:31:13: error: 'd' was not declared in this scope
   31 |         rep(d, 0, 4) {
      |             ^
Language: C++

int H, W, K, sx, sy, tx, ty;
string c[1010101];
int mi[1010101];
bool vis[1010101];
int dx[4] = { 0, 1, 0, -1 }, dy[4] = { -1, 0, 1, 0 };
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> H >> W >> K >> sx >> sy >> tx >> ty;
    rep(y, 0, H) cin >> c[y];
    sx--; sy--; tx--; ty--;

    queue<int> que;
    rep(i, 0, 1010101) mi[i] = inf;

    que.push(sx * W + sy);
    vis[sx * W + sy] = true;
    mi[sx * W + sy] = 0;

    while (!que.empty()) {
        int q = que.front(); que.pop();

        int x = q / W;
        int y = q % W;

        if (x == tx && y == ty) {
            printf("%d\n", mi[q]);
            return;
        }

        rep(d, 0, 4) {
            int xx = x, yy = y;
            rep(k, 0, K) {
                xx += dx[d];
                yy += dy[d];

                if (xx < 0 || H <= xx || yy < 0 || W <= yy) break;
                if (c[xx][yy] == '@') break;
                
                int id = xx * W + yy;
                if (vis[id] && mi[q] + 1 != mi[id]) break;

                if (!vis[id]) {
                    vis[id] = true;
                    mi[id] = mi[q] + 1;
                    que.push(id);
                }
            }
        }
    }

    printf("-1\n");
}

Compiler output:
a.cc:2:1: error: 'string' does not name a type
    2 | string c[1010101];
      | ^~~~~~
a.cc: In function 'void _main()':
a.cc:8:5: error: 'cin' was not declared in this scope
    8 |     cin >> H >> W >> K >> sx >> sy >> tx >> ty;
      |     ^~~
a.cc:9:9: error: 'y' was not declared in this scope; did you mean 'ty'?
    9 |     rep(y, 0, H) cin >> c[y];
      |         ^
      |         ty
a.cc:9:5: error: 'rep' was not declared in this scope
    9 |     rep(y, 0, H) cin >> c[y];
      |     ^~~
a.cc:12:5: error: 'queue' was not declared in this scope
   12 |     queue<int> que;
      |     ^~~~~
a.cc:12:11: error: expected primary-expression before 'int'
   12 |     queue<int> que;
      |           ^~~
a.cc:13:9: error: 'i' was not declared in this scope; did you mean 'mi'?
   13 |     rep(i, 0, 1010101) mi[i] = inf;
      |         ^
      |         mi
a.cc:15:5: error: 'que' was not declared in this scope
   15 |     que.push(sx * W + sy);
      |     ^~~
a.cc:26:13: error: 'printf' was not declared in this scope
   26 |             printf("%d\n", mi[q]);
      |             ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int H, W, K, sx, sy, tx, ty;
a.cc:30:13: error: 'd' was not declared in this scope
   30 |         rep(d, 0, 4) {
      |             ^
a.cc:51:5: error: 'printf' was not declared in this scope
   51 |     printf("-1\n");
      |     ^~~~~~
a.cc:51:5: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
Language: C

#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};
signed main(){
	int h,w,k;cin >> h >> w >> k;
	int sx,sy,gx,gy;cin >> sx >> sy >> gx >> gy;
	sx--;sy--;gx--;gy--;
	vector<string> f(h);
	rep(i,h)cin >> f[i];
	vector<vector<int>> dist(h,vector<int>(w,-1));
	queue<P> q;
	dist[sx][sy] = 0;
	q.emplace(sx,sy);
	while(q.size()){
		auto now = q.front();q.pop();
		int x = now.first,y = now.second;
		rep(i,4){
			for(int j = 1;j <= k;j++){
				int nx = x + dx[i]*j,ny = y+dy[i]*j;
				if(nx < 0 || ny < 0 || nx > h-1 || ny > w-1)continue;
				if(f[nx][ny] == '@')break;
				if(dist[nx][ny] != -1 && dist[nx][ny] != dist[x][y]+1)break;
				dist[nx][ny] = dist[x][y] + 1;
				q.emplace(nx,ny);
			}
		}
	}
	//rep(i,h)trace(dist[i]);
	cout << dist[gx][gy] << endl;
	return 0;
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

const int INF = INT_MAX/2;
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
using P = pair<int,int>;

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

int main() {

  int H,W,K; cin >> H >> W >> K;
  P s,g; cin >> s.first >> s.second >> g.first >> g.second;
  s.first--;s.second--;g.first--;g.second--;

  vector<string> C(H);
  REP(i,H) cin >> C.at(i);

  vector<vector<int>> len(H,vector<int>(W,INF));

  REP(i,H)REP(j,W){
    if(C.at(i).at(j)=='@')len.at(i).at(j)=-1;
  }

  len.at(s.first).at(s.second) = 0;

  queue<P> qu;

  qu.emplace(s.first,s.second);

  while(!qu.empty()){
    P now = qu.front();qu.pop();
    int a = now.first, b = now.second;
    int lengh = len.at(a).at(b)
    REP(i,4){
      for(int t = 1;t<=K;t++){
        int x = a + dx.at(i)*t, y = b + dy.at(i)*t;
        if(x<0||H<=x||y<0||W<=y)break;
        
        if(len.at(x).at(y)>lengh){
          if(chmin(len.at(x).at(y),lengh+1)) qu.emplace(x,y);
        }else{
          break;
        }
      }
    }
  }
  int ans = len.at(g.first).at(g.second);
  if(ans==INF) ans=-1;
  
  cout << ans << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:4:20: error: expected ',' or ';' before 'for'
    4 | #define FOR(i,a,b) for(int i=(a);i<(b);++i)
      |                    ^~~
a.cc:5:19: note: in expansion of macro 'FOR'
    5 | #define REP(i,n)  FOR(i,0,n)
      |                   ^~~
a.cc:39:5: note: in expansion of macro 'REP'
   39 |     REP(i,4){
      |     ^~~
a.cc:39:9: error: 'i' was not declared in this scope
   39 |     REP(i,4){
      |         ^
a.cc:4:34: note: in definition of macro 'FOR'
    4 | #define FOR(i,a,b) for(int i=(a);i<(b);++i)
      |                                  ^
a.cc:39:5: note: in expansion of macro 'REP'
   39 |     REP(i,4){
      |     ^~~
Language: C++

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

const int INF = INT_MAX/2;
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
using P = pair<int,int>;

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

int main() {

  int H,W,K; cin >> H >> W >> K;
  P s,g; cin >> s.first >> s.second >> g.first >> g.second;
  s.first--;s.second--;g.first--;g.second--;

  vector<string> C(H);
  REP(i,H) cin >> C.at(i);

  vector<vector<int>> len(H,VI(W,INF));

  REP(i,H)REP(j,W){
    if(C.at(i).at(j)=='@')len.at(i).at(j)=-1;
  }

  len.at(s.first).at(s.second) = 0;

  queue<P> qu;

  qu.emplace(s.first,s.second);

  while(!qu.empty()){
    P now = qu.front();qu.pop();
    int a = now.first, b = now.second;
    int lengh = len.at(a).at(b)
    REP(i,4){
      for(int t = 1;t<=K;t++){
        int x = a + dx.at(i)*t, y = b + dy.at(i)*t;
        if(x<0||H<=x||y<0||W<=y)break;
        
        if(len.at(x).at(y)>lengh){
          if(chmin(len.at(x).at(y),lengh+1)) qu.emplace(x,y);
        }else{
          break;
        }
      }
    }
  }
  int ans = len.at(g.first).at(g.second);
  if(ans==INF) ans=-1;
  
  cout << ans << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:29: error: 'VI' was not declared in this scope
   23 |   vector<vector<int>> len(H,VI(W,INF));
      |                             ^~
a.cc:4:20: error: expected ',' or ';' before 'for'
    4 | #define FOR(i,a,b) for(int i=(a);i<(b);++i)
      |                    ^~~
a.cc:5:19: note: in expansion of macro 'FOR'
    5 | #define REP(i,n)  FOR(i,0,n)
      |                   ^~~
a.cc:39:5: note: in expansion of macro 'REP'
   39 |     REP(i,4){
      |     ^~~
a.cc:39:9: error: 'i' was not declared in this scope
   39 |     REP(i,4){
      |         ^
a.cc:4:34: note: in definition of macro 'FOR'
    4 | #define FOR(i,a,b) for(int i=(a);i<(b);++i)
      |                                  ^
a.cc:39:5: note: in expansion of macro 'REP'
   39 |     REP(i,4){
      |     ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
string e[1160044];
map<int,map<int,int>> dis;
#define _for(i,a,b) for(int i=(a);i<=(b);i++)
#define _fIter(i,Istart,Iend) for(int i=Istart;i<=Iend;i++)
#define _fM(i,c) for(int i=c.begin();i<c.end();i++)
typedef int _Bx_INT32_0;
	int n,m,k;
int dx[5]={0,-1,0,1,0};
int dy[5]={0,0,-1,0,1};
char rmap(int i,int j){
	return e[i][j];
}
void _bfs(int x1,int y1)
{
	//cout<<m-(n-k);
	typedef struct pos{
		int x;
		int y;
	}POS;
	queue<POS>q;
	POS f1234567={x1,y1};
	q.push(f1234567);
	dis[x1][y1]=0;
	//cout<<8;
	while(!q.empty())
	{
		//cout<<2;
		POS h=q.front();
		q.pop();
		for(int i=1;i<=k;i++)
		{
			for(int j=1;j<5;j++)
			{
				int tx=h.x;
				int ty=h.y;
				for(int k=1;k<=i;k++)
				{
					tx+=dx[j];
					ty+=dy[j];
					if(tx&&ty&&tx<=n&&ty<=m&&e[tx][ty])=='@')break;
				}
				if(dis[tx][ty]>=dis[h.x][h.y]+1){
					q.push({tx,ty});
					dis[tx][ty]+dis[h.x][h.y]+1;
				}
			}
		}
	}
}
int main()
{

	cin>>n>>m>>k;
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	for(int i=1;i<=n;i++)
	for(int j=1;j<=m;j++)
	cin>>e[i][j];
	//cout<<3;
	_bfs(a,b);
	cout<<endl<<dis[c][d];
}

Compiler output:
a.cc: In function 'void _bfs(int, int)':
a.cc:42:76: error: expected primary-expression before '==' token
   42 |                                         if(tx&&ty&&tx<=n&&ty<=m&&e[tx][ty])=='@')break;
      |                                                                            ^~
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define INF int(1e9)
#define EPS 1e-9
#define MOD int(1e9 + 7)

int n, m, k;

struct Node {
	pair<int, int> pos;
	int cost;
	pair<int, int> origin;
	Node(pair<int, int> pos, int cost, pair<int, int> origin) :
			pos(pos), cost(cost), origin(origin) {
	}
	bool operator<(const Node& n) const {
		return cost > n.cost;
	}
};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cin >> n >> m >> k;
	int x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	--x1; --y1; --x2; --y2;

	bool vis[n][m];
	bool empty[n][m];

	for (int i = 0; i < n; i++) {
		char c;
		for (int j = 0; j < m; j++) {
			cin >> c;
			empty[i][j] = c != '@';
			vis[i][j] = false;
		}
	}

	auto isValidNode = [&](pair<int, int>& node) {
		int x = node.first, y = node.second;
		return x >= 0 && x < n && y >= 0 && y < m && empty[x][y] && !vis[x][y];
	};

	auto isWithinK =
			[&](pair<int, int>& newPos, pair<int, int>& origin) {
				return (newPos.first == origin.first && abs(newPos.second - origin.second) <= k) ||
				(newPos.second == origin.second && abs(newPos.first - origin.first) <= k);
			};

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

	priority_queue<Node> pq;
	pq.push( { { x1, y1 }, 1, { x1, y1 } });
	int ans = -1;
	while (!pq.empty()) {
		Node _n = pq.top();
		pq.pop();
		auto pos = _n.pos;
		auto origin = _n.origin;
		int cost = _n.cost;
		if (pos.first == x2 && pos.second == y2) {
			ans = cost;
			break;
		}
		vis[pos.first][pos.second] = true;

		for (int i = 0; i < 4; i++) {
			pair<int, int> newPos = { pos.first + dx[i], pos.second + dy[i] };
			if (!isValidNode(newPos))
				continue;

			if (isWithinK(newPos, origin)) {
				pq.push(Node(newPos, cost, origin));
			} else {
				pq.push(Node(newPos, cost + 1, pos));
			}
		}
	}
	cout << ans << '\n';
	return 0;
}


Compiler output:
a.cc: In lambda function:
a.cc:46:62: sorry, unimplemented: capture of variably-modified type 'bool [n][m]' that is not an N3639 array of runtime bound
   46 |                 return x >= 0 && x < n && y >= 0 && y < m && empty[x][y] && !vis[x][y];
      |                                                              ^~~~~
a.cc:46:62: note: because the array element type 'bool [m]' has variable size
a.cc:46:78: sorry, unimplemented: capture of variably-modified type 'bool [n][m]' that is not an N3639 array of runtime bound
   46 |                 return x >= 0 && x < n && y >= 0 && y < m && empty[x][y] && !vis[x][y];
      |                                                                              ^~~
a.cc:46:78: note: because the array element type 'bool [m]' has variable size
Language: Java

import java.util.*;
import java.io.*;

public class Abc170f {
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int h = sc.nextInt(), w = sc.nextInt(), k = sc.nextInt(), x1 = sc.nextInt() - 1, y1 = sc.nextInt() - 1,
				x2 = sc.nextInt() - 1, y2 = sc.nextInt() - 1;
		char[][] grid = new char[h][];
		for (int i = 0; i < grid.length; i++) {
			grid[i] = sc.next().toCharArray();
		}
		int[][] dist = new int[h][w];
		for (int[] x : dist)
			Arrays.fill(x, -1);
		Queue<int[]> q = new LinkedList<int[]>();
		q.add(new int[] { x1, y1 });
		dist[x1][y1] = 0;
		int[] dx = { 0, 0, -1, 1 };
		int[] dy = { 1, -1, 0, 0 };
		while (!q.isEmpty()) {
			int[] cur = q.poll();
			int curdist = dist[cur[0]][cur[1]];
			for (int j = 0; j < 4; j++) {
				for (int i = 1; i <= k; i++) {
					int nxtx = cur[0] + i * dx[j];
					int nxty = cur[1] + i * dy[j];
					if (nxtx >= h || nxtx < 0 || nxty < 0 || nxty >= w || grid[nxtx][nxty] == '@'
							|| (dist[nxtx][nxty] != -1 && dist[nxtx][nxty] <= curdist))
						break;
					dist[nxtx][nxty] = curdist + 1;
					q.add(new int[] { nxtx, nxty });
				}
			}
		}
		pw.println(dist[x2][y2]);
		pw.close();
	}

	static class Scanner {
		BufferedReader br;
		StringTokenizer st;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArr(int n) throws IOException {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = Integer.parseInt(next());
			}
			return arr;
		}

	}

}


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

#include <bits/stdc++.h>

using namespace std;
#define ll long long int

int main()
{
    ll t;
    t = 1;
    //cin t;
    while (t--)
    {
        ll n, m, k;
        cin >> n >> m >> k;
        ll x, y, x1, y1;
        cin >> x >> y >> x1 >> y1;
        int dx[4] = {0, 0, -1, 1};
        int dy[4] = {-1, 1, 0, 0};
        char a[n][m];
        ll dist[n][m];
        bool visited[n][m];
        x--;
        y--;
        x1--;
        y1--;
        if (a[x1][y1] == '@')
        {
            cout << "-1" << endl;
            return 0;
        }
        for (int i = 0; i < n; i++)
        {
            for (int j = 0; j < m; j++)
            {
                dist[i][j] = INT_MAX;
                visited[i][j] = false;
                cin >> a[i][j];
            }
        }
        queue<pair<int, int>> q;
        q.push({x, y});
        visited[x][y] = true;
        dist[x][y] = 0;
        while (!q.empty())
        {
            pair<int, int> temp = q.front();
            q.pop();
            for (int i = 0; i < 4; i++)
            {
                int x2 = temp.first;
                int y2 = temp.second;
                for (int j = 0; j < k; j++)
                {
                    x2 += dx[i];
                    y2 += dy[i];
                    if (x2 >= 0 && x2 < n && y2 >= 0 && y2 < m && a[x2][y2] != '@')
                    {
                        if (!visited[x2][y2])
                        {a
                            visited[x2][y2] = true;
                            q.push({x2, y2});
                            dist[x2][y2] = 1 + dist[temp.first][temp.second];
                        }
                        else
                            dist[x2][y2] = min((ll)dist[x2][y2], (ll)1 + dist[temp.first][temp.second]);
                    }
                    else
                        break;
                }
            }
        }
        if (dist[x1][y1] == INT_MAX)
            cout << "-1" << endl;
        else
            cout << dist[x1][y1] << endl;
    }
}



Compiler output:
a.cc: In function 'int main()':
a.cc:59:27: error: expected ';' before 'visited'
   59 |                         {a
      |                           ^
      |                           ;
   60 |                             visited[x2][y2] = true;
      |                             ~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
typedef long long ll;
typedef pair<ll, ll> l_l;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const ll INFLL = (ll)1e18+1;
const int dx[8] = {1, 0, -1, 0};
const int dy[8] = {0, 1, 0, -1};

l_l dist[1010][1010][10];

int main() {

    ll H, W, K;
    int sx, sy, gx, gy;
    cin >> H >> W >> K;
    cin >> sx >> sy >> gx >> gy;
    sx--, sy--, gx--, gy--;
    vector<string> S(H);
    rep(i,H)cin >> S[i];
    auto f = [&](ll a, ll b){
        return a * W + b;
    };
    auto g = [&](ll c, ll d){
        return c * 4 + d;
    };
    auto h = [&](ll x, ll y, ll z){
        return g(f(x, y), z);
    };
    rep(i,H)rep(j,W)rep(k,4)dist[i][j][k] = {INFLL,INFLL};
    // {{移動回数, K回以下の進行回数}, 座標 }
    priority_queue<pair<l_l,int>,
    vector<pair<l_l,int>>,
    greater<>> pq;

    rep(k,4)pq.push({{0,0},h(sx,sy,k)});
    rep(k,4)dist[sx][sy][k] = {0LL,0LL};

    while(!pq.empty()){
        auto tmp = pq.top();
        pq.pop();
        auto now_dist = tmp.first;
        ll d = tmp.first.first;
        ll cnt = tmp.first.second;
        ll idx = tmp.second;
        ll x = idx/4/W;
        ll y = idx/4%W;
        ll dir = idx % 4;
        //cerr << x+1 << " " << y+1 << " " << dir << " " << now_dist << " " << endl;
        if(dist[x][y][dir] < now_dist)continue;
        rep(j,4){
            int nx = x + dx[j];
            int ny = y + dy[j];
            ll nxt_d = d;
            ll nxt_cnt = cnt;
            if(nx < 0 || H <= nx || ny < 0 || W <= ny)continue;
            if(S[nx][ny] == '@')continue;
            if(j == dir){
                nxt_cnt++;
                if(nxt_cnt == K){
                    nxt_cnt = 0;
                    nxt_d++;
                }
            }
            else{
                nxt_d += nxt_cnt != 0;
                nxt_cnt = 1;
                if(nxt_cnt == K){
                    nxt_cnt = 0;
                    nxt_d++;
                }
            }
            l_l nxt_dist = make_pair(nxt_d, nxt_cnt);
            if(chmin(dist[nx][ny][j], nxt_dist)){
                pq.push({nxt_dist, h(nx, ny, j)});
            }
        }
    }

    l_l ans = {INFLL, INFLL};
    rep(j,4)chmin(ans, dist[gx][gy][j]);
    cout << ((ans.first > N * M)? -1: ans.first + (ans.second != 0)) << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:38:29: warning: narrowing conversion of 'h.main()::<lambda(ll, ll, ll)>(((ll)sx), ((ll)sy), ((ll)k))' from 'long long int' to 'int' [-Wnarrowing]
   38 |     rep(k,4)pq.push({{0,0},h(sx,sy,k)});
      |                            ~^~~~~~~~~
a.cc:84:27: error: 'N' was not declared in this scope
   84 |     cout << ((ans.first > N * M)? -1: ans.first + (ans.second != 0)) << endl;
      |                           ^
a.cc:84:31: error: 'M' was not declared in this scope
   84 |     cout << ((ans.first > N * M)? -1: ans.first + (ans.second != 0)) << endl;
      |                               ^
Language: C++

#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;

struct G{
  int a, b, c, d, e;
};

operator> (G a, G b){
  return a.e < b.e;
}

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

int main(){
  int h, w, K;
  cin >> h >> w >> K;
  int x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  vector<vector<int>> f(h, vector<int>(w, 154966));
  vector<vector<char>> pond(h, vector<char>(w));
  for(int i = 0; i < h; i ++){
    string str; cin >> str;
    for(int j = 0; j < w; j ++)
      pond[i][j] = str[j];
  }
  priority_queue<G, vector<G>, greater<G>> q;
  q.push({x1 - 1, y1 - 1, 0, 0, 1});
  q.push({x1 - 1, y1 - 1, 0, 1, 1});
  q.push({x1 - 1, y1 - 1, 0, 2, 1});
  q.push({x1 - 1, y1 - 1, 0, 3, 1});
  while(!q.empty()){
    auto [x, y, z, k, d] = q.top(); // row, column, passed in direction k, distance
    q.pop();
    if(f[x][y] < d)
      continue;
    f[x][y] = d;
    if(z == K)
      k = -1, z = 0;
    for(int i = 0; i < 4; i ++){
      if(x + dx[i] < h && x + dx[i] >= 0 &&
         y + dy[i] < w && y + dy[i] >= 0 && pond[x + dx[i]][y + dy[i]] != '@'){
            if(i == k){
              if(f[x + dx[i]][y + dy[i]] >= f[x][y])
                q.push({x + dx[i], y + dy[i], z + 1, i, f[x][y]});
            }else{
              if(f[x + dx[i]][y + dy[i]] >= f[x][y] + 1)
                q.push({x + dx[i], y + dy[i], 1, i, f[x][y] + 1});
            }
         }
    }
  }
//  for(int i = 0; i < h; i ++){
//    cout << endl;
//    for(int j = 0; j < w; j ++){
//      if(f[i][j] > 100)
//        cout << "@";
//      else
//        cout << f[i][j];
//      cout << " ";
//    }
//  }
  cout << f[x2 - 1][y2 - 1];
}


Compiler output:
a.cc:10:1: error: ISO C++ forbids declaration of 'operator>' with no type [-fpermissive]
   10 | operator> (G a, G b){
      | ^~~~~~~~
Language: Java

import java.util.*;
import java.io.*;
public class ABC170F{
   public static void main(String[] main) throws Exception{
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      StringTokenizer st = new StringTokenizer(br.readLine());
      PrintWriter out = new PrintWriter(System.out);
      int h = Integer.parseInt(st.nextToken());
      int w = Integer.parseInt(st.nextToken());
      int k = Integer.parseInt(st.nextToken());
      st = new StringTokenizer(br.readLine());
      int a = Integer.parseInt(st.nextToken())-1;
      int b = Integer.parseInt(st.nextToken())-1;
      int c = Integer.parseInt(st.nextToken())-1;
      int d = Integer.parseInt(st.nextToken())-1;
      String[] map = new String[h];
      int[][] len = new int[h][w];
      for(int i = 0; i < h; i++) {
    	  map[i] = br.readLine();
      	  for(int j = 0; j < w; j++)
      		  len[i][j] = -1;
      }
      Queue<Integer> curr = new LinkedList<Integer>();
      curr.add(c*w+d);
      len[c][d] = 0;
      while(curr.size() > 0) {
    	  int temp = curr.remove();
    	  int x = temp/w;
    	  int y = temp%w;
    	  int val = len[x][y];
    	  x--;
    	  while(x >= Math.max(temp/w - k,0) && map[x].charAt(y) == '.') {
    		  if(len[x][y] == -1) {
    			  len[x][y] = val + 1;
    			  curr.add(x*w+y);
    		  }
    		  x--;
    	  }
    	  x = temp/w + 1;
    	  while(x < Math.min(temp/w+k+1,h) && map[x].charAt(y) == '.') {
    		  if(len[x][y] == -1) {
    			  len[x][y] = val + 1;
    			  curr.add(x*w+y);
    		  }
    		  x++;
    	  }
    	  x = temp/w;
    	  y--;
    	  while(y >= Math.max(temp%w - k,0) && map[x].charAt(y) == '.') {
    		  if(len[x][y] == -1) {
    			  len[x][y] = val + 1;
    			  curr.add(x*w+y);
    		  }
    		  y--;
    	  }
    	  y = temp%w + 1;
    	  while(y < Math.min(temp%w+k+1,w) && map[x].charAt(y) == '.') {
    		  if(len[x][y] == -1) {
    			  len[x][y] = val + 1;
    			  curr.add(x*w+y);
    		  }
    		  y++;
    	  }
      }
      out.println(len[a][b]);
      out.close();
   }
}

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

#include <stdio.h>
#include <algorithm>
#include <queue>
using namespace std;

struct phase{
	int x,y,d; pair<int, int> c;
  bool operator <(const phase &t) const{
    if (c.first == t.c.first) return c.second < t.c.second;
return c.first > t.c.first;
  }
};

int n,m,k;
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};
int sx,sy, ex,ey;

char map[10001001];
phase e[1001001][2];

priority_queue<phase> q;
void enque(int x, int y, int d, pair<int, int> c)
{
  phase p{x,y,d,c};
  if (e[x*m+y][d] < p){
e[x*m+y][d] = p;
    q.push(p);
  }
}

int main()
{
  scanf ("%d %d %d",&n,&m,&k);
  scanf ("%d %d %d %d",&sx,&sy,&ex,&ey);
  for (int i=0;i<n;i++) scanf ("%s",map+i*m);
  for (int i=0;i<n*m;i++) e[i][0] = e[i][1] = {0,0,0,{100000000, 0}};
enque(sx, sy, 0, {0,0});
enque(sx, sy, 1, {0,0});
  while (!q.empty()){
int x = q.top().x;
int y = q.top().y;
int d = q.top().d;
    auto c = q.top().c;
    q.pop();
    
    if (e[x*m+y][d].c != c) continue;
    for (int k=0;k<4;k++){
int px= x+dx[k];
      int py = y + dy[k];
      if (px < 0 || px >= n || py < 0 || py >= m || map[px*m+py] == '@') continue;
      enque(px,py,k%2,{c.first+1,K-1});
      if (c.second && k % 2 == d){
      enque(px,py,k%2,{c.first,c.second-1});
      }
    }
  }
  
  int ans = min(e[ex*m+ey][0].c.first,e[ex*m+ey][1].c.first);
  if (ans == 100000000) ans = -1;
  printf ("%d\n",ans);
  
 return 0; 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:52:34: error: 'K' was not declared in this scope
   52 |       enque(px,py,k%2,{c.first+1,K-1});
      |                                  ^
a.cc:52:12: error: could not convert '{(c.std::pair<int, int>::first + 1), <expression error>}' from '<brace-enclosed initializer list>' to 'std::pair<int, int>'
   52 |       enque(px,py,k%2,{c.first+1,K-1});
      |       ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |            |
      |            <brace-enclosed initializer list>
Language: C++

#include <stdio.h>
#include <algorithm>
#include <queue>
using namespace std;

struct phase{
	int x,y,d; pair<int, int> c;
  bool operator <(const phase &t) const{
    if (c.first == t.c.first) return c.second < t.c.second;
return c.first > t.c.first;
  }
};

int n,m,k;
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};
int sx,sy, ex,ey;

char map[10001001];
phase e[1001001][2];

priority_queue<phase> q;
void enque(int x, int y, int d, pair<int, int> c)
{
  phase p{x,y,d,c};
  if (e[x*m+y][d] < p){
e[x*m+y][d] = p;
    q.push(p);
  }
}

int main()
{
  scanf ("%d %d %d",&n,&m,&k);
  scanf ("%d %d %d %d",&sx,&sy,&ex,&ey);
  for (int i=0;i<n;i++) scanf ("%s",map+i*m);
  for (int i=0;i<n*m;i++) e[i][0] = e[i][1] = {0,0,0,{100000000, 0}};
enque(sx, sy, 0, {0,0});
enque(sx, sy, 1, {0,0});
  while (!Q.empty()){
int x = Q.top().x;
int y = Q.top().y;
int d = Q.top().d;
    auto c = Q.top().c;
    Q.pop();
    
    if (e[x*m+y].c != c) continue;
    for (int k=0;k<4;k++){
int px= x+dx[k];
      int py = y + dy[k];
      if (px < 0 || px >= n || py < 0 || py >= m || map[px*m+py] == '@') continue;
      enque(px,py,k%2,{c.first+1,K-1});
      if (c.second && k % 2 == d){
      enque(px,py,k%2,{c.first,c.second-1});
      }
    }
  }
  
  int ans = min(e[ex*m+ey][0].c.first,e[ex*m+ey][1].c.first);
  if (ans == 100000000) ans = -1;
  printf ("%d\n",ans);
  
 return 0; 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:11: error: 'Q' was not declared in this scope
   40 |   while (!Q.empty()){
      |           ^
a.cc:47:18: error: request for member 'c' in 'e[((x * m) + y)]', which is of non-class type 'phase [2]'
   47 |     if (e[x*m+y].c != c) continue;
      |                  ^
a.cc:52:34: error: 'K' was not declared in this scope
   52 |       enque(px,py,k%2,{c.first+1,K-1});
      |                                  ^
a.cc:52:12: error: could not convert '{<expression error>, <expression error>}' from '<brace-enclosed initializer list>' to 'std::pair<int, int>'
   52 |       enque(px,py,k%2,{c.first+1,K-1});
      |       ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |            |
      |            <brace-enclosed initializer list>
a.cc:54:12: error: could not convert '{<expression error>, <expression error>}' from '<brace-enclosed initializer list>' to 'std::pair<int, int>'
   54 |       enque(px,py,k%2,{c.first,c.second-1});
      |       ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |            |
      |            <brace-enclosed initializer list>
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
 
const int N = 1e5 + 5;
 
int n, m, k;
int x11, y11, x2, y2;
int dx[4]={-1, +1, 0, 0};
int dy[4]={0, 0, +1, -1};
vector<vector<char> > a;
vector<vector<int> > vis, ways, dist;
 
void bfs(int x, int y)
{
	queue<pair<int, int> > q;
	q.push({x, y});
	vis[x][y] = 1;
	dist[x][y] = 0;
	while(!q.empty())
	{
		int x=q.front().first;
		int y=q.front().second;
		q.pop();
		for(int dir=0;dir<4;dir++)
		{
			for(int len = 1; len <= k; len++)
			{
				int nx=x+dx[dir] * len;
				int ny=y+dy[dir] * len;
				if(nx<1 || ny<1 || nx>n || ny>m)
					break;
				if(a[nx][ny] == '@')
					break;
				if(vis[nx][ny])
					break
				dist[nx][ny]=dist[x][y]+1;
				vis[nx][ny]=1;
				q.push({nx, ny});
			}
		}
	}
}
 
int32_t main()
{
	IOS;
	cin >> n >> m >> k;
	cin >> x11 >> y11 >> x2 >> y2;
	a = vector<vector<char> > (n + 1, vector<char> (m + 1));
	vis = ways = dist = vector<vector<int> > (n + 1, vector<int> (m + 1, 0));
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++)
			cin >> a[i][j];
	bfs(x11, y11);
	if(!vis[x2][y2])
		cout << -1;
	else
		cout << dist[x2][y2];
	return 0;
}


Compiler output:
a.cc: In function 'void bfs(int, int)':
a.cc:38:46: error: expected ';' before 'dist'
   38 |                                         break
      |                                              ^
      |                                              ;
   39 |                                 dist[nx][ny]=dist[x][y]+1;
      |                                 ~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ii = pair<int, int>;

const ll oo { 1LL << 62 };

const vector<ii> dirs { ii(-1, 0), ii(1, 0), ii(0, -1), ii(0, 1) };

ll solve(int H, int W, int K, int x1, int y1, int x2, int y2, vector<vector<ll>>& xs,
vector<int>& rs, vector<int>& cs)
{
    queue<ii> q;
    q.push(ii(x2, y2));

    vector<vector<int>> found(H + 2, vector<int>(W + 2, 0));

    xs[x2][y2] = 0;
    found[x2][y2] = 1;
    ++rs[x2];
    ++cs[y2];

    while (not q.empty())
    {
        auto p = q.front();
        q.pop();

        auto x = p.first, y = p.second;
        auto dist = xs[x][y] + 1;

        for (auto d : dirs)
        {
            auto dx = d.first, dy = d.second;
            auto u = x + dx, v = y + dy;

            while (u > 0 and u <= H and v > 0 and v <= W and abs(u - x) <= K and abs(v - y) <= K
                and xs[u][v] != oo)
            {
                if (not found[u][v])
                {
                    found[u][v] = 1;
                    ++rs[u];
                    ++cs[v];
                    q.push(ii(u, v));
                    xs[u][v] = dist;
                } else
                {
                    xs[u][v] = xs[u][v] == -1 ? dist : min(dist, xs[u][v]);

                    if ((dx and rs[u] == H) or (dy and cs[v] == W))
                        break;
                }
                    
                u += dx;
                v += dy;
            }
        }
#ifdef DEBUG
    cout << "(" << x << ", " << y << "), xs = " << endl;
    for (int x = 1; x <= H; ++x)
        for (int y = 1; y <= W; ++y)
            cout << setw(3) << (xs[x][y] == oo ? -9 : xs[x][y]) << (y == W ? '\n' : ' ');
#endif
    }

#ifdef DEBUG
    cout << "--- x1 = " << x1 << ", y1 = " << y1 << ", xs = " << xs[x1][y1] << endl;
#endif

    return xs[x1][y1];
}

int main()
{
    ios::sync_with_stdio(false);

    int H, W, K;
    cin >> H >> W >> K;

    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;

    vector<vector<ll>> xs(H + 2, vector<ll>(W + 2, -1));
    vector<int> rs(H, 0), cs(W, 0);

    for (int i = 1; i <= H; ++i)
    {
        string s;
        cin >> s;

        for (int j = 1; j <= W; ++j)
        {
            if (s[j - 1] == '@')
            {
                ++rs[i];
                ++cs[j];
                xs[i][j] = oo;
        }
    }

    auto ans = solve(H, W, K, x1, y1, x2, y2, xs, rs, cs);

    cout << ans << '\n';

    return 0;
}


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

#include<iostream>
#include<cstdio>
#include<queue>
using namespace std;
const int N=1e6+5;
struct node{
	int x,y,num,count,t;
}p,f;
int move[3][5]={0,0,0,0,0,0,0,1,0,-1,0,1,0,-1,0};
queue<node> q;

int main(){
	int n,m,k,i,j,x1,x2,y1,y2,x,y;
	scanf("%d%d%d",&n,&m,&k);
	scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
	int a[n+1][m+1];
	int visited[n+1][m+1];
	char c;
	
	for(i=1;i<=n;++i)
		for(j=1;j<=m;++j){
			cin>>c;
			if(c=='.') a[i][j]=1;
			else a[i][j]=0;
		}
	
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++) 
			visited[i][j]=0;
	f.x=x1,f.y=y1,f.count=1,f.num=0;f.t=0;
	visited[x1][y1]=true;
	q.push(f);
	
	while(!q.empty()){
		f=q.front();
		for(i=1;i<=4;++i){
			x=f.x+move[1][i];y=f.y+move[2][i];
			if(!visited[x][y] && a[x][y] && x>=1 && x<=n && y>=1 && y<=m){
				p.x=x;p.y=y;
				if(f.t==i || f.t==0){
					p.t=i;
					if(f.num>=k){
						p.num=1;p.count=f.count+1;
					}
					else{
						p.num=f.num+1;p.count=f.count;
					}
				}
				else{
					p.t=i;
					p.num=1;p.count=f.count+1;
				}
				q.push(p);
				visited[x][y]=true;
				if(x==x2 && y==y2){
					printf("%d",p.count);
					return 0;
				}
			}
		}
		q.pop();
	}
	
	printf("%d",-1);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:31: error: reference to 'move' is ambiguous
   37 |                         x=f.x+move[1][i];y=f.y+move[2][i];
      |                               ^~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
In file included from /usr/include/c++/14/bits/exception_ptr.h:41,
                 from /usr/include/c++/14/exception:166,
                 from /usr/include/c++/14/ios:41:
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:9:5: note:                 'int move [3][5]'
    9 | int move[3][5]={0,0,0,0,0,0,0,1,0,-1,0,1,0,-1,0};
      |     ^~~~
a.cc:37:48: error: reference to 'move' is ambiguous
   37 |                         x=f.x+move[1][i];y=f.y+move[2][i];
      |                                                ^~~~
/usr/include/c++/14/bits/stl_algobase.h:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:9:5: note:                 'int move [3][5]'
    9 | int move[3][5]={0,0,0,0,0,0,0,1,0,-1,0,1,0,-1,0};
      |     ^~~~
Language: C

#include<bits/stdc++.h>
using namespace std;
const int N=1e6+5;
struct node{
	int x,y,num,count,t;
}p,f;
int move[3][5]={0,0,0,0,0,0,0,1,0,-1,0,1,0,-1,0};
queue<node> q;

int main(){
	int n,m,k,i,j,x1,x2,y1,y2,x,y;
	scanf("%d%d%d",&n,&m,&k);
	scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
	int a[n+1][m+1];
	int visited[n+1][m+1];
	char c;
	
	for(i=1;i<=n;++i)
		for(j=1;j<=m;++j){
			cin>>c;
			if(c=='.') a[i][j]=1;
			else a[i][j]=0;
		}
	
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++) 
			visited[i][j]=0;
	f.x=x1,f.y=y1,f.count=1,f.num=0;f.t=0;
	visited[x1][y1]=true;
	q.push(f);
	
	while(!q.empty()){
		f=q.front();
		for(i=1;i<=4;++i){
			x=f.x+move[1][i];y=f.y+move[2][i];
			if(!visited[x][y] && a[x][y] && x>=1 && x<=n && y>=1 && y<=m){
				p.x=x;p.y=y;
				if(f.t==i || f.t==0){
					p.t=i;
					if(f.num>=k){
						p.num=1;p.count=f.count+1;
					}
					else{
						p.num=f.num+1;p.count=f.count;
					}
				}
				else{
					p.t=i;
					p.num=1;p.count=f.count+1;
				}
				q.push(p);
				visited[x][y]=true;
				if(x==x2 && y==y2){
					printf("%d",p.count);
					return 0;
				}
			}
		}
		q.pop();
	}
	
	printf("%d",-1);
	return 0;
}

Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
const int MAXN=100005;
const int inf=0x3f3f3f3f;
const int dx[]={0,0,1,-1};
const int dy[]={1,-1,0,0};
struct node{int x,y,l,f,d;};
int n,m,k,i,j,p1,q1,p2,q2,ans=inf;
char ch,c[MAXN][MAXN];
bool vis[MAXN][MAXN];
std::queue<node> q;
inline void read(int &x)
{
	short negative=1;
    x=0;
    char c=getchar();
    while(c<'0' || c>'9')
    {
    	if(c=='-')
			negative=-1;
		c=getchar();
	}
    while(c>='0' && c<='9')
        x=(x<<3)+(x<<1)+(c^48),c=getchar();
    x*=negative;
}
inline void print(int x)
{
    if (x<0)
        putchar('-'),x=-x;
    if (x>9)
        print(x/10);
    putchar(x%10+'0');
}
signed main(void)
{
	read(n),read(m),read(k);
	read(p1),read(q1),read(p2),read(q2);
	for (i=1;i<=n;i++)
		for (j=1;j<=m;j++)
		{
			ch=getchar();
			while (ch!='.' && ch!='@')
				ch=getchar();
			c[i][j]=ch;
		}
	q.push(node{p1,q1,0,0,1});
	q.push(node{p1,q1,0,1,1});
	q.push(node{p1,q1,0,2,1});
	q.push(node{p1,q1,0,3,1});
	while (!q.empty())
	{
		node u=q.front();
		q.pop();
		vis[u.x][u.y]=true;
		if (u.x==p2 && u.y==q2)
			ans=std::min(ans,u.d);
		for (i=0;i<4;i++)
		{
			node v=node{u.x+dx[i],u.y+dy[i],1,i,u.d+1};
			if (v.x<1 || v.x>n || v.y<1 || v.y>m || vis[v.x][v.y] || c[v.x][v.y]=='@')
				continue;
			if (i==u.f && u.l<k)
				v.d--,v.l=u.l+1;
			q.push(v);
		}
	}
	print(ans==inf?-1:ans);
	return 0;
} 

Compiler output:
/tmp/ccWoT6IV.o: in function `main':
a.cc:(.text+0x15f): relocation truncated to fit: R_X86_64_PC32 against symbol `q' defined in .bss section in /tmp/ccWoT6IV.o
a.cc:(.text+0x19c): relocation truncated to fit: R_X86_64_PC32 against symbol `q' defined in .bss section in /tmp/ccWoT6IV.o
a.cc:(.text+0x1d9): relocation truncated to fit: R_X86_64_PC32 against symbol `q' defined in .bss section in /tmp/ccWoT6IV.o
a.cc:(.text+0x216): relocation truncated to fit: R_X86_64_PC32 against symbol `q' defined in .bss section in /tmp/ccWoT6IV.o
a.cc:(.text+0x22a): relocation truncated to fit: R_X86_64_PC32 against symbol `q' defined in .bss section in /tmp/ccWoT6IV.o
a.cc:(.text+0x25a): relocation truncated to fit: R_X86_64_PC32 against symbol `q' defined in .bss section in /tmp/ccWoT6IV.o
a.cc:(.text+0x284): relocation truncated to fit: R_X86_64_PC32 against symbol `vis' defined in .bss section in /tmp/ccWoT6IV.o
a.cc:(.text+0x3cc): relocation truncated to fit: R_X86_64_PC32 against symbol `vis' defined in .bss section in /tmp/ccWoT6IV.o
a.cc:(.text+0x455): relocation truncated to fit: R_X86_64_PC32 against symbol `q' defined in .bss section in /tmp/ccWoT6IV.o
a.cc:(.text+0x485): relocation truncated to fit: R_X86_64_PC32 against symbol `q' defined in .bss section in /tmp/ccWoT6IV.o
/tmp/ccWoT6IV.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x4cb): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

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

int main(){

  int  height,width,K;
  cin >> height >> width >> K;

  int startX,startY;
  int goalX,goalY;
  cin >> startY >> startX;startX--;startY--;
  cin >> goalY >> goalX;goalX--;goalY--;

  //BFS
  queue<pair<int,int>> que;
  que.push({startX,startY});
  vector<vector<int>> dist(width,vector<int>(height,-1));
  dist[startX][startY]=0;
  int dx,dy;
  pair<int,int> P;
  vector<vector<char>> mp(width,vector<char>(height));
  for(int y=0;y<height;y++){
    for(int x=0;x<width;x++){
      cin >> mp[x][y];
    }
  }

  int dirctX[4] = {1,-1,0,0};
  int dirctY[4] = {0,0,1,-1};
  int nx=0,ny=0;
  while(!que.empty()){
    P = que.front();
    que.pop();
    dx=P.first;
    dy=P.second;

    for(int i=0;i<4;i++){
      nx=dx;
      ny=dy;
      for(int j=0;j<K;j++){
        if(i==0){
          nx+=1;
        }else if(i==1){
          nx-=1;
        }else if(i==2){
          ny+=1;
        }else{
          ny-=1;
        }
        if(nx>=width || nx<0 || ny>=height || ny<0 || mp[nx][ny]=='@') break;

        if(dist[nx][ny]==-1){
          que.push(make_pair(nx,ny));
          dist[nx][ny]=dist[dx][dy]+1;
        }

        if(nx==goalX && ny==goalY){
          cout << dist[nx][ny] << endl;
          return 0;
        }
      }
    }

    }
  }

  cout << -1 << endl;
}

Compiler output:
a.cc:67:3: error: 'cout' does not name a type
   67 |   cout << -1 << endl;
      |   ^~~~
a.cc:68:1: error: expected declaration before '}' token
   68 | }
      | ^