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

#include<iostream>
#include<vector>
#include<string>
#include <queue>
#include<map>
#include <cstring>
using namespace std;
#define ll long long int

vector<vector<ll>> dis(1001 , vector<ll>(1001 , INT_MAX)) ;
bool check(int i , int j , vector<vector<bool> >&vis , vector<vector<char> > &v)
 {
     return (i >= 0 && i < v.size() && j >= 0 && j < v[0].size() && !vis[i][j] && v[i][j] == '.' ) ;
 }
void dfs(int i , int j , vector<vector<bool> >&vis , vector<vector<char> > &v , ll cnt)
{
    if(!check(i , j , vis , v))
        return ;

    vis[i][j] = true ;
    dis[i][j] = min(dis[i][j] , cnt) ;
    dfs(i + 1 , j , vis , v , cnt) ;
    dfs(i - 1 , j , vis , v , cnt) ;
    dfs(i  , j + 1, vis , v , cnt) ;
    dfs(i  , j - 1, vis , v , cnt) ;


    return ;
}
int main()
{
    ll n , m , x1 , x2 , y1 , y2;
    cin>>n>>m ;
    cin>>x1>>y1 ;
    cin>>x2>>y2 ;
    x1-- ;
    x2--;
    y1--;
    y2-- ;
    vector<vector<char> > v(n , vector<char>(m)) ;
    vector<vector<bool> > vis(n , vector<bool>(m , false)) ;
    for(int i = 0 ; i < n ; i++)
    {
       for(ll j = 0 ; j < m ; j++)
        {
            cin>>v[i][j] ;
        }
    }
    dfs(x1 , y1 , vis , v , 0) ;

    if(vis[x2][y2])
    {
        cout<<0 ;
        return 0 ;
    }

    for(int i = 0 ; i < n ; i++)
    {
        for(int j = 0  ;j < m ; j++)
        {
            if(vis[i][j])
            {

                for(int k = i - 2 ; k <= i + 2 ; k++)
                {
                    for(int t = j - 2 ;  t <= j + 2 ; t++)
                    {
                        if(k >= 0 && k < n && t >= 0 && t < m && !vis[k][t] && v[k][t] == '.')
                            dfs(k , t , vis , v , dis[i][j] + 1) ;
                    }
                }
            }
        }
    }

    if(dis[x2][y2] == INT_MAX)
        cout<<-1 ;
    else
        cout<<dis[x2][y2] ;

}


Compiler output:
a.cc:10:49: error: 'INT_MAX' was not declared in this scope
   10 | vector<vector<ll>> dis(1001 , vector<ll>(1001 , INT_MAX)) ;
      |                                                 ^~~~~~~
a.cc:7:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    6 | #include <cstring>
  +++ |+#include <climits>
    7 | using namespace std;
a.cc: In function 'int main()':
a.cc:76:23: error: 'INT_MAX' was not declared in this scope
   76 |     if(dis[x2][y2] == INT_MAX)
      |                       ^~~~~~~
a.cc:76:23: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

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

template<class T>
using V = vector<T>;
template<class T>
using VV = V<V<T> >;
using pii = pair<int, int>;

#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for(int i=m; i<n; i++)
#define mp make_pair
#define fi first
#define se second


const int INF = 1 << 30;

int main(){
    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--;
    VV<char> S(H, V<char>(W));
    rep(i, H){
        rep(j, W) cin >> S.at(i).at(j);
    }
    
    VV<int> dis(H, V<int>(W, INF));
    queue<pii> update;
    V<int> h_list = {-1, 0, 1, 0}, w_list = {0, -1, 0, 1};

    dis.at(C_h).at(C_w) = 0;
    update.push(mp(C_h, C_w));

    while(!update.empty()){
        pii p = update.front();
        update.pop();
        int d = dis.at(p.fi).at(p.se);
        int h, w;
        rep(i, 4){
            h = p.fi + h_list.at(i);
            w = p.se + w_list.at(i);
            if(0 <= h && h < H && 0 <= w && w < W && S.at(h).at(w) == '.' && dis.at(h).at(w) > d){
                dis.at(h).at(w) = d;
                update.push(mp(h, w));
            }
        }

        d++;
        rep2(i, -2, 3){
            rep2(j, -2, 3){
                h = p.fi + i;
                w = p.se + j;
                if(0 <= h && h < H && 0 <= w && w < W && S.at(h).at(w) == '.' && dis.at(h).at(w) > d){
                    dis.at(h).at(w) = d;
                    update.push(mp(h, w));
                }
            }
        }
    }
    if(dis.at(D_h).at(D_w) == INF) cout << -1 << endl;
    else cout << dis.at(D_h).at(D_w) << endl;
}

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

#include <iostream>
using namespace std;

int ans, fans;
int bx, by, ex, ey;
int a[1001][1001];
bool b[1001][1001];
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
int h, w;
char c;
bool fnd;

void dfs1(int x, int y) {
	if (x <= 0 || x > h || y <= 0 || y > w) return ;
	if (b[x][y]) return;
	//cout << x << " " << y << endl;
	if (x == ex && y == ey) {
		fans = ans;
		fnd = true;
		return;
	}
	b[x][y] = true;
	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 4; j++) {
			if (a[x + dx[i]][y + dy[j]] == 1) {
				//b[x][y] = true;
				dfs1(x + dx[i], y + dy[j]);
				//b[x][y] = false;
			}
		}
	}
	return;
}

void dfs2(int x, int y) {
	if (x <= 0 || x > h || y <= 0 || y > w) return;
	if (b[x][y]) return;
	//cout << x << " " << y << endl;
	if (x == ex && y == ey) {
		fans = ans;
		return;
	}
	b[x][y] = true;
	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 4; j++) {
			if (a[x + dx[i]][y + dy[j]] == 1) {
				//b[x][y] = true;
				dfs2(x + dx[i], y + dy[j]);
				//b[x][y] = false;
			}
		}
	}
	for (int i = x - 2; i <= x + 2; i++) {
		for (int j = y - 2; j <= y + 2; j++) {
			for (int i = 0; i < 4; i++) {
				for (int j = 0; j < 4; j++) {
					if (i == x + dx[i] && j == y + dy[j]) {
						continue;
					}
					if (i == x && j == y) continue;
				}
			}
			if (a[i][j] == 1) {
				ans++;
				//b[x][y] = true;
				dfs2(i, j);
				//b[x][y] = false;
				ans--;
			}
		}
	}
	return;
}

