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

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(a) (a).begin(),(a).end()
#define overload4(_1, _2, _3, _4, name, ...) name
#define rep1(n) for(ll i = 0;i < (n);i++)
#define rep2(i,n) for(ll i = 0;i < (n);i++)
#define rep3(i,a,b) for(ll i = (a);i < (b);i++)
#define rep4(i,a,b,c) for(ll i = (a);i < (b);i += (c))
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep1(n) for(ll i = (n)-1;i >= 0;i--)
#define rrep2(i,n) for(ll i = (n)-1;i >= 0;i--)
#define rrep3(i,a,b) for(ll i = (a)-1;i >= (b);i--)
#define rrep4(i,a,b,c) for(ll i = (a)-1;i >= (b);i -= (c))
#define rrep(...) overload4(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
const ll INF=1e18,MOD = 1e9+7;
const int iINF = 1e9;

int dx[] =  {1,0,-1,0},dy[] = {0,1,0,-1};
int h,w,ch,cw,dh,dw,ans = 0;

inline bool isOK(int y,int x){
    if(x >= 0 && y >= 0 && x < w && y < h){
        return true;
    }
    else {
        return false;
    }
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin>>h>>w>>ch>>cw>>dh>>dw;
    ch--;cw--;dh--;dw--;
    pair<int,int>st = {ch,cw},gl = {dh,dw};
    char s[1001][1001];
    rep(i,h)rep(j,w)cin>>s[i][j];
    
    int dist[1001][1001];
    rep(i,h)rep(j,w)dist[i][j] = -1;

    dist[st.first][st.second] = 0;

    queue<pair<int,int>>que;
    que.push(st);
    int cnt = 0;
    while(true){
        bool flag = true;
        while(!que.empty()){
            pair<int,int>now = que.top();
            que.pop();
            rep(i,4){
                int nx = now.second + dx[i],ny = now.first + dy[i];
                if(isOK(ny,nx) && dist[ny][nx] == -1 && s[ny][nx] == '.'){
                    dist[ny][nx] = cnt;
                    que.push(make_pair(ny,nx));
                    flag = false;
                }
            }
        }

        if(flag)break;
        if(dist[gl.first][gl.second] != -1)break;
        cnt++;
        rep(i,h)rep(j,w){
            if(dist[i][j] == cnt - 1){
                rep(k,-2,3)rep(l,-2,3){
                    int ny = i + k,nx = j + l;
                    if(isOK(ny,nx) && s[ny][nx] == '.' && dist[ny][nx] == -1){
                        dist[ny][nx] = cnt;
                        que.push(make_pair(ny,nx));
                    }
                }
            }
        }
    }
    cout<<dist[gl.first][gl.second]<<endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:52:36: error: 'class std::queue<std::pair<int, int> >' has no member named 'top'; did you mean 'pop'?
   52 |             pair<int,int>now = que.top();
      |                                    ^~~
      |                                    pop
Language: C++

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

using ll = long long;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    int h, w, ch, cw, dh, dw;
    cin >> h >> w >> ch >> cw >> dh >> dw;
    int a[h][w];
    ch--, cw--, dh--, dw--;
    
    for(int i=0; i<h; i++) {
        string s;
        cin >> s;
        for(int j=0; j<w; j++) {
            if(s[j] == '#') a[i][j] = -1;
            else a[i][j] = 0;
        }
    }
    
    auto good = [&] (int i, int j) {
        return (i >= 0 && i < h && j >= 0 && j < w && a[i][j] == 0);
    };
    
    int res = -1, val = 0;
    set<pair<int, int>> go;
    if(good(ch, cw)) go.insert({ch, cw});
    
    while(go.size() > 0 && res == -1) {
        //cout << go.size() << endl;
        queue<vector<int>> q;        
        for(auto [x, y] : go) {
            if(a[x][y] == 1) continue;
            a[x][y] = 1;
            q.push({x, y});
            //cout << x << " " << y << endl;
        }
        go.clear();
        
        while(q.size()) {
            auto node = q.front();
            q.pop();
            int x = node[0], y = node[1];
            if(x == dh && y == dw) {
                res = val;
                break;
            }
            for(int dx : {-1, 0, 1}) {
                for(int dy : {-1, 0, 1}) {
                    if(dx + dy != 1) continue;
                    int new_x = x + dx, new_y = y + dy;
                    if(good(new_x, new_y)) {
                        a[new_x][new_y] = 1;
                        q.push({new_x, new_y});
                    }
                }
            }
            for(int dx : {-2, -1, 0, 1, 2}) {
                for(int dy : {-2, -1, 0, 1, 2}) {
                    int new_x = x + dx, new_y = y + dy;
                    if(good(new_x, new_y))
                        go.insert({new_x, new_y});
                }
            }
        }
        val++;
    }
    cout << res << endl;    

    return 0;
}

Compiler output:
a.cc: In lambda function:
a.cc:26:55: sorry, unimplemented: capture of variably-modified type 'int [h][w]' that is not an N3639 array of runtime bound
   26 |         return (i >= 0 && i < h && j >= 0 && j < w && a[i][j] == 0);
      |                                                       ^
a.cc:26:55: note: because the array element type 'int [w]' has variable size
Language: C++

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

typedef long long int ll;

ll n,m;
ll stx,sty;
ll desx,desy;
char s[1005][1005];
ll grp[1005][1005];
ll dx[] = {1,-1,0,0};
ll dy[] = {0,0,1,-1};
ll finalAns;
ll stGrp, desGrp;
vector<ll>g[100005];
ll vis[100005];
ll dist[100005];

bool isOkay (ll x,ll y) {
	if (x>=0 && x<n && y>=0 && y<m) return true;
	else return false;
}


void mark (ll srcx, ll srcy, ll group) {
	
	grp[srcx][srcy] = group;
	
	for (ll i=0 ; i<4 ; i++) {
		if (isOkay(srcx+dx[i], srcy+dy[i]) && s[srcx+dx[i]][srcy+dy[i]]=='.' && grp[srcx+dx[i]][srcy+dy[i]]==-1) {
			mark(srcx+dx[i], srcy+dy[i], group);
		}
	}
	
}

bool findEle (vector<ll>a, ll ele) {
	for (ll i=0 ; i<(ll)a.size() ; i++) {
		if (a[i]==ele) return true;
	}
	return false;
}


void findNeighbours (ll x, ll y) {
	
	for (ll i=x-2 ; i<=x+2 ; i++) {
		for (ll j=y-2 ; j<=y+2 ; j++) {
			if (isOkay(i,j) && grp[i][j]!=-1 && grp[i][j]!=grp[x][y] && !findEle(g[grp[x][y]],grp[i][j])) {
				g[grp[x][y]].push_back(grp[i][j]);
			}
		}
	}
	
	return;
	
}




