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

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef std::pair<int,int> pair2;
typedef std::pair<int,pair2> pair3;
const ll INF = 1LL<<60;

int main(){
  int H,W;
  cin>>H>>W;
  int Ch,Dh,Cw,Dw;
  cin>>Ch>>Cw>>Dh>>Dw;
char S[H][W];
int dist[H][W];
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
     cin>>S[i][j];
     dist[i][j]=9999;
    }
  }
  
  dist[Ch-1][Cw-1]=0;
  queue<pair<int,int> > que;
  que.push(make_pair(Ch-1,Cw-1));
  
  
  while(!que.empty()){
  int h=que.front().first;
  int w=que.front().second;
  que.pop();
  check[h][w]=0;
    //cout<<que.front().first<<","<<que.front().second<<endl;
    for(int i=-1;i<=1;i++){
      for(int j=-1;j<=1;j++){
        //cout<<h+i<<","<<w+i<<","<<h<<","<<w<<endl;
        if((abs(i)+abs(j))!=1){continue;}
        if(h+i<0||H<=h+i){continue;}
        if(w+j<0||W<=w+j){continue;}
        if(S[h+i][w+j]=='#'){continue;}
        if(dist[h+i][w+j]<=dist[h][w]){continue;}
        
          dist[h+i][w+j]=dist[h][w];

  
        //cout<<dist[h+i][w+i]<<","<<h+i<<","<<w+i<<endl;
        
         que.push(make_pair(h+i,w+j));
        
      }
    }
    
    for(int i=-2;i<=2;i++){
      //cout<<i<<endl;
      for(int j=-2;j<=2;j++){
        if(abs(i)+abs(j)==0){continue;}
        if((abs(i)+abs(j))==1){continue;}
        if(h+i<0||H<=h+i){continue;}
        if(w+j<0||W<=w+j){continue;}
        if(S[h+i][w+j]=='#'){continue;}        
       if(dist[h+i][w+j]<=dist[h][w]+1){continue;}
//          cout<<i<<","<<j<<endl;
          dist[h+i][w+j]=dist[h][w]+1);
        
        //cout<<dist[h+i][w+i]<<","<<h+i<<","<<w+i<<"#"<<h<<w<<endl;

          //cout<<h+i<<","<<w+i<<endl;
         que.push(make_pair(h+i,w+j));
                
      }
    }
    
  }
  
  
  
  
  
if(dist[Dh-1][Dw-1]==9999){
cout<<"-1"<<endl;
} 
else{
  cout<<dist[Dh-1][Dw-1]<<endl;}
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:3: error: 'check' was not declared in this scope
   31 |   check[h][w]=0;
      |   ^~~~~
a.cc:62:38: error: expected ';' before ')' token
   62 |           dist[h+i][w+j]=dist[h][w]+1);
      |                                      ^
      |                                      ;
Language: Java

mport java.util.*;


public class Main{
    private static int height, width;
    private static int[][] map;

    private static boolean isExistOrRoad(int h, int w){
        if(h < 0 || w < 0) return false;
        if(height <= h || width <= w) return false;
        if(map[h][w] == -1) return false;
        return true;
    }

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		height = sc.nextInt();
        width  = sc.nextInt();
        int c_h = sc.nextInt() - 1;
        int c_w = sc.nextInt() - 1;
        int d_h = sc.nextInt() - 1;
        int d_w = sc.nextInt() - 1;

        map = new int[height][width];

        for(int h=0; h<height; h++){
            String line = sc.next();
            for(int w=0; w<width; w++){
                map[h][w] = (line.charAt(w) == '#') ? -1 : Integer.MAX_VALUE;
            }
        }

        map[c_h][c_w] = 0; //startpoint

        boolean is_update = true;
        while(is_update){
            is_update = false;
            for(int h=0; h<height; h++){
                for(int w=0; w<width; w++){
                    //ignore wall
                    if(map[h][w] == -1){
                        continue;
                    }
                    int past_val = map[h][w];

                    // walk up
                    if(isExistOrRoad(h-1, w)) map[h][w] = Math.min(map[h][w], map[h-1][w]);
                    // walk down
                    if(isExistOrRoad(h+1, w)) map[h][w] = Math.min(map[h][w], map[h+1][w]);
                    // walk left
                    if(isExistOrRoad(h, w-1)) map[h][w] = Math.min(map[h][w], map[h][w-1]);
                    // walk right
                    if(isExistOrRoad(h, w+1)) map[h][w] = Math.min(map[h][w], map[h][w+1]);

                    // warp 
                    for(int h_warp=h-2; h_warp < h+2; h_warp++){
                        for(int w_warp=w-2; w_warp < w+2; w_warp++){
                            if(!isExistOrRoad(h_warp, w_warp)){
                                continue;
                            }
                            // can walk case
                            if(h_warp == h-1 && w_warp == w-1) break;
                            if(h_warp == h-1 && w_warp == w+1) break;
                            if(h_warp == h+1 && w_warp == w-1) break;
                            if(h_warp == h+1 && w_warp == w+1) break;

                            //need warp case
                            if(map[h][w] > map[h_warp][w_warp]){
                                map[h][w] = map[h_warp][w_warp] + 1;
                            }
                        }
                    }

                    if(map[h][w] != past_val)
                        is_update = true;
                }
            }
        }


        if(map[d_h][d_w] == Integer.MAX_VALUE){
            System.out.println(-1);
        }
        else{
            System.out.println(map[d_h][d_w]);
        }

		sc.close();
	}
}

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
mport java.util.*;
^
1 error
Language: C++

#include <iostream>
#include <queue>
#define HMAX 1002
#define WMAX 1002
#define NMAX 1002
using namespace std;
typedef pair<int,int> P;

int H,W,Ch,Cw,Dh,Dw;
int A[HMAX][WMAX][NMAX] = {},nx[4] = {1,0,-1,0},ny[4] = {0,1,0,-1};
char S[HMAX][WMAX];
priority_queue<pair<int,P>,vector<pair<int,P>>,greater<pair<int,P>>> que;

void tel(int a, int b,int c){
	for (int i = -2; i < 3; ++i)
	{
		for (int j = -2; j < 3; ++j)
		{
			if(i != 0 || j != 0){
				if(a+i>=0 && a+i<H && b+j>=0 && b+j<W && A[a+i][b+j][c+1]==0){
					if(S[a+i][b+j] == '.'){
						que.push(pair<int,P>(c+1,P(a+i,b+j)));
						A[a+i][b+j][c+1] = 1;
					}
				}
			}
		}
	}
}

