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

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

#define REP(i,N) for(int (i)=0;i<(int)(N);i++)

template <class T> bool minn(T &a,T b) { return (a > b ? (a = b, 1) : 0); }
template <class T> bool maxn(T &a,T b) { return (a < b ? (a = b, 1) : 0); }

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

int dist[801][801];
string f[801];

int nceil(int a,int b)
{
	return (a+b-1)/b;
}
int main(void)
{
	int N,M,K;

	cin >> N >> M >> K;

	int sx=-1,sy=-1;
	REP(i,N);
	{
		cin>>f[i];
		REP(j,M)
			if(f[i][j]=='S')
			{
				sx=i;
				sy=j;
			}
	}

	vector<pair<int,int> > q;
	REP(i,N)
		REP(j,M)
			dis[i][j] = 1e9;
	dis[sx][sy] = 0;

	q.push_back(make_pair(sx,sy));
	REP(cue,q.size())
	{
		int x=q[cur].first, y=q[cur].second;
		int ncur=dis[x][y];

		REP(d,4)
		{
			int xx = x+dx[d],yy = y+dy[d];
			if(min(xx,yy) < 0 || min(N-xx,M-yy) <= 0 || dis[xx][yy] < 1e8 || f[xx][yy] == '#') continue;
			dis[xx][yy] = ncur+1;
			q.push_back(make_pair(xx,yy));
		}
	}

	int ans=1e9;
	REP(i,N)
		REP(j,M)
		{
			if(dis[i][j] > K) continue;
			int res = 1e9;
			minn(res,nceil(i,K));
			minn(res,nceil(j,K));
			minn(res,nceil(N-i-1,K));
			minn(res,nceil(M-j-1,K));
			minn(ans,res+1);
		}

	cout << ans << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:24: error: 'i' was not declared in this scope
   29 |                 cin>>f[i];
      |                        ^
a.cc:41:25: error: 'dis' was not declared in this scope; did you mean 'div'?
   41 |                         dis[i][j] = 1e9;
      |                         ^~~
      |                         div
a.cc:42:9: error: 'dis' was not declared in this scope; did you mean 'div'?
   42 |         dis[sx][sy] = 0;
      |         ^~~
      |         div
a.cc:47:25: error: 'cur' was not declared in this scope; did you mean 'cue'?
   47 |                 int x=q[cur].first, y=q[cur].second;
      |                         ^~~
      |                         cue
a.cc:48:33: error: 'y' was not declared in this scope
   48 |                 int ncur=dis[x][y];
      |                                 ^
Language: C++

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

#define REP(i,N) for(int (i)=0;i<(int)(N);i++)

template <class T> bool minn(T &a,T b) { return (a > b ? (a = b, 1) : 0); }
template <class T> bool maxn(T &a,T b) { return (a < b ? (a = b, 1) : 0); }

int nceil(int a,int b)
{
	return (a+b-1)/b;
}
int main(void)
{
	int N,M,K;

	cin >> N >> M >> K;

	int sx=-1,sy=-1;
	REP(i,N);
	{
		cin>>f[i];
		REP(j,M)
			if(f[i][j]=='S')
			{
				sx=i;
				sy=j;
			}
	}

	vector<pair<int,int> > q;
	REP(i,N)
		REP(j,M)
			dis[i][j] = 1e9;
	dis[sx][sy] = 0;

	q.push_back(make_pair(sx,sy));
	REP(cue,q.size())
	{
		int x=q[cur].first, y=q[cur].second;
		int ncur=dis[x][y];

		REP(d,4)
		{
			int xx = x+dx[d],yy = y+dy[d];
			if(min(xx,yy) < 0 || min(N-xx,M-yy) <= 0 || dis[xx][yy] < 1e8 || f[xx][yy] == '#') continue;
			dis[xx][yy] = ncur+1;
			q.push_back(make_pair(xx,yy));
		}
	}

	int ans=1e9;
	REP(i,N)
		REP(j,M)
		{
			if(dis[i][j] > K) continue;
			int res = 1e9;
			minn(res,nceil(i,K));
			minn(res,nceil(j,K));
			minn(res,nceil(N-i-1,K));
			minn(res,nceil(M-j-1,K));
			minn(ans,res+1);
		}

	cout << ans << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:22: error: 'f' was not declared in this scope
   23 |                 cin>>f[i];
      |                      ^
a.cc:23:24: error: 'i' was not declared in this scope
   23 |                 cin>>f[i];
      |                        ^
a.cc:35:25: error: 'dis' was not declared in this scope; did you mean 'div'?
   35 |                         dis[i][j] = 1e9;
      |                         ^~~
      |                         div
a.cc:36:9: error: 'dis' was not declared in this scope; did you mean 'div'?
   36 |         dis[sx][sy] = 0;
      |         ^~~
      |         div
a.cc:41:25: error: 'cur' was not declared in this scope; did you mean 'cue'?
   41 |                 int x=q[cur].first, y=q[cur].second;
      |                         ^~~
      |                         cue
a.cc:42:33: error: 'y' was not declared in this scope
   42 |                 int ncur=dis[x][y];
      |                                 ^
a.cc:46:36: error: 'dx' was not declared in this scope; did you mean 'xx'?
   46 |                         int xx = x+dx[d],yy = y+dy[d];
      |                                    ^~
      |                                    xx
a.cc:47:35: error: 'yy' was not declared in this scope; did you mean 'sy'?
   47 |                         if(min(xx,yy) < 0 || min(N-xx,M-yy) <= 0 || dis[xx][yy] < 1e8 || f[xx][yy] == '#') continue;
      |                                   ^~
      |                                   sy
a.cc:47:90: error: 'f' was not declared in this scope
   47 |                         if(min(xx,yy) < 0 || min(N-xx,M-yy) <= 0 || dis[xx][yy] < 1e8 || f[xx][yy] == '#') continue;
      |                                                                                          ^
a.cc:48:33: error: 'yy' was not declared in this scope; did you mean 'sy'?
   48 |                         dis[xx][yy] = ncur+1;
      |                                 ^~
      |                                 sy
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
#define rep2(i,a,b) for (ll i=a;i<b;++i)
const ll MOD=1e9+7;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

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

int main(){
    int H,W,K;
    cin >> H >> W >> K;
    vector<string> A(H);
    rep(i,H) cin >> A[i];
    int sh,sw;
    rep(i,H) rep(j,W) if (A[i][j]=='S') sh=i,sw=j;
    int dh[4]={1,0,-1,0};
    int dw[4]={0,1,0,-1};
    queue<Pii> que;
    que.push(Pii(sh,sw));
    vector<vector<int>> d(H,vector<int>(W,-1));
    d[sh][sw]=0;
    int ans=INF;
    while(!que.empty()){
        Pii p=que.front();
        que.pop();
        int h=p.first,w=p.second;
        int x=(d[h][w]+min(h,min(H-1-h,min(w,W-1-w)))+K-1)/K;
        if (d[h][w]<K) x=1+(min(h,min(H-1-h,min(w,W-1-w)))+K-1)/K;
        chmin(ans,x);
        rep(j,4){
            int nh=h+dh[j],nw=w+dw[j];
            if (nh<0||nh>=H||nw<0||nw>=W) continue;
            if (A[nh][nw]=='#') continue;
            if (d[nh][nw]!=-1) continue;
            d[nh][nw]=d[h][w]+1;
            que.push(Pii(nh,nw));
        }
    }
    cout << ans << endl;
}

Compiler output:
a.cc:52:28: error: stray '\16' in program
   52 |             if (nh<0||nh>=H<U+000E>||nw<0||nw>=W) continue;
      |                            ^~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(a,b) for(int i=a;i<=b;i++)
#define FORBACK(a,b) for(int i=b;i>=a;i--)
#define pb push_back
#define mp make_pair
#define sz size
#define fi first
#define se second
typedef pair <int , int> ii;
int r,c,k,ans;
char arr[805][805];
vector<pair<int,int> >v;
bool visited[805][805];
struct State {
	int b, k, byk;
	
	State(){}
	State(int _b, int _k, int z){
		b = _b;
		k = _k;
		byk = z;
	}
};
State s;
queue<State> q;
int dx[]={-1,0,1,0};
int dy[]={0,-1,0,1};
bool inside(int ro,int co){
	return 1<=ro && ro <=r && 1<=co && co<=c;
}
void bfs(int sr, int sc,int Byk){
	q.push(State(sr,sc,Byk));
	while(!q.empty()){
		State now = q.front();
		q.pop();
		int cb = now.b;
		int ck = now.k;
		int cbyk = now.byk;
		//cout << " :: " << b << " " << k << " " << byk << endl;
		if(cbyk<=ck){
			v.pb(mp(cb,ck));
		}
		for(int i=0;i<4;i++){
			if(inside(cb + dx[i],ck + dy[i]) && arr[cb + dx[i]][ck + dy[i]]!='#' && visited[cb + dx[i]][ck + dy[i]]==false){
				visited[cb + dx[i]][ck + dy[i]]=true;
				q.push(State(cb + dx[i], ck + dy[i], cbyk + 1));							
			}			
		}
	}
}

int min3(int a , int b , int c) {
	return min(min(a , b) , c);
}

int min4(int a , int b , int c , int d) {
	return min(min3(a , b , c) , d);
}

int updiv(int a , int b) {
	int tmp = a / b;
	return tmp * b < a ? tmp + 1 : tmp;
}

int main(){
//	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	cin>>r>>c>>k;
	for(int i=1;i<=r;i++){
		for(int j=1;j<=c;j++){
			cin>>arr[i][j];
		}
	}
	for(int i=1;i<=r;i++){
		for(int j=1;j<=c;j++){
			if(arr[i][j]=='S'){
				bfs(i,j,0);
				break;
			}
		}
	}
	int sol = INT_MAX;
		int _r = vec.fi, _c = vec.se;
		sol = min(sol , min4(_c - 1 , c - _c , _r - 1 , r - _r));
	}
	printf("%d\n" , updiv(sol , k) + 1);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:84:26: error: 'vec' was not declared in this scope
   84 |                 int _r = vec.fi, _c = vec.se;
      |                          ^~~
a.cc:85:38: error: '_c' was not declared in this scope; did you mean '_r'?
   85 |                 sol = min(sol , min4(_c - 1 , c - _c , _r - 1 , r - _r));
      |                                      ^~
      |                                      _r
a.cc: At global scope:
a.cc:87:15: error: expected constructor, destructor, or type conversion before '(' token
   87 |         printf("%d\n" , updiv(sol , k) + 1);
      |               ^
a.cc:88:1: error: expected declaration before '}' token
   88 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(a,b) for(int i=a;i<=b;i++)
#define FORBACK(a,b) for(int i=b;i>=a;i--)
#define pb push_back
#define mp make_pair
#define sz size
#define fi first
#define se second
typedef pair <int , int> ii;
int r,c,k,ans;
char arr[805][805];
vector<pair<int,int> >v;
bool visited[805][805];
struct State {
	int b, k, byk;
	
	State(){}
	State(int _b, int _k, int z){
		b = _b;
		k = _k;
		byk = z;
	}
};
State s;
queue<State> q;
int dx[]={-1,0,1,0};
int dy[]={0,-1,0,1};
bool inside(int ro,int co){
	return 1<=ro && ro <=r && 1<=co && co<=c;
}
void bfs(int sr, int sc,int Byk){
	q.push(State(sr,sc,Byk));
	while(!q.empty()){
		State now = q.front();
		q.pop();
		int cb = now.b;
		int ck = now.k;
		int cbyk = now.byk;
		//cout << " :: " << b << " " << k << " " << byk << endl;
		if(cbyk<=ck){
			v.pb(mp(cb,ck));
		}
		for(int i=0;i<4;i++){
			if(inside(cb + dx[i],ck + dy[i]) && arr[cb + dx[i]][ck + dy[i]]!='#' && visited[cb + dx[i]][ck + dy[i]]==false){
				visited[cb + dx[i]][ck + dy[i]]=true;
				q.push(State(cb + dx[i], ck + dy[i], cbyk + 1));							
			}			
		}
	}
}

int min3(int a , int b , int c) {
	return min(min(a , b) , c);
}

int min4(int a , int b , int c , int d) {
	return min(min3(a , b , c) , d);
}

int updiv(int a , int b) {
	int tmp = a / b;
	return tmp * b < a ? tmp + 1 : tmp;
}

int main(){
//	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	cin>>r>>c>>k;
	for(int i=1;i<=r;i++){
		for(int j=1;j<=c;j++){
			cin>>arr[i][j];
		}
	}
	for(int i=1;i<=r;i++){
		for(int j=1;j<=c;j++){
			if(arr[i][j]=='S'){
				bfs(i,j,0);
				break;
			}
		}
	}
	int sol = INT_MAX;
	for (ii vec : v) {
		int _r = vec.fi, _c = vec.se;
		sol = min(sol , min4(_c - 1 , c - _c , _r - 1 , r - _r));
	}
	printf("%d\n" , updiv(sol , k) + 1);
}
e

Compiler output:
a.cc:90:1: error: 'e' does not name a type; did you mean 'se'?
   90 | e
      | ^
      | se
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};


  
int main(){
  
  int h,w,k;
  cin>>h>>w>>k;
  vector<string> a(h);
  REP(i,h){
    cin>>a[i];
  }
  
  vector<vector<int>> d(h,vector<int>(w,-1));
  queue<pair<int,int>> q;
  REP(i,h){
    REP(j,w){
      if(a[i][j]=='S'){
        d[i][j]=0;
        q.push_back(make_pair(i,j));
      }
    }
  }
  
  pair<int,int> p;
  int x,y;
  int nx,ny;
  int dx[]={1,0,-1,0};
  int dy[]={0,1,0,-1};
  while(!q.empty()){
    p = q.front();
    x = p.first;y = p.second;
    q.pop();
    if(d[x][y]==k)continue;
    REP(i,4){
      nx = x + dx[i];ny = y+dy[i];
      if(0<=nx && nx<h && 0<=ny && ny<w && a[nx][ny] == '.'){
        d[nx][ny] = d[x][y]+1;
        q.push(make_pair(nx,ny));
      }
    }
  }
  
  int ans = 1000;
  int temp;
  REP(i,h){
    REP(j,w){
      if(d[i][j]<0)continue;
      temp = (i+k-1)/k;
      temp = min(temp,(j+k-1)/k);
      temp = min(temp,(h-1-i+k-1)/k);
      temp = min(temp,(w-1-j+k-1)/k);
      ans = min(ans,temp+1);
    }
  }   
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:106:11: error: 'class std::queue<std::pair<int, int> >' has no member named 'push_back'
  106 |         q.push_back(make_pair(i,j));
      |           ^~~~~~~~~
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include "cxx-prettyprint/prettyprint.hpp"
using namespace std;

const int MOD = 1000000007;
typedef pair<int, int> P;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;i++)
#define rep2(i, m, n) for(int i=m;i<n;i++)
#define rrep(i, n, m) for(int i=n;i>=m;i--)
using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

    int H, W, K;
    cin >> H >> W >> K;
    vector<string> A;
    int diff = 1000000;
    vector<vector<bool>> visited(H, vector<bool>(W, false));

    P start;
    for (int i = 0; i < H; ++i) {
        string s;
        cin >> s;
        A.push_back(s);
        for (int j = 0; j < W; ++j) {
            if (s[j] == 'S') {
                start = {i, j};
                diff = min(min(i, H - 1 - i), min(j, W - 1 - j));
                visited[i][j] = true;
            }
        }
    }
    deque<P> queue;
    queue.push_back(start);
    while (!queue.empty()) {
        P q = queue.front();
        queue.pop_front();
        for (int i = 0; i < 4; ++i) {
            int x = dx[i];
            int y = dy[i];
            int a = q.first;
            int b = q.second;
            if (abs(a - start.first) + abs(b - start.second) > K) {
                continue;
            }
            int tmp = min(min(a, H - 1 - a), min(b, W - 1 - b));
            if (tmp < diff){
                diff = tmp;
            }
            if ((0 <= a + y && a + y <= H - 1) && 0 <= b + x && b + x <= W - 1) {
                if (visited[a + y][b + x] || A[a + y][b + x] != '.') {
                    continue;
                } else {
                    queue.push_back({a + y, b + x});
                    visited[a + y][b + x] = true;
                }
            }
        }
    }
    int ans = 1;
    if (diff == 0) {
        cout << ans << endl;
    } else {
        cout << ans + ((K - 1) + diff) / K << endl;
    }


}


