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

#include<iostream>
using namespace std ;

int main()
{
  int H,W ;
  cin>>H>>W ;
  string S[H] ;
  for(int i=0;i<H;i++) cin>>S[i] ;
  
  int count=0 ;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(S[i].at(j)=='.'){
        if(i>=1&&i<=H-2&&j>=1&&j<=W-2){
          for(int k=-1;k<=1;k++) for(int l=-1;l<=1&&!(k==0&&l==0);l++){
            if(S[i+k].at(j+l)=='#') count++ ;
          }
        }else if(i==0&&j==0){
          for(int k=0;k<=1;k++) for(int l=0;l<=1&&!(k==0&&l==0);l++){
            if(S[i+k].at(j+l)=='#') count++ ;
          }
        }
        else if(i==0&&j==W-1){
          for(int k=0;k<=1;k++) for(int l=-1;l<=0&&!(k==0&&l==0);l++){
            if(S[i+k].at(j+l)=='#') count++ ;
          }
        }
        else if(i==0){
          for(int k=0;k<=1;k++) for(int l=-1;l<=1&&!(k==0&&l==0);l++){
            if(S[i+k].at(j+l)=='#') count++ ;
          }
        }else if(i==H-1&&j==0){
          for(int k=-1;k<=0;k++) for(int l=0;l<=1&&!(k==0&&l==0);l++){
            if(S[i+k].at(j+l)=='#') count++ ;
          }
        }else if(i==H-1&&j==W-1){
          for(int k=-1;k<=0;k++) for(int l=-1;l<=0&&!(k==0&&l==0);l++){
            if(S[i+k].at(j+l)=='#') count++ ;
          }
        }else if(i==H-1){
          for(int k=-1;k<=0;k++) for(int l=-1;l<=1&&!(k==0&&l==0);l++){
            if(S[i+k].at(j+l)=='#') count++ ;
          }
        }else if(j==0){
          for(int k=-1;k<=1;k++) for(int l=0;l<=1&&!(k==0&&l==0);l++){
            if(S[i+k].at(j+l)=='#') count++ ;
          }
        }else if(j==W-1){
          for(int k=-1;k<=1;k++) for(int l=-1;l<=0&&!(k==0&&l==0);l++){
            if(S[i+k].at(j+l)=='#') count++ ;
          }
        }
        cout<<count ;
        count=0 ;
     }
   }
    
   return 0 ;
}


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

#include<iostream>
using namespace std ;

int main()
{
  int H,W ;
  cin>>H>>W ;
  string S[H] ;
  for(int i=0;i<H;i++) cin>>S[i] ;
  
  int count=0 ;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(S[i].at(j)=='.'){
        if(i>=1&&i<=H-2&&j>=1&&j<=W-2){
          for(int k=-1;k<=1;k++) for(int l=-1;l<=1&&!(k==0&&l==0);l++){
            if(S[i+k].at(j+l)=='#') count++ ;
          }
        }else if(i==0&&j==0){
          for(int k=0;k<=1;k++) for(int l=0;l<=1&&!(k==0&&l==0);l++){
            if(S[i+k].at(j+l)=='#') count++ ;
          }
        }
        else if(i==0&&j==W-1){
          for(int k=0;k<=1;k++) for(int l=-1;l<=0&&!(k==0&&l==0);l++){
            if(S[i+k].at(j+l)=='#') count++ ;
          }
        }
        else if(i==0){
          for(int k=0;k<=1;k++) for(int l=-1;l<=1&&!(k==0&&l==0);l++){
            if(S[i+k].at(j+l)=='#') count++ ;
          }
        }else if(i==H-1&&j==0){
          for(int k=-1;k<=0;k++) for(int l=0;l<=1&&!(k==0&&l==0);l++){
            if(S[i+k].at(j+l)=='#') count++ ;
          }
        }else if(i==H-1&&j==W-1){
          for(int k=-1;k<=0;k++) for(int l=-1;l<=0&&!(k==0&&l==0);l++){
            if(S[i+k].at(j+l)=='#') count++ ;
          }
        }else if(i==H-1){
          for(int k=-1;k<=0;k++) for(int l=-1;l<=1&&!(k==0&&l==0);l++){
            if(S[i+k].at(j+l)=='#') count++ ;
          }
        }else if(j==0){
          for(int k=-1;k<=1;k++) for(int l=0;l<=1&&!(k==0&&l==0);l++){
            if(S[i+k].at(j+l)=='#') count++ ;
          }
        }else if(j==W-1){
          for(int k=-1;k<=1;k++) for(int l=-1;l<=0&&!(k==0&&l==0);l++){
            if(S[i+k].at(j+l)=='#') count++ ;
          }
        }
        cout<<count ;
        count=0 ;
   .  }
   }
    
   return 0 ;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:56:4: error: expected primary-expression before '.' token
   56 |    .  }
      |    ^
a.cc:56:7: error: expected unqualified-id before '}' token
   56 |    .  }
      |       ^
a.cc:60:2: error: expected '}' at end of input
   60 | }
      |  ^
