Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;++i)
typedef long long ll;

int main(){
  int h,w,k;
  cin >> h >> w >> k;
  vector<vector<str>> A(h)(w);
  rep(i,h){
    rep(j,w){
      cin >> A[i][j];
    }
  }
  rep(i,h){
    rep(j,w){
      if(A[i][j] == "#"){
        if(A[i][j-1] == ".") A[i][j-1] = str(k);
        if(A[i][j+1] == ".") A[i][j+1] = str(k);
        if(A[i-1][j] == ".") A[i-1][j] = str(k);
        if(A[i+1][j] == ".") A[i+1][j] = str(k);
        if(A[i][j-1]) == "." && A[i-1][j] == ".") A[i-1][j-1] = str(k);
        if(A[i-1][j]) == "." && A[i][j+1] == ".") A[i-1][j+1] = str(k);
        if(A[i][j+1]) == "." && A[i+1][j] == ".") A[i+1][j+1] = str(k);
        if(A[i+1][j]) == "." && A[i][j-1] == ".") A[i+1][j-1] = str(k);
        k--
      }
    }
  }
  rep(i,h){
    rep(j,w){
      cout << A[i][j];
    }
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:17: error: 'str' was not declared in this scope; did you mean 'std'?
    9 |   vector<vector<str>> A(h)(w);
      |                 ^~~
      |                 std
a.cc:9:17: error: template argument 1 is invalid
a.cc:9:17: error: template argument 2 is invalid
a.cc:9:20: error: template argument 1 is invalid
    9 |   vector<vector<str>> A(h)(w);
      |                    ^~
a.cc:9:20: error: template argument 2 is invalid
a.cc:9:27: error: expected ',' or ';' before '(' token
    9 |   vector<vector<str>> A(h)(w);
      |                           ^
a.cc:12:15: error: invalid types 'int[int]' for array subscript
   12 |       cin >> A[i][j];
      |               ^
a.cc:17:11: error: invalid types 'int[int]' for array subscript
   17 |       if(A[i][j] == "#"){
      |           ^
a.cc:18:13: error: invalid types 'int[int]' for array subscript
   18 |         if(A[i][j-1] == ".") A[i][j-1] = str(k);
      |             ^
a.cc:18:31: error: invalid types 'int[int]' for array subscript
   18 |         if(A[i][j-1] == ".") A[i][j-1] = str(k);
      |                               ^
a.cc:19:13: error: invalid types 'int[int]' for array subscript
   19 |         if(A[i][j+1] == ".") A[i][j+1] = str(k);
      |             ^
a.cc:19:31: error: invalid types 'int[int]' for array subscript
   19 |         if(A[i][j+1] == ".") A[i][j+1] = str(k);
      |                               ^
a.cc:20:13: error: invalid types 'int[int]' for array subscript
   20 |         if(A[i-1][j] == ".") A[i-1][j] = str(k);
      |             ^
a.cc:20:31: error: invalid types 'int[int]' for array subscript
   20 |         if(A[i-1][j] == ".") A[i-1][j] = str(k);
      |                               ^
a.cc:21:13: error: invalid types 'int[int]' for array subscript
   21 |         if(A[i+1][j] == ".") A[i+1][j] = str(k);
      |             ^
a.cc:21:31: error: invalid types 'int[int]' for array subscript
   21 |         if(A[i+1][j] == ".") A[i+1][j] = str(k);
      |                               ^
a.cc:22:13: error: invalid types 'int[int]' for array subscript
   22 |         if(A[i][j-1]) == "." && A[i-1][j] == ".") A[i-1][j-1] = str(k);
      |             ^
a.cc:22:23: error: expected primary-expression before '==' token
   22 |         if(A[i][j-1]) == "." && A[i-1][j] == ".") A[i-1][j-1] = str(k);
      |                       ^~
a.cc:22:34: error: invalid types 'int[int]' for array subscript
   22 |         if(A[i][j-1]) == "." && A[i-1][j] == ".") A[i-1][j-1] = str(k);
      |                                  ^
a.cc:23:13: error: invalid types 'int[int]' for array subscript
   23 |         if(A[i-1][j]) == "." && A[i][j+1] == ".") A[i-1][j+1] = str(k);
      |             ^
a.cc:23:23: error: expected primary-expression before '==' token
   23 |         if(A[i-1][j]) == "." && A[i][j+1] == ".") A[i-1][j+1] = str(k);
      |                       ^~
a.cc:23:34: error: invalid types 'int[int]' for array subscript
   23 |         if(A[i-1][j]) == "." && A[i][j+1] == ".") A[i-1][j+1] = str(k);
      |                                  ^
a.cc:24:13: error: invalid types 'int[int]' for array subscript
   24 |         if(A[i][j+1]) == "." && A[i+1][j] == ".") A[i+1][j+1] = str(k);
      |             ^
a.cc:24:23: error: expected primary-expression before '==' token
   24 |         if(A[i][j+1]) == "." && A[i+1][j] == ".") A[i+1][j+1] = str(k);
      |                       ^~
a.cc:24:34: error: invalid types 'int[int]' for array subscript
   24 |         if(A[i][j+1]) == "." && A[i+1][j] == ".") A[i+1][j+1] = str(k);
      |                                  ^
a.cc:25:13: error: invalid types 'int[int]' for array subscript
   25 |         if(A[i+1][j]) == "." && A[i][j-1] == ".") A[i+1][j-1] = str(k);
      |             ^
a.cc:25:23: error: expected primary-expression before '==' token
   25 |         if(A[i+1][j]) == "." && A[i][j-1] == ".") A[i+1][j-1] = str(k);
      |                       ^~
a.cc:25:34: error: invalid types 'int[int]' for array subscript
   25 |         if(A[i+1][j]) == "." && A[i][j-1] == ".") A[i+1][j-1] = str(k);
      |                                  ^
a.cc:26:12: error: expected ';' before '}' token
   26 |         k--
      |            ^
      |            ;
   27 |       }
      |       ~     
a.cc:32:16: error: invalid types 'int[int]' for array subscript
   32 |       cout << A[i][j];
      |                ^