int main(){
	cin >> H >> W >> Ch >> Cw >> Dh >> Dw;
	Ch--;Cw--;Dh--;Dw--;
	for (int i = 0; i < H; ++i)
	{
		for (int j = 0; j < W; ++j)
		{
			cin >> S[i][j];
		}
	}
	que.push(pair<int,P>(0,P(Ch,Cw)));
	while(!que.empty()){
		pair<int,P> p = que.top(); que.pop();
		// cout << p.second.first << " " << p.second.second << " " << p.first << endl;
		if(p.second.first == Dh && p.second.second == Dw){
			cout << p.first << endl;
			return 0;
		}
		int a = p.second.first, b = p.second.second;
		for (int i = 0; i < 4; ++i)
		{
			if(a+nx[i]>=0 && a+nx[i]<H && b+ny[i]>=0 && b+ny[i]<W && A[a+nx[i]][b+ny[i]][p.first]==0){
				if(S[a+nx[i]][b+ny[i]] == '.'){
					que.push(pair<int,P>(p.first,P(a+nx[i],b+ny[i])));
					A[a+nx[i]][b+ny[i]][p.first] = 1;
				}
			}
		}
		tel(p.second.first,p.second.second,p.first);
	}
	cout << -1 << endl;

}

Compiler output:
/tmp/cciSCPRq.o: in function `tel(int, int, int)':
a.cc:(.text+0xf5): relocation truncated to fit: R_X86_64_PC32 against symbol `S' defined in .bss section in /tmp/cciSCPRq.o
a.cc:(.text+0x15e): relocation truncated to fit: R_X86_64_PC32 against symbol `que' defined in .bss section in /tmp/cciSCPRq.o
/tmp/cciSCPRq.o: in function `main':
a.cc:(.text+0x2c3): relocation truncated to fit: R_X86_64_PC32 against symbol `S' defined in .bss section in /tmp/cciSCPRq.o
a.cc:(.text+0x33f): relocation truncated to fit: R_X86_64_PC32 against symbol `que' defined in .bss section in /tmp/cciSCPRq.o
a.cc:(.text+0x353): relocation truncated to fit: R_X86_64_PC32 against symbol `que' defined in .bss section in /tmp/cciSCPRq.o
a.cc:(.text+0x36f): relocation truncated to fit: R_X86_64_PC32 against symbol `que' defined in .bss section in /tmp/cciSCPRq.o
a.cc:(.text+0x536): relocation truncated to fit: R_X86_64_PC32 against symbol `S' defined in .bss section in /tmp/cciSCPRq.o
a.cc:(.text+0x5be): relocation truncated to fit: R_X86_64_PC32 against symbol `que' defined in .bss section in /tmp/cciSCPRq.o
a.cc:(.text+0x65b): relocation truncated to fit: R_X86_64_PC32 against symbol `que' defined in .bss section in /tmp/cciSCPRq.o
/tmp/cciSCPRq.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x6a6): relocation truncated to fit: R_X86_64_PC32 against symbol `que' defined in .bss section in /tmp/cciSCPRq.o
a.cc:(.text+0x6bf): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<vector>
#include<queue>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int dx[]={1,0,-1,0};
constexpr int dy[]={0,1,0,-1};
constexpr int ddx[] = {1,1,-1,-1,2,2,2,2,2,-2,-2,-2,-2,-2,1,0,-1,1,0,-1};
constexpr int ddy[] = {1,-1,1,-1,0,1,2,-1,-2,2,1,0,-1,-2,2,2,2,-2,-2,-2};
constexpr int INF = 1<<28;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int H,W,C_h,C_w,D_h,D_w;
  cin>>H>>W>>C_h>>C_w>>D_h>>D_w;
  C_h--,C_w--,D_h--,D_w--;
  vector<string> S(h);
  rep(i,H)cin>>S[i];

  vector dist(H,vector(W,INF));
  dist[C_h][C_w] = 0;
  deque<int> deq;
  deq.emplace_front(C_h*W+C_w);
  while(!deq.empty()){
    int cur = deq.front();
    deq.pop_front();
    int y = cur/W;
    int x = cur%W;
    rep(i,4){
      int ny = y+dy[i];
      int nx = x+dx[i];
      if(ny<0||nx<0||ny>=H||nx>=W)continue;
      if(S[ny][nx]=='#')continue;
      if(dist[ny][nx]>dist[y][x]){
        dist[ny][nx] = dist[y][x];
        deq.emplace_front(ny*W+nx);
      }
    }
    rep(j,20){
      int ny = y+ddy[j];
      int nx = x+ddx[j];
      if(ny<0||nx<0||ny>=H||nx>=W)continue;
      if(S[ny][nx]=='#')continue;
      if(dist[ny][nx]>dist[y][x]+1){
        dist[ny][nx] = dist[y][x]+1;
        deq.emplace_back(ny*W+nx);
      }
    }
  }
  int ans = dist[D_h][D_w];
  cout<<(ans==INF?-1:ans)<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:20: error: 'h' was not declared in this scope
   17 |   vector<string> S(h);
      |                    ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define For(i, a) for (int i=0; i<(a); i++)
#define FORR(i,a,b) for (int i = (b)-1; i >= a; i--)
#define Forr(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define deb(...) cerr << "[" << #__VA_ARGS__ << "] : [", DBG(__VA_ARGS__)
void DBG() { cerr << "]\n";}
template<typename T, typename ...Args> void DBG(T first, Args... args){
cerr << first; if(sizeof...(args))cerr<<", "; DBG(args...); }
 
#define int ll
#define pb(x) push_back(x)
#define INF (int)1e9
#define PI 3.14159265358979323846
 
