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

#include <iostream>
#include <string>

using namespace std;

int h, w;
int count;
string s[1000];

cin >> h >> w;

for (int i = 0; i < h; i++) {
    cin >> s[i];
}

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

// for (int i = 0; i < 4; i++) {
//     int yy = y 
// }

for (int j = 0; i < h; i++) {
    for (int k = 0; k < w; k++) {
        if (s[j][k] = "#") {
            count++;
            if ((0 < j && j < h) && (0 < k && k < w) {
                s[j][k+1] = "#";
                s[j][k-1] = "#";
                s[j+1][k] = "#";
                s[j-1][k] = "#";    
            } else if (j == 0 && k == 0)) {
                s[j][k+1] = "#";
                s[j+1][k] = "#";
            } else if (j == h && k == 0) {
                s[j][k+1] = "#";
                s[j-1][k] = "#";
            } else if (j == 0 && k == w) {
                s[j+1][k] = "#";
                s[j][k-1] = "#";
            } else if (j == h && k == w) {
                s[j-1][k] = "#";
                s[j][k-1] ="#";
            } else if (j == 0) {
                s[j+1][k] = "#";
                s[j][k-1] = "#";
                s[j][k+1] = "#";
            } else if (j == h) {
                s[j-1][k] = "#";
                s[j][k-1] = "#";
                s[j][k+1] = "#";
            } else if (k == 0) {
                s[j][k+1] = "#";
                s[j+1][k-1] = "#";
                s[j-1][k+1] = "#";
            } else if (k == w) {
                s[j][k-1] = "#";
                s[j+1][k] = "#";
                s[j-1][k] = "#";
            }
        
        }
    }
}

cout << count << endl;





Compiler output:
a.cc:10:1: error: 'cin' does not name a type
   10 | cin >> h >> w;
      | ^~~