int main () {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    cin >> n >> m;
    
    cin >> stx >> sty;
    
    stx--;
    sty--;
    
    cin >> desx >> desy;
    
    desx--;
    desy--;
    
    
    for (ll i=0 ; i<n ; i++) {
		for (ll j=0 ; j<m ; j++) {
			grp[i][j] = -1;
			cin >> s[i][j];
		}
	}
	
	if (s[desx][desy]=='#') {
		cout << "-1\n";
		return 0;
	}
	
	ll group = 0;
	
	for (ll i=0 ; i<n ; i++) {
		for (ll j=0 ; j<m ; j++) {
			if (s[i][j]=='.' && grp[i][j]==-1) {
				mark(i,j,group);
				group++;
			}
		}
	}
	
	
	
	
	
	
	
	for (ll i=0 ; i<group+5 ; i++) {
		g[i].clear();
		vis[i] = 0;
		dist[i] = -1;
	}
	
	
	for (ll i=0 ; i<n ; i++) {
		for (ll j=0 ; j<m ; j++) {
			if (s[i][j]=='.') {
				findNeighbours(i,j);
			}
		}
	}
	
	
	
	stGrp = grp[stx][sty];
	desGrp = grp[desx][desy];
	
	
	queue<ll>q;
	q.push(stGrp);
	dist[stGrp] = 0;
	
	while (!q.empty()) {
		
		ll p = q.front();
		vis[p] = 1;
		q.pop();
		
		for (ll i=0 ; i<(ll)g[p].size() ; i++) {
			ll neigh = g[p][i];
			if (vis[neigh]==0) {
				dist[neigh] = dist[p] + 1;
				q.push(neigh);
			}
		}
		
	}
	
	cout << dist[desGrp] << "\n";5
	
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:149:39: error: expected ';' before '}' token
  149 |         cout << dist[desGrp] << "\n";5
      |                                       ^
      |                                       ;
......
  152 | }
      | ~
Language: C++

#include <iostream>
#include<algorithm>
#include<cstring>
using namespace std;
char p[10000][10000];
int vis[10000][10000];
int m =INT_MAX;
int dh,dw;
int h,w;
void dfs(int x,int y,int magic_num){
    if(x == dh && y == dw){
        m = min(m,magic_num);
        return;
    }
    if(x<=0||y<=0||x>h||y>w||vis[x][y]==1||p[x][y]=='#') return;
    vis[x][y] = 1;
    for(int i = -1;i<=1;i++){
        for(int j = -1;j<=1;j++){
            if(abs(i+j) == 1){
                dfs(x+i,y+j,magic_num);
            }
        }
    }
    magic_num++;
    for(int i = -2;i<=2;i++){
        for(int j = -2;j<=2;j++){
            dfs(x+i,y+j,magic_num);
        }
    }
    magic_num--;
    vis[x][y] = 0;
}
int main()
{
    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+1;i++)
        for(int j =1;j<w+1;j++)
            cin>>p[i][j];
    dfs(ch,cw,c);
    cout<<m<<endl;
    return 0;
}




Compiler output:
a.cc:7:8: error: 'INT_MAX' was not declared in this scope
    7 | int m =INT_MAX;
      |        ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include<cstring>
  +++ |+#include <climits>
    4 | using namespace std;
Language: C++

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

