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

import numpy as np

def dot_to_zero(letter):
    if letter == ".":
        return "0"
    else:
        return "#"

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

a = []
for i in range(h):
    s = np.array(list(map(dot_to_zero, input())))
    a.append(s)
a = np.vstack(a)

def add(array):
    for hei in [0,1,2]:
        for wid in [0,1,2]:
            if array[hei][wid] == "#":
                array[hei][wid] = "#"
            else:
                array[hei][wid] = str(int(array[hei][wid]) + 1)
    return array

a = np.pad(a, (1,1), 'edge')

print(a)

for index_h in range(1, h+1):
    for index_w in range(1, w+1):
        if a[index_h][index_w] == "#":
            print(index_h, index_w)
            a[index_h-1:index_h+2, index_w-1:index_w+2] = add(a[index_h-1:index_h+2, index_w-1:index_w+2])
            
a = a[1:-1, 1:-1]

for array in a:
    print("".join( array.tolist() )) 

Compiler output:
a.cc:26:22: warning: multi-character character constant [-Wmultichar]
   26 | a = np.pad(a, (1,1), 'edge')
      |                      ^~~~~~
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;

  int h, w;
  int dx[8] = {-1,-1,0,1,1,1,0,-1};
  int dy[8] = {0,1,1,1,0,-1,-1,-1};
   

int main () {
    
  cin >> h >> w;
  vector<vector<char>> graph(h,vector<char>(w));
    string s;
   
  for (int i = 0; i < h; i++) {
    cin >> s;
    for (int j = 0; j < w; j++){
      
      graph.at(i).at(j) = s.at(j);
     }
  }
  
  for (int i = 0; i < h; i++){
    for (int j = 0; j < w; j++){
      int count = 0;
      if (graph.at(i).at(j) == '#' ){
        continue;
      }
        
        for (int k = 0; k < 8; k++){
          //「座標外」を取り除くために単なるintで考えた後場合分け、okならグラフに適用
          int grid_h = i + dy.at(k);
          int grid_w = j + dx(k);
          if(grid_h < 0 || grid_w < 0 || grid_h >= h || grid_w >= w){
          continue;
          }
          //周囲8マスに#があったらカウントを加える
          if (graph.at(grid_h).at(grid_w) == '#') {
            count++;
          } 
          graph.at(i).at(j) = char(count + '0');
        }
    }
        
  }
  for (int i = 0; i < h; i++){
    for (int j = 0; j < w; j++){
     cout << graph.at(i).at(j);
    }
  cout << endl;
  }
}



Compiler output:
a.cc: In function 'int main()':
a.cc:32:31: error: request for member 'at' in 'dy', which is of non-class type 'int [8]'
   32 |           int grid_h = i + dy.at(k);
      |                               ^~
a.cc:33:30: error: 'dx' cannot be used as a function
   33 |           int grid_w = j + dx(k);
      |                            ~~^~~
Language: C++

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


int main () {
  
  int h, w;
  cin >> h >> w;
  vector<vector<char>> graph(h,vector<char>(w));
  int dx[8] = {-1,-1,0,1,1,1,0,-1};
  int dy[8] = {0,1,1,1,0,-1,-1,-1};
   string s;
   
  
  for (int i = 0; i < h; i++) {
   cin >> s
    for (int j = 0; j < w; j++){
      graph.at(i).at(j) = s.at(j);
     }
  }
  
  for (int i = 0; i < h; i++){
    for (int j = 0; j < w; j++){
      int count = 0;
      if (graph.at(i).at(j) == '#' ){
        continue;
      }
        
        for (int k = 0; k < 8; k++){
          //「座標外」を取り除くために単なるintで考えた後場合分け、okならグラフに適用
          int grid_h = i + dy[k];
          int grid_w = j + dx[k];
          if(grid_h < 0 || grid_w < 0 || grid_h >= h || grid_w >= w){
          continue;
          }
          //周囲8マスに#があったらカウントを加える
          if (graph.at(grid_h).at(grid_w) == '#') {
            count++;
          } 
          graph.at(i).at(j) = char(count + '0');
        }
    }
        
  }
  for (int i = 0; i < h; i++){
    for (int j = 0; j < w; j++){
     cout << graph.at(i).at(j);
    }
  cout << endl;
  }
}