int main() {
	cin >> h >> w;
	cin >> bx >> by;
	cin >> ex >> ey;
	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			cin >> c;
			if (c == '.') a[i][j] = 1;
		}
	}
	dfs1(bx, by);
	if (fnd) {
		cout << 0 << endl;
		return 0;
	}
	memset(b, 0, sizeof(b));
	dfs2(bx, by);
	if (fans) {
		cout << fans << endl;
	}
	else {
		cout << -1 << endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:91:9: error: 'memset' was not declared in this scope
   91 |         memset(b, 0, sizeof(b));
      |         ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | using namespace std;
Language: C++

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

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

void setComponentByDFS(int i, int j, int comp_cnt, vector<string> &A, vector<vector<int>> &component, int H, int W) {
  component[i][j] = comp_cnt;
  for (int k = 0; k < 4; ++k) {
    int ni = i + di[k], nj = j + dj[k];
    if(ni >= 0 && ni < H && nj >= 0 && nj < W && A[ni][nj] == '.' && component[ni][nj] == -1)
      setComponentByDFS(ni, nj, comp_cnt, A, component, H, W);
  }
}

int main() {
  int H, W; cin >> H >> W:
  int Ch, Cw; cin >> Ch >> Cw;
  int Dh, Dw; cin >> Dh >> Dw;
  vector<string> A(H);
  for (int i = 0; i < H; ++i) cin >> A[i];
  // DFS를 이용하여 component로 묶기
  vector<vector<int>> component(H, vector<int>(W, -1));
  int comp_cnt = 0;
  for (int i = 0; i < H; ++i) {
    for (int j = 0; j < W; ++j) {
      if(A[i][j] == '.' && component[i][j] == -1) {
        setComponentByDFS(i, j, comp_cnt++, A, component, H, W);
      }
    }
  }
  // 각 component 들이 magic move를 통해 연결될 수 있는지 확인
  vector<set<int>> adj(comp_cnt);
  for (int i = 0; i < H; ++i) {
    for (int j = 0; j < W; ++j) {
      if(A[i][j] == '.') {
        for (int xi = -2; xi <= 2; ++xi) {
          for (int xj = -2; xj <= 2; ++xj) {
            int ni = i + xi, nj = j + xj;
            if(ni >= 0 && ni < H && nj >= 0 && nj < W && A[ni][nj] == '.')
              adj[component[i][j]].insert(component[ni][nj]);
          }
        }
      }
    }
  }
  // BFS를 통해 최단거리를 계산함
  queue<int> Q;
  int src = component[Ch][Cw], dst = component[Dh][Dw];
  vector<int> dist(comp_cnt, -1);
  dist[src] = 0;
  Q.push(src);
  while(!Q.empty()){
    int here = Q.front(); Q.pop();
    for (auto next : adj[here]) {
      if(dist[next] == -1) {
        dist[next] = dist[here] + 1;
        Q.push(next);
      }
    }
  }
  cout << dist[dst] << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:26: error: expected ';' before ':' token
   17 |   int H, W; cin >> H >> W:
      |                          ^
      |                          ;
a.cc:18:22: error: 'Ch' was not declared in this scope
   18 |   int Ch, Cw; cin >> Ch >> Cw;
      |                      ^~
a.cc:18:28: error: 'Cw' was not declared in this scope
   18 |   int Ch, Cw; cin >> Ch >> Cw;
      |                            ^~
a.cc:62:16: error: 'dst' was not declared in this scope; did you mean 'dist'?
   62 |   cout << dist[dst] << endl;
      |                ^~~
      |                dist
Language: C

#include<iostream>
#include<deque>
using namespace std;


struct misaka{
	int x,y;
	int cnt;
}e;

int n,m;
int sx,sy;
int ex,ey;
char g[2000][2000];
bool st[2000][2000];
int dx[4]={0,0,1,-1},dy[4]={1,-1,0,0};
int ans = 10e8;

void bfs(){
	deque<misaka> q;
	q.push_back({sx,sy,0});
	
	while(!q.empty()){
		auto tmp = q.front();
		q.pop_front();
		
		int x = tmp.x;
		int y = tmp.y;
		int cnt = tmp.cnt;
		
		if(x == ex && y == ey){
			ans = cnt;
			return;
		}
		
		if(st[x][y]) 
			continue;
		st[x][y] = true;
		
		for(int i = 0;i < 4;++i){
			int tx = x + dx[i];
			int ty = y + dy[i];
			
			if(tx < 1 || tx > n || ty < 1 || ty > m || g[tx][ty] == '#')
				continue;
			
			q.push_front({tx,ty,cnt});
		}
		
		for(int i = x - 2;i <= x + 2;++i){
			for(int j = y - 2;j <= y + 2;++j){
				if(i < 1 || i > n || j < 1 || j > m || g[i][j] == '#')
					continue;
				
				q.push_back({i,j,cnt+1});
			}
		}
		
	}
}
int main(){
	scanf("%d %d %d %d %d %d",&n,&m,&sx,&sy,&ex,&ey);
	
	for(int i = 1;i <= n;++i)
		scanf("%s",g[i]+1);
		
		
	bfs();
	
	if(ans == 10e8) 
		printf("-1\n");
	else
		printf("%d\n",ans);
		
	return 0;
} 

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

#include <iostream>
#include <deque>
#include <vector>
#include <string>
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 ch, cw;
  cin >> ch >> cw;
  --ch; --cw;
  int dh, dw;
  cin >> dh >> dw;
  --dh; --dw;
  vector<string> s(h);
  for(int i = 0;i < h;i++){
    for(int j = 0;j < w;j++){
      cin >> s[i][j];
    }
  }
  deque<P> q;
  vector<vector<int> > dist(h,vector<int>(w,10000));
  q.emplace_back(ch,cw);
  dist[ch][cw] = 0;
  while(!q.empty()){
    int i = q.front().first;
    int j = q.front().second;
    q.pop_front();
    int d = dist[i][j];
    for(int v = 0;v < 4;v++){
      int ni = i + di[v];
      int 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; ej <= 2; ej++){
        int ni = i + ei;
        int 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[dh][dw];
  if(ans == 10000){
    ans = -1;
  }
  cout << ans;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:26: error: expected primary-expression before ',' token
   40 |       q.emplace_front(ni,,nj);
      |                          ^
Language: C++

#include <iostream>
#include <deque>
#include <vector>
#include <string>
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 ch, cw;
  cin >> ch >> cw;
  --ch; --cw;
  int dh, dw;
  cin >> dh >> dw;
  --dh; --dw;
  vector<string> s(h);
  for(int i = 0;i < h;i++){
    for(int j = 0;j < w;j++){
      cin >> s[i][j];
    }
  }
  deque<P> q;
  vector<vector<int> > dist(h,vector<int>(w,10000));
  q.emplace_back(ch,cw);
  dish[ch][cw] = 0;
  while(!q.empty()){
    int i = q.front().first;
    int j = q.front().second;
    q.pop_front();
    int d = dist[i][j];
    for(int v = 0;v < 4;v++){
      int ni = i + di[v];
      int 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; ej <= 2; ej++){
        int ni = i + ei;
        int 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[dh][dw];
  if(ans == 10000){
    ans = -1;
  }
  cout << ans;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:3: error: 'dish' was not declared in this scope; did you mean 'dist'?
   27 |   dish[ch][cw] = 0;
      |   ^~~~
      |   dist
a.cc:40:26: error: expected primary-expression before ',' token
   40 |       q.emplace_front(ni,,nj);
      |                          ^
Language: C

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;

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

int main() {
	int H, W;
	cin >> H >> W;

	int CH, CW, DH, DW;
	cin >> CH >> CW >> DH >> DW;

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

	int sx = CH - 1;
	int sy = CW - 1;

	int cnt = 0;

	queue<pair<int, int>> startP;
	startP.push(make_pair(sx, sy));

	vector<vector<int>> dist(H, vector<int>(W, -1));

	while (!startP.empty()) {
		pair<int, int> startPoint = startP.front();
		int sx = startPoint.first;
		int sy = startPoint.second;
		startP.pop();

		if (dist[sx][sy] != -1) {
			continue;
		}

		if (sx + 1 == DH && sy + 1 == DW) {
			cout << cnt << endl;
			return 0;
		}

		dist[sx][sy] = cnt;

		queue<pair<int, int>> que;
		que.push(make_pair(sx, sy));

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

			for (int direction = 0; direction < 4; ++direction) {
				int next_x = x + dx[direction];
				int next_y = y + dy[direction];
				if (next_x < 0 || next_x >= H || next_y < 0 || next_y >= W) {
					continue;
				}
				if (field[next_x][next_y] == '#') {
					continue;
				}

				if (next_x + 1 == DH && next_y + 1 == DW) {
					cout << cnt << endl;
					return 0;
				}

				if (dist[next_x][next_y] == -1) {
					que.push(make_pair(next_x, next_y));
					dist[next_x][next_y] = cnt;
				}
			}
		}

		for (int h = 0; h < H; ++h) {
			for (int w = 0; w < W; ++w) {
				if (dist[h][w] == cnt) {
					for (int i = -2; i <= 2; ++i) {
						for (int j = -2; j <= 2; ++j) {
							int check_x = h + i;
							int check_y = w + j;

							if (check_x < 0 || check_x >= H || check_y < 0 || check_y >= W) {
								continue;
							}
							if (field[check_x][check_y] == '#') {
								continue;
							}
							if (dist[check_x][check_y] != -1) {
								continue;
							}

							startP.push(make_pair(check_x, check_y));
						}
					}
				}
			}
		}

		cnt++;
	}

	cout << "-1" << endl;
	return 0;
}


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

#include<bits/stdc++.h>
#define endl '\n'
#define int long long
#define inf  100000007
#define f first
#define s second

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

void BFS(vector<vector<bool>>& v,vector<vector<int>>& b,pii& nodo,int& h,int& w){
	queue<pii> p;
	//priority_queue<pair<int,int>,vector<pair<int,int>>,std::greater<pair<int,int>>>p;
	p.push(nodo);

	while(!p.empty()){
		pii act=p.top();
		p.pop();

		int new_b=b[act.f][act.s];

		for(int i=-2;i<2;i++){
			for(int j=-2;j<2;j++){

				int Ci=act.f+i;
				int Cj=act.s+j;
				pii x={Ci,Cj};
				if(!(Ci<h && Ci>=0 && Cj<w && Cj>=0 && v[Ci][Cj]))continue;

				if(!i && !j)continue;
				if(b[x.f][x.s]<=new_b)continue;
					
				b[x.f][x.s]=new_b;
				if(abs(i)+abs(j)>1){
					b[x.f][x.s]++;
				}
				p.push(x);
			}
		}
	}
}
 
int32_t main ()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	
	int H,W;
	int Ch,Cw;
	int Dh,Dw;
	cin>>H>>W>>Ch>>Cw>>Dh>>Dw;

	Ch--;Cw--;Dh--;Dw--;

	vector<vector<bool>> v(H,vector<bool>(W));
	vector<vector<int>> b(H,vector<int>(W,inf));

	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			char c;
			cin>>c;
			if(c=='.'){
				v[i][j]=1;
			}
		}
	}

	if(!v[Dh][Dw])cout<<(-1)<<endl;
	else{
		b[Dh][Dw]=0;
		pii nodo={Dh,Dw};
		BFS(v,b,nodo,H,W);
		if(b[Ch][Cw]==inf)cout<<(-1)<<endl;
		else cout<<b[Ch][Cw]<<endl;
	}	
	
	return 0;
}


Compiler output:
a.cc: In function 'void BFS(std::vector<std::vector<bool> >&, std::vector<std::vector<long long int> >&, pii&, long long int&, long long int&)':
a.cc:17:27: error: 'class std::queue<std::pair<long long int, long long int> >' has no member named 'top'; did you mean 'pop'?
   17 |                 pii act=p.top();
      |                           ^~~
      |                           pop
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
using namespace std;
typedef long long ll;


void solve(){
	int n,m, sx, sy, fx, fy;
	cin >> n >> m >> sx >> sy >> fx >> fy;
	sx--;sy--;fx--;fy--;
	string arr[n];
	for (int i = 0; i < n; i++)
		cin >> arr[i];
	int dist[n][m];
	for (int i = 0; i < n; i++)
		for (int j = 0; j < m; j++)
			dist[i][j] = 1000000001;
	deque<pair<int,int> > dq;
	dist[sx][sy] = 0;
	dq.push_front(make_pair(sx,sy));
	int d0x[4] = {1, 0, 0, -1};
	int d0y[4] = {0, 1, -1, 0};
	while(dq.size()){
		int x = dq.front().first, y = dq.front().second;
		dq.pop_front();
		for (int i = 0; i < 4; i++){
			int xn = x + d0x[i], yn = y + d0y[i];
			if (xn < n && xn >= 0 && yn < m && yn >= 0 && arr[xn][yn] == '.' && dist[xn][yn] > dist[x][y]){
				dist[xn][yn] = dist[x][y];
				dq.push_front(make_pair(xn,yn));
			}
		}
		for (int dx = -2; dx <= 2; dx ++)
			for(int dy = -2; dy <= 2; dy++){
				int xn = x + dx, yn = y + dy;
				if (!(dx == 0 and dy == 0) and xn < n && xn >= 0 && yn < m && yn >= 0 && arr[xn][yn] == '.' && dist[xn][yn] > dist[x][y] + 1){
					dist[xn][yn] = dist[x][y] + 1;
					dq.push_back(make_pair(xn,yn));
				}
			}
	}
	if (dist[fx][fy] == INT_MAX)
		cout << -1 << endl;
	else cout << dist[fx][fy] << endl;
}

int main(){
	int TC = 1;
	//cin >> TC;
	for (int tcc = 1; tcc <= TC; tcc++){
		//cout << "Case #"<< tcc << ": ";
		solve();
	}
	return 0;
		
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:63:29: error: 'INT_MAX' was not declared in this scope
   63 |         if (dist[fx][fy] == INT_MAX)
      |                             ^~~~~~~
a.cc:24:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   23 | #include <assert.h>
  +++ |+#include <climits>
   24 | using namespace std;
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
using namespace std;
typedef long long ll;


void solve(){
	int n,m, sx, sy, fx, fy;
	cin >> n >> m >> sx >> sy >> fx >> fy;
	sx--;sy--;fx--;fy--;
	string arr[n];
	for (int i = 0; i < n; i++)
		cin >> arr[i];
	int dist[n][m];
	for (int i = 0; i < n; i++)
		for (int j = 0; j < m; j++)
			dist[i][j] = INT_MAX;
	deque<pair<int,int> > dq;
	dist[sx][sy] = 0;
	dq.push_front(make_pair(sx,sy));
	int d0x[4] = {1, 0, 0, -1};
	int d0y[4] = {0, 1, -1, 0};
	while(dq.size()){
		int x = dq.front().first, y = dq.front().second;
		dq.pop_front();
		for (int i = 0; i < 4; i++){
			int xn = x + d0x[i], yn = y + d0y[i];
			if (xn < n && xn >= 0 && yn < m && yn >= 0 && arr[xn][yn] == '.' && dist[xn][yn] > dist[x][y]){
				dist[xn][yn] = dist[x][y];
				dq.push_front(make_pair(xn,yn));
			}
		}
		for (int dx = -2; dx <= 2; dx ++)
			for(int dy = -2; dy <= 2; dy++){
				int xn = x + dx, yn = y + dy;
				if (!(dx == 0 and dy == 0) and xn < n && xn >= 0 && yn < m && yn >= 0 && arr[xn][yn] == '.' && dist[xn][yn] > dist[x][y] + 1){
					dist[xn][yn] = dist[x][y] + 1;
					dq.push_back(make_pair(xn,yn));
				}
			}
	}
	if (dist[fx][fy] == INT_MAX)
		cout << -1 << endl;
	else cout << dist[fx][fy] << endl;
}

int main(){
	int TC = 1;
	//cin >> TC;
	for (int tcc = 1; tcc <= TC; tcc++){
		//cout << "Case #"<< tcc << ": ";
		solve();
	}
	return 0;
		
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:38:38: error: 'INT_MAX' was not declared in this scope
   38 |                         dist[i][j] = INT_MAX;
      |                                      ^~~~~~~
a.cc:24:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   23 | #include <assert.h>
  +++ |+#include <climits>
   24 | using namespace std;
a.cc:63:29: error: 'INT_MAX' was not declared in this scope
   63 |         if (dist[fx][fy] == INT_MAX)
      |                             ^~~~~~~
a.cc:63:29: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int;
/* clang-format off */
#define MOD 1000000007
#define INF 1000000000
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(a) (a).begin(), (a).end()
#define __DEBUG__
#ifdef __DEBUG__
#define CH_P(a) cout <<"check_point("<<#a<<")" << "\n";
#define DEBUG(x) cout<<#x<<":"<<x<<"\n"
#define DEBUGS(v) cout << #v << ":";for(auto x:v){cout<<x<<" ";}cout<<"\n"
#endif
#ifndef __DEBUG__
#define CH_P(a) 
#define DEBUG(x) 
#define DEBUGS(v) 
#endif
/* clang-format on */

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

  int h, w, sy, sx, gy, gx;
  deque<tuple<int, int, int>> walk;
  set<pair<int, int>> passed;
  vector<pair<int, int>> d = {{0, -1}, {0, 1}, {-1, 0}, {1, 0}};
  cin >> h >> w >> sy >> sx >> gy >> gx;
  sy--, sx--, gy--, gx--;
  vector<string> m(h);
  vector<vector<int>> warp_map(h, vector<int>(w, INF));
  REP(i, h) { cin >> m[i]; }

  walk.push_front({sy, sx, -1});
  passed.insert({sy, sx});

  while (!walk.empty()) {
    int y, x, warp;
    tie(y, x, warp) = walk.front();
    walk.pop_front();
    warp_map[y][x] = warp;

    //四方に歩いて探索
    for (auto [dy, dx] : d) {
      int cy = y + dy, cx = x + dx;
      if (0 <= cy && cy < h && 0 <= cx && cx < w && !passed.count({cy, cx}) &&
          m[cy][cx] == '.') {
        walk.push_front({cy, cx, warp});
        passed.insert({cy, cx});
      }
    }

    // 5x5四方にワープして探索
    for (int dy = -2; dy <= 2; dy++) {
      for (int dx = -2; dx <= 2; dx++) {
        int cy = y + dy, cx = x + dx;
        if (0 <= cy && cy < h && 0 <= cx &&
            cx < w &&  //! passed.count({cy, cx}) &&
            m[cy][cx] == '.' && warp_map[cy][cx] > warp + 1) {
          walk.push_back({cy, cx, warp + 1});
          // passed.insert({cy, cx});
        }
      }
    }
  }

  // REP(i, h) { DEBUGS(warp_map[i]); }
  cout << (warp_map[gy][gx] == INF ? -1 : warp_map[gy][gx]) << endl;
  return 0;
}


Compiler output:
a.cc:3:19: error: declaration does not declare anything [-fpermissive]
    3 | typedef long long int;
      |                   ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < n; i++)
static const long long INF = 100;
using p = pair<int64_t,int64_t>;

//引数として２つのpをとって移動の可否、更には魔法の有無を調べる関数
int cost(p p1, p p2,const vector<vector<char>> & road){
    if (p1 == p2){
        return -100;
    }
    else if (road[p1.first][p1.second] == '#' or road[p2.first][p2.second] == '#'){
        return -100;
    }
    else if (p1.first == p2.first and abs(p1.second - p2.second) < 2){
        return 0;
    }
    else if (p1.second == p2.second and abs(p1.first - p2.first) < 2){
        return 0;
    }
    else if (abs(p1.first - p2.first) < 3 and abs(p1.second - p2.second)){
        return 1;
    }
    else{
        return -100;
    }
}

//ダイクストラのアルゴリズム
int dijkstra(int h,int w,int xs,int ys,int xg, int yg,const vector<vector<char>> & road){
    int64_t min = INF;
    vector <vector<int>> color (h,vector<int> (w,0));
    vector <vector<int64_t>> d (h,vector<int64_t> (w,INF));
    d[xs][ys] = 0;
    color[xs][ys] = 1;
    while (true){
        min = INF;
        p u = {INF,INF};
        //着目する点(dが最小の点を定める)
        rep(i,h){
            rep(j,w){
                if (color[i][j] != 1){
                    if (d[i][j] < min){
                        min = d[i][j];
                        u = {i,j};
                    }
                }
            }
        }
        //全ての点が終わったら操作をやめる
        if (u.first == INF){
            break;
        }
        color[u.first][u.second] = 1;
        rep(i,h){    
            rep(j,w){
                p pp = {i,j};
                if (cost(u,pp,road) != -100 and d[pp.first][pp.second] > d[u.first][u.second] + cost(u,pp,road)){
                    d[pp.first][pp.second] = d[u.first][u.second] + cost(u,pp,road);
                }
            }
        }
        
    }
    return d[xg][yg]; 

}

int main(){
    int h,w,xs,ys,xg,yg
    cin >> h >> w >> xs >> ys >> xg >> yg;
    vector<vector<char>> road (h,vector<char>(w));
    rep(i,h){
        rep(j,w){
            cin >> road[i][j];
        }
    }
    cout << dijkstra(h,w,xs,ys,xg,yg,road) << endl;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:71:5: error: expected initializer before 'cin'
   71 |     cin >> h >> w >> xs >> ys >> xg >> yg;
      |     ^~~
a.cc:78:35: error: 'yg' was not declared in this scope; did you mean 'xg'?
   78 |     cout << dijkstra(h,w,xs,ys,xg,yg,road) << endl;
      |                                   ^~
      |                                   xg
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < n; i++)
static const long long INF = 100;
using p = pair<int64_t,int64_t>;

//引数として２つのpをとって移動の可否、更には魔法の有無を調べる関数
int cost(p p1, p p2,const vector<vector<char>> & road){
    if (p1 == p2){
        return -100;
    }
    else if (road[p1.first][p1.second] == '#' or road[p2.first][p2.second] == '#'){
        return -100;
    }
    else if (p1.first == p2.first and abs(p1.second - p2.second) < 2){
        return 0;
    }
    else if (p1.second == p2.second and abs(p1.first - p2.first) < 2){
        return 0;
    }
    else if (abs(p1.first - p2.first) < 3 and abs(p1.second - p2.second)){
        return 1;
    }
    else{
        return -100;
    }
}

//ダイクストラのアルゴリズム
int dijkstra(int h,int w,int xs,int ys,int xg, int yg,const vector<vector<char>> & road){
    int64_t min = INF;
    vector <vector<int>> color (h,vector<int> (w,0));
    vector <vector<int64_t>> d (h,vector<int64_t> (w,INF));
    d[xs][ys] = 0;
    color[xs][ys] = 1;
    while (true){
        min = INF;
        p u = {INF,INF};
        //着目する点(dが最小の点を定める)
        rep(i,h){
            rep(j,w){
                if (color[i][j] != 1){
                    if (d[i][j] < min){
                        min = d[i][j];
                        u = {i,j};
                    }
                }
            }
        }
        //全ての点が終わったら操作をやめる
        if (u.first == INF){
            break;
        }
        color[u.first][u.second] = 1;
        rep(i,h){    
            rep(j,w){
                p pp = {i,j};
                if (cost(u,pp,road) != -100 and d[pp.first][pp.second] > d[u.first][u.second] + cost(u,pp,road)){
                    d[pp.first][pp.second] = d[u.first][u.second] + cost(u,pp,road);
                }
            }
        }
        
    }
    return d[xg][yg]; 

}

int main(){
    int h,w,xs,ys,xg,yg;
    vector<vector<char>> road (h,vector<char>(w));
    cin >> h >> w >> xs >> ys >> xg >> yg;
    rep(i,h){
        rep(j,w){
            cin >> road[i][j];
        }
    }
    cout << dijkstra(h,w,xs,ys,xg,yg,ban) << endl;
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:78:38: error: 'ban' was not declared in this scope; did you mean 'tan'?
   78 |     cout << dijkstra(h,w,xs,ys,xg,yg,ban) << endl;
      |                                      ^~~
      |                                      tan
Language: C++

#include<cstdio>
#include <queue>
using namespace std;
char a[1004][1004];
int H, W, ch, cw, dh, dw, i, j;
std::vector<pair<int,int>> g[1000000];
int f(int x, int y) {
	return (x - 2) * H + y - 2;
}
int const inf = 1 << 30;

int main() {
	scanf("%d%d%d%d%d%d", &H, &W, &ch, &cw, &dh, &dw);
	int s = f(ch + 1, cw + 1), t = f(dh + 1, dw + 1);


	while (i++ < H)scanf("%s", a[i + 1] + 2);
	for (i = 1; i++ < H + 1;)
		for (j = 1; j++ < W + 1;)
			if (a[i][j] == '.') {
				int x = f(i, j);
				for (int k = i - 2; k < i + 3; k++)
					for (int l = j - 2; l < j + 3; l++) {
						int y = f(k, l);
						if (x != y && a[k][l] == '.') {
							int w = abs(k - i) + abs(l - j) > 1;
							g[x].emplace_back(y, w);
							g[y].emplace_back(x, w);
						}
					}
			}
	vector<int> dist(H * W, inf);
	dist[s] = 0;
	priority_queue<pair<int, int>> q;
	q.emplace(0, s);
	while (!q.empty()) {
		auto u = q.top().second;
		q.pop();
		for (auto const& p : g[u]) {
			int v = p.first, w = p.second;
			if (dist[v] > dist[u] + w) {
				dist[v] = dist[u] + w;
				q.emplace(-dist[v], v);
			}
		}
	}
	printf("%d\n", dist[t] < inf ? dist[t] : -1);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:65: error: 'abs' was not declared in this scope
   26 |                                                         int w = abs(k - i) + abs(l - j) > 1;
      |                                                                 ^~~
Language: C++

#include <queue>
using namespace std;
char a[1004][1004];
int H, W, ch, cw, dh, dw, i, j;
std::vector<pair<int,int>> g[1000000];
int f(int x, int y) {
	return (x - 2) * H + y - 2;
}
int const inf = 1 << 30;

int main() {
	scanf("%d%d%d%d%d%d", &H, &W, &ch, &cw, &dh, &dw);
	int s = f(ch + 1, cw + 1), t = f(dh + 1, dw + 1);


	while (i++ < H)scanf("%s", a[i + 1] + 2);
	for (i = 1; i++ < H + 1;)
		for (j = 1; j++ < W + 1;)
			if (a[i][j] == '.') {
				int x = f(i, j);
				for (int k = i - 2; k < i + 3; k++)
					for (int l = j - 2; l < j + 3; l++) {
						int y = f(k, l);
						if (x != y && a[k][l] == '.') {
							int w = abs(k - i) + abs(l - j) > 1;
							g[x].emplace_back(y, w);
							g[y].emplace_back(x, w);
						}
					}
			}
	vector<int> dist(H * W, inf);
	dist[s] = 0;
	priority_queue<pair<int, int>> q;
	q.emplace(0, s);
	while (!q.empty()) {
		auto u = q.top().second;
		q.pop();
		for (auto const& p : g[u]) {
			int v = p.first, w = p.second;
			if (dist[v] > dist[u] + w) {
				dist[v] = dist[u] + w;
				q.emplace(-dist[v], v);
			}
		}
	}
	printf("%d\n", dist[t] < inf ? dist[t] : -1);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'scanf' was not declared in this scope
   12 |         scanf("%d%d%d%d%d%d", &H, &W, &ch, &cw, &dh, &dw);
      |         ^~~~~
a.cc:25:65: error: 'abs' was not declared in this scope
   25 |                                                         int w = abs(k - i) + abs(l - j) > 1;
      |                                                                 ^~~
a.cc:46:9: error: 'printf' was not declared in this scope
   46 |         printf("%d\n", dist[t] < inf ? dist[t] : -1);
      |         ^~~~~~
a.cc:2:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    1 | #include <queue>
  +++ |+#include <cstdio>
    2 | using namespace std;
Language: C++

  /////////////////////////////////////////
 ///        author: matcha1024         ///
/////////////////////////////////////////

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define forin(in) for(int i=0; i<(int)in.size(); i++) cin>>in[i]
#define forout(out) for(int i=0; i<(int)out.size(); i++) cout<<out[i]<<endl
#define rep(i, n) for(int i=0; i<(n); i++)

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);
    forin(s);
    const int INF=1e+9;
    vector<vector<int>> dist(h, vector<int>(w, INF));
    deque<pair<int, int>> q;
    dist[si][sj]=0;
    q.emplace_back(si, sj);
    while(!q.empty()){
        int i = q.front().first;
        int j = q.front().second;
        q.pop_front();
        int d = dist[i][j];
        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; 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 ans = dist[ti][tj];
    if(ans == INF) ans = -1;
    cout<< ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:26: error: 'di' was not declared in this scope; did you mean 'ni'?
   31 |             int ni = i + di[v], nj = j + dj[v];
      |                          ^~
      |                          ni
a.cc:32:37: error: 'nj' was not declared in this scope; did you mean 'ni'?
   32 |             if(ni < 0 || ni >= h || nj < 0 || nj >= w) continue;
      |                                     ^~
      |                                     ni
a.cc:33:22: error: 'nj' was not declared in this scope; did you mean 'ni'?
   33 |             if(s[ni][nj] == '#') continue;
      |                      ^~
      |                      ni
a.cc:34:25: error: 'nj' was not declared in this scope; did you mean 'ni'?
   34 |             if(dist[ni][nj] <= d) continue;
      |                         ^~
      |                         ni
a.cc:35:22: error: 'nj' was not declared in this scope; did you mean 'ni'?
   35 |             dist[ni][nj] = d;
      |                      ^~
      |                      ni
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;

int d[5] = {-2,-1,0,1,2};

int h, w, sx, sy, gx, gy;
string s[1010];
ll cost[1010][1010];
bool seen[1010][1010];

int main(){
    cin >> h >> w;
    cin >> sy >> sx >> gy >> gx;
    sy--, sx--, gx--, gy--;
    rep(i, h) cin >> s[i];
    rep(i, h) rep(j, w) cost[i][j] = LINF;

    queue<pair<int,int>> que;
    cost[sy][sx] = 0;

    que.push({sx, sy});

    while(!que.empty()){
        auto p = que.front(); que.pop();
        int x = p.first, y = p.second;
        if (seen[y][x]) continue;
        seen[y][x] = 1;
        rep(i, 5) rep(j, 5){
            int nx = x + d[i];
            int ny = y + d[j];
            if (nx<0||w<=nx||ny<0||h<=ny||s[ny][nx]=='#') continue;
            if (seen[ny][nx] && cost[y][x] >= cost[ny][nx]) continue;

            if (abs(dd[i]) + abs(dd[j]) <= 1) cost[ny][nx] = min(cost[y][x], cost[ny][nx]);
            else cost[ny][nx] = min(cost[y][x]+1, cost[ny][nx]);
            que.push({nx,ny});
        }
    }

    if (cost[gy][gx]==LINF) cout << -1 << endl;
    else cout << cost[gy][gx] << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:21: error: 'dd' was not declared in this scope; did you mean 'd'?
   43 |             if (abs(dd[i]) + abs(dd[j]) <= 1) cost[ny][nx] = min(cost[y][x], cost[ny][nx]);
      |                     ^~
      |                     d
Language: C++

#include<bits/stdc++.h>
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>> s(h, vector<char>(w));
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      cin >> s.at(i).at(j);
    }
  }
  vector<vector<bool>> d(h, vector<bool>(w, true));
  d.at(ch).at(cw) = true;
  queue<pair<pair<int, int>, int>> que;
  que.push(pair(pair(ch, cw), 0));
  int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
  vector<int> goal;
  while(que.size()){
    pair<pair<int, int>, int> tmp = que.front(); que.pop();
    if(tmp.first.first == dh && tmp.first.second == dw){
      goal.push_back(tmp.second);
      continue;
    }
    bool check = true;
    int x = tmp.first.first, y = tmp.first.second;
    for(int i = 0; i < 4; i++){
      int tmpx = x + dx[i];
      int tmpy = y + dy[i];
      if(0 <= tmpx && tmpx < h && 0 <= tmpy && tmpy < w && s.at(tmpx).at(tmpy) == '.' && d.at(tmpx).at(tmpy)){
        d.at(tmpx).at(tmpy) = false;
        check = false;
        que.push(pair(pair(tmpx, tmpy), tmp.second));
      }
    }
    if(check){
      for(int i = -2; i <= 2; i++){
        for(int j = -2; j <= 2; j++){
          int tmpx = x + i;
          int tmpy = y + j;
          if(0 <= tmpx && tmpx < h && 0 <= tmpy && tmpy < w && s.at(tmpx).at(tmpy) == '.' && d.at(tmpx).at(tmpy)){
            d.at(tmpx).at(tmpy) = false;
            que.push(pair(pair(tmpx, tmpy), tmp.second + 1));
          }
        }
      }
    }
    check = true;
  }
  if(goal.size() == 0){
    cout << -1;
  }else{
    sort(goal.begin(), goal.end());
    cout << goal.at(0) 
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:62:23: error: expected ';' before '}' token
   62 |     cout << goal.at(0)
      |                       ^
      |                       ;
   63 |   }
      |   ~
Language: C++

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

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

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

int main() {
    int H,W;
    cin>>H>>W;
    int ch,cw,dh,dw;
    cin>>ch>>cw>>dh>>dw;
    UnionFind u((H+2)*(W+2));
    char s[H+2][W+2];
    for(int i=1;i<=H;++i){
        for(int j=1;j<=W;++j){
            cin>>s[i][j];
        }
    }
    for(int i=1;i<=H;++i){
        for(int j=1;j<=W;++j){
            for(int k=0;k<4;++k){
                if(s[i][j]=='.'&&s[i+dx[k]][j+dy[k]]=='.'){
                    u.unite((i-1)*H+j,(i+dx[k]-1)*H+j+dy[k]);
                }
            }
        }
    }
    for(int i=1;i<=H;++i){
        for(int j=1;j<=W;++j){
            int x=u.root((i-1)*H+j);
            d[i][j]=x;
        }
    }
    vector<vector<int>>g((H+2)*(W+2));
    for(int i=1;i<=H;++i){
        for(int j=1;j<=W;++j){
            for(int k=-2;k<=2;++k){
                for(int l=-2;l<=2;++l){
                    if(1<=i+k&&i+k<=H&&1<=j+l&&j+l<=W&&s[i][j]=='.'&&s[i+k][j+l]=='.'&&d[i][j]!=d[i+k][j+l]){
                        g[d[i][j]].push_back(d[i+k][j+l]);
                    }
                }
            }
        }
    }
    vector<int>ans((H+2)*(W+2),-1);
    queue<int>q;
    int x=u.root((ch-1)*H+cw),y=u.root((dh-1)*H+dw);
    ans[x]=0;
    q.push(x);
    while(!q.empty()){
        int v=q.front();
        q.pop();
        for(int nv:g[v]){
            if(ans[nv]!=-1)continue;
            ans[nv]=ans[v]+1;
            q.push(nv);
        }
    }
    cout<<ans[y]<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:57:13: error: 'd' was not declared in this scope
   57 |             d[i][j]=x;
      |             ^
a.cc:65:88: error: 'd' was not declared in this scope
   65 |                     if(1<=i+k&&i+k<=H&&1<=j+l&&j+l<=W&&s[i][j]=='.'&&s[i+k][j+l]=='.'&&d[i][j]!=d[i+k][j+l]){
      |                                                                                        ^
Language: C++

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



int H, W, Ch, Cw, Dh, Dw;


void bfs(vector<vector<char> > &maze, vector<vector<int> > &d) {
    vector<int> dx(4) = {1, -1, 0, 0};
    vector<int> dy(4) = {0, 0, 1, -1};
    deque<pair<int, int> > que;
    que.push_front(make_pair(Ch,Cw));
    d.at(Ch).at(Cw) = 0;

    while(que.size() > 0) {
        auto p = que.front();
        que.pop_front();
        int h = p.first;
        int w = p.second;
        rep(i, 4) {
            int hn = h + dy.at(i);
            int wn = w + dx.at(i);

            if(hn >= 0 && hn < H && wn >= 0 && wn < W) {
                if(maze.at(hn).at(wn) == '.' && (d.at(hn).at(wn) == -1 || d.at(hn).at(wn) > d.at(h).at(w))) {
                    que.push_front(make_pair(hn, wn));
                    d.at(hn).at(wn) = d.at(h).at(w);
                }
            }
        }

        rep(i, 5) {
            rep(j, 5) {
                int hn = h - 2 + i;
                int wn = w - 2 + j;

                if(hn >= 0 && hn < H && wn >= 0 && wn < W) {
                    if(maze.at(hn).at(wn) == '.' && (d.at(hn).at(wn) == -1 || d.at(hn).at(wn) > d.at(h).at(w) + 1)) {
                        que.push_front(make_pair(hn, wn));
                        d.at(hn).at(wn) = d.at(h).at(w) + 1;
                    }
                }

            }
        }
    }

}



int main () {
    cin >> H >> W >> Ch >> Cw >> Dh >> Dw;
    Ch--, Cw--, Dh--, Dw--;

    vector<vector<char> > maze(H,vector<char>(W));
    vector<vector<int> > d(H,vector<int>(W,-1));
    rep(i, H) {
        string s;
        cin >> s;
        rep(j, W) {
            maze.at(i).at(j) = s.at(j);
        }
    }

    bfs(maze,d);
    cout << d.at(Dh).at(Dw) << endl;
    

}

Compiler output:
a.cc: In function 'void bfs(std::vector<std::vector<char> >&, std::vector<std::vector<int> >&)':
a.cc:13:23: error: expected ',' or ';' before '=' token
   13 |     vector<int> dx(4) = {1, -1, 0, 0};
      |                       ^
a.cc:14:23: error: expected ',' or ';' before '=' token
   14 |     vector<int> dy(4) = {0, 0, 1, -1};
      |                       ^
Language: C++

#include<bits/stdc++.h>
#define bst           (ios_base:: sync_with_stdio(false),cin.tie(NULL));
#define bug(x)        cerr<<#x<<'='<<x<<endl;
#define lp(i,a,b)     for(int i=a; i<=b; i++)
#define ll            long long int
#define eb            emplace_back
#define pb            push_back
#define inp(n)        scanf("%lld", &n)
using namespace std;
ll lalax[4]={1, -1, 0, 0}, lalay[4]={0, 0, 1, -1};
ll qx[40000000], qy[40000000];
int main(){
    bst
    ll h, w, i, j, k;
    ll ch, cw, dh, dw;
    cin>>h>>w>>ch>>cw>>dh>>dw;
   /// scanf("%lld %lld%lld%lld%lld %lld", &h, &w, &ch, &cw, &dh, &dw);
    ch--; cw--; dh--; dw--;
    string str[h+5];
    for(i=0; i<h; i++) cin>>str[i];

    ll dist[h][w];
    for(i=0; i<h; i++) for(j=0; j<w; j++) dist[i][j]=9999999;
    dist[ch][cw]=0;
    ll m=1;
    qx[m]=ch, qy[m]=cw;
    ll curr=1;
    bool ok=false;
    while(curr<=m && !ok){
        ll x=qx[curr], y=qy[curr]; curr++;
        for(i=0; i<4; i++){
            ll tempx=x+lalax[i], tempy=y+lalay[i];
            if(tempx<0 || tempx>=h || tempy<0 || tempy>=w || str[tempx][tempy]=='#') continue;
            if(dist[tempx][tempy]>dist[x][y]){
                if(tempx==dx && tempy==dy && dist[x][y]==0) ok=true;
                qx[++m]=tempx; qy[m]=tempy;
                dist[tempx][tempy]=dist[x][y];
            }
        }
        for(i=x-2; i<=x+2; i++){
            for(j=y-2; j<=y+2; j++){
                ll tempx=i, tempy=j;
                if(tempx<0 || tempx>=h || tempy<0 || tempy>=w || str[tempx][tempy]=='#') continue;
                if(dist[tempx][tempy]>dist[x][y]+1){
                    qx[++m]=tempx; qy[m]=tempy;
                    dist[tempx][tempy]=dist[x][y]+1;
                }
            }
        }

    }
    if(dist[dh][dw]>=999999) cout<<-1<<endl;
    else cout<<dist[dh][dw]<<endl;







    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:27: error: 'dx' was not declared in this scope; did you mean 'x'?
   35 |                 if(tempx==dx && tempy==dy && dist[x][y]==0) ok=true;
      |                           ^~
      |                           x
a.cc:35:40: error: 'dy' was not declared in this scope; did you mean 'y'?
   35 |                 if(tempx==dx && tempy==dy && dist[x][y]==0) ok=true;
      |                                        ^~
      |                                        y
Language: C++

/**
 *    author        : Saurav Paul 
 *    created       : August 24, 2020 11:46 AM
 *    Problem Name  : D - Wizard in Maze
 *    Problem Limit : 2000 ms , 1024 MB
 *    Problem Url   : https://atcoder.jp/contests/abc176/tasks/abc176_d
 *    @genarated by : ai-virtual-assistant
**/
#include<bits/stdc++.h>
using namespace std;
const int nax = 1e3 + 10 ;
const int INF = 1e9 + 90 ;
int H , W ;
int sx , sy , fx , fy ;
char grid[nax][nax] ;
int dist[nax][nax] ;
int dx[] = {-1,1,0,0} ;
int dy[] = {0,0,-1,1} ;
bool legal(int x , int y){
    if(x < 0 || x >= H || y < 0 || y >= W || grid[x][y] =='#') return false ;
    return true ;
}
void solve(){
    scanf("%d%d",&H,&W) ;
    scanf("%d%d%d%d",&sx,&sy,&fx,&fy) ;
    sx -- ; sy-- ; fx-- ; fy-- ;
    for(int i = 0 ; i < H ; i++){
        scanf("%s",grid[i]) ;
    }
    queue<int> X , Y ;
    X.push(sx) ;
    Y.push(sy) ;
    for(int i = 0 ; i < H ;i++){
        for(int j = 0 ; j < W ; j++){
            dist[i][j] = INF ;
        }
    }
    dist[sx][sy] = 0 ;
    bool check[h+1][w+1]={};
    check[sx][sy]=true;
    while(!X.empty()){
        int x = X.front() ;
        int y = Y.front() ;
        X.pop() , Y.pop() ;
        for(int d = 0 ; d < 4 ; d++){
            int nx = x + dx[d] ;
            int ny = y + dy[d] ;
            if(!legal(nx,ny)) continue ;
            if(check[nx][ny]) continue;
            if(dist[nx][ny] > dist[x][y]){
                dist[nx][ny] = dist[x][y] ;
                check[nx][ny]=true;
                X.push(nx) ;
                Y.push(ny) ;
            }
        }
        for(int nx = x - 2 ; nx <= x + 2 ; nx ++){
            for(int ny = y - 2 ; ny <= y + 2 ; ny ++){
                if(!legal(nx,ny)) continue ;
                if(check[nx][ny]) continue;
                if(dist[nx][ny] > dist[x][y] + 1){
                    dist[nx][ny] = dist[x][y] + 1 ;
                    X.push(nx);
                    Y.push(ny);
                }
            }
        }
    }
    if(dist[fx][fy] == INF) puts("-1") ;
    else printf("%d\n",dist[fx][fy]) ;
}
int main(){
    int testcases = 1;
    for(int i = 1 ; i <= testcases ; i ++){
        solve();
    }
    return 0 ;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:39:16: error: 'h' was not declared in this scope
   39 |     bool check[h+1][w+1]={};
      |                ^
a.cc:39:21: error: 'w' was not declared in this scope
   39 |     bool check[h+1][w+1]={};
      |                     ^
a.cc:40:5: error: 'check' was not declared in this scope
   40 |     check[sx][sy]=true;
      |     ^~~~~