Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int H , W;
  cin >> H >> W;
  string date;
  
  for(int i = 0; i < H * W; i++){
    cin >> date.at(i);
  }
  
  for(int i = 0;i < H * W; i++){
    int count = 0;
    //i番目が爆弾かどうか
    if(date.at(i) == '#'){
      cout << "#";
    }
    else{ //爆弾ではないとき	
      
    //｛頂点｝について
   　if(i == 0){ //左上の頂点
     	if(date.at(i + 1) == '#'){
     	 count++;
   		 }
     	 if(date.at(i + W) == '#'){
     	 count++;
   		 }
   	     if(date.at(i + W) == '#'){
         count++;
         }
     }
     else if(i == W - 1){ //右上の頂点
        if(date.at(i - 1) == '#'){
        count++;
        }
  	    if(date.at(i + W - 1) == '#'){
        count++;
        }
        if(date.at(i + W) == '#'){
        count++;
        }
     }
      else if(i == H * W - W + 1){ //左下の頂点
        if(date.at(i - W) == '#'){
        count++;
        }
        if(date.at(i - W + 1) == '#'){
        count++;
        }
        if(date.at(i + 1) == '#'){
        count++;
        }
      }
      else if(i == H * W - 1){ //右下の頂点
        if(date.at(i - W -1) == '#'){
        count++;
        }
        if(date.at(i - W) == '#'){
        count++;
        }
        if(date.at(i - 1) == '#'){
        count++;
        }
      }
      
      //｛辺｝/｛頂点｝について
      else if(0 < i < W){ //上辺
        if(date.at(i - 1) == '#'){
        count++;
        }
        if(date.at(i + 1) == '#'){
        count++;
        }
        if(date.at(i + W - 1) == '#'){
        count++;
        }
        if(date.at(i + W) == '#'){
        count++;
        }
        if(date.at(i + W + 1) == '#'){
        count++;
        }
      }
      else if(W * H - W + 1 < i < W * H - 1){ //下辺
        if(date.at(i - W -1) == '#'){
        count++;
        }
        if(date.at(i - W) == '#'){
        count++;
        }
        if(date.at(i - W + 1) == '#'){
        count++;
        }
        if(date.at(i - 1) == '#'){
        count++;
        }
        if(date.at(i + 1) == '#'){
        count++;
        }
      }
      else if(i % W == 0){ //左辺
        if(date.at(i - W) == '#'){
        count++;
        }
        if(date.at(i - W + 1) == '#'){
        count++;
        }
        if(date.at(i + 1) == '#'){
        count++;
        }
        if(date.at(i + W) == '#'){
        count++;
        }
        if(date.at(i + W + 1) == '#'){
        count++;
        }
      }
      else if((i + 1) % W == 0){ //右辺
        if(date.at(i - W -1) == '#'){
        count++;
        }
        if(date.at(i - W) == '#'){
        count++;
        }
        if(date.at(i - 1) == '#'){
        count++;
        }
        if(date.at(i + W - 1) == '#'){
        count++;
        }
        if(date.at(i + W) == '#'){
        count++;
        }
      }
     
    //内部について
      else{
        if(date.at(i - W -1) == '#'){
        count++;
        }
        if(date.at(i - W) == '#'){
        count++;
        }
        if(date.at(i - W + 1) == '#'){
        count++;
        }
        if(date.at(i - 1) == '#'){
        count++;
        }
        if(date.at(i + 1) == '#'){
        count++;
        }
        if(date.at(i + W - 1) == '#'){
        count++;
        }
        if(date.at(i + W) == '#'){
        count++;
        }
        if(date.at(i + W + 1) == '#'){
        count++;
        }
      }
    
    cout << count;
    }
    
    //改行
    if((i + 1) % W == 0 ){
      cout << endl;
    }
  }
}
    
    
    

Compiler output:
a.cc:22:4: error: extended character 　 is not valid in an identifier
   22 |    　if(i == 0){ //左上の頂点
      |    ^
a.cc: In function 'int main()':
a.cc:22:4: error: '\U00003000if' was not declared in this scope
   22 |    　if(i == 0){ //左上の頂点
      |    ^~~~
a.cc:33:6: error: 'else' without a previous 'if'
   33 |      else if(i == W - 1){ //右上の頂点
      |      ^~~~