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

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

int main() {
  int h, w;
  cin >> h >> w;
  
  vector<string> s(w);
  for (int i = 0; i < h; i++) {
    cin >> s.at(i);
  }
  
  vector<int> dx = {1, 0, -1, 0, 1, -1, -1, 1};
  vector<int> dy = {0, 1, 0, -1, 1, 1, -1, -1};
  
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (s.at(i).at(j) == '#') {
        continue;
      }
      
      int num = 0;
      for (int d = 0; d < 8; d++) {
        int ni = i + dy.at(d);
        int nj = j + dx.at(d);
        
        if (ni < 0 or h <= ni) {
          continue;
        }
        if (nj < 0 or w <= nj) {
          continue;
        }
        if (s.at(ni).at(nj) == '#') {
          num++;
        }
      }
      
      s.at(i).at(j) =　char (num);
      
    }
  }
  
  for (int i = 0; i < h; ++i) cout << s.at(i) << endl;

  return 0;
  
}


Compiler output:
a.cc:38:22: error: extended character 　 is not valid in an identifier
   38 |       s.at(i).at(j) =　char (num);
      |                      ^
a.cc: In function 'int main()':
a.cc:38:22: error: '\U00003000char' was not declared in this scope
   38 |       s.at(i).at(j) =　char (num);
      |                      ^~~~~~
Language: C++

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

int main() {
  int h, w;
  cin >> h >> w;
  
  vector<string> s(w);
  for (int i = 0; i < h; i++) {
    cin >> s.at(i);
  }
  
  vector<int> dx(8) = {1, 0, -1, 0, 1, -1, -1, 1};
  vector<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.at(i).at(j) == '#') {
        continue;
      }
      
      int num = 0;
      for (int d = 0; d < 8; d++) {
        int ni = i + dy.at(d);
        int nj = j + dx.at(d);
        
        if (ni < 0 or h <= ni) {
          continue;
        }
        if (nj < 0 or w <= nj) {
          continue;
        }
        if (s.at(ni).at(nj) == '#') {
          num++;
        }
      }
      
      s.at(i).at(j) =　char (num + ’0’);
      
    }
  }
  
  for (int i = 0; i < h; ++i) cout << s.at(i) << endl;

  return 0;
  
}


Compiler output:
a.cc:38:22: error: extended character 　 is not valid in an identifier
   38 |       s.at(i).at(j) =　char (num + ’0’);
      |                      ^
a.cc:38:36: error: extended character ’ is not valid in an identifier
   38 |       s.at(i).at(j) =　char (num + ’0’);
      |                                    ^
a.cc:38:36: error: extended character ’ is not valid in an identifier
a.cc: In function 'int main()':
a.cc:13:21: error: expected ',' or ';' before '=' token
   13 |   vector<int> dx(8) = {1, 0, -1, 0, 1, -1, -1, 1};
      |                     ^
a.cc:14:21: error: expected ',' or ';' before '=' token
   14 |   vector<int> dy(8) = {0, 1, 0, -1, 1, 1, -1, -1};
      |                     ^
a.cc:38:36: error: '\U000020190\U00002019' was not declared in this scope
   38 |       s.at(i).at(j) =　char (num + ’0’);
      |                                    ^~~
a.cc:38:22: error: '\U00003000char' was not declared in this scope
   38 |       s.at(i).at(j) =　char (num + ’0’);
      |                      ^~~~~~
Language: C++

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

int main() {
  int h, w;
  cin >> h >> w;
  
  vector<string> s(w);
  for (int i = 0; i < h; i++) {
    cin >> s.at(i);
  }
  
  vector<int> dx(8) = {1, 0, -1, 0, 1, -1, -1, 1};
  vector<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.at(i).at(j) == '#') {
        continue;
      }
      
      int num = 0;
      for (int d = 0; d < 8; d++) {
        int ni = i + dy.at(d);
        int nj = j + dx.at(d);
        
        if (ni < 0 or h <= ni) {
          continue;
        }
        if (nj < 0 or w <= nj) {
          continue;
        }
        if (s.at(ni).at(nj) == '#') {
          num++;
        }
      }
      
      s.at(i).at(j) =　char (num + ’0’);
      
    }
  }
  
  for (int i = 0; i < h; ++i) cout << board[i] << endl;

  return 0;
  
}


Compiler output:
a.cc:38:22: error: extended character 　 is not valid in an identifier
   38 |       s.at(i).at(j) =　char (num + ’0’);
      |                      ^
a.cc:38:36: error: extended character ’ is not valid in an identifier
   38 |       s.at(i).at(j) =　char (num + ’0’);
      |                                    ^
a.cc:38:36: error: extended character ’ is not valid in an identifier
a.cc: In function 'int main()':
a.cc:13:21: error: expected ',' or ';' before '=' token
   13 |   vector<int> dx(8) = {1, 0, -1, 0, 1, -1, -1, 1};
      |                     ^
a.cc:14:21: error: expected ',' or ';' before '=' token
   14 |   vector<int> dy(8) = {0, 1, 0, -1, 1, 1, -1, -1};
      |                     ^
a.cc:38:36: error: '\U000020190\U00002019' was not declared in this scope
   38 |       s.at(i).at(j) =　char (num + ’0’);
      |                                    ^~~
