Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VVL vector<vector<ll>>
#define ALL(v) (v).begin(), (v).end()
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    ll h,w,k,cnt=1; cin>>h>>w>>k;
    VS data(h); VVL ans(h,VL(w,0));
    rep(i,0,h) cin>>data[i];
    rep(i,0,h)rep(j,0,w)){
        if(j==0){
            if(data[i][j]=='#'){
                ans[i][j]=cnt;
                cnt++;
            }
        }
        else{
            if(data[i][j]=='#'){
                ans[i][j]=cnt;
                cnt++;
            }
            else if(ans[i][j-1]!=0 && ans[i][j]==0){
                ans[i][j]=ans[i][j-1];
            }
        }
    }
    rep(i,0,h)for(ll j=w-1;j>=(ll)(0);j--){
        if(j==w-1) continue;
        if(ans[i][j+1]!=0 && ans[i][j]==0)
        ans[i][j]=ans[i][j+1];
    }
    rep(i,0,w)rep(j,0,h)
        if(j==0) continue;
        if(ans[j-1][i]!=0 && ans[j][i]==0)
        ans[j][i]=ans[j-1][i];
    }
    rep(i,0,w)for(ll j=h-1;j>=(ll)(0);j--){
        if(j==h-1) continue;
        if(ans[j+1][i]!=0 && ans[j][i]==0)
        ans[j][i]=ans[j+1][i];
    }
    rep(i,0,h)rep(j,0,w){
        if(j!=w-1) cout<<ans[i][j]<<" ";
        else cout<<ans[i][j]<<endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:25: error: expected primary-expression before ')' token
   18 |     rep(i,0,h)rep(j,0,w)){
      |                         ^
a.cc:42:16: error: 'j' was not declared in this scope
   42 |         if(ans[j-1][i]!=0 && ans[j][i]==0)
      |                ^
a.cc:42:21: error: 'i' was not declared in this scope
   42 |         if(ans[j-1][i]!=0 && ans[j][i]==0)
      |                     ^
a.cc: At global scope:
a.cc:4:26: error: expected unqualified-id before 'for'
    4 | #define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
      |                          ^~~
a.cc:45:5: note: in expansion of macro 'rep'
   45 |     rep(i,0,w)for(ll j=h-1;j>=(ll)(0);j--){
      |     ^~~
a.cc:45:9: error: 'i' does not name a type
   45 |     rep(i,0,w)for(ll j=h-1;j>=(ll)(0);j--){
      |         ^
a.cc:4:52: note: in definition of macro 'rep'
    4 | #define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
      |                                                    ^
a.cc:45:9: error: 'i' does not name a type
   45 |     rep(i,0,w)for(ll j=h-1;j>=(ll)(0);j--){
      |         ^
a.cc:4:74: note: in definition of macro 'rep'
    4 | #define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
      |                                                                          ^
a.cc:45:28: error: 'j' does not name a type
   45 |     rep(i,0,w)for(ll j=h-1;j>=(ll)(0);j--){
      |                            ^
a.cc:45:39: error: 'j' does not name a type
   45 |     rep(i,0,w)for(ll j=h-1;j>=(ll)(0);j--){
      |                                       ^
a.cc:4:26: error: expected unqualified-id before 'for'
    4 | #define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
      |                          ^~~
a.cc:50:5: note: in expansion of macro 'rep'
   50 |     rep(i,0,h)rep(j,0,w){
      |     ^~~
a.cc:50:9: error: 'i' does not name a type
   50 |     rep(i,0,h)rep(j,0,w){
      |         ^
a.cc:4:52: note: in definition of macro 'rep'
    4 | #define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
      |                                                    ^
a.cc:50:9: error: 'i' does not name a type
   50 |     rep(i,0,h)rep(j,0,w){
      |         ^
a.cc:4:74: note: in definition of macro 'rep'
    4 | #define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
      |                                                                          ^
a.cc:50:19: error: 'j' does not name a type
   50 |     rep(i,0,h)rep(j,0,w){
      |                   ^
a.cc:4:52: note: in definition of macro 'rep'
    4 | #define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
      |                                                    ^
a.cc:50:19: error: 'j' does not name a type
   50 |     rep(i,0,h)rep(j,0,w){
      |                   ^
a.cc:4:74: note: in definition of macro 'rep'
    4 | #define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
      |                                                                          ^
a.cc:54:1: error: expected declaration before '}' token
   54 | }
      | ^