criyle/codenet-compile-errors huggingface dataset:
Language: Java

import java.util.*;
import java.math.*;
public class Solution {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = Integer.parseInt(in.next());
		int m = Integer.parseInt(in.next());
		int x = Integer.parseInt(in.next()) - 1;
		int y = Integer.parseInt(in.next()) - 1;
		int xx = Integer.parseInt(in.next()) - 1;
		int yy = Integer.parseInt(in.next()) - 1;
		char[][] grid = new char[n][m];
		Node[][] nodes = new Node[n][m];
		int[][] seen = new int[n][m];
		List<Node> queue = new ArrayList<>();
		for(int i = 0; i < n; i++) {
			String cur = in.next();
			grid[i] = cur.toCharArray();
		}
		seen[x][y] = 1;
		dfs(grid, seen, x, y, n, m);
		if((grid[x][y] == '#') || (grid[xx][yy] == '#')) {
			System.out.println("-1");
		}else if(seen[xx][yy] == 1) {
			System.out.println(0);
		}else {
			queue.add(new Node(xx, yy, 0));
			int cnt = 0;
			int ans = -1;
			main:
			while(cnt < queue.size()) {
				int a = queue.get(cnt).x;
				int b = queue.get(cnt).y;
				for(int i = Math.max(0, a - 2); i <= Math.min(n - 1, a + 2); i++) {
					for(int j = Math.max(0, b - 2); j <= Math.min(m - 1, b + 2); j++) {
						if(grid[i][j] == '#') continue;
						if(seen[i][j] == 2) continue;
						if(seen[i][j] == 0) {
							seen[i][j] = 2;
							queue.add(new Node(i, j, queue.get(cnt).time + 1));
						}else {
							ans = queue.get(cnt).time + 1;
							break main;
						}
					}
				}
				cnt += 1;
			}
			System.out.println(ans);
		}
	}
	public static void dfs(char[][] grid, int[][] seen, int i, int j, int n, int m) {
		int[] a = {1, -1, 0, 0};
		int[] b = {0, 0, 1, -1};
		for(int k = 0; k < 4; k++) {
			int x = i + a[k];
			int y = j + b[k];
			if((x < 0) || (x >= n)) continue;
			if((y < 0) || (y >= m)) continue;
			if(seen[x][y] == 1) continue;
			if(grid[x][y] == '#') continue;
			seen[x][y] = 1;
			dfs(grid, seen, x, y, n, m);
		}
	}
}
class Node {
	int x;
	int y;
	int time;
	public Node(int x, int y, int time) {
		this.x = x;
		this.y = y;
		this.time = time;
	}
}

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

/*** akshaykumar99 ***/
 
#include<bits/stdc++.h> 
using namespace std;
 
const long long MOD = 1e9+7;
const long double PI = acos(-1);
const long long N = 5e2+1;
 
#define ll int
// typedef long long ll;
typedef long double ld;

void test_case()
{
	ll h, w, ch, cw, dh, dw;
	cin >> h >> w >> ch >> cw >> dh >> dw;
	string s[h];
	for(int i = 0; i < h; i++)
	{
		cin >> s[i];
	}
	if(s[ch-1][cw-1] == '#')
	{
		cout << -1 << '\n';
		return;
	}
	ch--, cw--, dh--, dw--;
	ll dp[h][w];
	for(int i = 0; i < h; i++)
	{
		for(int j = 0; j < w; j++)
			dp[i][j] = INT_MAX;
	}
	priority_queue<array<ll,3>> q;
	q.push({0,ch, cw});
	dp[ch][cw] = 0;
	ll dx[] = {-2, -1, 0, 1, 2};
	ll dy[] = {-2, -1, 0, 1, 2};
	ll dxx[] = {-1, 1, 0, 0};
	ll dyy[] = {0, 0, -1, 1};
	while(!q.empty())
	{
		int x = q.top()[1], y = q.top()[2], z = -q.top()[0];
		q.pop();
		if(x == dh && y == dw)
		{
			cout << dp[dx][dy] << '\n';
			return;
		}
		if(dp[x][y] < z)
			continue;
		for(int i = 0; i < 4; i++)
		{
			if((x + dxx[i] >= 0) && (x + dxx[i] < h) && (y + dyy[i] >= 0) && (y + dyy[i] < w))
			{
				if((s[x + dxx[i]][y + dyy[i]] != '#') && (dp[x + dxx[i]][y + dyy[i]] > dp[x][y]))
				{
					dp[x+dxx[i]][y+dyy[i]] = dp[x][y];
					q.push({-dp[x+dxx[i]][y+dyy[i]], x+dxx[i], y+dyy[i]});
				}
			}
		}
		for(int i = 0; i < 5; i++)
		{
			for(int j = 0; j < 5; j++)
			{
				if((x + dx[i] >= 0) && (x + dx[i] < h) && (y + dy[j] >= 0) && (y + dy[j] < w))
				{
					if((s[x + dx[i]][y + dy[j]] != '#') && (dp[x + dx[i]][y + dy[j]] > dp[x][y] + 1))
					{
						dp[x+dx[i]][y+dy[j]] = dp[x][y] + 1;
						q.push({-dp[x+dx[i]][y+dy[j]], x+dx[i], y+dy[j]});
					}
				}
			}
		}
	}
	if(dp[dh][dw] == INT_MAX)
		cout << -1 << '\n';
	else
		cout << dp[dh][dw] << '\n';
}
 
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL); 
    ll tc=1;
    // cin>>tc;
    while(tc--)
        test_case();
    return 0;
}

Compiler output:
a.cc: In function 'void test_case()':
a.cc:48:35: error: invalid types 'int [h][w][int [5]]' for array subscript
   48 |                         cout << dp[dx][dy] << '\n';
      |                                   ^
Language: C++

#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define REP(i, n) for(int i = 0; i < n; ++i)
using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

class Graph
{
private:
	int m_nodeNum;
	vector<vector<int>> m_adList;
	vector<vector<int>> m_warpList;

public:
	Graph(const int N) : m_nodeNum(N)
	{
		m_adList = vector<vector<int>>(N);
		m_warpList = vector<vector<int>>(N);
	}

	void AddEdge(const int v, const int u)
	{
		m_adList[v].push_back(u);
	}

	void AddWarpEdge(const int v, const int u)
	{
		m_warpList[v].push_back(u);
	}

	const int DFS(const int g, const int s)
	{
		const int INF = 1'000'000'000;
		vector<int> warps(m_nodeNum, INF);
		warps[s] = 0;
		deque<int> q{ s };
		while (!q.empty())
		{
			for (const int n : m_warpList[v])
			{
				if (warps[n] > warps[v] + 1)
				{
					q.push_back(n);
					warps[n] = warps[v] + 1;
				}
			}
			int v = q.front(); q.pop_front();
			for (const int n : m_adList[v])
			{
				if (warps[n] > warps[v])
				{
					q.push_back(n);
					warps[n] = warps[v];
				}
			}
		}
		if (warps[g] == INF) return -1;
		return warps[g];
	}
};