a.cc:38:22: error: '\U00003000char' was not declared in this scope
   38 |       s.at(i).at(j) =　char (num + ’0’);
      |                      ^~~~~~
a.cc:43:39: error: 'board' was not declared in this scope
   43 |   for (int i = 0; i < h; ++i) cout << board[i] << endl;
      |                                       ^~~~~
Language: C++

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

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

  vector<string> grid(h+2);
  string frame(w+2, '-');
  grid.at(0) = frame;
  grid.at(h+1) = frame;

  for (int i = 1; i < h+1; i++) {
    string row;
    cin >> row;
    row = "-" + x + "-";
    grid.at(i) = row;
  }
  
  for (int i = 1; i < h+1; i++) {
    for (int j = 1; j < w+1; j++) {
      if (grid.at(i).at(j) == '#') {
        cout << '#';
      } else {
        int cnt = 0;
        for (int y = -1; y <= 1; y++) {
          for (int x = -1; x <= 1; x++) {
            if (grid.at(i + y).at(j + x) == '#') cnt++;
          }
        }
        cout << cnt;
      }
      if (j == w) cout << endl;
    }
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:17: error: 'x' was not declared in this scope
   16 |     row = "-" + x + "-";
      |                 ^
Language: C++

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

int main() {
  int h, w;
  cin >> h >> w;
  
  string board[50];
  for(int i =0; i < h * w; 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++){
    for(int j = 0; j < w; j++){
      cout << board[i][j];
    }
    cout >>　endl;
  }
  return 0;
}
          
        
  


Compiler output:
a.cc:37:12: error: extended character 　 is not valid in an identifier
   37 |     cout >>　endl;
      |            ^
a.cc: In function 'int main()':
a.cc:37:12: error: '\U00003000endl' was not declared in this scope
   37 |     cout >>　endl;
      |            ^~~~~~
Language: C++

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

int main() {
  int h, w;
  cin >> h >> w;
  
  string board[50];
  
  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: In function 'int main()':
a.cc:13:3: error: expected ',' or ';' before 'for'
   13 |   for(int i = 0; i < h; ++i){
      |   ^~~
a.cc:13:18: error: 'i' was not declared in this scope
   13 |   for(int i = 0; i < h; ++i){
      |                  ^
Language: C++

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

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

    int h, w;
    string s[100];

    cin >> h >> w;

    rep(i,h){
        cin >> s[i];
    }

    rep(i,h){
        rep(j,w){
            int a=0;

            if(s[i][j]=='#'){
               // t[i][j] = '#';
                continue;
            }

            rep(k,8){
                const int ii = i + dx[k];
                const int jj = j + dy[k];

                if(ii<0||ii>w-1){
                    continue;
                }
                if(jj<0||jj>h-1){
                    continue;
                }

                if(s[i+dx[k]][j+dy[k]]=='#'){
                    a++;
                }
            }

            //s[i][j] = char(a+'0');
            s[i][j] = to_string(a);
        }
    }
    rep(i,h){
        cout << s[i] << endl;
    }
}

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

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

int main(void) {
    int H,W;cin>>H>>W;
    char bobm[H+2][W+2];
    for (int j = 0; j <= W; j++) {
        bobm[0][j] = '.';
        bobm[H+1][j] = '.';
    }
    for (int i = 0; i <= H; i++) {
        bobm[i][0] = '.';
        bobm[i][W+1] = '.';
    }
    for (int i = 1; i <= H; i++) {
        string h;cin>>h;
        for (int j = 1; j <= W; j++) {
            bobm[i][j] = h[j - 1];
        }
    }
    // 結果出力
    for (int i = 1; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            char ch = bobm[i][j];
            if (ch == '#') cout << "#"; 
            else {
                vector<char> vc;
                vc.push_back(bobm[i-1][j]);
                vc.push_back(bobm[i-1][j-1]);
                vc.push_back(bobm[i-1][j+1]);
                vc.push_back(bobm[i][j-1]);
                vc.push_back(bobm[i][j+1]);
                vc.push_back(bobm[i+1][j-1]);
                vc.push_back(bobm[i+1][j]);
                vc.push_back(bobm[i+1][j+1]);
                cout << count(vc.begin(), vc.end(), '#');
            }
        }
        cout << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:25: error: 'count' was not declared in this scope
   37 |                 cout << count(vc.begin(), vc.end(), '#');
      |                         ^~~~~
Language: C++

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

int main() {
  int H, W;
  cin >> H >> W;
  vector<string> table(H);
  vector<int> dy = {1,0,-1,-1,-1,0,1,1};
  vector<int> dx = {1,1,1,0,-1,-1,-1,0};
  for (int i = 0; i < H; i++) {
    cin >> table[i];
  }
  for (int i = 0; i < H; i++) {
    for (in t j = 0; j < W; j++) {
      if (table[i][j] == '#') {
        continue;
      }
      int count = 0;
      for (int k = 0; k < 8; k++) {
        int ny = i + dy[k];
        int nx = j + dx[k];
        if (ny < 0 || ny >= H || nx < 0 || bx >= W) {
          continue;
        }
        if (table[ny][nx] == '#') {
          count++;
        }
      table[i][j] = (char)(count + '0');
      }
    }
  }
  for (int i = 0; i < H; i++) {
    cout << table[i] << endl;
  }
}

    
    
      

Compiler output:
a.cc: In function 'int main()':
a.cc:16:10: error: 'in' was not declared in this scope; did you mean 'i'?
   16 |     for (in t j = 0; j < W; j++) {
      |          ^~
      |          i
a.cc:16:22: error: 'j' was not declared in this scope
   16 |     for (in t j = 0; j < W; j++) {
      |                      ^
a.cc:24:44: error: 'bx' was not declared in this scope; did you mean 'nx'?
   24 |         if (ny < 0 || ny >= H || nx < 0 || bx >= W) {
      |                                            ^~
      |                                            nx
Language: C++

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

int main(){
  int H, W;
  cin >> H >> W;
  
  string s1, s2, s3;
  string fake = "";
  for(int i=0;i<W+2;i++)
    fake += '.';
  
  cin >> s3;
  
  for(int i=0;i<H-1;i++){
    if(i==0)
      s1 = fake;
    else
      s1=s2;
    
    s2=s3;
    
    if(i==H-2)
	  s3 = fake;
  	else{
      cin >> s3;
      s3 = '.'+s3+'.';
    }
 
    for(int j=0;j<W;j++){
      if(s2.at(j+1)=='#')
        cout << '#';
      else
        int c=0;
      	for(int k=0;k<3;k++){
          if(s1.at(j+k)=='#')
            c++;
          if(s2.at(j+k)=='#')
            c++; // here s2.at(j+1) itself is not '#'
          if(s3.at(j+k)=='#')
            c++;
        }
        cout << c;
      
    }
    cout << endl;
    
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:13: error: 'c' was not declared in this scope
   37 |             c++;
      |             ^
a.cc:39:13: error: 'c' was not declared in this scope
   39 |             c++; // here s2.at(j+1) itself is not '#'
      |             ^
a.cc:41:13: error: 'c' was not declared in this scope
   41 |             c++;
      |             ^
a.cc:43:17: error: 'c' was not declared in this scope
   43 |         cout << c;
      |                 ^
Language: C++

using namespace std;

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;

int main() {
    int H, W; cin >> H >> W;
    vector<string> s(H);
    for(int i = 0; i < H; i++){
        cin >> s[i];
    }
    int dx[] = {1, 0, -1, 0};
    int dy[] = {0, 1, 0, -1};
    int x[] = {-1, 1, -1, 1};
    int y[] = {1, 1, -1, -1};
    for(int h = 0; h < H; h++){
        for(int w = 0; w < W; w++){
            if(s[h][w] != '#'){
                int cnt = 0;
                for(int i = 0; i < 4; i++){
                    int nx = w + dx[i];
                    int ny = h + dy[i];
                    if(nx < 0 || W <= nx || ny < 0 || H <= ny) continue;
                    if(s[ny][nx] == '#') cnt++;
                }
                for(int i = 0; i < 4; i++){
                    int nx = w + x[i];
                    int ny = h + y[i];
                    if(nx < 0 || W <= nx || ny < 0 || H <= ny) continue;
                    if(s[ny][nx] == '#') cnt++;
                }
                char tmp = '0' + cnt;
                if(cnt > 0) s[h][w] = tmp;
                else s[h][w] = '0';
            }
        }
    }
    for(int i = 0; i < H; i++){
        cout << s[i] << endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:15: error: 'cin' was not declared in this scope
    8 |     int H, W; cin >> H >> W;
      |               ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:9:5: error: 'vector' was not declared in this scope
    9 |     vector<string> s(H);
      |     ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | using namespace std;
a.cc:9:12: error: 'string' was not declared in this scope
    9 |     vector<string> s(H);
      |            ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
  +++ |+#include <string>
    1 | using namespace std;
a.cc:9:20: error: 's' was not declared in this scope
    9 |     vector<string> s(H);
      |                    ^
a.cc:40:9: error: 'cout' was not declared in this scope
   40 |         cout << s[i] << endl;
      |         ^~~~
a.cc:40:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:40:25: error: 'endl' was not declared in this scope
   40 |         cout << s[i] << endl;
      |                         ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
Language: C++

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:50:34: error: expected ';' before '}' token
   50 |         cout << table.at(i).at(j)
      |                                  ^
      |                                  ;
   51 |       }
      |       ~                           
a.cc:57:2: error: expected '}' at end of input
   57 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

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

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

  vector<string> s(h);
  rep(i,h) cin >> s.at(i);
  
  rep(i,h) {
    rep(j,w) {
      if (s.at(i).at(j)) == '#' continue;
      if (s.at(i).at(j) == '.') {
        int a = 0;
        for (int m = -1; m <= 1; m++) {
          for (int l = -1; l <= 1; l++) {
            if (m == 0 && l == 0) continue;
            if (i + m >= 0 && i + m < h && j + l >= 0 && j + l < w) {
              if (s.at(i + m).at(j + l) == '#') a++;
              char b = '0' + a;
              s.at(i).at(j) = b;
            }
          }
        }
      }
    }
  }
  
  rep(i,h) cout << s.at(i) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:26: error: expected primary-expression before '==' token
   15 |       if (s.at(i).at(j)) == '#' continue;
      |                          ^~
Language: C++

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

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

  vector<string> s(h);
  rep(i,h) cin >> s.at(i);
  
  rep(i,h) {
    rep(j,w) {
      if (s.at(i).at(j) == '#' continue;
      if (s.at(i).at(j) == '.') {
        int a = 0;
        for (int m = -1; m <= 1; m++) {
          for (int l = -1; l <= 1; l++) {
            if (m == 0 && l == 0) continue;
            if (i + m >= 0 && i + m < h && j + l >= 0 && j + l < w) {
              if (s.at(i + m).at(j + l) == '#') a++;
              char b = '0' + a;
              s.at(i).at(j) = b;
            }
          }
        }
      }
    }
  }
  
  rep(i,h) cout << s.at(i) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:31: error: expected ';' before 'continue'
   15 |       if (s.at(i).at(j) == '#' continue;
      |                               ^~~~~~~~~
      |                               ;
a.cc:16:7: error: expected primary-expression before 'if'
   16 |       if (s.at(i).at(j) == '.') {
      |       ^~
a.cc:15:41: error: expected ')' before 'if'
   15 |       if (s.at(i).at(j) == '#' continue;
      |          ~                              ^
      |                                         )
   16 |       if (s.at(i).at(j) == '.') {
      |       ~~                                 
a.cc:29:5: error: expected primary-expression before '}' token
   29 |     }
      |     ^
Language: C

#include<stdio.h>

int main(){
  
  int H,W;
  int sum = 0;
  scanf("%d %d",&H,&W);

  char S[H][W];
  int Ans[H+1][W+1] = {0};
  for(int i=0; i<H; i++){
      scanf("%s",&S[i]);
      printf("%s\n",S[i]);
  }

  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
        if(S[i][j] == '#'){

          for(int k=-1; k<=1; k++){
            for(int l=-1; l<=1; l++){
              Ans[i+1+k][j+1+l]++;

            }
          }
        }

    }
  }

  for(int i=0; i<H+1; i++){
    for(int j=0; j<W+1; j++){
      if(S[i][j] == '#'){
        printf("#");
      }else{
        printf("%d",Ans[i+1][l+1]);
      }
      }
      printf("\n");
  }

  return 0;

}

Compiler output:
main.c: In function 'main':
main.c:10:23: error: variable-sized object may not be initialized except with an empty initializer
   10 |   int Ans[H+1][W+1] = {0};
      |                       ^
main.c:36:30: error: 'l' undeclared (first use in this function)
   36 |         printf("%d",Ans[i+1][l+1]);
      |                              ^
main.c:36:30: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <cmath>


using namespace std;
using ll = long long;

ll vx[8] = { -1, -1, -1, 0, 0, 1, 0, -1 };
ll vy[8] = { 1, 0, -1, 1, -1, 1, 0, -1 };

bool isOut(ll H, ll W, ll x, ll y) {
	if (x >= 0 && x < W && y >= 0 && y < H) return true;
	else return false;
}

int main() {
	ll H, W;
	cin >> H >> W;
	vector<string> str(H);
	vector<string> strans(H);
	for (ll i = 0; i < H; i++)
	{
		cin >> str[i];
		strans[i] = str[i];
	}
	for (ll i = 0; i < H; i++)
	{
		for (ll j = 0; j < W; j++)
		{
			if (str[i][j] == '.') {
				ll count = 0;
				for (ll k = 0; k < 8; k++)
				{
					if (isOut(H, W, j + vx[k], i + vy[k]) && str[i + vy[k]][j + vx[k]] == '#') count++;
				}
				strans[i][j] = to_string(count);
			}
			else {
				strans[i][j] = '#';
			}
		}
	}
	for (ll i = 0; i < H; i++)
	{
		cout << strans[i] << endl;
	}
	return 0;
}

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

//https://atcoder.jp/contests/abc075/tasks/abc075_b

#include <iostream>
using namespace std;

int main(){
    __int64 H,W;
    int counter = 0;
    // string S[51][51];
    string S[51];

    cin >> H >> W;
    for (int i = 0; i < H; i++){
        cin >> S[i];
    }
    for (int i = 0; i < H; i++){
            // cout << S[i] << endl;
    }
    // string num[H][W];
    int num[H][W];
    for (int i = 0; i < H; i++){
        for (int j = 0; j < W; j++){
            num[H][W] = 0;
        }
    }
    for (int i = 0; i < H; i++){
        for (int j = 0; j < W; j++){
            counter = 0;
            // if (S[i][j] == '.') printf("S[%d][%d]=clear\r\n",i,j);
            if (S[i][j] == '.'){
                for (int p = i-1; p <= i+1; p++){
                    for (int q = j-1; q <= j+1; q++){
                        if(p < 0 || q < 0 || p >= H || q >= W){
                            ;
                        }else{
                            if (S[p][q] == '#'){
                                counter ++;
                            }
                        }
                    }
                }
                num[i][j] = counter;
                // printf("num[%d][%d] = %d\r\n",i,j,num[i][j]);
            }
        }
    }
    for (int i = 0; i < H; i++){
        for (int j = 0; j < W; j++){
            if (S[i][j] == '.'){
                S[i][j] = '0' + num[i][j];
            }
        }
    }
    for (int i = 0; i < H; i++) {
        cout << S[i] << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
    7 |     __int64 H,W;
      |     ^~~~~~~
      |     __int64_t
a.cc:12:12: error: 'H' was not declared in this scope
   12 |     cin >> H >> W;
      |            ^
a.cc:12:17: error: 'W' was not declared in this scope
   12 |     cin >> H >> W;
      |                 ^
a.cc:23:13: error: 'num' was not declared in this scope; did you mean 'enum'?
   23 |             num[H][W] = 0;
      |             ^~~
      |             enum
a.cc:42:17: error: 'num' was not declared in this scope; did you mean 'enum'?
   42 |                 num[i][j] = counter;
      |                 ^~~
      |                 enum
a.cc:50:33: error: 'num' was not declared in this scope; did you mean 'enum'?
   50 |                 S[i][j] = '0' + num[i][j];
      |                                 ^~~
      |                                 enum
Language: C++

#include<bits/stdc++.h>
using namespace std;
int count(int a, int b, string s[]){
  int count = 0;
  for(int i = a; i < 3; i++){
    for(int j = b; j < 3; j++){
      if(S[i-1].at(j-1) == '#')
        count++;
    }
  }
  return count;
}

int main(){
  int H, X;
  cin >> H >> X;
  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 < X; j++){
      if(S[i].at(j) == '#'){
        cout << "#";
      }else 
        cout << count(i, j, S);
    }
    cout << endl;
  }
}


Compiler output:
a.cc: In function 'int count(int, int, std::string*)':
a.cc:7:10: error: 'S' was not declared in this scope
    7 |       if(S[i-1].at(j-1) == '#')
      |          ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int count(int a, int b, *string){
  int count = 0;
  for(int i = a; i < 3; i++){
    for(int j = b; j < 3; j++){
      if(S[i-1].at(j-1) == '#')
        count++;
    }
  }
  return count;
}

int main(){
  int H, X;
  cin >> H >> X;
  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 < X; j++){
      if(S[i].at(j) == '#'){
        cout << "#";
      }else 
        cout << count(i, j, S);
    }
    cout << endl;
  }
}

Compiler output:
a.cc:3:25: error: expected identifier before '*' token
    3 | int count(int a, int b, *string){
      |                         ^
a.cc: In function 'int count(int, int, int*)':
a.cc:7:10: error: 'S' was not declared in this scope
    7 |       if(S[i-1].at(j-1) == '#')
      |          ^
a.cc: In function 'int main()':
a.cc:25:22: error: no matching function for call to 'count(int&, int&, std::string [H])'
   25 |         cout << count(i, j, S);
      |                 ~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:4025:5: note: candidate: 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4025 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
/usr/include/c++/14/bits/stl_algo.h:4025:5: note:   template argument deduction/substitution failed:
a.cc:25:22: note:   variable-sized array type 'std::string [H]' {aka 'std::__cxx11::basic_string<char> [H]'} is not a valid template argument
   25 |         cout << count(i, j, S);
      |                 ~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note:   candidate expects 4 arguments, 3 provided
a.cc:3:5: note: candidate: 'int count(int, int, int*)'
    3 | int count(int a, int b, *string){
      |     ^~~~~
a.cc:3:26: note:   no known conversion for argument 3 from 'std::string [H]' {aka 'std::__cxx11::basic_string<char> [H]'} to 'int*'
    3 | int count(int a, int b, *string){
      |                         ~^~~~~~
Language: C++

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

 
int main() {
  
  string board[50];
  int h,W;
  int dx[]={-1,-1,-1,0,0,1,1,1};
  int dy[]={-1,0,1,-1,1,-1,0,1};
  cin>>h>>w;
  
 
  
  for(int i=0;i<h;i++)
  {
     cin>>board[i];
  }
  
  
  for(int i=0;i<h;i++)
  {
  for(int j=0;j<w;j++)
    {
       if(board[i][j]=='.')
       {
          int sum=0;
          for(int k=0;k<8;k++)
          {
             int x = i+dx[k];
             int y = j+dy[k];
           
            if(x>=0 && x<h && y>=0 && y<w&& board[x][y]=='#')
              sum++;
                         
          }
         board[i][j]=char(sum+'0');
       }
    }
  }
 
     for(int i=0;i<h;i++)
     {
       cout<<board[i]<<endl;
     }
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:11: error: 'w' was not declared in this scope
   12 |   cin>>h>>w;
      |           ^
Language: C++

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

 
int main() {
  
  string board[50];
  int h,W;
  int dx[]={-1,-1,-1,0,0,1,1,1};
  int dy[]={-1,0,1,-1,1,-1,0,1};
  cin>>h>>w;
  
 
  
  for(int i=0;i<h;i++)
  {
     cin>>board[i];
  }
  
  
  for(int i=0;i<h;i++)
  {
  for(int j=0;j<w;j++)
    {
       if(board[i][j]=='.')
       {
          int sum=0;
          for(int k=0;k<8;k++)
          {
             int x = i+dx[k];
             int y = j+dy[k];
           
            if(x>=0 && x<h && y>=0 && y<w&& board[x][y]=='#')
              sum++;
                         
          }
         board[i][j]=char(sum+'o');
       }
    }
  }
 
     for(int i=0;i<H;i++)
     {
       cout<<board[i]<<endl;
     }
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:11: error: 'w' was not declared in this scope
   12 |   cin>>h>>w;
      |           ^
a.cc:43:20: error: 'H' was not declared in this scope
   43 |      for(int i=0;i<H;i++)
      |                    ^
Language: C++

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

Compiler output:
a.cc:38:31: error: empty character constant
   38 |          board[i][j]=char(sum+'');
      |                               ^~
Language: C++

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

  int H,W;
  int dx[]={-1,-1,-1,0,0,1,1,1};
  int dy[]={-1,0,1,-1,1,-1,0,1};
  cin>>H>>W;
  
  string board[];
  
  for(int i=0;i<H;i++)
  {
     cin>>board[i];
  }
  
  for(int i=0;i<H;i++)
  {
  for(int j=0;j<W;j++)
    {
       if(board[i].at(j)=='.')
       {
         
          int sum=0;
          for(int k=0;k<8;k++)
          {
             int x = i+dx[k];
             int y = j+dy[k];
           
            if(x>=0&&x<H&&y>=0&&y<W&&board[x].at(y)=='#')
            {
              sum++;
            }                  
          }
         board[i].at(j)=sum;
       }
    }
  }

     for(int i=0;i<H;i++)
     {
       cout<<board[i]<<endl;
     }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:10: error: array size missing in 'board'
   11 |   string board[];
      |          ^~~~~
Language: C++

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

  int H,W;
  int dx[]={-1,-1,-1,0,0,1,1,1};
  int dy[]={-1,0,1,-1,1,-1,0,1};
  cin>>H>>W;
  
  string board[H];
  
  for(int i=0;i<H;i++)
  {
     cin>>board[i];
  }
  
  for(int i=0;i<H;i++)
  {
  for(int j=0;j<W;j++)
    {
       if(board[i].at(j)=='.')
       {
         
          int sum=0;
          for(int k=0;k<8;k++)
          {
             int x = i+dx[k];
             int y = j+dy[k];
           
            for(x>=0&&x<H&&y>=0&&y<W&&board[x].at(y)=='#')
            { sum++;}                  
          }
         board[i].at(j)=sum;
       }
    }
  }

     for(int i=0;i<H;i++)
     {
       cout<<board[i]<<endl;
     }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:58: error: expected ';' before ')' token
   31 |             for(x>=0&&x<H&&y>=0&&y<W&&board[x].at(y)=='#')
      |                                                          ^
      |                                                          ;
a.cc:33:11: error: expected primary-expression before '}' token
   33 |           }
      |           ^
a.cc:32:22: error: expected ';' before '}' token
   32 |             { sum++;}
      |                      ^
      |                      ;
   33 |           }
      |           ~           
a.cc:33:11: error: expected primary-expression before '}' token
   33 |           }
      |           ^
a.cc:32:22: error: expected ')' before '}' token
   32 |             { sum++;}
      |                      ^
      |                      )
   33 |           }
      |           ~           
a.cc:31:16: note: to match this '('
   31 |             for(x>=0&&x<H&&y>=0&&y<W&&board[x].at(y)=='#')
      |                ^
a.cc:33:11: error: expected primary-expression before '}' token
   33 |           }
      |           ^
Language: C++

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

  int H,W;
  int dx[]={-1,-1,-1,0,0,1,1,1};
  int dy[]={-1,0,1,-1,1,-1,0,1};
  cin>>H>>W;
  
  string board[];
  
  for(int i=0;i<H;i++)
  {
     cin>>board[i];
  }
  
  for(int i=0;i<H;i++)
  {
  for(int j=0;j<W;j++)
    {
       if(board[i].at(j)=='.')
       {
         
          int sum=0;
          for(int k=0;k<8;k++)
          {
             int x = i+dx[k];
             int y = j+dy[k];
           
            for(x>=0&&x<H&&y>=0&&y<W&&board[x].at(y)=='#')
            { sum++;}                  
          }
         board[i].at(j)=sum;
       }
    }
  }

     for(int i=0;i<H;i++)
     {
       cout<<board[i]<<endl;
     }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:10: error: array size missing in 'board'
   11 |   string board[];
      |          ^~~~~
a.cc:31:58: error: expected ';' before ')' token
   31 |             for(x>=0&&x<H&&y>=0&&y<W&&board[x].at(y)=='#')
      |                                                          ^
      |                                                          ;
a.cc:33:11: error: expected primary-expression before '}' token
   33 |           }
      |           ^
a.cc:32:22: error: expected ';' before '}' token
   32 |             { sum++;}
      |                      ^
      |                      ;
   33 |           }
      |           ~           
a.cc:33:11: error: expected primary-expression before '}' token
   33 |           }
      |           ^
a.cc:32:22: error: expected ')' before '}' token
   32 |             { sum++;}
      |                      ^
      |                      )
   33 |           }
      |           ~           
a.cc:31:16: note: to match this '('
   31 |             for(x>=0&&x<H&&y>=0&&y<W&&board[x].at(y)=='#')
      |                ^
a.cc:33:11: error: expected primary-expression before '}' token
   33 |           }
      |           ^
Language: C++

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

  int H,W;
  int dx[]={-1,-1,-1,0,0,1,1,1};
  int dy[]={-1,0,1,-1,1,-1,0,1};
  cin>>H>>W;
  
  string board[];
  
  for(int i=0;i<H;i++)
  {
     cin>>board[i];
  }
  
  for(int i=0;i<H;i++)
  {
  for(int j=0;j<W;j++)
    {
       if(board[i].at(j)=='.')
       {
          for(int k=0;k<8;k++)
          {
             int x = i+dx[k];
             int y = j+dy[k];
            
            for(x>=0&&x<H&&y>=0&&y<W&&board[x].at(y)=='#')
            { sum++;}                  
          }
         board[i].at(j)=sum;
       }
    }
  }

     for(int i=0;i<H;i++)
     {
       cout<<board[i]<<endl;
     }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:10: error: array size missing in 'board'
   11 |   string board[];
      |          ^~~~~
a.cc:29:58: error: expected ';' before ')' token
   29 |             for(x>=0&&x<H&&y>=0&&y<W&&board[x].at(y)=='#')
      |                                                          ^
      |                                                          ;
a.cc:31:11: error: expected primary-expression before '}' token
   31 |           }
      |           ^
a.cc:30:22: error: expected ';' before '}' token
   30 |             { sum++;}
      |                      ^
      |                      ;
   31 |           }
      |           ~           
