Language: C++

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

#define fi first
#define se second

int x[4]={ 0,0,-1,1};
int y[4]={-1,1,0,0};

int h,w,k;
char a[300][300];
int b[300][300];
bool V[300][300];
vector<pair<int,int>>f;
queue<pait<int,int>>Q;

void bfs(int i, int j, int c){
	v[i][j]=1;
	b[i][j] = c;
	Q.push({i,j});
	pair<int,int> u;
	int nx,ny;
	while(!Q.empty()){
		u = Q.front();
		Q.pop();
		
		for(int l=0;l<4;l++){
			nx = u.fi+x[l];
			ny = u.se+y[l];
			if(nx<0 || ny<0 || nx == h || ny == w || a[nx][ny]=='#')continue;
			if(!V[nx][ny]){
				V[nx][ny]=1;
				b[nx][ny]=c;
				Q.push({nx,ny});
			}
		}
	}
}

int main(){
	cin>>h>>w>>k;
	
	f.resize(k);
	
	for(int i=0,c=0;i<h;i++)
		for(int j=0;j<w;j++){
			cin>>a[i][j];
			if(a[i][j]=='#'){
				f[c]=({i,j});
				c++;
			}
		}
	
	for(int i=0;i<k;i++){
		memset(v,0,sizeof v);
		bfs(f[i].fi,f[i],se,i+1);
	}
	
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++)cout<<b[i][j]<<' ';
		cout<<'\n';
	}
}

Compiler output:
a.cc:15:7: error: 'pait' was not declared in this scope
   15 | queue<pait<int,int>>Q;
      |       ^~~~
a.cc:15:19: error: template argument 1 is invalid
   15 | queue<pait<int,int>>Q;
      |                   ^~
a.cc:15:19: error: template argument 2 is invalid
a.cc: In function 'void bfs(int, int, int)':
a.cc:18:9: error: 'v' was not declared in this scope
   18 |         v[i][j]=1;
      |         ^
a.cc:20:11: error: request for member 'push' in 'Q', which is of non-class type 'int'
   20 |         Q.push({i,j});
      |           ^~~~
a.cc:23:18: error: request for member 'empty' in 'Q', which is of non-class type 'int'
   23 |         while(!Q.empty()){
      |                  ^~~~~
a.cc:24:23: error: request for member 'front' in 'Q', which is of non-class type 'int'
   24 |                 u = Q.front();
      |                       ^~~~~
a.cc:25:19: error: request for member 'pop' in 'Q', which is of non-class type 'int'
   25 |                 Q.pop();
      |                   ^~~
a.cc:34:35: error: request for member 'push' in 'Q', which is of non-class type 'int'
   34 |                                 Q.push({nx,ny});
      |                                   ^~~~
a.cc: In function 'int main()':
a.cc:49:43: error: expected ';' before '}' token
   49 |                                 f[c]=({i,j});
      |                                           ^
      |                                           ;
a.cc:49:44: error: no match for 'operator=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} and 'int')
   49 |                                 f[c]=({i,j});
      |                                            ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_pair.h:946:9: note: candidate: 'template<class _U1, class _U2> typename std::enable_if<std::__and_<std::is_assignable<_T1&, const _U1&>, std::is_assignable<_T2&, const _U2&> >::value, std::pair<_T1, _T2>&>::type std::pair<_T1, _T2>::operator=(const std::pair<_U1, _U2>&) [with _U2 = _U1; _T1 = int; _T2 = int]'
  946 |         operator=(const pair<_U1, _U2>& __p)
      |         ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:946:9: note:   template argument deduction/substitution failed:
a.cc:49:44: note:   mismatched types 'const std::pair<_T1, _T2>' and 'int'
   49 |                                 f[c]=({i,j});
      |                                            ^
/usr/include/c++/14/bits/stl_pair.h:957:9: note: candidate: 'template<class _U1, class _U2> typename std::enable_if<std::__and_<std::is_assignable<_T1&, _U1&&>, std::is_assignable<_T2&, _U2&&> >::value, std::pair<_T1, _T2>&>::type std::pair<_T1, _T2>::operator=(std::pair<_U1, _U2>&&) [with _U2 = _U1; _T1 = int; _T2 = int]'
  957 |         operator=(pair<_U1, _U2>&& __p)
      |         ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:957:9: note:   template argument deduction/substitution failed:
a.cc:49:44: note:   mismatched types 'std::pair<_T1, _T2>' and 'int'
   49 |                                 f[c]=({i,j});
      |                                            ^
/usr/include/c++/14/bits/stl_pair.h:921:7: note: candidate: 'std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(std::__conditional_t<((bool)std::__and_<std::is_copy_assignable<_T1>, std::is_copy_assignable<_T2> >::value), const std::pair<_T1, _T2>&, const std::__nonesuch&>) [with _T1 = int; _T2 = int; std::__conditional_t<((bool)std::__and_<std::is_copy_assignable<_T1>, std::is_copy_assignable<_T2> >::value), const std::pair<_T1, _T2>&, const std::__nonesuch&> = const std::pair<int, int>&]'
  921 |       operator=(__conditional_t<__and_<is_copy_assignable<_T1>,
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:923:65: note:   no known conversion for argument 1 from 'int' to 'std::__conditional_t<true, const std::pair<int, int>&, const std::__nonesuch&>' {aka 'const std::pair<int, int>&'}
  921 |       operator=(__conditional_t<__and_<is_copy_assignable<_T1>,
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
  922 |                                        is_copy_assignable<_T2>>::value,
      |                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  923 |                                 const pair&, const __nonesuch&> __p)
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_pair.h:931:7: note: candidate: 'std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(std::__conditional_t<((bool)std::__and_<std::is_move_assignable<_Tp>, std::is_move_assignable<_T2> >::value), std::pair<_T1, _T2>&&, std::__nonesuch&&>) [with _T1 = int; _T2 = int; std::__conditional_t<((bool)std::__and_<std::is_move_assignable<_Tp>, std::is_move_assignable<_T2> >::value), std::pair<_T1, _T2>&&, std::__nonesuch&&> = std::pair<int, int>&&]'
  931 |       operator=(__conditional_t<__and_<is_move_assignable<_T1>,
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:933:55: note:   no known conversion for argument 1 from 'int' to 'std::__conditional_t<true, std::pair<int, int>&&, std::__nonesuch&&>' {aka 'std::pair<int, int>&&'}
  931 |       operator=(__conditional_t<__and_<is_move_assignable<_T1>,
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  932 |                                        is_move_assignable<_T2>>::value,
      |                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  933 |                                 pair&&, __nonesuch&&> __p)
      |                                 ~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:55:24: error: 'v' was not declared in this scope
   55 |                 memset(v,0,sizeof v);
      |                        ^
a.cc:5:12: error: 'second' was not declared in this scope
    5 | #define se second
      |            ^~~~~~
a.cc:56:34: note: in expansion of macro 'se'
   56 |                 bfs(f[i].fi,f[i],se,i+1);
      |                                  ^~