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

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

int main(){
	cin >> h >> w;
	vector<vector <char> > a(h)(w);
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin >> a.at(i)(j);
		}
	}

	int count=1,ans=0;
	while(count!=0){
	count=0;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(a.at(i)(j)=='.')
				count++;
			if(a.at(i)(j)=='#'){
				if(i-1>=0)
					a.at(i-1)(j)=='#';
				if(j-1>=0)
					a.at(i)(j-1)=='#';
				if(i+1<h)
					a.at(i+1)(j)=='#';
				if(j+1<w)
					a.at(i)(j+1)=='#';
			}

			}
		}
	ans++;
	}
	cout <<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:16: error: 'h' was not declared in this scope
    5 |         cin >> h >> w;
      |                ^
a.cc:5:21: error: 'w' was not declared in this scope
    5 |         cin >> h >> w;
      |                     ^
a.cc:6:36: error: expected ',' or ';' before '(' token
    6 |         vector<vector <char> > a(h)(w);
      |                                    ^
a.cc:9:39: error: no match for call to '(__gnu_cxx::__alloc_traits<std::allocator<std::vector<char> >, std::vector<char> >::value_type {aka std::vector<char>}) (int&)'
    9 |                         cin >> a.at(i)(j);
      |                                ~~~~~~~^~~
a.cc:18:35: error: no match for call to '(__gnu_cxx::__alloc_traits<std::allocator<std::vector<char> >, std::vector<char> >::value_type {aka std::vector<char>}) (int&)'
   18 |                         if(a.at(i)(j)=='.')
      |                            ~~~~~~~^~~
a.cc:20:35: error: no match for call to '(__gnu_cxx::__alloc_traits<std::allocator<std::vector<char> >, std::vector<char> >::value_type {aka std::vector<char>}) (int&)'
   20 |                         if(a.at(i)(j)=='#'){
      |                            ~~~~~~~^~~
a.cc:22:50: error: no match for call to '(__gnu_cxx::__alloc_traits<std::allocator<std::vector<char> >, std::vector<char> >::value_type {aka std::vector<char>}) (int&)'
   22 |                                         a.at(i-1)(j)=='#';
      |                                         ~~~~~~~~~^~~
a.cc:24:48: error: no match for call to '(__gnu_cxx::__alloc_traits<std::allocator<std::vector<char> >, std::vector<char> >::value_type {aka std::vector<char>}) (int)'
   24 |                                         a.at(i)(j-1)=='#';
      |                                         ~~~~~~~^~~~~
a.cc:26:50: error: no match for call to '(__gnu_cxx::__alloc_traits<std::allocator<std::vector<char> >, std::vector<char> >::value_type {aka std::vector<char>}) (int&)'
   26 |                                         a.at(i+1)(j)=='#';
      |                                         ~~~~~~~~~^~~
a.cc:28:48: error: no match for call to '(__gnu_cxx::__alloc_traits<std::allocator<std::vector<char> >, std::vector<char> >::value_type {aka std::vector<char>}) (int)'
   28 |                                         a.at(i)(j+1)=='#';
      |                                         ~~~~~~~^~~~~
Language: C++

#include<iostream>
using namespace std;

void number(A,H,W){
    int l=0;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if(A[i][j]=="#"){
                l++;
            }
        }
    }
    cout<<l<<endl;
    return 0;
}

void Darker(A,H,W){
    while(1){
        if(number(A,H,W)==H*W)break;
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                if(A[i-1][j][k]=="#"){
                    A[i][j][k+1]="#";
                }else if(A[i+1][j][k]=="#"){
                    A[i][j][k+1]="#";
                }else if(A[i][j-1][k]=="#"){
                    A[i][j][k+1]="#";
                }else if(A[i][j-1][k]=="#"){
                    A[i][j][k+1]="#";
                }else{
                    A[i][j][k]=".";
                }
            }
        k++;
        }
    }
    cout << k <<endl;
    return 0;
}

int main(){
    int H,W,A[1000][1000][2000],k=0;
    cin >> H, W;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            cin>>A[i][j][0];
        }
    }
    Dacker(A,H,W)
    return 0;
}

