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

#include <bits/stdc++.h>
using namespace std;
char S[N][N];
int f[N][N],dr[4][2]={{1,0},{-1,0},{0,1},{0,-1}},que[N*N],s,t,h,w,sx,sy,tx,ty;
const int N=1e3+5;
signed main(void){
	cin>>h>>w>>sx>>sy>>tx>>ty;
	for(int i=0;i<h;i++) {
		cin>>S[i];
		for(int j=0;j<w;j++)
			f[i][j]=S[i][j]=='#';
	}
	f[--sx][--sy]=1;
	tx--,ty--;
	que[t++]=sx*N+sy;
	while(s<t){
		int s1=s;
		while(s<t){
			int x=que[s++],y=x%N;
			x/=N;
			for(int i=0;i<4;i++){
				int x1=x+dr[i][0],y1=y+dr[i][1];
				if((unsigned)x1>=h||(unsigned)y1>=w||f[x1][y1])
					continue;
				f[x1][y1]=f[x][y];
				que[t++]=x1*N+y1;
			}
		}
		while(s1<s){
			int x=que[s1++],y=x%N;
			x/=N;
			for (int i=-2;i<3;i++) {
				for (int j=-2;j<3;j++) {
					int x1=x+i,y1=y+j;
					if((unsigned)x1>=h||(unsigned)y1>=w||f[x1][y1])
						continue;
					f[x1][y1]=f[x][y]+1;
					que[t++]=x1*N+y1;
				}
			}
		}
	}
	cout<<(f[tx][ty]?f[tx][ty]-1:-1);
	return 0;
}

Compiler output:
a.cc:3:8: error: 'N' was not declared in this scope
    3 | char S[N][N];
      |        ^
a.cc:3:11: error: 'N' was not declared in this scope
    3 | char S[N][N];
      |           ^
a.cc:4:7: error: 'N' was not declared in this scope
    4 | int f[N][N],dr[4][2]={{1,0},{-1,0},{0,1},{0,-1}},que[N*N],s,t,h,w,sx,sy,tx,ty;
      |       ^
a.cc:4:10: error: 'N' was not declared in this scope
    4 | int f[N][N],dr[4][2]={{1,0},{-1,0},{0,1},{0,-1}},que[N*N],s,t,h,w,sx,sy,tx,ty;
      |          ^
a.cc:4:54: error: 'N' was not declared in this scope
    4 | int f[N][N],dr[4][2]={{1,0},{-1,0},{0,1},{0,-1}},que[N*N],s,t,h,w,sx,sy,tx,ty;
      |                                                      ^
a.cc:4:56: error: 'N' was not declared in this scope
    4 | int f[N][N],dr[4][2]={{1,0},{-1,0},{0,1},{0,-1}},que[N*N],s,t,h,w,sx,sy,tx,ty;
      |                                                        ^
a.cc: In function 'int main()':
a.cc:9:22: error: 'S' was not declared in this scope
    9 |                 cin>>S[i];
      |                      ^
a.cc:11:25: error: 'f' was not declared in this scope
   11 |                         f[i][j]=S[i][j]=='#';
      |                         ^
a.cc:13:9: error: 'f' was not declared in this scope
   13 |         f[--sx][--sy]=1;
      |         ^
a.cc:15:9: error: 'que' was not declared in this scope
   15 |         que[t++]=sx*N+sy;
      |         ^~~
a.cc:22:54: error: 'y' was not declared in this scope; did you mean 'y1'?
   22 |                                 int x1=x+dr[i][0],y1=y+dr[i][1];
      |                                                      ^
      |                                                      y1
a.cc:34:55: error: 'y' was not declared in this scope; did you mean 'y1'?
   34 |                                         int x1=x+i,y1=y+j;
      |                                                       ^
      |                                                       y1
Language: C++

/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <list>
#include <stack>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#include <functional>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi   vector<int> 
#define   co(x)  cout << x << '\n' 
#define   dbg(x)  cerr << #x << " = " << x << '\n' 
#define   bitcount(x)  (int)__builtin_popcount(x) 
#define   sz(x)  (int)x.size()
#define   all(a) a.begin(),a.end() 
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std; 

char  g[1005][1005] ; 
int  cost[1005][1005] ; 
int  dx[4] = {1, -1, 0, 0} ; 
int  dy[4] = {0, 0, 1, -1} ; 
int  r, c, fx, fy, lx, ly ; 

bool ok(int i,int j){
    if (i<1 or i>r or j<1 or j>c or g[i][j] == '#') return false;
    return true;
}