int main() {
  int h, w;
  cin >> h >> w;

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

  set<P> can;
  rep(i, h) {
    rep(j, w) {
      char a;
      cin >> a;
      if(a == '.') {
        can.insert(P(i+1, j+1));
      }
    }
  }

  int ans = -1;

  auto is_can = [&](int ny, int nx) {
    if(can.find(P(ny, nx)) == can.end()) {
      return false;
    }
    if(nx <= 0 || nx > w || ny <= 0 || ny > h) {
      return false;
    }
    return true;
  };

  // ワープX回目での到達可能距離
  vector<int> dx = { -1, 1, 0, 0 };
  vector<int> dy = { 0, 0, 1, -1 };
  int warp_max = 50;
  map<P, int> visited;
  queue<P> que;
  queue<P> cur_que;
  int warp = 0;
  while(true) {
    if(warp == 0) {
      visited[P(ch, cw)] = 0;
      que.push(P(ch, cw));
      cur_que.push(P(ch, cw));
    }

    while(!que.empty()) {
      auto p = que.front();a
      que.pop();

      int y = p.first;
      int x = p.second;
      // cout << warp << ": " << y << "," << x << endl;
      for(int i=0;i<4;i++) {
        int nx = x + dx[i];
        int ny = y + dy[i];
        if(visited.find(P(ny, nx)) == visited.end() && is_can(ny, nx)) {

          que.push(P(ny, nx));
          cur_que.push(P(ny, nx));
          visited[P(ny, nx)] = warp;
        }
      }
    }

    // 終了条件
    bool finished = false;
    for (auto i = visited.begin(); i != visited.end(); ++i) {
      auto p = i->first;
      if(p == P(dh, dw)) {
        ans = warp;
        finished = true;
      }
    }

    if(finished) {
      break;
    }

    // ワープ
    queue<P> next_que;
    while(!cur_que.empty()) {
      auto p = cur_que.front();
      int y = p.first;
      int x = p.second;
      cur_que.pop();

      for(int wx=-2;wx<=2;wx++) {
        for(int wy=-2;wy<=2;wy++) {
          int nx = x + wx;
          int ny = y + wy;
          if(visited.find(P(ny, nx)) == visited.end() && is_can(ny, nx)) {
            que.push(P(ny, nx));
            next_que.push(P(ny, nx));
            visited[P(ny, nx)] = warp+1;
          }
        }
      }
    }
    cur_que = next_que;

    if(next_que.size() == 0) {
      break;
    }
    warp++;
  }

  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:55:28: error: 'a' was not declared in this scope
   55 |       auto p = que.front();a
      |                            ^
Language: C++

#include <bits/stdc++.h>
#define ll long long
int main()
{
    ll inf = 999999999999999;
    ll h, w;
    ll C_h, C_w, D_h, D_w;
    std::cin >> h >> w >> C_h >> C_w >> D_h >> D_w;
    std::vector<std::vector<ll>> N(h, std::vector<ll>(w, inf));
    std::vector<std::vector<char>> S(h, std::vector<char>(w));
    std::vector<std::vector<bool>> B(h, std::vector<bool>(w, false));
    for (ll i = 0; i < h; ++i) {
        std::string temp;
        std::cin >> temp;
        for (ll j = 0; j < w; ++j) {
            S[i][j] = temp[j];
            if (S[i][j] == '.') {

                B[i][j] = true;
            }
        }
    }
    N[C_h - 1][C_w - 1] = 0;
    for (ll count_2 = 0; count_2 < 10; ++count_2) {
        for (ll count = 0; count < 2; ++count) {
            for (ll i = 0; i < h; ++i) {
                for (ll j = 0; j < w; ++j) {
                    if (B[i][j]) {
                        if (i > 0) {
                            if (B[i - 1][j]) {
                                N[i][j] = std::min(N[i - 1][j], N[i][j]);
                            }a
                        }
                        if (i < h - 1) {
                            if (B[i + 1][j]) {
                                N[i][j] = std::min(N[i + 1][j], N[i][j]);
                            }
                        }
                        if (j > 0) {
                            if (B[i][j - 1]) {
                                N[i][j] = std::min(N[i][j - 1], N[i][j]);
                            }
                        }
                        if (j < w - 1) {
                            if (B[i][j + 1]) {
                                N[i][j] = std::min(N[i][j + 1], N[i][j]);
                            }
                        }
                    }
                }
            }
        }
        for (ll count = 0; count < 1; ++count) {
            for (ll i = 0; i < h; ++i) {
                for (ll j = 0; j < w; ++j) {
                    if (B[i][j]) {
                        for (ll x = -2; x <= 2; ++x) {
                            for (ll y = -2; y <= 2; ++y) {
                                if (0 <= i + x && i + x < h && 0 <= j + y && j + y < w) {
                                    if (B[i + x][j + y]) {
                                        N[i][j] = std::min(N[i + x][j + y] + 1, N[i][j]);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    if (N[D_h - 1][D_w - 1] > inf / 2) {
        std::cout << "-1" << std::endl;
    } else {
        std::cout << N[D_h - 1][D_w - 1] << std::endl;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:30: error: 'a' was not declared in this scope
   32 |                             }a
      |                              ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using T = tuple<ll,ll,ll>;
using vec = vector<ll>;
using vecp = vector<P>;
using mat = vector<vec>;
using matp = vector<vecp>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define all(v) v.begin(), v.end()


int main(){
  ll H,W,Ch,Dh,Cw,Dw;
  cin >> H >> W >> Ch >> Cw >> Dh >> Dw;
  Ch--;
  Cw--;
  Dh--;
  Dw--;
  vector<string> S(H);
  rep(i,H){
    cin >> S.at(i);
  }
  vector<int> h,w;
  h={1,0,-1,0,1,1,-1,-1,2,2,2,1,0,-1,-2,-2,-2,-2,-2,-1,0,1,2,2};
  w={0,1,0,-1,1,-1,1,-1,0,1,2,2,2,2,2,1,0,-1,-2,-2,-2,-2,-2,-1};
  priority_queue<T> A;
  mat dp(H,vec(W,INF));
  dp.at(Ch).at(Cw)=0;
  A.push(T(0,Ch,Cw));
  while(!A.empty()){
    ll x,y,z,k=0;
    tie(x, y, z) = A.front();
    A.pop();
    rep(i,24){
      if(y+h.at(i)>=0&&y+h.at(i)<=H-1&&z+w.at(i)>=0&&z+w.at(i)<=W-1){
        if(S.at(y+(ll)h.at(i)).at(z+(ll)w.at(i))=='.'){
        if(i<4){
          if(dp.at(y+h.at(i)).at(z+w.at(i))>dp.at(y).at(z)){
            dp.at(y+h.at(i)).at(z+w.at(i))=dp.at(y).at(z);
            A.push(T(dp.at(y+h.at(i)).at(z+w.at(i)),y+h.at(i),z+w.at(i)));
            k++;
            if(Dh==y+h.at(i)&&Dw==z+w.at(i)){
              cout << dp.at(Dh).at(Dw) << endl;
              return 0;
            }
          }
        }else{
          if(dp.at(y+h.at(i)).at(z+w.at(i))>dp.at(y).at(z)+1){
            dp.at(y+h.at(i)).at(z+w.at(i))=dp.at(y).at(z)+1;
            A.push(T(dp.at(y+h.at(i)).at(z+w.at(i)),y+h.at(i),z+w.at(i)));
          }
        }
      }
      }
    }
  }
  if(dp.at(Dh).at(Dw)==INF){
    cout << -1 << endl;
  }else{
    cout << dp.at(Dh).at(Dw) << endl;
  }
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:22: error: 'class std::priority_queue<std::tuple<long long int, long long int, long long int> >' has no member named 'front'
   36 |     tie(x, y, z) = A.front();
      |                      ^~~~~
Language: C++

//  Mayank Agarwal
//  IIIT Hyderabad



#include<bits/stdc++.h>
using namespace std;
const long long int M = 1000000007; 
#define ll long long int
#define ld double
#define pb push_back
#define mp make_pair
ll power(ll x, ll y,  ll p) 
{ 
    ll res = 1;      
    x = x % p;   
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1;x = (x*x) % p; 
    } return res%p; 
} 
ll modinver(ll a,ll b)
{
    return (power(a,1,M)*power(b,M-2,M))%M;
}
void SieveOfEratosthenes(int n) 
{   
    bool prime[10005]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
} 
string s1[1002];
ll h,w;

void dfs(ll l,ll r,ll zz)
{
    s1[l][r]=zz+'0';
    if(l-1>=0 && s1[l-1][r]=='.')
    {
        dfs(l-1,r,zz);
    }
    if(l+1<h && s1[l+1][r]=='.')
    {
        dfs(l+1,r,zz);
    }
    if(r-1>=0 && s1[l][r-1]=='.')
    {
        dfs(l,r-1,zz);
    }
    if(r+1<w && s1[l][r+1]=='.')
    {
        dfs(l,r+1,zz);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    cin>>h>>w;
    ll ch,dh,cw,dw;
    cin>>ch>>cw>>dh>>dw;
    string s[1002];
    for (int i = 0; i < h; ++i)
    {
        cin>>s[i];
        s1[i]=s[i];
    }
    ll co=0;
    for (int i = 0; i < h; ++i)
    {
        for (int j = 0; j < w; ++j)
        {
            if(s1[i][j]=='.')
            {
                dfs(i,j,co);
                co++;
            }
        }
    }
    set<pair<ll,ll>> ss;
    for (int i = 0; i < h; ++i)
    {
        for (int j = 0; j < w; ++j)
        {
            if(s1[i][j]=='#')
                continue;
            for(int k=max(i-2,0);k<min((ll)(i+3),h);k++)
            {
                for(int l=max(j-2,0);l<min((ll)(j+3),w);l++)
                {
                    if(s1[k][l]!='#' && s1[i][j]!=s1[k][l])
                    {
                        ll x1=s1[i][j]-'0';
                        ll x2=s1[k][l]-'0';
                        ss.insert(mp(min(x1,x2),max(x1,x2)));
                    }
                }
            }
        }
    }
    ll so=s1[ch-1][cw-1]-'0';
    ll de=s1[dh-1][dw-1]-'0';
    std::vector<ll> v[1004];
    for(auto i:ss)
    {
        // cout<<i.first<<" "<<i.second<<'\n';
        v[i.first].pb(i.second);
        v[i.second].pb(i.first);
    }
    queue<ll> qq;
    qq.push(so);
    ll dep[1002];
    ll vis[1002];
    for (int i = 0; i <=1001; ++i)
    {
        dep[i]=1e9;
        vis[i]=0;
    }
    dep[so]=0;
    vis[x]=1;
    while(!qq.empty())
    {
        ll x=qq.front();
        qq.pop();
        for (auto i:v[x])
        {
            if(vis[i]==0)
            {
                dep[i]=dep[x]+1;
                qq.push(i);
                vis[i]=1;
            }
        }
    }
    if(dep[de]==1e9)
    {
        cout<<"-1"<<'\n';
    }
    else
    {
        cout<<dep[de]<<'\n';
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:130:9: error: 'x' was not declared in this scope
  130 |     vis[x]=1;
      |         ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(i=0;i<n;i++)
#define foreach(c,itr) for(__typeof(c)::iterator itr=c.begin();itr!=c.end();itr++)
#define m_p make_pair
typedef long long ll;
int i,j;
queue<pair<int,int> > q;
int h,w;
int Ch,Cw,Dh,Dw;
char s[1005][1005];
int magic=0;


int bfs(int C1,int C2,int D1,int D2){
	q.push(m_p(C1,C2));
	for(queue<pair<int,int> >::iterator itr=q.front();itr!=q.back();itr++){
		if(*itr.first==D1&&*itr.second==D2){
			return magic;
		}
		else{
			int x=q.front().first;
	        int y=q.front().second;
	        q.pop();
	        q.push(m_p(x+1,y)); q.push(m_p(x-1,y)); q.push(m_p(x,y+1)); q.push(m_p(x,y-1));
	        for(i=-2;i<=2;i++){
    		    for(j=-2;j<=2;j++){
	    		    if(s[x+i][y+j]!='#') q.push(m_p(x+i,y+j));
    		    }
	        }
		}
	    magic++;	
	}
	return -1;
}

int main(){
	ios::sync_with_stdio(false);
    cin.tie();
    
    cin>>h>>w;
    cin>>Ch>>Cw>>Dh>>Dw;
    for(i=0;i<h;i++){
    	for(j=0;j<w;j++){
    		cin>>s[i][j];
		}
	}
	bfs(Ch,Cw,Dh,Dw);
	cout<<magic<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int bfs(int, int, int, int)':
a.cc:17:36: error: 'iterator' is not a member of 'std::queue<std::pair<int, int> >'
   17 |         for(queue<pair<int,int> >::iterator itr=q.front();itr!=q.back();itr++){
      |                                    ^~~~~~~~
a.cc:17:59: error: 'itr' was not declared in this scope
   17 |         for(queue<pair<int,int> >::iterator itr=q.front();itr!=q.back();itr++){
      |                                                           ^~~
Language: C++

#include <iostream>
#include <cstdio>
#include <queue>

using namespace std;

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

int n, m, sx, sy, ex, ey, dis[1010][1010], vis[1010][1010];
char a[1010][1010];
priority_queue<pair<int, pair<int, int> > > q;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> m >> sx >> sy >> ex >> ey;
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= m; j++)
			cin >> a[i][j];
	memset(dis, 0x3f, sizeof dis);
	memset(vis, 0, sizeof vis);
	q.push({ 0, {sx, sy} });
	dis[sx][sy] = 0;
	while (q.size()) {
		int x = q.top().second.first, y = q.top().second.second;
		q.pop();
		if (vis[x][y])
			continue;
		vis[x][y] = 1;
		for (int i = 0; i < 4; i++) {
			int tx = x + dx[i], ty = y + dy[i];
			if (tx && tx <= n && ty && ty <= m && a[tx][ty] == '.' && dis[tx][ty] > dis[x][y]) {
				dis[tx][ty] = dis[x][y];
				q.push({ -dis[tx][ty], {tx, ty} });
			}
		}
		for (int di = -2; di <= 2; di++)
			for (int dj = -2; dj <= 2; dj++) {
				int tx = x + di, ty = y + dj;
				if (tx > 0 && tx <= n && ty > 0 && ty <= m && a[tx][ty] == '.' && dis[tx][ty] > dis[x][y] + 1) {
					dis[tx][ty] = dis[x][y] + 1;
					q.push({ -dis[tx][ty], {tx, ty} });
				}
			}
	}
	if (dis[ex][ey] == 0x3f3f3f3f)
		dis[ex][ey] = -1;
	cout << dis[ex][ey] << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:9: error: 'memset' was not declared in this scope
   22 |         memset(dis, 0x3f, sizeof dis);
      |         ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <queue>
  +++ |+#include <cstring>
    4 |
Language: C++

#include<iostream>
using namespace std;
unsigned long int h, w, cx, cy, dx, dy;
int map[1000][1000];
void fun(int x, int y,int t) {
    if (map[x][y] != -1) {
        if (map[x][y]==-2||map[x][y]<=t)
            return;
    }
    map[x][y]=t;
    fun(x - 1, y,t);
    fun(x , y-1,t);
    fun(x + 1, y,t);
    fun(x , y+1,t);
    t++;
    for (int i = -2; i <= 2; i++) {
        for (int j = -2; j <= 2; j++) {
            if (x+i >= 0 && y+j >= 0)fun(x + i, y + j,t);
        }
    }
}
int main() {
    char s;
    
    cin >> h>>w;
    cin >> cx >> cy;
    cin >> dx >> dy;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> s;
            if (s == '#')
                map[i][j] = -2;
            else
                map[i][j] = -1;
        }
    }
    int min = LONG_MAX;
    fun(dx-1,dy-1,0);

    /*for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cout << map[i][j];
        }
        cout << endl;
    }*/
    cout<<map[cx-1][cy-1]<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:15: error: 'LONG_MAX' was not declared in this scope
   37 |     int min = LONG_MAX;
      |               ^~~~~~~~
a.cc:2:1: note: 'LONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include<iostream>
  +++ |+#include <climits>
    2 | using namespace std;
Language: C++

#include<bits/stdc++.h>
using namespace std;
int r[] = {1, -1, 0, 0};
int c[] = {0, 0, -1, 1};
#define pp pair<int,pair<int,int>>
string a[1000];
int h, w;
int ix, iy;
int fx, fy;
int ans = -1;
void dfs(int x = ix, int y = iy, int anss = 0)
{
	if (x == fx && y == fy)
	{
		ans = anss;
		return ;
	}
	for (int i = 0; i < 4; i++)
	{
		int xx, yy;
		xx = r[i] + x;
		yy = c[i] + y;
		if (xx < h && xx >= 0 && yy >= 0 && yy < w and a[xx][yy] == '.') {
			a[xx][yy] = '0';
			dfs(xx, yy, anss);
		}
	}
	for (int j = max(0, x - 2); j <= x + 2 && j < h ; j++)
	{
		for (int k = max(0, y - 2); k <= y + 2 && k < w; k++)
		{
			if (a[i][j] == '.')
			{
				a[j][k] = '0';
				dfs(j, k, anss + 1);
			}
		}
	}
}
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin >> h >> w;
	cin >> ix >> iy;
	cin >> fx >> fy;
	int i, j;
	for (i = 0; i < h; i++)
	{
		cin >> a[i];
	}
	ix--;
	iy--;
	fx--;
	fy--;
	dfs();
	cout << ans << endl;
	return 0;
}





Compiler output:
a.cc: In function 'void dfs(int, int, int)':
a.cc:32:31: error: 'i' was not declared in this scope
   32 |                         if (a[i][j] == '.')
      |                               ^
Language: C++

#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define ll long long
#define mod107 1000000007
#define rep(i, n) for (int i = 0; i < n; ++i)
#define Graph vector<vector<int>>
#define grepq priority_queue<double, std::vector<double>, std::greater<double>>
#define all(v) v.begin(), v.end()
#define PI acos(-1)
#define inf 1000000321

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


int main(){
    int H,W;
    cin >> H >> W;
    int Sh,Sw;
    cin >> Sh >> Sw;
    int Gh,Gw;
    cin >> Gh >> Gw;
    Sh--;Sw--;Gh--;Gw--;
    vector<vector<char>> C(H,vector<char> (W));
    for(int i = 0;i < H;i++){
        for(int j = 0;j < W;j++){
            cin >>C[i][j];
        }
    }
    vector<vector<int>> dist(H,vector<int> (W,inf));
    queue<int> que;
    que.push(Sh);
    que.push(Sw);
    dist[Sh][Sw] = 0;
     while(!que.empty()){
        int x,y;
        x = que.front();
        que.pop();
        y = que.front();
        que.pop();
        for(int dir = 0;dir < 4;dir++){
            int h = x+dx[dir];
            int w = y+dy[dir];       
            if(h < H && h >= 0 && w < W && w >= 0){
                if(C[h][w] == '.' && dist[x][y] < dist[h][w]){
                    dist[h][w] = dist[x][y];
                    que.push(h);
                    que.push(w);
                    ok = true;
                }
            }
        }
            for(int i = -2;i <= 2;i++){
                for(int j = -2;j <= 2;j++){
                    if(i == 0 && j == 0)continue;
                    int h = x+i;
                    int w = y+j;
                    if(h < H && h >= 0 && w < W && w >= 0){
                        if(C[h][w] == '.' && dist[x][y] +1 < dist[h][w]){
                            dist[h][w] = dist[x][y] + 1;
                            que.push(h);
                            que.push(w);
                        }
                    }
                }
            }
    }
    if(dist[Gh][Gw] == inf){
        cout << -1 << endl;
    }
    else{
        cout << dist[Gh][Gw] << endl;
    }
    /*for(int i = 0;i < H;i++){
        for(int j = 0;j  < W;j++){
            cout << dist[Gh][Gw] << " ";
        }
        cout << endl;
    }*/
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:21: error: 'ok' was not declared in this scope
   50 |                     ok = true;
      |                     ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define FOR(i,l,r) for(i=l;i<r;i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define P pair<ll,ll>
#define F first
#define S second
signed main(){
  ll H,W,i,j,c=0;P S,G;cin>>H>>W>>S.F>>S.S>>G.F>>G.S;bool X[H][W];ll Y[H][W];deque<P>B;
  REP(i,H)REP(j,W){char s;cin>>s;X[i][j]=(s=='.');Y[i][j]=H*W;}S.F--;S.S--;G.F--;G.S--;
  B.push_back(S);Y[S.F][S.S]=0;vector<P>O(4);
  O.at(0)=P(-1,0);O.at(1)=P(0,-1);O.at(2)=P(1,0);O.at(3)=P(0,1);
  while(B.size()&&c<7000000){
    P E=B.front();B.pop_front();c++;
    REP(i,4){
      ll x=E.F+O.at(i).F,y=E.S+O.at(i).S;
      if(0<=x&&x<H&&0<=y&&y<W&&X[x][y]&&Y[x][y]>Y[E.F][E.S]){
        Y[x][y]=Y[E.F][E.S];B.push_back(P(x,y));
      }
    }
    FOR(i,-2,3)FOR(j,-2,3)if(abs(i)+abs(j)>1){
      ll x=E.F+i,y=E.S+j;
      if(0<=x&&x<H&&0<=y&&y<W&&X[x][y]&&Y[x][y]>Y[E.F][E.S]+1){
        Y[x][y]=Y[E.F][E.S]+1;B.push_back(P(x,y));
      }
    }
  }
  if(Y[G.F][G.S]==H*W)Y[G.F][G.S]=-1;
  if(c==7000000)Y[G.F][G.S]=H/2+W.2;
  cout<<Y[G.F][G.S]<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:34: error: expected ';' before numeric constant
   31 |   if(c==7000000)Y[G.F][G.S]=H/2+W.2;
      |                                  ^~
      |                                  ;
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
const int INF=1e9;
vector<int> dijkstra(vector<vector<ii>>&adj, int& n, int& src) {
	vector<int> dist(n, INF);
	dist[src]=0;
	priority_queue<ii> pq;
	pq.push(make_pair(0,src));
	while(!pq.empty()) {
		ll cost=-pq.top().first, cur_node=pq.top().second;
		pq.pop();
		if(dist[cur_node]<cost) continue;
		for (ll i=0; i<adj[cur_node].size(); i++) {
			ll nxt_node=adj[cur_node][i].first, nextDist=cost+adj[cur_node][i].second;
			if(dist[nxt_node]>nextDist) {
				dist[nxt_node]=nextDist;
				pq.push(make_pair(-nextDist, nxt_node));
				path[nxt_node]=cur_node;
			}
		}
	}
	return dist;
}
int main(){
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n, m;
	cin >> n >> m;
	int sz = n*m;
	int xi, yi, xf, yf;
	cin >> xi >> yi >> xf >> yf;
	xi--, xf--, yi--, yf--;
	vector<string> mat(n);
	for(int i=0; i<n; i++)
		cin >> mat[i];
	vector<vector<ii>> adj(sz);
	int pt1, pt2, w;

	for(int x=0; x<n; x++){
		for(int y=0; y<m; y++){
			if(mat[x][y] == '#') 
				continue;
			pt1 = m * x + y;
			for(int i=-2; i<=2; i++){
				for(int j=-2; j<=2; j++){
					int xp = x+i, yp = y+j;
					if((i == 0 && j == 0) || xp < 0 || yp < 0 || xp >= n || yp >= m || mat[xp][yp] == '#')
						continue;
					pt2 = m * xp + yp; 
					w = ((abs(i) + abs(j) == 1) ? 0 : 1);
					adj[pt1].push_back({pt2,w});
					adj[pt2].push_back({pt1,w}); 
				}
			}
		}
	}
	pt1 = m * xi + yi;
	pt2 = m * xf + yf;
	vector<int> dist = dijkstra(adj, sz, pt1);
	if(dist[pt2] == INF){
		cout << -1 << endl;
	}
	else{
		cout << dist[pt2] << endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'std::vector<int> dijkstra(std::vector<std::vector<std::pair<int, int> > >&, int&, int&)':
a.cc:20:33: error: 'path' was not declared in this scope; did you mean 'std::filesystem::__cxx11::path'?
   20 |                                 path[nxt_node]=cur_node;
      |                                 ^~~~
      |                                 std::filesystem::__cxx11::path
In file included from /usr/include/c++/14/filesystem:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200,
                 from a.cc:1:
/usr/include/c++/14/bits/fs_path.h:293:9: note: 'std::filesystem::__cxx11::path' declared here
  293 |   class path
      |         ^~~~
Language: C++

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

int _; 

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

int n,m,sx,sy,gx,gy,iidx[maxn*maxn],cnt,sum[maxn*maxn];
bool vis[1000050];
vector<int> idx[maxn*maxn]; 
string s[maxn];

void dfs(int x,int y)
{
	if(x<0 || y<0 || x >= n || y >= m || s[x][y] != '.' || iidx[x*maxn+y])
		return;
	idx[cnt].push_back(x*maxn+y);
	iidx[x*maxn+y]=cnt;
	for(int i=0;i<4;i++)
		dfs(x+dx[i],y+dy[i]);
} 

inline bool bfs()
{
	queue<int> q;
	sum[sx*maxn+sy]=1;
	for(auto v : idx[iidx[sx*maxn+sy]])
	{		
		sum[v]=sum[sx*maxn+sy];
		q.push(v);		
	}
	vis[iidx[sx*maxn+sy]]=true;
	while(!q.empty())
	{
		int u=q.front();
		q.pop();
		if(u == gx*maxn+gy)
			return true;
		for(int i=-2;i <= 2;i++)
			for(int j=-2;j <= 2;j++)
				if(i || j)
				{
					int x=u/maxn+i,y=u%maxn+j;
					if(x >= 0 && y >= 0 && x<n && y<m && s[x][y] == '.' && !sum[x*maxn+y] && !vis[iidx[x*maxn+y]])
					{
						vis[iidx[x*maxn+y]]=true;
						for(auto v : idx[iidx[x*maxn+y])
						{
							sum[v]=sum[u]+1;
							q.push(v);
						}
					}
				}
	}
	return false;
}

int main()
{ 
	//for(scanf("%d",&_);_;_--) 
	scanf("%d%d%d%d%d%d",&n,&m,&sx,&sy,&gx,&gy);
	sx--;
	sy--;
	gx--;
	gy--;
	for(int i=0;i<n;i++)
		cin >> s[i];
	for(int i=0;i<n;i++)
		for(int j=0;j<m;j++)
			if(!iidx[i*maxn+j] && s[i][j] == '.')
			{
				cnt++;
				dfs(i,j);
			} 
	if(bfs())
		printf("%d\n",sum[gx*maxn+gy]-1);
	else
		printf("-1\n");
	return 0;
}  

Compiler output:
a.cc: In function 'bool bfs()':
a.cc:48:80: error: expected ']' before ')' token
   48 |                                                 for(auto v : idx[iidx[x*maxn+y])
      |                                                                                ^
      |                                                                                ]
Language: C++

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

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PLL;
typedef pair<P,P> PP;
typedef vector<ll> VECLL;
typedef vector<P> VECP;
typedef priority_queue<P,VECP,greater<P> > PQP;
typedef priority_queue<ll, VECLL, greater<ll> > PQll;

#define rep(i,a,n) for(ll i = a;i < n;i++)   
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF (ll)1e18
#define INF (int)1e9
#define fs first
#define sc second
ll sh,sw,gh,gw;
ll h,w;
char c[1000][1000];
ll memo[1000][1000];
bool is_visited[1000][1000];

bool dfs(ll y, ll x){

    rep(k,-2,3){
        rep(l,-2,3){
            if(y+k < 0 || y+k >= h || x+l < 0 || x+l >= w) continue;
            if(c[y+k][x+l] == '#') continue;

            if(abs(k) + abs(l) == 1){
                if(memo[y+k][x+l] > memo[y][x] && !is_visited[y+k][x+l]){
                    memo[y+k][x+l] = memo[y][x];
                    is_visited[y+k][x+l] = true;
                    dfs(y+k,x+l);
                }
            }
            else{
                if(memo[y+k][x+l] > memo[y][x]+1 && && !is_visited[y+k][x+l]){
                    memo[y+k][x+l] = memo[y][x] + 1;
                    is_visited[y+k][x+l] = true;
                    dfs(y+k,x+l);
                }
            }
        }
    }
}

int main(){
    cin >> h >> w;
    cin >> sh >> sw >> gh >> gw;
    rep(i,0,h) rep(j,0,w) cin >> c[i][j];       
    rep(i,0,h) rep(j,0,w) memo[i][j] = LINF;
    memo[sh-1][sw-1] = 0;

    is_visited[sh-1][sw-1] = true;
    dfs(sh-1,sw-1);


    if(memo[gh-1][gw-1] != LINF) cout << memo[gh-1][gw-1] << endl;
    else cout << -1 << endl;
}



Compiler output:
a.cc: In function 'bool dfs(ll, ll)':
a.cc:41:56: error: expected identifier before '!' token
   41 |                 if(memo[y+k][x+l] > memo[y][x]+1 && && !is_visited[y+k][x+l]){
      |                                                        ^
a.cc:41:55: error: expected ')' before '!' token
   41 |                 if(memo[y+k][x+l] > memo[y][x]+1 && && !is_visited[y+k][x+l]){
      |                   ~                                   ^~
      |                                                       )
a.cc:49:1: warning: no return statement in function returning non-void [-Wreturn-type]
   49 | }
      | ^
Language: C++

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

int _; 

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

int n,m,sx,sy,gx,gy,iidx[maxn*maxn],cnt,sum[maxn*maxn];
bool vis[1000050];
vector<int> idx[maxn*maxn]; 
string s[maxn];

void dfs(int x,int y)
{
	if(x<0 || y<0 || x >= n || y >= m || s[x][y] != '.' || iidx[x*maxn+y])
		return;
	idx[cnt].push_back(x*maxn+y);
	iidx[x*maxn+y]=cnt;
	for(int i=0;i<4;i++)
		dfs(x+dx[i],y+dy[i]);
} 

inline bool bfs()
{
	queue<int> q;
	sum[sx*maxn+sy]=1;
	for(auto v : idx[iidx[sx*maxn+sy]])
	{		
		sum[v]=sum[sx*maxn+sy];
		q.push(v);		
	}
	vis[iidx[sx*maxn+sy]]=true;
	while(!q.empty())
	{
		int u=q.front();
		q.pop();
		if(u == gx*maxn+gy)
			return true;
		for(int i=-2;i <= 2;i++)
			for(int j=-2;j <= 2;j++)
				if(i || j)
				{
					int x=u/maxn+i,y=u%maxn+j;
					if(x >= 0 && y >= 0 && x<n && y<m && s[x][y] == '.' && !sum[x*maxn+y] && !vis[iidx[x*maxn+y]])
					{
						vis[iidx[x*maxn+y]]=true;
						for(auto v : idx[iidx[x*maxn+y]0])
						{
							sum[v]=sum[u]+1;
							q.push(v);
						}
					}
				}
	}
	return false;
}

int main()
{ 
	//for(scanf("%d",&_);_;_--) 
	scanf("%d%d%d%d%d%d",&n,&m,&sx,&sy,&gx,&gy);
	sx--;
	sy--;
	gx--;
	gy--;
	for(int i=0;i<n;i++)
		cin >> s[i];
	for(int i=0;i<n;i++)
		for(int j=0;j<m;j++)
			if(!iidx[i*maxn+j] && s[i][j] == '.')
			{
				cnt++;
				dfs(i,j);
			} 
	if(bfs())
		printf("%d\n",sum[gx*maxn+gy]-1);
	else
		printf("-1\n");
	return 0;
}  

Compiler output:
a.cc: In function 'bool bfs()':
a.cc:48:80: error: expected ']' before numeric constant
   48 |                                                 for(auto v : idx[iidx[x*maxn+y]0])
      |                                                                                ^
      |                                                                                ]
a.cc:48:80: error: expected ')' before numeric constant
   48 |                                                 for(auto v : idx[iidx[x*maxn+y]0])
      |                                                    ~                           ^
      |                                                                                )
a.cc:48:81: error: expected ';' before ']' token
   48 |                                                 for(auto v : idx[iidx[x*maxn+y]0])
      |                                                                                 ^
      |                                                                                 ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
using ll = long long;
using P = pair<int,int>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
vector<vector<int>> seen(1005,vector<int>(1005,100000000));
vector<string> v(1005);
int now=0;
int h,w;
queue<tuple<int,int,int>> q;

void dfs(int x,int y,int z){
    
    if(!seen[x][y]<z+1)seen[x][y]=z;
    if(!seen[x][y]<z+1)rep(dir,4){
        int nh=x+dx[dir];
        int nw=y+dy[dir];
        if (nh < 0 || nh >= h || nw < 0 || nw >= w) continue;
        if (v[nh][nw] == '#') continue;
        if (seen[nh][nw]==z) continue;
        dfs(nh, nw,z);
    }
    if(!seen[x][y]<z+1)rep(i,5)rep(j,5){
        int nh=x+i-2;
        int nw=y+j-2;
        if (nh < 0 || nh >= h || nw < 0 || nw >= w) continue;
        if (v[nh][nw] == '#') continue;
        if(seen[nh][nw]>=z+1){
            seen[nh][nw]=min(seen[nh][nw],z+1);
            q.push(make_tuple(nh,nw,z+1));
        }
    }
}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
using ll = long long;
using P = pair<int,int>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
vector<vector<int>> seen(1005,vector<int>(1005,100000000));
vector<string> v(1005);
int now=0;
int h,w;
queue<tuple<int,int,int>> q;

void dfs(int x,int y,int z){
    if(seen[x][y]<z+1) continue;
    seen[x][y]=z;
    rep(dir,4){
        int nh=x+dx[dir];
        int nw=y+dy[dir];
        if (nh < 0 || nh >= h || nw < 0 || nw >= w) continue;
        if (v[nh][nw] == '#') continue;
        if (seen[nh][nw]==z) continue;
        dfs(nh, nw,z);
    }
    rep(i,5)rep(j,5){
        int nh=x+i-2;
        int nw=y+j-2;
        if (nh < 0 || nh >= h || nw < 0 || nw >= w) continue;
        if (v[nh][nw] == '#') continue;
        if(seen[nh][nw]>=z+1){
            seen[nh][nw]=min(seen[nh][nw],z+1);
            q.push(make_tuple(nh,nw,z+1));
        }
    }
}

int main(){

  cin >> h >> w;
  P s,g;
  cin >> s.first >> s.second >> g.first >> g.second;
  
  rep(i,h) cin >> v[i];
  s.first--;s.second--;g.first--;g.second--;
  q.push(make_tuple(0,0,0));
  while(!q.empty()){
      tuple<int,int,int> tu=q.front();q.pop();
      dfs(get<0>(tu),get<1>(tu),get<2>(tu));
  }
 if(seen[g.first][g.second]!=100000000)cout << seen[g.first][g.second] << endl;
 else cout << -1 << endl;
  

}


Compiler output:
a.cc: In function 'void dfs(int, int, int)':
a.cc:16:24: error: continue statement not within a loop
   16 |     if(seen[x][y]<z+1) continue;
      |                        ^~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (long long  i=a;i<n;i++)
#define sz(A) (int)(A.size())
#define all(x) (x).begin(),(x).end()
#define get(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
typedef long long ll;
typedef pair<int, int> PII;
typedef vector<int> VI;
int h, w;
int a, b, c, d;
int f = 0;
//set < pair<int, int>> se1;
void dfs(vector<string> &grid, int i, int j, vector<VI> &vis, set < pair<int, int>> &se) {
	if (i < 0 || i >= h || j < 0 || j >= w)return;
	if (vis[i][j] || grid[i][j]=='#')return ;
	if (i == c&&j == d) {
		f = 1;
		return;
	}
	se.insert({ i,j });
	vis[i][j] = 1;
	dfs(grid, i + 1, j, vis,se);
	dfs(grid, i - 1, j, vis,se);
	dfs(grid, i, j+1, vis,se);
	dfs(grid, i, j-1, vis,se);
}
void solve() {
	
	cin >> h >> w;
	
	cin >> a >> b >> c >> d;
	a--;
	b--;
	c--;
	d--;
	vector<string> grid;
	rep(i, 0, h) {
		string s;
		cin >> s;
		grid.push_back(s);
	}
	queue<pair<int, int> > q;
	q.push({ a,b });
	int ans = 0;
	vector<VI> vis(h, VI(w, 0));
	dfs(grid, a, b, vis);
	if (f == 1) {
		cout << 0 << endl;
		return;
	}
	//for (auto poi : se1)q.push(poi);
	while (!q.empty()) {
		int m = q.size();
		set < pair<int, int>> se1;
		rep(kk, 0, m) {
			f = 0;
			pair<int, int> poi = q.front();
			q.pop();
			set < pair<int, int>> se;
			dfs(grid, poi.first, poi.second, vis,se);
			if (f == 1) {
				cout << ans << endl;
				return;
			}
			for (auto poi : se)se1.insert(poi);
		}
		for (auto poi : se1) {
			int x = poi.first, y = poi.second;
			for (int i = -2; i <= 2; i++) {
				for (int j = -2; j <= 2; j++) {
					if (x + i >= 0 && x + i < h&&y + j >= 0 && y + j < w && !vis[x + i][y + j] && grid[x + i][y + j] == '.') {
						q.push({ x + i,y + j });
					}
				}
			}
		}
		ans++;
	}
	cout << -1 << endl;
}
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int T_ = 1;
	//cin >> T_;
	for (int i = 0; i < T_; i++)solve();
	return 0;
}



Compiler output:
a.cc: In function 'void solve()':
a.cc:47:12: error: too few arguments to function 'void dfs(std::vector<std::__cxx11::basic_string<char> >&, int, int, std::vector<std::vector<int> >&, std::set<std::pair<int, int> >&)'
   47 |         dfs(grid, a, b, vis);
      |         ~~~^~~~~~~~~~~~~~~~~
a.cc:14:6: note: declared here
   14 | void dfs(vector<string> &grid, int i, int j, vector<VI> &vis, set < pair<int, int>> &se) {
      |      ^~~
Language: C++

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
#define fr(i,a,b) for(int i=a;i<b;i++)
#define frn(i,a,b) for(int i=a;i>=b;i--)
#define vi vector<int>
#define pii pair<int,int>
#define vpi vector<pair<int,int>>
#define vvi vector<vector<int>>
#define test int t;cin>>t; while(t--)
#define mp make_pair
#define pb push_back
#define pu push
#define fi first
#define se second
#define mod 1000000007
typedef tree<int, null_type, less<int>, rb_tree_tag,
        tree_order_statistics_node_update> seti;
void fast() {
    ios_base::sync_with_stdio(0); cin.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
int n, m;
int cx; int cy;
int tx; int ty;
int dp[1005][1005];
int a[1005][1005];
int dx[4] = {0, 0, 1, -1};
int dy[4] = {1, -1, 0, 0};
int ans = -1;
int k = 0;
bool can(int x, int y) {
    if(x>tx && y>ty ) return false;
    if(x<tx && y<ty) return false;
    if (x >= 0 && y >= 0 && x < n && y < m) if (a[x][y]) return true;
    return false;
}
void fild(int x, int y, int ma) {
        if (dp[x][y] != -1) if(ma>=dp[x][y])return dp[x][y];
        dp[x][y] = ma;
        
        fr(i, 0, 4) {
            if (can(x + dx[i], y + dy[i])) fild(x + dx[i], y + dy[i], ma);
        }
        fr(i, -2, 3) {
            fr(j, -2, 3) {
                if (can(x + i, y + j)) fild(x + i, y + j, ma + 1);
            }
        }
}
 
int32_t main() {
    //fast();
    cin >> n >> m;
    cin >> cx >> cy >> tx >> ty;
    cx--; cy--;
    ty--; tx--;
    char d;
    fr(i, 0, n) {
        fr(j, 0, m) {
            cin >> d;
            if (d == '.')a[i][j] = 1;
            else a[i][j] = 0;
        }
    }
    memset(dp, -1, sizeof dp);
    fild(cx, cy, 0);
    cout << dp[tx][ty];
}

Compiler output:
a.cc: In function 'void fild(long long int, long long int, long long int)':
a.cc:45:59: error: return-statement with a value, in function returning 'void' [-fpermissive]
   45 |         if (dp[x][y] != -1) if(ma>=dp[x][y])return dp[x][y];
      |                                                    ~~~~~~~^
Language: C++

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
#define fr(i,a,b) for(int i=a;i<b;i++)
#define frn(i,a,b) for(int i=a;i>=b;i--)
#define vi vector<int>
#define pii pair<int,int>
#define vpi vector<pair<int,int>>
#define vvi vector<vector<int>>
#define test int t;cin>>t; while(t--)
#define mp make_pair
#define pb push_back
#define pu push
#define fi first
#define se second
#define mod 1000000007
typedef tree<int, null_type, less<int>, rb_tree_tag,
        tree_order_statistics_node_update> seti;
void fast() {
    ios_base::sync_with_stdio(0); cin.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
int n, m;
int cx; int cy;
int tx; int ty;
int dp[1005][1005];
int a[1005][1005];
int dx[4] = {0, 0, 1, -1};
int dy[4] = {1, -1, 0, 0};
int ans = -1;
int k = 0;
bool can(int x, int y) {
    if(x>tx && y>ty ) return false;
    if(x<tx && y<ty) return false;
    if (x >= 0 && y >= 0 && x < n && y < m) if (a[x][y]) return true;
    return false;
}
void fild(int x, int y, int ma) {
        if (dp[x][y] != -1) if(ma>=dp[x][y])return dp[x][y]
        dp[x][y] = ma;
        
        fr(i, 0, 4) {
            if (can(x + dx[i], y + dy[i])) fild(x + dx[i], y + dy[i], ma);
        }
        fr(i, -2, 3) {
            fr(j, -2, 3) {
                if (can(x + i, y + j)) fild(x + i, y + j, ma + 1);
            }
        }
}

int32_t main() {
    //fast();
    cin >> n >> m;
    cin >> cx >> cy >> tx >> ty;
    cx--; cy--;
    ty--; tx--;
    char d;
    fr(i, 0, n) {
        fr(j, 0, m) {
            cin >> d;
            if (d == '.')a[i][j] = 1;
            else a[i][j] = 0;
        }
    }
    memset(dp, -1, sizeof dp);
    fild(cx, cy, 0);
    cout << dp[tx][ty];
}

Compiler output:
a.cc: In function 'void fild(long long int, long long int, long long int)':
a.cc:45:59: error: return-statement with a value, in function returning 'void' [-fpermissive]
   45 |         if (dp[x][y] != -1) if(ma>=dp[x][y])return dp[x][y]
      |                                                    ~~~~~~~^
a.cc:45:60: error: expected ';' before 'dp'
   45 |         if (dp[x][y] != -1) if(ma>=dp[x][y])return dp[x][y]
      |                                                            ^
      |                                                            ;
   46 |         dp[x][y] = ma;
      |         ~~