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

#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdio>
#include <list>
#define ll long long
#define rep2(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define rep3(i,a,b) for(int i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
#define vec vector<int>
#define vecll vector<ll>
#define vecstr vector<string>
#define vecch vector<char>
#define vecpii vector<pii>
#define bs binary_search
#define All(c) (c).begin(),(c).end()
using namespace std;
int in(){int x;scanf("%d",&x);return x;}
string stin(){string s;cin>>s;return s;}
ll lin(){ll x;scanf("%lld",&x);return x;}
int main(){
    int h=in(),w=in();
    vector<vec> x(h,vec(w));
    vec a,b,c,d;
    rep(i,h){
        string s=stin();
        rep(j,s.length()){
            if(s.at(j)=='#'){
            x[i][j]=1;
            a.pb(i+j);
            b.pb(h-i+j);
            c.pb(i+w-j);
            d.pb(h-i+w-j);
            }else{
                x[i][j]=0;
            }
        }
    }
    sort(All(a));
    sort(All(b));
    sort(All(c));
    sort(All(d));
    int ans=0;
    rep(i,h)rep(j,w){
        if(x[i][j]==1)continue;
        int p,q,r,s;
        auto y=upper_bound(All(a),i+j);
        auto z=y;
        z--;
        p=min(abs(i+j-*y),abs(i+j-*z));
        
        y=upper_bound(All(b),h-i+j);
        z=y;
        z--;
        q=min(abs(h-i+j-*y),abs(h-i+j-*z));
        
        y=upper_bound(All(c),i+w-j);
        z=y;
        z--;
        r=min(abs(i+w-j-*y),abs(i+w-j-*z));
        
        y=upper_bound(All(d),h-i+w-j);
        z=y;
        z--;
        s=min(abs(h-i+w-j-*y),abs(h-i+w-j-*z));
        
        ans=max(ans,min(p,min(q,min(r,s))));
        }
    cout<<ans<<endl;


Compiler output:
a.cc: In function 'int main()':
a.cc:88:21: error: expected '}' at end of input
   88 |     cout<<ans<<endl;
      |                     ^
a.cc:40:11: note: to match this '{'
   40 | int main(){
      |           ^
Language: C++

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

char field[1001][1001];

int ans = 0;

void dfs(int x,int y,int H, int W){
    

    for(int dx = -1; dx <= -1; dx++){
        
            int nx  = x+dx;

            if(0<=nx<H&&field[nx][y] == '#'){
                field[x][y] = '#';
                ans++;
                return;
            }
        }
        
        
    }

    for(int dy = -1; dy <= -1; dy++){
        
            int ny  = y+dy;

            if(0<=ny<H&&field[x][ny] == '#'){
                field[x][y] = '#';
                ans++;
                return;
            }
        }
        
        
    }
}

int main(){
    int H,W;
    cin>>H>>W;
    
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            cin >> field[i][j];
        }
    }

    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            if(field[i][j] == '.'){
                dfs(i,j,H,W);
            }
        }
    }

    cout << ans << endl;

}

Compiler output:
a.cc:25:5: error: expected unqualified-id before 'for'
   25 |     for(int dy = -1; dy <= -1; dy++){
      |     ^~~
a.cc:25:22: error: 'dy' does not name a type
   25 |     for(int dy = -1; dy <= -1; dy++){
      |                      ^~
a.cc:25:32: error: 'dy' does not name a type
   25 |     for(int dy = -1; dy <= -1; dy++){
      |                                ^~
a.cc:37:5: error: expected declaration before '}' token
   37 |     }
      |     ^
a.cc:38:1: error: expected declaration before '}' token
   38 | }
      | ^
Language: Java

public class Main
{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int H,W;
        H=sc.nextInt();
        W=sc.nextInt();
        String[][] A = new String[W][H];
        int [][] counter = new int[W][H];
        for(int i=0;i<W;i++){
            for(int j=0;j<H;j++){
                A[i][j]=sc.next();
                counter[i][j]=0;
            }
        }
        for(int i=0;i<W;i++){
            for(int j=0;j<H;j++){
                while(i<W-1){
                    i++;
                    counter[i][j]++;
                    if(A[i][j].equals("#")){
                        break;
                    }
                }
                while(j<=H-1){
                    j++;
                    counter[i][j]++;
                    if(A[i][j].equals("#")){
                        break;
                    }
                }
            }
        }
        int max=0;
        for(int i=0;i<W;i++){
            for(int j=0;j<H-1;j++){
                if(counter[i][j]<counter[i][j+1]){
                    max=counter[i][j+1];
                }
            }
        }
        System.out.println(max);
    }

}


Compiler output:
Main.java:4: error: cannot find symbol
        Scanner sc = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class Main
Main.java:4: error: cannot find symbol
        Scanner sc = new Scanner(System.in);
                         ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: C++

#include <iostream>
#include <vector>
#include <string>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for (int i=a; i<(b);++i)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

string grid[1010];

int H,W;

int main(){
    cin >> H >> W;
    REP(i,H) cin >> grid[i];
    vector<int> x,y;
    REP(i,H){
        REP(j,W){
            if(grid[i][j] == '#'){
                x.push_back(j); y.push_back(i);
            }
        }
    }

    int ans = 0;
   
    REP(i,H){
        REP(j,W){
            int t = INF;
            REP(k,x.size()) chmin(t,abs(y[k] - i) + abs(x[k] - j));
            if(t == 0) continue;
            chmax(ans,t);
        }
    }

    cout << ans << endl;
}

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

#include<stdio.h>
using namespace std;
#include<vector>
#include<algorithm>
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
 
