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

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
using namespace std;
const int maxn =1000005;
struct node2{
    int x,y;
};
vector<int>ans[maxn];
vector<char>G[maxn];
char s[maxn];
int h,w,k;
bool judgeedge(int i,int j){
    return i>=0&&i<h&&j>=0&&j<w;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> h >>w >>k;
    int x1,y1,x2,y2;
    cin >> x1 >> y1 >> x2 >> y2;
    for(int i=0;i<h;i++){
        cin >> s;
        for(int j=0;j<w;++j){
            G[i].push_back(s[j]);
            ans[i].push_back(0);
        }
    }
    queue< node2>qq;
    qq.push({x1-1,y1-1});
    ans[x1-1][y1-1]=1;
    int x,y;
    int cost;
    while(!qq.empty()){
        x=qq.front().x;
        y=qq.front().y;
        if(x==x2-1&&y==y2-1){
            break;
        }
        cost=ans[x][y];
        qq.pop();
        for(int i=1;i<=k;i++){
            if(judgeedge(x,y+i)){
                if(G[x][y+i]=='@')
                    break;
                if(!ans[x][y+i])
                    qq.push({x,y+i});
                ans[x][y+i]=cost+1;
            }
            else
                break;
        }
        for(int i=1;i<=k;i++){
            if(judgeedge(x,y-i)&&){
                if(G[x][y-i]=='@')
                    break;
                if(!ans[x][y-i])
                qq.push({x,y-i});
                ans[x][y-i]=cost+1;
                //cout << 1 <<endl;
            }
            else
                break;
        }
        for(int i=1;i<=k;i++){
            if(judgeedge(x-i,y)){
                if(G[x-i][y]=='@')
                    break;
                if(!ans[x-i][y])
                    qq.push({x-i,y});
                ans[x-i][y]=cost+1;
                //cout << x-i << " " << y <<endl;
            }
            else
                break;
        }
        for(int i=1;i<=k;i++){
            if(judgeedge(x+i,y)){
                if(G[x+i][y]=='@')
                    break;
                if(ans[x+i][y])
                    ans[x+i][y]=cost+1;
                qq.push({x+i,y});
                //cout << 1 <<endl;
            }
            else
                break;
        }
    }
    if(ans[x2-1][y2-1]&&G[x1-1][y1-1]=='.'&&G[x2-1][y2-1]=='.'){
        cout << ans[x2-1][y2-1]-1 <<endl;
    }
    else
        cout << -1 << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:56:34: error: expected primary-expression before ')' token
   56 |             if(judgeedge(x,y-i)&&){
      |                                  ^
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
using namespace std;
const int maxn =1000005;
struct node2{
    int x,y;
};
vector<int>ans[maxn];
vector<char>G[maxn];
char s[maxn];
int h,w,k;
bool judgeedge(int i,int j){
    return i>=0&&i<h&&j>=0&&j<w;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> h >>w >> k;
    int x1,y1,x2,y2;
    cin >> x1 >> y1 >> x2 >> y2;
    x1--,y1--,x2--,y2--;
    for(int i=0;i<h;i++){
        cin >> s;
        for(int j=0;j<w;++j){
            G[i].push_back(s[j]);
            ans[i].push_back(maxn);
        }
    }
    queue< node2>qq;
    qq.push({x1,y1});
    ans[x1][y1]=0;
    int x,y;
    int cost;
    while(!qq.empty()){
        x=qq.front().x;
        y=qq.front().y;
        //cout << x << " " << y <<endl;
        cost=ans[x][y]+1;
        qq.pop();
        for(int i=1;i<=k;i++){
            if(judgeedge(x,y+i)&&G[x][y+i]=='.'&&ans[x][y+i]<=cost){
                ans[x][y+i]=cost;
                qq.push({x,y+i});
            }
            else if(G[x][y+i]=='@')
                break;
        }
        for(int i=1;i<=k;i++){
            if(judgeedge(x,y-i)&&G[x][y-i]=='.'&&ans[x][y-i]<=cost){
                ans[x][y-i]=cost;
                qq.push({x,y-i});
            }
            elseif(G[x][y-i]=='@')
                break;
        }
        for(int i=1;i<=k;i++){
            if(judgeedge(x-i,y)&&G[x-i][y]=='.'&&ans[x-i][y]<=cost){
                ans[x-i][y]=cost;
                qq.push({x-i,y});
            }
            elseif(G[x-i][y]=='@')
                break;
        }
        for(int i=1;i<=k;i++){
            if(judgeedge(x+i,y)&&G[x+i][y]=='.'&&ans[x+i][y]<=cost){
                ans[x+i][y]=cost;
                qq.push({x+i,y});
            }
            elseif(G[x+i][y]=='@')
                break;
        }
    }
    if(ans[x2][y2]!=maxn&&G[x1][y1]=='.'&&G[x2][y2]=='.'){
        cout << ans[x2][y2] <<endl;
    }
    else
        cout << -1 << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:56:13: error: 'elseif' was not declared in this scope
   56 |             elseif(G[x][y-i]=='@')
      |             ^~~~~~
a.cc:64:13: error: 'elseif' was not declared in this scope
   64 |             elseif(G[x-i][y]=='@')
      |             ^~~~~~
a.cc:72:13: error: 'elseif' was not declared in this scope
   72 |             elseif(G[x+i][y]=='@')
      |             ^~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
const int INF = 1001001001;


int main(){
    int h, w, k;
    cin >> h >> w >> k;
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    x1--; y1--; x2--; y2--;
    vector<string> c(h);
    rep(i, h) cin >> c[i];
    vector<vector<int>> dist(h, vector<int>(w, INF));
    queue<P> q;
    q.emplace(x1, y1);
    dist[x1][y1] = 0;
    while (!q.empty()) {
        P now = q.front();
        q.pop();
        int nx = now.first;
        int ny = now.second;
        int d = dist[nx][ny];
        rep(i, 4) {
            for (int j=1; j<=k; j++) {
                int ix = nx + dx[i]*j;
                int iy = ny + dy[i]*j;
                if (ix<0 || ix>=h || iy<0 || iy>=w) break;
                if (dist[ix][iy]<=d) break;
                if (c[ix][iy]=='@') break;
                if (dist[ix][iy]==d+1) continue
                dist[ix][iy] = d+1;
                q.emplace(ix, iy);
            }
        }
        /*
        rep(i, h) {
            rep(j, w) {
                cout << dist[i][j];
            }
            cout << endl;
        }
        */
    }

    int ans = dist[x2][y2];
    if (ans==INF) ans = -1;
    
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:48: error: expected ';' before 'dist'
   43 |                 if (dist[ix][iy]==d+1) continue
      |                                                ^
      |                                                ;
   44 |                 dist[ix][iy] = d+1;
      |                 ~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;
#ifdef ONLINE_JUDGE
#define cerr if(false)cerr
#endif

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define int long long
#define ld1 long double
#define faster ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL),cout<<setprecision(14);
#define vint vector<int>
#define all(v) (v).begin(), (v).end()
#define pii pair<int,int>
#define pb push_back
#define mm0(X) memset((X), 0, sizeof((X)))
#define mm1(X) memset((X), -1, sizeof((X)))
#define INF (int)1e9
#define READ(f) freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)
#define endl '\n'
#define vcc vector<char>
#define rep(i,a,b) for(int i=a;i<b;i++)

// if you have no idea just guess the appropriate well-known algo instead of doing nothing -- Benq inspiration
const int mod=998244353;
//inline int add(int a,int b){a+=b;if(a>=mod)a-=mod;return a;}
inline int sub(int a,int b){a-=b;if(a<0)a+=mod;return a;}
inline int mul(int a,int b){return (a*1ll*b)%mod;}
inline int powmod(int a,int b){int rt=1;while(b>0){if(b&1)rt=mul(rt,a);a=mul(a,a);b>>=1;}return rt;}
inline int inv(int a){return powmod(a,mod-2);}
int gcd(int a,int b){return b?gcd(b,a%b):a;}

const int N=(int)2e5+6;
int h,w,kr;
int x[2]; int y[2];
int dx[]={1,-1,0,0};
int dy[]={0,0,1,-1};

int check(int i,int j){
    if(i<h and j<w and i>=0 and j>=0) return 1;
    return 0;
}
void solve(){
    cin >> h >> w >> kr;
    cin >> x[0] >> y[0];
    cin >> x[1] >> y[1];

    for(int i=0;i<2;i++){
        x[i]--,y[i]--;
    }

    char c[h][w];
    for(int i=0;i<h;i++) for(int j=0;j<w;j++) cin >> c[i][j] ;

    set<pair<int,pii>> s;
    s.insert({0,{x[0],y[0]}});

    int vis[h][w];
    mm0(vis);
    int dis[h][w];
    mm1(dis);
    int final=-1;

    while(!s.empty()){
        auto k = *(s.begin());
        s.erase(s.begin());

        for(int kk=0;kk<4;kk++){
            for(int i=1;i<=kr;i++) {
                int movx=0;

                int xx = k.second.first + dx[kk]*i;
                int xy = k.second.second + dy[kk]*i;

                if(xx==x[1] and xy==y[1]){
                    cout<<k.first+1<<endl;
                    return;
                }

                if (!check(xx, xy)) break;
                if (c[xx][xy] == '@') break;
                if(vis[xx][xy] and dis[xx][xy]<k.first+1) break;
//                if (vis[xx][xy]) continue;

                vis[xx][xy] = 1;
                dis[xx][yy] = k.first+1;
                s.insert({k.first+1,{xx,xy}});
            }

        }
    }
    cout<<final<<endl;
}

int32_t main() {
    faster;

#ifndef ONLINE_JUDGE
    READ("input.txt");
    WRITE("output.txt");
    double beg=clock();
#endif

    int t=1;
//    cin>>t;

    while(t--){
        solve();
    }

#ifndef ONLINE_JUDGE
    double endd=clock();
    cout<<endl;
    cerr<<"*** Total time = "<<(endd-beg)/CLOCKS_PER_SEC;
#endif
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:89:25: error: 'yy' was not declared in this scope; did you mean 'xy'?
   89 |                 dis[xx][yy] = k.first+1;
      |                         ^~
      |                         xy
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define int long long
const int MOD=1e9+7;
const int N=1e3+10;
 int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
int32_t main()
{
	IOS;
	int n,m,K;
	cin>>n>>m>>K;
	int x,y,source,destination;
	cin>>source>>destination>>x>>y;
	char xxx;
	int grid[n+2][m+4];
	int dis[n+4][m+4][6];
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			grid[i][j]
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{

			cin>>xxx;
			if(xxx=='.')
			{
				grid[i][j]=1;
			}
			for(int k=0;k<4;k++)
			{
				dis[i][j][k]=MOD;
			}
		}
	}
	
	queue<pair<int,pair<int,int> > >q;
	for(int i=0;i<4;i++)
	{
		dis[x][y][i]=0;
		q.push(make_pair(x,make_pair(y,i)));
	}
	pair<int,pair<int,int> >v;
	int xx,yy;
	int d;
	while(!q.empty())
	{
		v=q.front();
		q.pop();
		//cout<<v.ff<<" "<<v.ss.ff<<" "<<v.ss.ss<<endl;
		for(int k=0;k<4;k++)
		{
			xx=v.ff+dx[k];
			yy=v.ss.ff+dy[k];
			if(!grid[xx][yy])
				continue;
			d=dis[v.ff][v.ss.ff][v.ss.ss];
			if(k==v.ss.ss)
			{
				d++;
			}
			else
			{
				int kk=d/K+(d%K!=0);
				d=kk*K;
				d++;
			}
			if(dis[xx][yy][k]>d)
			{
				
				dis[xx][yy][k]=d;
				q.push(make_pair(xx,make_pair(yy,k)));
 
			}
		}
	}
	int ans=MOD;
	for(int k=0;k<4;k++)
	{
		ans=min(ans,dis[source][destination][k]);
	}
	if(ans==MOD)
	{
		cout<<"-1"<<endl;
		return 0;
	}

	ans=ans/K+(ans%K!=0);
	cout<<ans<<endl;
 
 
}

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:26:35: error: expected ';' before 'for'
   26 |                         grid[i][j]
      |                                   ^
      |                                   ;
   27 |         for(int i=1;i<=n;i++)
      |         ~~~                        
a.cc:27:21: error: 'i' was not declared in this scope
   27 |         for(int i=1;i<=n;i++)
      |                     ^
Language: C++

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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = int_fast64_t;
using pll = pair<ll,ll>;
constexpr ll INF = 1LL<<50;
constexpr ll MOD = 1e9+7;
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
#if loc||local
template<class T>void dump(T&& t){cerr<<t<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
void dump(){}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T,class U> ostream &operator<<(ostream& os,pair<T,U>const& p){os<<p.first<<","<<p.second;return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}

signed main(){

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

  int h,w,k;
  cin>>h>>w>>k;
  int sx,sy,gx,gy;
  cin>>sx>>sy>>gx>>gy;
  sx--;sy--;gy--;gx--;
  swap(sx,sy);swap(gx,gy);
  vector<string> s(h);
  cin>>s;

  constexpr ll dx[]={1,0,-1,0,1,1,-1,-1};
  constexpr ll dy[]={0,1,0,-1,1,-1,1,-1};
  using T3 = tuple<ll,ll,ll>;
  using T4 = tuple<ll,ll,ll,ll>;

  vector dist(h,vector<ll>(w,INF));
  auto out = [&](int y,int x){return y<=-1||y>=h||x<=-1||x>=w;};
  auto cmp = [](auto a,auto b){return get<2>(a)>get<2>(b);};
  queue<T3> que;
  //priority_queue<T3,vector<T3>,decltype(cmp)> que(cmp);
  que.emplace(sy,sx,0);
  dist[sy][sx] = 0;
  while(!que.empty()){
    auto [y,x,c] = que.top();
    que.pop();
    dump(y,x,c);
    rep(i,4){
      for(int j=1;j<=k;++j){
        int ny = y+dy[i]*j;
        int nx = x+dx[i]*j;
        int nc = c+1;
        if(out(ny,nx))break;
        if(s[ny][nx]=='@')break;
        if(dist[ny][nx]<=dist[y][x])break;
        if(chmin<ll>(dist[ny][nx],nc))que.emplace(ny,nx,nc);
      }
    }
  }
  if(dist.at(gy).at(gx)==INF)cout<<-1<<endl;
  else cout<<dist.at(gy).at(gx)<<endl;


}


Compiler output:
a.cc: In function 'int main()':
a.cc:52:24: error: 'class std::queue<std::tuple<long int, long int, long int> >' has no member named 'top'; did you mean 'pop'?
   52 |     auto [y,x,c] = que.top();
      |                        ^~~
      |                        pop
Language: C++

#include <vector>
#include <queue>

#define INF (1<<28)

using namespace std;

int H, W, K;
int x1, y1, x2, y2;
vector<vector<char>> c;
typedef pair<int, int> P;

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

void solve() {
  queue<P> q;
  q.push(P(x1, y1));
  int d[H][W];
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      d[i][j] = INF;
    }
  }
  d[x1][y1] = 0;

  while (!q.empty()) {
    P cc = q.front(); q.pop();
    int cx = cc.first, cy = cc.second;
    // printf("c = (%d, %d)\n", cx, cy);
    if (cx == x2 && cy == y2) {
      break;
    }

    for (int i = 0; i < 4; i++) {
      for (int j = 1; j <= K; j++) {
        int nx = cx + dx[i] * j, ny = cy + dy[i] * j;
        // printf("n = (%d, %d) = %c\n", nx, ny, (0 <= nx && nx < H && 0 <= ny && ny < W ? c[nx][ny] : '-'));
        if (0 <= nx && nx < H && 0 <= ny && ny < W && c[nx][ny] == '.' && d[nx][ny] > d[cx][cy]+1) {
          d[nx][ny] = d[cx][cy]+1;
          q.push(P(nx, ny));
        } else {
          break;
        }
      }
    }
  }

  printf("%d\n", d[x2][y2] == INF ? -1 : d[x2][y2]);
}

int main() {
  scanf("%d %d %d", &H, &W, &K);
  scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
  x1--; y1--; x2--; y2--;

  getchar();
  for (int i = 0; i < H; i++) {
    c.push_back(vector<char>());
    for (int j = 0; j < W; j++) {
      c[i].push_back(getchar());
    }
    getchar();
  }

  solve();
}


Compiler output:
a.cc:9:9: warning: built-in function 'y1' declared as non-function [-Wbuiltin-declaration-mismatch]
    9 | int x1, y1, x2, y2;
      |         ^~
a.cc: In function 'void solve()':
a.cc:48:3: error: 'printf' was not declared in this scope
   48 |   printf("%d\n", d[x2][y2] == INF ? -1 : d[x2][y2]);
      |   ^~~~~~
a.cc:3:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    2 | #include <queue>
  +++ |+#include <cstdio>
    3 | 
a.cc: In function 'int main()':
a.cc:52:3: error: 'scanf' was not declared in this scope
   52 |   scanf("%d %d %d", &H, &W, &K);
      |   ^~~~~
a.cc:56:3: error: 'getchar' was not declared in this scope
   56 |   getchar();
      |   ^~~~~~~
a.cc:56:3: note: 'getchar' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
typedef pair<ll,mp> mmp;
ll inf =  1e9;

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

int main(){
 ll h,w,k;
 cin>>h>>w>>k;
 ll x1,y1,x2,y2;
 cin>>x1>>y1>>x2>>y2;

 vector<vector<ll> > t( h+2 , vector<ll>(w+2, -1) );
 //vector<vector<ll> > tt( h+2 , vector<ll>(w+2, 0) );
 for(ll i=1;i<=h;i++)
  for(ll j=1;j<=w;j++){
   char c;cin>>c;
   if( c=='.'){
    t[i][j] = inf;
   }
  }

  queue<mmp> q;
  q.push( mmp( 0, mp(x1,y1) ) );
 t[x1][y1] = 0;
  
  while(!q.empty() ){
   mmp now = q.front();
   q.pop();
   ll cnt = now.first;
   ll x = now.second.first;
   ll y = now.second.second;
   if( x== x2 && y == y2 ){
    cout<<cnt<<endl;
    return 0;
   }
   //vector< mmp > road;
   for(ll i=0;i<4;i++){
    for(ll j=1;j<=max(h,w);j++){
     ll nx = x + dx[i]*j;
     ll ny = y + dy[i]*j;
     if( t[nx][ny] == -1 ){
      break;
     }
     ll nc = cnt + 1 + (j-1)/k;
     if( t[nx][ny] == INF ){
     // road.push_back( mmp( nc, mp(nx,ny) ) );
      q.push( mmp( nc , mp( nx, ny ) ) );
      t[nx][ny] = nc;
     // tt[nx][ny] |= (1ll<<i);
     }
     else{
      break;
     }

    }
   }
   /*for(ll i=road.size()-1;i>=0;i--){
    q.push( road[i] );
   }*/

  }

  cout<<-1<<endl;


   return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:50:23: error: 'INF' was not declared in this scope
   50 |      if( t[nx][ny] == INF ){
      |                       ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main() {
  ll h, w, k;
  cin >> h >> w >> k;
  ll x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  x1--, x2--, y1--, y2--;
  vector<string> s(h);
  REP(i, h) { cin >> s[i]; }
  vector<vector<ll>> dist(h, vector<ll>(w, -1));
  queue<P> q;
  q.push({x1, y1});
  dist[x1][y1] = 0;
  vector<ll> d = {0, 1, 0, -1};

  while (!q.empty()) {
    P p = q.front();
    q.pop();
    ll cx = p.first, cy = p.second;

    REP(i, 4) {
      FOR(j, 1, k + 1) {
        ll nx = cx + j * d[i], ny = cy + j * d[i ^ 1];
        if (nx < 0 || nx >= h || ny < 0 || ny >= w) {
          break;
        }
        if (s[nx][ny] == '@') {
          break;
        }
        if (dist[nx][ny] != -1 && dist[nx][ny] <= dist[cx][cy] + 1 ) {
          break;
        }
        dist[nx][ny] = dist[cx][cy] + 1;
        q.push({nx, ny});
      }
    }
  }
  cout << dist[x2][xy] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:20: error: 'xy' was not declared in this scope; did you mean 'x2'?
   50 |   cout << dist[x2][xy] << endl;
      |                    ^~
      |                    x2
Language: C++

#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(obj)   (obj).begin(),(obj).end()

#define debug(var)  do{std::cout << __LINE__ << "> " << #var << ": ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

void Main() {
	ll H, W, K;
	cin >> H >> W >> K;
	ll x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;
	x1--, y1--, x2--, y2--;
	vector<string> grid(H);
	REP(i,H) cin >> grid[i];

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

	using PP = pair<pair<ll, ll>, pair<ll, ll>>;
	queue<PP> que;
	vector<vector<bool>> seen(H, vector<bool>(W));
	vvl d(H, vl(W, -1));

	seen[x1][y1] = true;
	d[x1][y1] = 0;
    que.push(make_pair(make_pair(x1, y1), make_pair(-1, 0)));

	while (!que.empty()) {
		PP v = que.front();
        que.pop();

		REP(i, 4) {
			ll next_y = v.first.first + dy[i];
			ll next_x = v.first.second + dx[i];
			if (next_y >= H || next_y < 0 || next_x >= W || next_x < 0) continue;
			if (seen[next_y][next_x]) continue;
			if (grid[next_y][next_x] == '@') continue;

			if (v.second.first == -1) {
				PP next = make_pair(make_pair(next_y, next_x), make_pair(i, 1));
				seen[next_y][next_x] = true;
				d[next_y][next_x] = 1;
				que.push(next);
			} else if (v.second.first != i) {
				PP next = make_pair(make_pair(next_y, next_x), make_pair(i, 1));
				seen[next_y][next_x] = true;
				d[next_y][next_x] = min(d[v.first.first][v.first.second] + 1,d[next_y][next_x]);
				que.push(next);
			} else {
				PP next = make_pair(make_pair(next_y, next_x), make_pair(i, v.second.second + 1));
				if (next.second.second > K) {
					PP next = make_pair(make_pair(next_y, next_x), make_pair(i, 1));
					seen[next_y][next_x] = true;
					d[next_y][next_x] = min(d[v.first.first][v.first.second] + 1, d[next_y][next_x]);
					que.push(next);
					continue;
				}m
				seen[next_y][next_x] = true;
				d[next_y][next_x] = min(d[v.first.first][v.first.second],d[next_y][next_x]);
				que.push(next);
			}
		}
	}
	cout << d[x2][y2]  << endl;
	// debug(d);
}

int main() {
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}


Compiler output:
a.cc: In function 'void Main()':
a.cc:69:34: error: 'm' was not declared in this scope
   69 |                                 }m
      |                                  ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<int,int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
const LL mod=1000000007;
const LL LINF=1LL<<62;
const int INF=1<<30;
int dx[]={1,0,-1,0,1,-1,1,-1};
int dy[]={0,1,0,-1,1,-1,-1,1};

int h,w,k;
int sx,sy,gx,gy;


int main(){
    cin >> h >> w >> k;
    cin >> sx >> sy >> gx >> gy;
    sx--,sy--,gx--,gy--;
    vector<string> s(h);
    for (int i = 0; i < h; i++) {
        cin >> s[i];
    }
    vector<vector<int>> dp(h + 1, vector<int> (w + 1, INF));
    LL ans = 0;
    set<P> st;
    st.insert({sx,sy});
    dp[sx][sy] = 0;
    while(not st.empty()){
        set<P> ns;
        for (int i = 0; i < 4; i++) {
            for(auto p:st){
                int x = p.fs, y = p.sc;
                if(gx == x && gy == y){
                    cout << ans << endl;
                    return 0;
                }
                for (int j = 0; j < k; j++) {
                    int nx = x + dx[i], ny = y + dy[i];
                    if(0<=nx&&nx<h&&0<=ny&&ny<w&&s[nx][ny] != '@'){
                        if(chmin(dp[nx][ny], ans)){
                            ns.insert({nx,ny});
                        }
                        else{
                            break;
                        }
                    }
                    else{
                        break;
                    }
                    x = nx, y = ny;
                }
            }
        }
        st = ns;
        ans++;
    }
    cout << -1 << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:50:33: error: no matching function for call to 'chmin(__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&, LL&)'
   50 |                         if(chmin(dp[nx][ny], ans)){
      |                            ~~~~~^~~~~~~~~~~~~~~~~
a.cc:13:31: note: candidate: 'template<class T> bool chmin(T&, T)'
   13 | template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
      |                               ^~~~~
a.cc:13:31: note:   template argument deduction/substitution failed:
a.cc:50:33: note:   deduced conflicting types for parameter 'T' ('int' and 'long long int')
   50 |                         if(chmin(dp[nx][ny], ans)){
      |                            ~~~~~^~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <set>
#include <algorithm>
#include <iomanip>

typedef long long ll;
const ll MOD = 1e9 + 7;
const long long INF = 1LL<<60;
const double PI=3.14159265358979323846;
const int NMAX=100005;
using namespace std;



int main(){
    int h,w,k;
    cin >> h >> w >> k;
    int x1,y1,x2,y2;
    cin >> x1 >> y1 >> x2 >> y2;
    char mp[h+2][w+2];
    int done[h+2][w+2];
    for(int i = 0; i < h+2; i++){
        for(int j = 0; j < w+2; j++){
            if(i == 0 || j == 0 || i == h+1 || j == w+1){
                mp[i][j] = '@';
            } else {
                cin >> mp[i][j];
            }
            done[i][j] = 0;
        }
    }

    priority_queue<pair<ll, pair<int,int> >, vector<pair<ll,pair<ll,ll> > >, greater<pair<ll,pair<ll,ll> > > > q; 
    q.push(make_pair(0,make_pair(x1,y1)));

    int dir_x[] = {1, 0, -1, 0};
    int dir_y[] = {0, 1, 0, -1};
    ll ans = -1;
    while(true){
        auto tmp = q.top();
        q.pop();
        ll w = tmp.first;
        ll tx = tmp.second.first;
        ll ty = tmp.second.second;


        if(tx == x2 && ty == y2){
            ans = w;
            break;
        }

        if(done[tx][ty] == 1) continue;
        done[tx][ty] = 1;

        for(int i = 0; i < 4; i++){
            ll nx=tx, ny=ty;
            while(mp[nx+dir_x[i]][ny+dir_y[i]] == '.'){
                ny += dir_y[i];
                nx += dir_x[i];
                if(done[nx][ny] == 1) continue;
                q.push(make_pair(w+1, make_pair(nx,ny)));
            }
        }
    }

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

Compiler output:
In file included from /usr/include/c++/14/queue:66,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_queue.h: In instantiation of 'class std::priority_queue<std::pair<long long int, std::pair<int, int> >, std::vector<std::pair<long long int, std::pair<long long int, long long int> > >, std::greater<std::pair<long long int, std::pair<long long int, long long int> > > >':
a.cc:38:112:   required from here
   38 |     priority_queue<pair<ll, pair<int,int> >, vector<pair<ll,pair<ll,ll> > >, greater<pair<ll,pair<ll,ll> > > > q;
      |                                                                                                                ^
/usr/include/c++/14/bits/stl_queue.h:520:67: error: static assertion failed: value_type must be the same as the underlying container
  520 |       static_assert(is_same<_Tp, typename _Sequence::value_type>::value,
      |                                                                   ^~~~~
/usr/include/c++/14/bits/stl_queue.h:520:67: note: 'std::integral_constant<bool, false>::value' evaluates to false
Language: C++

#include<bits/stdc++.h>

using namespace std;

#define INF 1000000007
#define LINF (1LL << 61)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }



i64 h,w,k, a,b,c,d;
string s[1010101];
void solve(){
	cin >> h >> w >> k;
	cin >> a >> b >> c >> d;
	a--; b--; c--; d--;
	for(int i = 0; i < h; i++){
		cin >> s[i];
	}
	
	vector<vector<int>> v(h,vector<int>(w,INF));
	queue<pair<P,int>> q;
	q.push(make_pair(P(a,b),0));
	v[a][b] = 0;
	int dx[4] = {0,-1,0,1}, dy[4] = {1,0,-1,0};
	while(!q.empty()){
		auto p = q.front(); q.pop();
		int x = p.first.first, y = p.first.second, cnt = p.second;
		if(v[x][y] != cnt) continue;
		if(x == c && y == d){
			cout << cnt << endl;
			return;
		}
		for(int i = 0; i < 4; i++){
			for(int j = 1; j <= k; j++){
				int nx = x+dx[i]*j, ny = y+dy[i]*j;
				if(nx<0||ny<0||nx>=h||ny>=w) break;
				//if(v[nx][ny] <= cnt+1) break;
				if(s[nx][ny] == '@') break;
				if(chmin(v[nx][ny], cnt+1;)){
					q.push(make_pair(P(nx,ny),cnt+1));
				}
			}
		}
	}
	assert(0);
	cout << -1 << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:48:58: error: expected ')' before ';' token
   48 |                                 if(chmin(v[nx][ny], cnt+1;)){
      |                                         ~                ^
      |                                                          )
a.cc:48:58: error: expected ')' before ';' token
   48 |                                 if(chmin(v[nx][ny], cnt+1;)){
      |                                   ~                      ^
      |                                                          )
a.cc:48:59: error: expected primary-expression before ')' token
   48 |                                 if(chmin(v[nx][ny], cnt+1;)){
      |                                                           ^
Language: Java

import java.util.*;

public class Main {
	static final long MOD = 998244353;
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int H = sc.nextInt();
		int W = sc.nextInt();
		int K = sc.nextInt();
		int x1 = sc.nextInt()-1;
		int y1 = sc.nextInt()-1;
		int x2 = sc.nextInt()-1;
		int y2 = sc.nextInt()-1;

		char[][] m = new char[H][];
		for(int i=0; i<H; i++)
			m[i] = sc.next().toCharArray();

		long[][][] best = new long[H][W][4];
		for(int i=0; i<H; i++)
			for(int j=0; j<W; j++)
				Arrays.fill(best[i], Long.MAX_VALUE);
		
		for(int i=0; i<4; i++)
			best[y1][x1][i] = 0;
		
		final int[] dx = {0, 1, 0, -1};
		final int[] dy = {1, 0, -1, 0};
		
		LinkedList<Long> q = new LinkedList<>();
		final long MASK1 = (1l<<40)-1;
		final long MASK2 = (1l<<20)-1;
		
		for(int d=0; d<4; d++) {
			long v = (d<<40)|(y1*W+x1);
			q.add(v);
		}
		
		while(!q.isEmpty()) {
			Long cur = q.poll();
			int dir = (int)((cur>>60)&3);
			Long step = (cur>>20)&MASK1;
			int y = (int)((cur&MASK2)/W);
			int x = (int)((cur&MASK2)%W);
			
			if(best[y][x][dir]<=step)
				continue;
			
			for(int d=0; d<4; d++) {
				int ny = y + dy[d];
				int nx = x + dx[d];
				if(0<=ny && ny<H && 0<=nx && nx<W &&m[ny][nx]=='.') {
					long nextStep = step;
					if(d==dir && (step&MASK1)<K) {
						nextStep++;
					} else {
						nextStep = (((step>>20)+1)<<20)+1;
					}
					if(best[ny][nx][dir]<=nextStep)
						continue;
					long v = d;
					v = (v<<40)|((nextStep>>20<<20)+1);
					v = (v<<20)|(ny*W+nx);
					q.add(v);
				}
			}
		}
		
		System.out.println(best[y2][x2]<Long.MAX_VALUE ? best[y2][x2] : -1);

		sc.close();
	}
}


Compiler output:
Main.java:71: error: bad operand types for binary operator '<'
		System.out.println(best[y2][x2]<Long.MAX_VALUE ? best[y2][x2] : -1);
		                               ^
  first type:  long[]
  second type: long
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
int n,m,k,xx,x2,yy,y2;
vector < vector <long long> > a;
vector <int> v;
queue < pair <int,int> > q;
int di[]={0,0,1,-1};
int dj[]={1,-1,0,0};
void lee()
{ a[xx][yy]=0;
  q.push(make_pair(xx,yy));
  while(!q.empty())
  { int x=q.front().first;
    int y=q.front().second;
    q.pop();
    if(x==x2 && y==y2)
       return;
    for(int d=0;d<4;d++)
    { int i=x,j=y;
      for(int t=1;t<=k;t++)
      { i+=di[d];
        j+=dj[d];
        if(a[i][j]!=0 || i<1 || j<1 || i>n || j>m || (i==xx && j==yy))
           break;
        a[i][j]=a[x][y]+1;
        q.push(make_pair(i,j));
      }
    }
  }
}
int main()
{ cin.tie(0);
  ios_base::sync_with_stdio(0);
  cin>>n>>m>>k;
  cin>>xx>>yy>>x2>>y2;
  for(int i=0;i<=m+1;i++)
    v.push_back(0);
  for(int i=0;i<=n+1;i++)
    a.push_back(v);
  for(int i=1;i<=n;i++)
  { for(int j=1;j<=m;j++)
    { char c;
      cin>>c;
      if(c=='@')
         a[i][j]=-1;
    }
  }
  lee();
  if(a[x2][y2]==0)
     a[x2][y2]=-1;
  cout<<a[x2][y2]<<'\n';
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:16: error: no matching function for call to 'std::vector<std::vector<long long int> >::push_back(std::vector<int>&)'
   39 |     a.push_back(v);
      |     ~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >; value_type = std::vector<long long int>]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from 'std::vector<int>' to 'const std::vector<std::vector<long long int> >::value_type&' {aka 'const std::vector<long long int>&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >; value_type = std::vector<long long int>]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<std::vector<long long int> >::value_type&&' {aka 'std::vector<long long int>&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
Language: C++

#include <iostream>
#include <queue>
#define P pair<int,int>
#define PP pair<int,P>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

long long dh[4] = {1,0,-1,0},dw[4] = {0,1,0,-1};
char f[55][55];
bool check[55][55];
long long main() {
    long long h,w,kk;cin>>h>>w>>kk;
    long long  sh,sw;cin>>sh>>sw;
    long long  gh,gw;cin>>gh>>gw;
    sh--,sw--,gh--,gw--;
    rep(i,h) rep(j,w) cin>>f[i][j];
    rep(i,h) rep(j,w) check[i][j]=false;

    priority_queue<PP,vector<PP>,greater<PP> > q;
    q.push(PP(0,P(sh,sw)));
    check[sh][sw] = true;

    while(!q.empty())
    {
        PP n = q.top();q.pop();
        for(int i=0;i<4;i++)
        {
            for(int j=1;j<(kk+1);j++)
            {
                int nh = n.second.first+dh[i]*j,nw=n.second.second+dw[i]*j;
                int dist = n.first;
                if(check[nh][nw]) continue;
                if(nh<0 || nw<0 || nh>=h || nw >=w || f[nh][nw]=='@') break;
                if(nh == gh && nw==gw)
                {
                    cout << dist+1 << endl;
                    return 0;
                }
                check[nh][nw]=true;
                q.push(PP(dist+1,P(nh,nw)));
            }
        }


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


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <iostream>
#include <queue>
#define P pair<int,int>
#define PP pair<int,P>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int dh[4] = {1,0,-1,0},dw[4] = {0,1,0,-1};
char f[55][55];
bool check[55][55];
long long main() {
    long long h,w,kk;cin>>h>>w>>kk;
    long long  sh,sw;cin>>sh>>sw;
    long long  gh,gw;cin>>gh>>gw;
    sh--,sw--,gh--,gw--;
    rep(i,h) rep(j,w) cin>>f[i][j];
    rep(i,h) rep(j,w) check[i][j]=false;

    priority_queue<PP,vector<PP>,greater<PP> > q;
    q.push(PP(0,P(sh,sw)));
    check[sh][sw] = true;

    while(!q.empty())
    {
        PP n = q.top();q.pop();
        for(int i=0;i<4;i++)
        {
            for(int j=1;j<(kk+1);j++)
            {
                int nh = n.second.first+dh[i]*j,nw=n.second.second+dw[i]*j;
                int dist = n.first;
                if(check[nh][nw]) continue;
                if(nh<0 || nw<0 || nh>=h || nw >=w || f[nh][nw]=='@') break;
                if(nh == gh && nw==gw)
                {
                    cout << dist+1 << endl;
                    return 0;
                }
                check[nh][nw]=true;
                q.push(PP(dist+1,P(nh,nw)));
            }
        }


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


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int H,W,K; cin>>H>>W>>K;
	vector<string> grid(H);
	int dist[H][W];
	int x1,y1,x2,y2; cin>>x1>>y1>>x2>>y2; x1--; y1--; x2--; y2--;
	for (int i=0; i<H; i++) {
		cin>>grid[i];
		grid[i]=string(buf);
		for (int j=0; j<W; j++)
			dist[i][j]=-1;
	}
	ii init={x1,y1}, nd={x2,y2};
	dist[init.first][init.second]=0;
	grid[init.first][init.second]='@';
	queue<ii> q; q.push(init);
	while(!q.empty()) {
		ii cur=q.front(); q.pop();
		for (int i=0; i<4; i++) {
			for (int j=1; j<=K; j++) {
				ii nxt=cur; nxt.first+=dx[i]*j; nxt.second+=dy[i]*j;
				if(nxt.first<0||nxt.first>=H||nxt.second<0||nxt.second>=W) continue;
				if(grid[nxt.first][nxt.second]!='.') break;
				if(dist[nxt.first][nxt.second]!=-1) continue;
				grid[nxt.first][nxt.second]='@';
				dist[nxt.first][nxt.second]=dist[cur.first][cur.second]+1;
				q.push(nxt);
			}
		}
	}
	cout<<dist[nd.first][nd.second]<<"\n";
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:32: error: 'buf' was not declared in this scope
   21 |                 grid[i]=string(buf);
      |                                ^~~
Language: C++

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <queue>
#include <vector>
#include <cmath>
#include <set>
using namespace std;

int h, w, k;
vector<int> e[3000010];
string s[3000010];
queue<int> q;
int u[4000010];
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int cal(int a1, int b1) {
    return a1 * w + b;
}

void add_edge(int a1, int b1, int a2, int b2) {
//    printf("%d %d %d %d\n", a1, b1, a2, b2);
    e[cal(a1, b1)].push_back(cal(a2, b2));
    e[cal(a2, b2)].push_back(cal(a1, b1));
}

int main() {
    int x1, y1, x2, y2;
    scanf("%d%d%d", &h, &w, &k);
    scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
    x1--, y1--, x2--, y2--;
    for(int i = 0; i < h; i++) {
        scanf("%s", &s[i][0]);
    }
    for(int i = 0; i < h; i++) {
        int f = 1;
        for(int j = 0; j < w; j++) {
            char tt = s[i][j];
            if(tt == '@') {
                f = 1;
                continue;
            }
            if(f == 0) {
                if(j + k < w && s[i][j + k] == '.') add_edge(i, j, i, j + k);
                else j = j + k;
                continue;
            }
            if(f == 1) {
                int now = 0;
                for(int t = 1; t <= k; t++) {
                    if(j + t >= w || s[i][j + t] == '@') {
                        now = j + t;
                        break;
                    }
                    add_edge(i, j, i, j + t);
                }
                if(now) j = now;
                else f = 0;
            }
        }
    }
    for(int j = 0; j < w; j++) {
        int f = 1;
        for(int i = 0; i < h; i++) {
            if(s[i][j] == '@') {
                f = 1;
                continue;
            }
            if(f == 0) {
                if(i + k < h && s[i + k][j] == '.') add_edge(i, j, i + k, j);
                else i = i + k;
                continue;
            }
            if(f == 1) {
                int now = 0;
                for(int t = 1; t <= k; t++) {
                    if(i + t >= h || s[i + t][j] == '@') {
                        now = i + t;
                        break;
                    }
                    add_edge(i, j, i + t, j);
                }
                if(now) i = now;
                else f = 0;
            }
        }
    }
    memset(u, -1, sizeof(u));
    q.push(cal(x1, y1));
//    printf("*********%d %d %d\n", x1, y1, cal(x1, y1));
    u[cal(x1, y1)] = 0;
    while(!q.empty()) {
        int x = q.front();
//        printf("%d %d %d\n", x / w, x % w, u[x]);
        q.pop();
        for(int i = 0; i < e[x].size(); i++) {
            int y = e[x][i];
            if(u[y] == -1) {
                u[y] = u[x] + 1;
                q.push(y);
            }
        }
    }
    printf("%d\n", u[cal(x2, y2)]);

	return 0;
}


Compiler output:
a.cc: In function 'int cal(int, int)':
a.cc:20:21: error: 'b' was not declared in this scope; did you mean 'b1'?
   20 |     return a1 * w + b;
      |                     ^
      |                     b1
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <deque>
#include <queue>
using namespace std;
typedef long long int ll;

ll dp[1000100];

char fi[1000100];

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

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int h,w,k; cin >> h >> w >> k;
	int x,y,xx,yy; cin >> x >> y >> xx >> yy;
	x--; y--; xx--; yy--;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin >> fi[i*w+j];
			dp[i*w+j]=1e9;
		}
	}
	dp[x*w+y]=0;
	queue<pair<int,int>> q;
	q.push(make_pair(x,y));
	while(q.size()){
		auto p=q.front();
		q.pop();
		for(int i=0;i<4;i++){
			int nx=p.first+dx[i],ny=p.second+dy[i];
			int nnx=
			if(0<=nx&&nx<h&&0<=ny&&ny<w&&dp[nx*w+ny]>=dp[p.first*w+p.second]+1&&fi[nx*w+ny]!='@'){
				int mx=1;
				for(int j=2;j<=k;j++){
					nx+=dx[i],ny+=dy[i];
					if(0<=nx&&nx<h&&0<=ny&&ny<w&&dp[nx*w+ny]>=dp[p.first*w+p.second]+1&&fi[nx*w+ny]!='@'){
						mx++;
					}
					else{
						nx-=dx[i],ny-=dy[i];
						break;
					}
				}
				/*if(p.first==2&&p.second==1){
					cout << i << " " << mx << endl;
				}*/
				for(int j=mx;j>=1;j--){
					if(dp[nx*w+ny]>dp[p.first*w+p.second]+1)dp[nx*w+ny]=dp[p.first*w+p.second]+1;
					q.push(make_pair(nx,ny));
					nx-=dx[i],ny-=dy[i];
				}
			}
			else continue;
		}
	}
	/*for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cout << dp[i*w+j] << " ";
		}
		cout << endl;
	}*/
	if(dp[xx*w+yy]==1e9){
		printf("-1\n");
	}
	else{
		printf("%lld\n",dp[xx*w+yy]);
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:25: error: expected primary-expression before 'if'
   39 |                         if(0<=nx&&nx<h&&0<=ny&&ny<w&&dp[nx*w+ny]>=dp[p.first*w+p.second]+1&&fi[nx*w+ny]!='@'){
      |                         ^~
Language: C++

/**
*    author:  boutarou
*    created: 14.06.2020 21:50:21
**/

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

template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

const double PI = 3.1415926535897932;
const lint INF = 3e18;
const int dy[] = { 0, 0, -1, 1 };
const int dx[] = { 1, -1, 0, 0 };

int h, w, k;
int sy, sx, gy, gx;
vector<char>c[1000005];
vector<lint>shortest[1000005];
queue<P>que;

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

	cin >> h >> w >> k;
	cin >> sy >> sx >> gy >> gx;
	sy--, sx--, gy--, gx--;
	rep(i, h) {
		rep(j, w) {
			shortest[i].push_back(INF);
		}
	}
	rep(i, h) {
		rep(j, w) {
			char now;
			cin >> now;
			c[i].push_back(now);
			if (now == '@') {
				shortest[i][j] = -1;
			}
		}
	}
	
	shortest[sy][sx] = 0;
	que.push({ sy, sx });
	while (!que.empty()) {
		P now = que.front(); que.pop();
		int now_y = now.first, now_x = now.second;
		rep(i, 4) {
			int ny = now_y + dy[i], nx = now_x + dx[i];
			rep(j, k) {
				if (ny < 0 || ny >= h || nx < 0 || nx >= w) break;
				if (shortest[ny][nx] != INF) break;
				que.push({ ny, nx });
				shortest[ny][nx] = shortest[now_y][now_x] + 1;
				ny += dy[i], nx += dx[i];
			}
		}
	}
	if (shortest[gy][gx] == INF) {
		cout << -1 << endl;
	}
	else {
		cout << shortest[gy][gx] << endl;
	}

	return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include "bits/stdc++.h"

using namespace std;



int main() {
	int H;
	int W;
	int K;//泳げる距離
	cin >> H >> W >> K;
	int Sx;
	int Sy;
	int Gx;
	int Gy;
	cin >> Sx >> Sy >> Gx >> Gy;
	--Sx;
	--Sy;
	--Gx;
	--Gy;

	vector<vector<string>> map(H, vector<string>(W));
	for (int n = 0;n < H;++n) {
		string str;
		cin >> str;
		for (int m = 0;m < W; ++m) {
			map[n][m] = str[m];
		}
		
	}
	const int dx[] = { -1,0,1,0 };
	const int dy[] = { 0,-1,0,1 };


	vector<vector<int>> D(H, vector<int>(W));//回数
	for (int n = 0; n < H; ++n) {
		for (int m = 0; m < W; ++m) {
			D[n][m] = -1;//初期値
		}
	}

	queue<pair<int, int>> q;
	q.emplace(Sx, Sy);
	D[Sx][Sy] = 0;

	while (!q.empty()) {
		int x = q.front().first;
		int y = q.front().second;
		q.pop();
		//範囲内かつ0を4セット
		for (int l = 0; l < 4; ++l) {
			for (int m = 1;m <= K; ++m) {
				int x1 = x + m * dx[l];
				int y1 = y + m * dy[l];
				if ((0 <= x1) && (H > x1) && (0 <= y1) && (W > y1)) {
					if ((0 != map[x1][y1].compare("@"))) {
						if (-1 == D[x1][y1]) {
							D[x1][y1] = D[x][y] + 1;
							q.emplace(x1, y1);
						}
						else if (D[x1][y1] > D[x][y] + 1) {
							D[x1][y1] = D[x][y] + 1;
							q.emplace(x1, y1);
						}
					}
					else {
						break;
					}
				}
			}
			if ((x1 == Gx) && (y1 == Gy)) {
				cout << D[Gx][Gy] << endl;
				return 0;
			}
		}
		if (false) {
			for (int n = 0; n < H; ++n) {
				for (int m = 0; m < W; ++m) {
					cout << D[n][m];//初期値
				}
				cout <<  endl; 
			}
			cout << endl;
		}
	}

	cout << D[Gx][Gy] << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:71:30: error: 'x1' was not declared in this scope; did you mean 'x'?
   71 |                         if ((x1 == Gx) && (y1 == Gy)) {
      |                              ^~
      |                              x
a.cc:71:47: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   71 |                         if ((x1 == Gx) && (y1 == Gy)) {
      |                                            ~~~^~~~~
Language: C++

#include<iostream>
using namespace std;
int main()
{
  int a,v,b,w,t;
  cin>>a>>v;
  cin>>b>>w;
  cin>>t;
  if(a<b){
    int c=a+(v*t);
    int d=b+(w*t);
    if(c>=d){
      cout<<"YES";
    }
    else{
      cout<<"NO";
    }
  }
  else if(b<a){
    int e=b-(w*t);
    int f=a-(v*t);
    if(f<=e){
      cout<<"YES";
    }
    else{
      cout<<"NO";
    }
  }
  else if(a==b){
    break;
  }
}
     


Compiler output:
a.cc: In function 'int main()':
a.cc:30:5: error: break statement not within loop or switch
   30 |     break;
      |     ^~~~~