int main()
{
	int H, W; cin >> H >> W;
	int ch, cw, dh, dw; cin >> ch >> cw >> dh >> dw; --ch; --cw; --dh; --dw;
	vector<char> grids(H * W);
	REP(i, H * W) cin >> grids[i];
	Graph g(H * W);
	REP(i, H * W)
	{
		if (grids[i] == '#') continue;
		const int r = i / W;
		const int c = i % W;
		// 上下左右
		if (r > 0 && grids[i - W] == '.')
		{
			g.AddEdge(i, i - W);
		}
		if (r < H - 1 && grids[i + W] == '.')
		{
			g.AddEdge(i, i + W);
		}
		if (c > 0 && grids[i - 1] == '.')
		{
			g.AddEdge(i, i - 1);
		}
		if (c < W - 1 && grids[i + 1] == '.')
		{
			g.AddEdge(i, i + 1);
		}
		// ワープ
		for (int r2 = max(0, r - 2); r2 <= min(H - 1, r + 2); ++r2)
		{
			for (int c2 = max(0, c - 2); c2 <= min(W - 1, c + 2); ++c2)
			{
				if (abs(r - r2) + abs(c - c2) <= 1) continue;
				if (grids[r2 * W + c2] == '.')
				{
					g.AddWarpEdge(i, r2 * W + c2);
				}
			}
		}
	}
	cout << g.DFS(ch * W + cw, dh * W + dw) << endl;
}


Compiler output:
a.cc: In member function 'const int Graph::DFS(int, int)':
a.cc:50:55: error: 'v' was not declared in this scope
   50 |                         for (const int n : m_warpList[v])
      |                                                       ^
Language: C++

#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

vector<pair<int,int>> dir{{-1,0},{1,0},{0,1},{0,-1}};
vector<pair<int,int>> dir2;

void init()
{
	for(int i=-2;i<=2;++i)
	{
		for(int j=-2;j<=2;++j)
		{
			if(abs(i+j)==1 && i==0 || j==0) continue;
			dir2.push_back({i,j});
		}
	}
}

int main()
{
	init();
	ll n,m;
	cin>>n>>m;

	ll x,y,a,b;
	cin>>x>>y>>a>>b;

	vector<string> s(n);
	int dp[n+1][m+1];

	for(int i=0;i<=n;++i) for(int j=0;j<=m;++j) dp[i][j]=INT_MAX;

	for(int i=0;i<n;++i) cin>>s[i];

	if(s[x-1][y-1]=='#' || s[a-1][b-1]=='#')
	{
		cout<<-1<<endl;
		return 0;
	}

	queue<pair<int,int>> qu;
	qu.push({x,y});
	dp[x][y]=0;
	while(!qu.empty())
	{
		auto pt=qu.front();
		qu.pop();

		int p=pt.first,q=pt.second;
		for(auto j:dir)
		{
			p+=j.first,q+=j.second;
			if(!(p<=0 || p>n || q<=0 || q>m))
			{
				if(s[p-1][q-1]!='#' && dp[p][q]>dp[p-j.first][q-j.second])
				{
					dp[p][q]=dp[p-j.first][q-j.second];
					qu.push({p,q});
				}
			}
			p-=j.first,q-=j.second;
		}
		for(auto j:dir2)
		{
			p+=j.first,q+=j.second;
			if(!(p<=0 || p>n || q<=0 || q>m))
			{
				if(s[p-1][q-1]!='#' && dp[p][q]>dp[p-j.first][q-j.second]+1)
				{
					dp[p][q]=dp[p-j.first][q-j.second]+1;
					qu.push({p,q});
				}
			}
			p-=j.first,q-=j.second;
		}
		//cout<<"wtf\n";
	}

	if(dp[a][b]==INT_MAX]) dp[a][b]=-1;
	cout<<dp[a][b]<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:81:29: error: expected ')' before ']' token
   81 |         if(dp[a][b]==INT_MAX]) dp[a][b]=-1;
      |           ~                 ^
a.cc:81:29: error: expected primary-expression before ']' token
Language: C++

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>

using namespace std;

const int N = 1e5 + 10;

char s[N][N];

typedef pair<int, int> PII;

int n, m;
bool st[N][N];

struct node{
	int x, y;
	int step;
};

node start;
node endt;

void bfs(){
	int dx[20] = {-1, 0, 1, 0, -2, -2, -2, -2, -2, -1, 0, 1, 2, 2, 2, 2, 2, 1, 0, -1};
	int dy[20] = {0, 1, 0, -1, -2, -1, 0, 1, 2, 2, 2, 2, 2, 1, 0, -1, -2, -2, -2, -2};
	
	queue<node> q;
	q.push(start);
	while(q.size()){
		auto t = q.front();
		q.pop();
		
	//	cout << t.x << " " << t.y << " " << t.step << endl;
		
		if (t.x == endt.x && t.y == endt.y){
			cout << t.step << endl;
			return;
		}
		
		for (int i = 0; i < 20; i ++){
			int x = t.x + dx[i], y = t.y + dy[i];
			
			if (st[x][y])   continue;
			st[x][y] = true;
			if (s[x][y] == '#')  continue;
			if (x < 1 || x > n || y < 1 || y > m)   continue;
			if (i < 4){
				q.push({x, y, t.step});
			}
			else {
				q.push({x, y, t.step + 1});
			}
		}
	}
	if (!q.size())  {
		cout << -1 << endl;
		return;
	} 
}

int main(){
	int x, y;
	scanf("%d%d", &n, &m);
	scanf("%d%d", &x, &y);
	start = {x, y, 0};
	st[x][y] = true;
	int x1, y1;
	scanf("%d%d", &x1, &y1);
	endt = {x1, y1, -1};
	getchar();
	for (int i = 1; i <= n; i ++)
	    scanf("%s", s[i] + 1);
	    
	    
	    bfs();
	    
	    return 0;
}

Compiler output:
/tmp/ccyuzBGY.o: in function `bfs()':
a.cc:(.text+0x185): relocation truncated to fit: R_X86_64_PC32 against symbol `start' defined in .bss section in /tmp/ccyuzBGY.o
a.cc:(.text+0x1d2): relocation truncated to fit: R_X86_64_PC32 against symbol `endt' defined in .bss section in /tmp/ccyuzBGY.o
a.cc:(.text+0x1e2): relocation truncated to fit: R_X86_64_PC32 against symbol `endt' defined in .bss section in /tmp/ccyuzBGY.o
a.cc:(.text+0x26f): relocation truncated to fit: R_X86_64_PC32 against symbol `st' defined in .bss section in /tmp/ccyuzBGY.o
a.cc:(.text+0x299): relocation truncated to fit: R_X86_64_PC32 against symbol `st' defined in .bss section in /tmp/ccyuzBGY.o
a.cc:(.text+0x2d9): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccyuzBGY.o
a.cc:(.text+0x2ea): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccyuzBGY.o
/tmp/ccyuzBGY.o: in function `main':
a.cc:(.text+0x415): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccyuzBGY.o
a.cc:(.text+0x41f): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccyuzBGY.o
a.cc:(.text+0x461): relocation truncated to fit: R_X86_64_PC32 against symbol `start' defined in .bss section in /tmp/ccyuzBGY.o
a.cc:(.text+0x467): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using vll = vector<ll> ;
#define all(v) v.begin(),v.end()
 
#define P pair<int,int>
#define INF 1e9
 