a.cc:31:11: error: expected primary-expression before '}' token
   31 |           }
      |           ^
a.cc:30:22: error: expected ')' before '}' token
   30 |             { sum++;}
      |                      ^
      |                      )
   31 |           }
      |           ~           
a.cc:29:16: note: to match this '('
   29 |             for(x>=0&&x<H&&y>=0&&y<W&&board[x].at(y)=='#')
      |                ^
a.cc:31:11: error: expected primary-expression before '}' token
   31 |           }
      |           ^
a.cc:32:25: error: 'sum' was not declared in this scope
   32 |          board[i].at(j)=sum;
      |                         ^~~
Language: C++

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

  int H,W;
  int dx[]={-1,-1,-1,0,0,1,1,1};
  int dy[]={-1,0,1,-1,1,-1,0,1};
  cin>>H>>W;
  
  string board[];
  
  for(int i=0;i<H;i++)
  {
     cin>>board[i];
  }
  
  for(int i=0;i<H;i++)
  {
  for(int j=0;j<W;j++)
    {
       if(board[i][j]=='.')
       {
          for(int k=0;k<8;k++)
          {
             int x = i+dx[k];
             int y = j+dy[k];
            
            for(x>=0&&x<H&&y>=0&&y<W&&board[x][y]=='#')
              sum++;                   
          }
         board[i][j]=sum;
       }
    }
  }

     for(int i=0;i<H;i++)
     {
       cout<<board[i]<<endl;
     }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:10: error: array size missing in 'board'
   11 |   string board[];
      |          ^~~~~