Compiler output:
a.cc:4:6: error: variable or field 'number' declared void
    4 | void number(A,H,W){
      |      ^~~~~~
a.cc:4:13: error: 'A' was not declared in this scope
    4 | void number(A,H,W){
      |             ^
a.cc:4:15: error: 'H' was not declared in this scope
    4 | void number(A,H,W){
      |               ^
a.cc:4:17: error: 'W' was not declared in this scope
    4 | void number(A,H,W){
      |                 ^
a.cc:17:6: error: variable or field 'Darker' declared void
   17 | void Darker(A,H,W){
      |      ^~~~~~
a.cc:17:13: error: 'A' was not declared in this scope
   17 | void Darker(A,H,W){
      |             ^
a.cc:17:15: error: 'H' was not declared in this scope
   17 | void Darker(A,H,W){
      |               ^
a.cc:17:17: error: 'W' was not declared in this scope
   17 | void Darker(A,H,W){
      |                 ^
a.cc: In function 'int main()':
a.cc:49:5: error: 'Dacker' was not declared in this scope
   49 |     Dacker(A,H,W)
      |     ^~~~~~
Language: C++

def step(a,h,w)
  blacks = []
  changes = []
  ba = a
  h.times do |n|
    h.times do |nn|
      if a["#{n}#{nn}"] == "#"
        blacks.push("#{n}#{nn}")
      end
    end
  end
  blacks.size.times do |n|
    changes.push(blacks[n].to_i-10.to_s,blacks[n].to_i-1.to_s,blacks[n]+10.to_s,blacks[n]+1.to_s)
  end
  changes.size.times do |n| 
    if a[changes[n]] != nil
      ba[changes[n]] = "#"
    end
  end
  return ba
end
def turencheker(a,h,w)
  result = true
  h.times do |n|
    w.times do |nn|
      if a["#{n}#{nn}"] == "#"
      else
        result = false
      end
    end
  end
  return result
end
a = {}
h,w = gets.chomp.split(" ").map(&to_i)
h.times do |n|
  clm = gets.chmp.split(" ").map(&to_i)
  w.times do |nn|
    i = nn-1
    a["#{n}#{nn}"]=clm[i]
  end
end
retulst = 0
until turencheker(a,h,w)
  step(a,h,w)
  result += 1
end
puts result


Compiler output:
a.cc:1:1: error: 'def' does not name a type
    1 | def step(a,h,w)
      | ^~~
a.cc:35:1: error: 'h' does not name a type
   35 | h,w = gets.chomp.split(" ").map(&to_i)
      | ^
Language: C++

#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
//#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=0;i<b;i++)
#define REP(i,a,b) for(int i=0;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
//#define inf (1ll<<60)
#define Yes(f) cout <<(f?"Yes":"No")<<endl//fが真の場合Yesを出力、偽の場合Noを出力
#define yes(f) cout <<(f?"yes":"no")<<endl
#define YES(f) cout <<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v),greater<int>())

using namespace std;

const　int inf=1e9;
const int mod=1e9+7;

//num今の場所の数字
int ans;
void change(int x, int y,int h,int w,int num){
    int hen=0;
    if(x<0||x>=w||y<0||y>=h)
    {
        //hen++;
        return;
    }

    field[y][x]=min(field[y][x],num);

    change(x-1,y,h,w,num+1);
    change(x+1,y,h,w,num+1);
    change(x,y-1,h,w,num+1);
    change(x,y+1,h,w,num+1);
/*
    change[y][x-1];
    change[y][x+1];
    change[y-1][x];
    change[y+1][x];
*/
}


//wをｘ座標として考える
int main(){
    int h,w;
    cin >> h >> w;
    vvi field(h*w,inf);
    int black=0;
    char a;
    int x,y;
    vp black_place(h*w);
    rep(i,h)
    {
        rep(j,w)
        {
            cin >> a;
            if(a=='#'){
                field[i][j]=1;
                black_place[black].fi=j;
                black_place[black].se=i;
                black++;
            }
        }
    }

    //処理
    rep(i,black)
    {
        change(black_place[i].fi,black_place[i].se,h,w,2);
    }

    cout << ans << endl;
}

Compiler output:
a.cc:27:1: error: extended character 　 is not valid in an identifier
   27 | const　int inf=1e9;
      | ^
a.cc:27:1: error: 'const\U00003000int' does not name a type
   27 | const　int inf=1e9;
      | ^~~~~~~~~~
a.cc: In function 'void change(int, int, int, int, int)':
a.cc:40:5: error: 'field' was not declared in this scope
   40 |     field[y][x]=min(field[y][x],num);
      |     ^~~~~
a.cc: In function 'int main()':
a.cc:59:19: error: 'inf' was not declared in this scope; did you mean 'ynf'?
   59 |     vvi field(h*w,inf);
      |                   ^~~
      |                   ynf
Language: C++

#include<stdio.h>
#include<string.h>
long long n,m,a[1009][1009]={0};
int min(int x,int y)
{
	if(x>=y)
	return y;
	else return x;
}
int sx(int x,int y)
{
	if(a[x][y]==-1)return 100000;
	else
	if(x>0&&y>0&&x<=n&&y<=m){
		if(a[x+1][y]!=1&&a[x][y+1]!=1&&a[x-1][y]!=1&&a[x][y-1]!=1)
	{
		a[x][y]=-1;
		return min(min(sx(x+1,y),sx(x,y+1)),min(sx(x-1,y),sx(x,y-1)))+1;
	}
	    else return 1;
	}
	else return 100000;
}
int main(){
	long long i,l,p,x,y;
	char c[1006],d;
	scanf("%lld%lld",&n,&m);
	getchar();
	for(i=1;i<=n;i++){
		gets(c);
		for(l=1;l<=m;l++)
		{
			if(c[l-1]=='#')a[i][l]=1;
			else a[i][l]=0;
		 } 
	}
	p=0;
	for(i=1;i<=n;i++)
	{
		for(l=1;l<=m;l++)
		{
			if(!a[i][l]){
				if(sx(i,l)>p)
				{for(int e=1;e<=n;e++)
				for(int r=1;r<=m;r++)
				{
					if(a[e][r]==-1)a[e][r]=0;
				}
					p=sx(i,l);
				}
				
				for(int e=1;e<=n;e++)
				for(int r=1;r<=m;r++)
				{
					if(a[e][r]==-1)a[e][r]=0;
				}
			}
			
		}
	}
	printf("%lld",p);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:17: error: 'gets' was not declared in this scope; did you mean 'getw'?
   30 |                 gets(c);
      |                 ^~~~
      |                 getw
Language: Java

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int H = Integer.parseInt(sc.next());
        int W = Integer.parseInt(sc.next());
        char[] testchars = new char[W];
        List<int[]> blacks = new ArrayList<>();
        List<int[]> whites = new ArrayList<>();
        int counts = 0;
        String test = sc.nextLine();
        for (int i = 0; i<H; i++){
            test = sc.nextLine();
            testchars = test.toCharArray();
//            System.out.println(test);
            for (int j = 0; j<W; j++){
                if (testchars[j] == '#') {
                    blacks.add(new int[]{i, j});
//                    System.out.println("blk");
                } else {
                    whites.add(new int[] {i,j});
//                    System.out.println("wht");
                    counts++;
                }
            }
        }
        int[] dist = new int[counts];
        for (int i=0;i<dist.length;i++)
            dist[i] = Integer.MAX_VALUE;
        int idx = 0;
        for (int[] w: whites) {
            for (int[] b: blacks) {
                if (dist[idx] > Math.abs(w[0]-b[0])+Math.abs(w[1]-b[1])) {
                    dist[idx] = Math.abs(w[0]-b[0])+Math.abs(w[1]-b[1]);
                }
            }
            idx++;
        }
        Arrays.sort(dist);
        System.out.println(dist[counts-1]);
    }
}

Compiler output:
Main.java:3: error: cannot find symbol
        Scanner sc = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class Main
Main.java:3: error: cannot find symbol
        Scanner sc = new Scanner(System.in);
                         ^
  symbol:   class Scanner
  location: class Main
Main.java:7: error: cannot find symbol
        List<int[]> blacks = new ArrayList<>();
        ^
  symbol:   class List
  location: class Main
Main.java:7: error: cannot find symbol
        List<int[]> blacks = new ArrayList<>();
                                 ^
  symbol:   class ArrayList
  location: class Main
Main.java:8: error: cannot find symbol
        List<int[]> whites = new ArrayList<>();
        ^
  symbol:   class List
  location: class Main
Main.java:8: error: cannot find symbol
        List<int[]> whites = new ArrayList<>();
                                 ^
  symbol:   class ArrayList
  location: class Main
Main.java:38: error: cannot find symbol
        Arrays.sort(dist);
        ^
  symbol:   variable Arrays
  location: class Main
7 errors
Language: C

#include <stdio.h>
#include <math.h
#define N 100

int main(void){
    int h, w;
    int i,j,k,l=0;
    char a[N][N];
    int x[N], y[N];
    int dis;
    int min[N][N];
    int max=0;

    scanf("%d",&h);
    scanf("%d",&w);
    //printf("%d %d\n",h,w);
    for(i=0; i<h; i++){
        //printf("%d %d\n",i,j);
        for(j=0; j<w; j++){
            //printf("%d, %d,\n",i,j);
            //printf("%d\n",j);
            scanf("%*c%c",&a[i][j]);
            if(a[i][j] == '#'){
                x[l] = j;
                y[l] = i;
                l++;
            }
        }
        //printf("\n");
    }

    for(i=0; i<h; i++){
        for(j=0; j<w; j++){
            min[i][j] = 2000;
            for(k=0; k<l; k++){
                dis = fabs(x[k] - j) + fabs(y[k] - i);
                if(dis < min[i][j]){
                    min[i][j] = dis;
                }
            }    
        }
    }

    for(i=0; i<h; i++){
        for(j=0; j<w; j++){
            if(max < min[i][j]){
                max = min[i][j];
            }    
        }
    }

    printf("%d",max);
    
    return 0;
}

Compiler output:
main.c:2:17: error: missing terminating > character
    2 | #include <math.h
      |                 ^
Language: C++

v#include<bits/stdc++.h>
using namespace std;
int r,c,step,n;
struct Node
{
	int x,y;
};
Node a[1000001];
string s;
int main()
{
	cin >> r >> c;
	for(int i = 0 ; i < r ; i ++)
	{
		cin >> s;
		string :: size_type pos;
		string flag;
		flag = '#';
		pos = 0;
		while((pos = s.find(flag,pos)) != string::npos)
		{
			pos = s.find(flag,pos);
			a[n].x = i;a[n].y = pos;
			n ++;
		  	pos ++;
		}
	}
	for(int i = 0 ; i < r ; i ++)
		for(int j = 0 ; j < c ; j ++)
		{
			int temp = r + c - 2; 
			for(int k = 0 ; k < n ; k ++)
			{
				int m = abs(a[k].x - i) + abs(a[k].y - j);
				temp = min(temp,m);
				
			}
			step = max(step,temp);
		}
			
	cout << step << endl;
	return 0;
 } 

Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | v#include<bits/stdc++.h>
      |  ^
a.cc:1:1: error: 'v' does not name a type
    1 | v#include<bits/stdc++.h>
      | ^
a.cc:9:1: error: 'string' does not name a type
    9 | string s;
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:12:9: error: 'cin' was not declared in this scope
   12 |         cin >> r >> c;
      |         ^~~
a.cc:15:24: error: 's' was not declared in this scope
   15 |                 cin >> s;
      |                        ^
a.cc:16:17: error: 'string' has not been declared
   16 |                 string :: size_type pos;
      |                 ^~~~~~
a.cc:17:17: error: 'string' was not declared in this scope
   17 |                 string flag;
      |                 ^~~~~~
a.cc:18:17: error: 'flag' was not declared in this scope
   18 |                 flag = '#';
      |                 ^~~~
a.cc:19:17: error: 'pos' was not declared in this scope
   19 |                 pos = 0;
      |                 ^~~
a.cc:20:51: error: 'string' is not a class, namespace, or enumeration
   20 |                 while((pos = s.find(flag,pos)) != string::npos)
      |                                                   ^~~~~~
a.cc:34:41: error: 'abs' was not declared in this scope
   34 |                                 int m = abs(a[k].x - i) + abs(a[k].y - j);
      |                                         ^~~
a.cc:35:40: error: 'min' was not declared in this scope; did you mean 'main'?
   35 |                                 temp = min(temp,m);
      |                                        ^~~
      |                                        main
a.cc:38:32: error: 'max' was not declared in this scope
   38 |                         step = max(step,temp);
      |                                ^~~
a.cc:41:9: error: 'cout' was not declared in this scope
   41 |         cout << step << endl;
      |         ^~~~
a.cc:41:25: error: 'endl' was not declared in this scope
   41 |         cout << step << endl;
      |                         ^~~~
Language: C++

#include <bits/stdc++.h>
#include <numeric>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
    int h,w,c=0;
    cin >> h >> w;
    vector<int> a(h*w);
    for(int i=0;i<h*w;i++){
            cin >> a[i];
    }
    for(int i=0;i<h*w;i++){
        if(a[i]=='#'){
            a[i-1]='#';
            a[i+1]='#';
            a[i-w]='#';
            a[i+w]='#';
            c++;
        }
    }
    cout << C << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:13: error: 'C' was not declared in this scope
   24 |     cout << C << endl;
      |             ^
Language: C++

#include<iostream>
#include <string>
#include <cstdlib> //絶対値利用のため
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
#define fr(i,n) for(int i=0;i<n;i++)
#define ifr(i,n) for(int i=n-1;i>=0;i--)

int INF = INT_MAX / 2;

int main() {
	int h, w;
	cin >> h >> w;
	vector<vector<char>> a(h, vector<char>(w));
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> a.at(i).at(j);
		}
	}
	int dis_all  = -INF;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (a.at(i).at(j) == '.') {
				int dis = INF;
				for (int k = 0; k < h; k++) {
					for (int l = 0; l < w; l++) {
						if (a.at(k).at(l) == '#') dis = min(abs(k - i) + abs(l - j), dis);
					}
				}
				dis_all = max(dis_all, dis);
			}
			
		}
	}

	cout << dis_all << endl;


	return 0;
}

Compiler output:
a.cc:11:11: error: 'INT_MAX' was not declared in this scope
   11 | int INF = INT_MAX / 2;
      |           ^~~~~~~
a.cc:6:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    5 | #include <vector>
  +++ |+#include <climits>
    6 | using namespace std;
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <tuple>
#include <queue>
#include <set>
#include <math.h>
#include <array>
#include <list>
#include <set>
#define MOD 1000000007
#define INF 1000000000
using namespace std;
typedef long long ll;
typedef tuple<ll,int,int> tup;
typedef vector<int> vi;
typedef pair<int,int> pii;
int H,W;
vector<int> b;
vector<int> ans;
bool change=false;
bool used[1005][1005];
string board[1005];
int ope=0;
int dx[]={-1,0,1,0};
int dy[]={0,-1,0,1};
int blacknum=0;
queue<pair<int,int> > qp;
bool outrange(int y, int x)
{
  if(y<0 || y>=H || x<0 || x>=W || used[y][x] || board[y][x]=='#') return true;
  else return false;
}

bool outrangeused(int y, int x)
{
  if(y<0 || y>=H || x<0 || x>=W) return true;
  else return false;
}
int main(int argc,char const* argv[])
{
  memset(used,false,sizeof(used));
  cin >> H >> W;
  queue<pair<int,int> > qp;
  for (int i = 0; i < H; ++i)
    {
      cin >> board[i];
      for (int j = 0; j < W; ++j)
	{
	  if(board[i][j]=='#')
	    {
	      qp.push(pii(i,j));
	      blacknum++;
	    }
	}
    }
  queue<pair<int,int > > qp2;
  while(!qp.empty())
    {
      pii tmp=qp.front();
      qp.pop();
      int nowy=tmp.first;
      int nowx=tmp.second;
      used[nowy][nowx]=true;
      for (int k = 0; k < 4; ++k)
	{
	  int ny=nowy+dy[k];
	  int nx=nowx+dx[k];
	  if(!outrange(ny,nx))
	    {
	      qp2.push(pii(ny,nx));
	      board[ny][nx]='#';
	      used[ny][nx]=true;
	    }
	}	  
      //cout << qp.size() << ' ' << qp2.size() <<  endl;
      if(qp.size()==0)
	{
	  qp=qp2;
	  if(qp2.size()==0) break;
	  qp2=queue<pair<int,int> > ();
	  ope++;
	}
    }
  cout << ope << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:44:3: error: 'memset' was not declared in this scope
   44 |   memset(used,false,sizeof(used));
      |   ^~~~~~
a.cc:12:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   11 | #include <list>
  +++ |+#include <cstring>
   12 | #include <set>
Language: C++

#include <algorithm>
#include <cassert>
#include <cstring>
#include <iostream>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

int main() {
  int H, W;
  std::cin >> H >> W;
  std::bitset<1000 * 1000> base_map;
  for (int y = 0; y < H; y++) {
    std::string s;
    std::cin >> s;
    for (int x = 0; x < s.length(); x++) {
      if (s[x] == '#') base_map.set(y * W + x);
    }
  }
  int i;
  std::bitset<1000 * 1000> tmp_map = base_map;
  for (i = 0; base_map.count() != H * W; i++) {
    for (int y = 0; y < H; y++) {
      for (int x = 0; x < W; x++) {
        if (!base_map[y * W + x]) continue;
        if (y > 0) tmp_map[(y - 1) * W + (x + 0)] = 1;
        if (x > 0) tmp_map[(y + 0) * W + (x - 1)] = 1;
        if (y < H - 1) tmp_map[(y + 1) * W + (x + 0)] = 1;
        if (x < W - 1) tmp_map[(y + 0) * W + (x + 1)] = 1;
      }
    }
    base_map = tmp_map;
  }
  std::cout << i << std::endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:8: error: 'bitset' is not a member of 'std'
   15 |   std::bitset<1000 * 1000> base_map;
      |        ^~~~~~
a.cc:11:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>'
   10 | #include <vector>
  +++ |+#include <bitset>
   11 | 
a.cc:15:28: error: 'base_map' was not declared in this scope
   15 |   std::bitset<1000 * 1000> base_map;
      |                            ^~~~~~~~
a.cc:24:8: error: 'bitset' is not a member of 'std'
   24 |   std::bitset<1000 * 1000> tmp_map = base_map;
      |        ^~~~~~
a.cc:24:8: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>'
a.cc:24:28: error: 'tmp_map' was not declared in this scope
   24 |   std::bitset<1000 * 1000> tmp_map = base_map;
      |                            ^~~~~~~
Language: C++

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

bool is_change(int h, int w, int H, int W, string A);

int main() {
    int H, W; cin >> H >> W;
    string A, A_copy, a_tmp, ans(H*W, '#');
    for (int i = 0; i < H; i++) {
        cin >> a_tmp;
        A += a_tmp;
    }
    int count = 0, ;
    while (A != ans) {
        A_copy = A;
        for (int h = 0; h < H; h++) {
            for (int w = 0; w < W; w++) {
                if (A[h*W+w] == '#') {}
                else {
                    if (is_change(h, w, H, W, A_copy)) A.replace(h*W+w, 1, "#");
                }
            }
        }
        count++;
    }
    cout << count << endl;
    return 0;
}

bool is_change(int h, int w, int H, int W, string A) {
    if (h == 0) {
        if (w == 0) {
            return A[(h+1)*W+w] == '#' || A[h*W+w+1] == '#';
        }
        else if (w == W-1) {
            return A[(h+1)*W+w] == '#' || A[h*W+w-1] == '#';
        }
        else {
            return A[(h+1)*W+w] == '#' || A[h*W+w-1] == '#' || A[h*W+w+1] == '#';
        }
    }
    else if (h == H-1) {
        if (w == 0) {
            return A[(h-1)*W+w] == '#' || A[h*W+w+1] == '#';
        }
        else if (w == W-1) {
            return A[(h-1)*W+w] == '#' || A[h*W+w-1] == '#';
        }
        else {
            return A[(h-1)*W+w] == '#' || A[h*W+w-1] == '#' || A[h*W+w+1] == '#';
        }
    }
    else {
        if (w == 0) {
            return A[(h-1)*W+w] == '#' || A[h*W+w+1] == '#' || A[(h+1)*W+w] == '#';
        }
        else if (w == W-1) {
            return A[(h-1)*W+w] == '#' || A[h*W+w-1] == '#' || A[(h+1)*W+w] == '#';
        }
        else {
            return A[(h-1)*W+w] == '#' || A[h*W+w-1] == '#' || A[h*W+w+1] == '#' || A[(h+1)*W+w] == '#';
        }
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:20: error: expected unqualified-id before ';' token
   14 |     int count = 0, ;
      |                    ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <cmath>

using namespace std;

typedef pair<int, int> P;
vector<P> b;
vector<P> w;

char c;

int main() {

    int H, W;
    cin >> H >> W;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cin >> c;
            if (c == '#') {
                b.push_back(make_pair(i, j));
            }
            else {
                w.push_back(make_pair(i, j));
            }
        }
    }


    if (b.empty()) {
        cout << 0 << '\n';
        return 0;
    }

    vector<int> mins;
    for (int i = 0;  i < w.size(); i++) {
        vector<int> dist;
        for (int j = 0; j < b.size(); j++) {
            dist.push_back(abs(w[i].first - b[j].first) + abs(w[i].second - b[j].second));
        }
        mins.push_back(*min_element(dist.begin(), dist.end()));
    }
    
    cout << *max_element(mins.begin(), mins.end()) << '\n';


}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:25: error: 'min_element' was not declared in this scope
   42 |         mins.push_back(*min_element(dist.begin(), dist.end()));
      |                         ^~~~~~~~~~~
a.cc:45:14: error: 'max_element' was not declared in this scope
   45 |     cout << *max_element(mins.begin(), mins.end()) << '\n';
      |              ^~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int>> gg = { {1,0},{-1,0},{0,1},{0,-1} };
int main() {
	int h, w;
	cin >> h >> w;
	vector<string> da(h);
	for (int i = 0;i < h;i++)
		cin >> da[i];
	vector<vector<bool>> ju(h+2, vector<bool>(w+2, false));
	for (int i = 0;i < h + 2;i++) {
		ju[i][0] = true;
		ju[i][w + 1] = true;
	}
	for (int i = 0;i < w + 2;i++) {
		ju[0][i] = true;
		ju[h + 1][i] = true;
	}
	vector < pair<int, int>> co(0);
	int hi = 0;
	for (int i = 0;i < h;i++) {
		for (int j = 0;j < w;j++) {
			if (da[i][j] == '#') {
				ju[i+1][j+1] = true;
				pair<int, int> x = { i+1,j+1 };
				co.push_back(x);
				hi++;
			}
		}
	}
    if(hi==h*w){
        cout << 0 <<endl;
        return 0;
    }
	int ans = 0,ne=0,ko=hi;
	hi = 0;
	while (hi != h * w) {
		ne = ko;
		ko = 0;
		for (int i = 0;i < ne;i++) {
			for (int j = 0;j < 4;j++) {
				if (!ju[co[hi].first + gg[j].first][co[hi].second + gg[j].second]) {
					ju[co[hi].first + gg[j].first][co[hi].second + gg[j].second] = true;
					pair<int, int> x={ co[hi].first + gg[j].first,co[hi].second + gg[j].second };
					co.push_back(x);
					ko++;
				}
			}
			hi++;
		}
		ans++;
		/*for (int i = 0;i < h+2;i++) {
			for (int j = 0;j < w+2;j++) {
				if (ju[i][j])
					cout << 1 << ' ';
				else
					cout << 0 << ' ';
			}
			cout << endl;
		}*/
	}
	cout << ans-1 << endl;


Compiler output:
a.cc: In function 'int main()':
a.cc:62:31: error: expected '}' at end of input
   62 |         cout << ans-1 << endl;
      |                               ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

import sys
import numpy as np

stdin = sys.stdin

ni = lambda: int(ns()) #int
na = lambda: list(map(int, stdin.readline().split())) #int,list
ns = lambda: stdin.readline().rstrip()  # str
h, w = na()
a = []
for i in range(h):
	a.append(list(ns()))
a=np.array(a)
b=np.array(np.where(a=="#")).T
w=np.array(np.where(a==".")).T

m_list=[]
for i in w:
	m=10000000
	for j in b:
		#print(abs(i-j).sum())
		m = min(abs(i-j).sum(),m)
	m_list.append(m)

print(max(m_list))


Compiler output:
a.cc:6:24: error: stray '#' in program
    6 | ni = lambda: int(ns()) #int
      |                        ^
a.cc:7:55: error: stray '#' in program
    7 | na = lambda: list(map(int, stdin.readline().split())) #int,list
      |                                                       ^
a.cc:8:41: error: stray '#' in program
    8 | ns = lambda: stdin.readline().rstrip()  # str
      |                                         ^
a.cc:21:18: error: invalid preprocessing directive #print
   21 |                 #print(abs(i-j).sum())
      |                  ^~~~~
a.cc:1:1: error: 'import' does not name a type
    1 | import sys
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

int main()
{
    cin >> H >> W;
    A.resize(H);
    rep (i, H)
    {
        cin >> A[i];
    }

    int res = 0;

    while (!AllBlack())
    {
        vector<string> copy = A;
        rep (y, H)
        {
            rep (x, H)
            {
                if (copy[y][x] == '#')
                {
                    for (int i = 0; i < 4; ++i)
                    {
                        if (!Over(y + dy[i], x + dx[i]))
                        {
                            A[y + dy[i]][x + dx[i]] = '#';
                        }
                    }
                }
            }
        }
        res++;
    }

    cout << res << "\n";

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:3:5: error: 'cin' was not declared in this scope
    3 |     cin >> H >> W;
      |     ^~~
a.cc:3:12: error: 'H' was not declared in this scope
    3 |     cin >> H >> W;
      |            ^
a.cc:3:17: error: 'W' was not declared in this scope
    3 |     cin >> H >> W;
      |                 ^
a.cc:4:5: error: 'A' was not declared in this scope
    4 |     A.resize(H);
      |     ^
a.cc:5:10: error: 'i' was not declared in this scope
    5 |     rep (i, H)
      |          ^
a.cc:5:5: error: 'rep' was not declared in this scope
    5 |     rep (i, H)
      |     ^~~
a.cc:12:13: error: 'AllBlack' was not declared in this scope
   12 |     while (!AllBlack())
      |             ^~~~~~~~
a.cc:14:9: error: 'vector' was not declared in this scope
   14 |         vector<string> copy = A;
      |         ^~~~~~
a.cc:14:16: error: 'string' was not declared in this scope
   14 |         vector<string> copy = A;
      |                ^~~~~~
a.cc:14:24: error: 'copy' was not declared in this scope
   14 |         vector<string> copy = A;
      |                        ^~~~
a.cc:15:14: error: 'y' was not declared in this scope
   15 |         rep (y, H)
      |              ^
a.cc:34:5: error: 'cout' was not declared in this scope
   34 |     cout << res << "\n";
      |     ^~~~
Language: C++

h,w=map(int,input().split())
maze=[list(input()) for i in range(w)]
s=[]
#print(maze)
for i in range(w):
    for j in range(h):
        if maze[i][j]=="#":
            s.append([i,j])
l=[]
#print(maze,s)
for i in range(w):
    for j in range(h):
        cnt=10**7
        if maze[i][j]==".":
            for k in s:
                a=abs(k[0]-i)+abs(k[1]-j)
                cnt=min(cnt,a)
            l.append(cnt)
#print(l)
print(max(l))
    

Compiler output:
a.cc:4:2: error: invalid preprocessing directive #print
    4 | #print(maze)
      |  ^~~~~
a.cc:10:2: error: invalid preprocessing directive #print
   10 | #print(maze,s)
      |  ^~~~~
a.cc:19:2: error: invalid preprocessing directive #print
   19 | #print(l)
      |  ^~~~~
a.cc:1:1: error: 'h' does not name a type
    1 | h,w=map(int,input().split())
      | ^
Language: C


#include <stdio.h>

int h,w;
bool mas[1000][1000];
bool nmas[1000][1000];

bool isDark();
void copy();

int main(){
	int i,j;
	int c;
	int cont=0;
	char yoko[1002]="";
	
	scanf("%d %d ",&h,&w);
	for(i=0;i<h;i++){
		scanf("%s",yoko);
		for(j=0;j<w;j++){
			if(yoko[j]=='#'){
				nmas[i][j]=true;
			}else{
				nmas[i][j]=false;
			}
		}
	}
	while(true){
		cont++;
		copy();
		for(i=0;i<h;i++){
			for(j=0;j<w;j++){
				if(mas[i][j]){
					if(i-1>=0)nmas[i-1][j]=true;
					if(i+1<h)nmas[i+1][j]=true;
					if(j-1>=0)nmas[i][j-1]=true;
					if(j+1<w)nmas[i][j+1]=true;
				}
			}
		}
		if(isDark()){
			break;
		}
	}
	
	printf("%d\n",cont);
	
	return 0;
}

bool isDark(){
	int i,j;
	for(i=0;i<h;i++){
		for(j=0;j<w;j++){
			if(!(nmas[i][j]))return false;
		}
	}
	return true;
}

void copy(){
	int i,j;
	for(i=0;i<h;i++){
		for(j=0;j<w;j++){
			mas[i][j]=nmas[i][j];
		}
	}
}

Compiler output:
main.c:5:1: error: unknown type name 'bool'
    5 | bool mas[1000][1000];
      | ^~~~
main.c:3:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    2 | #include <stdio.h>
  +++ |+#include <stdbool.h>
    3 | 
main.c:6:1: error: unknown type name 'bool'
    6 | bool nmas[1000][1000];
      | ^~~~
main.c:6:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:8:1: error: unknown type name 'bool'
    8 | bool isDark();
      | ^~~~
main.c:8:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c: In function 'main':
main.c:22:44: error: 'true' undeclared (first use in this function)
   22 |                                 nmas[i][j]=true;
      |                                            ^~~~
main.c:22:44: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:22:44: note: each undeclared identifier is reported only once for each function it appears in
main.c:24:44: error: 'false' undeclared (first use in this function)
   24 |                                 nmas[i][j]=false;
      |                                            ^~~~~
main.c:24:44: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c: At top level:
main.c:51:1: error: unknown type name 'bool'
   51 | bool isDark(){
      | ^~~~
main.c:51:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c: In function 'isDark':
main.c:55:49: error: 'false' undeclared (first use in this function)
   55 |                         if(!(nmas[i][j]))return false;
      |                                                 ^~~~~
main.c:55:49: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:58:16: error: 'true' undeclared (first use in this function)
   58 |         return true;
      |                ^~~~
main.c:58:16: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
Language: C++

//#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#define MAX_INT 2100000000
using namespace std;
typedef long long int ll;
int main()
{
	int h, w, i, j, k, n = 0, dx[4] = { 0, -1, 0, 1 }, dy[4] = {1,0,-1,0},now=1,ans=0;
	static int a[1010][1010];
	char c;
	queue<pair<int,int> > q;
	cin >> h >> w;
	for (i = 1; i <= h; i++)
	{
		for (j = 1; j <= w; j++)
		{
			cin >> c;
			if (c == '#')
			{
				a[i][j] = 1;
				q.push(make_pair(i, j));
			}
			if (c == '.') a[i][j] = 0;
		}
	}
	while (q.size())
	{
		pair<int, int> p;
		p = q.front();
		q.pop();
		int kuro = 0;
		for (int i = 0; i < 4; i++)
		{
			if (1 <= p.first + dy[i] && p.first + dy[i] <= h && 1 <= p.second + dx[i] && p.second + dx[i] <= w)
			{
				if (a[p.first + dy[i]][p.second + dx[i]]==0)
				{
					kuro++;
					a[p.first + dy[i]][p.second + dx[i]] = a[p.first][p.second] + 1;
					q.push(make_pair(p.first + dy[i], p.second + dx[i]));
				}
			}
		}
	}
	int ans = 0;
	for (i = 1; i <= h; i++)
	{
		for (j = 1; j <= w; j++)
		{
			ans=max(a[i][j],ans);
		}
	}
	cout << ans-1 << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:50:13: error: redeclaration of 'int ans'
   50 |         int ans = 0;
      |             ^~~
a.cc:13:85: note: 'int ans' previously declared here
   13 |         int h, w, i, j, k, n = 0, dx[4] = { 0, -1, 0, 1 }, dy[4] = {1,0,-1,0},now=1,ans=0;
      |                                                                                     ^~~
Language: C++

#include<iostream>
using namespace std;
 
int main()
{
  bool m=false;
  int h;
  cin >> h;
  int w;
  cin >> w;
  char **a = new char*[h];
  for (int i=0; i<h;i++){
  	a[i] = new char[w];
  }
  
  bool **b = new bool*[h];
  for (int i=0; i<h;i++){
  	b[i] = new bool[w];
  }
  
  char c;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
    	while(cin>>c){
          a[i][j]=c;
          if(c=="#"){
          	b[i][j]=true;
          }else{
          	b[i][j]=false;
          }
    	}  
    }
  }
  int n=0;
  while(!m){
    n++;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(b[i][j]){
        if(i>0){a[i-1][j]="#";}
        if(i<h-1){a[i+1][j]="#";}
        if(j>0){a[i][j-1]="#";}
        if(j<w-1)a[i][j+1]="#";}
      }
    }
  }
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(a[i][j]=="#"){
      	b[i][j]=true;
      }
      if(!b[i][j]){
        m=true;
      }
    }
  }
  }
  cout >> n >> endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   26 |           if(c=="#"){
      |              ~^~~~~
a.cc:40:27: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   40 |         if(i>0){a[i-1][j]="#";}
      |                           ^~~
      |                           |
      |                           const char*
a.cc:41:29: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   41 |         if(i<h-1){a[i+1][j]="#";}
      |                             ^~~
      |                             |
      |                             const char*
a.cc:42:27: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   42 |         if(j>0){a[i][j-1]="#";}
      |                           ^~~
      |                           |
      |                           const char*
a.cc:43:28: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   43 |         if(j<w-1)a[i][j+1]="#";}
      |                            ^~~
      |                            |
      |                            const char*
a.cc:49:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   49 |       if(a[i][j]=="#"){
      |          ~~~~~~~^~~~~
a.cc: At global scope:
a.cc:58:3: error: 'cout' does not name a type
   58 |   cout >> n >> endl;
      |   ^~~~
a.cc:59:1: error: expected declaration before '}' token
   59 | }
      | ^
Language: C++

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



void dfs(vector<vector<char>>& A, int i, int j, int& H,int& W) {
	if (i < 0 || i >= H || j < 0 || j >= W || A[i][j] == '#')
		return;
	else {
		A[i][j] = '#';
			return;
	}
}

int main() {
	int H, W;
	cin >> H >> W;
	vector<vector<char>> A(H, vector<char>(W));

	vector<vector<int>> black;

	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> A[i][j];
			if (A[i][j] == '#') black.emplace_back(vector<int>({ i,j }));
		}
	}
	if (black.size() == H * W) {
		cout << 0 << endl;
		return 1;
	}

	int res = INT_MIN;

	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (A[i][j] == '.') {
				int tmp = INT_MAX;
				for (int k = 0; k < black.size(); k++) {
					tmp = min(tmp, abs(i - black[k][0]) + abs(j - black[k][1]));
				}
				res = max(res, tmp);
			}
		}
	}

	cout << res << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:19: error: 'INT_MIN' was not declared in this scope
   36 |         int res = INT_MIN;
      |                   ^~~~~~~