inline void solve(){ 
    cin >> r >> c >> fx >> fy >> lx >> ly ; 
    for (int i=1;i<=r;i++) {
        cin >> (g[i]+1) ; 
        fill(cost[i],cost[i]+1005,1000000);
    }
    queue <pii> q; 
    q.push_back({fx,fy}) ; 
    cost[fx][fy] = 0 ; 
    while (q.size()){ 
        int  x = q.front().ff ; 
        int  y = q.front().ss ; 
        q.pop_front() ; 
        for (int t=0;t<4;t++) { 
            int i = x + dx[t] ; 
            int j = y + dy[t] ; 
            if (cost[i][j] <= cost[x][y])  continue ; 
            if (ok(i,j)) {
                q.push_front({i,j}) ; 
                cost[i][j] = cost[x][y] ; 
            }
        }
        for (int i=max(1LL,x-2);i<=min(r,x+2);i++){
            for (int j=max(1LL,y-2);j<=min(c,y+2);j++){
                if ((i == x and j == y) or ( cost[i][j] <= cost[x][y]+1 )) continue;
                if (ok(i,j)){
                    cost[i][j] = cost[x][y]+1 ; 
                    q.push_back({i,j}); 
                }
            }
        }
    }
    if (cost[lx][ly] != 1000000LL) co(cost[lx][ly]) ; 
    else co(-1) ; 
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:52:7: error: 'class std::queue<std::pair<long long int, long long int> >' has no member named 'push_back'
   52 |     q.push_back({fx,fy}) ;
      |       ^~~~~~~~~
a.cc:57:11: error: 'class std::queue<std::pair<long long int, long long int> >' has no member named 'pop_front'
   57 |         q.pop_front() ;
      |           ^~~~~~~~~
a.cc:63:19: error: 'class std::queue<std::pair<long long int, long long int> >' has no member named 'push_front'
   63 |                 q.push_front({i,j}) ;
      |                   ^~~~~~~~~~
a.cc:72:23: error: 'class std::queue<std::pair<long long int, long long int> >' has no member named 'push_back'
   72 |                     q.push_back({i,j});
      |                       ^~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int di[]={-1,0,1,0};
int dj[]={0,-1,0,1};
int INF=1e9;
int main(){
  int h,w;
  cin>>h>>w;
  int si,sj;
  cin>>si>>sj;
  int ti,tj;
  cin>>ti>>tj;
  si--;sj--;ti--;tj--;
  vector<string> s(h);
  for(int i=0;i<h;i++) cin>>s[i];
  vector<vector<int>> dist(h,vector<int>(w,INF));
  deque<P> q;
  dist[si][sj]=0;
  q.emplace_back(si,sj);
  while(!q.empty()){
    int i=q.front().first;
    int j=q.front.second;
    int d=dist[i][j];
    q.pop_front();
    if(dist[i][j]!=d) continue;
    for(int v=0;v<4;v++){
       int ni=i+di[v],nj=j+dj[v];
      if(ni<0||ni>=h||nj<0||nj>=w) continue;
      if(s[ni][nj]=='#') continue;
      if(dist[ni][nf]<=d) continue;
      dist[ni][nj]=d;
      q.emplace_front(ni,nj);
    }
    for(int ei=-2;ei<=2;ei++){
      for(int ej=-2;ej<=2;ej++){
        int ni=i+ei,nj=j+ej;
        if(ni<0||ni>=h||nj<0||nj>=w) continue;
        if(s[ni][nj]=='#') continue;
        if(dist[ni][nj]<=d+1) continue;
        dist[ni][nj]=d+1;
        q.emplace_back(ni,nj);
      }
    }
  }
  int nas=dist[ti][tj];
  if(ans==INF) ans=-1;
  cout<<ans<<endl;
  return 0;
}

  

Compiler output:
a.cc: In function 'int main()':
a.cc:17:9: error: 'P' was not declared in this scope
   17 |   deque<P> q;
      |         ^
a.cc:17:10: error: template argument 1 is invalid
   17 |   deque<P> q;
      |          ^
a.cc:17:10: error: template argument 2 is invalid
a.cc:19:5: error: request for member 'emplace_back' in 'q', which is of non-class type 'int'
   19 |   q.emplace_back(si,sj);
      |     ^~~~~~~~~~~~
a.cc:20:12: error: request for member 'empty' in 'q', which is of non-class type 'int'
   20 |   while(!q.empty()){
      |            ^~~~~
a.cc:21:13: error: request for member 'front' in 'q', which is of non-class type 'int'
   21 |     int i=q.front().first;
      |             ^~~~~
a.cc:22:13: error: request for member 'front' in 'q', which is of non-class type 'int'
   22 |     int j=q.front.second;
      |             ^~~~~
a.cc:24:7: error: request for member 'pop_front' in 'q', which is of non-class type 'int'
   24 |     q.pop_front();
      |       ^~~~~~~~~
a.cc:30:19: error: 'nf' was not declared in this scope; did you mean 'nj'?
   30 |       if(dist[ni][nf]<=d) continue;
      |                   ^~
      |                   nj
a.cc:32:9: error: request for member 'emplace_front' in 'q', which is of non-class type 'int'
   32 |       q.emplace_front(ni,nj);
      |         ^~~~~~~~~~~~~
a.cc:41:11: error: request for member 'emplace_back' in 'q', which is of non-class type 'int'
   41 |         q.emplace_back(ni,nj);
      |           ^~~~~~~~~~~~
a.cc:46:6: error: 'ans' was not declared in this scope; did you mean 'nas'?
   46 |   if(ans==INF) ans=-1;
      |      ^~~
      |      nas
a.cc:47:9: error: 'ans' was not declared in this scope; did you mean 'nas'?
   47 |   cout<<ans<<endl;
      |         ^~~
      |         nas
Language: C++

#include<iostream>
#include<math.h>
#include<bits/stdc++.h>
#include<deque>
#include<cstdio>
#define rep(i,n) for (int i=0;i<(n);++i)
using ll = long long;
using namespace std;
using P = pair<int,int>;

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

int main(){
	int h,w;
	cin>>h>>w;
	int si,sj;
	cin>>si>>sj;
	int ti,tj;
	cin>>ti>>tj;
	--sj; --si; --ti; --tj;
	vector<string> s(h);
	rep(i,h) cin>>s[i];
	const int INF = 1e9;
	vector<vector<int>> dist(h,vector<int>(w,INF));
	deque<P> q;
	dist[si][sj]=0;
	q.emplace_back(si,sl);
	while(!q.empty()){
		int i = q.front().first;
		int j = q.front().second;
		int d = dist[i][j];
		q.pop_front();
		rep(v,4){
			int ni = i+di[v], nj = j+di[v];
			if(ni<0||ni>=h||ni>=w) continue;
			if(s[ni][nj] == '#') continue; 
			if(dist[ni][nj] <= d) continue;
			dist[ni][nj] = d;
			q.emplace_front(ni,nj);
		}
		for(int ei = -2; ei <= 2; ei++){
			for(int el = -2; el <= 2; ej++){
				int ni = i+ei, nj = j+ej;
				if(ni < 0||ni>=h||nj<0||nj>=w) continue;
				if(s[ni][nj] == '#') continue;
				if(dist[ni][nj] <= d+1) continue;
				dist[ni][nj] = d+1;
				q.emplace_back(ni,nj);
			}
		}
	}
	int ans = dist[ti][tj];
	if(ans == INF) ans = -1;
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:27: error: 'sl' was not declared in this scope; did you mean 's'?
   28 |         q.emplace_back(si,sl);
      |                           ^~
      |                           s
a.cc:43:51: error: 'ej' was not declared in this scope; did you mean 'el'?
   43 |                         for(int el = -2; el <= 2; ej++){
      |                                                   ^~
      |                                                   el
Language: C++

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

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

int main(){
    ll h , w ;
    cin >> h >> w ;
    ll si , sj ;
    cin >> si >> sj ;
    ll gi , gj ;
    cin >> gi >> gj ;
    si-- ;sj-- ;gi-- ;gj-- ;
    vector<string> S(h) ;
    rep(i,h) cin >> S[i] ;
    int ans = 0 ;
    vector<vector<int>> dist(h,vector<int>(w,INF)) ;
    deque<P> q ;
    dist[si][sj] = 0 ;
    q.emplace_back(si,sj) ;
    while(!q.empty()){
        ll i = q.front().first ;
        ll j = q.front().second ;
        q.pop_front() ;
        ll d = dist[i][j] ;
        rep(v,4){
            ll ni = i + di[v] , nj = j + dj[v] ;
            if(ni < 0 || ni >=h || nj < 0 || jn >= w) continue ;
            if(S[ni][nj] == '#' ) continue ;
            dist[ni][nj] = d ;
            q.emplace_front(ni,nj) ;
        }
        for (ll ei = -2 ; ei <= 2 ; ei++ ){
            for (ll ej = -2; ej <= 2 ;ej++ ){
                ll ni = i + ei , nj = j + ej ;
                if(ni < 0 || ni >=h || nj < 0 || jn >= w) continue ;
                if(S[ni][nj] == '#' ) continue ;
                dist[ni][nj] = d + 1  ;
                q.emplace_back(ni,nj) ;
            }
        }
    }
    cout << dist[gi][gj] << endl ;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:49: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   33 |             if(ni < 0 || ni >=h || nj < 0 || jn >= w) continue ;
      |                                              ~~~^~~~
a.cc:41:53: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   41 |                 if(ni < 0 || ni >=h || nj < 0 || jn >= w) continue ;
      |                                                  ~~~^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
bool vis[1001][1001];
int d[1001][1001];
int cx,cy,dx,dy,h,w;
int main(){
	cin>>h>>w>>cx>>cy>>dx>>dy;
	string s[h+1];
	for(int i=1;i<=h;i++){
		cin>>s[i];
	}
	deque<pair<int,int> > q;
	q.push_back(make_pair(cx,cy));
	for(int i=1;i<=h;i++){
		fill(vis[i]+1,vis[i]+w+1,false);
	}
	while(!q.empty()){
		pair<int,int> k=q.front();
		q.pop();
		int x=k.first;
		int y=k.second;
		if(x==dx && y==dy){
			cout<<d[x][y]<<endl;
			return 0;
		}
		for(int i=-2;i<=2;i++)
			for(int j=-2;j<=2;j++){
				int curx=x+i,cury=y+j;
				if(curx>0 && curx<=h && cury>0 && cury<=w && s[curx][cury]=='.'){
					if(vis[curx][cury]) continue;
					if(abs(i)+abs(j)<2){
						vis[curx][cury]=true;
						d[curx][cury]=d[x][y];
						q.push_front(make_pair(curx,cury));
					}else{
						if(d[curx][cury]>d[x][y]+1){
							d[curx][cury]=d[x][y]+1;
							q.push_back(make_pair(curx,cury));
						}
					}
				}
			}
	}
	cout<<-1<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:19: error: 'class std::deque<std::pair<int, int> >' has no member named 'pop'
   19 |                 q.pop();
      |                   ^~~
Language: C++

#include <bits/stdc++.h>
#include <queue>
#include <algorithm>

using namespace std;

int main(){
    //入力
    int h,w; cin >> h >> w;
    int ch,cw; cin >> ch >> cw;
    ch--; cw--;
    int dh,dw; cin >> dh >> dw;
    dh--; dw--;
    vector<vector<char>> maze(h,vector<char>(w));
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            cin >> maze[i][j];
        }
    } 
    //調べたかどうか
    vector<vector<int>> visited(h,vector<int>(w,-1));
    visited[ch][cw] = 0;
    deque<pair<int,int>> q;
    q.emplace_back(make_pair(ch,cw));
    //通常移動用
    vector<int> dy(4); dy = {1,-1,0,0};
    vector<int> dx(4); dx = {0,0,1,-1};
    //ワープ移動用
    vector<int> wy(20);wy = { 2, 2,2,2,2,  1, 1,1,1,  0,0, -1,-1,-1,-1, -2,-2,-2,-2,-2};
    vector<int> wx(20);wx = {-2,-1,0,1,2, -2,-1,1,2, -2,2, -2,-1, 1, 2, -2,-1, 0, 1, 2};
    //この書き方でいい
    //const int di[] = {-1,0,1,0};
    //const int dj[] = {0,-1,0,1};   

    while(!q.empty()){
        int y = q.front().first;
        int x = q.front().second;
        q.pop_front();

        int cnt = visited[y][x]; 
        //通常移動
        for(int i=0; i<4; i++){
            int ny = y + dy[i];
            int nx = x + dx[i];
            if(ny < 0 || ny >= h || nx < 0 || nx >= w) continue;
            if(maze[ny][nx] == '#') continue;
            if(visited[ny][nx] <= cnt && visited[ny][nx] != -1) continue;

            visited[ny][nx] = cnt;
            //ワープでない場合は前から詰める
            //これで通常移動で行ける場所を調べ終えてから、ワープで行ける場所を調べられる
            q.emplace_front(make_pair(ny,nx));
        }

        cnt++;
        for(int i=0; i<20; i++){
            int ny = y + wy[i];
            int nx = x + wx[i];
            if(ny < 0 || ny >= h || nx < 0 || nx >= w) continue;
            if(maze[ny][nx] == '#') continue;
            if(visited[ny][nx] <= cnt && visited[ny][nx] != -1) continue;

            visited[ny][nx] = cnt;
            q.emplace_back(make_pair(ny,nx));
        }
    }
    cout << visited[dh][dw] << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:67:37: error: expected '}' at end of input
   67 |     cout << visited[dh][dw] << endl;
      |                                     ^
a.cc:7:11: note: to match this '{'
    7 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Yes() std::cout << "Yes" << std::endl
#define No() std::cout << "No" << std::endl
#define Say(s) std::cout << s << std::endl
const ll MOD = 1000000007;
const ll INF = 1061109567;

template <class T>
using Grid = std::vector<std::vector<T>>;
void dfs_grid(const ll& start_tate, const ll& start_yoko, Grid<char>& grid_char, Grid<bool>& grid_num, ll number)
{
    grid_num[start_tate][start_yoko] = number;
    //grid_char[start_tate][start_yoko] = '#';  //'.'を虱潰しにしたい時に使う
    for (ll dx = -1; dx <= 1; ++dx) {
        for (ll dy = -1; dy <= 1; ++dy) {
            if (0 <= start_tate + dx && start_tate + dx < grid_num.size() && 0 <= start_yoko + dy && start_yoko + dy < grid_num[0].size()) {
                if (grid_num[start_tate + dx][start_yoko + dy] > number && grid_char[start_tate + dx][start_yoko + dy] == '.') {
                    dfs_grid(start_tate + dx, start_yoko + dy, grid_char, grid_num, number);
                }
            }
        }
    }
    for (ll dx = -2; dx <= 2; ++dx) {
        for (ll dy = -2; dy <= 2; ++dy) {
            if (0 <= start_tate + dx && start_tate + dx < grid_num.size() && 0 <= start_yoko + dy && start_yoko + dy < grid_num[0].size()) {
                if (grid_num[start_tate + dx][start_yoko + dy] > number + 1 && grid_char[start_tate + dx][start_yoko + dy] == '.') {
                    dfs_grid(start_tate + dx, start_yoko + dy, grid_char, grid_num, number + 1);
                }
            }
        }
    }
}
int main()
{
    ll h, w;
    ll C_h, C_w, D_h, D_w;
    std::cin >> h >> w >> C_h >> C_w >> D_h >> D_w;
    --C_h;
    --C_w;
    --D_h;
    --D_w;
    Grid<ll> N(h, std::vector<ll>(w, INF));
    Grid<char> S(h, std::vector<char>(w));
    for (ll i = 0; i < h; ++i) {
        std::string temp;
        std::cin >> temp;
        for (ll j = 0; j < w; ++j) {
            S[i][j] = temp[j];
        }
    }
    dfs_grid(C_h, C_w, S, N, 0);

    if (N[D_h][D_w] > INF / 2) {
        std::cout << "-1" << std::endl;
    } else {
        std::cout << N[D_h][D_w] << std::endl;
    }

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:54:27: error: invalid initialization of reference of type 'Grid<bool>&' {aka 'std::vector<std::vector<bool, std::allocator<bool> >, std::allocator<std::vector<bool, std::allocator<bool> > > >&'} from expression of type 'Grid<long long int>' {aka 'std::vector<std::vector<long long int, std::allocator<long long int> >, std::allocator<std::vector<long long int, std::allocator<long long int> > > >'}
   54 |     dfs_grid(C_h, C_w, S, N, 0);
      |                           ^
a.cc:13:94: note: in passing argument 4 of 'void dfs_grid(const long long int&, const long long int&, Grid<char>&, Grid<bool>&, long long int)'
   13 | void dfs_grid(const ll& start_tate, const ll& start_yoko, Grid<char>& grid_char, Grid<bool>& grid_num, ll number)
      |                                                                                  ~~~~~~~~~~~~^~~~~~~~
Language: C++

/*
 * @Author: Luisvacson
 * @LastEditors: Luisvacson
 * @Descriptions: None
 * @Date: 2020-09-05 18:43:22
 * @LastEditTime: 2020-09-05 19:01:01
 * @FilePath: \VSC\C++\Public\Wizard in Maze.cpp
 */
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int, int>

int n, m;
int gx, gy, sx, sy;
char G[1005][1005];
bool vis[1005][1005];
int ds[1005][1005];
signed main()
{
    scanf("%d%d", &n, &m);
    scanf("%d%d%d%d", &gx, &gy, &sx, &sy);
    register int i, j;
    for (i = 1; i <= n; ++i) {
        for (j = 1; j <= m; ++j) {
            ds[i][j] = 1 << 30;
        }
    }

    deque<pii> Q;
    vis[gx][gy] = true;
    ds[gx][gy] = 0;
    Q.push_front(pii(gx, gy));
    while (!Q.empty()) {
        pii p = Q.front();
        int x = p.first, y = p.second;
        if (x == sx && y == sy) {
            printf("%d\n", ds[x][y]);
            return 0;
        }
        Q.pop_front();

        for (i = -2; i <= 2; ++i) {
            for (j = -2; j <= 2; ++j) {
                int xx = x + i, yy = y + j;
                if (xx > 0 && xx <= n && yy > 0 && yy <= m && G[xx][yy] = '.' && !vis[xx][yy]) {
                    if (abs(i) + abs(j) <= 1) {
                        Q.push_front(pii(xx, yy));
                        ds[xx][yy] = ds[x][y];
                        vis[xx][yy] = true;
                    } else {
                        if (ds[x][y] + 1 < ds[xx][yy]) {
                            ds[xx][yy] = ds[x][y] + 1;
                            Q.push_back(pii(xx, yy));
                        }
                    }
                }
            }
        }
    }

    puts("-1");
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:18: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   22 |     register int i, j;
      |                  ^
a.cc:22:21: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   22 |     register int i, j;
      |                     ^
a.cc:45:60: error: lvalue required as left operand of assignment
   45 |                 if (xx > 0 && xx <= n && yy > 0 && yy <= m && G[xx][yy] = '.' && !vis[xx][yy]) {
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define MOD 1e9+7    
using namespace std;

int main(){
	int n, x, total=0;
	cin >> n;
	int a[n+1];
	long long s[n+1];
	
	s[0] = 0;
	for (int i=1; i<=n; i++){
		cin >> a[i];
		s[i] = s[i-1] + a[i];
	}
	
	for (i=1; i<n; i++){
		total += a[i] * (s[n]-s[i]) % MOD; 
	}
	
	cout << total % MOD;
	return 0; 
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:17:14: error: 'i' was not declared in this scope
   17 |         for (i=1; i<n; i++){
      |              ^
a.cc:21:23: error: invalid operands of types 'int' and 'double' to binary 'operator%'
   21 |         cout << total % MOD;
      |                 ~~~~~ ^
      |                 |
      |                 int
Language: C++

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

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

int main(void){
    int h,w,ch,cw,dh,dw;
    cin>>h>>w;
    cin>>ch>>cw;
    cin>>dh>>dw;
    ch--; cw--; dh--; dw--;
    vector<string> s(h);
    rep(i,h) cin>>s[i];
    const int INF=10e9;
    vector<vector<int>> dist(h,vector<int>(w,INF));
    deque<P> q;
    dist[ch][cw]=0;
    q.emplace_back(ch,cw);
    while(!q.empty()){
        int i=q.front().first;
        int j=q.front().second;
        int d=dist[i][j];
        q.pip_front();
        rep(v,4){
            int ni=i+di[v],nj=j+dj[v];
            if(ni<0||ni>=h||nj<0||nj>=w)continue;
            if(s[ni][nj]=='#')continue;
            if(dist[ni][nj]<=d)continue;
            dist[ni][nj]=d;
            q.emplace_front(ni,nj);
        }
        for(int ei=-2;ei<=2;ei++){
            for(int ej=-2;2j<=2;ej++){
                int ni=i+ei,nj=j+ej;
                if(ni<0||ni>=h||nj<0||nj>=w)continue;
                if(s[ni][nj]=='#')continue;
                if(dist[ni][nj]<=d+1)continue;
                dist[ni][nj]=d+1;
                q.emplace_front(ni,nj);
            }
        }
    }
    int ans=dist[dh][dw];
    if(ans==INF)ans=-1;
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:19: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+10' to '2147483647' [-Woverflow]
   18 |     const int INF=10e9;
      |                   ^~~~
a.cc:27:11: error: 'class std::deque<std::pair<int, int> >' has no member named 'pip_front'; did you mean 'pop_front'?
   27 |         q.pip_front();
      |           ^~~~~~~~~
      |           pop_front
a.cc:37:29: error: invalid operands of types '__complex__ int' and 'int' to binary 'operator<='
   37 |             for(int ej=-2;2j<=2;ej++){
      |                           ~~^~~
      |                           |   |
      |                           |   int
      |                           __complex__ int
Language: C++

#include<bits/stdc++.h>
#include <queue>
#define fs first
#define sc second
#define N 1010
using namespace std;

struct nut
{
    int x,y,val;
    operator<(const nut& V)const
    {
        return val<V.val;
    }
};

int kc(int a,int b,int c,int d)
{
    if(abs(a-c)+abs(b-d)==1) return 0;
        else return 1;
}

set<nut>s;
int n,m,xs,ys,xe,ye,dp[N][N];
string a[N];

bool check(int x,int y)
{
    return ((x>0&&x<=n)&&(y>0&&y<=m));
}

void update()
{
    dp[xs][ys]=0;
    s.insert({xs,ys,0});
    while(!s.empty())
    {
        nut u=*s.begin();
      //  cout<<s.size()<<" "<<u.x<<" "<<u.y<<endl;
        s.erase(u);
        for(int i=-2;i<=2;i++)
            for(int j=-2;j<=2;j++)
                if((i!=0||j!=0)&&(check(u.x+i,u.y+j)&&a[u.x+i][u.y+j]=='.'))
                {
                    int x=u.x+i,y=u.y+j;
                    if(dp[x][y]==-1||dp[x][y]>dp[u.x][u.y]+kc(x,y,u.x,u.y))
                    {
                        s.erase({x,y,dp[x][y]});
                        dp[x][y]=dp[u.x][u.y]+kc(x,y,u.x,u.y);
               //          cout<<u.x<<" "<<u.y<<" "<<x<<" "<<y<<" "<<dp[x][y]<<endl;
                        s.insert({x,y,dp[x][y]});
                    }
                }
    }
}

int main()
{
    memset(dp,-1,sizeof(dp));
    cin>>n>>m;
    cin>>xs>>ys>>xe>>ye;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        a[i]=" "+a[i];
    }
    update();
    cout<<dp[xe][ye];
    return 0;
}


Compiler output:
a.cc:11:5: error: ISO C++ forbids declaration of 'operator<' with no type [-fpermissive]
   11 |     operator<(const nut& V)const
      |     ^~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using st = string;
using P = pair<int, int>;
#define mrep(i, m, n) for(int i = m; i < n; i++)
#define rep(i, n) mrep(i, 0, n)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

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

#define INF 1e9

int main() {
    int h, w;
    cin >> h >> w;
    int ch, cw, dh, dw;
    cin >> ch >> cw >> dh >> dw;
    ch--; cw--;
    dh--; dw--;
    vector<st> s(h);
    rep(i, h) cin >> s.at(i);
    vector<vector<int>> dist(h, vector<int>(w, INF));
    deque<pair<ll, ll>> q;
    dist.at(ch).at(cw) = 0;
    q.emplace_back(ch, cw);
    while(!q.empty){
        int i = q.front().first;
        int j = q.front().second;
        q.pop_front();
        int d = dist.at(i).at(j);
        rep(k, 4){
            int ni = i + di[k];
            int nj = j + dj[k];
            if(ni < 0 || ni >= h || nj < 0 || nj >= w) continue;
            if(s.at(ni).at(nj) == '#') continue;
            if(dist.at(ni).at(nj) <= d) continue;
            dist.at(ni).at(nj) = d;
            q.emplace_front(ni, nj);
        }
        for(int mi = -2; mi <= 2; mi++){
            for(int mj = -2; mj <= 2; mj++){
                int ni = i + mi;
                int nj = j + mj;
                if(ni < 0 || ni >= h || nj < 0 || nj >= w) continue;
                if(s.at(ni).at(nj) == '#') continue;
                if(dist.at(ni).at(nj) <= d + 1) continue;
                dist.at(ni).at(nj) = d + 1;
                q.emplace_back(ni, nj);
            }
        }
    }
    int ans = dist.at(dh).at(dw);
    if(ans == INF) ans = -1;
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:14: error: cannot convert 'std::deque<std::pair<long long int, long long int> >::empty' from type 'bool (std::deque<std::pair<long long int, long long int> >::)() const noexcept' to type 'bool'
   29 |     while(!q.empty){
      |              ^~~~~
a.cc:29:14: error: in argument to unary !
   29 |     while(!q.empty){
      |            ~~^~~~~
Language: C++

#include<bits/stdc++.h>
#define ll long long
#define mod (long long)(1e9+7)
#define endl "\n"
using namespace std;

void using_01bfs(string G[],ll h,ll w,
	ll srcx,ll srcy,ll destx,ll desty){
	auto legal=[&](ll r,ll c) ]->bool{
		if(r<0||c<0||r>=h||c>=w||G[r][c]=='#'){
			return 0;
		}
		return 1;
	};
	deque<pair<ll,ll> > q;
	ll dist[h][w];
	for(ll i=0;i<h;i++){
		for(ll j=0;j<w;j++){
			dist[i][j]=INT_MAX;
		}
	}
	q.push_front({srcx,srcy});
	dist[srcx][srcy]=0;
	while(!q.empty()){
		pair<ll,ll> p=q.front();
		q.pop_front();
		ll x=p.first;
		ll y=p.second;
		for(pair<ll,ll> P:vector<pair<ll,ll> >({{x,y+1},{x+1,y},{x-1,y},{x,y-1}})){
			if(legal(P.first,P.second)){
				if(dist[x][y]<dist[P.first][P.second]){
					dist[P.first][P.second]=dist[x][y];
					q.push_front({P.first,P.second});
				}
			}
		}
		for(ll i=x-2;i<=x+2;i++){
			for(ll j=y-2;j<=y+2;j++){
				if(legal(x,y)){
					if(dist[i][j]>dist[x][y]+1){
						dist[i][j]=dist[x][y]+1;
						q.push_back({i,j});
					}
				}
			}
		}
	}
	cout<<(dist[destx][desty]==INT_MAX?-1:dist[destx][desty])<<endl;

}

void solve(){
	ll h,w;
	cin>>h>>w;
	ll srcx,srcy;
	ll destx,desty;
	cin>>srcx>>srcy;
	cin>>destx>>desty;
	srcx--,srcy--,destx--,desty--;
	string G[h];
	for(ll i=0;i<h;i++){
		cin>>G[i];
	}
	using_01bfs(G,h,w,srcx,srcy,destx,desty);
}


int main(){
	ll t=1;
	//cin>>t;
	while(t--){
		solve();
	}
}


Compiler output:
a.cc: In lambda function:
a.cc:9:35: error: expected '{' before ']' token
    9 |         auto legal=[&](ll r,ll c) ]->bool{
      |                                   ^
a.cc: In function 'void using_01bfs(std::string*, long long int, long long int, long long int, long long int, long long int, long long int)':
a.cc:9:35: error: expected ',' or ';' before ']' token
a.cc:30:33: error: could not convert 'legal.using_01bfs(std::string*, long long int, long long int, long long int, long long int, long long int, long long int)::<lambda(long long int, long long int)>(P.std::pair<long long int, long long int>::first, P.std::pair<long long int, long long int>::second)' from 'void' to 'bool'
   30 |                         if(legal(P.first,P.second)){
      |                            ~~~~~^~~~~~~~~~~~~~~~~~
      |                                 |
      |                                 void
a.cc:39:41: error: could not convert 'legal.using_01bfs(std::string*, long long int, long long int, long long int, long long int, long long int, long long int)::<lambda(long long int, long long int)>(x, y)' from 'void' to 'bool'
   39 |                                 if(legal(x,y)){
      |                                    ~~~~~^~~~~
      |                                         |
      |                                         void
Language: C

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

const int mi[] = {1,0,-1,0};
const int mj[] = {0,1,0,-1};

int main() {
    int h,w,ch,cw,dh,dw;
    cin >> h >> w;
    cin >> ch >> cw;
    cin >> dh >> dw;
    ch--;cw--;dh--;dw--;
    vector<string> s(h);
    rep(i,h) cin >> s[i];
    const int INF = 1e6;
    vector<vector<int>> dist(h,vector<int>(w,INF));
    deque<P> deq;
    deq.emplace_front(ch,cw); //init
    dist[ch][cw] = 0; //init
    while(!deq.empty()) {
        int i0 = deq.front().first;
        int j0 = deq.front().second;
        deq.pop_front();
        int d = dist[i0][j0];
        rep(k,4) {
            int i = i0 + mi[i], j = j0 + mj[i];
            if (s[i][j] == '#') continue;
            if (i < 0 || i >= h || j < 0 || j >= w) continue;
            if (dist[i][i] <= d) continue;
            dist[i][j] = d;
            deq.emplace_front(i,j);
        }
        for (int l = -2; l <= 2 ; l++) {
            for (int m = -2; m <= 2 ; m++) {
                int i = i0 + l, j = j0 + m;
                if (s[i][j] == '#') continue;
                if (i < 0 || i >= h || j < 0 || j >= w) continue;
                if (dist[i][j] <= d + 1) continue;
                dist[i][j] = d + 1;
                deq.emplace_back(i,j);
            }
        }
    }
    int ans = dist[dh][dw];
    if (ans == INF) ans = -1;
    cout << ans << endl;
    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>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
using P = pair<int,int>;

const int xi[] = {1,0,-1,0};
const int yi[] = {0,1,0,-1};

int main() {
    int h,w,ch,cw,dh,dw;
    cin >> h >> w;
    cin >> ch >> cw;
    cin >> dh >> dw;
    ch--;cw--;dh--;dw--;
    vector<string> s(h);
    rep(i,h) cin >> s[i];
    const int INF = 1e6;
    vector<vector<int>> dist(h,vector<int>(w,INF));
    deque<P> deq;
    deq.emplace_front(ch,cw); //init
    dist[ch][cw] = 0; //init
    while(!deq.empty()) {
        int x0 = deq.front().first;
        int y0 = deq.back().second;
        deq.pop_front();
        int d = dist[x0][y0];
        rep(i,4) {
            int x = x0 + xi[i], y = y0 + yi[i];
            if (s[x][y] == '#') continue;
            if (x < 0 || x >= w || y < 0 || y>=h) continue;
            if (dist[x][y] <= d) continue;
            dist[x][y] = d;
            deq.emplace_front(x,y);
        }
        for (int i = -2; i <= 2 ; i++) {
            for (int j = -2; j <= 2 ; j++) {
                int x = x0 + i, y = y0 + j;
                if (s[x][y] == '#') continue;
                if (x < 0 || x >= w || y < 0 || y>=h) continue;
                if (dist[x][y] <= d + 1) continue;
                dist[x][y] = d + 1;
                deq.emplace_front(x,y);
            }
        }
    }
    int ans = dist[dh][dw];
    if (ans == INF) ans = -1;
    cout << ans << endl;
    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>
using namespace std;
string s;
const int NMAX = 1000;
int matrix[NMAX+5][NMAX+5];
int dx [4] = {0, 1, 0, -1};
int dy [4] = {1, 0, -1, 0};
set<int>g[NMAX*NMAX + 5];
void bfs(int n, int m, int ind, int x, int y)
{
   queue<int>qx;
   queue<int>qy;
   qx.push(x);
   qy.push(y);
   matrix[x][y] = ind;
   while(!qx.empty())
   {
      x = qx.front();
      y = qy.front();
      qx.pop();
      qy.pop();
      for(int i=0;i<4;i++)
      {
          int cx = x + dx[i];
          /// x linie
          /// y coloana
          int cy = y + dy[i];
          if(cx <= n and cx >=1 and cy <= m and cy >= 1 and matrix[cx][cy] == 0)
          {
              matrix[cx][cy] = ind;
              qx.push(cx);
              qy.push(cy);
          }
      }
   }
}
void bfs2(int n, int m, int x, int y)
{
    int i, j;
   for(i=-2; i<=2; i++)
   {
       for(j=-2; j<=2;j++)
       {
           int cx = x + i;
           /// x linie
           /// y coloana
           int cy = y + j;
           if(cx <= n and cx >=1 and cy <= m and cy>=1 and matrix[cx][cy] != matrix[x][y] and matrix[cx][cy] != -1)
              g[matrix[x][y]].insert(matrix[cx][cy]);

       }

   }
}
int bfs3(vector<int> viz, int start, int finish)
{
    queue<int>q;
    viz[start] = 1;
    q.push(start);
    while (!q.empty())
    {
        start = q.front();
        if(start == finish)
            break;
        q.pop();
        for(auto x : g[start]) {
            if (viz[x] == 0){
                viz[x] = viz[start] + 1;
                q.push(x);
                if(x == finish)
                    break;
            }
        }

    }
    return viz[finish] - 1;
}
 int main()
 {
     long long  t, n, k, x, m;
     int i, j;
     long long sum = 0;
     cin>>n>>m;
     int x1, x2, y1, y2;
     cin>>x1>>y1>>x2>>y2;
     for(i=1;i<=n;i++)
     {
         cin>>s;
         for(j = 0; j < s.size(); j++)
         {
             if(s[j] == '#')
                 matrix[i][j+1] = -1;
             else
                 matrix[i][j+1] = 0;
         }
     }

     int ind = 1;
    for(i=1;i<=n;i++)
    {
        for(j=1;j<=m;j++)
        {
            if(matrix[i][j] == 0) {
                bfs(n, m, ind, i, j);
                ind++;
            }
        }
    }

  /*   for(i=1;i<=n;i++)
     {
         for(j=1;j<=m;j++)
         {
             cout<<matrix[i][j]<<" ";
         }
         cout<<"\n";

     }*/

    for(i=1;i<=n;i++){
        for(j=1;j<=m;j++)
            if(matrix[i][j] != -1)
                bfs2(n, m, i, j);
    }


    vector <int> viz(ind+5, 0);
    //cout<<matrix[x1][y1]<<"\n";
    // cout<<matrix[x2][y2]<<"\n";

    cout<<bfs3(viz, matrix[x1][y1], matrix[x2][y2])<<"\n";


 }\

Compiler output:
a.cc:134:3: error: stray '\' in program
  134 |  }\
      |   ^
Language: C++

#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
#define Max(a) (*max_element(ALL(a)))
#define Min(a) (*min_element(ALL(a)))
using namespace std;
struct UF
{
  vector<ll> par;
  vector<ll> sz;
  vector<ll> rank;
  UF(ll n):par(n),sz(n),rank(n){
    for(ll i = 0; i < n; i++){
      par[i] = i;sz[i] = 1;rank[i] = 0;
    }
  }
  ll find(ll x) {
    if (par[x] == x) return x;
    else return par[x] = find(par[x]);
  }
  void merge(ll x, ll y) {
    x = find(x); y = find(y);
    if (x == y) return;
    if(rank[x] < rank[y]){
      par[x] = y;
      sz[y] += sz[x];
    }
    else{
      par[y] = x;
      sz[x] += sz[y];
      if(rank[x] == rank[y])rank[x]++;
    }
  }
  bool same(ll x, ll y) { return find(x) == find(y); }
  ll size(ll n){return sz[find(n)];}
};

string m[1111];
ll h,w;
bool check(ll x,ll y){
  return x>=0&&x<h&&y>=0&&y<w;
}
vvi E(1111111);
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>h>>w;
  ll sx,sy,tx,ty;
  cin>>sx>>sy>>tx>>ty;
  sx--;sy--;tx--;ty--;
  UF uni(1111111);
  for(int i=0;i<h;i++){
    cin>>m[i];
  }
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(m[i][j]=='.'){
	for(int k=0;k<4;k++){
	  ll x = i-vx[k],y = j-vy[k];
	  if(check(x,y) && m[x][y] == '.'){
	    uni.merge(i*1000+j,x*1000+y);
	  }
	}
      }
    }
  }
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      for(int k=i-2;k<=i+2;k++){
	for(int l=j-2;l<=j+2;l++){
	  if(check(k,l) && m[k][l] == '.' && !uni.same(i*1000+j,k*1000+l)){
	    E[uni.find(i*1000+j)].pb(uni.find(k*1000+l));
	    E[uni.find(k*1000+l)].pb(uni.find(i*1000+j));
	  }
	}
      }
    }
  }
  ll s = uni.find(sx*1000+sy);
  ll t = uni.find(tx*1000+ty);
  queue<pair<ll,ll>>que;
  vi dist(1111111,llINF);
  dist[s] = 0;
  que.push(mp(s,0));
  while(!que.empty()){
    ll now = que.front().F;
    ll cost = que.front().S;
    que.pop();
    for(auto e:E[now]){
      if(dist[e] > dist[now]+1){
	dist[e] = dist[now]+1;
	que.push(mp(e,cost+1));
      }
    }
  }
  if(dist[t] == llINF)cout<<-1<<endl
    else
  cout<<dist[t]<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:70:20: error: 'vx' was not declared in this scope; did you mean 'x'?
   70 |           ll x = i-vx[k],y = j-vy[k];
      |                    ^~
      |                    x
a.cc:71:22: error: 'y' was not declared in this scope
   71 |           if(check(x,y) && m[x][y] == '.'){
      |                      ^
a.cc:107:37: error: expected ';' before 'else'
  107 |   if(dist[t] == llINF)cout<<-1<<endl
      |                                     ^
      |                                     ;
  108 |     else
      |     ~~~~
Language: Java



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

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out = new PrintWriter(System.out);

		StringTokenizer st = new StringTokenizer(br.readLine());
		int h = Integer.parseInt(st.nextToken());
		int w = Integer.parseInt(st.nextToken());

		StringTokenizer st1 = new StringTokenizer(br.readLine());
		int si = Integer.parseInt(st1.nextToken());
		int sj = Integer.parseInt(st1.nextToken());

		StringTokenizer st2 = new StringTokenizer(br.readLine());
		int ei = Integer.parseInt(st2.nextToken());
		int ej = Integer.parseInt(st2.nextToken());

		char[][] a = new char[h][w];

		for (int i = 0; i < h; i++) {
			String str = br.readLine();
			for (int j = 0; j < w; j++) {
				a[i][j] = str.charAt(j);
			}
		}

		bfs(a, si - 1, sj - 1, ei - 1, ej - 1, h, w);
		out.close();
	}

	static class Pair {
		int x;
		int y;
		int cst;

		Pair(int x, int y, int cst) {
			this.x = x;
			this.y = y;
			this.cst = cst;
		}
	}

	static int[] walkH = { 0, 1, 0, -1 };
	static int[] walkW = { 1, 0, -1, 0 };
	static int[] warpH = { 1, 1, -1, -1, 0, 1, 2, 2, 2, 2, 2, 1, 0, -1, -2, -2, -2, -2, -2, -1 };
	static int[] warpW = { 1, -1, 1, -1, 2, 2, 2, 1, 0, -1, -2, -2, -2, -2, -2, -1, 0, 1, 2, 2 };

	static void bfs(char[][] a, int si, int sj, int ei, int ej, int h, int w) {
		PriorityQueue<Pair> q=new PriorityQueue<magic.Pair>((x,b)->(x.cst-b.cst));
		q.add(new Pair(si, sj, 0));

		

		while (!q.isEmpty()) {
			Pair rem = q.poll();

			if (rem.x == ei && rem.y == ej) {
				System.out.println(rem.cst);
				return;
			}
			if(a[rem.x][rem.y]=='#') continue;

			a[rem.x][rem.y] = '#';


			for (int k = 0; k < 4; k++) {
				int nx = walkH[k] + rem.x;
				int ny = walkW[k] + rem.y;
				if (nx >= 0 && ny >= 0 && nx < h && ny < w && a[nx][ny] == '.' ) {
					q.add(new Pair(nx, ny, rem.cst));	
				}
			}

			for (int k = 0; k < warpH.length; k++) {
				int nx = warpH[k] + rem.x;
				int ny = warpW[k] + rem.y;
				if (nx >= 0 && ny >= 0 && nx < h && ny < w && a[nx][ny] == '.') {
					q.add(new Pair(nx, ny, rem.cst + 1));
				}
			}
		}

		System.out.println(-1);
	}
}

Compiler output:
Main.java:54: error: package magic does not exist
		PriorityQueue<Pair> q=new PriorityQueue<magic.Pair>((x,b)->(x.cst-b.cst));
		                                             ^
1 error
Language: Java



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

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out = new PrintWriter(System.out);

		StringTokenizer st = new StringTokenizer(br.readLine());
		int h = Integer.parseInt(st.nextToken());
		int w = Integer.parseInt(st.nextToken());

		StringTokenizer st1 = new StringTokenizer(br.readLine());
		int si = Integer.parseInt(st1.nextToken());
		int sj = Integer.parseInt(st1.nextToken());

		StringTokenizer st2 = new StringTokenizer(br.readLine());
		int ei = Integer.parseInt(st2.nextToken());
		int ej = Integer.parseInt(st2.nextToken());

		char[][] a = new char[h][w];

		for (int i = 0; i < h; i++) {
			String str = br.readLine();
			for (int j = 0; j < w; j++) {
				a[i][j] = str.charAt(j);
			}
		}

		bfs(a, si - 1, sj - 1, ei - 1, ej - 1, h, w);
		out.close();
	}

	static class Pair {
		int x;
		int y;
		int cst;

		Pair(int x, int y, int cst) {
			this.x = x;
			this.y = y;
			this.cst = cst;
		}
	}

	static int[] walkH = { 0, 1, 0, -1 };
	static int[] walkW = { 1, 0, -1, 0 };
	static int[] warpH = { 1, 1, -1, -1, 0, 1, 2, 2, 2, 2, 2, 1, 0, -1, -2, -2, -2, -2, -2, -1 };
	static int[] warpW = { 1, -1, 1, -1, 2, 2, 2, 1, 0, -1, -2, -2, -2, -2, -2, -1, 0, 1, 2, 2 };

	static void bfs(char[][] a, int si, int sj, int ei, int ej, int h, int w) {
		PriorityQueue<Pair> q=new PriorityQueue<magic.Pair>((a,b)->(a.cst-b.cst));
		q.add(new Pair(si, sj, 0));

		

		while (!q.isEmpty()) {
			Pair rem = q.poll();

			if (rem.x == ei && rem.y == ej) {
				System.out.println(rem.cst);
				return;
			}
			if(a[rem.x][rem.y]=='#') continue;

			a[rem.x][rem.y] = '#';


			for (int k = 0; k < 4; k++) {
				int nx = walkH[k] + rem.x;
				int ny = walkW[k] + rem.y;
				if (nx >= 0 && ny >= 0 && nx < h && ny < w && a[nx][ny] == '.' ) {
					q.add(new Pair(nx, ny, rem.cst));	
				}
			}

			for (int k = 0; k < warpH.length; k++) {
				int nx = warpH[k] + rem.x;
				int ny = warpW[k] + rem.y;
				if (nx >= 0 && ny >= 0 && nx < h && ny < w && a[nx][ny] == '.') {
					q.add(new Pair(nx, ny, rem.cst + 1));
				}
			}
		}

		System.out.println(-1);
	}
}

Compiler output:
Main.java:54: error: package magic does not exist
		PriorityQueue<Pair> q=new PriorityQueue<magic.Pair>((a,b)->(a.cst-b.cst));
		                                             ^
Main.java:54: error: variable a is already defined in method bfs(char[][],int,int,int,int,int,int)
		PriorityQueue<Pair> q=new PriorityQueue<magic.Pair>((a,b)->(a.cst-b.cst));
		                                                     ^
2 errors
Language: Java



import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args)throws Exception {
		 BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		 StringTokenizer st = new StringTokenizer(br.readLine());
		int h=Integer.parseInt(st.nextToken());
		int w=Integer.parseInt(st.nextToken());
		StringTokenizer st1= new StringTokenizer(br.readLine());
		int sr=Integer.parseInt(st1.nextToken());
		int sc=Integer.parseInt(st1.nextToken());
		StringTokenizer st2= new StringTokenizer(br.readLine());
		int dr=Integer.parseInt(st2.nextToken());
		int dc=Integer.parseInt(st2.nextToken());
		
		char[][] maze=new char[h][w];
		for(int i=0;i<h;i++) {
			String s=br.readLine();
			for(int j=0;j<w;j++) {
				maze[i][j]=s.charAt(j);
			}
		}
		int ans=solve(maze,sr-1,sc-1,dr-1,dc-1);
		if(ans==Integer.MAX_VALUE) System.out.println(-1);
		else
			System.out.println(ans);

	}

	private static int solve(char[][] maze ,int sr, int sc, int dr, int dc) {
		if(sr<0 || sr>=maze.length || sc<0 || sc>=maze[0].length || maze[sr][sc]=='#')
			return Integer.MAX_VALUE;
		if(sr==dr && sc==dc) return 0;
		
		maze[sr][sc]='#';
		int n=solve(maze,sr-1,sc,dr,dc);
		int s=solve(maze,sr+1,sc,dr,dc);
		int w=solve(maze,sr,sc-1,dr,dc);
		int e=solve(maze,sr,sc+1,dr,dc);
		
		int ans=Integer.MAX_VALUE;
		if(n==Integer.MAX_VALUE && s==Integer.MAX_VALUE && w==Integer.MAX_VALUE && e==Integer.MAX_VALUE) {
			if(Math.abs(dr-sr)<=2 && Math.abs(dc-sc)<=2) return 1;
//			for(int i=-2;i<=2;i++) {
//				for(int j=-2;j<=2;j++) {
//					ans=Math.min(ans, 1+solve(maze,sr+i,sc+j,dr,dc));
//				}
//			}
//			return ans;
		}
		else {
			return Math.min(Math.min(n, s), Math.min(w, e)); 
		}
		
	}

}


Compiler output:
Main.java:63: error: missing return statement
	}
	^
1 error
Language: Java



import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args)throws Exception {
		 BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		 StringTokenizer st = new StringTokenizer(br.readLine());
		int h=Integer.parseInt(st.nextToken());
		int w=Integer.parseInt(st.nextToken());
		StringTokenizer st1= new StringTokenizer(br.readLine());
		int sr=Integer.parseInt(st1.nextToken());
		int sc=Integer.parseInt(st1.nextToken());
		StringTokenizer st2= new StringTokenizer(br.readLine());
		int dr=Integer.parseInt(st2.nextToken());
		int dc=Integer.parseInt(st2.nextToken());
		
		char[][] maze=new char[h][w];
		for(int i=0;i<h;i++) {
			String s=br.readLine();
			for(int j=0;j<w;j++) {
				maze[i][j]=s.charAt(j);
			}
		}
		int ans=solve(maze,sr-1,sc-1,dr-1,dc-1);
		if(ans==Integer.MAX_VALUE) System.out.println(-1);
		else
			System.out.println(ans);

	}

	private static int solve(char[][] maze ,int sr, int sc, int dr, int dc) {
		if(sr<0 || sr>=maze.length || sc<0 || sc>=maze[0].length || maze[sr][sc]=='#')
			return Integer.MAX_VALUE;
		if(sr==dr && sc==dc) return 0;
		
		maze[sr][sc]='#';
		int n=solve(maze,sr-1,sc,dr,dc);
		int s=solve(maze,sr+1,sc,dr,dc);
		int w=solve(maze,sr,sc-1,dr,dc);
		int e=solve(maze,sr,sc+1,dr,dc);
		
		int ans=Integer.MAX_VALUE;
		if(n==Integer.MAX_VALUE && s==Integer.MAX_VALUE && w==Integer.MAX_VALUE && e==Integer.MAX_VALUE) {
			for(int i=-2;i<=2;i++) {
				for(int j=-2;j<=2;j++) {
					ans=Math.min(ans, 1+solve(maze,sr+i,sc+j,dr,dc));
				}
			}
			return ans;
		}
		else {
			return Math.min(Math.min(n, s), Math.min(w, e)); 
		}
		return Integer.MAX_VALUE;
	}

}


Compiler output:
Main.java:61: error: unreachable statement
		return Integer.MAX_VALUE;
		^
1 error