a.cc:29:55: error: expected ';' before ')' token
   29 |             for(x>=0&&x<H&&y>=0&&y<W&&board[x][y]=='#')
      |                                                       ^
      |                                                       ;
a.cc:31:11: error: expected primary-expression before '}' token
   31 |           }
      |           ^
a.cc:30:21: error: expected ';' before '}' token
   30 |               sum++;
      |                     ^
      |                     ;
   31 |           }
      |           ~          
a.cc:31:11: error: expected primary-expression before '}' token
   31 |           }
      |           ^
a.cc:30:21: error: expected ')' before '}' token
   30 |               sum++;
      |                     ^
      |                     )
   31 |           }
      |           ~          
a.cc:29:16: note: to match this '('
   29 |             for(x>=0&&x<H&&y>=0&&y<W&&board[x][y]=='#')
      |                ^
a.cc:31:11: error: expected primary-expression before '}' token
   31 |           }
      |           ^
a.cc:32:22: error: 'sum' was not declared in this scope
   32 |          board[i][j]=sum;
      |                      ^~~
Language: C++

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

  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++)
    {
        int sum=0;
        if(s[i].at(j)==".")
        {
           for(int x=i-1;x<=i;x++)
           {
              for(int y=j-1;y<j+1;j++)
              {
                  if(x>=0&&x<H&&y>=0&&y<W&&s[x].at(y)=="#")
                  {
                     sum++;
                  }
              }
           }
         s[i].at(j)=sum;
        }
    }
  }
     for(int i=0;i<H;i++)
     {
       cout<<s[i]<<endl;
     }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:22: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   22 |         if(s[i].at(j)==".")
      |            ~~~~~~~~~~^~~~~