a.cc:5:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include <vector>
  +++ |+#include <climits>
    5 | using namespace std;
a.cc:41:43: error: 'INT_MAX' was not declared in this scope
   41 |                                 int tmp = INT_MAX;
      |                                           ^~~~~~~
a.cc:41:43: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include<iostream>
using namespace std;
 
int main()
{
  bool m=false;
  int h;
  cin >> h;
  int w;
  cin >> w;
  char **a = new char*[h];
  for (int i=0; i<h;i++){
  	a[i] = new char[w];
  }
  
  bool **b = new bool*[h];
  for (int i=0; i<h;i++){
  	b[i] = new bool[w];
  }
  
  char c;
  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
    	while(cin>>c){
          a[i][j]=c;
          if(c=="#"){
          	b[i][j]=true;
          }else{
          	b[i][j]=false;
          }
    	}  
    }
  }
  int n=0;
  while(!m){
    n++;
  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
      if(b[i][j]){
        if(i>0){a[i-1][j]="#";}
        if(i<h-1){a[i+1][j]="#";}
        if(j>0){a[i][j-1]="#";}
        if(j<w-1)a[i][j+1]="#";}
      }
    }
  }
  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
      if(a[i][j]=="#"){
      	b[i][j]=true;
      }
      if(!b[i][j]){
        m=true;
      }
    }
  }
  }
  cout >> n >> endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:7: error: 'i' was not declared in this scope
   22 |   for(i=0;i<h;i++){
      |       ^
a.cc:23:9: error: 'j' was not declared in this scope
   23 |     for(j=0;j<w;j++){
      |         ^
a.cc:26:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   26 |           if(c=="#"){
      |              ~^~~~~
a.cc:37:7: error: 'i' was not declared in this scope
   37 |   for(i=0;i<h;i++){
      |       ^
a.cc:38:9: error: 'j' was not declared in this scope
   38 |     for(j=0;j<w;j++){
      |         ^
a.cc:47:7: error: 'i' was not declared in this scope
   47 |   for(i=0;i<h;i++){
      |       ^
a.cc:48:9: error: 'j' was not declared in this scope
   48 |     for(j=0;j<w;j++){
      |         ^
a.cc: At global scope:
a.cc:58:3: error: 'cout' does not name a type
   58 |   cout >> n >> endl;
      |   ^~~~
a.cc:59:1: error: expected declaration before '}' token
   59 | }
      | ^
Language: C++

#include <iostream>
#include <vector>
#include<list>
#include <algorithm>
#include <string>
#include <math.h>
#include<map>
#include <utility>

#include<queue>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
 
#define INF (1e8)
typedef long long unsigned int ll;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
 

template<typename T>
int vector_finder(std::vector<T> vec, T number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

int gcd(int a,int b){
	if(b>0){
		return gcd(b, a % b);
	}else{
		return a;
	}
}

int N,M;
int H, W;

int A[1000][1000];
int visited[1000][1000] = {0};
int cou[1001][1001] = {INF};
int ans = 0;

int main()
{
	cin >> H >> W;
	int chang[H][W];
	REP(i, H)
	{
		string s;
		cin >> s;
		REP(j, W)
		{
			if(s[j]=='#'){
				A[i][j] = 0;
				cou[i+1][j+1] = 0;
			}else{
				A[i][j] = 1;
				visited[i][j] = 1;
				cou[i+1][j+1] = INF;	
			}
			chang[i][j] = 0;
		}
	}

	int ans= 0;
	while (1)
	{
		bool flag = false;
		ans++;

		REP(i,H){
			REP(j,W){
				chang[i][j] = 0;
			}
		}
		
		REP(i,H)
		{
			REP(j,W){
				if(A[i][j]==0){
					if(chang[i][j]==0&&A[i-1][j]==1){
					A[i - 1][j] = 0;
					chang[i - 1][j] = 1;
					}
					if(chang[i][j]==0&&A[i+1][j]==1){
					A[i + 1][j] = 0;
					chang[i + 1][j] = 1;
					}
					if(chang[i][j]==0&&A[i][j-1]==1){
					A[i][j-1] = 0;
					chang[i][j-1] = 1;
					}
					if(chang[i][j]==0&&A[i][j+1]==1){
					A[i][j+1] = 0;
					chang[i][j+1] = 1;
					}
				}
			}
		}
		
		REP(i,H)
		{
			REP(j,W){
				if(A[i][j]==1){
					flag = true;
				}
			}
		}
		if(!flag){
			break;
		}
		
	}

	cout << ans << endl;








	return 0;
}

Compiler output:
a.cc:14:14: error: narrowing conversion of '1.0e+8' from 'double' to 'int' [-Wnarrowing]
   14 | #define INF (1e8)
      |             ~^~~~
a.cc:44:24: note: in expansion of macro 'INF'
   44 | int cou[1001][1001] = {INF};
      |                        ^~~
Language: C++

#include <cstdio>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <utility>
#include <algorithm>
#include <iostream>
#include <iostream>

using namespace std;

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

void printA(const vector< vector<char> >& a) {
	for (int i = 0; i < a.size(); i++) {
		for (int j = 0; j < a[i].size(); j++) {
			cout << a[i][j];
		}
		cout << endl;
	}
}

void printAns(const vector< vector<int> >& a) {
	for (int i = 0; i < a.size(); i++) {
		for (int j = 0; j < a[i].size(); j++) {
			cout << a[i][j] << ' ';
		}
		cout << endl;
	}
}

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

	vector< vector<char> > a(h, vector<char>(w));
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> a[i][j];
		}
	}

	vector< vector<int> > ans(w, vector<int>(h, INT_MAX));

	// for right
	for (int i = 0; i < h; i++) {
		bool hitBlack = false;
		for (int j = 0; j < w; j++) {
			if (a[i][j] == '#') {
				hitBlack = true;
				ans[i][j] = 0;
			}
			else if (hitBlack) {
				chmin(ans[i][j], ans[i][j - 1] + 1);
			}
		}
	}

	// for left
	for (int i = 0; i < h; i++) {
		bool hitBlack = false;
		for (int j = w - 1; j >= 0; j--) {
			if ((!hitBlack) && (ans[i][j] != INT_MAX)) {
				hitBlack = true;
				continue;
			}
			
			if (hitBlack) {
				chmin(ans[i][j], ans[i][j + 1] + 1);
			}
		}
	}

	// for bottom
	for (int j = 0; j < w; j++) {
		bool hitBlack = false;
		for (int i = 0; i < h; i++) {
			if ((!hitBlack) && (ans[i][j] != INT_MAX)) {
				hitBlack = true;
				continue;
			}
			
			if (hitBlack) {
				chmin(ans[i][j], ans[i - 1][j] + 1);
			}
		}
	}

	// for top
	for (int j = 0; j < w; j++) {
		bool hitBlack = false;
		for (int i = h - 1; i >= 0; i--) {
			if ((!hitBlack) && (ans[i][j] != INT_MAX)) {
				hitBlack = true;
				continue;
			}
			
			if (hitBlack) {
				chmin(ans[i][j], ans[i + 1][j] + 1);
			}
		}
	}

	//printAns(ans);

	int maxVal = 0;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			chmax(maxVal, ans[i][j]);
		}
	}

	cout << maxVal << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:53: error: 'INT_MAX' was not declared in this scope
   45 |         vector< vector<int> > ans(w, vector<int>(h, INT_MAX));
      |                                                     ^~~~~~~
a.cc:9:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    8 | #include <iostream>
  +++ |+#include <climits>
    9 | #include <iostream>
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main(){
  int H , W ; cin >> H >> W ;
  deque<bool> board((H+2)*(W+1));
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if()
      char c; cin >> c;
      if(c=='#'){
        board[j+i*W] = true;
      }
      else{
        board[j+i*W] = false;
      }
    }
  }
  deque<bool> board2(board);
  bool change = false;
  int num = 0;
  do{
    change = false;
    for(int i=0,ei=H*W;i<ei;i++){
      int u=i%W,v=i/W;
      bool black = false;
      if(board[i]) continue;
      else if(u>0 && board[i-1]) black = true;
      else if(u<W-1 && board[i+1]) black = true;
      else if(v>0 && board[i-W]) black = true;
      else if(v<H-1 && board[i+W]) black = true;
      
      if(black){
		board2[i] = true;
        change = true;
      }
    }
    if(change){
      std::copy(board2.begin(),board2.end(),board.begin());
      num++;
    }
  }while(change);
  
  printf("%d",num);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:10: error: expected primary-expression before ')' token
   10 |       if()
      |          ^
a.cc:11:22: error: 'c' was not declared in this scope
   11 |       char c; cin >> c;
      |                      ^