int del_x[4] = {-1, 1, 0, 0};
int del_y[4] = {0, 0, -1, 1};
int XX[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
int YY[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
 
 
 
int32_t main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(0);
    int h,w; cin >> h >> w;
    int sx,sy,ex,ey; cin >> sx >> sy >> ex >> ey;
    sx--,sy--,ex--,ey--;
    char grid[h][w];
    For(i,h)For(j,w)cin >> grid[i][j];
    int dp[h][w];
    fill(dp[0],dp[0]+h*w,INF);
    queue<int> qx,qy;
    qx.push(sx);
    qy.push(sy);
    dp[sx][sy]=0;
    while(!qx.empty()){
        int x=qx.front(), y=qy.front();
        qx.pop();
        qy.pop();
        For(i,4){
            int nx=x+del_x[i], ny=y+del_y[i];
            if(nx<0 || nx>=h)continue;
            if(ny<0 || ny>=w)continue;
            if(grid[nx][ny]=='#')continue;
            if(dp[nx][ny]>dp[x][y]){
                dp[nx][ny]=dp[x][y];
                qx.push(nx);
                qy.push(ny);
            }
        }
        for(int nx=x-2;nx<=x+2;nx++){
            for(int ny=y-2;ny<=y+2;ny++){
                if(nx<0 || nx>=h)continue;
                if(ny<0 || ny>=w)continue;
                if(grid[nx][ny]=='#')continue;
                if(dp[nx][ny]>1+dp[x][y]){
                    dp[nx][ny]=1+dp[x][y];
                    qx.push(nx);
                    qy.push(ny);
                }
            }
        }
    }
    cout << (dp[ex][ey]>=INF?-1:dp[ex][ey]) <<"\n";

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:69:52: error: expected '}' at end of input
   69 |     cout << (dp[ex][ey]>=INF?-1:dp[ex][ey]) <<"\n";
      |                                                    ^
a.cc:27:15: note: to match this '{'
   27 | int32_t main(){
      |               ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxN = 1e3 + 10;
const int inf = 0x3f3f3f3f;

char s[maxN][maxN];
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
int f[maxN][maxN];
int n, m;
int a, b, x, y;

bool ok(int i, int j) {
  return (i > 0 && j > 0 && i <= n && j <= m && s[i][j] != '#');
}

struct abc {
  int vtime, u, v;
  abc(int _v = 0, int _u = 0, int _v = 0) : vtime(_v), u(_u), v(_v) {}
  bool operator < (const abc &op) const {
    return vtime > op.vtime;
  }
};

int main(){
//  freopen("abc.inp", "r", stdin); freopen("abc.out", "w", stdout);
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  cin >> n >> m;
  cin >> a >> b;
  cin >> x >> y;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j)
      cin >> s[i][j];
  priority_queue< abc > dq;
  dq.push({a, b});
  memset(f, inf, sizeof f);
  f[a][b] = 0;
  while (!dq.empty()) {
    abc tp = dq.top(); tp.pop();
    int vtime = tp.vtime, u = tp.u, v = tp.v;
    if (f[u][v] < vtime) continue;
    for (int id = 0; id < 4; ++id) {
      int l = u + dx[id], r = v + dy[id];
      if (ok(l, r)) {
        if (f[l][r] > f[u][v]) {
          f[l][r] = f[u][v];
          dq.push(abc(f[l][r], u, v));
        }
      }
    }
    for (int i = -2; i <= 2; ++i)
    for (int j = -2; j <= 2; ++j) {
        int u = l + i, v = r + j;
        if (ok(u, v)) {
          if (f[l][r] > f[u][v] + 1) {
            f[l][r] = f[u][v] + 1;
            dq.push(abc(f[l][r], l, r));
          }
        }
    }
  }
  cout << (vis[x][y] == inf ? -1 : vis[x][y]) << '\n';
return 0;
}


Compiler output:
a.cc:20:35: error: redefinition of 'int _v'
   20 |   abc(int _v = 0, int _u = 0, int _v = 0) : vtime(_v), u(_u), v(_v) {}
      |                               ~~~~^~~~~~
a.cc:20:11: note: 'int _v' previously declared here
   20 |   abc(int _v = 0, int _u = 0, int _v = 0) : vtime(_v), u(_u), v(_v) {}
      |       ~~~~^~~~~~
a.cc: In function 'int main()':
a.cc:40:27: error: 'struct abc' has no member named 'pop'
   40 |     abc tp = dq.top(); tp.pop();
      |                           ^~~
a.cc:54:17: error: 'l' was not declared in this scope
   54 |         int u = l + i, v = r + j;
      |                 ^
a.cc:56:20: error: 'r' was not declared in this scope
   56 |           if (f[l][r] > f[u][v] + 1) {
      |                    ^
a.cc:63:12: error: 'vis' was not declared in this scope
   63 |   cout << (vis[x][y] == inf ? -1 : vis[x][y]) << '\n';
      |            ^~~
Language: C++

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

struct Ps{
  int r,c;
  Ps():r(0),c(0){}
  Ps(int r,int c):r(r),c(c){}
  Ps operator+(const Ps&p)const
  { return Ps(r+p.r,c+p.c);  }
  friend istream& operator>>(istream&is,Ps&p)
  {is >> p.r >> p.c; return is;  }
};

int main(){
  int h,w; cin >> h >> w;
  Ps s,g; cin >> s >> g;
  s = s+Ps(-1,-1);
  g = g+Ps(-1,-1);
  bitset<1000> mz[1000];
  for(int i = 0; i < h; ++i)for(int j = 0; j < w; ++j)
      mz[i][j] = []{char c; cin >> c; return c;}() == '.';
  optional<int> distance[1000][1000];
  deque<pair<Ps,int>> dq;
  dq.emplace_front(s,0);
  constexpr int mr[] = {0,0,1,-1};
  constexpr int mc[] = {1,-1,0,0};
  constexpr int nr[] = {-2,-2,-2,-2,-2,-1,-1,-1,-1, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2};
  constexpr int nc[] = {-2,-1, 0, 1, 2,-2,-1, 1, 2,-2, 2,-2,-1, 1, 2,-2,-1, 0, 1, 2};
  while(!dq.empty()){
    auto [ps,di] = dq.front();
    dq.pop_front();
    if(distance[ps.r][ps.c])continue;
    distance[ps.r][ps.c] = di;
    mz[nps.r][nps.c] = 0;
    if(ps.r==g.r && ps.c==g.c)break;
    for(int i = 0; i < 4; ++i){
      Ps nps = ps + Ps(mr[i],mc[i]);
      if(nps.r < 0 || nps.c < 0 || nps.r >= h || nps.c >= w)continue;
      if(!mz[nps.r][nps.c])continue;
      mz[nps.r][nps.c] = 0;
      dq.emplace_front(move(nps),di);
    }
    for(int i = 0; i < 20; ++i){
      Ps nps = ps + Ps(nr[i],nc[i]);
      if(nps.r < 0 || nps.c < 0 || nps.r >= h || nps.c >= w)continue;
      if(!mz[nps.r][nps.c])continue;
      dq.emplace_back(move(nps),di+1);
    }
  }
  cout << (distance[g.r][g.c] ? distance[g.r][g.c].value() : -1) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:8: error: 'nps' was not declared in this scope; did you mean 'ps'?
   34 |     mz[nps.r][nps.c] = 0;
      |        ^~~
      |        ps
Language: C++

// 有點不耐煩會破壞偉大的計劃

#include <bits/stdc++.h>

#define append push_back

using namespace std;
using ll = long long;

const int N = 1e5 + 3;
const int M = 1e6 + 7;
const long long MOD = 1e9 + 7;
const long long INF = 1e18 + 9;
const int SM = 1e3 + 5;
const int logN = 22, BL = 400;
const double EPS = 1e-9, PI = acos(-1);
const int dx[] = {1, 0, 0, -1, -1, 1, -1, 1};
const int dy[] = {0, 1, -1, 0, -1, 1, 1, -1};

void debug(){
	cerr << "\n";
}
template<typename Type1, typename... Type2>
void debug(Type1 a, Type2... b) {
    cerr << a << " ";
    debug(b...);
}

long long h, w, d[SM][SM], x[2], y[2];
char board[SM][SM];

bool legal(long long x, long long y){
    return board[x][y] == '.' && x >= 1 && h >= x && y >= 1 && w >= 1;
}

int main(){
//    freopen(".in", "r", stdin);
//    freopen(".out", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    cin >> h >> w >> x[0] >> y[0] >> x[1] >> y[1];

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

    deque<pair<long long, long long>> q;
    q.push_front({x[0], y[0]});
    d[x[0]][y[0]] = 0;

    while(!q.empty()){
        long long vx = q.front().first, vy = q.front().second;
        q.pop();

        for(long long i = 0; i < 4; i++){
            long long nx = vx + dx[i], ny = vy + dy[i];
            if(legal(nx, ny) && d[nx][ny] > d[vx][vy]){
                d[nx][ny] = d[vx][vy];
                q.push_front({nx, ny});
            }
        }

        for(long long i = vx - 2; i <= vx + 2; i++){
            for(long long j = vy - 2; j <= vy + 2; j++){
                if(legal(i, j) && d[i][j] > d[vx][vy] + 1){
                    d[i][j] = d[vx][vy] + 1;
                    q.push_back({i, j});
                }
            }
        }
    }

    if(d[x[1]][y[1]] >= INF) cout << "-1";
    else cout << d[x[1]][y[1]];

    return 0;
}


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

#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include <deque>
#include <set>
using namespace std;
int S[1000][1000];

int main()
{
	int H, W;
	cin >> H >> W;
	int C[2];
	int D[2];
	cin >> C[1] >> C[0] >> D[1] >> D[0];
	C[0] = C[0] - 1;
	C[1] = C[1] - 1;
	D[0] = D[0] - 1;
	D[1] = D[1] - 1;
//	vector<vector<int>>S(W, vector<int>(H));
	for (int y = 0; y < H; y++) {
		for (int x = 0; x < W; x++) {
			char c;
			cin >> c;
			if (c == '.') {
				S[x][y] = 1;
			}
			else {
				S[x][y] = 0;
			}
		}
	}
	deque<pair<int,int>>stack;
	deque<pair<int, int>>stack2;
	deque<pair<int, int>>stack3;

	pair<int, int> a(C[0], C[1]);

	int result = 0;
	while (true) {
		while (true) {
			int x = a.first;
			int y = a.second;
			if (x >= 0 && x < W&&y >= 0 && y< H&&S[x][y] == 1) {
				stack2.push_back(a);
				S[x][y] = 2;
				stack3.push_back({x- 1, y });
				stack3.push_back({ x + 1, y});
				stack3.push_back({ x ,y - 1 });
				stack3.push_back({x,y+ 1 });
			}
			if (stack3.size() == 0) {
				break;
			}
			a = stack3.back();
			stack3.pop_back();
		}
		if (S[D[0]][D[1]] == 2 || S[D[0]][D[1]] == 4) {
			cout << result;
			return 0;
		}
		bool frag = false;
		for (int i = 0; i < stack2.size(); i++) {
			int x = stack2[i].first;
			int y = stack2[i].second;
			for (int xx = x-2; xx < x+3; xx++) {
				for (int yy = y-2; yy < y+3; yy++) {
					if (xx  >= 0 && xx  < W&&yy  >= 0 && yy  < H&&S[ xx] yy] == 1) {
						stack3.push_back({xx , yy });
//						S[x + xx][y + yy] = 4;
						frag = true;
					}
				}
			}
		}
		stack2.clear();

		if (!frag) {
			cout << -1;
			return 0;
		}
			a = stack3.back();
			stack3.pop_back();
		result++;

	}

}

Compiler output:
a.cc: In function 'int main()':
a.cc:69:93: error: expected ')' before 'yy'
   69 |                                         if (xx  >= 0 && xx  < W&&yy  >= 0 && yy  < H&&S[ xx] yy] == 1) {
      |                                            ~                                                ^~~
      |                                                                                             )
a.cc:69:96: error: expected primary-expression before ']' token
   69 |                                         if (xx  >= 0 && xx  < W&&yy  >= 0 && yy  < H&&S[ xx] yy] == 1) {
      |                                                                                                ^
Language: C++

#include <iostream>
#include<algorithm>
#include<cstring>
#include<setjmp.h>
using namespace std;
char p[10000][10000];
int vis[1000][1000];
int m =INT_MAX;
int dh,dw;
int h,w;
jmp_buf jmpbuffer;
void dfs(int x,int y,int magic_num){
    if(x == dh && y == dw){
        m = min(m,magic_num);
        if( m == 0 ) longjmp(jmpbuffer,1);
    }
    else {
    if(x<=0||y<=0||x>h||y>w||vis[x][y]==1||p[x][y]=='#') return;
    vis[x][y] = 1;
    dfs(x-1,y,magic_num);
    dfs(x+1,y,magic_num);
    dfs(x,y-1,magic_num);
    dfs(x,y+1,magic_num);
    for(int i = -2;i<=2;i++){
        for(int j = -2;j<=2;j++){
            if((i==-1&&j==0)||(i==0&&j==-1)||(i==1&&j==0)||(i==0&&j==1)){
                continue;
            }
            else{
                 magic_num++;
                 dfs(x+i,y+j,magic_num);
                 magic_num--;
            }
        }
    }
    vis[x][y] = 0;
}
}
int main()
{
    int k =0;
    int ch,cw;
    cin>>h>>w;
    cin>>ch>>cw;
    cin>>dh>>dw;
    int c = 0;
    memset(vis,0,sizeof(vis));
    for(int i = 1;i<=h;i++)
        for(int j =1;j<=w;j++)
            cin>>p[i][j];
    k = setjmp(jmpbuffer);
    dfs(ch,cw,c);
    //cout<<k<<endl;
    if(m == INT_MAX)  cout<<-1<<endl;
    else cout<<m<<endl;
    return 0;
}




Compiler output:
a.cc:8:8: error: 'INT_MAX' was not declared in this scope
    8 | int m =INT_MAX;
      |        ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include<setjmp.h>
  +++ |+#include <climits>
    5 | using namespace std;
a.cc: In function 'int main()':
a.cc:54:13: error: 'INT_MAX' was not declared in this scope
   54 |     if(m == INT_MAX)  cout<<-1<<endl;
      |             ^~~~~~~
a.cc:54:13: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>

typedef long long LL;

#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define REP(i,n) FOR(i,0,n)
#define max(l,r) ((l)>(r)?l:r)
#define min(l,r) ((l)<(r)?l:r)

const int MAX = 600000;
const int LIM = 100000000;
const LL MOD = 1000000007;
const int INF = 2147483647/2;
const LL LINF = 9223372036854775807/3;

int ucmpii(const void *a, const void *b){return(*(int*)a==*(int*)b?0:(*(int*)a>*(int*)b?1:-1));}
int dcmpii(const void *a, const void *b){return(*(int*)a==*(int*)b?0:(*(int*)a<*(int*)b?1:-1));}

int ucmpll(const void *a, const void *b){return(*(LL*)a==*(LL*)b?0:(*(LL*)a>*(LL*)b?1:-1));}
int dcmpll(const void *a, const void *b){return(*(LL*)a==*(LL*)b?0:(*(LL*)a<*(LL*)b?1:-1));}

void SORT(int*a, int n){qsort(a,n,sizeof(int),ucmpii);}
void SORTR(int*a, int n){qsort(a,n,sizeof(int),dcmpii);}
void LSORT(LL*a, int n){qsort(a,n,sizeof(LL),ucmpll);}
void LSORTR(LL*a, int n){qsort(a,n,sizeof(LL),dcmpll);}

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


int H,W;
LL ans=0;
int sx,sy,gx,gy;
char S[1010][1010];
int cnt[1010][1010] = {0};
int qxbeg=0,qxend=0, quex[LIM];
int qybeg=0,qyend=0, quey[LIM];

void dfs(int a, int b){
  cnt[a][b] = ans+1;
  REP(i,4){
    int x = a+dx[i];
    int y = b+dy[i];
    if(x<0||H<=x||y<0||W<=y) continue;
    if(S[x][y] == '#') continue;
    if(cnt[x][y]) continue;
    dfs(x,y);
  }
  REP(i,5)REP(j,5){
    int x = a-2+i;
    int y = b-2+j;
    if(x<0||H<=x||y<0||W<=y) continue;
    if(S[x][y] == '#') continue;
    if(cnt[x][y]) continue;
    quex[qxend++] = x;
    quey[qyend++] = y;
  }
}

void solve(){
  dfs(sx,sy);
  while(!cnt[gx][gy]){
    ans++;
    int N = qxend-qxbeg;
    int tmp=0;
    REP(i,N){
      int x = quex[qxbeg++], y = quey[qybeg++];
      if(cnt[x][y]==0){
        dfs(x,y);
        tmp++;
      }
    }
    if(!tmp && !cnt[gx][gy]){
      ans = -1;
      break;
    }
  }
}

int main(){
  
  scanf("%d%d%d%d%d%d",&H,&W,&sx,&sy,&gx,&gy);
  sx--;sy--;gx--;gy--;
  REP(i,H) scanf("%s",S[i]);

  solve();

  printf("%lld",ans);
}

Compiler output:
main.c:40:22: error: variably modified 'quex' at file scope
   40 | int qxbeg=0,qxend=0, quex[LIM];
      |                      ^~~~
main.c:41:22: error: variably modified 'quey' at file scope
   41 | int qybeg=0,qyend=0, quey[LIM];
      |                      ^~~~
Language: C++

#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower, islower
#include <math.h>

#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
//using ll = long long; using ld = long double;
//using P = pair<int, int>;

long long h,w;
long long sx,sy,gx,gy;
string s;
bool mat[1005][1005];
bool vis[1005][1005];
bool dr[4] = {0, 0, -1, 1};
bool dc[4] = {-1, 1, 0, 0};

bool valid(long long r, long long c) {
    return r >= 0 && r < h && c >= 0 && c < w; 
}

void solve(){
    cin >> h >> w;
    cin >> sy >> sx;
    cin >> gy >> gx; 
    for (int i = 0; i < h; ++i) {
        cin >> s;
        rep(j, w) {
            mat[i][j] = (s[j] = '.');
        }
    }
    deque<pair<pair<long long, long long>, long long>> q;
    q.push_back(make_pair(make_pair(sy,sx),0));
    while (!q.empty()) {
        pair<pair<long long, long long>, long long> x = q.front();
        pair<long long, long long> pos = x.first;
        q.pop_front();

        if (vis[pos.first][pos.second]) continue;
        vis[pos.first][pos.second] = 1;
        
        if (pos.first == gy && pos.second == gx ) {
            cout << x.second << endl;
            return;
        }

        for (int d = 0; d < 4; ++d) {
            long long nr = pos.first + dr[d];
            long long nc = pos.second + dc[d];

            if (valid(nr, nc) && mat[nr][nc] && !vis[nr][nc]) {
                    q.push_front(make_pair(make_pair(nr, nc), x.second));
            }
        }

        for (long long dr = -2; dr <= 2; ++dr) {
            for (long long dc = -2; dc <=2; ++dc) {
                long long nr = pos.first + dr;
                long long nc = pos.second + dc;
                if (valid(nr, nc) && mat[nr][nc] && !vis[nr][nc]) {
                    q.push_back(make_pair(make_pair(nr, nc), x.second + 1));
                }
            }
        }
    }

    cout << -1 << endl;
}

int main(){

    solve();
    
}


Compiler output:
a.cc:30:21: error: narrowing conversion of '-1' from 'int' to 'bool' [-Wnarrowing]
   30 | bool dr[4] = {0, 0, -1, 1};
      |                     ^~
a.cc:31:15: error: narrowing conversion of '-1' from 'int' to 'bool' [-Wnarrowing]
   31 | bool dc[4] = {-1, 1, 0, 0};
      |               ^~
Language: C++

#include<bits/stdc++.h>
#include<string>
#include<algorithm>
using namespace std;
#define ll long long
ll r,c;
int vis[3005][3005],dis[3005][3005];
char A[3005][3005];
queue<pair<ll,ll>>q;
void go(int i,int j)
{
    q.push(make_pair(i,j));  // put them in queue
    vis[i][j]=1; // this is visited
    dis[i][j]=0; // initially no magic is needed
    while(!q.empty())
    {
        ll u=q.top().first;  // nearest point
        ll v=q.top().second;
        q.pop();
        for(int x=-2; x<=2; x++)  // try 5x5 grid
        {
            for(int y=-2; y<=2; y++)
            {
                if(u+x>r||u+x<1||v+y>c||v+y<1||(x==0&&y==0)) // out of bound
                    continue;
                if(vis[u+x][v+y]==0&&A[u+x][v+y]=='.') // possible to go
                {
                    vis[u+x][v+y]=1;
                    if(abs(x)+abs(y)>1) // if its a magic, OPeration B
                        dis[u+x][v+y]=dis[u][v]+1;
                    else  // operation A
                        dis[u+x][v+y]=dis[u][v];
                    q.push(make_pair(u+x,v+y));
                }
                else if(A[u+x][v+y]=='.') // to find minimum dis
                {
                    if((abs(x)+abs(y)>1)&&dis[u+x][v+y]>dis[u][v]+1) // can be improved
                    {                      // +1 because we are using magic
                        dis[u+x][v+y]=dis[u][v]+1;
                        q.push(make_pair(u+x,v+y));
                    }
                    else if(dis[u][v]<dis[u+x][v+y]&&(abs(x)+abs(y)<=1)) // can be improved
                    {
                        dis[u+x][v+y]=dis[u][v];
                        q.push(make_pair(u+x,v+y));
                    }
                }
            }
        }
    }
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
 
    ll sx,sy,dx,dy;
    string s;
    cin>>r>>c;
    cin>>sx>>sy;
    cin>>dx>>dy;
    for(int i=1; i<=r; i++)
    {
        cin>>s;
        for(int j=1; j<=c; j++)
        {
            A[i][j]=s[j-1];
            dis[i][j]=99999999999999; // fill dis with inf
        }
    }
    go(sx,sy); // start from source
    if(vis[dx][dy]==0) // not possible
    {
        cout<<-1<<endl;
    }
    else
    {
        cout<<dis[dx][dy]<<endl;   // minimum distance
    }
    return 0;
}


Compiler output:
a.cc: In function 'void go(int, int)':
a.cc:17:16: error: 'class std::queue<std::pair<long long int, long long int> >' has no member named 'top'; did you mean 'pop'?
   17 |         ll u=q.top().first;  // nearest point
      |                ^~~
      |                pop
a.cc:18:16: error: 'class std::queue<std::pair<long long int, long long int> >' has no member named 'top'; did you mean 'pop'?
   18 |         ll v=q.top().second;
      |                ^~~
      |                pop
a.cc: In function 'int main()':
a.cc:68:23: warning: overflow in conversion from 'long int' to 'int' changes value from '99999999999999' to '276447231' [-Woverflow]
   68 |             dis[i][j]=99999999999999; // fill dis with inf
      |                       ^~~~~~~~~~~~~~
Language: C++

#include "bits/stdc++.h"
#define ll long long int
#define ld long double
#define fastIO ios_base::sync_with_stdio(false); cin.tie(nullptr)
#define F first
#define S second
#define INF 1000000

using namespace std;
typedef pair<int, int> pii;

int r, c;
vector<vector<int>> dp;
vector<vector<bool>> g;
vector<vector<bool>> vis;

bool isSafe(int row, int col) {
    return row < r && row >= 0 && col < c && col >= 0 && g[row][col];
}

//int memo(int row, int col) {
//    if (dp[row][col] != -1) return dp[row][col];
//    if (vis[row][col]) return INF;
//    vis[row][col] = true;
//
//    int best = INF;
//
//    if (isSafe(row + 1, col)) best = min(best, memo(row + 1, col));
//    if (isSafe(row, col + 1)) best = min(best, memo(row, col + 1));
//    if (isSafe(row - 1, col)) best = min(best, memo(row - 1, col));
//    if (isSafe(row, col - 1)) best = min(best, memo(row, col - 1));
//
//
//    for (int i = row - 2; i <= row + 2; i++) {
//        for (int j = col - 2; j <= col + 2; j++) {
//            if (isSafe(i, j)) best = min(best, 1 + memo(i, j));
//        }
//    }
//
//    return dp[row][col] = best;
//}

int main() {
    fastIO;
    int startX, startY, endX, endY;
    cin >> r >> c >> startX >> startY >> endX >> endY;
    startX--, startY--, endX--, endY--;

    g = vis = vector<vector<bool>>(r, vector<bool>(c, false));
    dp = vector<vector<int>>(r, vector<int>(c, 100000));

    for (int i = 0; i < r; i++) {
        for (int j = 0; j < c; j++) {
            char temp;
            cin >> temp;
            if (temp == '.') g[i][j] = true;
        }
    }

    priority_queue<pair<pii, int>> q;
    q.push({{endX, endY}, 0});

    while (!q.empty()) {
        pair<pii, int> p = q.top();
        q.pop();
        int x = p.F.F, y = p.F.S, score = p.S;

        if (score >= dp[x][y]) continue;
        dp[x][y] = score;

        if (isSafe(x + 1, y) && dp[x + 1][y] > score) q.push({{x + 1, y}, score});
        if (isSafe(x - 1, y) && dp[x - 1][y] > score) q.push({{x - 1, y}, score});
        if (isSafe(x, y + 1) && dp[x][y + 1] > score) q.push({{x, y + 1}, score});
        if (isSafe(x, y - 1) && dp[x][y - 1] > score) q.push({{x, y - 1}, score});

        for (int i = x - 2; i <= x + 2; i++) {
            for (int j = y - 2; j <= y + 2; j++) {
                if (isSafe(i, j) && && dp[i][j] > score + 1) q.push({{i, j}, score + 1});
            }
        }
    }

    if (dp[startX][startY] >= 10000) cout << -1;
    else cout << dp[startX][startY];


//    int res = memo(startX, startY);
//    if (res >= 10000) cout << -1;
//    else cout << res;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:78:42: error: expected ')' before '[' token
   78 |                 if (isSafe(i, j) && && dp[i][j] > score + 1) q.push({{i, j}, score + 1});
      |                    ~                     ^
      |                                          )
a.cc:78:40: error: label 'dp' used but not defined
   78 |                 if (isSafe(i, j) && && dp[i][j] > score + 1) q.push({{i, j}, score + 1});
      |                                        ^~
Language: C++

7 7
1 1
7 7
.#.#.#.
#.#.#.#
.#.#.#.
#.#.#.#
.#.#.#.
#.#.#.#
.#.#.#.

Compiler output:
a.cc:4:2: error: stray '#' in program
    4 | .#.#.#.
      |  ^
a.cc:4:4: error: stray '#' in program
    4 | .#.#.#.
      |    ^
a.cc:4:6: error: stray '#' in program
    4 | .#.#.#.
      |      ^
a.cc:5:2: error: invalid preprocessing directive #.
    5 | #.#.#.#
      |  ^
a.cc:6:2: error: stray '#' in program
    6 | .#.#.#.
      |  ^
a.cc:6:4: error: stray '#' in program
    6 | .#.#.#.
      |    ^
a.cc:6:6: error: stray '#' in program
    6 | .#.#.#.
      |      ^
a.cc:7:2: error: invalid preprocessing directive #.
    7 | #.#.#.#
      |  ^
a.cc:8:2: error: stray '#' in program
    8 | .#.#.#.
      |  ^
a.cc:8:4: error: stray '#' in program
    8 | .#.#.#.
      |    ^
a.cc:8:6: error: stray '#' in program
    8 | .#.#.#.
      |      ^
a.cc:9:2: error: invalid preprocessing directive #.
    9 | #.#.#.#
      |  ^
a.cc:10:2: error: stray '#' in program
   10 | .#.#.#.
      |  ^
a.cc:10:4: error: stray '#' in program
   10 | .#.#.#.
      |    ^
a.cc:10:6: error: stray '#' in program
   10 | .#.#.#.
      |      ^
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 7 7
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
    #define int long long
    int H,W;
    cin>>H>>W;
    int ch,cw,dh,dw;
    cin>>ch>>cw>>dh>>dw;
    vector<string> vec(H);
    vector<vector<int>> tree(H*W,vector<int>(0));
    for(int i=0;i<H;i++){
        cin>>vec.at(i);
    }
    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(k>=0 && k<H && l>=0 && l<W){
                        if(vec.at(k).at(l)=='.'){
                            tree.at(i*W+j).push_back(k*W+l);
                        }
                    }
                }
            }
        }
    }
    //H×Wのグリッドグラフのダイクストラ.
    vector<int> dist(H*W,-1);
    vector<int> determined(H*W,0);
    priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> que;
    que.push(make_pair(0,0);//距離,座標
    dist.at(0)=0;
    while(!que.empty()){
        int v=que.top().second;//que.top().firstとdist.at(v)は同値.
        que.pop();
        if(determined.at(v)==1){continue;}
        determined.at(v)=1;
        for(int i=0;i<(int)tree.at(v).size();i++){
            int nv=tree.at(v).at(i);
            if(determine.at(nv)==1){continue;}
            int dist_to_v=dist.at(v);
            if(nv-v!=1 && nv-v!=-1 && nv-v!=W && nv-v!=-W){dist_to_v++;}
            if(dist.at(nv)!=-1 && dist_to_v>=dist.at(nv)){continue;}
            dist.at(nv)=dist_to_v;
            que.push(make_pair(dist_to_v,nv));
        }
    }
    cout<<dist.at((dh-1)*W+dw-1)<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:28: error: expected ')' before ';' token
   31 |     que.push(make_pair(0,0);//距離,座標
      |             ~              ^
      |                            )
a.cc:40:16: error: 'determine' was not declared in this scope; did you mean 'determined'?
   40 |             if(determine.at(nv)==1){continue;}
      |                ^~~~~~~~~
      |                determined
Language: C++

#include <bits/stdc++.h>
using namespace std;  
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define Rep(i, a, b) for(ll i = a; i <= b; i++)
#define repr(i, a, b) for(ll i = b-1; i >= a; i--)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
using ll = long long;
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define co(x) cout << x << endl
#define coel cout << endl
#define pb push_back
#define sz(v) ((ll)(v).size())
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
// const ll INF = 1LL << 60;
const ll INF = 1000000000;
#define pp pair<ll, pair<ll, ll>> 
#define fi first
#define se second



////////////////////////////////////////////////////////

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

ll H, W;
string s[1010];
ll F[1010][1010];
ll sy, sx, gy, gx; 

void bfs(){
    rep(i, 0, 1010) rep(j, 0, 1010) F[i][j] = INF;

    deque<pair<ll, ll>> qu;
    qu.push_front({sy, sx});
    F[sy][sx] = 0;
    while(!qu.empty()){
        ll y, x;
        y = qu.front().first, x = qu.front().second;
        qu.pop_front();
        rep(i, 0, 4){
            ll ny, nx;
            ny = y + dy[i], nx = x + dx[i];
            if(ny < 0 || ny >= H || nx < 0 || nx >= W) continue;
            if(s[ny][nx] == '#') continue;
            if(F[ny][nx] > F[y][x])  continue;
            chmin(F[ny][nx], F[y][x])
            qu.push_front({ny, nx});
        }
        Rep(i, -2, 2) Rep(j, -2, 2){
            ll ny, nx;
            ny = y + i, nx = x + j;
            if(ny < 0 || ny >= H || nx < 0 || nx >= W) continue;
            if(s[ny][nx] == '#') continue;
            if(F[ny][nx] <= F[y][x]+1)  continue;
            chmin(F[ny][nx], F[y][x]+1);
            qu.push_back({ny, nx});
        }
        t++;
    }
}

int main() {
    cin >> H >> W;
    cin >> sy >> sx >> gy >> gx;
    sy--, sx--, gy--, gx--;
    rep(i, 0, H)  cin >> s[i];

    bfs();

    co((F[gy][gx]==INF ? -1 : F[gy][gx]));

    return 0;
}
 
 


Compiler output:
a.cc: In function 'void bfs()':
a.cc:56:13: error: expected ';' before 'qu'
   56 |             qu.push_front({ny, nx});
      |             ^~
a.cc:56:35: error: expected primary-expression before ')' token
   56 |             qu.push_front({ny, nx});
      |                                   ^
a.cc:67:9: error: 't' was not declared in this scope
   67 |         t++;
      |         ^
Language: C++

#include <memory.h>

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

using namespace std;

#define MOD 1000000007

char c[1000][1000];
vector<vector<pair<int, int>>> graph(h *w);

int main()
{
    int h, w;
    cin >> h >> w;
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    sx--;
    sy--;
    tx--;
    ty--;
    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            cin >> c[i][j];
        }
    }
    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            if (c[i][j] == '#')
                continue;
            for (int l = max(0, i - 2); l < min(h, i + 3); l++)
            {
                for (int k = max(0, j - 2); k < min(w, j + 3); k++)
                {
                    if (l == i && k == j || c[l][k] == '#')
                        continue;
                    if (abs(l - i) + abs(k - j) == 1)
                    {
                        graph[w * i + j].push_back(make_pair(w * l + k, 0));
                    }
                    else
                    {
                        graph[w * i + j].push_back(make_pair(w * l + k, 1));
                    }
                }
            }
        }
    }
    priority_queue<pair<int, int>> qu;
    qu.push(make_pair(0, w * sx + sy));
    vector<int> res(w * w, MOD);
    while (!qu.empty())
    {
        int now = (qu.top()).second;
        int cost = -(qu.top()).first;
        qu.pop();
        if (cost > res[now])
            continue;
        for (int i = 0; i < graph[now].size(); i++)
        {
            int next = graph[now][i].first;
            int nextc = cost + graph[now][i].second;
            if (res[next] > nextc)
            {
                res[next] = nextc;
                qu.push(make_pair(-nextc, next));
            }
        }
    }
    if (res[w * tx + ty] == MOD)
        cout << -1 << endl;
    else
        cout << res[w * tx + ty] << endl;
}