int H,W;
vector<string> c;
int dx[4]{0,0,1,-1};
int dy[4]{1,-1,0,0};
vector<vector<ll>> dist;

void bfs(P s){
  queue<P> que,que2;
  que.push(s);que2.push(s);
  //cout << dist[s.first][s.second] << endl;
  while(!que.empty()){
    P q = que.front();que.pop();
    int x=q.first,y=q.second;
    rep(i,4){
      int nx=x+dx[i],ny=y+dy[i];
      if(nx<0 || nx>=H || ny<0 || ny>=W) continue;
      if(dist[nx][ny]<=1e5) continue;
      else{
        if(c[nx][ny]=='.'){
        dist[nx][ny]=dist[x][y];
        que.push(make_pair(nx,ny));
        que2.push(make_pair(nx,ny));
        }
      }
    }
  }
  que2 = bfs2(que2);
  while(!que2.empty()){
    P q = que.front();que.pop();
    bfs(q);
  }
  //rep(i,H){rep(j,W){cout<<dist[i][j];}cout<<endl;}
}

queue<P> bfs2(queue<P> que2){
  queue<P> tmp;
  while(!que2.empty()){
    P q2 = que2.front();que2.pop();
    int i = q2.first, j = q2.second;
    for(int a=-2;a<=2;++a){
      for(int b=-2;b<=2;++b){
        if(i+a<0 || i+a>=H || j+b<0 || j+b>=W) continue;
        if(c[i][j]=='.' && c[i+a][j+b]=='.' && dist[i][j]<INF && dist[i+a][j+b]==INF){
          dist[i+a][j+b] = dist[i][j] + 1;
          tmp.push(make_pair(i+a,j+b));
        }
      }
    }
  }
  return tmp;
}
 
 
int main(){
  cin>>H>>W;
  dist.resize(H);
  rep(i,H)dist[i].resize(W);
  c.resize(H);
  rep(i,H)rep(j,W)dist[i][j]=INF;
  int sh,sw;cin>>sh>>sw;sh--,sw--;
  int gh,gw;cin>>gh>>gw;gh--,gw--;
  rep(i,H)cin>>c[i];
  P s=make_pair(sh,sw);
  dist[sh][sw] = 0;
  bfs(s);
  cout<< (dist[gh][gw] == INF ? -1 : dist[gh][gw]) <<endl;
}

Compiler output:
a.cc: In function 'void bfs(std::pair<int, int>)':
a.cc:37:10: error: 'bfs2' was not declared in this scope; did you mean 'bfs'?
   37 |   que2 = bfs2(que2);
      |          ^~~~
      |          bfs
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using P = pair<int,int>;

const int INF = 1e9;
const int N = 1010;

char board[N][N];
int dp[N][N];
int warp[N][N];

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

int h,w;

bool isSafe(int x, int y) {
  if(1 <= x && x <= h && 1 <= y && y <= w && board[x][y] == '.') {
    return true;
  } else {
    return false;
  }
}

signed main() {
  cin >> h >> w;

  int ch, cw, dh, dw;
  cin >> ch >> cw >> dh >> dw;

  for (int i = 1; i <= h; i++) {
    for (int j = 1; j <= w; j++) {
      cin >> board[i][j];
    }
  }

  rep(i,N) rep(j,N) dp[i][j] = INF;
  rep(i,N) rep(j,N) warp[i][j] = INF;

  queue<P> que;
  que.emplace(ch, cw);

  //dp 歩いてきたときのワープ回数
  //warp そこまでワープしてきた時のワープ回数
  dp[ch][cw] = 0;
  warp[ch][cw] = 0;

  while(!que.empty()) {
    P p = que.front(); que.pop();
    int curx = p.first;
    int cury = p.second;

    for (int i = 0; i < 4; i++) {
      int nx = curx + dx[i];
      int ny = cury + dy[i];

      if(!isSafe(nx, ny) || (dp[nx][ny] <= dp[curx][cury] &&
      dp[nx][ny] <= warp[curx][cury])) continue;
      que.emplace(nx, ny);
      chmin(dp[nx][ny], dp[curx][cury]);
      chmin(dp[nx][ny], warp[curx][cury]);
    }

    for (int i = -2; i <= 2; i++) {
      for (int j = -2; j <= 2; j++) {
        int nx = curx + i;
        int ny = cury + j;

        if(!isSafe(nx, ny) || (warp[nx][ny] <= warp[curx][cury]4 4
        1 1
        4 4
                ..#.
        ..#.
        .#..
        .#..
        + 1
        && warp[nx][ny] <= dp[curx][cury] + 1)) continue;
        que.emplace(nx, ny);
        chmin(warp[nx][ny], warp[curx][cury] + 1);
        chmin(warp[nx][ny], dp[curx][cury] + 1);
      }
    }
  }

  int ans = min(dp[dh][dw], warp[dh][dw]);
  if(ans >= INF) ans = -1;

  cout << ans << '\n';

}


Compiler output:
a.cc:74:19: error: stray '#' in program
   74 |                 ..#.
      |                   ^
a.cc:75:11: error: stray '#' in program
   75 |         ..#.
      |           ^
a.cc:76:10: error: stray '#' in program
   76 |         .#..
      |          ^
a.cc:77:10: error: stray '#' in program
   77 |         .#..
      |          ^
a.cc: In function 'int main()':
a.cc:71:64: error: expected ')' before numeric constant
   71 |         if(!isSafe(nx, ny) || (warp[nx][ny] <= warp[curx][cury]4 4
      |                               ~                                ^
      |                                                                )
a.cc:79:57: error: expected ')' before ';' token
   79 |         && warp[nx][ny] <= dp[curx][cury] + 1)) continue;
      |                                                         ^
      |                                                         )
