Language: C++

//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
 
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
//using namespace __gnu_pbds;

#define pb push_back
#define pp pop_back
#define F first
#define S second
#define endl "\n"
#define ll long long                                                 
#define ld long double	
#define lb lower_bound
#define ub upper_bound

//template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;

void INeedIT() {ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);}

int c[5000][5000];
vector < pii > v; 

int main () {
	INeedIT();
	int h, w, k;
	cin >> h >> w >> k;
	for (int i = 1; i <= h; i++) {
		string s;
		cin >> s;
		for (int j = 0; j < w; j++) {
			if (s[j] == '#') {
				c[i][j + 1]=k;
				k--;
				v.pb({i, j + 1});
			}
			else {
				c[i][j+1]=0;
			}
		}
	}
	for (int i=0;i<v.size();i++) {
		for (int x = v[i].S + 1;x <= w; x++) {
			if (c[v[i].F][x] != 0) {
				break;
			}
			else {
				c[v[i].F][x] = c[v[i].F][v[i].S];
			}
		}
	}
	for (int i=0;i<v.size();i++) {
		for (int x = v[i].S - 1;x >= 1; x--) {
			if (c[v[i].F][x] != 0) {
				break;
			}
			else {
				c[v[i].F][x] = c[v[i].F][v[i].S];
			}
		}
	}
	for (int i=0;i<v.size();i++) {
		for (int y = v[i].F + 1; y <= h; y++) {
			if (c[y][v[i].S] != 0) {
				break;
			}
			else {
				c[y][v[i].S] = c[v[i].F][v[i].S];
			}
		}
	}
	for (int i=0;i<v.size();i++) {
		for (int y = v[i].F - 1; y >= 1; y--) {
			if (c[y][v[i].S] != 0) {
				break;
			}
			else {
				c[y][v[i].S] = c[v[i].F][v[i].S];
			}
		}
	}
	for (int i=1;i<=h;i++) {
		for (int j=1;j<=w;j++) {
			cout<<c[i][j];
		}
		cout<<endl;
	}
	return 0;
}	

Compiler output:
a.cc:27:10: error: 'pii' was not declared in this scope
   27 | vector < pii > v;
      |          ^~~
a.cc:27:14: error: template argument 1 is invalid
   27 | vector < pii > v;
      |              ^
a.cc:27:14: error: template argument 2 is invalid
a.cc: In function 'int main()':
a.cc:12:12: error: request for member 'push_back' in 'v', which is of non-class type 'int'
   12 | #define pb push_back
      |            ^~~~~~~~~
a.cc:40:35: note: in expansion of macro 'pb'
   40 |                                 v.pb({i, j + 1});
      |                                   ^~
a.cc:47:26: error: request for member 'size' in 'v', which is of non-class type 'int'
   47 |         for (int i=0;i<v.size();i++) {
      |                          ^~~~
a.cc:48:31: error: invalid types 'int[int]' for array subscript
   48 |                 for (int x = v[i].S + 1;x <= w; x++) {
      |                               ^
a.cc:49:32: error: invalid types 'int[int]' for array subscript
   49 |                         if (c[v[i].F][x] != 0) {
      |                                ^
a.cc:53:36: error: invalid types 'int[int]' for array subscript
   53 |                                 c[v[i].F][x] = c[v[i].F][v[i].S];
      |                                    ^
a.cc:53:51: error: invalid types 'int[int]' for array subscript
   53 |                                 c[v[i].F][x] = c[v[i].F][v[i].S];
      |                                                   ^
a.cc:53:59: error: invalid types 'int[int]' for array subscript
   53 |                                 c[v[i].F][x] = c[v[i].F][v[i].S];
      |                                                           ^
a.cc:57:26: error: request for member 'size' in 'v', which is of non-class type 'int'
   57 |         for (int i=0;i<v.size();i++) {
      |                          ^~~~
a.cc:58:31: error: invalid types 'int[int]' for array subscript
   58 |                 for (int x = v[i].S - 1;x >= 1; x--) {
      |                               ^
a.cc:59:32: error: invalid types 'int[int]' for array subscript
   59 |                         if (c[v[i].F][x] != 0) {
      |                                ^
a.cc:63:36: error: invalid types 'int[int]' for array subscript
   63 |                                 c[v[i].F][x] = c[v[i].F][v[i].S];
      |                                    ^
a.cc:63:51: error: invalid types 'int[int]' for array subscript
   63 |                                 c[v[i].F][x] = c[v[i].F][v[i].S];
      |                                                   ^
a.cc:63:59: error: invalid types 'int[int]' for array subscript
   63 |                                 c[v[i].F][x] = c[v[i].F][v[i].S];
      |                                                           ^
a.cc:67:26: error: request for member 'size' in 'v', which is of non-class type 'int'
   67 |         for (int i=0;i<v.size();i++) {
      |                          ^~~~
a.cc:68:31: error: invalid types 'int[int]' for array subscript
   68 |                 for (int y = v[i].F + 1; y <= h; y++) {
      |                               ^
a.cc:69:35: error: invalid types 'int[int]' for array subscript
   69 |                         if (c[y][v[i].S] != 0) {
      |                                   ^
a.cc:73:39: error: invalid types 'int[int]' for array subscript
   73 |                                 c[y][v[i].S] = c[v[i].F][v[i].S];
      |                                       ^
a.cc:73:51: error: invalid types 'int[int]' for array subscript
   73 |                                 c[y][v[i].S] = c[v[i].F][v[i].S];
      |                                                   ^
a.cc:73:59: error: invalid types 'int[int]' for array subscript
   73 |                                 c[y][v[i].S] = c[v[i].F][v[i].S];
      |                                                           ^
a.cc:77:26: error: request for member 'size' in 'v', which is of non-class type 'int'
   77 |         for (int i=0;i<v.size();i++) {
      |                          ^~~~
a.cc:78:31: error: invalid types 'int[int]' for array subscript
   78 |                 for (int y = v[i].F - 1; y >= 1; y--) {
      |                               ^
a.cc:79:35: error: invalid types 'int[int]' for array subscript
   79 |                         if (c[y][v[i].S] != 0) {
      |                                   ^
a.cc:83:39: error: invalid types 'int[int]' for array subscript
   83 |                                 c[y][v[i].S] = c[v[i].F][v[i].S];
      |                                       ^
a.cc:83:51: error: invalid types 'int[int]' for array subscript
   83 |                                 c[y][v[i].S] = c[v[i].F][v[i].S];
      |                                                   ^
a.cc:83:59: error: invalid types 'int[int]' for array subscript
   83 |                                 c[y][v[i].S] = c[v[i].F][v[i].S];
      |                                                           ^