criyle/codenet-compile-errors huggingface dataset:
Language: C++

 #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <iomanip>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << endl
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
int dx8[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy8[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int dx4[4] = {1, 0, -1, 0};
int dy4[4] = {0, 1, 0, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){ fill((T*)array, (T*)(array+N), val); }
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;



int main(void) {
   int H,W,K;
   cin >> H >> W >> K;
   vvi G(H,vi(W,0));

   string S[310];
   rep(i,H){
       cin >>s[i];
   }

   int strawBerryCount=1;
   rep(i,H){
       rep(j,W){
        
        if(G[i][j] != 0){
           G[i][j] = strawBerryCount;
           strawBerryCount++;
        }
    };
   }
    
    //4方向に累積和みたいなことをしていく
    //→
    rep(i,H){
        rep(j,W-1){
            if(G[i][j] != 0){
                G[i][j+1] = G[i][j];
            }
        }
    }
    //←
    rep(i,H){
        for(int j=W-1;j=1;j--){
            if(G[i][j] != 0){
                G[i][j-1] = G[i][j];
            }
        }
    }
    //↓
    rep(j,W){
        rep(i,H-1){
            if(G[i][j] != 0){
                G[i+1][j] = G[i][j];
            }
        }
    }
    //↑
    rep(j,W){
        for(int i=H-1;i=1;i--){
            if(G[i][j] != 0){
                G[i-1][j] = G[i][j];
            }
        }      
    }

    rep(i,H){
        rep(j,W){
            cout << G[i][j]<< " ";
        }
        cout<<endl;
    }
    
    
    

}

Compiler output:
a.cc: In function 'int main()':
a.cc:69:14: error: 's' was not declared in this scope
   69 |        cin >>s[i];
      |              ^
Language: C++

#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60;
const ll mod=1000003 ;

int main(){
  int h,w,k;
  cin >> h >> w >> k;
  char c[h][w];
  rep(i,h)rep(j,w)cin >> c[i][j];
  int a[h][w]={};
  bool flag[h]={};
  rep(i,h){
    int cnt=0;
    vector<int> pos;
    rep(j,w){
      if(c[i][j]=='#'){
        cnt++;
        pos.push_back(j);
      }
    }
    if(cnt>0){
      int kk=pos.size();
      rep(j,kk-1){
        REP(k,pos[j]+1,w){
          a[i][k]++;
        }
      }
    }else flag[i]=true;
  }
  int p[h][w]={};
  int num=0;
  rep(i,h){
    if(!flag[i]){
      rep(j,w){
        p[i][j]=a[i][j]+num+1;
      }
      num=p[i][w-1];
    }
  }
  if(flag[0]){
    p[0][j]=1;
  }
  rep(i,h){
    if(flag[i]){
      if(i>0){
        rep(j,w)p[i][j]=p[i-1][j];
      }
    }
  }
  rep(i,h){
    rep(j,w)cout << p[i][j] << ' ';
    cout << endl;
  }
return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:61:10: error: 'j' was not declared in this scope
   61 |     p[0][j]=1;
      |          ^
Language: C++

import numpy as np

h, w, k = map(int, input().split())

cake = np.zeros((h, w))

for i in range(h):
    inputline = input()
    for j in range(w):
        if inputline[j] == ".":
            cake[i][j] = 0
        else:
            cake[i][j] = 1

s = np.sum(cake, axis=1)
first = 0
for i in range(h):
    if s[i]:
        first = i
        break

ans = np.zeros((h, w), dtype=np.uint8)
num = 1

for i in range(h):
    flag = 0
    if not s[i]:
        continue
    for j in range(w):
        if cake[i][j] and flag:
            num += 1
        elif cake[i][j]:
            flag += 1
        ans[i][j] = num
    num += 1

for i in range(h):
    if s[i] == 0 and i == 0:
        ans[i] = ans[first]
    elif s[i] == 0:
        ans[i] = ans[i-1]

for i in range(h):
    print(' '.join(map(str, ans[i])))


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import numpy as np
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
const long long INF = 1LL << 60;
const int MOD = 1000000007;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
signed main(void){
    int h,w,k; cin>>h>>w>>k;
    vector <vector<char>> cake(h,vector <char>(w));
    rep(i,h){
        rep(j,w){
            cin>>cake[i][j];
        }
    }
    
    int now = 1;
    bool stop = false;
    rep(i,h){
        rep(j, w){
            if(stop) break;
            ans[i][j] = now;
            if(cake[i][j] == '#') now++;
            if(now > k) {
                stop = true;
                for(int l = j;l<w;l++){
                    ans[i][l] = now-1;
                }
                break;
            }
        }
        if(stop) break;
    }
    rep(i,h){
        if(i == 0) continue;
        rep(j,h){
            if(!ans[i][j]){
                ans[i][j] = ans[i-1][j];
            }
        }
    }
    rep(i,h){
        rep(j,w){
            cout<<ans[i][j]<<' ';
        }
        cout<<endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   28 |             ans[i][j] = now;
      |             ^~~
      |             abs
a.cc:43:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   43 |             if(!ans[i][j]){
      |                 ^~~
      |                 abs
a.cc:50:19: error: 'ans' was not declared in this scope; did you mean 'abs'?
   50 |             cout<<ans[i][j]<<' ';
      |                   ^~~
      |                   abs
Language: C++

#include <bits/stdc++.h>
using namespace std;
int w,h,k;
int A[309][309];
int num;
int cnt[309];
char c[309][309];
void solve(int l,int r) //砍列 
{
	vector <int> P;	//哪一列有草莓 
	for(int i=l; i<=r; i++)
	{
		for(int j=1; j<=w; j++)
		{
			if(c[i][j]=='#')	P.push_back(j);
		}
	}
	sort(P.begin(), P.end());
	for(int i=0; i<P.size(); i++)
	{
		int v1=1, v2=w;
		if(i>=1) v1=P[i-1]+1;
		if(i<(int)P.size()-1) v2=P[i];
		num++;
		for(int j=l; j<=r; j++)
		{
			for(int k=v1; k<=v2; k++)
			{
				A[j][k]=num;
			}
		}
	}
}
int main()
{
	vector <int> vec;
	cin>>h>>w>>k;
	for(int i=1; i<=h; i++)
	{
		for(int j=1; j<=w; j++)
		{
			cin>>c[i][j];
			if(c[i][j]=='#') cnt[i]++;
		}
	} 
	for(int i=1; i<=h; i++)
	{
		if(cnt[i]>=1) vec.push_back(i);
	}
	for(int i=0; i<vec.size(); i++)
	{
		int v1=1, v2=h;
		if(i>=1) v1=vec[i-1]+1;
		if(i<(int)vec.size()-1) v2=vec[i];
		solve(v1, v2);
	}
	for(int i=1; i<=h; i++)
	{
		for(int j=1; j<=w; j++)
		{
			if(j>=2) cout<<" "; cout<<A[i][j];
		}
		cout<<endl;
	}
	return 0;


Compiler output:
a.cc: In function 'int main()':
a.cc:65:18: error: expected '}' at end of input
   65 |         return 0;
      |                  ^
a.cc:35:1: note: to match this '{'
   35 | {
      | ^
Language: C++

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

int main() {
  ll h,w,k,kind=1;
  char s;
  cin >> h >> w >> k;
  vector<vector<ll>>a(h,vector<ll>(w));
  rep(i,h) rep(j,w){
  	cin >> s;
  	if(s=='#') { 
  		a.at(i).at(j)=kind;
  		kind++;
  	}
  }
  rep(i,h){
  	ll ind=0;
  	rep(j,w){
  		if(a.at(i).at(j)!=0){
  			for(ll k=ind;k<j;k++) a.at(i).at(k)=a.at(i).at(j);
  			ind=j+1;
  		}
  		else if(j==w-1){ for(ll k=max((ll)0,ind-1);k<w;k++) a.at(i).at(k)=a.at(i).at(max((ll)0,ind-1));
  		}
  	}
  }
  rep(i,h){
  	rep(j,w){
  		if(a.at(i).at(j)==0 && i!=0) a.at(i).at(j)=a.at(i-1).at(j);
  	}
  }
    rep(i,h){
  	rep(j,w){
  		if(a.at(n-1-i).at(j)==0 && n-1-i!=n-1) a.at(n-1-i).at(j)=a.at(n-2-i).at(j);
  	}
  }
  rep(i,h){
  	rep(j,w) cout << a.at(i).at(j);
  	cout << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:25: error: 'n' was not declared in this scope
   37 |                 if(a.at(n-1-i).at(j)==0 && n-1-i!=n-1) a.at(n-1-i).at(j)=a.at(n-2-i).at(j);
      |                         ^
Language: C++

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

int main(){
  ll n;
  cin >> n;
  vector<string> a(n);
  for(auto& i : a) cin >> i;
  ll cnt = 0;
  vector<vector<ll>> ans(h, vector<ll>(w));
  for(ll i = 0; i < h; i++) for(ll j = 0; j < w; j++) if(a[i][j] == '#'){
    ans[i][j] = ++cnt;
  }
  for(ll i = 0; i < h; i++) for(ll j = w - 2; j >= 0; j--) if(!ans[i][j]){
    ans[i][j] = ans[i][j + 1];
  }
  for(ll i = 0; i < h; i++) for(ll j = 1; j < w; j++) if(!ans[i][j]){
    ans[i][j] = ans[i][j - 1];
  }
  for(ll j = 0; j < w; j++) for(ll i = h - 2; i >= 0; i--) if(!ans[i][j]){
    ans[i][j] = ans[i + 1][j];
  }
  for(ll j = 0; j < w; j++) for(ll i = 1; i < h; i++) if(!ans[i][j]){
    ans[i][j] = ans[i - 1][j];
  }
  for(ll i = 0; i < h; i++){
    cout << ans[i][0];
    for(ll j = 1; j < w; j++) cout << ' ' << ans[i][j];
    cout << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:26: error: 'h' was not declared in this scope
   11 |   vector<vector<ll>> ans(h, vector<ll>(w));
      |                          ^
a.cc:11:40: error: 'w' was not declared in this scope
   11 |   vector<vector<ll>> ans(h, vector<ll>(w));
      |                                        ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

int s[300][300];

void color_s(int wp_l, int hp_u, int wp_r, int hp_d, int num){
  for(int i = hp_u; i < hp_d; i++){
    for (int j = wp_l; j < wp_r; j++){
      s[i][j] = num;
    }
  }
  return;
}

int main(){
  for(int i = 0; i < 300; i++){
    for (int j = 0; j < 300; j++){
      s[i][j] = 0;
    }
  }

  int h, w, k;
  cin >> h >> w >> k;
  cin.ignore();
  char tmp_s;
  int num = 1;
  for (int i = 0; i < h; i++){
    for (int j = 0; j < w; j++){
      cin >> tmp_s;
      if(tmp_s == '#'){
        s[i][j] = num;
        ++num;
      }
    }
    cin.ignore();
  }


  bool first_found = false;

  int wp_l = 0, hp_u = 0;
  int wp_r = 1, hp_d = 1;

  int tmp_num = 1;
  for (int i = 0; i < h; i++){
    colored = false;
    wp_l = 0;
    for(int j = 0; j < w; j++){
      if(s[i][j] != 0){
        tmp_num = s[i][j];
        color_s(wp_l, hp_u, j + 1, i + 1, tmp_num);
        wp_l = j + 1;
        colored = true;
      } else if ((j == w - 1) && (colored == true)){ // 最終列の場合かつ塗が出た場合、それまでで塗りつぶす
        color_s(wp_l, hp_u, w, i + 1, tmp_num);
      }
    }
    if(colored == true){
      hp_u = i + 1;
    }
  }

  // 今度は下から探る
  bool all_zero = true;
  for(int j = 0; j < w; j++){
    if(s[h-1][j] != 0) all_zero = false;
  }
  if(all_zero == false){
    goto L_END;
  }
  for(int i = h - 2; i >= 0; i--){
    if(s[i][0] == 0) continue;
    else tmp_s = s[i][0];
    wp_l = 0;
    for(int j = 1; j < w; j++){
      if(s[i][j] != tmp_s){
        color_s(wp_l, i + 1, j, h, tmp_num);
        tmp_num = s[i][j];
        wp_l = j;
        if(j == w - 1) goto L_END;
      } else if (j == w - 1){ // 最終列の場合かつ塗が出た場合、それまでで塗りつぶす
        color_s(wp_l, i + 1, w, h, tmp_num);
        goto L_END;
      }
    }
  }

L_END:
  for (int i = 0; i < h; i++){
    for (int j = 0; j < w; j++){
      printf("%3d ", s[i][j]);
    }
    cout << endl;
  }

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:47:5: error: 'colored' was not declared in this scope; did you mean 'color_s'?
   47 |     colored = false;
      |     ^~~~~~~
      |     color_s
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  ios::sync_with_stdio(false);
  cin.tie(0);
 
  int H, W, K;
  cin >> H >> W >> K;
  vector<vector<char>> cake(H, vector<char>(W, 0));
  vector<int> check(H, 0);
  for (int i = 0; i < H; i++) 
    for (int j = 0; j < W; j++) {
      cin >> cake[i][j];
      if (cake[i][j] == '#') ++check[i];
  }
  vector<vector<int>> ans(H, vector<int>(W, 0));
  int count = 1;
  for (int i = 0; i < H; i++) {
    if (check[i] == 0) {
        check[i] = -1;
        continue;
    }
    for (int j = 0; j < W; j++) {
      if (check[i] != 0) ans[i][j] = count;
      else ans[i][j] = count - 1;
      if (cake[i][j] == '#') {
        --check[i];
        ++count;
    }
  }
  }
  for (int i = 1; i < H; i++) 
    if (check[i] == -1)
      for (int j = 0; j < W; j++) 
        ans[i][j] = ans[i - 1][j];

  for (int i = H - 2; i >= 0; i--) 
    if (check[i] == -1) 
      for (int j = 0; j < W; j++) a
        ans[i][j] = ans[i + 1][j];

  for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
          cout << ans[i][j] << ' ';
      }
      cout << '\n';
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:35: error: 'a' was not declared in this scope
   41 |       for (int j = 0; j < W; j++) a
      |                                   ^
Language: C++

// C - Strawberry Cakes
#include <bits/stdc++.h>

using namespace std;

int main(int argc, char *argv[])
{
	ios::sync_with_stdio(false); cin.tie(0);
	int H, W, K;
	cin >> H >> W >> K;
	vector<string> s(H);
	for (int i = 0; i < H; i++) cin >> s[i];
	vector<vector<int> > ans(H, vector<int>(W));
	int no = 1;
	for (int i = 0; i < H; i++) {
		int c = 0;
		for (int j = 0; j < W; j++)
			if (s[i][j] == '#') c++;
		if (c == 0) {
			if (i > 0 && a[i - 1][0] != 0)
				for (int j = 0; j < W; j++) ans[i][j] = ans[i - 1][j];
			continue;
		}
		for (int j = 0, k = 0; j < W; j++) {
			ans[i][j] = no + min(k, c - 1);
			if (s[i][j] == '#') k++;
		}
		no += c;
		if (i > 0 && a[i - 1][j] == 0)
			for (int j = 0; j < W; j++) ans[i - 1][j] = ans[i][j];
	}

	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) cout << (j ? " " : "") << ans[i][j];
		cout << endl;
	}

	return 0;
}


Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:20:38: error: 'a' was not declared in this scope
   20 |                         if (i > 0 && a[i - 1][0] != 0)
      |                                      ^
a.cc:29:30: error: 'a' was not declared in this scope
   29 |                 if (i > 0 && a[i - 1][j] == 0)
      |                              ^
a.cc:29:39: error: 'j' was not declared in this scope
   29 |                 if (i > 0 && a[i - 1][j] == 0)
      |                                       ^
Language: C++

n#include <bits/stdc++.h>

using namespace std;

int s[300][300];

void color_s(int wp_l, int hp_u, int wp_r, int hp_d, int num){
  for(int i = hp_u; i < hp_d; i++){
    for (int j = wp_l; j < wp_r; j++){
      s[i][j] = num;
    }
  }
  return;
}

int main(){
  for(int i = 0; i < 300; i++){
    for (int j = 0; j < 300; j++){
      s[i][j] = 0;
    }
  }

  int h, w, k;
  cin >> h >> w >> k;
  cin.ignore();
  char tmp_s;
  int num = 1;
  for (int i = 0; i < h; i++){
    for (int j = 0; j < w; j++){
      cin >> tmp_s;
      if(tmp_s == '#'){
        s[i][j] = num;
        ++num;
      }
    }
    cin.ignore();
  }


  bool first_found = false;

  int wp_l = 0, hp_u = 0;
  int wp_r = 1, hp_d = 1;

  int tmp_num = 1;
  bool colored = false; // 塗ったか？
  for (int i = 0; i < h; i++){
    colored = false;
    wp_l = 0;
    for(int j = 0; j < w; j++){
      if(s[i][j] != 0){
        tmp_s = s[i][j];
        color_s(wp_l, hp_u, j + 1, i + 1, tmp_s);
        wp_l = j + 1;
        colored = true;
      } else if ((j == w - 1) && (colored == true)){ // 最終列の場合かつ塗が出た場合、それまでで塗りつぶす
        color_s(wp_l, hp_u, w, i + 1, tmp_s);
      }
    }
    if(colored == true){
      hp_u = i + 1;
    }
  }

  // 今度は下から探る
  bool all_zero = true;
  for(int j = 0; j < w; j++){
    if(s[h-1][j] != 0) all_zero = false;
  }
  if(all_zero == false){
    goto L_END;
  }
  for(int i = h - 2; i >= 0; i--){
    if(s[i][0] == 0) continue;
    else tmp_s = s[i][0];
    wp_l = 0;
    for(int j = 1; j < w; j++){
      if(s[i][j] != tmp_s){
        color_s(wp_l, i + 1, j, h, tmp_s);
        tmp_s = s[i][j];
        wp_l = j;
        if(j == w - 1) goto L_END;
      } else if (j == w - 1){ // 最終列の場合かつ塗が出た場合、それまでで塗りつぶす
        color_s(wp_l, i + 1, w, h, tmp_s);
        goto L_END;
      }
    }
  }

L_END:
  for (int i = 0; i < h; i++){
    for (int j = 0; j < w; j++){
      printf("%3d ", s[i][j]);
    }
    cout << endl;
  }

  return 0;
}


Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | n#include <bits/stdc++.h>
      |  ^
a.cc:1:1: error: 'n' does not name a type
    1 | n#include <bits/stdc++.h>
      | ^
a.cc: In function 'int main()':
a.cc:24:3: error: 'cin' was not declared in this scope
   24 |   cin >> h >> w >> k;
      |   ^~~
a.cc:93:7: error: 'printf' was not declared in this scope
   93 |       printf("%3d ", s[i][j]);
      |       ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | n#include <bits/stdc++.h>
a.cc:95:5: error: 'cout' was not declared in this scope
   95 |     cout << endl;
      |     ^~~~
a.cc:95:13: error: 'endl' was not declared in this scope
   95 |     cout << endl;
      |             ^~~~
Language: C++

#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
    int h, w, k;    cin >> h >> w >> k;
    int sup = h;
    vector<vector<int> > cnt(h);
    string *s = new string[h];
    int **ans = new int*[h];

    for (int i = 0; i < h; i++) {
        ans[i] = new int[w];
        cin >> s[i];
        int sz = 0;
        for (int j=0; j < w; j++) {
            if (s[i][j] == '#') {
                cnt[i].push_back(j);
                sz++;
            }
        }
        if (sz == 0 && sup == h)
            sup = i;
    }

    int l = 1;
    for (int i = 0; i < h; i++) {
        
        if (cnt[i].size() == 0)
            continue;

        else {
            int m = 0;
            int sz = cnt[i].size();
            while (sz > 1) {
                bool can = false;
                while (s[i][m] != '#' || !can) {
                    if (s[i][m] == '#')
                        can = true;
                    ans[i][m] = l;
                    m++;
                }
                l++;
                sz--;
            }
            for (int a = m; a < w; a++)
                ans[i][a] = l;
            l++;
        }
    }

    for (int i = 0; i < h; i++) {
        if (cnt[i].size() == 0 && i == 0) {
            int m = i+1;
            while (!cnt[m].size())
                m++;
            for (int j = 0; j < w; j++) {
                ans[i][j]  = ans[m][j];
            }
        }
        else if (cnt[i].size() == 0) {
            int m = i-1;
            while (!ans[m][j])
                m--;
            for (int j = 0; j < w; j++) {
                ans[i][j]  = ans[m][j];
            }
        } 

    }

    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cout << ans[i][j] << " ";
        }
        cout << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:65:28: error: 'j' was not declared in this scope
   65 |             while (!ans[m][j])
      |                            ^
Language: Java

import java.io.*;
import java.util.*;

public class Main{
    static String str=new String[300];
    static int[][] ary=new int[300][300];
    static int w,h,k;
    static void search(int count,int x,int y){
        int xm=0,xp=0;
        for(int i=x-1;i>-1;i--){
            if(str[y].charAt[x]=='#'||ary[y][i]>0)break;
            xm++;
            ary[y][i]=count;
        }
        for(int i=x+1;i<w;i++){
            if(str[y].charAt[x]=='#'||ary[y][i]>0)break;
            xp++;
            ary[y][i]=count;
        }
        for(int i=y-1;y>-1;i--){
            boolean flag=false
            for(int j=x-xm;j<x+xp;j++){
                if(str[i].charAt[j]=='#'||ary[i][j]>0){
                    break;
                    flag=true;
                }
                ary[i][j]=count;
            }
            if(flag)break;
        }
        for(int i=y+1;y<h;i++){
            boolean flag=false
            for(int j=x-xm;j<x+xp;j++){
                if(str[i].charAt[j]=='#'||ary[i][j]>0){
                    break;
                    flag=true;
                }
                ary[i][j]=count;
            }
            if(flag)break;
        }
    }
    public static void main(String[] args)throws Exception{
        Scanner sc=new Scanner(System.in);
        h=sc.nextInt();
        w=sc.nextInt();
        k=sc.nextInt();
        for(int i=0;i<h;i++){
            str[i]=sc.next();
            Arrays.fill(ary[i],0);
        }
        int count=1;
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                if(str[i].charAt[j]=="#"){
                    ary[i][j]=count;
                    search(count,i,j);
                    count++;
                }
            }
        }
        for(int i=0;i<h;i++){
            for(j=0;j<w;j++){
                System.out.print(ary[i][j]);
                if(j<w-1)System.out.print(" ");
            }
            System.out.println();
        }
    }
}

Compiler output:
Main.java:21: error: ';' expected
            boolean flag=false
                              ^
Main.java:32: error: ';' expected
            boolean flag=false
                              ^
2 errors
Language: C

#include<stdio.h>
#include<stdlib.h>

int main(){
  int h,w,k;
  scanf("%d%d%d\n",&h,&w,&k);
  char c[h][w];//character
  int ou[h][w];//output
  char st[h];//strawberry in each row
  int no=1; //block no.
  int fir=0; //first element in row?

  //copy elements
  for(int i=0;i<h;i++){
    st[i]=0;
    for(int j=0;j<w;j++){
      scanf("%c",c[i][j]);
      if(c[i][j]=='#'){
	st[i]+=1;}}
    scanf("\n");}

  int k=0;
  while(st[k]==0){
    k++;}
   for(int i=k;i<h;i++){
     fir=0;
     if(st[i]==0){
       for(int l=0;l<w;l++){
	 ou[i][l]=ou[i-1][l];}
       continue;}
     for(int j=0;j<w;j++){
       if(c[i][j]=='#'){
	 if(fir==0){
	   fir=1;
	   ou[i][j]=no;
	   continue;}
	 no+=1;}
       ou[i][j]=no;}}

   for(int m=k;m>=0;m--){
     for(int j=0;j<w;j++){
       ou[m][j]=ou[m+1][j];}}

   for(int i=0;i<h;i++){
     for(int j=0;j<w;j++){
       printf("%d ",ou[i][j]);}
     printf("\n");}
  
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:22:7: error: redeclaration of 'k' with no linkage
   22 |   int k=0;
      |       ^
main.c:5:11: note: previous declaration of 'k' with type 'int'
    5 |   int h,w,k;
      |           ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main(){
  int h,w,k;
  cin >> h >> w >> k;
  vector<vector<char>> s(h,vector<char>(w));
  vector<int> b(h);
  vector<int> c;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin >>s.at(i).at(j);
      if(s.at(i).at(j)=='#'){
          b[i]=1;
      }
    }
  }
  for(int i=0;i<h;i++){
      if(b[i]==1){
          
          at=1;
      }
      else{
          at++;
      }
    }
  }
  int count=0;
  for(int i=0;i<h;i++){
      for(int m=0)
      if(s.at(i).at(0)=='#'){
          for(int j=0;j<w;j++){
              if(s.at(i).at(j)=='#'){
                  count++;
                  cout << count << " ";
                  
              }
              else{
                  cout << count << " ";
                  
              }
          }
      }
      else if(b[i]==0){
          
      }
      else{
           int number=0;
          for(int j=0;j<w;j++){
              if(s.at(i).at(j)=='#'){
                  cout << count << " ";
                  number=j;
                  break;
              }
              else{
                  cout << count <<" ";
              }
          }
          for(int j=number+1;j<w;j++){
              if(s.at(i).at(j)=='#'){
                  count++;
                  cout << count << " ";
                  
              }
              else{
                  cout << count << " ";
                  
              }
          }
      }
    count++;
    cout << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:11: error: 'at' was not declared in this scope
   22 |           at=1;
      |           ^~
a.cc:25:11: error: 'at' was not declared in this scope
   25 |           at++;
      |           ^~
a.cc: At global scope:
a.cc:30:3: error: expected unqualified-id before 'for'
   30 |   for(int i=0;i<h;i++){
      |   ^~~
a.cc:30:15: error: 'i' does not name a type
   30 |   for(int i=0;i<h;i++){
      |               ^
a.cc:30:19: error: 'i' does not name a type
   30 |   for(int i=0;i<h;i++){
      |                   ^
a.cc:75:1: error: expected declaration before '}' token
   75 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int h,w,k;
  cin >> h >> w >> k;
  int d=1;
  int y=0;
  char s[h][w];
  bool q[h];
  for(int i=0;i<h;i++){
    q[i]=false;
    for(int j=0;j<w;j++){
      cin >> s[i][j];
      if(s[i][j]=='#'){
        q[i]=true;
      }
    }
  }
  int c[w];
  for(int i=0;i<w;i++){
    c[i]=0;
  }
  int p=0;
  for(int i=0;i<h;i++){
    if(q[i]==false&&c[0]!=0){
      for(int j=0;j<w;j++){
        cout << c[j] << " ";
      }
    }
    else if(q[i]==false&&c[0]==0){
      p++;
    }
    else{
      for(int j=0;j<w;j++){
        if(s[i][j]=='#'&&y==0){
          y=1;
          cout << d << endl;
          c[j]=d;
        }
        else if(s[i][j]=='#'&y==1){
          d++;
          cout << d << " ";
          c[j]=d;
        }
        else{
          cout << d << " ";
          c[j]=d;
        }
      }
      cout << endl;
      d++;
      y=0;
      for(int z=0;z<p;z++){
        for(j=0;j<w;j++){
          cout << c[j] << " ";
          if(z==p-1){
            cout << endl;
          }
        }
      }
    }
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:54:13: error: 'j' was not declared in this scope
   54 |         for(j=0;j<w;j++){
      |             ^
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<pair<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;
	
	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.push_back({i,j});
				c++;
			}
		}
	
	for(int i=0;i<f.size();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: 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: In function 'int main()':
a.cc:53:24: error: 'v' was not declared in this scope
   53 |                 memset(v,0,sizeof v);
      |                        ^
Language: C

3 7 7
#...#.#
..#...#
.#..#..

Compiler output:
main.c:1:1: error: expected identifier or '(' before numeric constant
    1 | 3 7 7
      | ^
main.c:2:2: error: invalid preprocessing directive #...
    2 | #...#.#
      |  ^~~
main.c:3:3: error: stray '#' in program
    3 | ..#...#
      |   ^
main.c:3:7: error: stray '#' in program
    3 | ..#...#
      |       ^
main.c:4:2: error: stray '#' in program
    4 | .#..#..
      |  ^
main.c:4:5: error: stray '#' in program
    4 | .#..#..
      |     ^
Language: C++

#include <bits/stdc++.h>
#define sz(v)   ((int)(v).size())
#define  all(v)    ((v).begin()),((v).end())
#define  allr(v)    ((v).rbegin()),((v).rend())
#define   pb         push_back
#define   mp         make_pair
#define    clr(v,d)      memset( v, d ,sizeof(v))
typedef  long long     ll ;
typedef  unsigned long long ull;
const double eps= (1e-9);
using namespace std;
int dcmp(long double a,long double b){   return fabsl(a-b)<=eps ? 0: (a>b)? 1:-1  ;}
int getBit(ll num, int idx) {return ((num >> idx) & 1ll) == 1;}
int setBit1(int num, int idx) {return num | (1<<idx);}
ll setBit0(ll num, int idx) {return num & ~(1ll<<idx);}
ll flipBit(ll num, int idx) {return num ^ (1ll<<idx);}
void M(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);}
int countNumBit1(int mask) {int ret=0; while (mask) 	{mask &= (mask-1);++ret;	}return ret;}
const int N=309;
string st[N];
int id=1,ans[N][N],n,m;
vector<int> arr[309];
void Fill(int cnt,int cl,int a,int b){

    for(int i=cl-cnt;i<cl;i++){
        for(int j=0;j<n;j++){
            ans[j][i]=id;
        }
    }
    for(int i=a;i<=b;i++){
        ans[i][cl]=id;
    }
    id++;
}
int main(){
    M();
    int k;
    cin>>n>>m>>k;
    for(int i=0;i<n;i++){
        cin>>st[i];
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            if(st[i][j]=='#'){
                arr[j].pb(i);
            }
        }
    }
    int cnt=0,lst=-1;
    for(int i=0;i<m;i++){

        for(int j=0;j<sz(arr[i]);j++){
            if(j+1<sz(arr[i])){
            if(j==0){
                Fill(0,i,0,arr[i][j+1]-1);
                lst=arr[i][j+1]-1;
            }
            else{
                Fill(0,i,lst+1,arr[i][j+1]-1);
                lst=arr[i][j+1]-1;
            }
            }
            else{
                if(j==0){
                Fill(0,i,0,n-1);
              }
            else{
                Fill(0,i,lst+1,n-1);
            }
            }
        }

    }
    lst=-1;
    for(int i=0;i<m;i++){
        bool ok=1;
        for(int j=0;j<n;j++){
            if(ans[j][i]==0) ok=0;
        }
        if(ok==1){
            break;
        }
        else{
            lst=i;
        }
    }
    if(lst!=-1){
    for(int i=0;i<n;i++){
        for(int j=lst;j>=0;j--){
            if(ans[i][j]==0)
            ans[i][j]=ans[i][j+1];
        }
    }
    for(int i=0;i<n;i++){
        for(int j=lst+1;j<m;j++){
            if(ans[i][j]==0)
                ans[i][j]=ans[i][j-1];
        }
    }
    }
    else{

        for(int i=0;i<n;i++){
        for(int j=1;j<m;j++){
            if(ans[i][j]==0)
                ans[i][j]=ans[i][j-1];
        }
        }
    }

    }
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cout<<ans[i][j];
        }
        cout<<endl;
}


Compiler output:
a.cc:112:5: error: expected unqualified-id before 'for'
  112 |     for(int i=0;i<n;i++){
      |     ^~~
a.cc:112:17: error: 'i' does not name a type
  112 |     for(int i=0;i<n;i++){
      |                 ^
a.cc:112:21: error: 'i' does not name a type
  112 |     for(int i=0;i<n;i++){
      |                     ^
Language: C++

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

int H, W, K;
char S[310][310];
int ans[310][310];

int main() {
    cin >> H >> W >> K;
    vector<pair<int, int> > st;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cin >> S[i][j];
            if (S[i][j] == '#') {
                st.push_back(make_pair(i, j));
            }
        }
    }

    memset(ans, -1, sizeof(ans));

    for (int i = 0; i < K; i++) {
        int x = st[i].first;
        int y = st[i].second;
        ans[x][y] = i+1;

        for (int j = x-1; j >= 0; j--) {
            if (S[j][y] == '.' && ans[j][y] == -1) {
                ans[j][y] = i+1;
            }
            else {
                break;
            }
        }

        for (int j = x+1; j < W; j++) {
            if (S[j][y] == '.' && ans[j][y] == -1) {
                ans[j][y] = i+1;
            }
            else {
                break;
            }
        }
    }

    for (int i = 0; i < H; i++) {
        for (int j = 1; j < W; j++) {
            if (ans[i][j] == -1) {
                ans[i][j] = ans[i][j-1];
            }
        }
    }

    for (int i = 0; i < H; i++) {
        for (j = W-2; j >= 0; j++) {
            if (ans[i][j] == -1) {
                ans[i][j] = ans[i][j+1];
            }
        }
    }

    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cout << ans[i][j] << " ";
        }
        cout << endl;
    }

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:56:14: error: 'j' was not declared in this scope
   56 |         for (j = W-2; j >= 0; j++) {
      |              ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
int h,w,k;
cin >> h >>w>>k;
char board[h][w];
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
cin >> board[i][j];}
}
int member=1;
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
int cnt=0;
board[i][j]=member;
if(board[i][j]=='#')cnt++;
if(cnt==2){cnt==0;
member++;
board[i][j]==member;
if(j==w-1)member++;
continue;}
if(j==w-1){member++;
        cnt==0;
        continue;}
  
}
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
cout << board[i][j] <<" ";}
}
  cout << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:2: error: expected '}' at end of input
   32 | }
      |  ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int h,w,k;
  cin >> h >> w >> k;
  int d=1;
  int y=0;
  int b[h];
  char s[h][w];
  for(int i=0;i<h;i++){
    b[i]=0;
    for(int j=0;j<w;j++){
      cin >> s[i][j];
      if(s[i][j]=='#'){
      b[i]=1;
      }
    }
  }
  int c[w];
  for(int i=0;i<w;i++){
    c[i]=0;
  }
  int k=0;
  for(int i=0;i<h;i++){
    if(b[i]==1){
      if(c[0]==0){
        k++;
      }
      else{
        for(int j=0;j<w;j++){
          cout << c[j];
        }
      }
    }
    for(int j=0;j<w;j++){
      if(s[i][j]=='#'&&y==0){
        y=1;
        cout << d << endl;
        c[j]=d;
      }
      else if(s[i][j]=='#'&y==1){
        d++;
        cout << d << " ";
        c[j]=d;
      }
      else{
        cout << d << " ";
        c[j]=d;
      }
    }
    for(int l=0;i<k;l++){
      for(int m<0;m<w;m++){
        cout << c[m];
      }
    }
    cout << endl;
    d++;
    y=0;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:7: error: redeclaration of 'int k'
   23 |   int k=0;
      |       ^
a.cc:4:11: note: 'int k' previously declared here
    4 |   int h,w,k;
      |           ^
a.cc:52:16: error: expected ';' before '<' token
   52 |       for(int m<0;m<w;m++){
      |                ^
      |                ;
a.cc:52:16: error: expected primary-expression before '<' token
a.cc:52:22: error: expected ')' before ';' token
   52 |       for(int m<0;m<w;m++){
      |          ~           ^
      |                      )
a.cc:52:23: error: 'm' was not declared in this scope
   52 |       for(int m<0;m<w;m++){
      |                       ^
Language: C++

#include <bits/stdc++.h> 

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);

  int H,W,K;
  cin>>H>>W>>K;
  vector<string>S(H);
  for(int i=0;i<H;i++)cin>>S[i];

  vector<vector<int>>ans(H,vector<int>(W));
  int c=1;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(S[i][j]=='#'){
        for(;j<W;j++){
          ans[i][j]=c;
          if(j+1<W&&S[i][j+1]=='#')break;
        }
        c++;
f      }
    }
  }

  for(int i=0;i<H;i++){
    for(int j=W-2;j>=0;j--){
      if(ans[i][j]==0){
        ans[i][j]=ans[i][j+1];
      }
    }
  }

  for(int i=0;i<H;i++){
    bool b=true;
    for(int j=0;j<W;j++){
      if(ans[i][j]!=0)b=false;
    }
    if(b){
      if(i==0){
        for(int j=0;j<W;j++){
          ans[i][j]=ans[i+1][j];
        }
      }
      else{
        for(int j=0;j<W;j++){
          ans[i][j]=ans[i-1][j];
        }
      }
    }
  }

  
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cout<<ans[i][j]<<" ";
    }
    cout<<endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:1: error: 'f' was not declared in this scope
   32 | f      }
      | ^
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#include<queue>
#define ll long long
#define itn int
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
using namespace std;