a.cc:71:11: note: to match this '('
   71 |         if(!isSafe(nx, ny) || (warp[nx][ny] <= warp[curx][cury]4 4
      |           ^
Language: C++

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <deque>

using namespace std;

const int N = 1e5 + 10;

char s[N][N];

typedef pair<int, int> PII;

int n, m;
bool st[N][N];

struct node{
	int x, y;
	int step;
};

node start;
node endt;

void bfs(){
	int dx[20] = {-1, 0, 1, 0, -2, -2, -2, -2, -2, -1, 0, 1, 2, 2, 2, 2, 2, 1, 0, -1};
	int dy[20] = {0, 1, 0, -1, -2, -1, 0, 1, 2, 2, 2, 2, 2, 1, 0, -1, -2, -2, -2, -2};
	
	deque<node> q;
	q.push_front(start);
	while(q.size()){
		auto t = q.front();
		q.pop_front();
		
	//	cout << t.x << " " << t.y << " " << t.step << endl;
		
		if (t.x == endt.x && t.y == endt.y){
			cout << t.step << endl;
			return;
		}
		
		for (int i = 0; i < 20; i ++){
			int x = t.x + dx[i], y = t.y + dy[i];
			
			if (st[x][y])   continue;
			st[x][y] = true;
			if (s[x][y] == '#')  continue;
			if (x < 1 || x > n || y < 1 || y > m)   continue;
			if (i < 4){
				q.push_front({x, y, t.step});
			}
			else {
				q.push_back({x, y, t.step + 1});
			}
		}
	}
	if (!q.size())  {
		cout << -1 << endl;
		return;
	} 
}

int main(){
	int x, y;
	scanf("%d%d", &n, &m);
	scanf("%d%d", &x, &y);
	start = {x, y, 0};
	st[x][y] = true;
	int x1, y1;
	scanf("%d%d", &x1, &y1);
	endt = {x1, y1, -1};
	getchar();
	for (int i = 1; i <= n; i ++)
	    scanf("%s", s[i] + 1);
	    
	    
	    bfs();
	    
	    return 0;
}

Compiler output:
/tmp/ccoVfY6m.o: in function `bfs()':
a.cc:(.text+0x185): relocation truncated to fit: R_X86_64_PC32 against symbol `start' defined in .bss section in /tmp/ccoVfY6m.o
a.cc:(.text+0x1d2): relocation truncated to fit: R_X86_64_PC32 against symbol `endt' defined in .bss section in /tmp/ccoVfY6m.o
a.cc:(.text+0x1e2): relocation truncated to fit: R_X86_64_PC32 against symbol `endt' defined in .bss section in /tmp/ccoVfY6m.o
a.cc:(.text+0x26f): relocation truncated to fit: R_X86_64_PC32 against symbol `st' defined in .bss section in /tmp/ccoVfY6m.o
a.cc:(.text+0x299): relocation truncated to fit: R_X86_64_PC32 against symbol `st' defined in .bss section in /tmp/ccoVfY6m.o
a.cc:(.text+0x2d9): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccoVfY6m.o
a.cc:(.text+0x2ea): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccoVfY6m.o
/tmp/ccoVfY6m.o: in function `main':
a.cc:(.text+0x415): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccoVfY6m.o
a.cc:(.text+0x41f): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccoVfY6m.o
a.cc:(.text+0x461): relocation truncated to fit: R_X86_64_PC32 against symbol `start' defined in .bss section in /tmp/ccoVfY6m.o
a.cc:(.text+0x467): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <deque>

using namespace std;

const int N = 1e5 + 10;

char s[N][N];

typedef pair<int, int> PII;

int n, m;
bool st[N][N];

struct node{
	int x, y;
	int step;
};

node start;
node endt;

void bfs(){
	int dx[20] = {-1, 0, 1, 0, -2, -2, -2, -2, -2, -1, 0, 1, 2, 2, 2, 2, 2, 1, 0, -1};
	int dy[20] = {0, 1, 0, -1, -2, -1, 0, 1, 2, 2, 2, 2, 2, 1, 0, -1, -2, -2, -2, -2};
	
	deque<node> q;
	q.push_front(start);
	while(q.size()){
		auto t = q.front();
		q.pop_front();
		
	//	cout << t.x << " " << t.y << " " << t.step << endl;
		
		if (t.x == endt.x && t.y == endt.y){
			cout << t.step << endl;
			return;
		}
		
		for (int i = 0; i < 20; i ++){
			int x = t.x + dx[i], y = t.y + dy[i];
			
			if (st[x][y])   continue;
			st[x][y] = true;
			if (s[x][y] == '#')  continue;
			if (x < 1 || x > n || y < 1 || y > m)   continue;
			if (i < 4){
				q.push_front({x, y, t.step});
			}
			else {
				q.push_back({x, y, t.step + 1});
			}
		}
	}
	if (!q.size())  {
		cout << -1 << endl;
		return;
	} 
}

int main(){
	int x, y;
	scanf("%d%d", &n, &m);
	scanf("%d%d", &x, &y);
	start = {x, y, 0};
	st[x][y] = true;
	int x1, y1;
	scanf("%d%d", &x1, &y1);
	endt = {x1, y1, -1};
	getchar();
	for (int i = 1; i <= n; i ++)
	    scanf("%s", s[i] + 1);
	    
	    
	    bfs();
	    
	    return 0;
}

Compiler output:
/tmp/ccOhZRG6.o: in function `bfs()':
a.cc:(.text+0x185): relocation truncated to fit: R_X86_64_PC32 against symbol `start' defined in .bss section in /tmp/ccOhZRG6.o
a.cc:(.text+0x1d2): relocation truncated to fit: R_X86_64_PC32 against symbol `endt' defined in .bss section in /tmp/ccOhZRG6.o
a.cc:(.text+0x1e2): relocation truncated to fit: R_X86_64_PC32 against symbol `endt' defined in .bss section in /tmp/ccOhZRG6.o
a.cc:(.text+0x26f): relocation truncated to fit: R_X86_64_PC32 against symbol `st' defined in .bss section in /tmp/ccOhZRG6.o
a.cc:(.text+0x299): relocation truncated to fit: R_X86_64_PC32 against symbol `st' defined in .bss section in /tmp/ccOhZRG6.o
a.cc:(.text+0x2d9): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccOhZRG6.o
a.cc:(.text+0x2ea): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccOhZRG6.o
/tmp/ccOhZRG6.o: in function `main':
a.cc:(.text+0x415): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccOhZRG6.o
a.cc:(.text+0x41f): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccOhZRG6.o
a.cc:(.text+0x461): relocation truncated to fit: R_X86_64_PC32 against symbol `start' defined in .bss section in /tmp/ccOhZRG6.o
a.cc:(.text+0x467): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <deque>

using namespace std;

const int N = 1e5 + 10;

char s[N][N];

typedef pair<int, int> PII;

int n, m;
bool st[N][N];

struct node{
	int x, y;
	int step;
};

node start;
node endt;

void bfs(){
	int dx[20] = {-1, 0, 1, 0, -2, -2, -2, -2, -2, -1, 0, 1, 2, 2, 2, 2, 2, 1, 0, -1};
	int dy[20] = {0, 1, 0, -1, -2, -1, 0, 1, 2, 2, 2, 2, 2, 1, 0, -1, -2, -2, -2, -2};
	
	deque<node> q;
	q.push_front(start);
	while(q.size()){
		auto t = q.front();
		q.pop_front();
		
	//	cout << t.x << " " << t.y << " " << t.step << endl;
		
		if (t.x == endt.x && t.y == endt.y){
			cout << t.step << endl;
			return;
		}
		
		for (int i = 0; i < 20; i ++){
			int x = t.x + dx[i], y = t.y + dy[i];
			
			if (st[x][y])   continue;
			st[x][y] = true;
			if (s[x][y] == '#')  continue;
			if (x < 1 || x > n || y < 1 || y > m)   continue;
			if (i < 4){
				q.push_front({x, y, t.step});
			}
			else {
				q.push_back({x, y, t.step + 1});
			}
		}
	}
	if (!q.size())  {
		cout << -1 << endl;
		return;
	} 
}

int main(){
	int x, y;
	scanf("%d%d", &n, &m);
	scanf("%d%d", &x, &y);
	start = {x, y, 0};
	st[x][y] = true;
	int x1, y1;
	scanf("%d%d", &x1, &y1);
	endt = {x1, y1, -1};
	getchar();
	for (int i = 1; i <= n; i ++)
	    scanf("%s", s[i] + 1);
	    
//	for (int i = 1; i <= n; i ++)
//	  for (int j = 1; j <= m; j ++)
//	    printf("%c\n", s[i][j]);
	    
	    bfs();
	    
	    return 0;
}

Compiler output:
/tmp/cc9ykfsM.o: in function `bfs()':
a.cc:(.text+0x185): relocation truncated to fit: R_X86_64_PC32 against symbol `start' defined in .bss section in /tmp/cc9ykfsM.o
a.cc:(.text+0x1d2): relocation truncated to fit: R_X86_64_PC32 against symbol `endt' defined in .bss section in /tmp/cc9ykfsM.o
a.cc:(.text+0x1e2): relocation truncated to fit: R_X86_64_PC32 against symbol `endt' defined in .bss section in /tmp/cc9ykfsM.o
a.cc:(.text+0x26f): relocation truncated to fit: R_X86_64_PC32 against symbol `st' defined in .bss section in /tmp/cc9ykfsM.o
a.cc:(.text+0x299): relocation truncated to fit: R_X86_64_PC32 against symbol `st' defined in .bss section in /tmp/cc9ykfsM.o
a.cc:(.text+0x2d9): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc9ykfsM.o
a.cc:(.text+0x2ea): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/cc9ykfsM.o
/tmp/cc9ykfsM.o: in function `main':
a.cc:(.text+0x415): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/cc9ykfsM.o
a.cc:(.text+0x41f): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc9ykfsM.o
a.cc:(.text+0x461): relocation truncated to fit: R_X86_64_PC32 against symbol `start' defined in .bss section in /tmp/cc9ykfsM.o
a.cc:(.text+0x467): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <deque>

using namespace std;

const int N = 1e5 + 10;

char s[N][N];

typedef pair<int, int> PII;

int n, m;
bool st[N][N];

struct node{
	int x, y;
	int step;
};

node start;
node endt;

void bfs(){
	int dx[20] = {-1, 0, 1, 0, -2, -2, -2, -2, -2, -1, 0, 1, 2, 2, 2, 2, 2, 1, 0, -1};
	int dy[20] = {0, 1, 0, -1, -2, -1, 0, 1, 2, 2, 2, 2, 2, 1, 0, -1, -2, -2, -2, -2};
	
	deque<node> q;
	q.push_front(start);
	while(q.size()){
		auto t = q.front();
		q.pop_front();
		
	//	cout << t.x << " " << t.y << " " << t.step << endl;
		
		if (t.x == endt.x && t.y == endt.y){
			cout << t.step << endl;
			return;
		}
		
		for (int i = 0; i < 20; i ++){
			int x = t.x + dx[i], y = t.y + dy[i];
			
			if (st[x][y])   continue;
			st[x][y] = true;
			if (s[x][y] == '#')  continue;
			if (x < 1 || x > n || y < 1 || y > m)   continue;
			if (i < 4){
				q.push_front({x, y, t.step});
			}
			else {
				q.push_back({x, y, t.step + 1});
			}
		}
	}
	if (!q.size())  {
		cout << -1 << endl;
		return;
	} 
}

int main(){
	int x, y;
	scanf("%d%d", &n, &m);
	scanf("%d%d", &x, &y);
	start = {x, y, 0};
	st[x][y] = true;
	int x1, y1;
	scanf("%d%d", &x1, &y1);
	endt = {x1, y1, -1};
	getchar();
	for (int i = 1; i <= n; i ++)
	    scanf("%s", s[i] + 1);
	    
//	for (int i = 1; i <= n; i ++)
//	  for (int j = 1; j <= m; j ++)
//	    printf("%c\n", s[i][j]);
	    
	    bfs();
	    
	    return 0;
}

Compiler output:
/tmp/ccx4Bwgt.o: in function `bfs()':
a.cc:(.text+0x185): relocation truncated to fit: R_X86_64_PC32 against symbol `start' defined in .bss section in /tmp/ccx4Bwgt.o
a.cc:(.text+0x1d2): relocation truncated to fit: R_X86_64_PC32 against symbol `endt' defined in .bss section in /tmp/ccx4Bwgt.o
a.cc:(.text+0x1e2): relocation truncated to fit: R_X86_64_PC32 against symbol `endt' defined in .bss section in /tmp/ccx4Bwgt.o
a.cc:(.text+0x26f): relocation truncated to fit: R_X86_64_PC32 against symbol `st' defined in .bss section in /tmp/ccx4Bwgt.o
a.cc:(.text+0x299): relocation truncated to fit: R_X86_64_PC32 against symbol `st' defined in .bss section in /tmp/ccx4Bwgt.o
a.cc:(.text+0x2d9): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccx4Bwgt.o
a.cc:(.text+0x2ea): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccx4Bwgt.o
/tmp/ccx4Bwgt.o: in function `main':
a.cc:(.text+0x415): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccx4Bwgt.o
a.cc:(.text+0x41f): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccx4Bwgt.o
a.cc:(.text+0x461): relocation truncated to fit: R_X86_64_PC32 against symbol `start' defined in .bss section in /tmp/ccx4Bwgt.o
a.cc:(.text+0x467): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <deque>

using namespace std;

const int N = 1e5 + 10;

char s[N][N];

typedef pair<int, int> PII;

int n, m;
bool st[N][N];

struct node{
	int x, y;
	int step;
};

node start;
node endt;

void bfs(){
	int dx[20] = {-1, 0, 1, 0, -2, -2, -2, -2, -2, -1, 0, 1, 2, 2, 2, 2, 2, 1, 0, -1};
	int dy[20] = {0, 1, 0, -1, -2, -1, 0, 1, 2, 2, 2, 2, 2, 1, 0, -1, -2, -2, -2, -2};
	
	deque<node> q;
	q.push_front(start);
	while(q.size()){
		auto t = q.front();
		q.pop_front();
		
	//	cout << t.x << " " << t.y << " " << t.step << endl;
		
		if (t.x == endt.x && t.y == endt.y){
			cout << t.step << endl;
			return;
		}
		
		for (int i = 0; i < 20; i ++){
			int x = t.x + dx[i], y = t.y + dy[i];
			
			if (st[x][y])   continue;
			st[x][y] = true;
			if (s[x][y] == '#')  continue;
			if (x < 1 || x > n || y < 1 || y > m)   continue;
			if (i < 4){
				q.push_front({x, y, t.step});
			}
			else {
				q.push_back({x, y, t.step + 1});
			}
		}
	}
	if (!q.size())  {
		cout << -1 << endl;
		return;
	} 
}

int main(){
	int x, y;
	scanf("%d%d", &n, &m);
	scanf("%d%d", &x, &y);
	start = {x, y, 0};
	st[x][y] = true;
	int x1, y1;
	scanf("%d%d", &x1, &y1);
	endt = {x1, y1, -1};
	getchar();
	for (int i = 1; i <= n; i ++)
	    scanf("%s", s[i] + 1);
	    
//	for (int i = 1; i <= n; i ++)
//	  for (int j = 1; j <= m; j ++)
//	    printf("%c\n", s[i][j]);
	    
	    bfs();
	    
	    return 0;
}

Compiler output:
/tmp/ccFZE1MT.o: in function `bfs()':
a.cc:(.text+0x185): relocation truncated to fit: R_X86_64_PC32 against symbol `start' defined in .bss section in /tmp/ccFZE1MT.o
a.cc:(.text+0x1d2): relocation truncated to fit: R_X86_64_PC32 against symbol `endt' defined in .bss section in /tmp/ccFZE1MT.o
a.cc:(.text+0x1e2): relocation truncated to fit: R_X86_64_PC32 against symbol `endt' defined in .bss section in /tmp/ccFZE1MT.o
a.cc:(.text+0x26f): relocation truncated to fit: R_X86_64_PC32 against symbol `st' defined in .bss section in /tmp/ccFZE1MT.o
a.cc:(.text+0x299): relocation truncated to fit: R_X86_64_PC32 against symbol `st' defined in .bss section in /tmp/ccFZE1MT.o
a.cc:(.text+0x2d9): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccFZE1MT.o
a.cc:(.text+0x2ea): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccFZE1MT.o
/tmp/ccFZE1MT.o: in function `main':
a.cc:(.text+0x415): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccFZE1MT.o
a.cc:(.text+0x41f): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccFZE1MT.o
a.cc:(.text+0x461): relocation truncated to fit: R_X86_64_PC32 against symbol `start' defined in .bss section in /tmp/ccFZE1MT.o
a.cc:(.text+0x467): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: Java

import java.util.Arrays;
import java.util.Scanner;
import java.util.Stack;	

class main {
	
	int[] dx = {0, 0, 1, -1, -2, -2, -2, -2, -2, 2, 2, 2, 2, 2};
	int[] dy = {1, -1, 0, 0, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2};
	int flag = 0;
	int min = Integer.MAX_VALUE;
	
	void dfs(int i, int j, int[][] visited, int di, int dj, char[][] arr, int h, int w, int ct) {
		if (visited[i][j] == 1) return;
		if (i==di && j==dj) {
			flag=1;
			//System.out.println("Ct : " + di + " " + dj);
			if (ct < min) {
				min = ct;
			}
			visited[i][j] = 1;
			return;
		}
		visited[i][j] = 1;
		
		for (int k=0;k<14;k++) {
			int newi = i + dx[k]; 
			int newj = j + dy[k];
			if (newi>=0 && newj>=0 && newi<h && newj<w && visited[newi][newj]==0 && arr[newi][newj] == '.') {
				if (newi==-2 || newi==2 || newj==-2 || newj==2) {
					dfs(newi, newj, visited, di, dj, arr, h, w, ct+1);
				} else {
					dfs(newi, newj, visited, di, dj, arr, h, w, ct);
				}
			}
		}
		visited[i][j] = 0;
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		codeforces c = new codeforces();
	
		int h,w;
		int ch,cw;
		int dh, dw;
		h = sc.nextInt();
		w = sc.nextInt();
		ch = sc.nextInt();
		cw = sc.nextInt();
		dh = sc.nextInt();
		dw = sc.nextInt();
		ch--;
		cw--;
		dh--;
		dw--;
		
		char[][] arr = new char[h][w];
		for (int i=0;i<h;i++) {
				String str = sc.next();
				arr[i] = str.toCharArray();
		}
		
		if (arr[ch][cw] == '#' || arr[dh][dw] == '#') {
			System.out.println("-1");
		} else {
			int[][] visited = new int[h][w];
			c.dfs(ch, cw, visited, dh, dw, arr, h, w, 0);
			if (c.flag == 0) {
				System.out.println(-1);	
			} else {
				System.out.println(c.min);
			}
		}
	}
}


Compiler output:
Main.java:41: error: cannot find symbol
		codeforces c = new codeforces();
		^
  symbol:   class codeforces
  location: class main
Main.java:41: error: cannot find symbol
		codeforces c = new codeforces();
		                   ^
  symbol:   class codeforces
  location: class main
2 errors
Language: Java

import java.util.Arrays;
import java.util.Scanner;
import java.util.Stack;	

public class codeforces {
	
	int[] dx = {0, 0, 1, -1, -2, -2, -2, -2, -2, 2, 2, 2, 2, 2};
	int[] dy = {1, -1, 0, 0, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2};
	int flag = 0;
	int min = Integer.MAX_VALUE;
	
	void dfs(int i, int j, int[][] visited, int di, int dj, char[][] arr, int h, int w, int ct) {
		if (visited[i][j] == 1) return;
		if (i==di && j==dj) {
			flag=1;
			//System.out.println("Ct : " + di + " " + dj);
			if (ct < min) {
				min = ct;
			}
			visited[i][j] = 1;
			return;
		}
		visited[i][j] = 1;
		
		for (int k=0;k<14;k++) {
			int newi = i + dx[k]; 
			int newj = j + dy[k];
			if (newi>=0 && newj>=0 && newi<h && newj<w && visited[newi][newj]==0 && arr[newi][newj] == '.') {
				if (newi==-2 || newi==2 || newj==-2 || newj==2) {
					dfs(newi, newj, visited, di, dj, arr, h, w, ct+1);
				} else {
					dfs(newi, newj, visited, di, dj, arr, h, w, ct);
				}
			}
		}
		visited[i][j] = 0;
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		codeforces c = new codeforces();
	
		int h,w;
		int ch,cw;
		int dh, dw;
		h = sc.nextInt();
		w = sc.nextInt();
		ch = sc.nextInt();
		cw = sc.nextInt();
		dh = sc.nextInt();
		dw = sc.nextInt();
		ch--;
		cw--;
		dh--;
		dw--;
		
		char[][] arr = new char[h][w];
		for (int i=0;i<h;i++) {
				String str = sc.next();
				arr[i] = str.toCharArray();
		}
		
		if (arr[ch][cw] == '#' || arr[dh][dw] == '#') {
			System.out.println("-1");
		} else {
			int[][] visited = new int[h][w];
			c.dfs(ch, cw, visited, dh, dw, arr, h, w, 0);
			if (c.flag == 0) {
				System.out.println(-1);	
			} else {
				System.out.println(c.min);
			}
		}
	}
}


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

#include <map>
#include <queue>
#include <cstdio>
using namespace std;
const int MAXN = 1e3 + 5;
queue<pair<int, int> > q;
map<pair<int, int>, int> m;
char mp[MAXN][MAXN];
bool v[MAXN][MAXN];
int d1[MAXN] = {0, 1, -1, 0, 0};
int d2[MAXN] = {0, 0, 0, 1, -1};
int x, y, x2, y2, h, w;
int ans;
void Read() {
	int i, j;
	scanf("%d %d %d %d %d %d", &h, &w, &x, &y, &x2, &y2);
	for(i = 1; i <= h; i++) {
		scanf("\n");
		for(j = 1; j <= w; j++) {
			scanf("%c", &mp[i][j]);
			if(mp[i][j] == '#')
				v[i][j] = 1;
		}
	}
}
void BFS() {
	q.push(make_pair(x, y));
	while(!q.empty()) {
		bool flag = 0;
		pair<int, int> now = q.front(); q.pop();
//		printf("%d %d\n", now.first, now.second);
		v[now.first][now.second] = 1;
		int step = m[make_pair(now.first, now.second)];
		for(int i = 1; i <= 4; i++) {
			if(d1[i] + now.first < 1 || d2[i] + now.second < 1 || d1[i] + now.first > h || d2[i] + now.second > w)
				continue;
			if(!v[d1[i] + now.first][d2[i] + now.second]) {
				q.push(make_pair(d1[i] + now.first, d2[i] + now.second));
				m[make_pair(d1[i] + now.first, d2[i] + now.second)] = step;
				v[d1[i] + now.first][d2[i] + now.second] = 1;
				flag = 1;
			}
		}
		if(!flag) {
//			printf("x");
			for(int i = -2; i <= 2; i++) {
				for(int j = -2; j <= 2; j++) {
					if(i + now.first < 1 || j + now.second < 1 || i + now.first > h || j + now.second > w)
						continue;
					if(!v[i + now.first][j + now.second]) {
						q.push(make_pair(i + now.first, j + now.second));
						m[make_pair(i + now.first, j + now.second)] = step + 1;
						v[i + now.first][j + now.second] = 1;
						flag = 1;
					}
				}
			}
			ans++;
		}
		if(v[x2][y2])
			break;
	}
	printf("%d", m[make_pair(x2, y2)]);
}
int main() {
	Read();
	BFS();
	return 0;
}

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

#include<bits/stdc++.h>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#define endl  "\n"
#define ll long long
#define int long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cin.exceptions(cin.failbit);cout.tie(NULL);
using namespace std;
bool isPrime(int n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;
    if (n % 2 == 0 || n % 3 == 0)
        return false;
    for (int i = 5; i * i <= n; i += 6)
    {
        if ((n % i == 0) || (n % (i + 2) == 0))
            return false;
    }
    return true;
}
char a[1005][1005];
vector<int> v;
int vis[1005][1005];
int valid(int x,int y,int n,int m)
{
	if(x<n && x>=0 && y<m && y>=0)
	return 1;
	else
	return 0;
}


dfs(int x,int y,int ans,int n,int m,int x1,int y1,int x2,int y2)
{
	
	if(x==x2 && y==y2)
	{
		v.push_back(ans);
		return 0;
	}
	
	
	int flag=0;
	if(valid(x-1,y,n,m) && vis[x-1][y]==0 && a[x-1][y]=='.')
	{
		flag=1;
		vis[x-1][y]=1;
		dfs(x-1,y,ans,n,m,x1,y1,x2,y2);
	}
	
	
	if(valid(x,y-1,n,m) && vis[x][y-1]==0 && a[x][y-1]=='.')
	{
		flag=1;
		vis[x][y-1]=1;
		dfs(x,y-1,ans,n,m,x1,y1,x2,y2);
	}
	
	if(valid(x+1,y,n,m) && vis[x+1][y]==0 && a[x+1][y]=='.')
	{
		flag=1;
		vis[x+1][y]=1;
		dfs(x+1,y,ans,n,m,x1,y1,x2,y2);
	}
	
	
	if(valid(x,y+1,n,m) && vis[x][y+1]==0 && a[x][y+1]=='.')
	{
		flag=1;
		vis[x][y+1]=1;
		dfs(x,y+1,ans,n,m,x1,y1,x2,y2);
	}
	
	if(flag==0)
	{
		int final=0;
		
		int temp=x-2;
		int temp2=y-2;
		int var=x+2;
		int var2=y+2;
		
		
		for(int i=temp;i<=var;i++)
		{
			for(int j=temp2;j<=var2;j++)
			{
				if(i==x && y==j)
				continue;
				
				if(valid(i,j,n,m) && vis[i][j]==0 && a[i][j]=='.')
				{
					final=1;
					//ans++;
					vis[i][j]=1;
					dfs(i,j,ans+1,n,m,x1,y1,x2,y2);
				}
			}
		}
		
		if(final==0)
		{	
			ans=INT_MIN;
		}
		
	}
	
	
}


int32_t main()
{
	int t;
	t=1;
	while(t--)
	{
		
		int n,m,x1,y1,x2,y2;

		
		cin >> n >> m;
		cin >> x1 >> y1;
		cin >> x2 >> y2;
		
		x1--;
		y1--;
		x2--;
		y2--;
		
		string s[n];
		for(int i=0;i<n;i++)
		{
			cin >> s[i];
		}
		
		
		for(int i=0;i<n;i++)
		{
			for(int j=0;j<m;j++)
			{
				a[i][j]=s[i][j];
				//cin >> a[i][j];
				vis[i][j]=0;
			}
		}
		
		dfs(x1,y1,0,n,m,x1,y1,x2,y2);
		
		int mn=INT_MAX;
		for(int i=0;i<v.size();i++)
		{
			
			//cout << v[i] << " ";
			if(v[i]>=0)
			{
				mn=min(mn,v[i]);
			}
		}
		
		if(mn==INT_MAX)
		cout << "-1";
		else
		cout << mn;
		
		
	}
}




Compiler output:
a.cc:40:1: error: ISO C++ forbids declaration of 'dfs' with no type [-fpermissive]
   40 | dfs(int x,int y,int ans,int n,int m,int x1,int y1,int x2,int y2)
      | ^~~
a.cc: In function 'int dfs(long long int, long long int, long long int, long long int, long long int, long long int, long long int, long long int, long long int)':
a.cc:116:1: warning: control reaches end of non-void function [-Wreturn-type]
  116 | }
      | ^
Language: C++

#include <bits/stdc++.h>

using namespace std;


const int DIM = 1e3 + 7;

bool v[DIM][DIM];
int viz[DIM][DIM];

int n, m;
int xf, yf;
bool isin(int x, int y)
{
    return (x <= n && x >= 1 && y <= m && y >= 1);
}



int xd[] = {1,0,-1,0};
int yd[] = {0,1,0,-1};

void bfs(int c,int b)
{
    queue <  pair < int, pair <int,int> > > q;

    viz[c][b] = 0;

    q.push({0,{c,b}});





    while(!q.empty())
    {
        int cnt = q.front().first;
        int xl = q.front().second.first;
        int yl = q.front().second.second;


        q.pop();

        int k = 0;

        for(int i = 0; i < 4; i++)
        {
              int xi = xl + xd[i];
              int yi = yl + yd[i];


              if(isin(xi, yi) == false)
                continue;
              else
              if(v[xi][yi] == true)
              {
                 if(cnt < viz[xi][yi])
                 {viz[xi][yi] =  cnt;
                    if(xi == xf && yi == yf && viz[xi][yi] == 0)
                    {
                        cout << 0;
                        return 0;
                    }

                  q.push({cnt,{xi,yi}});
                 }

              }
        }
              if(cnt + 1 < n * m)
                  for(int j = xl - 2; j <= xl + 2; j++)
                    for(int p = yl - 2; p <= yl + 2; p++)
                    {
                        if(isin(j, p) == false)
                            continue;
                        else
                         if(v[j][p] == true)
                         {
                             if(viz[j][p] > cnt + 1)
                                {viz[j][p] = cnt + 1;
                                q.push({cnt + 1, {j, p}});
                                }
                         }

                    }
              }





}


int main()
{

ios::sync_with_stdio(false);
cin.tie(0);

    cin >> n >> m;

    int xs, ys;
    cin >> xs >> ys;

    cin >> xf >> yf;

    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= m; j++)
        {
            char a;
            cin >> a;

            viz[i][j] = 1e9;
            if(a == '#')
            {
                v[i][j] = false;
            }
            else
                v[i][j] = true;

        }


        if(v[xs][ys] == false || v[xf][yf] == false)
        {
            cout << -1;
            return 0;
        }
        bfs(xs,ys);

        if(viz[xf][yf] == 1e9)
        cout << -1;
        else
        cout <<viz[xf][yf];


    return 0;
}