Compiler output:
a.cc:27:38: error: 'h' was not declared in this scope
   27 | vector<vector<pair<int, int>>> graph(h *w);
      |                                      ^
a.cc:27:41: error: 'w' was not declared in this scope
   27 | vector<vector<pair<int, int>>> graph(h *w);
      |                                         ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007
int main() {
	ll h,w;
	cin>>h>>w;
	ll dx[4]={1,0,-1,0};
	ll dy[4]={0,1,0,-1};
	ll ch,cw,dh,dw;
	cin>>ch>>cw>>dh>>dw;
	ch--;cw--;dh--;dw--;
	char s[1002][1003];
	ll ans[1002][1002];
	for(ll i=0;i<h;i++){
		for(ll j=0;j<w;j++){
			cin>>s[i][j];
			ans[i][j]=-1;
		}
	}
	queue<pair<ll,ll>>q,r;
	q.push(make_pair(ch,cw));
	ans[ch][cw]=0;
	while(q.size()!=0){
		while(q.size()!=0){
			pair<ll,ll>now=q.front();
			r.push(make_pair(nexh,nexw));			
			q.pop();
			ll nowh=now.first;
			ll noww=now.second;
			for(ll i=0;i<4;i++){
				ll nexh=nowh+dx[i];
				ll nexw=noww+dy[i];
				if(nexh<0||nexw<0||nexh==h||nexw==w){
					continue;
				}
				if(s[nexh][nexw]=='#'){
					continue;
				}
				if(ans[nexh][nexw]!=-1){
					continue;
				}
				ans[nexh][nexw]=ans[nowh][noww];
				q.push(make_pair(nexh,nexw));
				r.push(make_pair(nexh,nexw));
			}
		}
		while(r.size()!=0){
			pair<ll,ll>now=r.front();
			r.pop();
			ll nowh=now.first;
			ll noww=now.second;
			for(ll i=-2;i<3;i++){
				for(ll j=-2;j<3;j++){
					if(i==0&&j==0){
						continue;
					}
					ll nexh=nowh+i;
					ll nexw=noww+j;
					if(nexh<0||nexw<0||nexh>=h||nexw>=w){
					continue;
					}
					if(s[nexh][nexw]=='#'){
					continue;
					}
					if(ans[nexh][nexw]!=-1){
					continue;
					}
					ans[nexh][nexw]=ans[nowh][noww]+1;
					if(nexh==dh&&nexw==dw){
					cout << ans[nexh][nexw];
					return 0;
					}
					q.push(make_pair(nexh,nexw));
				}
			}
		}
	}
	cout << ans[dh][dw]<<endl;
	// your code goes here
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:42: error: 'nexh' was not declared in this scope
   28 |                         r.push(make_pair(nexh,nexw));
      |                                          ^~~~
a.cc:28:47: error: 'nexw' was not declared in this scope
   28 |                         r.push(make_pair(nexh,nexw));
      |                                               ^~~~
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;

#include <math.h>
#include <iomanip>
#include <vector>
#include <queue>
#include <climits>
using Graph = vector<vector<int>>;
const double PI = 3.14159265358979323846;
#define int long long


void main() {


	int H, W,Ch,Cw,Dh,Dw;
	char S[20][20];
	int kaisu[20][20];
	queue<pair<int, int>>  mk,kk;
	//mk(未開拓)kk(既開拓)

	pair<int, int> tmp;
	
	cin >> H >>W>>Ch>>Cw>>Dh>>Dw;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> S[i+1][j+1];
			kaisu[i+1][j+1] = -1;
		}
	}
	for (int i = 0; i < H+1; i++) {
		S[i][0] = '#';
		S[i][W + 1] = '#';
	}
	for (int j = 0; j < W + 1; j++) {
		S[0][j] = '#';
		S[H+1][j] = '#';
	}

	if (S[Ch][Cw - 1] == '#'&&S[Ch][Cw + 1] == '#'&&S[Ch - 1][Cw] == '#'&&S[Ch + 1][Cw] == '#') {
		kk.push(make_pair(Ch, Cw));
	}
	else {
		mk.push(make_pair(Ch, Cw));
	}
	kaisu[Ch][Cw] = 0;

	int count = 0;
	for (int sasakama = 0; sasakama < H*W*5; sasakama++) {
		if(mk.size()!=0){
			tmp = mk.front();
			int h = tmp.first;
			int w = tmp.second;
			if (S[h + 1][w] == '.' && kaisu[h + 1][w] == -1) {
				mk.push(make_pair(h + 1, w));
				kaisu[h+1][w] = count;
			}
			if (S[h - 1][w] == '.' && kaisu[h - 1][w] == -1) {
				mk.push(make_pair(h - 1, w));
				kaisu[h-1][w] = count;
			}
			if (S[h][w+1] == '.' && kaisu[h][w+1] == -1) {
				mk.push(make_pair(h, w+1));
				kaisu[h][w+1] = count;
			}
			if (S[h][w-1] == '.' && kaisu[h][w-1] == -1) {
				mk.push(make_pair(h, w-1));
				kaisu[h][w-1] = count;
			}
			kk.push(tmp);
			if (h == Dh&&w == Dw) {
				break;
			}
			mk.pop();
		} else if (kk.size() != 0) {
			count++;
			for (int i = 0; i < kk.size(); i++) {
				tmp = kk.front();
				int h = tmp.first;
				int w = tmp.second;
				for (int j = -2; j < 3; j++) {
					for (int k = -2; k < 3; k++) {
						if (h + j >= 1 && h + j <= H&&w + k >= 1&& w + k <= W){
							if (S[h + j][w + k] == '.' && kaisu[h + j][w + k] == -1) {
								mk.push(make_pair(h + j, w + k));
								kaisu[h + j][w + k] = count;
							}
						}
					}
				}
				kk.pop();
			}
		}
		if (sasakama == H*W * 5 - 1) {
			count = -1;
			break;
		}
	}


	cout << count <<endl;

	cin >> count;


}



Compiler output:
a.cc:17:1: error: '::main' must return 'int'
   17 | void main() {
      | ^~~~