a.cc:28:54: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   28 |                   if(x>=0&&x<H&&y>=0&&y<W&&s[x].at(y)=="#")
      |                                            ~~~~~~~~~~^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
int H,W,sum;
  cin>>H>>W;
  
 string s[H];
  
  for(int i=0;i<H;i++)
  {
     cin>>s[i];
  }
  
  for(int a=0;a<H;a++)
  {
     for(int b=0;b<W;b++)
     {
       if(s[a].at(b)=='.')
       {
          for(int c=a-1;c<=a+1;c++)
          {
             for(int d=b-1;b<=b+1;d++)
             {
                if(s[c].at(d=='#')
                   sum++;
             }
           }
                   
            s[a].at(b)=sum;       
       }
     }
                   
         
      cout<<s[a]<<endl1;
  }

  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:35: error: expected ';' before 'sum'
   26 |                 if(s[c].at(d=='#')
      |                                   ^
      |                                   ;
   27 |                    sum++;
      |                    ~~~             
a.cc:26:27: warning: ignoring return value of 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::reference std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::at(size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; reference = char&; size_type = long unsigned int]', declared with attribute 'nodiscard' [-Wunused-result]
   26 |                 if(s[c].at(d=='#')
      |                    ~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:1309:7: note: declared here
 1309 |       at(size_type __n)
      |       ^~
a.cc:28:14: error: expected primary-expression before '}' token
   28 |              }
      |              ^
a.cc:27:26: error: expected ')' before '}' token
   27 |                    sum++;
      |                          ^
      |                          )
   28 |              }
      |              ~            