int main(){
  int H,W;
  scanf("%d",&H);
  scanf("%d",&W);
  char A[1000][1000]={};
  vector<pair<int,int> > wPos;
  vector<pair<int,int> > bPos;
  bool flag = false;
  int white = 0;
  int result = 0;
  int dist = 1000000;
  rep(i, 0, H){
    rep(j, 0, W){
      char temp;
      scanf(" %c",&A[i][j]);
     
      if(A[i][j] == '.') {
	wPos.pb(make_pair(i,j));
 
      }else{
	bPos.pb(make_pair(i,j));
      }
    }
  }
  
  rep(i, 0, wPos.size()){
    rep(j, 0, bPos.size()){
      
       int temp = abs(wPos[i].first-bPos[j].first)+abs(wPos[i].second-bPos[j].second);
       dist = min(temp,dist);
       if(dist < abs(wPos[i].first-bPos[j].first) || dist<wPos[i].second-bPos[j].second) break;
       //cout<<dist<<endl;
     }
     result = max(result, dist);
     if(dist < abs(wPos[i].first-bPos[j].first)) break;
     dist = 1000000;
     
  }
  printf("%d\n", result);
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:39: error: 'j' was not declared in this scope
   42 |      if(dist < abs(wPos[i].first-bPos[j].first)) break;
      |                                       ^
Language: Java

public class A
{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int H,W;
        H=sc.nextInt();
        W=sc.nextInt();
        String[][] A = new String[W][H];
        int [][] counter = new int[W][H];
        for(int i=0;i<W;i++){
            for(int j=0;j<H;j++){
                A[i][j]=sc.next();
                counter[i][j]=0;
            }
        }
        for(int i=0;i<W;i++){
            for(int j=0;j<H;j++){
                while(i<W-1){
                    i++;
                    counter[i][j]++;
                    if(A[i][j].equals("#")){
                        break;
                    }
                }
                while(j<=H-1){
                    j++;
                    counter[i][j]++;
                    if(A[i][j].equals("#")){
                        break;
                    }
                }
            }
        }
        int max=0;
        for(int i=0;i<W;i++){
            for(int j=0;j<H-1;j++){
                if(counter[i][j]<counter[i][j+1]){
                    max=counter[i][j+1];
                }
            }
        }
        System.out.println(max);
    }

}


Compiler output:
Main.java:1: error: class A is public, should be declared in a file named A.java
public class A
       ^
Main.java:4: error: cannot find symbol
        Scanner sc = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class A
Main.java:4: error: cannot find symbol
        Scanner sc = new Scanner(System.in);
                         ^
  symbol:   class Scanner
  location: class A
3 errors
Language: Java


import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	static int[][] masu;
	static int H, W;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		H = sc.nextInt();
		W = sc.nextInt();
		masu = new int[H][W];
		for(int i = 0; i < H; i++) {
			char[] tmp = sc.next().toCharArray();
			for(int j = 0; j < W; j++) {
				if(tmp[j] == '#') {
					masu[i][j] = 0;
				} else {
					masu[i][j] = 10000000;
				}
			}
		}
		int[][] init = masu;
		for(int i = 0; i < H; i++) {
			for(int j = 0; j < W; j++) {
				if(init[i][j] == 0) {
					dik(i, j);
				}
			}
		}
		int max = 0;
		for(int i = 0; i < H; i++) {
			for(int j = 0; j < W; j++) {
				max = Math.max(max, masu[i][j]);
			
		}
		System.out.println(max);
	}

	static void dik(int i, int j) {
		List<Pair> list = new ArrayList<>();
		list.add(new Pair(i,j))
		while(!list.isEmpty()) {
			Pair tmp = list.get(0);
			list.remove(0);
			int k = tmp.getFirst();
			int l = tmp.getSecond();
			if(k > 0) {
				if(masu[k][l] + 1 < masu[k - 1][l]) {
					masu[k - 1][l] = masu[k][l] + 1;
					list.add(new Pair(k-1,l));
				}
			}
			if(k < H - 1) {
				if(masu[k][l] + 1 < masu[k + 1][l]) {
					masu[k + 1][l] = masu[k][l] + 1;
					list.add(new Pair(k+1,l));
				}
			}
			if(l > 0) {
				if(masu[k][l] + 1 < masu[k][l - 1]) {
					masu[k][l - 1] = masu[k][l] + 1;
					list.add(new Pair(k,l-1));
				}
			}
			if(l < W - 1) {
				if(masu[k][l] + 1 < masu[k][l + 1]) {
					masu[k][l + 1] = masu[k][l] + 1;
					list.add(new Pair(k,l+1));
				}
			}
		}
	}

}

class Pair {
	int first;
	int second;

	protected Pair(int first, int second) {
		super();
		this.first = first;
		this.second = second;
	}

	public int getFirst() {
		return first;
	}

	public void setFirst(int first) {
		this.first = first;
	}

	public int getSecond() {
		return second;
	}

	public void setSecond(int second) {
		this.second = second;
	}

}


Compiler output:
Main.java:43: error: illegal start of expression
	static void dik(int i, int j) {
	^
Main.java:45: error: ';' expected
		list.add(new Pair(i,j))
		                       ^
2 errors
Language: C++

#ifdef __GNUC__ 
#include <bits/stdc++.h>

#endif
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/dynamic_bitset.hpp>
using namespace std;
vector<pair<long long, long long > > pointbuf;
template <long long h, long long w>
struct Bucket :public Bucket<h / 2, w / 2> {
	bool buf[h][w];
	using Base = Bucket<h / 2, w / 2>;
	using Base::wsize;
	using Base::hsize;
	Bucket(long long w_, long long h_) :Base(w_, h_), buf{} {}
	void set(long long h_, long long  w_) {
		buf[h_*h / hsize][w_ * w / wsize] = true;
		Bucket<h / 2, w / 2>::set(h_, w_);
	}
	long long calc() {
		vector< pair<int, int> > tmp;
		for (long long i = 0; i < h; ++i) {
			for (long long j = 0; j < w; j++) {
				if (buf[i][j] == 0) {//現在2*2のみ
					if (buf[i][(j+1)%w] ) {
						long long ww = wsize/2 - j%w;
						long long itmp = (i+1) * hsize/2 ;
						for (long long ii = i * hsize / 2; ii < itmp; ++ii) {
							tmp.emplace_back(ii,ww);
						}
						//tmp.emplace_back((hsize - 1)*(i / w), (j%w)*(wsize - 1));
					}
					if (buf[(i+1)%h][j ]) {
						long long hh = hsize / 2 - i % h;
						long long jtmp = (j + 1) * wsize / 2;
						for (long long jj = j * wsize / 2; jj < jtmp; ++jj) {
							tmp.emplace_back(hh, jj);
						}
					}
				}
			}
		}
		if (tmp.size() == 0)return 0;
		long long maxlen = 0;
		for (auto p : pointbuf) {
			for (auto target : tmp) {
				long long manhattan = abs(p.first - target.first) + abs(p.second - target.second);
				if (manhattan > maxlen)maxlen = manhattan;
			}
		}
		return maxlen;
	}
};
template <>
struct Bucket<1, 1> {
	long long wsize;
	long long hsize;
	Bucket(long long w, long long h) :wsize(w), hsize(h) {}
	void set(int, int) {}
};
long long main() {
	long long h, w;
	string s;
	cin >> h >> w;
	boost::dynamic_bitset<> buf(h*w);
	boost::dynamic_bitset<> mask1(h*w);
	boost::dynamic_bitset<> mask2(h*w);
	long long linetmp = 0, n = 0;
	long long col = 0;
	Bucket<2, 2> bukect(h, w);

	for (long long i = 0; i < h; ++i) {
		cin >> s;
		mask1.set(n);
		col = 0;
		for (auto c : s) {
			if (c == '#') {
				buf.set(n);
				pointbuf.emplace_back(linetmp, col);
				bukect.set(linetmp, col);
			}
			++n; ++col;
		}
		mask2.set(n - 1);
		++linetmp;
	}
	auto r = bukect.calc();
	if (r != 0) {
		n = r;
	}
	else {
		n = 0;
		mask1.flip();
		mask2.flip();
		while (!buf.all()) {
			buf |= ((mask1&buf) >> 1) | ((mask2&buf) << 1) | (buf >> w) | (buf << w);
			++n;
		}
	}
	cout << n << endl;
}


Compiler output:
a.cc:5:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
    5 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
const long long mod = pow(10, 9) + 7;
const long long MOD = 998244353;
const long long INF = 1LL << 60;
const int inf = pow(10, 9) + 7;
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, int B) {return (A + (B - 1)) / B;}
long long divCeil(int A, long long B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, long long B) {return (A + (B - 1)) / B;}