a.cc:5:1: note: to match this '{'
    5 | {
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int a,b;
int main(){
  cin>>a>>b;
  string mine,mine1;
  vector<int> mine2(a*b,0);
  for(int i=0;i<a;i++){
    cin>>mine[i];
    mine1+=mine;
    for(int j=0;j<b;j++){    
    char d=mine[j];
    if(d=='#'){
      if(j>=1){
        mine2[b*i+j-1]++;
        if(i>=1)mine2[b*(i-1)+j-1]++;
        if(i<a-1)mine2[b*(i+1)+j-1]++;
      }
      if(j<b-1){
        mine2[b*i+j+1]++;
        if(i>=1)mine2[b*(i-1)+j+1]++;
        if(i<a-1)mine2[b*(i+1)+j+1]++;
      }
      if(i>=1)mine2[b*(i-1)+j]++;
      if(i<a-1)mine2[b*(i+1)+j]++;
    }
    }
  }
  for(int i=0;i<a;i++){
    for(int j=0;j<b;j++){
    char d=mine1[b*i+j];
    int e=mine2[b*i+j];
    if(d=='#')cout<<'#';
    else cout<<e;
  }
  cout<<endl;
}

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

#include<bits/stdc++.h>
using namespace std;
int a,b;
int main(){
  cin>>a>>b;
  vector<string> mine(a);
  vector<int> mine2(a*b,0);
  for(int i=0;i<a;i++){
    cin>>mine[i];
    for(int j=0;j<b;j++){
    string mine1=mine[i];
    char d=mine1[j];
    if(d=='#'){
      if(j>=1){
        mine2[b*i+j-1]++;
        if(i>=1)mine2[b*(i-1)+j-1]++;
        if(i<a-1)mine2[b*(i+1)+j-1]++;
      }
      if(j<b-1){
        mine2[b*i+j+1]++;
        if(i>=1)mine2[b*(i-1)+j+1]++;
        if(i<a-1)mine2[b*(i+1)+j+1]++;
      }
      if(i>=1)mine2[b*(i-1)+j]++;
      if(i<a-1)mine2[b*(i+1)+j]++;
    }
    }
  }
  for(int i=0;i<a;i++){
    string mine1=mine[i];
    for(int j=0;j<b;j++){
    char d=mine1[j];
    int e=mine2[b*i+j];
    if(d=='#')cout<<'#';
    else cout<<e;
  }
  cout<<endl;
}

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

#include <bits/stdc++.h>
using namespace std;
int main(){
  string a, b;
  int x, y;
  cin >> x >> y;
  a = "."; 
  
  for (int i = 1; i < y + 2; i++) a += ".";
  for (int i = 0; i < x; i++){
    cin >> b;
	a += "." + b + "."; 
  }
  for (int i = 0; i < y + 2; i++) a += ".";
  
  for (int i = y + 3; i < (x + 1) * (y + 2) - 1; i++){
    if (a.at(i) == '.'){
      int count = 0;
      if (a.at(i + 1) == '#') count++;
      if (a.at(i + y + 1) == '#') count++;
      if (a.at(i + y + 2) == '#') count++;
      if (a.at(i + y + 3) == '#') count++;
      if (a.at(i - 1) == '#') count++;
      if (a.at(i - y - 1) == '#') count++;
      if (a.at(i - y - 2) == '#') count++;
      if (a.at(i - y - 3) == '#') count++;
      a.at(i) = char count;
    }
    else continue;
  }
  
  for (int i = 2; i < x + 2; i++){
    for (int j = (i - 1) * (y + 2) + 1; j < i * (y + 2) - 1; j++) cout << a.at(j);
    cout << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:17: error: expected primary-expression before 'char'
   27 |       a.at(i) = char count;
      |                 ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  string a, b;
  int x, y;
  cin >> x >> y;
  a = "."; 
  for (int i = 1; i < y + 2; i++) a += "."; 
  
  for (int i = 0; i < x; i++){
    cin >> b;
	a += "." + b + "."; 
  }
  
  for (int i = 0; i < y + 2; i++) a += ".";　
 
  for (int i = y + 3; i < (x + 1) * (y + 2) - 1; i++){
    if (a.at(i) == '.'){
      int count = 0;
      if (a.at(i + 1) == '#') count++;
      if (a.at(i + y + 1) == '#') count++;
      if (a.at(i + y + 2) == '#') count++;
      if (a.at(i + y + 3) == '#') count++;
      if (a.at(i - 1) == '#') count++;
      if (a.at(i - y - 1) == '#') count++;
      if (a.at(i - y - 2) == '#') count++;
      if (a.at(i - y - 3) == '#') count++;
      a.at(i) = count;
    }
  }
  
  for (int i = 2; i < x + 1; i++){
    for (int j = (i - 1) * (y + 2) + 1; j < i * (y + 2) - 1; j++) cout << a.at(j);
    cout << endl;
  }
}


Compiler output:
a.cc:15:44: error: extended character 　 is not valid in an identifier
   15 |   for (int i = 0; i < y + 2; i++) a += ".";　
      |                                            ^
a.cc: In function 'int main()':
a.cc:15:44: error: '\U00003000' was not declared in this scope
   15 |   for (int i = 0; i < y + 2; i++) a += ".";　
      |                                            ^~
a.cc:17:23: error: 'i' was not declared in this scope
   17 |   for (int i = y + 3; i < (x + 1) * (y + 2) - 1; i++){
      |                       ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  string a, b;
  int x, y;
  cin >> x >> y;
  a = "."; //一行目の取得
  
  for (int i = 1; i < y + 2; i++) a += "."; //'.'がy+2個並ぶ
  
  for (int i = 0; i < x; i++){
    cin >> b;
	a += "." + b + "."; //x*y個の列に並び替え
  }
  
  for (int i = 0; i < y + 2; i++) a += ".";　//x+2行目に'.'を挿入
  
  /* ................
  	 .##############.
     .##############.
     .##############.
     ................ が一行に並ぶ
   */

  for (int i = y + 3; i < (x + 1) * (y + 2) - 1; i++){
    if (a.at(i) == '.'){
      int count = 0;
      if (a.at(i + 1) == '#') count++;
      if (a.at(i + y + 1) == '#') count++;
      if (a.at(i + y + 2) == '#') count++;
      if (a.at(i + y + 3) == '#') count++;
      if (a.at(i - 1) == '#') count++;
      if (a.at(i - y - 1) == '#') count++;
      if (a.at(i - y - 2) == '#') count++;
      if (a.at(i - y - 3) == '#') count++;
      a.at(i) = count;
    }
  }
  
  for (int i = 2; i < x + 1; i++){
    for (int j = (i - 1) * (y + 2) + 1; j < i * (y + 2) - 1; j++) cout << a.at(j);
    cout << endl;
  }
}


Compiler output:
a.cc:16:44: error: extended character 　 is not valid in an identifier
   16 |   for (int i = 0; i < y + 2; i++) a += ".";　//x+2行目に'.'を挿入
      |                                            ^
a.cc: In function 'int main()':
a.cc:16:44: error: '\U00003000' was not declared in this scope
   16 |   for (int i = 0; i < y + 2; i++) a += ".";　//x+2行目に'.'を挿入
      |                                            ^~
a.cc:25:23: error: 'i' was not declared in this scope
   25 |   for (int i = y + 3; i < (x + 1) * (y + 2) - 1; i++){
      |                       ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  string a, b;
  int x, y;
  cin >> x >> y;
  a = "0"; //一行目の取得
  
  for (int i = 1; i < y + 2; i++) a += "0";
  
  for (int i = 0; i < x; i++){
    cin >> b;
    for (int j = 0; j < y; j++){
      if (b.at(j) == '.') b.at(j) = "0";
    }
	a += "0" + b + "0"; //一列に並び替え
  }
  
  for (int i = 0; i < y + 2; i++) a += "0";

  for (int i = y + 1; i < (x + 1) * (y + 1); i++){
    if (a.at(i) == '0'){
      int count = 0;
      if (a.at(i + 1) == '#') count++;
      if (a.at(i + y + 1) == '#') count++;
      if (a.at(i + y + 2) == '#') count++;
      if (a.at(i + y + 3) == '#') count++;
      if (a.at(i - 1) == '#') count++;
      if (a.at(i - y - 1) == '#') count++;
      if (a.at(i - y - 2) == '#') count++;
      if (a.at(i - y - 3) == '#') count++;
      a.at(i) = count;
    }
  }
  
  for (int i = 1; i < x + 1; i++){
    for (int j = (i - 1) * (y + 2) + 1; i < i * (y + 2); i++) cout << a.at(j);
    cout << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:37: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive]
   14 |       if (b.at(j) == '.') b.at(j) = "0";
      |                                     ^~~
      |                                     |
      |                                     const char*
Language: C++

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

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

    int h, w;
    cin >> h >> w;
    
    vector<string> s(h);
    for (int i = 0; i < h; i++) {
        cin >> s.at(i);
    }
    
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            char c = s[i][j];
            
            if(c == '.') s[i][j] = 0;
        }
    }
    
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            char c = s[i][j];
            
            if(c == '#') {
                if(j != w - 1) s[i][j+1]++;
                if(j != 0 ) s[i][j-1]++;
                if(i != 0) {
                    s[i-1][j]++
                    if(j != w - 1) s[i-1][j+1]++;
                    if(j != 0 ) s[i-1][j-1]++;
                }
                if(i != h - 1) {
                    s[i+1][j]++
                    if(j != w - 1) s[i+1][j+1]++;
                    if(j != 0 ) s[i+1][j-1]++;
                }
            }
        }
    }

    for (int i = 0; i < h; i++) {
        cout << s.at(i) << endl;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:32: error: expected ';' before 'if'
   33 |                     s[i-1][j]++
      |                                ^
      |                                ;
   34 |                     if(j != w - 1) s[i-1][j+1]++;
      |                     ~~          
a.cc:38:32: error: expected ';' before 'if'
   38 |                     s[i+1][j]++
      |                                ^
      |                                ;
   39 |                     if(j != w - 1) s[i+1][j+1]++;
      |                     ~~
Language: C++

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

int main() {
    int H, W;
    cin >> H >> W;
    vector<vector<char>> S(H+2);
    vector<vector<int>> memo;
    int s;
    for (int i = 1; i <= H; i++)
    {
        S[i].push_back('.');
        for (int j = 1; j <= W; j++)
        {
            cin >> s;
            S[i].push_back(s);
            if (s == '.'){
            memo.push_back({i,j});
            }
        }
        S[i].push_back('.');
    }
    int tmp;
    for (int i = ; i < memo.size(); i++){
        for (int j = -1; j <= 1; j++){
            for (int k = -1; k <= 1; k++){
                if (S[memo[i][0] + j][memo[i][1] + k] == '#' ){
                    tmp++;
                }
            }
        }
        S[memo[i][0]][memo[i][1]] = char(tmp);

    }
    for (int i = 1; i <= H; i++){
        for (int j = 1; j <= W; j++){
            cout << S[i][j] << endl;
        }
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:18: error: expected primary-expression before ';' token
   27 |     for (int i = ; i < memo.size(); i++){
      |                  ^
Language: C++

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

int main() {
    int H, W;
    cin >> H >> W;
    vector<vector<char>> S(H+2);
    vector<vector<int>> memo;
    int s;
    for (int i = 1; i <= H; i++)
    {
        S[i].push_back('.');
        for (int j = 1; j <= W; j++)
        {
            cin >> s;
            S[i].push_back(s)
            if (s == '.'){
            memo.push_back({i,j})
            }
        }
        S[i].push_back('.')
    }
    int tmp;
    for (int i = ; i < memo.size(); i++){
        for (int j = -1; j <= 1; j++){
            for (int k = -1; k <= 1; k++){
                if (S[memo[i][0] + j][memo[i][1] + k] == '#' ){
                    tmp++;
                }
            }
        }
        S[memo[i][0]][memo[i][1]] = char(tmp);

    }
    for (int i = 1; i <= H; i++){
        for (int j = 1; j <= W; j++){
            cout << S[i][j] << endl;
        }
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:30: error: expected ';' before 'if'
   19 |             S[i].push_back(s)
      |                              ^
      |                              ;
   20 |             if (s == '.'){
      |             ~~                
a.cc:24:28: error: expected ';' before '}' token
   24 |         S[i].push_back('.')
      |                            ^
      |                            ;
   25 |     }
      |     ~                       
a.cc:27:18: error: expected primary-expression before ';' token
   27 |     for (int i = ; i < memo.size(); i++){
      |                  ^
Language: C++

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

int main() {
    int H, W;
    cin >> H >> W;
    vector<vector<char>> S(H+2);
    vector<vector<int>> memo;
    int s;
    for (int i = 1; i <= H; i++)
    {
        S[i].push_back('.')
        for (int j = 1; j <= W; j++)
        {
            cin >> s;
            S[i].push_back(s)
            if (s == '.'){
            memo.push_back({i,j})
            }
        }
        S[i].push_back('.')
    }
    int tmp;
    for (int i = ; i < memo.size(); i++){
        for (int j = -1; j <= 1; j++){
            for (int k = -1; k <= 1; k++){
                if (S[memo[i][0] + j][memo[i][1] + k] == '#' ){
                    tmp++;
                }
            }
        }
        S[memo[i][0]][memo[i][1]] = char(tmp);

    }
    for (int i = 1; i <= H; i++){
        for (int j = 1; j <= W; j++){
            cout << S[i][j] << endl;
        }
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:28: error: expected ';' before 'for'
   15 |         S[i].push_back('.')
      |                            ^
      |                            ;
   16 |         for (int j = 1; j <= W; j++)
      |         ~~~                 
a.cc:16:25: error: 'j' was not declared in this scope
   16 |         for (int j = 1; j <= W; j++)
      |                         ^
a.cc:24:28: error: expected ';' before '}' token
   24 |         S[i].push_back('.')
      |                            ^
      |                            ;
   25 |     }
      |     ~                       
a.cc:27:18: error: expected primary-expression before ';' token
   27 |     for (int i = ; i < memo.size(); i++){
      |                  ^
Language: C++

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

int main() {
    int H, W;
    cin >> H >> W;
    vector<vector<char>> S(H+2);
    vector<vector<int>> memo
    int s;
    for (int i = 1; i <= H; i++)
    {
        S[i].push_back('.')
        for (int j = 1; j <= W; j++)
        {
            cin >> s;
            S[i].push_back(s)
            if (s == '.')
            memo.push_back({i,j})
        }
        S[i].push_back('.')
    }
    int tmp;
    for (int i = ; i < memo.size(); i++){
        for (int j = -1; j <= 1; j++){
            for (int k = -1; k <= 1; k++){
                if (S[memo[i][0] + j][memo[i][1] + k] == '#' ){
                    tmp++
                }
            }
        }
        S[memo[i][0]][memo[i][1]] = char(tmp)

    }
    for (int i = 1; i <= H; i++){
        for (int j = 1; j <= W; j++){
            cout << S[i][j] << endl;
        }
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: expected initializer before 'int'
   12 |     int s;
      |     ^~~
a.cc:15:28: error: expected ';' before 'for'
   15 |         S[i].push_back('.')
      |                            ^
      |                            ;
   16 |         for (int j = 1; j <= W; j++)
      |         ~~~                 
a.cc:16:25: error: 'j' was not declared in this scope
   16 |         for (int j = 1; j <= W; j++)
      |                         ^
a.cc:23:28: error: expected ';' before '}' token
   23 |         S[i].push_back('.')
      |                            ^
      |                            ;
   24 |     }
      |     ~                       
a.cc:26:18: error: expected primary-expression before ';' token
   26 |     for (int i = ; i < memo.size(); i++){
      |                  ^
a.cc:26:24: error: 'memo' was not declared in this scope
   26 |     for (int i = ; i < memo.size(); i++){
      |                        ^~~~
a.cc:30:26: error: expected ';' before '}' token
   30 |                     tmp++
      |                          ^
      |                          ;
   31 |                 }
      |                 ~
Language: C++

#include <iostream>
#include <string>
using namespace std;

int main() {
  int H, W;
  cin >> H >> W;

  int is_bomb[H][W];
  for (int i = 0; i < H; i++){
    for (int j = 0; j < W; j++){
      is_bomb[i][j] = 0;
    }
  }

  string Si;
  int bomb_num[H + 2][W + 2];
  for (int i = 0; i < H + 2; i++){
    for (int j = 0; j < W + 2; j++){
      bomb_num[i][j] = 0;
    }
  }

  for (int i = 0; i < H; i++){
    cin >> Si;
    for (int j = 0; j < W; j++){
      Si.at(j) == '.' ? 1 : is_bomb[i][j] = 1;
    }
  }

  for (int i = 0; i < H; i++){
    for (int j = 0; j < W; j++){
      if (is_bomb[i][j] == 1) {
        for (int k = 0; k < 3; k++){
          for (int l = 0; l < 3; l++){
            bomb_num[i + k][j + l] += 1;
          }
        }
      }
    }
  }

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


Compiler output:
a.cc: In function 'int main()':
a.cc:45:35: error: operands to '?:' have different types 'const char*' and 'int'
   45 |       cout << (is_bomb[i][j] == 1 ? "#" : bomb_num[i + 1][j + 1]);
      |                ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

void ConfirmBomb(vector<string> vec, int column, int row, int maxcolumn, int maxrow, int bombCount)
{
  //範囲を確認してからボムかどうかを確認する
  if((column < 0) || (column == maxcolumn))
  {
    return;
  }
  if((row < 0) || (row == maxrow))
  {
    return;
  }
  if(vec[column].at(row) == '#')
  {
    bombCount++;
  }
}
  
string CountBomb(vector<string> vec, int column, int row, int maxcolumn, int maxrow)
{
  //#の場合は＃を返す
  if(vec[column].at(row) == '#')
  {
    return "#";
  }
  
  int BombCount = 0;
  //上の行を確認
  for(int i = -1; i < 2; i ++)
  {
    for(int j = -1; j < 2; j ++)
    {
      ConfirmBomb(vec, column, row, maxcolumn, maxrow, BombCount);
    }
  }
  return to_string(BombCount);
}
 
int main() {
  int h, w;
  vector<string> inVec, outVec;
  
  cin >> h, w;
  for(int i = 0; i < h; i++)
  {
    string temp;
    cin >> temp;
    inVec.push_back(temp);
    outVec.push_back(temp);
  }
  
  for(int i = 0; i < h; i++)
  {
    for(int j = 0; j < w; j++)
    {
      outVec[i].at(j) = CountBomb(inVec, i, j, h, w).at(0):
    }
  }
  
  for(int i = 0; i < h; i++)
  {
    cout << outVec[i] << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:59: error: expected ';' before ':' token
   58 |       outVec[i].at(j) = CountBomb(inVec, i, j, h, w).at(0):
      |                                                           ^
      |                                                           ;
Language: C++

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

void ConfirmBomb(vector<string> vec, int column, int row, int maxcolumn, int maxrow, int bombCount)
{
  //範囲を確認してからボムかどうかを確認する
  if((column < 0) || (column == maxcolumn))
  {
    return;
  }
  if((row < 0) || (row == maxrow))
  {
    return;
  }
  if(vec[column].at(row) == '#')
  {
    bombCount++;
  }
}
  
string CountBomb(vector<string> vec, int column, int row, int maxcolumn, int maxrow)
{
  //#の場合は＃を返す
  if(vec[column].at(row) == '#')
  {
    return "#";
  }
  
  int BombCount = 0;
  //上の行を確認
  for(int i = -1; i < 2; i ++)
  {
    for(int j = -1; j < 2; j ++)
    {
      ConfirmBomb(vec, column, row, maxcolumn, maxrow, BombCount);
    }
  }
}
 
int main() {
  int h, w;
  vector<string> inVec, outVec;
  
  cin >> h, w;
  for(int i = 0; i < h; i++)
  {
    string temp;
    cin >> temp;
    inVec.push_back(temp);
    outVec.push_back(temp);
  }
  
  for(int i = 0; i < h; i++)
  {
    for(int j = 0; j < w; j++)
    {
      outVec[i].at(j) = CountBomb(inVec, i, j, h, w):
    }
  }
  
  for(int i = 0; i < h; i++)
  {
    cout << outVec[i] << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:57:34: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} in assignment
   57 |       outVec[i].at(j) = CountBomb(inVec, i, j, h, w):
      |                         ~~~~~~~~~^~~~~~~~~~~~~~~~~~~
      |                                  |
      |                                  std::string {aka std::__cxx11::basic_string<char>}
a.cc: In function 'std::string CountBomb(std::vector<std::__cxx11::basic_string<char> >, int, int, int, int)':
a.cc:38:1: warning: control reaches end of non-void function [-Wreturn-type]
   38 | }
      | ^
Language: C++

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

void ConfirmBomb(vector<string> vec, int column, int row, int maxcolumn, int maxrow, int bombCount)
{
  //範囲を確認してからボムかどうかを確認する
  if((column < 0) || (column == maxcolumn))
  {
    return;
  }
  if((row < 0) || (row == maxrow))
  {
    return;
  }
  if(vec[column].at(row) == '#')
  {
    bombCount++;
  }
}
  
string CountBomb(vector<string> vec, int column, int row, int maxcolumn, int maxrow)
{
  //#の場合は＃を返す
  if(vec[column].at(row) == '#')
  {
    return "#";
  }
  
  int BombCount = 0;
  //上の行を確認
  for(int i = -1; i < 2; i ++)
  {
    for(int j = -1; j < 2; j ++)
    {
      ConfirmBomb(vec, column, row, maxcolumn, maxrow, BombCount);
    }
  }
}
 
int main() {
  int h, w;
  vector<string> inVec, outVec;
  
  cin >> h, w;
  for(int i = 0; i < h; i++)
  {
    string temp;
    cin >> temp;
    inVec.push_back(temp);
    outVec.push_back(temp);
  }
  
  for(int i = 0; i < h; i++)
  {
    for(int j = 0; j < w; j++)
    {
      outVec[i].at(j) = outVecCountBomb(inVec, i, j, h, w):
    }
  }
  
  for(int i = 0; i < h; i++)
  {
    cout << outVec[i] << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:57:25: error: 'outVecCountBomb' was not declared in this scope
   57 |       outVec[i].at(j) = outVecCountBomb(inVec, i, j, h, w):
      |                         ^~~~~~~~~~~~~~~
a.cc: In function 'std::string CountBomb(std::vector<std::__cxx11::basic_string<char> >, int, int, int, int)':
a.cc:38:1: warning: control reaches end of non-void function [-Wreturn-type]
   38 | }
      | ^
Language: C++

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

void ConfirmBomb(vector<string> vec, int column, int row, int maxcolumn, int maxrow, int bombCount)
{
  //範囲を確認してからボムかどうかを確認する
  if((column < 0) || (column == maxcolumn))
  {
    return;
  }
  if((row < 0) || (row == maxrow))
  {
    return;
  }
  if(vec[column].at(row) == '#')
  {
    bombCount++;
  }
}
  
string CountBomb(vector<string> vec, int column, int row, int maxcolumn, int maxrow)
{
  //#の場合は＃を返す
  if(vec[column].at(row) == '#')
  {
    return '#';
  }
  
  int BombCount = 0;
  //上の行を確認
  for(int i = -1; i < 2; i ++)
  {
    for(int j = -1; j < 2; j ++)
    {
      ConfirmBomb(vec, column, row, maxcolumn, maxrow, bombCount);
    }
  }
}
 
int main() {
  int h, w;
  vector<string> inVec, outVec;
  char[h,w] = {0};
  
  cin >> h, w;
  for(int i = 0; i < h; i++)
  {
    string temp;
    cin >> temp;
    inVec.push_back(temp);
    outVec.push_back(temp);
  }
  
  for(int i = 0; i < h; i++)
  {
    for(int j = 0; j < w; j++)
    {
      outVec[i].at(j) = outVecCountBomb(inVec, i, j, h, w):
    }
  }
  
  for(int i = 0; i < h; i++)
  {
    cout << outVec[i] << endl;
  }
}

Compiler output:
a.cc: In function 'std::string CountBomb(std::vector<std::__cxx11::basic_string<char> >, int, int, int, int)':
a.cc:26:12: error: could not convert ''#'' from 'char' to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   26 |     return '#';
      |            ^~~
      |            |
      |            char
a.cc:35:56: error: 'bombCount' was not declared in this scope; did you mean 'BombCount'?
   35 |       ConfirmBomb(vec, column, row, maxcolumn, maxrow, bombCount);
      |                                                        ^~~~~~~~~
      |                                                        BombCount
a.cc: In function 'int main()':
a.cc:43:7: error: structured binding declaration cannot have type 'char'
   43 |   char[h,w] = {0};
      |       ^~~~~
a.cc:43:7: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:43:8: error: conflicting declaration 'auto h'
   43 |   char[h,w] = {0};
      |        ^
a.cc:41:7: note: previous declaration as 'int h'
   41 |   int h, w;
      |       ^
a.cc:43:10: error: conflicting declaration 'auto w'
   43 |   char[h,w] = {0};
      |          ^
a.cc:41:10: note: previous declaration as 'int w'
   41 |   int h, w;
      |          ^
a.cc:58:25: error: 'outVecCountBomb' was not declared in this scope
   58 |       outVec[i].at(j) = outVecCountBomb(inVec, i, j, h, w):
      |                         ^~~~~~~~~~~~~~~
Language: C++

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

void ConfirmBomb(vector<string> vec, int column, int row, int maxcolumn, int maxrow, int bombCount)
{
  //範囲を確認してからボムかどうかを確認する
  if((column < 0) || (column == maxcolumn))
  {
    return;
  }
  if((row < 0) || (row == maxrow))
  {
    return;
  }
  if(vec[column].at(row) == '#')
  {
    bombCount++
  }
}
  
string CountBomb(vector<string> vec, int column, int row, int maxcolumn, int maxrow)
{
  //#の場合は＃を返す
  if(vec[column].at(row) == '#')
  {
    return '#';
  }
  
  int BombCount = 0;
  //上の行を確認
  for(int i = -1; i < 2; i ++)
  {
    for(int j = -1; j < 2; j ++)
    {
      ConfirmBomb(vec, column, row, maxcolumn, maxrow, bombCount)
    }
  }
}
 
int main() {
  int h, w;
  vector<string> inVec, outVec;
  char[h,w] = {0};
  
  cin >> h, w;
  for(int i = 0; i < h; i++)
  {
    string temp;
    cin >> temp;
    inVec.push_back(temp);
    outVec.push_back(temp);
  }
  
  for(int i = 0; i < h; i++)
  {
    for(int j = 0; j < w; j++)
    {
      outVec[i].at(j) = outVecCountBomb(inVec, i, j, h, w):
    }
  }
}

Compiler output:
a.cc: In function 'void ConfirmBomb(std::vector<std::__cxx11::basic_string<char> >, int, int, int, int, int)':
a.cc:17:16: error: expected ';' before '}' token
   17 |     bombCount++
      |                ^
      |                ;
   18 |   }
      |   ~             
a.cc: In function 'std::string CountBomb(std::vector<std::__cxx11::basic_string<char> >, int, int, int, int)':
a.cc:26:12: error: could not convert ''#'' from 'char' to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   26 |     return '#';
      |            ^~~
      |            |
      |            char
a.cc:35:56: error: 'bombCount' was not declared in this scope; did you mean 'BombCount'?
   35 |       ConfirmBomb(vec, column, row, maxcolumn, maxrow, bombCount)
      |                                                        ^~~~~~~~~
      |                                                        BombCount
a.cc: In function 'int main()':
a.cc:43:7: error: structured binding declaration cannot have type 'char'
   43 |   char[h,w] = {0};
      |       ^~~~~
a.cc:43:7: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:43:8: error: conflicting declaration 'auto h'
   43 |   char[h,w] = {0};
      |        ^
a.cc:41:7: note: previous declaration as 'int h'
   41 |   int h, w;
      |       ^
a.cc:43:10: error: conflicting declaration 'auto w'
   43 |   char[h,w] = {0};
      |          ^
a.cc:41:10: note: previous declaration as 'int w'
   41 |   int h, w;
      |          ^
a.cc:58:25: error: 'outVecCountBomb' was not declared in this scope
   58 |       outVec[i].at(j) = outVecCountBomb(inVec, i, j, h, w):
      |                         ^~~~~~~~~~~~~~~
Language: C++

#include<iostream>
using namespace std;
int main(void){
  
  int h, w;
  
  cin >> h >> w;
  
  string s[h];
  
  for(int i = 0; i < h; i++){
    cin >> s[i];
  }
  
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      if(s[i][j] == '.'){
        char n = '0';
        for(int k = -1; k <= 1; k++){
          for(int l = -1; l <= 1; l++){
            if(s[i - k][j - l] == '#'){
              n++;
            }
          }
        }
        s[i][j] = n;
      }
    }
  }
  
  for(int i = 0; i < h; i++){
    cout << s[i] << endl;
  }
  
  return 0;


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

#include<iostream>
using namespace std;
int main(void){
  
  int w, h;
  char s[][];
  
  cin >> h >> w;
  
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      cin >> s[i][j];
    }
  }
  
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      if(s[i][j] == '.'){
        int n = 0;
        for(int k = -1; k <= 1; k++){
          for(int l = -1; l <= 1; l++){
            if(s[k][l] == '#'){
              n++;
            }
          }
        }
        s[i][j] = n;
      }
    }
  }
  
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      cout << s[i][j];
    }
  }
  cout << endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:8: error: declaration of 's' as multidimensional array must have bounds for all dimensions except the first
    6 |   char s[][];
      |        ^
a.cc:12:14: error: 's' was not declared in this scope
   12 |       cin >> s[i][j];
      |              ^
a.cc:18:10: error: 's' was not declared in this scope
   18 |       if(s[i][j] == '.'){
      |          ^
a.cc:34:15: error: 's' was not declared in this scope
   34 |       cout << s[i][j];
      |               ^
Language: C++

#include<iostream>
using namespace std;
int main(void){
  
  int w, h;
  string s[][];
  
  cin >> h >> w;
  
  for(int i = 0; i < h; i++){
    cin >> s[i];
  }
  
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      if(s[i][j] == '.'){
        int n = 0;
        for(int k = -1; k <= 1; k++){
          for(int l = -1; l <= 1; l++){
            if(s[k][l] == '#'){
              n++;
            }
          }
        }
        s[i][j] = n;
      }
    }
  }
  
  for(int i = 0; i < h; i++){
    cout << s[i];
  }
  cout << endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:10: error: declaration of 's' as multidimensional array must have bounds for all dimensions except the first
    6 |   string s[][];
      |          ^
a.cc:11:12: error: 's' was not declared in this scope
   11 |     cin >> s[i];
      |            ^
a.cc:16:10: error: 's' was not declared in this scope
   16 |       if(s[i][j] == '.'){
      |          ^
a.cc:31:13: error: 's' was not declared in this scope
   31 |     cout << s[i];
      |             ^
Language: C++

#include<iostream>
using namespace std;
int main(void){
  
  int w, h;
  string s[][];
  
  cin >> h >> w;
  
  for(int i = 0; i < h; i++){
    cin >> s[i][0];
  }
  
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      if(s[i][j] == '.'){
        int n = 0;
        for(int k = -1; k <= 1; k++){
          for(int l = -1; l <= 1; l++){
            if(s[k][l] == '#'){
              n++;
            }
          }
        }
        s[i][j] = n;
      }
    }
  }
  
  for(int i = 0; i < h; i++){
    cout << s[i][0];
  }
  cout << endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:10: error: declaration of 's' as multidimensional array must have bounds for all dimensions except the first
    6 |   string s[][];
      |          ^
a.cc:11:12: error: 's' was not declared in this scope
   11 |     cin >> s[i][0];
      |            ^
a.cc:16:10: error: 's' was not declared in this scope
   16 |       if(s[i][j] == '.'){
      |          ^
a.cc:31:13: error: 's' was not declared in this scope
   31 |     cout << s[i][0];
      |             ^
Language: C++

#include<iostream>
using namespace std;
int main(void){
  
  int w, h;
  string s[][];
  
  cin >> h >> w;
  
  for(int i = 0; i < h; i++){
    cin >> s[i][];
  }
  
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      if(s[i][j] == '.'){
        int n = 0;
        for(int k = -1; k <= 1; k++){
          for(int l = -1; l <= 1; l++){
            if(s[k][l] == '#'){
              n++;
            }
          }
        }
        s[i][j] = n;
      }
    }
  }
  
  for(int i = 0; i < h; i++){
    cout << s[i][];
  }
  cout << endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:10: error: declaration of 's' as multidimensional array must have bounds for all dimensions except the first
    6 |   string s[][];
      |          ^
a.cc:11:12: error: 's' was not declared in this scope
   11 |     cin >> s[i][];
      |            ^
a.cc:11:17: error: expected primary-expression before ']' token
   11 |     cin >> s[i][];
      |                 ^
a.cc:16:10: error: 's' was not declared in this scope
   16 |       if(s[i][j] == '.'){
      |          ^
a.cc:31:13: error: 's' was not declared in this scope
   31 |     cout << s[i][];
      |             ^
a.cc:31:18: error: expected primary-expression before ']' token
   31 |     cout << s[i][];
      |                  ^
Language: C++

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

int main(){
	int h, w;
	cin >> h >> w;
	string s[50];
	rep(i, n) cin >> s[i];
	int dx[8] = {1, 1, 1, 0, 0, -1, -1, -1};
	int dy[8] = {0, 1, -1, 1, -1, -1, 1, 0};

	rep(i, h){
		rep(j, w){
			if(s[i][j] == '#') continue;

			int num = 0;
			rep(d, 8){
				int ni = i + dy[d];
				int nj = j + dx[d];

				if(ni < 0 || h <= ni) continue;
				if(nj < 0 || w <= nj) continue;
				if(s[ni][nj] == '#') num++;
			}
			s[i][j] = char(num + '0');
		}
	}
	rep(i, h) cout << s[i];
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:16: error: 'n' was not declared in this scope
    9 |         rep(i, n) cin >> s[i];
      |                ^
a.cc:3:38: note: in definition of macro 'rep'
    3 | #define rep(i,n) for(int i = 0; i < (n); ++i)
      |                                      ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int (i) = 0; (i) < (int)(n); i++)
 
int main() {
   int n,k,i,j;
   cin>>n>>k;
   char c[n][k],ans[n][k];
   rep(i,n){
     rep(j,k){
     cin>>c[i][j];
     ans[i][j]='0';
     }
   }
   for(i=0;i<n;i++){
     for(j=0;j<n;j++){
     if(i-1>=0&&j-1>=0){
         ans[i-1][j-1]+=1;
         }
         if(i-1>=0){
         ans[i-1][j]+=1;
         }
         if(i-1>=0&&j+1<k){
         ans[i-1][j+1]+=1;
         }
         if(j-1>=0){
         ans[i][j-1]+=1;
         }
         if(i+1<k){
         ans[i][j+1]+=1;
         }
         if(i+1<n&&j-1>=0){
         ans[i+1][j-1]+=1;
         }
         if(i+1<n){
         ans[i+1][j]+=1;
         }
         if(i+1<n&&j+1<k){
         ans[i+1][j+1]+=1;
         }
       }
     }
   }
   rep(i,n){
     rep(j,k){
       if(c[i][j]=='#'){
         ans[i][j]='#';
       }
     }
   }
     rep(i,n){
      rep(j,k){
        cout<<ans[i][j];
      }
       cout<<endl;
     }
     return 0;
}


Compiler output:
a.cc:4:19: error: expected unqualified-id before 'for'
    4 | #define rep(i, n) for (int (i) = 0; (i) < (int)(n); i++)
      |                   ^~~
a.cc:45:4: note: in expansion of macro 'rep'
   45 |    rep(i,n){
      |    ^~~
a.cc:4:41: error: expected constructor, destructor, or type conversion before '<' token
    4 | #define rep(i, n) for (int (i) = 0; (i) < (int)(n); i++)
      |                                         ^
a.cc:45:4: note: in expansion of macro 'rep'
   45 |    rep(i,n){
      |    ^~~
a.cc:45:8: error: 'i' does not name a type
   45 |    rep(i,n){
      |        ^
a.cc:4:53: note: in definition of macro 'rep'
    4 | #define rep(i, n) for (int (i) = 0; (i) < (int)(n); i++)
      |                                                     ^
a.cc:4:19: error: expected unqualified-id before 'for'
    4 | #define rep(i, n) for (int (i) = 0; (i) < (int)(n); i++)
      |                   ^~~
a.cc:52:6: note: in expansion of macro 'rep'
   52 |      rep(i,n){
      |      ^~~
a.cc:4:41: error: expected constructor, destructor, or type conversion before '<' token
    4 | #define rep(i, n) for (int (i) = 0; (i) < (int)(n); i++)
      |                                         ^
a.cc:52:6: note: in expansion of macro 'rep'
   52 |      rep(i,n){
      |      ^~~
a.cc:52:10: error: 'i' does not name a type
   52 |      rep(i,n){
      |          ^
a.cc:4:53: note: in definition of macro 'rep'
    4 | #define rep(i, n) for (int (i) = 0; (i) < (int)(n); i++)
      |                                                     ^
a.cc:58:6: error: expected unqualified-id before 'return'
   58 |      return 0;
      |      ^~~~~~
a.cc:59:1: error: expected declaration before '}' token
   59 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int (i) = 0; (i) < (int)(n); i++)
 
int main() {
   int n,k,i,j;
   cin>>n>>k;
   char c[n][k],ans[n][k];
   rep(i,n){
     rep(j,k){
     cin>>c[i][j];
     ans[i][j]='0';
     }
   }
   for(i=0;i<n;i++){
     for(j=0;j<n;j++){
     if(i-1>=0&&j-1>0){
         ans[i-1][j-1]+=1;
         }
         if(i-1>=0){
         ans[i-1][j]+=1;
         }
         if(i-1>=0&&j+1<k){
         ans[i-1][j+1]+=1;
         }
         if(j-1>=0){
         ans[i][j-1]+=1;
         }
         if(i+1<k){
         ans[i][j+1]+=1;
         }
         if(i+1<n&&j-1>=0){
         ans[i+1][j-1]+=1;
         }
         if(i+1<n){
         ans[i+1][j]+=1;
         }
         if(i+1<n&&j+1<k){
         ans[i+1][j+1]+=1;
         }
       }
     }
   }
   rep(i,n){
     rep(j,k){
       if(c[i][j]=='#'){
         ans[i][j]='#';
       }
     }
   }
     rep(i,n){
      rep(j,k){
        cout<<ans[i][j];
      }
       cout<<endl;
     }
     return 0;
}


Compiler output:
a.cc:4:19: error: expected unqualified-id before 'for'
    4 | #define rep(i, n) for (int (i) = 0; (i) < (int)(n); i++)
      |                   ^~~
a.cc:45:4: note: in expansion of macro 'rep'
   45 |    rep(i,n){
      |    ^~~
a.cc:4:41: error: expected constructor, destructor, or type conversion before '<' token
    4 | #define rep(i, n) for (int (i) = 0; (i) < (int)(n); i++)
      |                                         ^
a.cc:45:4: note: in expansion of macro 'rep'
   45 |    rep(i,n){
      |    ^~~
a.cc:45:8: error: 'i' does not name a type
   45 |    rep(i,n){
      |        ^
a.cc:4:53: note: in definition of macro 'rep'
    4 | #define rep(i, n) for (int (i) = 0; (i) < (int)(n); i++)
      |                                                     ^
a.cc:4:19: error: expected unqualified-id before 'for'
    4 | #define rep(i, n) for (int (i) = 0; (i) < (int)(n); i++)
      |                   ^~~
a.cc:52:6: note: in expansion of macro 'rep'
   52 |      rep(i,n){
      |      ^~~
a.cc:4:41: error: expected constructor, destructor, or type conversion before '<' token
    4 | #define rep(i, n) for (int (i) = 0; (i) < (int)(n); i++)
      |                                         ^
a.cc:52:6: note: in expansion of macro 'rep'
   52 |      rep(i,n){
      |      ^~~
a.cc:52:10: error: 'i' does not name a type
   52 |      rep(i,n){
      |          ^
a.cc:4:53: note: in definition of macro 'rep'
    4 | #define rep(i, n) for (int (i) = 0; (i) < (int)(n); i++)
      |                                                     ^
a.cc:58:6: error: expected unqualified-id before 'return'
   58 |      return 0;
      |      ^~~~~~
a.cc:59:1: error: expected declaration before '}' token
   59 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int (i) = 0; (i) < (int)(n); i++)
 
int main() {
   int n,k,i,j;
   cin>>n>>k;
   char c[n][k],ans[n][k];
   rep(i,n){
     rep(j,k){
     cin>>c[i][j];
     ans[i][j]='0';
     }
   }
   rep(i,n){
     rep(j,k){
     if(i-1>=0&&j-1>0){
         ans[i-1][j-1]+=1;
         }
         if(i-1>=0){
         ans[i-1][j]+=1;
         }
         if(i-1>=0&&j+1<k){
         ans[i-1][j+1]+=1;
         }
         if(j-1>=0){
         ans[i][j-1]+=1;
         }
         if(i+1<k){
         ans[i][j+1]+=1;
         }
         if(i+1<n&&j-1>=0){
         ans[i+1][j-1]+=1;
         }
         if(i+1<n){
         ans[i+1][j]+=1;
         }
         if(i+1<n&&j+1<k){
         ans[i+1][j+1]+=1;
         }
       }
     }
   }
   rep(i,n){
     rep(j,k){
       if(c[i][j]=='#'){
         ans[i][j]='#';
       }
     }
   }
     rep(i,n){
      rep(j,k){
        cout<<ans[i][j];
      }
       cout<<endl;
     }
     return 0;
}


Compiler output:
a.cc:4:19: error: expected unqualified-id before 'for'
    4 | #define rep(i, n) for (int (i) = 0; (i) < (int)(n); i++)
      |                   ^~~
a.cc:45:4: note: in expansion of macro 'rep'
   45 |    rep(i,n){
      |    ^~~
a.cc:4:41: error: expected constructor, destructor, or type conversion before '<' token
    4 | #define rep(i, n) for (int (i) = 0; (i) < (int)(n); i++)
      |                                         ^
a.cc:45:4: note: in expansion of macro 'rep'
   45 |    rep(i,n){
      |    ^~~
a.cc:45:8: error: 'i' does not name a type
   45 |    rep(i,n){
      |        ^
a.cc:4:53: note: in definition of macro 'rep'
    4 | #define rep(i, n) for (int (i) = 0; (i) < (int)(n); i++)
      |                                                     ^
a.cc:4:19: error: expected unqualified-id before 'for'
    4 | #define rep(i, n) for (int (i) = 0; (i) < (int)(n); i++)
      |                   ^~~
a.cc:52:6: note: in expansion of macro 'rep'
   52 |      rep(i,n){
      |      ^~~
a.cc:4:41: error: expected constructor, destructor, or type conversion before '<' token
    4 | #define rep(i, n) for (int (i) = 0; (i) < (int)(n); i++)
      |                                         ^
a.cc:52:6: note: in expansion of macro 'rep'
   52 |      rep(i,n){
      |      ^~~
a.cc:52:10: error: 'i' does not name a type
   52 |      rep(i,n){
      |          ^
a.cc:4:53: note: in definition of macro 'rep'
    4 | #define rep(i, n) for (int (i) = 0; (i) < (int)(n); i++)
      |                                                     ^
a.cc:58:6: error: expected unqualified-id before 'return'
   58 |      return 0;
      |      ^~~~~~
a.cc:59:1: error: expected declaration before '}' token
   59 | }
      | ^