Language: C++

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

inline void PaintMass(vector<vector<int>>& Mass, queue<int,int>& Blacks)
{
	const auto& black = Blacks.front();
	const int h = black.first, w = black.second;
  	
  	// 上下左右を塗る
    if( h > 0 && !Mass[h-1][w]){
    	Mass[h-1][w] = true;
      	Blacks.emplace(h-1, w);
    }
          
    if( w > 0 && !Mass[h][w-1]){
        Mass[h][w-1] = true;
       	Blacks.emplace(h, w-1);
    }
          
    if( h < Mass.size() - 1 && !Mass[h+1][w]){
    	Mass[h+1][w] = true;
       	Blacks.emplace(h+1, w);
    }
          
    if( w < Mass[i].size() - 1 && Mass[h][w+1]){
        Mass[h][w+1] = true;
       	Blacks.emplace(h, w)+1;
    }
  
  	Blacks.pop();
}

int main()
{
 	size_t h,w;
 	cin >> h >> w;
	vector<vector<int>> Mass(h, vector<int>(w));
	queue<pair<int,int>> Blacks;
  
	for(size_t i = 0; i < h; ++ i)
    	for(size_t j = 0; j < w; ++ j)
    	{
        	char col;
        	cin >> col;
      		if(Mass[i][j] = col == '#')
            	Blacks.emplace(i, j);
     	}

  	int Paint = 0;
  	while(!Blacks.empty())
    {
    	size_t cnt = Blacks.size();
      	while(cnt)
        {
    		PaintMass(Mass, Blacks);
        }
      	++ Paint;
    }
  
  	cout << Paint;
	return 0; 
}


Compiler output:
In file included from /usr/include/c++/14/queue:66,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_queue.h: In instantiation of 'class std::queue<int, int>':
a.cc:8:28:   required from here
    8 |         const auto& black = Blacks.front();
      |                                   ^
/usr/include/c++/14/bits/stl_queue.h:132:67: error: 'int' is not a class, struct, or union type
  132 |       static_assert(is_same<_Tp, typename _Sequence::value_type>::value,
      |                                                                   ^~~~~
/usr/include/c++/14/bits/stl_queue.h:138:57: error: 'int' is not a class, struct, or union type
  138 |       typedef typename  _Sequence::value_type           value_type;
      |                                                         ^~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:139:57: error: 'int' is not a class, struct, or union type
  139 |       typedef typename  _Sequence::reference            reference;
      |                                                         ^~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:140:57: error: 'int' is not a class, struct, or union type
  140 |       typedef typename  _Sequence::const_reference      const_reference;
      |                                                         ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:141:57: error: 'int' is not a class, struct, or union type
  141 |       typedef typename  _Sequence::size_type            size_type;
      |                                                         ^~~~~~~~~
a.cc: In function 'void PaintMass(std::vector<std::vector<int> >&, std::queue<int, int>&)':
a.cc:8:36: error: 'class std::queue<int, int>' has no member named 'front'
    8 |         const auto& black = Blacks.front();
      |                                    ^~~~~
a.cc:12:29: error: 'w' was not declared in this scope
   12 |     if( h > 0 && !Mass[h-1][w]){
      |                             ^
a.cc:17:9: error: 'w' was not declared in this scope
   17 |     if( w > 0 && !Mass[h][w-1]){
      |         ^
a.cc:22:43: error: 'w' was not declared in this scope
   22 |     if( h < Mass.size() - 1 && !Mass[h+1][w]){
      |                                           ^
a.cc:27:9: error: 'w' was not declared in this scope
   27 |     if( w < Mass[i].size() - 1 && Mass[h][w+1]){
      |         ^
a.cc:27:18: error: 'i' was not declared in this scope
   27 |     if( w < Mass[i].size() - 1 && Mass[h][w+1]){
      |                  ^
a.cc: In function 'int main()':
a.cc:57:33: error: invalid initialization of reference of type 'std::queue<int, int>&' from expression of type 'std::queue<std::pair<int, int> >'
   57 |                 PaintMass(Mass, Blacks);
      |                                 ^~~~~~
a.cc:6:66: note: in passing argument 2 of 'void PaintMass(std::vector<std::vector<int> >&, std::queue<int, int>&)'
    6 | inline void PaintMass(vector<vector<int>>& Mass, queue<int,int>& Blacks)
      |                                                  ~~~~~~~~~~~~~~~~^~~~~~