Language: C++

#include<bits/stdc++.h>
using namespace std;
/*
vector<int> dx(4)={1,0,-1,0};
vector<int> dy(4)={0,1,0,-1};
*/
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main() {
  int H,W;cin>>H>>W;
  vector<string> Fi(H);
  for(int i=0;i<H;i++) cin>>Fi.at(i);
  
  vector<int,vector<int>> dist(H,vector<int>(W,-1));
  using pint=pair<int,int>;
  queue<pint> que;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(Fi[i][j]=='#'){
        dist[i][j]=0;
        que.push_back((i,j));
      }
    }
  }
  
  while(!que.empty()){
    auto cur=que.front();
    que.pop();
    for(int dir=0;dir<4;dir++){
      int nx=cur.first+dx.at(dir);
      int ny=cur.second+dy.at(dir);
      if(nx<0 || nx>=H || ny<0 || ny>=W) continue;
      if(dist[nx][ny]==-1){
        dist[nx][ny] = dist[cur.first][cur.second]+1;
        que.push(pint(nx,ny));
      }
    }
  }
  int ans=0;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      ans= max(ans,dist[i][j]);
    }
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:16: error: invalid types '__gnu_cxx::__alloc_traits<std::vector<int>, int>::value_type {aka int}[int]' for array subscript
   21 |         dist[i][j]=0;
      |                ^
a.cc:22:13: error: 'class std::queue<std::pair<int, int> >' has no member named 'push_back'
   22 |         que.push_back((i,j));
      |             ^~~~~~~~~
a.cc:31:27: error: request for member 'at' in 'dx', which is of non-class type 'int [4]'
   31 |       int nx=cur.first+dx.at(dir);
      |                           ^~
a.cc:32:28: error: request for member 'at' in 'dy', which is of non-class type 'int [4]'
   32 |       int ny=cur.second+dy.at(dir);
      |                            ^~
a.cc:34:18: error: invalid types '__gnu_cxx::__alloc_traits<std::vector<int>, int>::value_type {aka int}[int]' for array subscript
   34 |       if(dist[nx][ny]==-1){
      |                  ^
a.cc:35:17: error: invalid types '__gnu_cxx::__alloc_traits<std::vector<int>, int>::value_type {aka int}[int]' for array subscript
   35 |         dist[nx][ny] = dist[cur.first][cur.second]+1;
      |                 ^
a.cc:35:39: error: invalid types '__gnu_cxx::__alloc_traits<std::vector<int>, int>::value_type {aka int}[int]' for array subscript
   35 |         dist[nx][ny] = dist[cur.first][cur.second]+1;
      |                                       ^
a.cc:43:27: error: invalid types '__gnu_cxx::__alloc_traits<std::vector<int>, int>::value_type {aka int}[int]' for array subscript
   43 |       ans= max(ans,dist[i][j]);
      |                           ^
In file included from /usr/include/c++/14/ext/alloc_traits.h:34,
                 from /usr/include/c++/14/bits/basic_string.h:39,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/alloc_traits.h: In instantiation of 'static void std::allocator_traits< <template-parameter-1-1> >::deallocate(_Alloc&, pointer, size_type) [with _Alloc = std::vector<int>; pointer = int*; size_type = long unsigned int]':
/usr/include/c++/14/bits/stl_vector.h:389:19:   required from 'void std::_Vector_base<_Tp, _Alloc>::_M_deallocate(pointer, std::size_t) [with _Tp = int; _Alloc = std::vector<int>; pointer = int*; std::size_t = long unsigned int]'
  389 |           _Tr::deallocate(_M_impl, __p, __n);
      |           ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:368:2:   required from 'std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = int; _Alloc = std::vector<int>]'
  368 |         _M_deallocate(_M_impl._M_start,
      |         ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:557:47:   required from 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = int; _Alloc = std::vector<int>; size_type = long unsigned int; allocator_type = std::vector<int>]'
  557 |       : _Base(_S_check_init_len(__n, __a), __a)
      |                                               ^
a.cc:15:51:   required from here
   15 |   vector<int,vector<int>> dist(H,vector<int>(W,-1));
      |                                                   ^
/usr/include/c++/14/bits/alloc_traits.h:362:13: error: 'class std::vector<int>' has no member named 'deallocate'; did you mean '_M_allocate'?
  362 |       { __a.deallocate(__p, __n); }
      |         ~~~~^~~~~~~~~~
      |         _M_allocate
/usr/include/c++/14/bits/alloc_traits.h: In instantiation of 'static std::allocator_traits< <template-parameter-1-1> >::pointer std::allocator_traits< <template-parameter-1-1> >::allocate(_Alloc&, size_type) [with _Alloc = std::vector<int>; pointer = int*; size_type = long unsigned int]':
/usr/include/c++/14/bits/stl_vector.h:380:33:   required from 'std::_Vector_base<_Tp, _Alloc>::pointer std::_Vector_base<_Tp, _Alloc>::_M_allocate(std::size_t) [with _Tp = int; _Alloc = std::vector<int>; pointer = int*; std::size_t = long unsigned int]'
  380 |         return __n != 0 ? _Tr::allocate(_M_impl, __n) : pointer();
      |                           ~~~~~~~~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:398:33:   required from 'void std::_Vector_base<_Tp, _Alloc>::_M_create_storage(std::size_t) [with _Tp = int; _Alloc = std::vector<int>; std::size_t = long unsigned int]'
  398 |         this->_M_impl._M_start = this->_M_allocate(__n);
      |                                  ~~~~~~^~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:334:9:   required from 'std::_Vector_base<_Tp, _Alloc>::_Vector_base(std::size_t, const allocator_type&) [with _Tp = int; _Alloc = std::vector<int>; std::size_t = long unsigned int; allocator_type = std::vector<int>]'
  334 |       { _M_create_storage(__n); }
      |         ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:557:47:   required from 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = int; _Alloc = std::vector<int>; size_type = long unsigned int; allocator_type = std::vector<int>]'
  557 |       : _Base(_S_check_init_len(__n, __a), __a)
      |                                               ^
a.cc:15:51:   required from here
   15 |   vector<int,vector<int>> dist(H,vector<int>(W,-1));
      |                                                   ^
/usr/include/c++/14/bits/alloc_traits.h:335:20: error: 'class std::vector<int>' has no member named 'allocate'; did you mean '_M_allocate'?
  335 |       { return __a.allocate(__n); }
      |                ~~~~^~~~~~~~
      |                _M_allocate