int manhattan(int x1, int y1, int x2, int y2)
{
  return abs(x1 - x2) + abs(y1 - y2);
}

int main()
{
  int H, W;
  cin >> H >> W;
  vector<vector<char>> A(H, vector<char>(W));
  vector<int> B0, B1, W0, W1;
  for (int i = 0; i < H; i++)
  {
    for (int j = 0; j < W; j++)
    {
      char c;
      cin >> c;
      A.at(i).at(j) = c;
      if (c == '#') 
      {
        B0.push_back(i);
        B1.push_back(j);
      }
      else
      {
        W0.push_back(i);
        W0.push_back(j);
      }
      
    }
  }
  int b = B0.size();
  int w = W0.size();

  int ans = 1;
  for (int h = 0; h < w; i++)
  {
    int i = W0.at(h);
    int j = W1.at(h);
    if (A.at(i).at(j) == '.')
      {
        int D = inf;
        if (i < i / 2)
        {
          for (int k = 0; k < b; k++)
          {
            int d = manhattan(B0.at(k), B1.at(k),
                              i, j); 
            chmin(D, d);
            if (d <= ans) break;
          }
          chmax(ans, D);
        }
        else
        {
          for (int k = b - 1; k >= 0; k--)
          {
            int d = manhattan(B0.at(k), B1.at(k),
                              i, j); 
            chmin(D, d);
            if (d <= ans) break;
          }
          chmax(ans, D);
        }
        
      }
  }
  

  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:49:26: error: 'i' was not declared in this scope
   49 |   for (int h = 0; h < w; i++)
      |                          ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e3+7;
//char maze[maxn][maxn];

struct node{
    int x,y;
}a[1000000];
string maze[maxn];
int x[maxn*maxn];

int main(){
    ios_base::sync_with_stdio(false),cin.tie(0);
    int n,m;cin>>n>>m;
    for(int i=0;i<n;i++) cin>>maze[i];
    int cnt=0;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++) {
            if(maze[i][j]=='#') a[cnt].x=i,a[cnt].y=j,x[cnt]=i,cnt++;
        }
    }
    int ans=0;
    int kk=0;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            if(maze[i][j]=='.'){
                int tmp=n+m*10;
                int xx=lower_bound(x,x+cnt,i)-x;
                int l=max(0,xx-502),r=min(xx+502,cnt)
                for(int k=l;k<r;k++){
                    int zx=abs(a[k].x-i)+abs(a[k].y-j);
                    if(zx<tmp) tmp=zx;
                }
                if(tmp>ans) ans=tmp;
            }
        }
    }
    printf("%d\n",ans);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:17: error: expected ',' or ';' before 'for'
   30 |                 for(int k=l;k<r;k++){
      |                 ^~~
a.cc:30:29: error: 'k' was not declared in this scope
   30 |                 for(int k=l;k<r;k++){
      |                             ^
Language: C

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

int main(){
  int H,W,ans=0;
  cin>>H>>W;
  int A[H][W];
  vector<pair<int,int>> AA;
  for(int i=0; i<H; ++i){
    for(int j=0; j<W; ++j){
      char a;
      cin>>a;
      if(a=='#') AA.push_back(make_pair(i,j));
    }
  }
  
  for(int i=0; i<H; ++i){
    for(int j=0; j<W; ++j){
      A[i][j]=100000;
      for(int q=0; q<AA.size(); ++q){
        A[i][j]=min(A[i][j],abs(i-AA[q].first)+abs(j-AA[q].second));
        if(ans>A[i][j]) break;
      }
      ans=max(ans,A[i][j]);
    }
  }

  cout<<ans<<endl;
}

Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

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

int main() {
  int H,W,n,m;
  cin >> H >> W;
  n=0;
  b=0;
  m=0;
  vector<int>vec(H*W+1000);
  vector<int>I(H*W+1000);
  vector<int>J(H*W+1000);
  vector<char>A(H*W+1000);
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin >> A.at(i+H*j);
      if(A.at(i+H*j)=='#'){
        I.at(m)=i;
        J.at(m)=j;
        m++;
      }
    }
  }
  vec.at(1)=m;
  while(m<(H*W)){
    int z=0;
      for(int k=vec.at(n);k<vec.at(n+1);k++){
        int i=I.at(k);
        int j=J.at(k);
        if(i!=0&&A.at(i-1+H*j)=='.'){
          z++;
          I.at(vec.at(n+1)+z)=i-1;
          J.at(vec.at(n+1)+z)=j;
          A.at(i-1+H*j)='#';
        }
        if(i!=(H-1)&&A.at(i+1+H*j)=='.'){
          z++;
          I.at(vec.at(n+1)+z)=i+1;
          J.at(vec.at(n+1)+z)=j;
          A.at(i+1+H*j)='#';
        }
        if(j!=0&&A.at(i-H+H*j)=='.'){
          z++;
          I.at(vec.at(n+1)+z)=i;
          J.at(vec.at(n+1)+z)=j-1;
          A.at(i-H+H*j)='#';
        }
        if(j!=(W-1)&&A.at(i+H+H*j)=='.'){
          z++;
          I.at(vec.at(n+1)+z)=i;
          J.at(vec.at(n+1)+z)=j+1;
          A.at(i+H+H*j)='#';
        }
      }
    m=m+z;
    vec.at(n+2)=m;
    n++;
  }

    cout << n << endl;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'b' was not declared in this scope
    8 |   b=0;
      |   ^
Language: C++

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

int stl = 0;
int H, W;

void erodeimage(char srcImage[H][W], char dstImage[H][W]){
  for (int i = 1; i < H - 1; i++){
		for (int j = 1; j < W - 1; j++){
      for (int k = 0; k < 3; k++){
				for (int l = 0; l < 3; l++){
					if (srcImage[i + k - 1][j + l - 1] == '#'){
						dstImage[i + k - 1][j + l] = '#';
            dstImage[i + k + 1][j + l] = '#';
            dstImage[i + k][j + l - 1] = '#';
            dstImage[i + k][j + l + 1] = '#';
					}
				}
			}
		}
	}
}

void check(char a[H][W]){
  int ch = 0;
  for (size_t i = 0; i < H; i++) {
    for (size_t j = 0; j < W; j++){
      if(a[H][W] == '#'){
        ch += 1;
      }
    }
  }
  if(ch == H*W){
    stl = 1;
  }
}

int main(){
  int count =0;
  cin >> H >> W;
  char image[H][W], temp[H][W], srcImage[H][W];
  for (size_t i = 0; i < H; i++) {
    for (size_t j = 0; j < W; j++) {
      cin >> image[i][j];
    }
  }
  memcpy(image, srcImage, W*H);
  while(stl == 0){
    erodeimage(srcImage, temp);
    memcpy(temp, srcImage, W*H);
    check(srcImage);
    count += 1;
  }
}


Compiler output:
a.cc:7:34: error: size of array 'srcImage' is not an integral constant-expression
    7 | void erodeimage(char srcImage[H][W], char dstImage[H][W]){
      |                                  ^
a.cc:7:31: error: size of array 'srcImage' is not an integral constant-expression
    7 | void erodeimage(char srcImage[H][W], char dstImage[H][W]){
      |                               ^
a.cc:7:55: error: size of array 'dstImage' is not an integral constant-expression
    7 | void erodeimage(char srcImage[H][W], char dstImage[H][W]){
      |                                                       ^
a.cc:7:52: error: size of array 'dstImage' is not an integral constant-expression
    7 | void erodeimage(char srcImage[H][W], char dstImage[H][W]){
      |                                                    ^
a.cc:24:22: error: size of array 'a' is not an integral constant-expression
   24 | void check(char a[H][W]){
      |                      ^
a.cc:24:19: error: size of array 'a' is not an integral constant-expression
   24 | void check(char a[H][W]){
      |                   ^
a.cc: In function 'int main()':
a.cc:49:16: error: cannot convert 'char (*)[W]' to 'char (*)[1]'
   49 |     erodeimage(srcImage, temp);
      |                ^~~~~~~~
      |                |
      |                char (*)[W]
a.cc:7:22: note:   initializing argument 1 of 'void erodeimage(char (*)[1], char (*)[1])'
    7 | void erodeimage(char srcImage[H][W], char dstImage[H][W]){
      |                 ~~~~~^~~~~~~~~~~~~~
a.cc:51:11: error: cannot convert 'char (*)[W]' to 'char (*)[1]'
   51 |     check(srcImage);
      |           ^~~~~~~~
      |           |
      |           char (*)[W]
a.cc:24:17: note:   initializing argument 1 of 'void check(char (*)[1])'
   24 | void check(char a[H][W]){
      |            ~~~~~^~~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <cmath>
#include <utility>

using namespace std;

using ELEMENT = int;

inline int CountPaintStep(const vector<pair<int,int>>& Blacks,
                          const int target_h, const int target_w)
{
	int MinStep = ~(1 << 31);
  	for(const auto& Itr : Blacks)
    {
    	const int step = abs(target_h - Itr.first) + abs(target_w - Itr.second);
       	if(MinStep > step)
           	MinStep = step;
    }

  	return MinStep;
}

int main()
{
 	int h,w;
 	cin >> h >> w;
	vector<vector<ELEMENT>> Mass(static_cast<size_t>(h), vector<ELEMENT>(static_cast<size_t>(w)));
  	vector<pair<int,int>> Whites;
	vector<pair<int,int>> Blacks;
  
	for(int i = 0; i < h; ++ i){
    	for(int j = 0; j < w; ++ j)
    	{
        	char col;
        	cin >> col;
          	
          	if(col == '#')
            	Blacks.emplace_back(pair<int,int>(i, j));
          	else
            	Whites.emplace_back(pair<int, int>(i, j));
     	}
    }
  	Blacks.shrink_to_fit();
  	Whites.shrink_to_fit();
  	
  	int MaxStep = 0;
  	for(const auto&& Itr : Whites)
    {
      const auto step = CountPaintStep(Blacks, Itr.first, Itr.second);
      if(step > MaxStep)
      	MaxStep = step;
    }
  
  	cout << MaxStep;
	return 0; 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:48:32: error: cannot bind rvalue reference of type 'const std::pair<int, int>&&' to lvalue of type 'std::pair<int, int>'
   48 |         for(const auto&& Itr : Whites)
      |                                ^~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <cmath>
#include <utility>

using namespace std;

using ELEMENT = int;

inline int CountPaintStep(const vector<pair<int,int>>& Blacks,
                          const int target_h, const int target_w)
{
	int MinStep = ~(1 << 31);
  	for(const auto& Itr : Blacks)
    {
    	const int step = abs(target_h - Itr->first) + abs(target_w - Itr->second);
       	if(MinStep > step)
           	MinStep = step;
    }

  	return MinStep;
}

int main()
{
 	int h,w;
 	cin >> h >> w;
	vector<vector<ELEMENT>> Mass(static_cast<size_t>(h), vector<ELEMENT>(static_cast<size_t>(w)));
  	vector<pair<int,int>> Whites;
	vector<pair<int,int>> Blacks;
  
	for(int i = 0; i < h; ++ i){
    	for(int j = 0; j < w; ++ j)
    	{
        	char col;
        	cin >> col;
          	
          	if(col == '#')
            	Blacks.emplace_back(pair<int,int>(i, j));
          	else
            	Whites.emplace_back(pair<int, int>(i, j));
     	}
    }
  	Blacks.shrink_to_fit();
  	Whites.shrink_to_fit();
  	
  	int MaxStep = 0;
  	for(const auto& Itr : Whites)
    {
      const auto step = CountPaintStep(Blacks, Itr->first, Itr->second);
      if(step > MaxStep)
      	MaxStep = step;
    }
  
  	cout << MaxStep;
	return 0; 
}


Compiler output:
a.cc: In function 'int CountPaintStep(const std::vector<std::pair<int, int> >&, int, int)':
a.cc:16:44: error: base operand of '->' has non-pointer type 'const std::pair<int, int>'
   16 |         const int step = abs(target_h - Itr->first) + abs(target_w - Itr->second);
      |                                            ^~
a.cc:16:73: error: base operand of '->' has non-pointer type 'const std::pair<int, int>'
   16 |         const int step = abs(target_h - Itr->first) + abs(target_w - Itr->second);
      |                                                                         ^~
a.cc: In function 'int main()':
a.cc:50:51: error: base operand of '->' has non-pointer type 'const std::pair<int, int>'
   50 |       const auto step = CountPaintStep(Blacks, Itr->first, Itr->second);
      |                                                   ^~
a.cc:50:63: error: base operand of '->' has non-pointer type 'const std::pair<int, int>'
   50 |       const auto step = CountPaintStep(Blacks, Itr->first, Itr->second);
      |                                                               ^~
Language: C++

#include<iostream>

using namespace std;

short int a[1005][1005];

bool used[1005][1005];

char c;

int h,w,ans=0;

bool pd(short int x[][],int xx,int yy){

    for(int i=1;i<=xx;i++)

        for(int j=1;j<=yy;j++)

            if(x[i][j]!=1)

                return false;

    return true;

}

int main(){

    cin>>h>>w;

    for(int i=1;i<=h;i++)

        for(int j=1;j<=w;j++){

            cin>>c;

            if(c=='.')

                a[i][j]==0;

            else a[i][j]==1;

        }

    while(!pd(a,h,w)){

        for(int i=1;i<=h;i++)

            for(int j=1;j<=w;j++){

                used[i][j]=false;

            }

        for(int i=1;i<=h;i++)

            for(int j=1;j<=w;j++)

                if(a[i][j]==1&&!used[i][j]){

                    a[i-1][j]=1;

                    a[i+1][j]=1;

                    a[i][j+1]=1;

                    a[i][j-1]=1;

                    used[i][j]=true;

                    used[i-1][j]=true;

                    used[i+1][j]=true;

                    used[i][j+1]=true;

                    used[i][j-1]=true;

                }

        ans++;

    }

    cout<<ans;

    return 0;

}

Compiler output:
a.cc:13:19: error: declaration of 'x' as multidimensional array must have bounds for all dimensions except the first
   13 | bool pd(short int x[][],int xx,int yy){
      |                   ^
a.cc:13:24: error: expected ')' before ',' token
   13 | bool pd(short int x[][],int xx,int yy){
      |        ~               ^
      |                        )
a.cc:13:25: error: expected unqualified-id before 'int'
   13 | bool pd(short int x[][],int xx,int yy){
      |                         ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main( int argc, char *argv[] )
{
	int h, w, ans;
	cin >> h >> w;
	ans = 0;
	vector<vector<int>>data(h, vector<int>(w));
	for(int i = 0;i < h; i++){
		for(int j = 0;j < w; j++){
			cin >> data.at(i).at(j);
		}
	}
	while!(for(int i = 0;i < h; i++){
		for(int j = 0;j < w; j++){
			data[i][j] == '#';
		}
	}
	)
	{
	for(int i = 1;i < h; i++){
		for(int j = 1;j < w; j++){
			if(data[i][j] == '#';){
				data[i-1][j] = '.';
				data[i+1][j] = '.';
				data[i][j+1] = '.';
				data[i][j-1] = '.';
			}
		}
	}
	ans++;
}
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:14:14: error: expected '(' before '!' token
   14 |         while!(for(int i = 0;i < h; i++){
      |              ^
      |              (
a.cc:14:16: error: expected primary-expression before 'for'
   14 |         while!(for(int i = 0;i < h; i++){
      |                ^~~
a.cc:14:16: error: expected ')' before 'for'
   14 |         while!(for(int i = 0;i < h; i++){
      |               ~^~~
      |                )
a.cc:14:29: error: expected ')' before ';' token
   14 |         while!(for(int i = 0;i < h; i++){
      |              ~              ^
      |                             )
a.cc:14:30: error: 'i' was not declared in this scope
   14 |         while!(for(int i = 0;i < h; i++){
      |                              ^
a.cc:19:9: error: expected primary-expression before ')' token
   19 |         )
      |         ^
Language: C++

#include<iostream>
using namespace std;

int Number(int A[1001][1001][2002],int H,int W, int k){
    int l=0;
    for(int i=1;i<H+1;i++){
        for(int j=1;j<W+1;j++){
            if(A[i][j][k]=='#'){
                ++l;
            }
        }
    }
    return l;
}

int Darker( int A[1001][1001][2002],int H,int W){
    int k = 0;
    while(1){
        int sw = Number(A,H,W,k);
        if(sw==H*W)break;
        for(int i=1;i<H+1;i++){
            for(int j=1;j<W+1;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;
        }
    }
    return k;
}

int main(){
    int H,W,A[1001][1001][2002],k=0;
    cin >> H, W;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            cin>>A[i+1][j+1][0];
        }
    }
    int tw = Darker(A,H,W);
    cout << t <<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:13: error: 't' was not declared in this scope; did you mean 'tw'?
   50 |     cout << t <<endl;
      |             ^
      |             tw
Language: C++

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

int main(){
  int H, W, N;
  int sr, sc;
  string S, T;
  cin >> H >> W >> N;
  cin >> sr >> sc;
  cin >> S >> T;
  
  for(int i = 0; i < N ; i++){
    if(S[i]=='L'){
      if(W%2 == 0){
        if(sc > W/2){
          sc -= 1;
        }
      }
      else{
        if(sc >= W/2 + 2){
          sc -= 1;
        }
      }
    }
    if(S[i]=='R'){
      if(W%2 == 0){
        if(sc <= W/2){
          sc += 1;
        }
      }
      else{
        if(sc < W/2 + 1){
          sc += 1;
        }
      }
    }
    if(S[i]=='U'){
      if(H%2 == 0){
        if(sr > H/2){
          sr -= 1;
        }
      }
      else{
        if(sr >= H/2 + 2){
          sr -= 1;
        }
      }
    }
    if(S[i]=='D'){
      if(H%2 == 0){
        if(sr <= H/2){
          sr += 1;
        }
      }
      else{
        if(sr < H/2 + 1){
          sr += 1;
        }
      }
    }
    if(sr == 0||sr == H + 1||sc == 0||sc == W + 1){
      cout << "NO" << endl;
      break;
    }
    
    if(T[i]=='L'){
      if(W%2 == 0){
        if(sc <= W/2){
          sc -= 1;
        }
      }
      else{
        if(sc <= W/2){
          sc -= 1;
        }
      }
    }
    if(T[i]=='R'){
      if(W%2 == 0){
        if(sc > W/2){
          sc += 1;
        }
      }
      else{
        if(sc >= W/2 + 1){
          sc += 1;
        }
      }
    }
    if(T[i]=='U'){
      if(H%2 == 0){
        if(sr <= H/2){
          sr -= 1;
        }
      }
      else{
        if(sr <= H/2 + 1){
          sr -= 1;
        }
      }
    }
    if(T[i]=='D'){
      if(H%2 == 0){
        if(sr > H/2){
          sr += 1;
        }
      }
      else{
        if(sr >= H/2 + 1){
          sr += 1;
        }
      }
    }
    if(sr == 0||sr == H + 1||sc == 0||sc == W + 1){
      cout << "NO" << endl;
      break;
    }
  }
  if(sc != W + 1 && sc != 0 && sr != H + 1 && sr != 0){
    cout << "YES" << endl;
}


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


#include<stdio.h>

using namespace std;


int main(){
	int H, W;
	cin>>H>>W;
	char map[H][W];
	int data[H][W];
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			cin>>map[i][j];
			data[i][j] = 0;
		}
	}
	int ans = 0;
	int s = 2;
	while(1){
		s++;
		int n = 0;
		
		for(int i = 0; i < H; i++){
	
			for(int j = 0; j < W; j++){
				
			
				if(map[i][j] == '.')continue;
				if(data[i][j] == s)continue;
				if(map[i - 1][j] == '#' and map[i + 1][j] == '#' and map[i][j + 1] == '#' and map[i][j - 1] == '#')continue;
				if(i > 0){
					if(map[i - 1][j] == '.'){n++;data[i - 1][j] = s;}
					map[i - 1][j] = '#';
				}
				if(j > 0){
					if(map[i][j - 1] == '.'){n++;data[i][j - 1] = s;}
					map[i][j - 1] = '#';
				}
				if(j < W - 1){
					if(map[i][j + 1] == '.'){n++;data[i][j + 1] = s;}
					map[i][j + 1] = '#';
				}
				if(i < H - 1){
					if(map[i + 1][j] == '.'){n++;data[i + 1][j] = s;}
				map[i + 1][j] = '#';
				}
			}
		}
		if(n == 0)goto a;
				ans ++;
	}
	a:
	printf("%d\n", ans);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'cin' was not declared in this scope
    9 |         cin>>H>>W;
      |         ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include<stdio.h>
  +++ |+#include <iostream>
    3 |
Language: C++

#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>


using namespace std;
int main(void){
    int H,W;
    cin>>H>>W;
    int dis[H][W];
    char maze[H][W];
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++{
            cin>>maze[i][j];
          dis[i][j]=1000000000;
          if(maze[i][j]=='#') dis[i][j]=0;
        }
    }
            
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:28: error: expected ')' before '{' token
   14 |         for(int j=0;j<W;j++{
      |            ~               ^
      |                            )
Language: C++

#include <iostream>
#include <vector>
#include <cmath>
#include <utility>

using namespace std;

using ELEMENT = int;

inline int CountPaintStep(const vector<vector<ELEMENT>>& Mass,
                          const vector<pair<int,int>>& Blacks
                          const int target_h, const int target_w)
{
	int MinStep = ~(1 << 31);
  	for(auto Itr = Blacks.cbegin(); Itr != Blacks.cend(); ++ Itr)
    {
    	const int step = abs(target_h - Itr->first) + abs(target_w - Itr->second);
       	if(MinStep > step)
           	MinStep = step;
    }

  	return MinStep;
}

int main()
{
 	int h,w;
 	cin >> h >> w;
	vector<vector<ELEMENT>> Mass(static_cast<size_t>(h), vector<ELEMENT>(static_cast<size_t>(w)));
	vector<pair<int,int>> Blacks;
  
	for(int i = 0; i < h; ++ i){
    	for(int j = 0; j < w; ++ j)
    	{
        	char col;
        	cin >> col;
          	
          	if(Mass[i][j] = col == '#')
            	Blacks.emplace_back(pair<int,int>(i, j));
     	}
    }
  	Blacks.shrink_to_fit();
  	
  	int MaxStep = 0;
  	for(int i = 0; i < h; ++ i)
    	for(int j = 0; j < w; ++ j)
        {
        	const auto step = CountPaintStep(Mass, Blacks, i, j);
          	if(step > MaxStep)
              MaxStep = step;
        }
  
  	cout << MaxStep;
	return 0; 
}

Compiler output:
a.cc:12:27: error: expected ',' or '...' before 'const'
   12 |                           const int target_h, const int target_w)
      |                           ^~~~~
a.cc: In function 'int CountPaintStep(const std::vector<std::vector<int> >&, const std::vector<std::pair<int, int> >&)':
a.cc:17:30: error: 'target_h' was not declared in this scope
   17 |         const int step = abs(target_h - Itr->first) + abs(target_w - Itr->second);
      |                              ^~~~~~~~
a.cc:17:59: error: 'target_w' was not declared in this scope
   17 |         const int step = abs(target_h - Itr->first) + abs(target_w - Itr->second);
      |                                                           ^~~~~~~~
a.cc: In function 'int main()':
a.cc:48:49: error: too many arguments to function 'int CountPaintStep(const std::vector<std::vector<int> >&, const std::vector<std::pair<int, int> >&)'
   48 |                 const auto step = CountPaintStep(Mass, Blacks, i, j);
      |                                   ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
a.cc:10:12: note: declared here
   10 | inline int CountPaintStep(const vector<vector<ELEMENT>>& Mass,
      |            ^~~~~~~~~~~~~~
Language: C++

#include <iostream>

using namespace std;

int H,W,flag=-1;
char c;
int A[1010][1010];
int main(){
  cin >> H >> W;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin >> c;
      A[i][j]=(c=='#'?0:-1);
    }
  }
  int i;
  for(i=1;flag==-1;i++){
    flag=1;
    for(int y=0;y<H;y++){
      for(int x=0;x<W;x++){
        if(A[i][j]!=-1) continue;
        if(y!=0 && A[y-1][x]==i-1) A[y][x]=i;
        else if(y<H-1 && A[y+1][x]==i-1) A[y][x]=i;
        if(x!=0 && A[y][x-1]==i-1) A[y][x]=i;
        else if(x<W-1 && A[y][x+1]==i-1) A[y][x]=i;
        flag=min(A[y][x],flag);
      }
    }
  }
  cout << i-1 << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:17: error: 'j' was not declared in this scope
   21 |         if(A[i][j]!=-1) continue;
      |                 ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e3+7;
//char maze[maxn][maxn];

struct node{
    int x,y;
}a[1000000];

int main(){
    ios_base::sync_with_stdio(false),cin.tie(0);
    int n,m;cin>>n>>m;
    for(int i=0;i<n;i++) cin>>maze[i];
    int cnt=0;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++) {
            if(maze[i][j]=='#') a[cnt].x=i,a[cnt].y=j,cnt++;
        }
    }
    int ans=0;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            if(maze[i][j]=='.'){
                int tmp=n+m;
                for(int k=0;k<cnt;k++) {
                    int zx=abs(a[k].x-i)+abs(a[k].y-j);
                    tmp=min(zx,tmp);
                }
                ans=max(tmp,ans);
            }
        }
    }
    printf("%d\n",ans);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:31: error: 'maze' was not declared in this scope
   13 |     for(int i=0;i<n;i++) cin>>maze[i];
      |                               ^~~~
a.cc:17:16: error: 'maze' was not declared in this scope
   17 |             if(maze[i][j]=='#') a[cnt].x=i,a[cnt].y=j,cnt++;
      |                ^~~~
a.cc:23:16: error: 'maze' was not declared in this scope
   23 |             if(maze[i][j]=='.'){
      |                ^~~~
Language: C++

#include <iostream>
#include <string.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <functional>
#include <cassert>
#include <utility>
#include <stack>
#include <queue>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef pair<int,int> Pi;
typedef long long int ll;
const int INF=(ll)(1<<30)-1;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}


int h,w;
char a[1010][1010];
int ans=0;
int x,y;

bool ab[1001][1001][1001][1001];

bool ac[1010][1010];

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


int solve(int h1,int w1){
	queue< pair<int,int> > que;
	/*REP(i,h){
		REP(j,w){
			ab[i][j]=0;
		}
	}*/
	ab[h1][w1][h1][w1]=1;
	ans=-1;
	que.push(Pi(h1,w1));
	while(que.size()){
		
		Pi p=que.front();que.pop();
		//cout<<p.first<<" "<<p.second<<endl;
		if(a[p.first][p.second]=='#'){
			
			for(int i=min(p.first,h1);i<=max(p.first,h1);i++)
				for(int j=min(p.second,w1);j<max(p.second,w1);j++)
					ac[i][j]=1;
			//cout<<h1<<" "<<w1<<" "<<abs(p.first-h1)+abs(p.second-w1)<<endl;
			return abs(p.first-h1)+abs(p.second-w1);
		}
		for(int i=0;i<4;i++){
			int nx=p.first+dx[i],ny=p.second+dy[i];
			
			if(0<=nx&&nx<h&&0<=ny&&ny<=w&&(!ab[nx][ny][h1][w1])){
				que.push(Pi(nx,ny));
			}
		}
	}
}
			
int main(){
	cin>>h>>w;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin>>a[i][j];
		}
	}
	
	int max=0;
	
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(!(ac[i][j]))
			max=max(solve(i,j),max);
		}
	}
	cout<<max<<endl;
	return 0;
}
			
			

Compiler output:
a.cc: In function 'int solve(int, int)':
a.cc:70:1: warning: control reaches end of non-void function [-Wreturn-type]
   70 | }
      | ^
/tmp/ccCto0zL.o: in function `solve(int, int)':
a.cc:(.text+0x1bc): relocation truncated to fit: R_X86_64_PC32 against symbol `ac' defined in .bss section in /tmp/ccCto0zL.o
/tmp/ccCto0zL.o: in function `main':
a.cc:(.text+0x4a6): relocation truncated to fit: R_X86_64_PC32 against symbol `ac' defined in .bss section in /tmp/ccCto0zL.o
collect2: error: ld returned 1 exit status
Language: C++

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

int main(){
  int H,W,ans=0;
  cin>>H>>W;
  int A[H][W];
  vector<pair<int,int>> AA;
  for(int i=0; i<H; ++i){
    for(int j=0; j<W; ++j){
      char a;
      cin>>a;
      if(a=='#') AA.push_back(make_pair(i,j));
    }
  }
  
  vector<int> B;
  B.push_back(0);
  for(int i=0; i<AA.size(); ++i) B.push_back(i+j);
  B.push_back(H+W-2);
  int bb=0;
  for(int i=1; i<B.size(); ++i) bb=max(bb,(B[i]-B[i-1]+1)/2);
  
  bool CAN[H][W];
  for(int q=0; i<AA.size(); ++i){
    for(int i=AA[q].first-bb; i<=AA[q].first+bb; ++i){
      for(int j=AA[q].second-bb; i<=AA[q].second+bb; ++j){
        CAN[i][j]=true;
      }
    }
  }
  
  for(int i=0; i<H; ++i){
    for(int j=0; j<W; ++j){
      if(CAN){
        A[i][j]=100000;
        for(int q=0; q<AA.size(); ++q){
          A[i][j]=min(A[i][j],abs(i-AA[q].first)+abs(j-AA[q].second));
        }
        ans=max(ans,A[i][j]);
      }
    }
  }

  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:48: error: 'j' was not declared in this scope
   24 |   for(int i=0; i<AA.size(); ++i) B.push_back(i+j);
      |                                                ^
a.cc:30:16: error: 'i' was not declared in this scope
   30 |   for(int q=0; i<AA.size(); ++i){
      |                ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL //デバッグ出力系
#define dout(s) cout<<s<<"\n";
#define debug() if(true)
#else
#define dout(s)
#define debug() if(false)
#endif//
#define next asdnext
#define prev asdprev
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define vout(v) for(auto &i:v){cout<<i<<" ";}cout<<"\n"; //配列出力
#define vin(v) for(auto &i:v)cin>>i; //配列入力
#define vec(v,n) vector<int> v(n);
typedef long long ll;
typedef unsigned long long ull;

void Main() {
	int H,W;
	cin >> H >> W;
	vector<vector<bool>> A(H, vector<bool>(W, 0));//白=0
	vector<vector<bool>> B(H, vector<bool>(W, 0));//白=0
	char c;
	for (int i = 0; i < H; i++) {//AをTMPにコピー
		for (int j = 0; j < W; j++) {
			cin >> c;
			A[i][j] = (c == '#');
		}
	}
	int cnt = 0;
	bool end = false;
	while (1) {
		int end=0;
		for (int i = 0; i < H; i++) {//AをTMPにコピー
			for (int j = 0; j < W; j++) {
				end += B[i][j] = A[i][j];
			}
		}

		if (end==H*W) {
			break;
		}

		cnt++;


		if (B[0][0])
			A[0 + 1][0] = A[0][1] = 1;
		for (int j = 1; j < W - 1; j++) {
			if (B[0][j])
				A[0][j - 1] = A[0 + 1][j] = A[0][j + 1] = 1;
		}
		if (B[0][H - 1])
			A[0 + 1][W - 1] = A[0][W - 2] = 1;

		for (int i = 1; i < H-1; i++) {
			if (B[i][0])
				A[i - 1][0] = A[i + 1][0] = A[i][1] = 1;
			for (int j = 1; j < W-1; j++) {
				if (B[i][j])
					A[i][j - 1] = A[i - 1][j] = A[i + 1][j] = A[i][j + 1] = 1;
			}
			if (B[i][H-1])
				A[i - 1][W-1] = A[i + 1][W-1] = A[i][W-2] = 1;
		}


		if (B[H-1][0])
			A[H - 1 - 1][0] = A[H - 1][1] = 1;
		for (int j = 1; j < W - 1; j++) {
			if (B[H - 1][j])
				A[H - 1][j - 1] = A[H - 1 - 1][j] = A[H - 1][j + 1] = 1;
		}
		if (B[H - 1][H - 1])
			A[H - 1 - 1][W- 1] = A[H - 1][W - 2] = 1;


		dout("\n");
		debug() {
			for (auto&i : A) {
				for (auto&j : i) {
					cout << (j ? '#' : '.');
				}
				cout << "\n";
			}
		}
	}

	cout << cnt << "\n";
}

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


Compiler output:
a.cc: In function 'void Main()':
a.cc:83:47: error: cannot bind non-const lvalue reference of type 'std::_Bit_reference&' to an rvalue of type 'std::_Bit_iterator::reference'
   83 |                                 for (auto&j : i) {
      |                                               ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL //デバッグ出力系
#define dout(s) cout<<s<<"\n";
#define debug() if(true)
#else
#define dout(s)
#define debug() if(false)
#endif//
#define next asdnext
#define prev asdprev
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define vout(v) for(auto &i:v){cout<<i<<" ";}cout<<"\n"; //配列出力
#define vin(v) for(auto &i:v)cin>>i; //配列入力
#define vec(v,n) vector<int> v(n);
typedef long long ll;
typedef unsigned long long ull;

void Main() {
	int H,W;
	cin >> H >> W;
	vector<vector<bool>> A(H, vector<bool>(W, 0));//白=0
	vector<vector<bool>> B(H, vector<bool>(W, 0));//白=0
	char c;
	for (auto&i:A) {
		for (auto&j:i) {
			cin >> c;
			j = (c == '#');
		}
	}
	int cnt = 0;
	bool end = false;
	while (1) {
		int end=0;
		for (int i = 0; i < H; i++) {//AをTMPにコピー
			for (int j = 0; j < W; j++) {
				end += B[i][j] = A[i][j];
			}
		}

		if (end==H*W) {
			break;
		}

		cnt++;


		if (B[0][0])
			A[0 + 1][0] = A[0][1] = 1;
		for (int j = 1; j < W - 1; j++) {
			if (B[0][j])
				A[0][j - 1] = A[0 + 1][j] = A[0][j + 1] = 1;
		}
		if (B[0][H - 1])
			A[0 + 1][W - 1] = A[0][W - 2] = 1;

		for (int i = 1; i < H-1; i++) {
			if (B[i][0])
				A[i - 1][0] = A[i + 1][0] = A[i][1] = 1;
			for (int j = 1; j < W-1; j++) {
				if (B[i][j])
					A[i][j - 1] = A[i - 1][j] = A[i + 1][j] = A[i][j + 1] = 1;
			}
			if (B[i][H-1])
				A[i - 1][W-1] = A[i + 1][W-1] = A[i][W-2] = 1;
		}


		if (B[H-1][0])
			A[H - 1 - 1][0] = A[H - 1][1] = 1;
		for (int j = 1; j < W - 1; j++) {
			if (B[H - 1][j])
				A[H - 1][j - 1] = A[H - 1 - 1][j] = A[H - 1][j + 1] = 1;
		}
		if (B[H - 1][H - 1])
			A[H - 1 - 1][W- 1] = A[H - 1][W - 2] = 1;


		dout("\n");
		debug() {
			for (auto&i : A) {
				for (auto&j : i) {
					cout << (j ? '#' : '.');
				}
				cout << "\n";
			}
		}
	}

	cout << cnt << "\n";
}

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


Compiler output:
a.cc: In function 'void Main()':
a.cc:27:29: error: cannot bind non-const lvalue reference of type 'std::_Bit_reference&' to an rvalue of type 'std::_Bit_iterator::reference'
   27 |                 for (auto&j:i) {
      |                             ^
a.cc:83:47: error: cannot bind non-const lvalue reference of type 'std::_Bit_reference&' to an rvalue of type 'std::_Bit_iterator::reference'
   83 |                                 for (auto&j : i) {
      |                                               ^