Compiler output:
a.cc: In function 'int main()':
a.cc:16:12: error: expected ';' before 'for'
   16 |    cin >> s
      |            ^
      |            ;
   17 |     for (int j = 0; j < w; j++){
      |     ~~~     
a.cc:17:21: error: 'j' was not declared in this scope
   17 |     for (int j = 0; j < w; j++){
      |                     ^
Language: C++

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

int main () {
  int h, w;
  cin >> h >> w;
  vetor<vector<char>> graph(h,vector<char>(w));
  int dx[8] = {-1,-1,0,1,1,1,0,-1};
  int dy[8] = {0,1,1,1,0,-1,-1,-1};
  
  for (int i = 0; i < h; i++) {
    string s;
    cin >> s;
    for (int j = 0; j < w; j++){
      graph.at[i].at[j] = s.at[j];
     }
  }
  
  for (int i = 0; i < h; i++){
    for (int j = 0; j < w; j++){
      if (graph.at[i].at[j] == '#' ){
        continue;
      }
        int count = 0;
        for (int k = 0; k < 8; k++){
          //「座標外」を取り除くために単なるintで考えた後場合分け、okならグラフに適用
          int grid_h = i + dy[k];
          int grid_w = i + dx[k];
          if(grid_h < 0 || grid_w < 0 || grid_h >= h || grid_w >= w){
          continue;
          }
          //周囲8マスに#があったらカウントを加える
          if graph.at[grid_h].at[grid_w] == '#' {
            count++;
          } 
          graph.at(i).at(j) = char(count + '0');
        }
    }
        
      }
  for (int i = 0; i < h; i++){
    for (int j = 0; j < w; j++){
     cout << graph.at(i).at(j) << endl;
    }
  
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'vetor' was not declared in this scope
    7 |   vetor<vector<char>> graph(h,vector<char>(w));
      |   ^~~~~
a.cc:7:20: error: expected primary-expression before '>' token
    7 |   vetor<vector<char>> graph(h,vector<char>(w));
      |                    ^~
a.cc:7:23: error: 'graph' was not declared in this scope; did you mean 'isgraph'?
    7 |   vetor<vector<char>> graph(h,vector<char>(w));
      |                       ^~~~~
      |                       isgraph
a.cc:15:31: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   15 |       graph.at[i].at[j] = s.at[j];
      |                               ^
a.cc:33:14: error: expected '(' before 'graph'
   33 |           if graph.at[grid_h].at[grid_w] == '#' {
      |              ^~~~~
      |              (
Language: C++

 int main(void) {
 int h, w;
 cin >> h >> w;

 string board[50];

 for (int i = 0; i < h; ++i) cin >> board[i];

 const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
 const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

 for (int i = 0; i < h; ++i) {
 for (int j = 0; j < w; ++j) {
 if (board[i][j] == "#") continue;

 int num = 0;
 for (int d = 0; d < 8; ++ d) {
 const int ni = i + dy[d];
 const int nj = j + dx[d];

 if (ni < 0 or h <= ni) continue;
 if (nj < 0 or w <= nj) continue;
 if (board[ni][nj] == "#") num++;
 }

 board[i][j] = char(num + ’0’);

 }
 }

 for (int i = 0; i < h; ++i) cout << board[i] << endl;

 return 0;
 }

Compiler output:
a.cc:26:27: error: extended character ’ is not valid in an identifier
   26 |  board[i][j] = char(num + ’0’);
      |                           ^
a.cc:26:27: error: extended character ’ is not valid in an identifier
a.cc: In function 'int main()':
a.cc:3:2: error: 'cin' was not declared in this scope
    3 |  cin >> h >> w;
      |  ^~~
a.cc:5:2: error: 'string' was not declared in this scope
    5 |  string board[50];
      |  ^~~~~~
a.cc:7:37: error: 'board' was not declared in this scope
    7 |  for (int i = 0; i < h; ++i) cin >> board[i];
      |                                     ^~~~~
a.cc:14:6: error: 'board' was not declared in this scope
   14 |  if (board[i][j] == "#") continue;
      |      ^~~~~
a.cc:23:6: error: 'board' was not declared in this scope
   23 |  if (board[ni][nj] == "#") num++;
      |      ^~~~~
a.cc:26:2: error: 'board' was not declared in this scope
   26 |  board[i][j] = char(num + ’0’);
      |  ^~~~~
a.cc:26:27: error: '\U000020190\U00002019' was not declared in this scope
   26 |  board[i][j] = char(num + ’0’);
      |                           ^~~
a.cc:31:30: error: 'cout' was not declared in this scope
   31 |  for (int i = 0; i < h; ++i) cout << board[i] << endl;
      |                              ^~~~
a.cc:31:38: error: 'board' was not declared in this scope
   31 |  for (int i = 0; i < h; ++i) cout << board[i] << endl;
      |                                      ^~~~~
a.cc:31:50: error: 'endl' was not declared in this scope
   31 |  for (int i = 0; i < h; ++i) cout << board[i] << endl;
      |                                                  ^~~~
Language: C++

1 int main(void) {
2 int h, w;
3 cin >> h >> w;
4
5 string board[50];
6
7 for (int i = 0; i < h; ++i) cin >> board[i];
8
9 const int a[8] = {1, 0, -1, 0, 1, -1, -1, 1};
10 const int b[8] = {0, 1, 0, -1, 1, 1, -1, -1};
11
12 for (int i = 0; i < h; ++i) {
13 for (int j = 0; j < w; ++j) {
14 if (board[i][j] == ’#’) continue;
15
16 int num = 0;
17 for (int d = 0; d < 8; ++ d) {
18 const int ni = i + b[d];
19 const int nj = j + a[d];
20
21 if (ni < 0 or h <= ni) continue;
22 if (nj < 0 or w <= nj) continue;
23 if (board[ni][nj] == ’#’) num++;
24 }
25
26 board[i][j] = char(num + ’0’);
27
28 }
29 }
30
31 for (int i = 0; i < h; ++i) cout << board[i] << endl;
32
33 return 0;
}

Compiler output:
a.cc:14:23: error: extended character ’ is not valid in an identifier
   14 | 14 if (board[i][j] == ’#’) continue;
      |                       ^
a.cc:14:24: error: stray '#' in program
   14 | 14 if (board[i][j] == ’#’) continue;
      |                        ^
a.cc:14:25: error: extended character ’ is not valid in an identifier
   14 | 14 if (board[i][j] == ’#’) continue;
      |                         ^
a.cc:23:25: error: extended character ’ is not valid in an identifier
   23 | 23 if (board[ni][nj] == ’#’) num++;
      |                         ^
a.cc:23:26: error: stray '#' in program
   23 | 23 if (board[ni][nj] == ’#’) num++;
      |                          ^
a.cc:23:27: error: extended character ’ is not valid in an identifier
   23 | 23 if (board[ni][nj] == ’#’) num++;
      |                           ^
a.cc:26:29: error: extended character ’ is not valid in an identifier
   26 | 26 board[i][j] = char(num + ’0’);
      |                             ^
a.cc:26:29: error: extended character ’ is not valid in an identifier
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 1 int main(void) {
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int H, W;
  cin >> H >> W;

  vector<string> S(H);

  int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1}
  int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1}


  for(i = 0; i < H; i++){
    cin >> S.at(i);
  }
  

  for(i = 0; i < H; i++){
    for(j = 0; j < W; j++){

      if(S[i][j] == '#')
        contniue;
      
      int count = 0;
      for(int d = 0; d < 8; d++){
        int ni = i + dx[d];
        int nj = j + dy[d];

        if(ni < 0 || ni >= H)
          continue;
        if(nj < 0 || nj >= W)
          continue;
        if(S[i][j] == '#')
          count++; 
      }

      S[i][j] = char(count + '0')

  }

  for(int i = 0; i < H; i++)
    cout << S[i] << endl;
  

}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:3: error: expected ',' or ';' before 'int'
   12 |   int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1}
      |   ^~~
a.cc:15:7: error: 'i' was not declared in this scope
   15 |   for(i = 0; i < H; i++){
      |       ^
a.cc:20:7: error: 'i' was not declared in this scope
   20 |   for(i = 0; i < H; i++){
      |       ^
a.cc:21:9: error: 'j' was not declared in this scope
   21 |     for(j = 0; j < W; j++){
      |         ^
a.cc:24:9: error: 'contniue' was not declared in this scope
   24 |         contniue;
      |         ^~~~~~~~
a.cc:29:22: error: 'dy' was not declared in this scope; did you mean 'd'?
   29 |         int nj = j + dy[d];
      |                      ^~
      |                      d
a.cc:47:2: error: expected '}' at end of input
   47 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int H, W;
  cin >> H >> W;
  string S[50];
  
  for(int i = 0; i < H; i++){
    cin >> S[i];
  }
  
  int x = { -1, 0, 1, -1, 1, -1, 0, 1 };
  int y = {  1, 1, 1,  0, 0, -1,-1,-1 };
  
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      if(S[i][j] == '#') continue;
      int C = 0;
      
      for(int k = 0; k < 8;k++){
        if(j + x[k] < 0 || j + x[k] > H) continue;
        if(i + y[k] < 0 || i + y[k] > W) continue;
        if(S[i + y[k]][j + x[k]] == '#') C++;
      }
      S[i][j] = char(C + '0');
    }
  }
  
  for(int i = 0; i < H; i++) cout << S[i] << endl;
 
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:7: error: scalar object 'x' requires one element in initializer
   14 |   int x = { -1, 0, 1, -1, 1, -1, 0, 1 };
      |       ^
a.cc:15:7: error: scalar object 'y' requires one element in initializer
   15 |   int y = {  1, 1, 1,  0, 0, -1,-1,-1 };
      |       ^
Language: C++

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

int main() {
  
  int H, W;
  cin >> H >> W;
  string S[50];
  
  for(int i = 0; i < H; i++){
    cin >> S[i];
  }
  
  int x = { -1, 0, 1, -1, 1, -1, 0, 1 };
  int y = {  1, 1, 1,  0, 0, -1,-1,-1 };
  
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      if(S[i][j] == '#') continue;
      int C = 0;
      
      for(int k = 0; k < 8;k++){
        if(j + x[k] < -1 || j + x[k] > 1) continue;
        if(i + y[k] < -1 || i + y[k] > 1) continue;
        if(S[i + y[k]][j + x[k]] == '#') C++;
      }
      S[i][j] = char(C + '0');
    }
  }
  
  for(int i = 0; i < H; i++) cout << S[i] << endl;
 
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:7: error: scalar object 'x' requires one element in initializer
   14 |   int x = { -1, 0, 1, -1, 1, -1, 0, 1 };
      |       ^
a.cc:15:7: error: scalar object 'y' requires one element in initializer
   15 |   int y = {  1, 1, 1,  0, 0, -1,-1,-1 };
      |       ^
Language: C++

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

int main() {
  int H, W;
  cin >> H, W;
  string str[H];
  
  for(int i = 0; i < H; i++){
    getLine(cin, str[i]);
  }
  
  int x[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
  int y[8] = { 1, 1, 1,  0, 0, -1,-1,-1};
  int C = 0;
  
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; i++){
      if(str[i][j] == '.'){
        for(int k = 0; k < 8; k++){
          if(j + x[k] < 0 || j + x[k] > 1)
            continue;
          if(i + y[k] < 0 || i + x[k] > 1)
            continue;
          C++;
        }
        str[i][j] = ststic_cast<string>(C);
        cout << str[i][j] << endl;
      }
    }
  }
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: 'getLine' was not declared in this scope; did you mean 'getline'?
   10 |     getLine(cin, str[i]);
      |     ^~~~~~~
      |     getline
a.cc:27:21: error: 'ststic_cast' was not declared in this scope; did you mean 'static_assert'?
   27 |         str[i][j] = ststic_cast<string>(C);
      |                     ^~~~~~~~~~~
      |                     static_assert
a.cc:27:39: error: expected primary-expression before '>' token
   27 |         str[i][j] = ststic_cast<string>(C);
      |                                       ^
Language: C

// Minesweeper
#include <bits/stdc++.h> //C++の機能を「全て」読み込むための命令
#define rep(i,n) for(int i=0; i<(n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
    int h,w;
    cin >> h >> w;
    string table[60];
    rep(i,h) cin >> table[i];
    // rep(i,h) cout << table[i] <<endl;

    //八方向を配列で埋め込む.
    vector<int> dx{1,1,0,-1,-1,-1,0,1};
    vector<int> dy{0,1,1,1,0,-1,-1,-1};

    rep(i,h){
        rep(j,w){
            if(table[i][j]=='#') continue;
            if(table[i][j]=='.'){
                int cnt = 0;
                rep(k,8){
                    int x = i + dx.at(k);
                    int y = j + dy.at(k);
                    if(x>=0 && x<h && y>=0 && y<w && table[x][y]=='#') ++cnt;
                }
                table[i][j] = char('0' + cnt);
            }
        }
    }
    rep(i,h) cout << table[i] <<endl;
    return 0;
}

Compiler output:
main.c:2:10: fatal error: bits/stdc++.h: No such file or directory
    2 | #include <bits/stdc++.h> //C++の機能を「全て」読み込むための命令
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

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



int main(){


int h,w;
cin>>h>>w;

 string board[50];

 for(int i=0;i<h;i++) cin>>bored[i];

 const int dx[8] = {1,0,-1,0,1,-1,-1,1};
 const int dy[8] = {0,1,0,-1,1,1,-1,-1};

 for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){

     if(board[i][j] == '#') continue;

      int num=0;

      for(int d=0;d<8;d++){
        const int a1 = i+dy[d];
        const int b1 = j+dx[d];

        if(a1 < 0 || a1>=h1) continue;
        if(b1 < 0 || b1>= h2) continue;

        if(board[a1][b1] == '#') num++;
      }

      board[i][j] == char(num+'0');

    }
 }


 for(int i=0;i<h;i++)
    cout<<board[i]<<endl;


return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:28: error: 'bored' was not declared in this scope
   16 |  for(int i=0;i<h;i++) cin>>bored[i];
      |                            ^~~~~
a.cc:32:26: error: 'h1' was not declared in this scope; did you mean 'b1'?
   32 |         if(a1 < 0 || a1>=h1) continue;
      |                          ^~
      |                          b1
a.cc:33:27: error: 'h2' was not declared in this scope; did you mean 'h'?
   33 |         if(b1 < 0 || b1>= h2) continue;
      |                           ^~
      |                           h
Language: C

#include <stdio.h>
int dx[8] = {1, 1, 1, 0, 0, -1, -1, -1};
int dy[8] = {-1, 0, 1, 1, -1, -1, 0, 1};
int main(){
  int H, W;
  scanf("%d %d", &H, &W);
  char c[H][W];
  for(int i = 0; i < H; i++) scanf("%s", c[i]);
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      if(c[i][j] == '.'){
        int count = 0;
        for(int k = 0; k < 8; k++){
          int nx = i + dx[k], ny = j + dy[k]
          if(0 <= nx && nx < H && 0 <= ny && ny < W && c[nx][ny] == '#') count++;
        }
        c[i][j] = '0' + count;
      }
    }
  }
  for(int i =0 ; i < H; i++) printf("%s\n", c[i]);
}

Compiler output:
main.c: In function 'main':
main.c:15:11: error: expected ',' or ';' before 'if'
   15 |           if(0 <= nx && nx < H && 0 <= ny && ny < W && c[nx][ny] == '#') count++;
      |           ^~
Language: C++

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

int main() {
  int H,W;
  cin >> H >> W;
  vector<string> A(H)
  for(int i=0;i<H;i++){
    string S;
    cin >> S;
    A.at(i)=S;
  }
  for(int i=0;i<H;i++)
    for(int j=0;j<H;j++){
      if(A.at(i).at(j)=='#')
        continue;
      int a=0;
      if(i!=0 && j!=0)
        if(A.at(i-1).at(j-1)=='#')
          a++;
      if(i!=0)
        if(A.at(i-1).at(j)=='#')
          a++;
      if(i!=0 && j!=W)
        if(A.at(i-1).at(j+1)=='#')
          a++;
      if(j!=W)
        if(A.at(i).at(j+1)=='#')
          a++;
      if(j!=W && i!=H)
        if(A.at(i+1).at(j+1)=='#')
          a++;
      if(i!=H)
        if(A.at(i+1).at(j)=='#')
          a++;
      if(i!=H && j!=0)
        if(A.at(i+1).at(j-1)=='#')
          a++;
      if(j!=0)
        if(A.at(i).at(j-1)=='#')
          a++;
      A.at(i).at(j)=a;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: expected ',' or ';' before 'for'
    8 |   for(int i=0;i<H;i++){
      |   ^~~
a.cc:8:15: error: 'i' was not declared in this scope
    8 |   for(int i=0;i<H;i++){
      |               ^
Language: C++

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

int main() {
  int H,W;
  cin >> H >> W;
  vector<string> A(H)
  for(int i=0;i<H;i++){
    string S;
    cin >> S;
    A.at(i)=S;
  }
  for(int i=0;i<H;i++)
    for(int j=0;j<H;j++){
      if(A.at(i).at(j)=='#')
        continue;
      int a=0;
      if(i!=0 && j!=0)
        if(A.at(i-1).at(j-1)=='#')
          a++;
      if(i!=0)
        if(A.at(i-1).at(j)=='#')
          a++;
      if(i!=0 && j!=W)
        if(A.at(i-1).at(j+1)=='#')
          a++;
      if(j!=W)
        if(A.at(i).at(j+1)=='#')
          a++;
      if(j!=W && i!=H)
        if(A.at(i+1).at(j+1)=='#')
          a++;
      if(i!=H)
        if(A.at(i+1).at(j)=='#')
          a++;
      if(i!=H && j!=0)
        if(A.at(i+1).at(j-1)=='#')
          a++;
      if(j!=0)
        if(A.at(i).at(j-1)=='#')
          a++;
      A.at(i).at(j)=a
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: expected ',' or ';' before 'for'
    8 |   for(int i=0;i<H;i++){
      |   ^~~
a.cc:8:15: error: 'i' was not declared in this scope
    8 |   for(int i=0;i<H;i++){
      |               ^
a.cc:42:22: error: expected ';' before '}' token
   42 |       A.at(i).at(j)=a
      |                      ^
      |                      ;
   43 | }
      | ~                     
a.cc:43:2: error: expected '}' at end of input
   43 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int H, W;
  cin >> H >> W;
  
  vector<string>> data( H, vector<string>(W));
  
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      cin >>data.at(i).at(j);
    }
  }
  
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      int count = 0;
      
      if(data.at(i).at(j) == "#"){
        cout << "#";
        continue;
      }
      
      if(i!=0){
        //前列カウント
        if(j!=0){          
       	  if(data.at(i-1).at(j-1) == "#") count++;
        }
        if(data.at(i-1).at(j) == "#") count++;
        if(j!=W-1){
          if(data.at(i-1).at(j+1) == "#") count++;
        }
      }
      //現在列カウント
      if(j!=0){
        if(data.at(i).at(j-1) == "#") count++;
      }
      if(j!=W-1){
        if(data.at(i).at(j+1) == "#") count++;
      }
      if(i!=H-1){
        //後列カウント
        if(j!=0){
          if(data.at(i+1).at(j-1) == "#") count++;
        }
        if(data.at(i+1).at(j) == "W") count++;
        if(j!=W-1){
          if(data.at(i+1).at(j+1) == "W") count++;
        }
      }
      
      cout << count;
    }
    
    cout << endl;
    
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:16: error: expected unqualified-id before '>' token
    7 |   vector<string>> data( H, vector<string>(W));
      |                ^~
a.cc:11:18: error: overloaded function with no contextual type information
   11 |       cin >>data.at(i).at(j);
      |                  ^~
a.cc:19:15: error: overloaded function with no contextual type information
   19 |       if(data.at(i).at(j) == "#"){
      |               ^~
a.cc:27:19: error: overloaded function with no contextual type information
   27 |           if(data.at(i-1).at(j-1) == "#") count++;
      |                   ^~
a.cc:29:17: error: overloaded function with no contextual type information
   29 |         if(data.at(i-1).at(j) == "#") count++;
      |                 ^~
a.cc:31:19: error: overloaded function with no contextual type information
   31 |           if(data.at(i-1).at(j+1) == "#") count++;
      |                   ^~
a.cc:36:17: error: overloaded function with no contextual type information
   36 |         if(data.at(i).at(j-1) == "#") count++;
      |                 ^~
a.cc:39:17: error: overloaded function with no contextual type information
   39 |         if(data.at(i).at(j+1) == "#") count++;
      |                 ^~
a.cc:44:19: error: overloaded function with no contextual type information
   44 |           if(data.at(i+1).at(j-1) == "#") count++;
      |                   ^~
a.cc:46:17: error: overloaded function with no contextual type information
   46 |         if(data.at(i+1).at(j) == "W") count++;
      |                 ^~
a.cc:48:19: error: overloaded function with no contextual type information
   48 |           if(data.at(i+1).at(j+1) == "W") count++;
      |                   ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
 
vector<string> dot_to_minenumber(const vector<string>& input_map);
 
int main(){
  //入力
  int H, W;
  cin >> H >> W;
  vector<string> input_map(H);
  for ( int i = 0; i < input_map.size() ; i++) cin >> input_map.at(i);
  
  //処理
  vector<string> output_map = dot_to_minenumber(input_map);
  
  //出力
  for ( string s : output_map ) cout << s << endl;
}
 
vector<string> dot_to_minenumber(const vector<string>& input_map){
  vector<string> ret_map = input_map;
  vector<int> row = { -1 , 0 , 1};
  vector<int> column = { -1 , 0 , 1};//ある点の周辺を調べる用
  for ( int i = 0 ; i < ret_map.size(); i++){
    for ( int j = 0 ; j < ret_map.at(0).size(); j++){//マップの全探索
      if ( ret_map.at(i).at(j) == '.'){//その点が地雷ではないとき
        int count = 0;
      	for ( int x : row ){
       	 for ( int y : column){
          	if (0 <= (i + x) && (i + x) < ret_map.size() && 
                0 <= (j + y) && (j + y ) < ret_map.at(0).size() &&
                ret_map.at(i + x).at(j + y) == '#' ) count++;//その点回りに文字が存在し、かつ地雷ならcount++
                   ret_map.at(i).at(j) = '0' + count;//(1)よく知らないけどこれでintをcharで代入できる
       	 }
      	}
        /*(1)の代わりにこれでも代入できる
        string s = to_string(count);
        ret_map.at(i).at(j) = s.at(0);
        */
      }//if文終了
    }
  }//ループ終了
  ret ret_map;
}

Compiler output:
a.cc: In function 'std::vector<std::__cxx11::basic_string<char> > dot_to_minenumber(const std::vector<std::__cxx11::basic_string<char> >&)':
a.cc:43:3: error: 'ret' was not declared in this scope
   43 |   ret ret_map;
      |   ^~~
a.cc:44:1: warning: no return statement in function returning non-void [-Wreturn-type]
   44 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
 
void dot_to_minenumber(vector<string>& map);
 
int main(){
  //入力
  int H, W;
  cin >> H >> W;
  vector<string> map(H);
  for ( int i = 0; i < map.size() ; i++) cin >> map.at(i);
  
  //処理
  dot_to_minenumber(map);
  
  //出力
  for ( string x : map ) cout << x << endl;
}
 
void dot_to_minenumber(vector<string>& map){
  vector<int> row = { -1 , 0 , 1};
  vector<int> column = { -1 , 0 , 1};//ある点の周辺を調べる用
  for ( int i = 0 ; i < map.size(); i++){
    for ( int j = 0 ; j < map.at(0).size(); j++){//マップの全探索
      if ( map.at(i).at(j) == '.'){//その点が地雷ではないとき
        int count = 0;
      	for ( int x : row ){
       	 for ( int y : column){
          	if (0 <= (i + x) && (i + x) < map.size() && 
                0 <= (j + y) && (j + y ) < map.at(0).size() &&
                map.at(i + x).at(j + y) == '#' ) count++;//その点回りに文字が存在し、かつ地雷ならcount++
                   map.at(i).at(j) = '0' + count;//(1)よく知らないけどこれでintをcharで代入できる
       	 }
      	}
        /*(1)の代わりにこれでも代入できる
        string s = to_string(count);
        map.at(i).at(j) = s.at(0);
        */
      }//if文終了
    }
  }//ループ終了

Compiler output:
a.cc: In function 'void dot_to_minenumber(std::vector<std::__cxx11::basic_string<char> >&)':
a.cc:41:4: error: expected '}' at end of input
   41 |   }//ループ終了
      |    ^
a.cc:20:44: note: to match this '{'
   20 | void dot_to_minenumber(vector<string>& map){
      |                                            ^
Language: C++

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

void dot_to_minenumber(vector<string>& map){}

int main(){
  //入力
  int H, W;
  cin >> H >> W;
  vector<string> map(H);
  for ( int i = 0; i < map.size() ; i++) cin >> map.at(i);
  
  //処理
  dot_to_minenumber(map);
  
  //出力
  for ( string x : map ) cout << x << endl;
}

void dot_to_minenumber(vector<string>& map){
  vector<int> row = { -1 , 0 , 1};
  vector<int> column = { -1 , 0 , 1};//ある点の周辺を調べる用
  for ( int i = 0 ; i < map.size(); i++){
    for ( int j = 0 ; j < map.at(0).size(); j++){//マップの全探索
      if ( map.at(i).at(j) == '.'){//その点が地雷ではないとき
        int count = 0;
      	for ( int x : row ){
       	 for ( int y : column){
          	if (0 <= (i + x) && (i + x) < map.size() && 
                0 <= (j + y) && (j + y ) < map.at(0).size() &&
                map.at(i + x).at(j + y) == '#' ) count++;//その点回りに文字が存在し、かつ地雷ならcount++
                   map.at(i).at(j) = '0' + count;//(1)よく知らないけどこれでintをcharで代入できる
       	 }
      	}
        /*(1)の代わりにこれでも代入できる
        string s = to_string(count);
        map.at(i).at(j) = s.at(0);
        */
      }//if文終了
    }
  }//ループ終了
}

Compiler output:
a.cc:20:6: error: redefinition of 'void dot_to_minenumber(std::vector<std::__cxx11::basic_string<char> >&)'
   20 | void dot_to_minenumber(vector<string>& map){
      |      ^~~~~~~~~~~~~~~~~
a.cc:4:6: note: 'void dot_to_minenumber(std::vector<std::__cxx11::basic_string<char> >&)' previously defined here
    4 | void dot_to_minenumber(vector<string>& map){}
      |      ^~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int H, W;
  cin >> H >> W;
  vector<string> map(H);
  for ( int i = 0; i < map.size() ; i++){
    cin >> map.at(i);
  }
  vector<int> row = { -1 , 0 , 1};
  vector<int> column = { -1 , 0 , 1};
  for ( int i = 0 ; i < map.size(); i++){
    for ( int j = 0 ; j < map.at(0).size(); j++){
      if ( map.at(i).at(j) == '.'){
      	int count = 0;
      	for ( x : row ){
       	 for ( y : column){
          	if ( map.at(i + x).at(j + y) == '#' ) count++;
       	 }
      	}
        map.at(i).at(j) = to_string(count);
      }
    }
  }
  
  for ( x : map ){
    cout << x << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:17: error: found ':' in nested-name-specifier, expected '::'
   16 |         for ( x : row ){
      |                 ^
      |                 ::
a.cc:16:15: error: 'x' has not been declared
   16 |         for ( x : row ){
      |               ^
a.cc:21:36: 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
   21 |         map.at(i).at(j) = to_string(count);
      |                           ~~~~~~~~~^~~~~~~
      |                                    |
      |                                    std::string {aka std::__cxx11::basic_string<char>}
a.cc:22:7: error: expected primary-expression before '}' token
   22 |       }
      |       ^
a.cc:21:44: error: expected ')' before '}' token
   21 |         map.at(i).at(j) = to_string(count);
      |                                            ^
      |                                            )
   22 |       }
      |       ~                                     
a.cc:16:13: note: to match this '('
   16 |         for ( x : row ){
      |             ^
a.cc:22:7: error: expected primary-expression before '}' token
   22 |       }
      |       ^
a.cc:26:11: error: found ':' in nested-name-specifier, expected '::'
   26 |   for ( x : map ){
      |           ^
      |           ::
a.cc:26:9: error: 'x' has not been declared
   26 |   for ( x : map ){
      |         ^
a.cc:29:1: error: expected primary-expression before '}' token
   29 | }
      | ^
a.cc:28:4: error: expected ';' before '}' token
   28 |   }
      |    ^
      |    ;
   29 | }
      | ~   
a.cc:29:1: error: expected primary-expression before '}' token
   29 | }
      | ^
a.cc:28:4: error: expected ')' before '}' token
   28 |   }
      |    ^
      |    )
   29 | }
      | ~   
a.cc:26:7: note: to match this '('
   26 |   for ( x : map ){
      |       ^
a.cc:29:1: error: expected primary-expression before '}' token
   29 | }
      | ^
Language: C

#include<stdio.h>
int main(){
  int i,j,h,w,a[52][52];
  char x[50][50];
  scanf("%d %d",&h,&w);
  for(i=1;i<=h;i++){
      scanf("%c",x[i]);
    }
  }
  for(i=0;i<=h+1;i++){
    for(j=0;j<=w+1;j++){
      a[i][j]=0;
    }
  }
  for(i=1;i<=h;i++){
    for(j=1;j<=w;j++){
      if(x[i-1][j-1]=='#'){
        a[i-1][j-1]++;
        a[i-1][j]++;
        a[i-1][j+1]++;
        a[i][j-1]++;
        a[i][j+1]++;
        a[i+1][j-1]++;
        a[i+1][j]++;
        a[i+1][j+1]++;
      }
    }
  }
  for(i=1;i<=h;i++){
    for(j=1;j<=w;j++){
      if(x[i][j]=='#'){printf("#");}
      else{printf("%d",a[i][j]);}
    }
    printf("\n");
  }
}

Compiler output:
main.c:10:3: error: expected identifier or '(' before 'for'
   10 |   for(i=0;i<=h+1;i++){
      |   ^~~
main.c:10:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<=' token
   10 |   for(i=0;i<=h+1;i++){
      |            ^~
main.c:10:19: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
   10 |   for(i=0;i<=h+1;i++){
      |                   ^~
main.c:15:3: error: expected identifier or '(' before 'for'
   15 |   for(i=1;i<=h;i++){
      |   ^~~
main.c:15:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<=' token
   15 |   for(i=1;i<=h;i++){
      |            ^~
main.c:15:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
   15 |   for(i=1;i<=h;i++){
      |                 ^~
main.c:29:3: error: expected identifier or '(' before 'for'
   29 |   for(i=1;i<=h;i++){
      |   ^~~
main.c:29:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<=' token
   29 |   for(i=1;i<=h;i++){
      |            ^~
main.c:29:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
   29 |   for(i=1;i<=h;i++){
      |                 ^~
main.c:36:1: error: expected identifier or '(' before '}' token
   36 | }
      | ^
Language: C

#include<stdio.h>
int main(){
  int i,j,h,w,a[52][52];
  char x[52][52];
  scanf("%d %d",&h,&w);
  for(i=1;i<=h;i++){
      scanf("%c",x[i]);
    }
  }
  for(i=0;i<=h+1;i++){
    for(j=0;i<=w+1;i++){
      a[i][j]=0;
    }
  }
  for(i=1;i<=h;i++){
    for(j=1;i<=w;i++){
      if(x[i][j]=='#'){
        a[i-1][j-1]++;
        a[i-1][j]++;
        a[i-1][j+1]++;
        a[i][j-1]++;
        a[i][j+1]++;
        a[i+1][j-1]++;
        a[i+1][j]++;
        a[i+1][j+1]++;
      }
    }
  }
  for(i=1;i<=h;i++){
    for(j=1;i<=w;i++){
      if(x[i][j]=='#'){printf("#");}
      else{printf("%d",a[i][j]);}
    }
    printf("\n");
  }
}

Compiler output:
main.c:10:3: error: expected identifier or '(' before 'for'
   10 |   for(i=0;i<=h+1;i++){
      |   ^~~
main.c:10:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<=' token
   10 |   for(i=0;i<=h+1;i++){
      |            ^~
main.c:10:19: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
   10 |   for(i=0;i<=h+1;i++){
      |                   ^~
main.c:15:3: error: expected identifier or '(' before 'for'
   15 |   for(i=1;i<=h;i++){
      |   ^~~
main.c:15:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<=' token
   15 |   for(i=1;i<=h;i++){
      |            ^~
main.c:15:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
   15 |   for(i=1;i<=h;i++){
      |                 ^~
main.c:29:3: error: expected identifier or '(' before 'for'
   29 |   for(i=1;i<=h;i++){
      |   ^~~
main.c:29:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<=' token
   29 |   for(i=1;i<=h;i++){
      |            ^~
main.c:29:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
   29 |   for(i=1;i<=h;i++){
      |                 ^~
main.c:36:1: error: expected identifier or '(' before '}' token
   36 | }
      | ^
Language: C

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

int main(){
  int H,W,X;
  cin >> H >> W;
  vector<vector<char>> sq(H, vector<char>(W));
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin >> sq.at(i).at(j);
    }
  }
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(sq.at(i).at(j)=='#') continue;
      X=0;
      if(i>0){
        if(j>0 && sq.at(i-1).at(j-1)=='#') X++;
        if(sq.at(i-1).at(j)=='#') X++;
        if(j<W-1 && sq.at(i-1).at(j+1)=='#') X++;
      }
      if(j>0 && sq.at(i).at(j-1)=='#') X++;
      if(j<W-1 && sq.at(i).at(j+1)=='#') X++;
      if(i<H-1){
        if(j>0 && sq.at(i+1).at(j-1)=='#') X++;
        if(sq.at(i+1).at(j)=='#') X++;
        if(j<W-1 && sq.at(i+1).at(j+1)=='#') X++;
      }
      sq.at(i).at(j)= '0'+ X;
    }
  }
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cout << sq.at(i).at(j);
      if(j==W-1) cout << endl;
    }
  }
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

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

int main(){
  int h, w;
  vector<string> s(h);
  cin >> h >> w;

  for(int i=0; i<h; ++i) cin >> s[i];
  
  const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
  const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1,};
  for(int i=0; i<h; ++i){ 
    for(int j=0; j<w; ++j){
      if(s[i][j] == "#") continue;

      int num = 0;
      for(int d=0; d<8; ++d){
        const int ni = i + dy[d];
        const int nj = j + dx[d];

        if(ni<0 or h<=ni) continue;
        if(nj<0 or w<=nj) continue;
        if(s[ni][nj] == "#") num++;
      }
      s[i][j] = char(num + '0');
    }
  }

  for(int i=0; i<h; ++i) cout << s[i] << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   17 |       if(s[i][j] == "#") continue;
a.cc:26:22: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   26 |         if(s[ni][nj] == "#") num++;
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H, W;
  cin >> H >> W;
  vector<string> masu;
  for(int i=0 ; i<H ; i++){
    cin>>masu.at(i)
  }
  
  for(int i=0 ; i<H ; i++){
    for(int j=0 ; j<W ; j++){
      if(masu.at(i).at(j) == '.'){
        int mine = 0;
        for(int k=i-1 ; k<i+2 ; k++){
   	     for(int l=j-1 ; l<j+2 ; l++){
           if(k<0 || l<0 || k>H-1 || l>W-1 ||(k==i && l==j)){continue;}
           if(masu.at(k).at(l) == '#'){mine++;}
         }
        }
        cout << mine;
      }else{cout<<'#';}
    }
    cout << endl;
  }
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:20: error: expected ';' before '}' token
    9 |     cin>>masu.at(i)
      |                    ^
      |                    ;
   10 |   }
      |   ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H, W;
  cin >> H >> W;
  vector<string> masu;
  for(int i=0 ; i<H ; i++){
    cin>>masu.at(i)
  }
  
  for(int i=0 ; i<H ; i++){
    for(int j=0 ; j<W ; j++){
      if(masu.at(i).at(j) == '.'){
        int mine = 0;
        for(int k=i-1 ; k<i+2 ; k++){
   	     for(int l=j-1 ; l<j+2 ; l++){
           if(k<0 || l<0 || k>H-1 || l>W-1 ||(k==i && l==j)){continue;}
           if(masu.at(k).at(l) == '#'){mint++;}
         }
        }
        cout << mine;
      }else{cout<<'#';}
    }
    cout << endl;
  }
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:20: error: expected ';' before '}' token
    9 |     cin>>masu.at(i)
      |                    ^
      |                    ;
   10 |   }
      |   ~                 
a.cc:19:40: error: 'mint' was not declared in this scope; did you mean 'mine'?
   19 |            if(masu.at(k).at(l) == '#'){mint++;}
      |                                        ^~~~
      |                                        mine
Language: C++

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

string board[60];
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int main(){
  int X,Y;
  cin >> X >> Y;
  for (int i=0;i<X;++i) cin >> board[i];
  
  for (int i=0;i<X;++i){
    for (int j=0;j<Y;++j){
      if (board[i][j]=='.'){
        int cnt=0;
        for (int k=0;k<8;++k){
          int x=i+dx[k];
          int y=i+dy[k];
          if (x>=0&&x<X&&y>=0&&y<Y&&board[x][y]=='#'){
            cnt++;
          }
        }
      }
                board[i][j]='0'+cnt;//数字の1から文字の1になる
    }
  }
  for (int i=0;i<X;++i) cout << board[i] << endl;
}
          


Compiler output:
a.cc: In function 'int main()':
a.cc:25:33: error: 'cnt' was not declared in this scope; did you mean 'int'?
   25 |                 board[i][j]='0'+cnt;//数字の1から文字の1になる
      |                                 ^~~
      |                                 int
Language: C++

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

int main() {
  int H, W;
  vector<vector<char>> v(H,vector<char>(W) );
  
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      cin >> v[i][j];
    }
  }
  
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      int t=0;
      if(v[i][j] == '.'){
        if(j!=0 && v[i][j-1]=='#')
          t++;
        if(j!=0 && i!=0 && v[i-1][j-1]=='#')
          t++;
        if(j!=0 && (i+1)!=H && v[i+1][j-1]=='#')
          t++;
        if(i!=0 && v[i-1][j]=='#')  t++;
        if((i+1)!=H && v[i+1][j]=='#')  t++;
        if((j+1)!=W){
          if(i!=0 &&v[i-1][j+1]=='#')  t++;
          if(v[i][j+1]=='#')  t++;
          if((i+1)!=H &&v[i+1][j+1]=='#')  t++;
        }
      }
      char q =to_char(t);
      v[i][j] = q;
    }
  }
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      cout << v[i][j];
    }
    cout <<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:15: error: 'to_char' was not declared in this scope; did you mean 'u_char'?
   32 |       char q =to_char(t);
      |               ^~~~~~~
      |               u_char
Language: C++

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

int main() {
  int H, W;
  vector<vector<char>> v(H,vector<char>(W) );
  
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      cin >> v[i][j];
    }
  }
  
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      int t=0;
      if(v[i][j] == '.'){
        if(j!=0 && v[i][j-1]=='#')
          t++;
        if(j!=0 && i!=0 && v[i-1][j-1]=='#')
          t++;
        if(j!=0 && (i+1)!=H && v[i+1][j-1]=='#')
          t++;
        if(i!=0 && v[i-1][j]=='#')  t++;
        if((i+1)!=H && v[i+1][j]=='#')  t++;
        if((j+1)!=W){
          if(i!=0 &&v[i-1][j+1]=='#')  t++;
          if(v[i][j+1]=='#')  t++;
          if((i+1)!=H &&v[i+1][j+1]=='#')  t++;
        }
      }
      char q =to_string(t);
      v[i][j] = q;
    }
  }
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      cout << v[i][j];
    }
    cout <<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:24: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'char' in initialization
   32 |       char q =to_string(t);
      |               ~~~~~~~~~^~~
      |                        |
      |                        std::string {aka std::__cxx11::basic_string<char>}
Language: C++

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

int main() {
  int H, W;
  vector<vector<char>> v(H,vector<char>(W) );
  
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      cin >> v[i][j];
    }
  }
  
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      int t=0;
      if(v[i][j] == '.'){
        if(j!=0 && v[i][j-1]=='#')
          t++;
        if(j!=0 && i!=0 && v[i-1][j-1]=='#')
          t++;
        if(j!=0 && (i+1)!=H && v[i+1][j-1]=='#')
          t++;
        if(i!=0 && v[i-1][j]=='#')  t++;
        if((i+1)!=H && v[i+1][j]=='#')  t++;
        if((j+1)!=W){
          if(i!=0 &&v[i-1][j+1]=='#')  t++;
          if(v[i][j+1]=='#')  t++;
          if((i+1)!=H &&v[i+1][j+1]=='#')  t++;
        }
      }
      v[i][j] = to_string(t);
    }
  }
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      cout << v[i][j];
    }
    cout <<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:26: 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
   32 |       v[i][j] = to_string(t);
      |                 ~~~~~~~~~^~~
      |                          |
      |                          std::string {aka std::__cxx11::basic_string<char>}
Language: C++

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

int main() {
  int H, W;
  vector<vector<char>> v(H,vector<char>(W) );
  
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      cin >> v[i][j];
    }
  }
  
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      if(v[i][j] == '.'){
        int t=0;
        if(j!=0 && v[i][j-1]=='#')
          t++;
        if(j!=0 && i!=0 && v[i-1][j-1]=='#')
          t++;
        if(j!=0 && (i+1)!=H && v[i+1][j-1]=='#')
          t++;
        if(i!=0 && v[i-1][j]=='#')  t++;
        if((i+1)!=H && v[i+1][j]=='#')  t++;
        if((j+1)!=W){
          if(i!=0 &&v[i-1][j+1]=='#')  t++;
          if(v[i][j+1]=='#')  t++;
          if((i+1)!=H &&v[i+1][j+1]=='#')  t++;
        }
      }
      v[i][j] = to_string(t);
    }
  }
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      cout << v[i][j];
    }
    endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:27: error: 't' was not declared in this scope
   32 |       v[i][j] = to_string(t);
      |                           ^
a.cc:39:9: error: statement cannot resolve address of overloaded function
   39 |     endl;
      |         ^
Language: C++

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

int main() {
  int H, W;
  vector<vector<char>> v(H,vector<char>(W) );
  
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      cin >> v[i][j];
    }
  }
  
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      if(v[i][j] == "."){
        int t=0;
        if(j!=0 && v[i][j-1]=="#")
          t++;
        if(j!=0 && i!=0 && v[i-1][j-1]=="#")
          t++;
        if(j!=0 && (i+1)!=H && v[i+1][j-1]=="#")
          t++;
        if(i!=0 && v[i-1][j]=="#")  t++;
        if((i+1)!=H && v[i+1][j]=="#")  t++;
        if((j+1)!=W){
          if(i!=0 &&v[i-1][j+1]=="#")  t++;
          if(v[i][j+1]=="#")  t++;
          if((i+1)!=H &&v[i+1][j+1]=="#")  t++;
        }
      }
      v[i][j] = to_string(t);
    }
  }
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      cout << v[i][j];
    }
    endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   16 |       if(v[i][j] == "."){
a.cc:18:29: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   18 |         if(j!=0 && v[i][j-1]=="#")
a.cc:20:39: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   20 |         if(j!=0 && i!=0 && v[i-1][j-1]=="#")
a.cc:22:43: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   22 |         if(j!=0 && (i+1)!=H && v[i+1][j-1]=="#")
a.cc:24:29: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   24 |         if(i!=0 && v[i-1][j]=="#")  t++;
a.cc:25:33: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   25 |         if((i+1)!=H && v[i+1][j]=="#")  t++;
a.cc:27:32: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   27 |           if(i!=0 &&v[i-1][j+1]=="#")  t++;
a.cc:28:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   28 |           if(v[i][j+1]=="#")  t++;
a.cc:29:36: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   29 |           if((i+1)!=H &&v[i+1][j+1]=="#")  t++;
a.cc:32:27: error: 't' was not declared in this scope
   32 |       v[i][j] = to_string(t);
      |                           ^
a.cc:39:9: error: statement cannot resolve address of overloaded function
   39 |     endl;
      |         ^
Language: C++

#include<iostream>
using namespace std;
int main(){
  int h,w;
  cin>>h>>w;
  string board[50];
  for(int i=0;i<h;i++) cin>>board[i];
  
  const int dx[8]={1,0,-1,0,1,-1,-1,1};
  const int dy[8]={0,1,0,-1,1,1,-1,-1};
  
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(board[i][j]=='#') continue;
      
      int num=0;
      for(int d=0;d<8;d++){
        const int nj=i+dy[d];
        const int nj=j+dx[d];
        
        if(nj<0||h<=nj) continue;
        if(nj<0||w<=nj) continue;
        if(board[nj][nj]=='#') num++;
      }
      board[i][j]=char(num+'0');
    }
  }
  
  for(int i=0;i<h;i++) cout<<board[i]<<endl;
  return 0;
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:19:19: error: redeclaration of 'const int nj'
   19 |         const int nj=j+dx[d];
      |                   ^~
a.cc:18:19: note: 'const int nj' previously declared here
   18 |         const int nj=i+dy[d];
      |                   ^~