Language: C++

#include<iostream>
using namespace std;

int number(int A[],int H,int 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;
}

int Darker(int A[],int H,int W){
    while(1){
        if(number(int A[],int H,int 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: In function 'int number(int*, int, int)':
a.cc:8:20: error: invalid types 'int[int]' for array subscript
    8 |             if(A[i][j]=="#"){
      |                    ^
a.cc: In function 'int Darker(int*, int, int)':
a.cc:19:19: error: expected primary-expression before 'int'
   19 |         if(number(int A[],int H,int W)==H*W)break;
      |                   ^~~
a.cc:19:27: error: expected primary-expression before 'int'
   19 |         if(number(int A[],int H,int W)==H*W)break;
      |                           ^~~
a.cc:19:33: error: expected primary-expression before 'int'
   19 |         if(number(int A[],int H,int W)==H*W)break;
      |                                 ^~~
a.cc:22:26: error: invalid types 'int[int]' for array subscript
   22 |                 if(A[i-1][j][k]=="#"){
      |                          ^
a.cc:22:30: error: 'k' was not declared in this scope
   22 |                 if(A[i-1][j][k]=="#"){
      |                              ^
a.cc:23:25: error: invalid types 'int[int]' for array subscript
   23 |                     A[i][j][k+1]="#";
      |                         ^
a.cc:24:32: error: invalid types 'int[int]' for array subscript
   24 |                 }else if(A[i+1][j][k]=="#"){
      |                                ^
a.cc:25:25: error: invalid types 'int[int]' for array subscript
   25 |                     A[i][j][k+1]="#";
      |                         ^
a.cc:26:30: error: invalid types 'int[int]' for array subscript
   26 |                 }else if(A[i][j-1][k]=="#"){
      |                              ^
a.cc:27:25: error: invalid types 'int[int]' for array subscript
   27 |                     A[i][j][k+1]="#";
      |                         ^
a.cc:28:30: error: invalid types 'int[int]' for array subscript
   28 |                 }else if(A[i][j-1][k]=="#"){
      |                              ^
a.cc:29:25: error: invalid types 'int[int]' for array subscript
   29 |                     A[i][j][k+1]="#";
      |                         ^
a.cc:31:25: error: invalid types 'int[int]' for array subscript
   31 |                     A[i][j][k]=".";
      |                         ^
a.cc:34:9: error: 'k' was not declared in this scope
   34 |         k++;
      |         ^
a.cc:37:13: error: 'k' was not declared in this scope
   37 |     cout << k <<endl;
      |             ^
a.cc: In function 'int main()':
a.cc:49:5: error: 'Dacker' was not declared in this scope; did you mean 'Darker'?
   49 |     Dacker(A,H,W)
      |     ^~~~~~
      |     Darker