a.cc:26:19: note: to match this '('
   26 |                 if(s[c].at(d=='#')
      |                   ^
a.cc:28:14: error: expected primary-expression before '}' token
   28 |              }
      |              ^
a.cc:36:19: error: 'endl1' was not declared in this scope
   36 |       cout<<s[a]<<endl1;
      |                   ^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int H,W,sum;
  cin>>H>>W;
  
  for(int h=0;h<H;h++)
  {
    string s[H];
    cin>>s[h];
  }  
   
  for(int a=0;a<H;a++){
    for(int b=0;b<W;b++){
      if(s[a].at(b)=='.')
      {
        for(int c=a-1;c<=a+1;c++){
          for(int d=b-1;d<=b+1;d++){
             if(s[c].at(d)=='#')
               sum++;
          }
        }
        
        s[a].at(b)=sum;
       }
    }
  }

  for(int f=0;f<H;f++)
    cout<<s[f]<<endl;
  
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:10: error: 's' was not declared in this scope
   17 |       if(s[a].at(b)=='.')
      |          ^
a.cc:32:11: error: 's' was not declared in this scope
   32 |     cout<<s[f]<<endl;
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int H,W,sum;
  cin>>H>>W;
  
  for(int h=0;h<H;h++)
  {
    string s[];
    cin>>s[h];
  }  
   
  for(int a=0;a<H;a++){
    for(int b=0;b<W;b++){
      if(s[a].at(b)=='.')
      {
        for(int c=a-1;c<=a+1;c++){
          for(int d=b-1;d<=b+1;d++){
             if(s[c].at(d)=='#')
               sum++;
          }
        }
        
        s[a].at(b)=sum;
       }
    }
  }

  for(int f=0;f<H;f++)
    cout<<s[f]<<endl;
  
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:12: error: array size missing in 's'
   11 |     string s[];
      |            ^