Compiler output:
a.cc: In function 'void bfs(int, int)':
a.cc:62:32: error: return-statement with a value, in function returning 'void' [-fpermissive]
   62 |                         return 0;
      |                                ^
Language: C++

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

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

int main(){
  int H,W;
  cin >> H >> W;
  int CH,CW, DH,DW;
  cin >> CH >> CW >> DH >> DW;
  CH--; CW--; DH--; DW--;
  vector< string > s(H);
  REP(i,H) cin >> s[i];

  REP(y,H) REP(x,W) d[y][x] = 100000000;
  d[CH][CW] = 0;
  
  int j = 0, f = 0;
  int sx, sy;
  while(1) {
    REP(y,H) {
      REP(x,W) {
        if (d[y][x] = j) {
          sx = x;
          sy = y;
          f = 1;
          break;
        }
      }
      if (f==1) break;
    }
    if (f==1) {
      // BFS
      queue< pair<int, int> > q;
      q.push( {sy, sx} );
      while( !q.empty() ) {
        auto v = q.top(); q.pop();
        int h = v.first;
        int w = v.second;
        // 5x5の範囲を +1
        for(int iy=-2; iy<=2; iy++ )
          for(int ix=-2; ix<=2; ix++ ) {
            int nx = x + ix;
            int ny = y + iy;
            if (iy==0 && ix==0) continue;
            if ((nx <= 0) || (nx >=W) || (ny <= 0) || (ny >=H) ) continue;
            d[ny][nx] = min(d[h][w]+1,d[ny][nx]);
          }
        // 普通に4方向にBFS
        REP(i,4) {
          int nx = h + dx[i];
          int ny = w + dy[i];
          if ((nx <= 0) || (nx >=W) || (ny <= 0) || (ny >=H) ) continue;
          if ( s[ny][nx] == '.' ) {
            d[ny][nx] = d[h][w];
            q.emplace(ny, nx);
          }
        }
      }
      j++;
      f = 1;
    } else {
      break;
    }
  }

  if ( d[DH][DW] == 100000000 ) d[DH][DW] = -1;
  cout << d[DH][DW] << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:20: error: 'class std::queue<std::pair<int, int> >' has no member named 'top'; did you mean 'pop'?
   41 |         auto v = q.top(); q.pop();
      |                    ^~~
      |                    pop
a.cc:47:22: error: 'x' was not declared in this scope; did you mean 'nx'?
   47 |             int nx = x + ix;
      |                      ^
      |                      nx
a.cc:48:22: error: 'y' was not declared in this scope; did you mean 'ny'?
   48 |             int ny = y + iy;
      |                      ^
      |                      ny
Language: C++

#pragma GCC target ("avx2")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#include <bits/stdc++.h>
#define int long long
#define mp make_pair
#define pb push_back
using namespace std;
void solve(){
    int h,w,ch,cw,dh,dw;
    cin>>h>>w>>ch>>cw>>dh>>dw;
    char a[h+1][w+1];
    for (int i=1; i<=h; i++){
        for (int j=1; j<=w; j++) cin>>a[i][j];
    }
    vector <pair <int,int> > g[h*w+1];
    for (int i=1; i<=h; i++){
        for (int j=1; j<=w; j++){
            if (a[i][j]=='#') continue;
            for (int k=-2; k<=2; k++){
                for (int l=-2; l<=2; l++){
                    if (k+l>0&&i+k>0&&i+k<=h&&j+l>0&&j+l<=w&&a[i+k][j+l]=='.'){
                        int boo=1;
                        if (abs(k)+abs(l)==1) boo=0;
                        g[w*(i-1)+j].pb(mp(w*(i-1+k)+(j+l),boo));
                    }
                }
            }
        }
    }
    int dist[h*w+1];
    for (int i=1; i<=h*w; i++) dist[i]=1e9;
    dist[w*(ch-1)+cw]=0;
    priority_queue <pair <int,int>,vector <pair <int,int> >,greater<pair <int,int> > > pq;
    for (int i=1; i<=h*w; i++) pq.push(mp(dist[i],i));
    bool visited[h*w+1];
    for (int i=1; i<=h*w; i++) visited[i]=0;
    while (!pq.empty()&&!visited[w*(dh-1)+dw]){
        int t1=pq.top().first,t2=pq.top().second;
        pq.pop();
        if (!visited[t2]){
            ll gs=g[t2].size();
            for (int i=0; i<gs; i++){
                int t3=g[t2][i].first,t4=g[t2][i].second;
                if (!visited[t3]&&dist[t2]!=1e9&&dist[t2]+t4<dist[t3]){
                    dist[t3]=dist[t2]+t4;
                    pq.push(mp(dist[t3],t3));
                }
            }
        }
        visited[t2]=1;
    }
    if (dist[w*(dh-1)+dw]==1e9) cout<<-1;
    else cout<<dist[w*(dh-1)+dw];
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:42:13: error: 'll' was not declared in this scope
   42 |             ll gs=g[t2].size();
      |             ^~
a.cc:43:29: error: 'gs' was not declared in this scope; did you mean 'g'?
   43 |             for (int i=0; i<gs; i++){
      |                             ^~
      |                             g
Language: C++

#include<cstdio>
#include<tuple>
#include<queue>

typedef std::tuple<int, int, int> P;

const int MAX_H = 1000, MAX_W = 1000;
const int INF = 10000000;
char field[MAX_H][MAX_W + 1];
int d[MAX_H][MAX_W];
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

int H, W, sx, sy, gx, gy, wp=0;

void solve();
int bfs();

int main(){

    scanf("%d %d", &H, &W);
    scanf("%d %d", &sy, &sx);
    scanf("%d %d", &gy, &gx);

    for(int i = 0;i<H;i++){
        scanf("%s", field[i]);
    }

    solve();

    return 0;
}

int bfs(){
    std::queue<P> que;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            d[i][j] = INF;
        }
    }
    que.push(P(sx,sy,0));
    d[sx][sy] = 0;

    while(que.size()){
        P p = que.front(); que.pop();
        if(std::get<0>(p) == gx && std::get<1>(p) == gy){
            break;
        }
        for(int i=0;i<4;i++){
            //移動した後の点を(nx, ny)とする
            int nx = std::get<0>(p) + dx[i], ny = std::get<1>(p) + dy[i];

            //移動が可能かの判定とすでに訪れたことがあるかの判定(d[nx][ny] != INFなら訪れたことがある)
            if(0 <= nx && nx < H && 0 <= ny && ny < W && field[nx][ny] != '#' && d[nx][ny] == INF){
                //移動できるならキューに入れ、その点の距離をpからの距離＋1で確定する
                que.push(P(nx, ny, wp));
                d[nx][ny] = d[std::get<0>(p)][std::get<1>(p)] + 1;
            }
        }

        
    }

    return wp;

}

Compiler output:
/usr/bin/ld: /tmp/ccqW4QIj.o: in function `main':
a.cc:(.text+0xc6): undefined reference to `solve()'
collect2: error: ld returned 1 exit status