int main(){
  int H,W,K;
  cin>>H>>W>>K;
  char S[H+1][W+1];
  int L[H+1][W+1];
  bool P[H+1][W+1],PP[H+1];
  
  REP(i,H+1) PP[i]=false;
  
  for(int i=1; i<=H; ++i){
    for(int j=1; j<=W; ++j){
      cin>>S[i][j];
      L[i][j]=0;
      P[i][j]=false;
      if(S[i][j]=='#') PP[i]=true;
    }
  }
  
  int Q=1,F,FF;
  
  for(int i=1; i<=H; ++i){
    for(int j=1; j<=W; ++j){
      if(S[i][j]=='#'){
        for(int k=j; k>=1; ++k){
          if(S[i][k]=='#' || P[i][k]==true){
            F=k;
          }
        }
        for(int k=j; k<=W; ++k){
          if(S[i][k]=='#' || P[i][k]==true){
            FF=k;
          }
        }
        
        for(int k=F+1; k<FF; ++k){
          L[i][k]=Q;
          P[i][k]=true;
        }
      }
      Q++;
    }
  }
  
  
  for(int i=1; i<H; ++i){
    if(P[i]==true && P[i+1]==false){
      for(int j=1; j<=W; ++j){
        L[i+1][j]=L[i][j];
      }
    }
  }
  
  for(int i=H; i>1; --i){
    if(P[i]==true && P[i-1]==false){
      for(int j=1; j<=W; ++j){
        L[i-1][j]=L[i][j];
      }
    }
  }
  
  
  
  
  for(int i=1; i<=H; ++i){
    for(int j=1; j<=W; ++j){
      cout<<L[i][j]<<" ";
    }
    cout<<endl;
  }
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:76:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   76 |     if(P[i]==true && P[i+1]==false){
      |        ~~~~^~~~~~
a.cc:76:28: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   76 |     if(P[i]==true && P[i+1]==false){
      |                      ~~~~~~^~~~~~~
a.cc:84:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   84 |     if(P[i]==true && P[i-1]==false){
      |        ~~~~^~~~~~
a.cc:84:28: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   84 |     if(P[i]==true && P[i-1]==false){
      |                      ~~~~~~^~~~~~~
Language: C++

#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;

bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}

int main(){
  
  int h,w,k;
  cin>>h>>w>>k;
  vector<string> s(h);
  REP(i,h){
    cin>>s[i];
  }
  vector<vector<int>> num(h, vector<int>(w, -1));
  int index = 1;
  REP(i,h){
    REP(j,w){
      if(s[i][j] == '#'){
        num[i][j] = index;
        index++;
      }
    }
  }
  REP(i,h){
    int temp = -1;
    int last_;
    for(int j = w-1; j>= 0; j--){
      if(num[i][j] < 0){
        num[i][j] = temp;
      }else{
        if(temp < 0){
          last_ = num[i][j];
        }
        temp = num[i][j];
      }
    }
    REP(j,w){
      if(num[i][j] < 0){
        num[i][j] = last_;
      }
    }
  }
  bool rowex[h] = {};
  vector<int> rows:
  int rowed = -1;
  REP(i,h){
    if(num[i][0] < 0)continue;
    rowex[i] = true;
    rows.push_back(i);
  }
  for(int i = h-1; i>=0; i--){
    if(rowex[i]){
      rowed = i;
      break;
    }
  }
  int m = rows.size();
  REP(i,m){
    if(i == 0){
      if(rows[i] == 0)continue;
      for(int i2 = rows[i]-1; i2>=0; i2--){
        REP(j,w){
          num[i2][j] = num[i2+1][j];
        }
      }
    }else{
      for(int i2 = rows[i]-1; i2>=rows[i-1]+1; i2--){
        REP(j,w){
          num[i2][j] = num[i2+1][j];
        }
      }
    }
  }
  if(rowed != h-1){
    for(int i = rowed + 1; i<h; i++){
      REP(j,w){
        num[i][j] = num[i-1][j];
      }
    }
  }
  
  REP(i,h){
    REP(j,w){
      cout<<num[i][j];
    }
    cout<<endl;
  }
      
  return 0; 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:89:19: error: expected initializer before ':' token
   89 |   vector<int> rows:
      |                   ^
a.cc:94:5: error: 'rows' was not declared in this scope
   94 |     rows.push_back(i);
      |     ^~~~
a.cc:98:7: error: 'rowed' was not declared in this scope; did you mean 'rowex'?
   98 |       rowed = i;
      |       ^~~~~
      |       rowex
a.cc:102:11: error: 'rows' was not declared in this scope
  102 |   int m = rows.size();
      |           ^~~~
a.cc:119:6: error: 'rowed' was not declared in this scope; did you mean 'rowex'?
  119 |   if(rowed != h-1){
      |      ^~~~~
      |      rowex
Language: C++

#include <iostream>
#include <vector>
#include <map>

using namespace std;

int main() {
    int h, w;
    int k;
    cin >> h >> w >> k;
    vector<vector<char>> chocolate(h, vector<char>(w));

    for (size_t i = 0; i < h; ++i) {
        for (size_t j = 0; j < w; ++j) {
            cin >> chocolate[i][j];
        }
    }

    vector<vector<int>> result(h, vector<int>(w));

    int curCut = 1;
    int lastRow = -1;
    for (size_t row = 0; row < h; ++row) {
        vector<int> matches;
        for (size_t col = 0; col < w; ++col) {
            if (chocolate[row][col] == '#') {
                matches.push_back(col);
            }
        }
        if (!matches.empty()) {
            int pmatch = -1;
            for (const auto match : matches) {
                for (int i = row; i > lastRow; --i) {
                    for (int j = pmatch + 1; j <= match; ++j) {
                        result[i][j] = curCut;
                    }
                }
                pmatch = match;
                ++curCut;
            }
            lastRow = row;
        }
    }

    for (size_t row = 0; row < h; ++row) {
        int last = w - 1;
        while (last >= 0 && result[row][last] == 0) {
            --last;
        }
        if (last >= 0) {
            for (int j = last + 1; j < w; ++j) {
                result[row][j] = result[row][last];
            }
        } else {
            break;
        }
    }

    for (int col = 0; col < w; ++col) {
        int last = h - 1;
        while (last >= 0 && result[last][col] == 0) {
            --last;
        }

        assert(last >= 0);

        for (int row = last + 1; row < h; ++row) {
            result[row][col] = result[last][col];
        }
    }

    for (size_t i = 0; i < h; ++i) {
        for (size_t j = 0; j < w; ++j) {
            cout << result[i][j] << ' ';
        }
        cout << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:65:9: error: 'assert' was not declared in this scope
   65 |         assert(last >= 0);
      |         ^~~~~~
a.cc:4:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
    3 | #include <map>
  +++ |+#include <cassert>
    4 |
Language: C++

#include <bits/stdc++.h>
//#include <atcoder/all>

using namespace std;
//using namespace atcoder;
using usize = ::std::size_t;
using u64 = ::std::int_least64_t;
//using u64 = long long;
static constexpr u64 Inf = ::std::numeric_limits<u64>::max() / 2;


int main(int argc, char *argv[])
{
    
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    
    function<u64 (u64)> f = [&](u64 v) {
        if(v <= 9) return 0LL;
        int low_digit = v % 10;
        int high_digit = (v / 10) % 10;
        u64 total = 0LL;
        if (low_digit + high_digit >= 10) {
            total = (u64) (v/100) * 100 + low_digit + high_digit;
        } else {
            total = (u64) (v/100) * 10 + low_digit + high_digit;
        }
        return f(total) + 1LL;
    };
    function<u64 (u64, u64)> g = [&](u64 d, u64 v) {
        if(v == 1) return 0LL;
        if(v == 2) {
            d *= 11LL;
            return f(d);
        }
        u64 next = d * (v - 1) % 9;
        next = next ? next : 9LL;
        next += d * 10;
        v--;
        return g(d, v) + f((u64)next);
    };
    
    
    int M;
    cin >> M;
    vector<u64> d(M), c(M);
    
    for (int i = 0; i < M; i++) {
        cin >> d[i] >> c[i];
    }
    u64 cnt = (u64) M - 1;
    u64 reduced_num = 0;
    for (int i = 0; i < M; i++) {
        if(d[i]) cnt += g(d[i], c[i]);
        else cnt += c[i] - 1LL;
        u64 reduced = c[i];
        reduced %= 9;
        reduced = (reduced == 0) ? 9 :reduced;
        
        if (d[i] != 0 && d[i]*reduced % 9 == 0) {
            reduced_num += 9;
        } else {
            reduced_num += (d[i] * reduced % 9);
        }
    }
    cnt += f(reduced_num);
    
    /*u64 base = (u64) pow(10, 17);
    base--;
    base /= 9;
    cout << f(base * 8) << endl;
    cout << g(8, 17) << endl;*/
    
    cout << cnt << endl;
    
    return 0;
    
}


Compiler output:
a.cc: In lambda function:
a.cc:36:21: error: inconsistent types 'long long int' and 'long int' deduced for lambda return type
   36 |             return f(d);
      |                    ~^~~
a.cc:42:24: error: inconsistent types 'long long int' and 'long int' deduced for lambda return type
   42 |         return g(d, v) + f((u64)next);
      |                ~~~~~~~~^~~~~~~~~~~~~~