a.cc:17:10: error: 's' was not declared in this scope
   17 |       if(s[a].at(b)=='.')
      |          ^
a.cc:32:11: error: 's' was not declared in this scope
   32 |     cout<<s[f]<<endl;
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int H,W,sum;
  cin>>H>>W;
  
  for(int h=0;h<H;h++)
  {
    string s[];
    cin>>s[h];
  }  
   
  for(int a=0;a<H;a++){
    for(int b=0;b<W;b++){
      if(s[a].at(b)=='.')
      {
        for(int c=a-1;c<=a+1;c++){
          for(int d=b-1;d<=b+1;d++){
             if(s[c].at(d)=='#')
               sum++;
          }
        }
        
        s[a].at(b)=sum;
       }
    }
  }

  for(int f=0;f<H;f++)
    cout<<s<<endl;
  
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:12: error: array size missing in 's'
   11 |     string s[];
      |            ^
a.cc:17:10: error: 's' was not declared in this scope
   17 |       if(s[a].at(b)=='.')
      |          ^
a.cc:32:11: error: 's' was not declared in this scope
   32 |     cout<<s<<endl;
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n ;
  int w;
  cin >> n >> w;
  int ans = 1;
  char list[n][w];
  for(int i = 0; i < n; i++){
    string s;
    getline(cin, s);
    for(int j = 0; j < w; j++){
      list[i][j] = s.at(j);
    }
  }
 
  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 < n; i++){
    for(int j = 0; j < w; j++){
      if (list[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 (list[ni][nj] == '#') num++;
      }
      list[i][j] = char(num + ’0’); 
    }
  }

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


Compiler output:
a.cc:31:31: error: extended character ’ is not valid in an identifier
   31 |       list[i][j] = char(num + ’0’);
      |                               ^
a.cc:31:31: error: extended character ’ is not valid in an identifier
a.cc: In function 'int main()':
a.cc:27:23: error: 'h' was not declared in this scope
   27 |         if (ni < 0 or h <= ni) continue;
      |                       ^
a.cc:31:31: error: '\U000020190\U00002019' was not declared in this scope
   31 |       list[i][j] = char(num + ’0’);
      |                               ^~~