a.cc:12:1: error: expected unqualified-id before 'for'
   12 | for (int i = 0; i < h; i++) {
      | ^~~
a.cc:12:17: error: 'i' does not name a type
   12 | for (int i = 0; i < h; i++) {
      |                 ^
a.cc:12:24: error: 'i' does not name a type
   12 | for (int i = 0; i < h; i++) {
      |                        ^
a.cc:23:1: error: expected unqualified-id before 'for'
   23 | for (int j = 0; i < h; i++) {
      | ^~~
a.cc:23:17: error: 'i' does not name a type
   23 | for (int j = 0; i < h; i++) {
      |                 ^
a.cc:23:24: error: 'i' does not name a type
   23 | for (int j = 0; i < h; i++) {
      |                        ^
a.cc:66:1: error: 'cout' does not name a type
   66 | cout << count << endl;
      | ^~~~
Language: C++

#include<iostream>
#include<queue>
#include<cstring>
using namespace std;
int a[1005][1005],n,m;
long long b[1005][1005];
int move[3][5]={0,0,0,0,0,0,1,0,-1,0,0,0,-1,0,1};
struct node{
	int x,y;
}p,f;
queue<node> q;

int main()
{
	char c;
	bool flag;
	int i,j,k,dx,dy;
	long long ans=0;
	cin>>n>>m;
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++){
			cin>>c;
			if(c=='#'){
				a[i][j]=1;
				p.x=i;p.y=j;
				q.push(p);
			}
			else a[i][j]=0;	
		}
		
	while(!q.empty()){
		f=q.front();
		for(i=1;i<=4;i++){
			dx=move[1][i]+f.x;
			dy=move[2][i]+f.y;
			if(dx>=1 && dx<=n && dy>=1 && dy<=m && !a[dx][dy]){
				a[dx][dy]=1;
				p.x=dx;p.y=dy;
				q.push(p);
				b[dx][dy]=b[f.x][f.y]+1;
			}
		}
		ans=max(ans,b[f.x][f.y]);
		q.pop();
	}
	
	cout<<ans;
	return 0;
 } 

Compiler output:
a.cc: In function 'int main()':
a.cc:34:28: error: reference to 'move' is ambiguous
   34 |                         dx=move[1][i]+f.x;
      |                            ^~~~
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:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
In file included from /usr/include/c++/14/bits/exception_ptr.h:41,
                 from /usr/include/c++/14/exception:166,
                 from /usr/include/c++/14/ios:41:
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:7:5: note:                 'int move [3][5]'
    7 | int move[3][5]={0,0,0,0,0,0,1,0,-1,0,0,0,-1,0,1};
      |     ^~~~
a.cc:35:28: error: reference to 'move' is ambiguous
   35 |                         dy=move[2][i]+f.y;
      |                            ^~~~
/usr/include/c++/14/bits/stl_algobase.h:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:7:5: note:                 'int move [3][5]'
    7 | int move[3][5]={0,0,0,0,0,0,1,0,-1,0,0,0,-1,0,1};
      |     ^~~~
Language: C++

#include<iostream>
#include<queue>
#include<cstring>
using namespace std;
int a[1005][1005],n,m;
long long b[1005][1005];
int move[3][5]={0,0,0,0,0,
				0,1,0,-1,0,
				0,0,-1,0,1};
struct node{
	int x,y;
}p,f;
queue<node> q;

int main()
{
	char c;
	bool flag;
	int i,j,k,dx,dy;
	long long ans=0;
	cin>>n>>m;
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++){
			cin>>c;
			if(c=='#'){
				a[i][j]=1;
				p.x=i;p.y=j;
				q.push(p);
			}
			else a[i][j]=0;	
		}
		
	while(!q.empty()){
		f=q.front();
		for(i=1;i<=4;i++){
			dx=move[1][i]+f.x;
			dy=move[2][i]+f.y;
			if(dx>=1 && dx<=n && dy>=1 && dy<=m && !a[dx][dy]){
				a[dx][dy]=1;
				p.x=dx;p.y=dy;
				q.push(p);
				b[dx][dy]=b[f.x][f.y]+1;
			}
		}
		ans=max(ans,b[f.x][f.y]);
		q.pop();
	}
	
	cout<<ans;
	return 0;
 } 

Compiler output:
a.cc: In function 'int main()':
a.cc:36:28: error: reference to 'move' is ambiguous
   36 |                         dx=move[1][i]+f.x;
      |                            ^~~~
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:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
In file included from /usr/include/c++/14/bits/exception_ptr.h:41,
                 from /usr/include/c++/14/exception:166,
                 from /usr/include/c++/14/ios:41:
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:7:5: note:                 'int move [3][5]'
    7 | int move[3][5]={0,0,0,0,0,
      |     ^~~~
a.cc:37:28: error: reference to 'move' is ambiguous
   37 |                         dy=move[2][i]+f.y;
      |                            ^~~~
/usr/include/c++/14/bits/stl_algobase.h:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:7:5: note:                 'int move [3][5]'
    7 | int move[3][5]={0,0,0,0,0,
      |     ^~~~
Language: C

#include<stdio.h>
int main(void){
  int H,W,A[1000][1000],i,j,cou;
  scanf("%d",&H);
  scanf("%d",&W);
  for(i=0;i<H;i++){
  	for(j=0;j<W;j++){
  		scanf("%d",&A[i][j]);
    }
  }
  for(int k=0;k<10;k++){
  for(i=0;i<H;i++){
  	for(j=0;j<W;j++){
  		if(i%2!=0){
        j++;
        }
      if(A[i][j]=='#'){
      	A[i-1][j]='#';
        A[i+1][j]='#';
        A[i][j-1]='#';
        A[i][j+1]='#';
      }
      
    }
  }
  cou++;
    for(i=0;i<H;i++){
  	for(j=0;j<W;j++){
  		if(A[i][j]=='#'){
        cou2++;
        }
      
    }
  }
    if(cou2==H*W){
      break;
    }
  }
  printf("%d",cou);
}
  

Compiler output:
main.c: In function 'main':
main.c:30:9: error: 'cou2' undeclared (first use in this function); did you mean 'cou'?
   30 |         cou2++;
      |         ^~~~
      |         cou
main.c:30:9: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <bits/stdc++.h>
using namespace std;
char mp[1010][1010];
int dx[]={0,0,1,-1},dy[]={1,-1,0,0};
int n,m;
int hash(int x,int y){
	return x*m+y;
}
int judge(int x,int y){
	if(x>=0 && x<n && y>=0 && y<m && mp[x][y]=='.'){
		return 1;
	}
	return 0;
}
queue<int> q,qq;
int main(){
	scanf("%d%d",&n,&m);
	for(int i=0;i<n;i++){
		scanf("%s",mp[i]);
		for(int j=0;j<m;j++){
			if(mp[i][j]=='#'){
				q.push(hash(i,j));
				qq.push(1);
			}
		}
	}
	int ans=0;
	while(!q.empty()){
		int tmp=q.front();
		q.pop();
		int x=tmp/m,y=tmp%m;
		int th=qq.front();
		qq.pop();
		ans=th;
		for(int i=0;i<4;i++){
			int tx=x+dx[i],ty=y+dy[i];
			if(judge(tx,ty)){
				mp[tx][ty]='#';
				q.push(hash(tx,ty));
				qq.push(th+1);
			}
		}
	}
	printf("%d\n",ans-1);
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:40: error: reference to 'hash' is ambiguous
   22 |                                 q.push(hash(i,j));
      |                                        ^~~~
In file included from /usr/include/c++/14/string_view:50,
                 from /usr/include/c++/14/bits/basic_string.h:47,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:6:5: note:                 'int hash(int, int)'
    6 | int hash(int x,int y){
      |     ^~~~
a.cc:39:40: error: reference to 'hash' is ambiguous
   39 |                                 q.push(hash(tx,ty));
      |                                        ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:6:5: note:                 'int hash(int, int)'
    6 | int hash(int x,int y){
      |     ^~~~
Language: C

#include <stdio.h>
int main(){
  int h,w;
  scanf("%d %d",&h,&w);
  int square[h][w];
  int i,j;
  
  for(i=0;i<h;i++){
    char mark[i][w];
    scanf("%s",mark[i]);
	for(j=0;j<w;j++){
      square[i][j]=mark[i][j];
      square[i][j]=(square[i][j]=='#'? 0 : 10000;)
    }
  }
  /*for(i=0;i<h;i++){
    for(j=0;j<w;j++){ */
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:13:49: error: expected ')' before ';' token
   13 |       square[i][j]=(square[i][j]=='#'? 0 : 10000;)
      |                    ~                            ^
      |                                                 )
main.c:13:51: error: expected ';' before '}' token
   13 |       square[i][j]=(square[i][j]=='#'? 0 : 10000;)
      |                                                   ^
      |                                                   ;
   14 |     }
      |     ~
Language: C

#include <stdio.h>
int main(){
  int h,w;
  scanf("%d %d",&h,&w);
  int square[h][w];
  int i,j;
  
  for(i=0;i<h;i++){
    char mark[i][w];
    scanf("%s",mark[i]);
	for(j=0;j<w;j++){
      square[i][j]=mark[i][j]
      square[i][j]=(square[i][j]=='#'? 0 : 10000;)
    }
  }
  /*for(i=0;i<h;i++){
    for(j=0;j<w;j++){ */
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:12:30: error: expected ';' before 'square'
   12 |       square[i][j]=mark[i][j]
      |                              ^
      |                              ;
   13 |       square[i][j]=(square[i][j]=='#'? 0 : 10000;)
      |       ~~~~~~
Language: C

#include <stdio.h>
int main(){
  int h,w;
  scanf("%d %d",&h,&w);
  int square[h][w];
  int i,j;
  
  for(i=0;i<h;i++){
    char mark[i][w];
    scanf("%s",mark[i]);
	for(j=0;j<w;j++){
      square[i][j]=mark[i][j]
      square[i][j]=(square[i][j]=='#'? 0 : 10000;)
    }
  }
  /*for(i=0;i<h;i++){
    for(j=0;j<w;j++){ */
      

Compiler output:
main.c: In function 'main':
main.c:12:30: error: expected ';' before 'square'
   12 |       square[i][j]=mark[i][j]
      |                              ^
      |                              ;
   13 |       square[i][j]=(square[i][j]=='#'? 0 : 10000;)
      |       ~~~~~~                  
main.c:15:3: error: expected declaration or statement at end of input
   15 |   }
      |   ^
Language: C++

//  Darker and Darker

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

using namespace std;

struct Point
{
    int x;
    int y;
    int number;
};


void move(int met[1000][1000], Point p, queue<Point> &q, int x1, int y1, int &count)
{
    int x2 = x1 + p.x;
    int y2 = y1 + p.y;
    if (met[x2][y2] > -1) {
        return;
    }
    int number = p.number + 1;
    met[x2][y2] = number;
    p.x = x2;
    p.y = y2;
    p.number = number;
    q.push(p);
    count = count < number ? number : count;
    return count;
}

int main()
{
    int met[1000][1000];
    int H,W;
    cin >> H >> W;
    int number = 0;
    queue<Point> q;

    // 初期化
    for (int i = 0; i < H; i++) {
        string s;
        cin >> s;
        for (int j = 0; j < W; j++) {
            if (s[j] == '#') {
                number++;
                met[i][j] = 2;
                Point p;
                p.x = i;
                p.y = j;
                p.number = 0;
                q.push(p);
            }
            else {
                met[i][j] = -1;
            }
        }
    }

    int count = 0;
    while (!q.empty()) {
        Point p = q.front();
        q.pop();
        // 隣接するセルをキューに追加する
        move(met, p, q, -1, 0, count);
        move(met, p, q, 0, -1, count);
        move(met, p, q, 0, 1, count);
        move(met, p, q, 1, 0, count);
    }
    cout << count << endl;
    return 0;
}

Compiler output:
a.cc: In function 'void move(int (*)[1000], Point, std::queue<Point>&, int, int, int&)':
a.cc:33:12: error: return-statement with a value, in function returning 'void' [-fpermissive]
   33 |     return count;
      |            ^~~~~
Language: C++

//  Darker and Darker

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

using namespace std;

struct Point
{
    int x;
    int y;
    int number;
};


void move(int met[1000][1000], Point p, queue<Point> &q, int x1, int y1, int &count)
{
    int x2 = x1 + p.x;
    int y2 = y1 + p.y;
    if (met[x2][y2] > -1) {
        return count;
    }
    int number = p.number + 1;
    met[x2][y2] = number;
    p.x = x2;
    p.y = y2;
    p.number = number;
    q.push(p);
    count = count < number ? number : count;
    return count;
}

int main()
{
    int met[1000][1000];
    int H,W;
    cin >> H >> W;
    int number = 0;
    queue<Point> q;

    // 初期化
    for (int i = 0; i < H; i++) {
        string s;
        cin >> s;
        for (int j = 0; j < W; j++) {
            if (s[j] == '#') {
                number++;
                met[i][j] = 2;
                Point p;
                p.x = i;
                p.y = j;
                p.number = 0;
                q.push(p);
            }
            else {
                met[i][j] = -1;
            }
        }
    }

    int count = 0;
    while (!q.empty()) {
        Point p = q.front();
        q.pop();
        // 隣接するセルをキューに追加する
        move(met, p, q, -1, 0, count);
        move(met, p, q, 0, -1, count);
        move(met, p, q, 0, 1, count);
        move(met, p, q, 1, 0, count);
    }
    cout << count << endl;
    return 0;
}

Compiler output:
a.cc: In function 'void move(int (*)[1000], Point, std::queue<Point>&, int, int, int&)':
a.cc:24:16: error: return-statement with a value, in function returning 'void' [-fpermissive]
   24 |         return count;
      |                ^~~~~
a.cc:33:12: error: return-statement with a value, in function returning 'void' [-fpermissive]
   33 |     return count;
      |            ^~~~~
Language: C++

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

#define rep(i,n) for(int i=0;i<n;i++)
#define repi(i,a,n) for(int i=a;i<n;i++)
#define repd(i,n) for(int i=n-1;i>=0;i--)
#define mp make_pair
#define fastIO ios::sync_with_stdio(false)
#define read freopen("in.in","r",stdin)
#define write freopen("out.out","w",stdout)
#define scf(xx) scanf("%d",&xx)
#define scfl(xx) scanf("%I64d",&xx)
#define All(a) a.begin(), a.end()
#define debug(i,r) cout<<"i= "<<(int)i<<" r="<<(lli)r<<endl;
#define fil(dp) memset(dp,-1,sizeof dp);
#define sz(x) (int)(x).size()
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

const int MOD = 1000000007;
const double PI = 4*atan(1);
const int MX = 100000;

typedef long long ll;
typedef long long int  lli;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, ll> ii;
typedef pair<int, int> pi;
typedef long double ld;

int t[300005];
char tab[1001][1001];

bool verify(int i,int j,int n,int m)
{
if(i>=0 && i<n && j>=0 && j<m)return 1;
else return 0;
}
int main()
{

    int n,m;
    cin>>n>>m;
    rep(i,n)
    {
    rep(j,n)cin>>tab[i][j];
    }
    int res=0;
    queue<pi> v;
    rep(i,n)
    {
    rep(j,n){if(tab[i][j]=='#')v.push(mp(i,j));}
    }
    bool flag =0;
    queue<pi> temp;
    while(v.size())
    {
    while(v.size())
    {
    pi a=v.front();v.pop();
    if(verify(a.first-1,a.second,n,m) && tab[a.first-1][a.second]=='.'){tab[a.first-1][a.second]='#';temp.push(mp(a.first-1,a.second));}
    if(verify(a.first,a.second-1,n,m) && tab[a.first][a.second-1]=='.'){tab[a.first][a.second-1]='#';temp.push(mp(a.first,a.second-1));}
    if(verify(a.first+1,a.second,n,m) && tab[a.first+1][a.second]=='.'){tab[a.first+1][a.second]='#';temp.push(mp(a.first+1,a.second));}
    if(verify(a.first,a.second+1,n,m) && tab[a.first][a.second+1]=='.'){tab[a.first][a.second+1]='#';temp.push(mp(a.first,a.second+1));}
    }
    res++;
    v=temp;
    while(!temp.empty)temp.pop();
     //if(flag)res++;
     //flag=0;
    }

     cout<<max(0,res-1)<<endl;

    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:72:17: error: cannot convert 'std::queue<std::pair<int, int> >::empty' from type 'bool (std::queue<std::pair<int, int> >::)() const' to type 'bool'
   72 |     while(!temp.empty)temp.pop();
      |                 ^~~~~
a.cc:72:17: error: in argument to unary !
   72 |     while(!temp.empty)temp.pop();
      |            ~~~~~^~~~~
Language: C++

#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <time.h>
#include <stdlib.h>
using namespace std;

int h,w;

int rep(int mat[1000][10０0],int x,int y,int n){
	mat[x][y] = n;
	if(n+1<mat[x-1][y]&&x>0) rep(mat,x-1,y,n+1);
	if(n+1<mat[x][y-1]&&y>0) rep(mat,x,y-1,n+1);
	if(n+1<mat[x][y+1] && y<h-1) rep(mat,x,y+1,n+1);
	if(n+1<mat[x+1][y] && x<w-1) rep(mat,x+1,y,n+1);
	return 0;
}
	

int main(){
	int mat[1000][1000],count=0,ans=0;
	char c;
	scanf("%d",&h); 
	scanf("%d",&w);
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin >> c;
			if(c=='#') mat[i][j] = 0;
			if(c=='.') mat[i][j] = 10000;
		}
	}
	
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(mat[i][j]==0){
				rep(mat,i,j,0);
			}
			if(mat[i][j]+1<mat[i][j+1] && j<h-1) mat[i][j+1] = mat[i][j]+1;
			if(mat[i][j]+1<mat[i+1][j] && i<w-1) mat[i+1][j] = mat[i][j]+1;
		}
	}
	
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(ans<mat[i][j]) ans = mat[i][j];
			printf("%d ",mat[i][j]);
		}
		printf("\n");
	}
	printf("%d\n",ans);
	return 0;
}

Compiler output:
a.cc:13:23: error: unable to find numeric literal operator 'operator""\U0000ff100'
   13 | int rep(int mat[1000][10０0],int x,int y,int n){
      |                       ^~~~~
a.cc:13:29: error: expected ')' before ',' token
   13 | int rep(int mat[1000][10０0],int x,int y,int n){
      |        ~                    ^
      |                             )
a.cc:13:30: error: expected unqualified-id before 'int'
   13 | int rep(int mat[1000][10０0],int x,int y,int n){
      |                              ^~~
Language: C++

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

int main() {
  int h, w;
  cin >> h >> w;
  vector<vector<char>> g(h, vector<char>(w));
  vector<vector<int>> d(h, vector<int>(w, -1));
  queue<pair<int, int>> Q;
  for (int i = 0; i < h; i ++) {
    for (int j = 0; j < w; j ++) {
      cin >> g[i][j];
      if (g[i][j] == '#') {
        d[i][j] = 0;
        Q.push(make_pair(i, j));
      }
    }
  }

  int ans = 0;
  int dx[4] = {1, -1, 0, 0};
  int dy[4] = {0, 0, 1, -1};
  pair<int, int> p;
  while (!Q.empty()) {
    p = Q.front(); Q.pop();
    int x = p.first;
    int y = p.second;
    ans = d[x][y];
    for (int i = 0; i < 4; i ++) {
      int nx = x + dx[i];
      int ny = y + dy[i];
      if ()
      if (nx >= 0 && nx < h && ny >= 0 && ny < w && d[nx][ny] == -1) {
        d[nx][ny] = d[x][y] + 1;
        Q.push(make_pair(nx, ny));
      }
    }
  }

  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:11: error: expected primary-expression before ')' token
   33 |       if ()
      |           ^
Language: C++

#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <time.h>
#include <stdlib.h>
using namespace std;

int h,w;

int rep(int mat[1000][1000],int x,int y,int n){
	if(mat[x][y]==0) return 1;
	if(n==0) return 0;
	int sum=0;
	if(x>0) sum+=rep(mat,x-1,y,n-1);
	if(y>0) sum+=rep(mat,x,y-1,n-1);
	if(x<h-1) sum+=rep(mat,x+1,y,n-1);
	if(x<w-1) sum+=rep(mat,x,y+1,n-1);
	if(sum==0)return 0;
	return 1;
}
	

int main(){
	int mat[100][100],n,count=0;
	char c;
	scanf("%d",&h); 
	scanf("%d",&w);
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin >> c;
			if(c=='#') mat[i][j] = 0;
			if(c=='.') mat[i][j] = 1;
		}
	}
	
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			for(n=count+1;;n++){
				if(rep(mat,i,j,n)==0) count +=1;
				else break;
			}
		}
	}
	
	printf("%d\n",n);
	while(1){}
	return 0;
}
				

Compiler output:
a.cc: In function 'int main()':
a.cc:42:40: error: cannot convert 'int (*)[100]' to 'int (*)[1000]'
   42 |                                 if(rep(mat,i,j,n)==0) count +=1;
      |                                        ^~~
      |                                        |
      |                                        int (*)[100]
a.cc:13:13: note:   initializing argument 1 of 'int rep(int (*)[1000], int, int, int)'
   13 | int rep(int mat[1000][1000],int x,int y,int n){
      |         ~~~~^~~~~~~~~~~~~~~
Language: C++

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

int main(){
  int H, W;
  cin >> H >> W;
  vector<string> a(H);
  for(int i = 0; i < H; i++){ 
    cin >> a[i];
  }
  vector<int> s = {1, -1, 0, 0};
  vector<int> t = {0, 0, 1, -1};
  int x = 0;
  for(int g = 0; g >= 0; g++){
    int y = 0;
    int z = 0;
    vector<int> b(1000000);
    vector<int> c(1000000);
    for(int i = 0; i < H; i++){
      for(int j = 0; j < W; j++){
        if(a[i][j] == '#'){
          b[z] =  i;
          c[z] =  j;
          z++;//#のi,jを入力
        }
      }
    }     
    for(int l = 0; l < z; l++){
      for(int k = 0; k < 4; k++){//.を#に変更
        int m = b[l] + s[k];
        int n = c[l] + t[k];
        if(0 <= m && m < H && 0 <= n && n < W && a[m][n] == '.'){
          a[m][n] = '#';
          y++;//yは変更した回数
        }
      }
      a[b[l]][c[l]] = $;
    }
    x++;
    if(y == 0){
      cout << x-1 << endl;
      break;
    }
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:23: error: '$' was not declared in this scope
   37 |       a[b[l]][c[l]] = $;
      |                       ^
Language: C++

#include<queue>
#include<iostream>
#include<string.h>
using namespace std;

int dx[8] = {-1,1,0,0,1,-1,1,-1};
int dy[8] = {0,0,-1,1,1,-1,-1,1};
int score[1001][1001];
queue< pair<int,int> > que;
int h,w;
bfs(){
while(que.empty() != true){
pair<int,int>temp = que.front();que.pop();
for(int i=0;i<4;i++){
int ny = temp.first + dy[i];
int nx = temp.second + dx[i];
if(nx <= 0 || h +1 <= nx || ny <= 0 || w+1 <= ny)continue;
else if(score[ny][nx] != -1)continue;
else{
score[ny][nx] = score[temp.first][temp.second] +1;
que.push(make_pair(ny,nx));
}
}
}
}

int main(){
cin >> h >>w;
memset(score,-1,sizeof(score));
for(int i=1;i<=h;i++)
for(int j=1;j<=w;j++){
    char temp;
    cin >> temp;
if(temp == '#'){
    score[i][j] = 0;
    que.push(make_pair(i,j));
}
}
bfs();
int ans =-1;
for(int i=1;i<=h;i++){
for(int j=1;j<=w;j++){
ans = max(ans,score[i][j]);
//cout << score[i][j] << " ";
}
//cout << endl;
}
cout << ans <<endl;
return 0;
}

Compiler output:
a.cc:11:1: error: ISO C++ forbids declaration of 'bfs' with no type [-fpermissive]
   11 | bfs(){
      | ^~~
a.cc: In function 'int bfs()':
a.cc:25:1: warning: no return statement in function returning non-void [-Wreturn-type]
   25 | }
      | ^
Language: C++

#include<iostream>
#include<queue>
#define INF 2500
int h,w;
int b[1000][1000];
int check[1000][1000];
struct point{int x, y, value;};
using namespace std;
queue<point> Q;
 
 
int main(){
    char tmp;
    cin >> h >> w;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            b[i][j]=INF;
        }
    }
 
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin >> tmp;
            if(tmp=='#'){
                struct point P={i,j,0};
                Q.push(P);
                b[i][j]=0;
            }
        }
    }
    while(!Q.empty()){
        point p=Q.front();
        if(p.x-1>=0){
            if(p.value+1<b[p.x-1][p.y]){
                struct point q={p.x-1, p.y, p.value+1};
                Q.push(q);
                b[p.x-1][p.y]=p.value+1;
            }
        }
        if(p.x+1<w){
            if(p.value+1<b[p.x+1][p.y]){
                struct point q={p.x+1, p.y, p.value+1};
                Q.push(q);
                b[p.x+1][p.y]=p.value+1;
            }
        }
        if(p.y-1>=0){
            if(p.value+1<b[p.x][p.y-1]){
                struct point q={p.x, p.y-1, p.value+1};
                Q.push(q);
                b[p.x][p.y-1]=p.value+1;
            }
        }
        if(p.y+1<h){
            if(p.value+1<b[p.x][p.y+1]){
                struct point q={p.x, p.y+1, p.value+1};
                Q.push(q);
                b[p.x][p.y+1]=p.value+1;
            }
        }
        Q.pop();
    }
    int mx=0;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
 
            mx=max(mx, b[i][j]);
        }
        cout << endl;
    }
    cout<< mx << endl;
 


Compiler output:
a.cc: In function 'int main()':
a.cc:71:23: error: expected '}' at end of input
   71 |     cout<< mx << endl;
      |                       ^
a.cc:12:11: note: to match this '{'
   12 | int main(){
      |           ^
Language: C

#include<stdio.h>
#include<stdlib.h>
int colhead=0;
int coltail=0;
int rowhead=0;
int rowtail=0;
int col_queue[10000000];
int row_queue[10000000];

int main(void){
  int column;
  int row;
  scanf("%d %d", &column, &row);
  char matrix[column][row];
  int v_flag[column][row];
  int depth[column][row] = {};
  int i = 0;
  int j = 0;
  for(i = 0; i < row; i++ ){
    for(j = 0; j < column; j++ ){
      scanf("%s", &matrix[j][i]);
      if(matrix[j][i] == '#'){
        enq(j,i);
        v_flag[j][i] = 1;
      }
    }
  }
  int cnow=0;
  int rnow=0;
  while(1){
  deq(&cnow, &rnow);
    v_flag[cnow][rnow] = 1;
    if(rnow-1>-1){
          if(v_flag[cnow][rnow-1]!=1){
            enq(cnow,rnow-1);
            v_flag[cnow][rnow-1]=1;
            depth[cnow][rnow-1] = depth[cnow][rnow] + 1;
          }
    }
    if(rnow+1<row){
          if(v_flag[cnow][rnow+1]!=1){
            //printf("右");
            enq(cnow,rnow+1);
            v_flag[cnow][rnow+1]=1;
            depth[cnow][rnow+1] = depth[cnow][rnow] + 1;
          }
    }
    if(cnow-1>-1){
          if(v_flag[cnow-1][rnow]!=1){
            //printf("上");
            enq(cnow-1,rnow);
            v_flag[cnow-1][rnow]=1;
            depth[cnow-1][rnow] = depth[cnow][rnow] + 1;
          }
    }
    if(cnow+1<column){
          if(v_flag[cnow+1][rnow]!=1){
            //printf("下");
            enq(cnow+1,rnow);
            v_flag[cnow+1][rnow]=1;
            depth[cnow+1][rnow] = depth[cnow][rnow] + 1;
          }
    }
    if(coltail == colhead&&rowtail == rowhead){
      break;
    }
  }
  int max = depth[0][0];
  for(i = 0; i < column; i++){
    for(j = 0; j < row; j++){
      if(depth[i][j]>max){
        max = depth[i][j];
      }
    }
  }
  printf("%d", max);
  return 0;
}

int enq( int n, int o ) {
  // if( 10000 <= colhead  ) return -1;
  // if( 10000 <= rowhead  ) return -1;
  coltail++;
  rowtail++;
  col_queue[coltail] = n;
  row_queue[rowtail] = o;
  return 0;
}

int deq( int *n , int *o) {
  // if( colhead == coltail ) return -1;
  // if( rowhead == rowtail ) return -1;
    *n = col_queue[colhead];
    *o = row_queue[rowhead];
    colhead++;
    rowhead++;
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:23:9: error: implicit declaration of function 'enq' [-Wimplicit-function-declaration]
   23 |         enq(j,i);
      |         ^~~
main.c:31:3: error: implicit declaration of function 'deq' [-Wimplicit-function-declaration]
   31 |   deq(&cnow, &rnow);
      |   ^~~
Language: C

#include<stdio.h>
#include<stdlib.h>
int colhead=0;
int coltail=0;
int rowhead=0;
int rowtail=0;
int col_queue[10000000];
int row_queue[10000000];
int depth[10000000][10000000] = {};

int main(void){
  int column;
  int row;
  scanf("%d %d", &column, &row);
  char matrix[column][row];
  int v_flag[column][row];
  int i = 0;
  int j = 0;
  for(i = 0; i < row; i++ ){
    for(j = 0; j < column; j++ ){
      scanf("%s", &matrix[j][i]);
      if(matrix[j][i] == '#'){
        enq(j,i);
        v_flag[j][i] = 1;
      }
    }
  }
  int cnow=0;
  int rnow=0;
  while(1){
  deq(&cnow, &rnow);
    v_flag[cnow][rnow] = 1;
    if(rnow-1>-1){
          if(v_flag[cnow][rnow-1]!=1){
            enq(cnow,rnow-1);
            v_flag[cnow][rnow-1]=1;
            depth[cnow][rnow-1] = depth[cnow][rnow] + 1;
          }
    }
    if(rnow+1<row){
          if(v_flag[cnow][rnow+1]!=1){
            //printf("右");
            enq(cnow,rnow+1);
            v_flag[cnow][rnow+1]=1;
            depth[cnow][rnow+1] = depth[cnow][rnow] + 1;
          }
    }
    if(cnow-1>-1){
          if(v_flag[cnow-1][rnow]!=1){
            //printf("上");
            enq(cnow-1,rnow);
            v_flag[cnow-1][rnow]=1;
            depth[cnow-1][rnow] = depth[cnow][rnow] + 1;
          }
    }
    if(cnow+1<column){
          if(v_flag[cnow+1][rnow]!=1){
            //printf("下");
            enq(cnow+1,rnow);
            v_flag[cnow+1][rnow]=1;
            depth[cnow+1][rnow] = depth[cnow][rnow] + 1;
          }
    }
    if(coltail == colhead&&rowtail == rowhead){
      break;
    }
  }
  int max = depth[0][0];
  for(i = 0; i < column; i++){
    for(j = 0; j < row; j++){
      if(depth[i][j]>max){
        max = depth[i][j];
      }
    }
  }
  printf("%d", max);
  return 0;
}

int enq( int n, int o ) {
  // if( 10000 <= colhead  ) return -1;
  // if( 10000 <= rowhead  ) return -1;
  coltail++;
  rowtail++;
  col_queue[coltail] = n;
  row_queue[rowtail] = o;
  return 0;
}

int deq( int *n , int *o) {
  // if( colhead == coltail ) return -1;
  // if( rowhead == rowtail ) return -1;
    *n = col_queue[colhead];
    *o = row_queue[rowhead];
    colhead++;
    rowhead++;
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:23:9: error: implicit declaration of function 'enq' [-Wimplicit-function-declaration]
   23 |         enq(j,i);
      |         ^~~
main.c:31:3: error: implicit declaration of function 'deq' [-Wimplicit-function-declaration]
   31 |   deq(&cnow, &rnow);
      |   ^~~
Language: C

#include<stdio.h>
#include<stdlib.h>
int colhead=0;
int coltail=0;
int rowhead=0;
int rowtail=0;
int col_queue[10000];
int row_queue[10000];
int depth[10000][10000] = {};

int main(void){
  int column;
  int row;
  scanf("%d %d", &column, &row);
  char matrix[column][row];
  int v_flag[column][row];
  int i = 0;
  int j = 0;
  for(i = 0; i < row; i++ ){
    for(j = 0; j < column; j++ ){
      scanf("%s", &matrix[j][i]);
      if(matrix[j][i] == '#'){
        enq(j,i);
        v_flag[j][i] = 1;
      }
    }
  }
  // int cnow=0;
  // int rnow=0;
  // while(1){
  deq(&cnow, &rnow);
  //   v_flag[cnow][rnow] = 1;
  //   if(rnow-1>-1){
  //         if(v_flag[cnow][rnow-1]!=1){
  //           enq(cnow,rnow-1);
  //           v_flag[cnow][rnow-1]=1;
  //           depth[cnow][rnow-1] = depth[cnow][rnow] + 1;
  //         }
  //   }
  //   if(rnow+1<row){
  //         if(v_flag[cnow][rnow+1]!=1){
  //           //printf("右");
  //           enq(cnow,rnow+1);
  //           v_flag[cnow][rnow+1]=1;
  //           depth[cnow][rnow+1] = depth[cnow][rnow] + 1;
  //         }
  //   }
  //   if(cnow-1>-1){
  //         if(v_flag[cnow-1][rnow]!=1){
  //           //printf("上");
  //           enq(cnow-1,rnow);
  //           v_flag[cnow-1][rnow]=1;
  //           depth[cnow-1][rnow] = depth[cnow][rnow] + 1;
  //         }
  //   }
  //   if(cnow+1<column){
  //         if(v_flag[cnow+1][rnow]!=1){
  //           //printf("下");
  //           enq(cnow+1,rnow);
  //           v_flag[cnow+1][rnow]=1;
  //           depth[cnow+1][rnow] = depth[cnow][rnow] + 1;
  //         }
  //   }
  //   if(coltail == colhead&&rowtail == rowhead){
  //     break;
  //   }
  // }
  // int max = depth[0][0];
  // for(i = 0; i < column; i++){
  //   for(j = 0; j < row; j++){
  //     if(depth[i][j]>max){
  //       max = depth[i][j];
  //     }
  //   }
  // }
  //printf("%d", max);
  return 0;
}

int enq( int n, int o ) {
  if( 10000 <= colhead  ) return -1;
  if( 10000 <= rowhead  ) return -1;
  coltail++;
  rowtail++;
  col_queue[coltail] = n;
  row_queue[rowtail] = o;
  return 0;
}

int deq( int *n , int *o) {
  if( colhead == coltail ) return -1;
  if( rowhead == rowtail ) return -1;
    *n = col_queue[colhead++];
    *o = row_queue[rowhead++];
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:23:9: error: implicit declaration of function 'enq' [-Wimplicit-function-declaration]
   23 |         enq(j,i);
      |         ^~~
main.c:31:3: error: implicit declaration of function 'deq' [-Wimplicit-function-declaration]
   31 |   deq(&cnow, &rnow);
      |   ^~~
main.c:31:8: error: 'cnow' undeclared (first use in this function)
   31 |   deq(&cnow, &rnow);
      |        ^~~~
main.c:31:8: note: each undeclared identifier is reported only once for each function it appears in
main.c:31:15: error: 'rnow' undeclared (first use in this function); did you mean 'row'?
   31 |   deq(&cnow, &rnow);
      |               ^~~~
      |               row
Language: C

#include<stdio.h>
#include<stdlib.h>
int colhead=0;
int coltail=0;
int rowhead=0;
int rowtail=0;
int col_queue[10000];
int row_queue[10000];
int depth[10000][10000] = {};

int main(void){
  int column;
  int row;
  scanf("%d %d", &column, &row);
  char matrix[column][row];
  int v_flag[column][row];
  int i = 0;
  int j = 0;
  for(i = 0; i < row; i++ ){
    for(j = 0; j < column; j++ ){
      scanf("%s", &matrix[j][i]);
      if(matrix[j][i] == '#'){
        enq(j,i);
        v_flag[j][i] = 1;
      }
    }
  }
  // int cnow=0;
  // int rnow=0;
  // while(1){
  //   deq(&cnow, &rnow);
  //   v_flag[cnow][rnow] = 1;
  //   if(rnow-1>-1){
  //         if(v_flag[cnow][rnow-1]!=1){
  //           enq(cnow,rnow-1);
  //           v_flag[cnow][rnow-1]=1;
  //           depth[cnow][rnow-1] = depth[cnow][rnow] + 1;
  //         }
  //   }
  //   if(rnow+1<row){
  //         if(v_flag[cnow][rnow+1]!=1){
  //           //printf("右");
  //           enq(cnow,rnow+1);
  //           v_flag[cnow][rnow+1]=1;
  //           depth[cnow][rnow+1] = depth[cnow][rnow] + 1;
  //         }
  //   }
  //   if(cnow-1>-1){
  //         if(v_flag[cnow-1][rnow]!=1){
  //           //printf("上");
  //           enq(cnow-1,rnow);
  //           v_flag[cnow-1][rnow]=1;
  //           depth[cnow-1][rnow] = depth[cnow][rnow] + 1;
  //         }
  //   }
  //   if(cnow+1<column){
  //         if(v_flag[cnow+1][rnow]!=1){
  //           //printf("下");
  //           enq(cnow+1,rnow);
  //           v_flag[cnow+1][rnow]=1;
  //           depth[cnow+1][rnow] = depth[cnow][rnow] + 1;
  //         }
  //   }
  //   if(coltail == colhead&&rowtail == rowhead){
  //     break;
  //   }
  // }
  // int max = depth[0][0];
  // for(i = 0; i < column; i++){
  //   for(j = 0; j < row; j++){
  //     if(depth[i][j]>max){
  //       max = depth[i][j];
  //     }
  //   }
  // }
  printf("%d", max);
  return 0;
}

int enq( int n, int o ) {
  if( 10000 <= colhead  ) return -1;
  if( 10000 <= rowhead  ) return -1;
    col_queue[coltail++] = n;
    row_queue[rowtail++] = o;
    return 0;
}

int deq( int *n , int *o) {
  if( colhead == coltail ) return -1;
  if( rowhead == rowtail ) return -1;
    *n = col_queue[colhead++];
    *o = row_queue[rowhead++];
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:23:9: error: implicit declaration of function 'enq' [-Wimplicit-function-declaration]
   23 |         enq(j,i);
      |         ^~~
main.c:76:16: error: 'max' undeclared (first use in this function)
   76 |   printf("%d", max);
      |                ^~~
main.c:76:16: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
#include<stdlib.h>
int colhead=0;
int coltail=0;
int rowhead=0;
int rowtail=0;
int col_queue[10000];
int row_queue[10000];
int depth[10000][10000] = {};

int main(void){
  int column;
  int row;
  scanf("%d %d", &column, &row);
  char matrix[column][row];
  int v_flag[column][row];
  int i = 0;
  int j = 0;
  for(i = 0; i < row; i++ ){
    for(j = 0; j < column; j++ ){
      scanf("%s", &matrix[j][i]);
      if(matrix[j][i] == '#'){
        enq(j,i);
        v_flag[j][i] = 1;
      }
    }
  // }
  // int cnow=0;
  // int rnow=0;
  // while(1){
  //   deq(&cnow, &rnow);
  //   v_flag[cnow][rnow] = 1;
  //   if(rnow-1>-1){
  //         if(v_flag[cnow][rnow-1]!=1){
  //           enq(cnow,rnow-1);
  //           v_flag[cnow][rnow-1]=1;
  //           depth[cnow][rnow-1] = depth[cnow][rnow] + 1;
  //         }
  //   }
  //   if(rnow+1<row){
  //         if(v_flag[cnow][rnow+1]!=1){
  //           //printf("右");
  //           enq(cnow,rnow+1);
  //           v_flag[cnow][rnow+1]=1;
  //           depth[cnow][rnow+1] = depth[cnow][rnow] + 1;
  //         }
  //   }
  //   if(cnow-1>-1){
  //         if(v_flag[cnow-1][rnow]!=1){
  //           //printf("上");
  //           enq(cnow-1,rnow);
  //           v_flag[cnow-1][rnow]=1;
  //           depth[cnow-1][rnow] = depth[cnow][rnow] + 1;
  //         }
  //   }
  //   if(cnow+1<column){
  //         if(v_flag[cnow+1][rnow]!=1){
  //           //printf("下");
  //           enq(cnow+1,rnow);
  //           v_flag[cnow+1][rnow]=1;
  //           depth[cnow+1][rnow] = depth[cnow][rnow] + 1;
  //         }
  //   }
  //   if(coltail == colhead&&rowtail == rowhead){
  //     break;
  //   }
  // }
  // int max = depth[0][0];
  // for(i = 0; i < column; i++){
  //   for(j = 0; j < row; j++){
  //     if(depth[i][j]>max){
  //       max = depth[i][j];
  //     }
  //   }
  // }
  printf("%d", max);
  return 0;
}

int enq( int n, int o ) {
  if( 10000 <= colhead  ) return -1;
  if( 10000 <= rowhead  ) return -1;
    col_queue[coltail++] = n;
    row_queue[rowtail++] = o;
    return 0;
}

int deq( int *n , int *o) {
  if( colhead == coltail ) return -1;
  if( rowhead == rowtail ) return -1;
    *n = col_queue[colhead++];
    *o = row_queue[rowhead++];
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:23:9: error: implicit declaration of function 'enq' [-Wimplicit-function-declaration]
   23 |         enq(j,i);
      |         ^~~
main.c:76:16: error: 'max' undeclared (first use in this function)
   76 |   printf("%d", max);
      |                ^~~
main.c:76:16: note: each undeclared identifier is reported only once for each function it appears in
main.c:94:1: error: expected declaration or statement at end of input
   94 | }
      | ^
Language: C

#include<stdio.h>
#include<stdlib.h>
int head=0;
int tail=0;
int queue[10000000];
int depth[10000000] = {};

int main(void){
  int column;
  int row;
  scanf("%d %d", &column, &row);
  char matrix[column*row];
  int v_flag[column*row];
  int i = 0;
  int j = 0;
  for(i = 0; i < row; i++ ){
    for(j = 0; j <column; j++ ){
      scanf("%s", &matrix[i+j*row]);
      //printf("%d",i+j*row);
      if(matrix[i+j*row] == '#'){
        enq(i+j*row);
        v_flag[i+j*row] = 1;
      }
    }
  }
  int now=0;
  while(1){
    deq(&now);
    v_flag[now] = 1;
    //printf("\n今%d", now);
    //printf("\n%dから%d", head,tail);
    if(now-1>-1&&(now-1)%row!=row-1){
          if(v_flag[now-1]!=1){
            //printf("左");
            enq(now-1);
            v_flag[now-1]=1;
            depth[now-1] = depth[now] + 1;
          }
    }
    if(now+1<n&&(now+1)%row!=0){
          if(v_flag[now+1]!=1){
            //printf("右");
            enq(now+1);
            v_flag[now+1]=1;
            depth[now+1] = depth[now] + 1;
          }
    }
    if(now-row>-1){
          if(v_flag[now-row]!=1){
            //printf("上");
            enq(now-row);
            v_flag[now-row]=1;
            depth[now-row] = depth[now] + 1;
          }
    }
    if(now+row<n){
          if(v_flag[now+row]!=1){
            //printf("下");
            enq(now+row);
            v_flag[now+row]=1;
            depth[now+row] = depth[now] + 1;
          }
    }
    if(tail == head){
      break;
    }
  }
  int max = depth[0];
  for(i = 0; i < n; i++){
    if(depth[i]<max){
      max = depth[i];
    }
  }
  printf("%d", max-1);
  return 0;
}

int enq( int n ) {
    queue[tail++] = n;
    return 0;
}

int deq( int *n ) {
    *n = queue[head++];
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:21:9: error: implicit declaration of function 'enq' [-Wimplicit-function-declaration]
   21 |         enq(i+j*row);
      |         ^~~
main.c:28:5: error: implicit declaration of function 'deq' [-Wimplicit-function-declaration]
   28 |     deq(&now);
      |     ^~~
main.c:40:14: error: 'n' undeclared (first use in this function)
   40 |     if(now+1<n&&(now+1)%row!=0){
      |              ^
main.c:40:14: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
#define MOD 1000000007

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<class T> inline T gcd(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<class T> inline T lcm(T a,T b){return a*b/gcd(a,b);}

const int INF=1e9;
const double eps=0.0000000001;

int h,w;
char a[1010][1010];
int dx[]={-1,0,0,1};
int dy[]={0,1,-1,0};

int main(){
  int cnt=0;
  int kuro=0;
  pair<int,int> c;
  
  cin >> h >> w;
  FOR(i,h){
    FOR(j,w){
      cin >> a[i][j];
  }
  int ans=0,sum;
  
  bool b[1010][1010]={0};
  queue<pair<int,int>> v;
  int x;
  while(1){
    x=0;
    FOR(i,h){
      FOR(j,w){
        if(a[i][j]=='#' && !b[i][j]){
          v.push(make_pair(i,j));
          x++;
          b[i][j]=1;
        }else{
        }
      }
    }
    if(x==0)break;

    FOR(i,x){
      FOR(j,4){
        if(a[v.front().first+dx[j]][v.front().second+dy[j]]=='.' && v.front().first+dx[j]>=0 && v.front().second+dy[j]>=0 && v.front().first+dx[j]<h && v.front().second+dy[j]<w){
          a[v.front().first+dx[j]][v.front().second+dy[j]]='#';
        }
      }
      v.pop();
    }

    
    cnt++;
    
  }
  cout << cnt-1 << endl;
  
}


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

#include<stdio.h>
#include<stdlib.h>
int colhead=0;
int coltail=0;
int rowhead=0;
int rowtail=0;
int col_queue[100000];
int row_queue[100000];
int depth[100000][100000] = {};

int main(void){
  int column;
  int row;
  scanf("%d %d", &column, &row);
  char matrix[column][row];
  int v_flag[column][row];
  int i = 0;
  int j = 0;
  for(i = 0; i < row; i++ ){
    for(j = 0; j < column; j++ ){
      scanf("%s", &matrix[j][i]);
      if(matrix[i][j] == '#'){
        enq(i,j);
        v_flag[i][j] = 1;
      }
    }
  }
  for(i = 0; i < column; i++ ){
    for(j = 0; j < row; j++ ){
      printf("%c", matrix[i][j]);
    }
  }
  int cnow=0;
  int rnow=0;
  while(1){
    deq(&cnow, &rnow);
    v_flag[cnow][rnow] = 1;
    if(rnow-1>-1){
          if(v_flag[cnow][rnow-1]!=1){
            enq(cnow,rnow-1);
            v_flag[cnow][rnow-1]=1;
            depth[cnow][rnow-1] = depth[cnow][rnow] + 1;
          }
    }
    if(rnow+1<row){
          if(v_flag[cnow][rnow+1]!=1){
            //printf("右");
            enq(cnow,rnow+1);
            v_flag[cnow][rnow+1]=1;
            depth[cnow][rnow+1] = depth[cnow][rnow] + 1;
          }
    }
    if(cnow-1>-1){
          if(v_flag[cnow-1][rnow]!=1){
            //printf("上");
            enq(cnow-1,rnow);
            v_flag[cnow-1][rnow]=1;
            depth[cnow-1][rnow] = depth[cnow][rnow] + 1;
          }
    }
    if(cnow+1<column){
          if(v_flag[cnow+1][rnow]!=1){
            //printf("下");
            enq(cnow+1,rnow);
            v_flag[cnow+1][rnow]=1;
            depth[cnow+1][rnow] = depth[cnow][rnow] + 1;
          }
    }
    if(coltail == colhead&&rowtail == rowhead){
      break;
    }
  }
  int max = depth[0][0];
  for(i = 0; i < column; i++){
    for(j = 0; j < row; j++){
      if(depth[i][j]>max){
        max = depth[i][j];
      }
    }
  }
  printf("%d", max);
  return 0;
}

int enq( int n, int o ) {
    col_queue[coltail++] = n;
    row_queue[rowtail++] = o;
    return 0;
}

int deq( int *n , int *o) {
    *n = col_queue[colhead++];
    *o = row_queue[rowhead++];
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:23:9: error: implicit declaration of function 'enq' [-Wimplicit-function-declaration]
   23 |         enq(i,j);
      |         ^~~
main.c:36:5: error: implicit declaration of function 'deq' [-Wimplicit-function-declaration]
   36 |     deq(&cnow, &rnow);
      |     ^~~
Language: C++

from sys import stdin
H, W = stdin.readline().rstrip().split()
A = []
for i in range(int(H)): A.append(list(stdin.readline().rstrip()))
count = 0 # the number of operations 
white = "."
black = "#"
nWhite = 0

from collections import deque
queue = deque()

d = [[1000 for x in range(int(W))] for x in range(int(H))]

vx = [1, 0, -1, 0]
vy = [0, 1, 0, -1]
def bfs():
    count = 0
    for i in range(int(H)):
        for j in range(int(W)):
            if A[i][j] == black:
                queue.append([i,j]) 
                d[i][j] = 0
    while len(queue) > 0:
        temp = queue.popleft()
        x = temp[0]
        y = temp[1]
        for k in range(4):
            if x+vx[k] >= 0 and x+vx[k] < 6 and y+vy[k] >= 0 and y+vy[k] < 6 and A[x+vx[k]][y+vy[k]] == white:
                A[x+vx[k]][y+vy[k]] = black
                queue.append([x+vx[k], y+vy[k]])
                d[x+vx[k]][y+vy[k]] = d[x][y] + 1
                count = max(count, d[x+vx[k]][y+vy[k]])
    return count
print("Ans: " + str(bfs()))
print(d)

Compiler output:
a.cc:5:11: error: stray '#' in program
    5 | count = 0 # the number of operations
      |           ^
a.cc:1:1: error: 'from' does not name a type
    1 | from sys import stdin
      | ^~~~