Compiler output:
a.cc:20:10: fatal error: cxx-prettyprint/prettyprint.hpp: No such file or directory
   20 | #include "cxx-prettyprint/prettyprint.hpp"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
using P=pair<int,int>;
int inf=1e9;
queue<P> que;
vector<int>dx={0,0,1,-1};
vector<int>dy={1,-1,0,0};

int main(){
	int h,w,k;cin>>h>>w>>k;
	vector<string>a(h);
	for(auto&& u:a)cin>>u;
	vector<vector<int>>d(h,vector<int>(w,inf));
	rep(i,h)rep(j,w)if(a[i][j]=='S'){que.push(make_pair(i,j));d[i][j]=0;}
	while(!que.empty()){
		P z=que.front();que.pop();
		rep(i,4){
			int x,y;x=z.first+dx[i];y=z.second+dy[i];
			if(x<0||x>=h||y<0||y>=w)continue;
			if(d[x][y]==inf&&s[x][y]=='.' ){
				d[x][y]=d[z.first][z.second]+1;
				que.push(make_pair(x,y));
			}			

		}
	}	
	int mn=inf;
	rep(i,h)rep(j,w){if(d[i][j]<=k)mn=min({mn,i,j,h-1-i,w-1-j});}
	
	cout<<(mn-1)/k+2<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:42: error: 's' was not declared in this scope
   21 |                         if(d[x][y]==inf&&s[x][y]=='.' ){
      |                                          ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
using P=pair<int,int>;
int inf=1e9;
queue<P> que;
vector<int>dx={0,0,1,-1};
vector<int>dy={1,-1,0,0};

int main(){
	int h,w,k;cin>>h>>w>>k;
	vector<string>a(h);
	for(auto&& u:a)cin>>u;
	vector<vector<int>>d(h,vector<int>(w,inf));
	rep(i,h)rep(j,w)if(a[i][j]=='S'){que.push(make_pair(i,j));d[i][j]=0;}
	while(!que.empty()){
		P z=que.front();que.pop();
		rep(i,4){
			int x,y;x=z.first+dx[i];y=z.second+dy[i];
			if(x<0||x>=h||y<0||y>=h)continue;
			if(d[x][y]==inf&&s[x][y]=='.' ){
				d[x][y]=d[z.first][z.second]+1;
				que.push(make_pair(x,y));
			}			

		}
	}	
	int mn=inf;
	rep(i,h)rep(j,w){if(d[i][j]<=k)mn=min({mn,i,j,h-1-i,w-1-j});}
	
	cout<<(mn-1)/k+2<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:42: error: 's' was not declared in this scope
   21 |                         if(d[x][y]==inf&&s[x][y]=='.' ){
      |                                          ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
using P=pair<int,int>;
int inf=1e9;
queue<P> que;
vector<int>dx={0,0,1,-1};
vector<int>dy={1,-1,0,0};

int main(){
	int h,w,k;cin>>h>>w>>k;
	vector<string>a(h);
	for(auto&& u:a)cin>>u;
	vector<vector<int>>d(h,vector<int>(w,inf));
	rep(i,h)rep(j,w)if(a[i][j]=='S'){que.push(make_pair(i,j));d[i][j]=0;}
	while(!que.empty()){
		P z=que.front();que.pop();
		rep(i,4){
			int x,y;x=z.first+dx[i];y=z.second+dy[i];
			if(x<0||x>=h||y<0||y>=h)continue;
			if(d[x][y]==inf){
				d[x][y]=d[z.first][z.second]+1;
				que.push(make_pair(x,y));
		}			

	}	
	int mn=inf;
	rep(i,h)mn=min({mn,d[i][0],d[i][w-1]});
	rep(i,w)mn=min({mn,d[0][i],d[h-1][i]});
	cout<<(mn-1)/k+1<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:2: error: expected '}' at end of input
   31 | }
      |  ^
a.cc:10:11: note: to match this '{'
   10 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
bool use[800][800];
int dx={0,0,1,-1};
int dy={1,-1,0,0};
void dfs(int x,int y)
{
	if(use[x][y] || s[x][y]=="#")
	return;
	if(x==0 || x==h-1 || y==0 || y==w-1)
	return res;
	else
	for(int i=0;i<4;i++)
	{
		dfs(x+dx[i],y+dy[i]);
	}
}
int close(string s[],int n,int w)
{
}
int  main()
{
	cin>>h>>w>>k;
	for(int i=0;i<h;i++)
	cin>>s[i];
	
}

Compiler output:
a.cc:4:5: error: scalar object 'dx' requires one element in initializer
    4 | int dx={0,0,1,-1};
      |     ^~
a.cc:5:5: error: scalar object 'dy' requires one element in initializer
    5 | int dy={1,-1,0,0};
      |     ^~
a.cc: In function 'void dfs(int, int)':
a.cc:8:25: error: 's' was not declared in this scope
    8 |         if(use[x][y] || s[x][y]=="#")
      |                         ^
a.cc:10:23: error: 'h' was not declared in this scope
   10 |         if(x==0 || x==h-1 || y==0 || y==w-1)
      |                       ^
a.cc:10:41: error: 'w' was not declared in this scope
   10 |         if(x==0 || x==h-1 || y==0 || y==w-1)
      |                                         ^
a.cc:11:16: error: 'res' was not declared in this scope
   11 |         return res;
      |                ^~~
a.cc: In function 'int close(std::string*, int, int)':
a.cc:20:1: warning: no return statement in function returning non-void [-Wreturn-type]
   20 | }
      | ^
a.cc: In function 'int main()':
a.cc:23:14: error: 'h' was not declared in this scope
   23 |         cin>>h>>w>>k;
      |              ^
a.cc:23:17: error: 'w' was not declared in this scope
   23 |         cin>>h>>w>>k;
      |                 ^
a.cc:23:20: error: 'k' was not declared in this scope
   23 |         cin>>h>>w>>k;
      |                    ^
a.cc:25:14: error: 's' was not declared in this scope
   25 |         cin>>s[i];
      |              ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int maxn=5000;
int n,m,k;
char iomap[maxn][maxn];
pair<int,int> start;
int step[maxn][maxn];
bool vis[maxn][maxn];
bool islegal(pair<int,int> p)
{
	return (!p.first||!p.second||p.first>=n-1||p.second>=m-1);
}
void dfs(pair<int,int> p)
{
	if(islegal(p))
	{
		cout<<step[p.first][p.second]<<endl;
		exit(0);
	}
	if(step[p.first+2][p.second]==inf)
	{
		step[p.first+2][p.second]=step[p.first][p.second];
		dfs(make_pair(p.first+2,p.second));
	}
	if(step[p.first-2][p.second]==inf)
	{
		step[p.first-2][p.second]=step[p.first][p.second];
		dfs(make_pair(p.first-2.p.second));
	}
}
int main()
{
	scanf("%d%d%d",&n,&m,&k);
	for(int i=0;i<n;i++)
		for(int j=0;j<m;j++)
		{
			cin>>iomap[i][j];
			if(iomap[i][j]=='S')
				start=make_pair(i,j);
			vis[i][j]=false;
		}
	vis[start.first][start.second]=true;
	step[start.first][start.second]=0;
	dfs(start);
	return 0;
}

Compiler output:
a.cc: In function 'void dfs(std::pair<int, int>)':
a.cc:20:39: error: 'inf' was not declared in this scope; did you mean 'ynf'?
   20 |         if(step[p.first+2][p.second]==inf)
      |                                       ^~~
      |                                       ynf
a.cc:25:39: error: 'inf' was not declared in this scope; did you mean 'ynf'?
   25 |         if(step[p.first-2][p.second]==inf)
      |                                       ^~~
      |                                       ynf
a.cc:28:39: error: unable to find numeric literal operator 'operator""p.second'
   28 |                 dfs(make_pair(p.first-2.p.second));
      |                                       ^~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
const int maxn=8e2+10;
using namespace std;
char a[maxn][maxn];
int stmp[maxn][maxn];//代表这是bfs的第几步
int direction[4][2]={1,0,-1,0,0,1,0,-1};//四个方向
int n,m,k;
int ans=99999999;
bool check(int x,int y)//判断这个点是否可行
{
    if(x>=0&&x<n&&y>=0&&y<m&&stmp[x][y]==0&&a[x][y]=='.')
    {
       return 1;
    }
    return 0;
}
queue<pair<int,int> >po;
int main()
{
    cin>>n>>m>>k;
    int sx,sy;
    for(int i=0;i<n;i++)//输入顺便找到起点
    {
        for(int j=0;j<m;j++)
        {
            printf("%c",a[i][j]);
            if(a[i][j]=='S')
            {
                sx=i;
                sy=j;
            }
        }
        getchar();
    }
    stmp[sx][sy]=1;
    po.push(make_pair(sx,sy));
    while(!po.empty())
    {
        int x=po.front().first;
        int y=po.front().second;
        ans=min(ans,min(min(x,n-x-1),min(y,m-y-1)));
        po.pop();
        for(int i=0;i<4;i++)
        {
            int xx=x+posi[i][0];
            int yy=y+posi[i][1];
            if(check(xx,yy)&&stmp[x][y]<=k)
            {
               stmp[xx][yy]=stmp[x][y]+1;
               po.push(make_pair(xx,yy));
            }
        }
    }
    int anss;
    anss=1+(ans+k-1)/k;//向上取整
    cout<<anss<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:45:22: error: 'posi' was not declared in this scope
   45 |             int xx=x+posi[i][0];
      |                      ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int INF = 1000000007;

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

void dfs(int i, int j, vector<vector<bool> > &G, vector<pair<int, int> > &ans){

    ans.push_back({i, j});
    if(k == 0) return;
    for(int h = 0; h < 4; h++){
        int ni = i + di[h];
        int nj = j + dj[h];

        if(G[ni][nj]){
            G[i][j] = false;
            dfs(ni, nj, G, ans, k - 1);
        }
    }
}

int main(){

    int h, w, k; cin >> h >> w >> k;
    vector<vector<bool> > G(h + 2, vector<bool> (w + 2, false));


    int si, sj;
    for(int i = 1; i <= h; i++){
        for(int j = 1; j <= w; j++){
            char in; cin >> in;
            if(in == '#') continue;

            G[i][j] = true;
            if(in == 'S'){
                si = i;
                sj = j;
            }
        }
    }

    vector<pair<int, int> > ans;
    G[si][sj] = false;
    dfs(si, sj, G, ans, k);

    int anss = INF;
    for(int i = 0; i < ans.size(); i++){
        int tmp = min(min(ans[i].first - 1, ans[i].second - 1), min(h - ans[i].first, w - ans[i].second));
        anss = min(anss, 2 + (tmp - 1) / k);
        if(tmp == 0) anss = 1;
    }
    

    cout << anss << endl;
    return 0;
}

Compiler output:
a.cc: In function 'void dfs(int, int, std::vector<std::vector<bool> >&, std::vector<std::pair<int, int> >&)':
a.cc:11:8: error: 'k' was not declared in this scope
   11 |     if(k == 0) return;
      |        ^
a.cc:18:33: error: 'k' was not declared in this scope
   18 |             dfs(ni, nj, G, ans, k - 1);
      |                                 ^
a.cc: In function 'int main()':
a.cc:45:8: error: too many arguments to function 'void dfs(int, int, std::vector<std::vector<bool> >&, std::vector<std::pair<int, int> >&)'
   45 |     dfs(si, sj, G, ans, k);
      |     ~~~^~~~~~~~~~~~~~~~~~~
a.cc:8:6: note: declared here
    8 | void dfs(int i, int j, vector<vector<bool> > &G, vector<pair<int, int> > &ans){
      |      ^~~
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr int dx[] = {0, 0, 1, -1};
constexpr int dy[] = {1, -1, 0, 0};

int div_up(int a, int b)
{
    return (a + b - 1) / b;
}

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

    int h, w, k, fh, fw;
    string a[810];

    cin >> h >> w >> k;
    REP(i, h)
    cin >> a[i];

    REP(i, h)
    REP(j, w)
    if (a[i][j] == 'S')
        fh = i, fw = j;

    vector<P> v;

    int dis[810][810];
    memset(dis, -1, sizeof(dis));
    dis[fh][fw] = 0;

    queue<P> q;
    q.push(make_pair(fh, fw));

    while (q.size())
    {
        P p = q.front();
        q.pop();

        bool add = false;

        REP(i, 4)
        {
            P p_ = p;
            p_.first += dy[i];
            p_.second += dx[i];

            if (p_.first < 0 || h <= p_.first || p_.second < 0 || w <= p_.second)
                continue;

            if (dis[p_.first][p_.second] != -1)
                continue;

            if (a[p_.first][p_.second] == '#')
            {
                if (!add)
                {
                    v.push_back(p);
                    add = true;
                }

                continue;
            }

            int d = dis[p.first][p.second] + 1;

            dis[p_.first][p_.second] = d;

            if (d <= k)
                q.push(p_);
        }
    }

    int res = INT_MAX;

    for (P p : v)
    {
        res = min(res, div_up(p.first, k));
        res = min(res, div_up(h - p.first - 1, k));
        res = min(res, div_up(p.second, k));
        res = min(res, div_up(w - p.second - 1, k));
    }

    cout << res + 1 << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:56:5: error: 'memset' was not declared in this scope
   56 |     memset(dis, -1, sizeof(dis));
      |     ^~~~~~
a.cc:14:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   13 | #include <climits>
  +++ |+#include <cstring>
   14 |
Language: C++

#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;


int main(){
    ll h,w,k;
    cin>>h>>w>>k;
    vector<string> A(h);
    for(int i=0;i<h;i++){cin>>A[i];}
    pll s;
    for(int i=0;i<h;i++){
        for(int t=0;t<w;t++){
            if(A[i][t]=='S'){s={i,t};}
        }
    }
    ll ans=E;
    queue<pll> Q;
    Q.push(s);
    vector<vector<ll>> dist(h,vector<ll>(w,E));
    dist[s.F][s.S]=0;
    vector<pll> d={{0,1},{1,0},{-1,0},{0,-1}};
    bool done=false;
    while(!Q.empty() && !done){
        pll W=Q.front(); Q.pop();
        if(dist[W.F][W.S]>=k){continue;}
        for(int i=0;i<4 && !done;i++){
            pll k=W;
            k.F+=d[i].F;
            k.S+=d[i].S;
            if(A[k.F][k.S]=='#' || dist[k.F][k.S]!=E){continue;}
            dist[k.F][k.S]=dist[W.F][W.S]+1;
            Q.push({k.F,k.S});
            if(k.F==0 || k.S==0 || k.F==h-1 || k.S==w-1){
                ans=dist[k.F][k.S];
                done=true;
            }
        }
    }
    for(int i=0;i<h;i++){
        for(int t=0;t<w;t++){
            if(dist[i][t]!=E){
                ans=min(min(ans,k+i),min(k+t,w-1-t+k),min(h-1-i+k,ans));
            }
        }
    }
    cout<<ans<<endl;
    
    
    
    return 0;
}


Compiler output:
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/iomanip:42,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = long long int; _Compare = long long int]':
a.cc:73:24:   required from here
   73 |                 ans=min(min(ans,k+i),min(k+t,w-1-t+k),min(h-1-i+k,ans));
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function
  284 |       if (__comp(__b, __a))
      |           ~~~~~~^~~~~~~~~~
Language: C++

#include<cstdio>
#include<queue>
#include<cstring>
#include<algorithm>
#define pii pair<int,int>
#define mp make_pair
using namespace std;
int n,m,k,cx,cy,ans=1e9;
char s[805][805];
int d[805][805];
const int dx[]={0,1,-1,0},dy[]={1,0,0,-1};
void bfs()
{
	queue<pair<pii,int> > q;
	q.push(mp(pii(cx,cy),0));
	while(!q.empty())
	{
		int x=q.front().first.first,y=q.front().first.second,z=q.front().second;q.pop();
		if(d[x][y]<=z||s[x][y]=='#')continue;
		d[x][y]=z;
		for(int i=0;i<4;i++)
		q.push(mp(pii(x+dx[i],y+dy[i]),z+1));
	}
}
int main()
{
	scanf("%d%d%d",&n,&m,&k);gets(s[0]);
	for(int i=0;i<n;i++)
	{
		gets(s[i]);
		for(int j=0;j<m;j++)
		{if(s[i][j]=='S')cx=i,cy=j,s[i][j]='.';d[i][j]=1e9;} 
	}
	bfs();
	for(int i=0;i<n;i++)
	for(int j=0;j<m;j++)
	if(d[i][j]<=k)
	ans=min(ans,1+(min(min(i,n-i-1),min(j,m-j-1))+k-1)/k);
	printf("%d\n",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:34: error: 'gets' was not declared in this scope; did you mean 'getw'?
   27 |         scanf("%d%d%d",&n,&m,&k);gets(s[0]);
      |                                  ^~~~
      |                                  getw
Language: C++

#include <bits/stdc++.h>
using std::cout;
using std::endl;
using std::cin;
constexpr int vx[] = {1, 0, -1, 0}, vy[] = {0, 1, 0, -1};

int dp[h][w][801];
bool used[h][w];

int main(){
	int h, w, K; cin >> h >> w >> K; std::vector<std::string> s(h);
	for(int i = 0; i < h; i++) cin >> s[i];
	
	int sx, sy;
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			if(s[i][j] != 'S') continue;
			sx = i;
			sy = j;
			i = j = 1e9;
		}
	}
	
	used[sx][sy] = true;
	typedef std::pair<int, std::pair<int, int>> P;
	std::queue<P> qu; qu.push({0, {sx, sy}});
	for(int i = 0; i < h; i++)
		for(int j = 0; j < w; j++)
			for(int k = 0; k < 801; k++)
				dp[i][j][k] = 1e9;
	
	dp[sx][sy][0] = 0;
	while(!qu.empty()){
		auto p = qu.front(); qu.pop();
		
		for(int i = 0; i < 4; i++){
			int nx = p.second.first + vy[i], ny = p.second.second + vx[i];
			if(nx<0||ny<0||nx>=h||ny>=w) continue;
			int block = (s[nx][ny] == '#');
			
			if(dp[p.second.first][p.second.second][p.first] + 1 >= dp[nx][ny][p.first + block]) continue;
			dp[nx][ny][p.first + block] = dp[p.second.first][p.second.second][p.first] + 1;
			qu.push({p.first + block, {nx, ny}});
		}
	}
	
	int mi = 1e9;
	for(int i = 0; i < w; i++){
		for(int j = 1; j < 801; j++){
			mi = std::min(mi, std::max(std::max(2, (dp[0][i][j] + K - 1) / K), j / K + 1));
			mi = std::min(mi, std::max(std::max(2, (dp[i][0][j] + K - 1) / K), j / K + 1));
			mi = std::min(mi, std::max(std::max(2, (dp[h - 1][i][j] + K - 1) / K), j / K + 1));
			mi = std::min(mi, std::max(std::max(2, (dp[i][w - 1][j] + K - 1) / K), j / K + 1));
		}
		
		mi = std::min(mi, (dp[0][i][0] + K - 1) / K);
		mi = std::min(mi, (dp[i][0][0] + K - 1) / K);
		mi = std::min(mi, (dp[h - 1][i][0] + K - 1) / K);
		mi = std::min(mi, (dp[i][w - 1][0] + K - 1) / K);
	}
	
	
	cout << mi << endl;
	return 0;
}


Compiler output:
a.cc:7:8: error: 'h' was not declared in this scope
    7 | int dp[h][w][801];
      |        ^
a.cc:7:11: error: 'w' was not declared in this scope
    7 | int dp[h][w][801];
      |           ^
a.cc:8:11: error: 'h' was not declared in this scope
    8 | bool used[h][w];
      |           ^
a.cc:8:14: error: 'w' was not declared in this scope
    8 | bool used[h][w];
      |              ^
a.cc: In function 'int main()':
a.cc:24:9: error: 'used' was not declared in this scope
   24 |         used[sx][sy] = true;
      |         ^~~~
a.cc:30:33: error: 'dp' was not declared in this scope; did you mean 'dup'?
   30 |                                 dp[i][j][k] = 1e9;
      |                                 ^~
      |                                 dup
a.cc:32:9: error: 'dp' was not declared in this scope; did you mean 'dup'?
   32 |         dp[sx][sy][0] = 0;
      |         ^~
      |         dup
Language: C++

#include <iostream>
#include <queue>
#include <tuple>
#include <cstring>
using namespace std;

static int dr[4] = {1, 0, -1, 0},
           dc[4] = {0, 1, 0, -1};

static int H, W, K;

bool inside(int r, int c) {
    return 0 <= r and r < H and 0 <= c and c < W;
}

int main() {
    const int MAXH = 810;
    const int MAXW = 810;

    cin >> H >> W >> K;

    int sr = -1, sc = -1;

    string A[MAXH];
    for (int r = 0; r < H; r++) {
        cin >> A[r];
        for (int c = 0; c < W; c++) {
            if (A[r][c] == 'S') {
                sr = r;
                sc = c;
            }
        }
    }

    static int dist[MAXH][MAXW];
    memset(dist, -1, sizeof(dist));

    queue<tuple<int, int, int>> Q;
    dist[sr][sc] = 0;
    Q.push(make_tuple(sr, sc, 0));

    int ans = W * H;
    while (!Q.empty()) {
        int r, c, d;
        tie(r, c, d) = Q.front(); Q.pop();

        int x = min({r, H - 1 - r, c, W - 1 - c});

        ans = min(ans, (x + K - 1) / K + 1);

        if (d == K) continue;
        for (int i = 0; i < 4; i++) {
            int nr = r + dr[i],
                nc = c + dc[i];
            if (inside(nr, nc) and dist[nr][nc] < 0 and A[nr][nc] != '#') {
                dist[nr][nc] = d + 1;
                Q.push(make_tuple(nr, nc, d + 1));
            }
        }
    }
    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:20: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
   47 |         int x = min({r, H - 1 - r, c, W - 1 - c});
      |                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 1 provided
Language: C++

#include <iostream>
#include <queue>
#include <tuple>
#include <cstring>
using namespace std;

static int dr[4] = {1, 0, -1, 0},
           dc[4] = {0, 1, 0, -1};

static int H, W, K;

bool inside(int r, int c) {
    return 0 <= r and r < H and 0 <= c and c < W;
}

int main() {
    const int MAXH = 810;
    const int MAXW = 810;

    cin >> H >> W >> K;

    int sr = -1, sc = -1;

    string A[MAXH];
    for (int r = 0; r < H; r++) {
        cin >> A[r];
        for (int c = 0; c < W; c++) {
            if (A[r][c] == 'S') {
                sr = r;
                sc = c;
            }
        }
    }

    static int dist[MAXH][MAXW];
    memset(dist, -1, sizeof(dist));

    queue<tuple<int, int, int>> Q;
    dist[sr][sc] = 0;
    Q.push({sr, sc, 0});

    int ans = W * H;
    while (!Q.empty()) {
        int r, c, d;
        tie(r, c, d) = Q.front(); Q.pop();

        int x = min({r, H - 1 - r, c, W - 1 - c});

        ans = min(ans, (x + K - 1) / K + 1);

        if (d == K) continue;
        for (int i = 0; i < 4; i++) {
            int nr = r + dr[i],
                nc = c + dc[i];
            if (inside(nr, nc) and dist[nr][nc] < 0 and A[nr][nc] != '#') {
                dist[nr][nc] = d + 1;
                Q.push({nr, nc, d + 1});
            }
        }
    }
    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:20: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
   47 |         int x = min({r, H - 1 - r, c, W - 1 - c});
      |                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 1 provided
Language: C++

#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define in insert
#define er erase
#define fr first
#define sc second
typedef long long ll;
const long long llinf=LLONG_MAX;
const int inf=INT_MAX;
const int nmax=1e5+5;
const int mod=1e9+7;
using namespace std;
int n,m,k,i,j,l,r,viz[801][801];
ll ans=llinf;
pair<ll,ll>a[]={{1,0},{-1,0},{0,1},{0,-1}};
char c[801][801];
void solve(int i,int j)
{
	viz[i][j]=1;
	int d=min({i,j,n-i-1,m-j-1});
	ans=min(ans,(d+k-1)/k);
	for(int t=0;t<4;t++)if(i+a[t].fr>=0 && i+a[t].fr<n && j+a[t].sc>=0 && j+a[t].sc<m && !viz[i+a[t].fr][j+a[t].sc] && c[i+a[t].fr][j+a[t].sc]!='#' && abs(l-i-a[t].fr)+abs(r-j-a[t].sc)<=k)solve(i+a[t].fr,j+a[t].sc);
}
int main()
{
	//freopen("sol.in","r",stdin);
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	cin>>n>>m>>k;
	for(i=0;i<n;i++)
	 for(j=0;j<m;j++)
	 {
	 	cin>>c[i][j];
	 	if(c[i][j]=='S')l=i,r=j;
	 }
	solve(l,r);
	cout<<ans+1<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'void solve(int, int)':
a.cc:23:16: error: no matching function for call to 'min(ll&, int)'
   23 |         ans=min(ans,(d+k-1)/k);
      |             ~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:23:16: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   23 |         ans=min(ans,(d+k-1)/k);
      |             ~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:23:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   23 |         ans=min(ans,(d+k-1)/k);
      |             ~~~^~~~~~~~~~~~~~~
Language: C++


#include<iostream>
#include<fstream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<set>

using namespace std;



class Node {
public:
    int x, y, d;
    Node(int a, int b, int c) {
        x = a;
        y = b;
        d = c;
    }
};

bool operator>(const Node &lhs, const Node &rhs) {
    return lhs.d > rhs.d;
}

bool operator<(const Node &lhs, const Node &rhs) {
    return lhs.d < rhs.d;
}

int f(int x, int y, int w, int h, int k) {
    int ww = ((x) > (w - x - 1)) ? (w  - x - 1) : (x);
    int hh =((y) > (h - y - 1)) ? (h  - y - 1) : (y);
    
    ww = (ww + k - 1)/k;
    hh = (hh + k - 1)/k;
    return (ww > hh) ? hh : ww;
}

int main() {
    int hx[4] = {0, 0, 1, -1};
    int hy[4] = {-1, 1, 0, 0};
    vector<string> s;
    
    int w, h, k;
    cin >> h >> w >> k;
    s.resize(h);
    for(int i = 0; i < h; i++) {
        cin >> s[i];
    }
    int x, y;
    for (int i = 0; i < h; i++) {
        for(int j = 0; j < w; j++) {
            if(s[i][j] == 'S') {
                s[i][j] = '#';
                x = j;
                y = i;
            }
        }
    }
    
    multiset<Node> q;
    
    
    Node node(x, y, 1);
    
    int ans = f(x, y, w, h, k) + 1;
    
    q.insert(node);
    
    
    while(q.size() > 0) {
        Node now = *q.begin();
        q.erase(q.begin());
        if(now.x < 0 || now.x >= w || now.y < 0 || now.y >= h) {
            ans = 0;
            break;
        }
        if(f(now.x, now.y, w, h, k) + 1 < ans) {
            ans = f(now.x, now.y, w, h, k) + 1;
        }
        if(now.d　-　1 == k) {
            continue;
        }
        for(int i = 0; i < 4; i++) {
            if(s[now.y + hy[i]][now.x + hx[i]] == '.') {
                if(now.x + hx[i] == 0 || now.x + hx[i] == w - 1 || now.y + hy[i] == 0 || now.y + hy[i] == h - 1) {
                    ans = 1;
                    continue;
                }
                s[now.y + hy[i]][now.x + hx[i]] = '#';
                Node next(now.x + hx[i], now.y + hy[i], now.d + 1);
                q.insert(next);
            }
        }
    }
    cout << ans << endl;
    
    return 0;
}

Compiler output:
a.cc:86:16: error: extended character 　 is not valid in an identifier
   86 |         if(now.d　-　1 == k) {
      |                ^
a.cc:86:20: error: extended character 　 is not valid in an identifier
   86 |         if(now.d　-　1 == k) {
      |                    ^
a.cc: In function 'int main()':
a.cc:86:16: error: 'class Node' has no member named 'd\U00003000'
   86 |         if(now.d　-　1 == k) {
      |                ^~~
a.cc:86:20: error: '\U000030001' was not declared in this scope
   86 |         if(now.d　-　1 == k) {
      |                    ^~~
Language: C++

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

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <int, pii> piii;

#define fr first
#define sc second
#define pb push_back
#define mpr make_pair
#define ppb pop_back()
#define ins insert
#define sz(s) int(s.size())
#define all(x) x.begin(), x.end()
#define lb lower_bound
#define ub upper_bound
int n, m, k, d[1000][1000], b[1000][1000];
bool in(int x, int y){
	if(x < 1 || x > n || y < 1 || y > m)return 0;
	return 1;
}
pii s;
set <piii> st;

char c;
int main()
{
	ios_base :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> m >> k;
	for(int i = 1;i <= n; ++ i){
		for(int j = 1;j <= m; ++ j){
			cin >> c;
			if(i == 1 || j == 1 || i == n || j == m){
				d[i][j] = (c == '#');
				st.ins(mpr(d[i][j], mpr(i, j)));
			}
			else {
				b[i][j] = 1;
				b[i][j] += (c == '#');
				if(c == 'S')s = mpr(i, j);
				d[i][j] = 1000;
			}
		}
	}
	while(sz(st)){
		piii p2 = *st.begin();
		pii p = p2.sc;
		st.erase(st.begin());
		for(int i = -1;i <= 1; ++ i){
			for(int j = -1;j <= 1; ++ j){
				if(abs(i + j) != 1)continue;
				if(!in(p.fr + i, p.sc + j))continue;
				if(d[p.fr + i][p.sc + j] > d[p.fr][p.sc] + b[p.fr + i][p.sc + j]){
					st.erase(mpr(d[p.fr + i][p.sc + j], mpr(p.fr + i, p.sc + j)));
					d[p.fr + i][p.sc + j] = d[p.fr][p.sc] + b[p.fr + i][p.sc + j];
					st.ins(mpr(d[p.fr + i][p.sc + j], mpr(p.fr + i, p.sc + j)));
				}
			}
		}
	}
	if(d[s.fr][s.sc] > 2 * k){
		cout << k
		return 0;
	}
	cout << d[s.fr][s.sc];
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:65:26: error: expected ';' before 'return'
   65 |                 cout << k
      |                          ^
      |                          ;
   66 |                 return 0;
      |                 ~~~~~~