criyle/codenet-compile-errors huggingface dataset:
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:22:25: error: extended character ’ is not valid in an identifier
   22 |       if (list[i][j] == ’#’) continue;
      |                         ^
a.cc:22:26: error: stray '#' in program
   22 |       if (list[i][j] == ’#’) continue;
      |                          ^
a.cc:22:27: error: extended character ’ is not valid in an identifier
   22 |       if (list[i][j] == ’#’) continue;
      |                           ^
a.cc:29:29: error: extended character ’ is not valid in an identifier
   29 |         if (list[ni][nj] == ’#’) num++;
      |                             ^
a.cc:29:30: error: stray '#' in program
   29 |         if (list[ni][nj] == ’#’) num++;
      |                              ^
a.cc:29:31: error: extended character ’ is not valid in an identifier
   29 |         if (list[ni][nj] == ’#’) num++;
      |                               ^
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:22:25: error: '\U00002019' was not declared in this scope
   22 |       if (list[i][j] == ’#’) continue;
      |                         ^
a.cc:22:26: error: expected ')' before '\U00002019'
   22 |       if (list[i][j] == ’#’) continue;
      |          ~               ^~
      |                          )
a.cc:27:23: error: 'h' was not declared in this scope
   27 |         if (ni < 0 or h <= ni) continue;
      |                       ^
a.cc:29:29: error: '\U00002019' was not declared in this scope
   29 |         if (list[ni][nj] == ’#’) num++;
      |                             ^
a.cc:29:30: error: expected ')' before '\U00002019'
   29 |         if (list[ni][nj] == ’#’) num++;
      |            ~                 ^~
      |                              )
a.cc:31:31: error: '\U000020190\U00002019' was not declared in this scope
   31 |       list[i][j] = char(num + ’0’);
      |                               ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
int H,W;
  cin>>H>>W;
  vector<vector<char>>M(H+2,vector<char>(W+2,'.'));
  for(int i=1;i<=H){
  for(int j=1;j<=W){
   cin>>M[i][j];
  }
  }
  for(int i=1;i<=H;i++){
  for(int j=1;j<=W;j++){
  if(M[i][j]=='.'){
  int sum=0;
    for(int I=i-1;I<=i+1;I++){
    for(int J=j-1;J<j+1;J++){
    if(M[i][j]!=M[I][J])
      sum++;
    }
    }
  } M.at(i).at(j)=(char)(sum);
    }
  }for(int i=1;i<=H;i++){
  for(int j=1;j<=W;j++){
  if(j!=W)
    cout<<M.at(i).at(j);
    else
      cout<<M.at(i).at(j)<<endl;
  }
  }
   return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:19: error: expected ';' before ')' token
    7 |   for(int i=1;i<=H){
      |                   ^
      |                   ;
a.cc:8:19: error: expected ';' before ')' token
    8 |   for(int j=1;j<=W){
      |                   ^
      |                   ;
a.cc:22:26: error: 'sum' was not declared in this scope
   22 |   } M.at(i).at(j)=(char)(sum);
      |                          ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
int H,W;
  cin>>H>>W;
  vector<vector<char>>M(H+2,vector<char>(W+2,'.'));
  for(int i=1;i<=H){
  for(int j=1;j<=W){
   cin>>M[i][j];
  }
  }
  for(int i=1;i<=H;i++){
  for(int j=1;j<=W;j++){
  if(M[i][j]=='.'){
  int sum=0;
    for(int I=i-1;I<=i+1;I++){
    for(int J=j-1;J<j+1;J++){
    if(M[i][j]!=M[I][J])
      sum++;
    }
    }
  } char ans=(char)(sum);
    }
  }for(int i=1;i<=H;i++){
  for(int j=1;j<=W;j++){
  if(j!=W)
    cout<<M.at(i).at(j);
    else
      cout<<M.at(i).at(j)<<endl;
  }
  }
   return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:19: error: expected ';' before ')' token
    7 |   for(int i=1;i<=H){
      |                   ^
      |                   ;
a.cc:8:19: error: expected ';' before ')' token
    8 |   for(int j=1;j<=W){
      |                   ^
      |                   ;
a.cc:22:21: error: 'sum' was not declared in this scope
   22 |   } char ans=(char)(sum);
      |                     ^~~
Language: C++

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

int main() {
  int h,w;
  cin>>h>>w;
  vector<vactor<string>>s(h,vector<string>(w));
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin>>s[i][j];
    }
  }
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      int ans=0;
      if(s[i][j]=="."){
        for(int k=-1;k<=1;k++){
          for(int l=-1;l<=1;l++){
            if(i+k>=0 && j+l>=0){
              if(s[i+k][j+l]=="#") ans++;
            }
          }
        }
        s[i][j]=to_string(ans);
      }
    }
  }
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(j==w-1) cout<<s[i][j]<<endl;
      else cout<<s[i][j];
    }
  }  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:10: error: 'vactor' was not declared in this scope
    7 |   vector<vactor<string>>s(h,vector<string>(w));
      |          ^~~~~~
a.cc:7:17: error: template argument 1 is invalid
    7 |   vector<vactor<string>>s(h,vector<string>(w));
      |                 ^~~~~~
a.cc:7:17: error: template argument 2 is invalid
a.cc:7:23: error: expected unqualified-id before '>' token
    7 |   vector<vactor<string>>s(h,vector<string>(w));
      |                       ^~
a.cc:10:12: error: 's' was not declared in this scope
   10 |       cin>>s[i][j];
      |            ^
a.cc:16:10: error: 's' was not declared in this scope
   16 |       if(s[i][j]=="."){
      |          ^
a.cc:30:24: error: 's' was not declared in this scope
   30 |       if(j==w-1) cout<<s[i][j]<<endl;
      |                        ^
a.cc:31:18: error: 's' was not declared in this scope
   31 |       else cout<<s[i][j];
      |                  ^
Language: C++

#include<bits/stdc++.h>
#include<string>
using namespace std;
 
int main() {
  int H, W, c;
  cin >> H >> W;
  char S[H+2][W+2];
  for(int i(0);i<H+2i++)	S[0][i] = S[H+1][i] = 0;
  for(int i(i);i<H+1;i++){
    S[i][0] = S[i][W+1] =0;
    for(int j(1);j<W+1;j++)	cin >> S[i][j];
  }
  for(int i(1);i<H+1;i++){
    for(int j(1);j<W+1;j++){
      if(S[i][j]=='.'){
        c=0;
        for(int k(i-1);k<i+2;k++){
          for(int l(j-1);l<j+2;l++){
            if(S[k][l]=='#')	c++;
          }
        }
        S[i][j]=c
      }
    }
  }
  for(int i(1);i<H+1;i++){
    for(int j(1);j<W+1;j++){
      cout << S[i][j];
    } 
    cout << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:22: error: no 'operator++(int)' declared for postfix '++' [-fpermissive]
    9 |   for(int i(0);i<H+2i++)        S[0][i] = S[H+1][i] = 0;
      |                    ~~^~
a.cc:9:24: error: expected ';' before ')' token
    9 |   for(int i(0);i<H+2i++)        S[0][i] = S[H+1][i] = 0;
      |                        ^
      |                        ;
a.cc:23:18: error: expected ';' before '}' token
   23 |         S[i][j]=c
      |                  ^
      |                  ;
   24 |       }
      |       ~
Language: C++

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

int main() {
  int N, W;
  string all = "";
  
  string k;
  for (int i=0; i<N; i++) {
    cin >> k;
    all += k;
  }
  
  for (int i=0; i<N*W; i++) {
    // 改行処理
    if (i != 0 && i%W == 0)
      cout << endl;
    // 自身が幕弾の時
    if (all.at(i) == '#') 
      cout << '#';
    // 爆弾でない時
    else {
      int count = 0;
      bool checker_1 = false;
      bool checker_2 = false;
      // 上がある
      if (W < i) {
        if (all.at(i-W) == '#')
          count++;
        checker_1 = true;
      }
      // 下がある
      if (i < W*(N=1)) {
        if (all.at(i+W) == '#')
          count++;
        checker_2 = true;
      }
      // 左がある
      if (i%W != 0) {
        if (all.at(i-1) == '#')
          count++;
        // 左上がある
        if (checker_1) {
          if (all.at(i-W-1) == '#')
            count++;
        }
        // 左下がある
        if (checker_2) {
          if (all.at(i+W-1) == '#')
            count++;
        }
      }
      // 右がある
      if (i%W != W-1) {
        if (all.at(i+1) == '#')
          count++;
        // 右上がある
        if (checker_1) {
          if (all.at(i-W+1) == '#')
            count++;
        }
        // 右下がある
        if (checker_2) {
          if (all.at(i+W+1) == '#')
            count++;
        }
      }
      cout << count;
    }
  }
    
      
      
    


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

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

int main() {
  int N, W;
  string all = "";
  
  string k;
  for (int i=0; i<N; i++) {
    cin >> k;
    all += k;
  }
  
  for (int i=0; i<N*W; i++) {
    // 改行処理
    if (i != 0 && i%W == 0)
      cout << endl;
    // 自身が幕弾の時
    if (all.at(i) == "#") 
      cout << "#";
    // 爆弾でない時
    else {
      int count = 0;
      bool checker_1 = false;
      bool checker_2 = false;
      // 上がある
      if (W < i) {
        if (all.at(i-W) == "#")
          count++;
        checker_1 = true;
      }
      // 下がある
      if (i < W*(N=1)) {
        if (all.at(i+W) == "#")
          count++;
        checker_2 = true;
      }
      // 左がある
      if (i%W != 0) {
        if (all.at(i-1) == "#")
          count++;
        // 左上がある
        if (checker_1) {
          if (all.at(i-W-1) == "#")
            count++;
        }
        // 左下がある
        if (checker_2) {
          if (all.at(i+W-1) == "#")
            count++;
        }
      }
      // 右がある
      if (i%W != W-1) {
        if (all.at(i+1) == "#")
          count++;
        // 右上がある
        if (checker_1) {
          if (all.at(i-W+1) == "#")
            count++;
        }
        // 右下がある
        if (checker_2) {
          if (all.at(i+W+1) == "#")
            count++;
        }
      }
      cout << count;
    }
  }
    
      
      
    


Compiler output:
a.cc: In function 'int main()':
a.cc:19:19: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   19 |     if (all.at(i) == "#")
      |         ~~~~~~~~~~^~~~~~
a.cc:28:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   28 |         if (all.at(i-W) == "#")
      |             ~~~~~~~~~~~~^~~~~~
a.cc:34:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   34 |         if (all.at(i+W) == "#")
      |             ~~~~~~~~~~~~^~~~~~
a.cc:40:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   40 |         if (all.at(i-1) == "#")
      |             ~~~~~~~~~~~~^~~~~~
a.cc:44:29: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   44 |           if (all.at(i-W-1) == "#")
      |               ~~~~~~~~~~~~~~^~~~~~
a.cc:49:29: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   49 |           if (all.at(i+W-1) == "#")
      |               ~~~~~~~~~~~~~~^~~~~~
a.cc:55:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   55 |         if (all.at(i+1) == "#")
      |             ~~~~~~~~~~~~^~~~~~
a.cc:59:29: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   59 |           if (all.at(i-W+1) == "#")
      |               ~~~~~~~~~~~~~~^~~~~~
a.cc:64:29: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   64 |           if (all.at(i+W+1) == "#")
      |               ~~~~~~~~~~~~~~^~~~~~
a.cc:70:4: error: expected '}' at end of input
   70 |   }
      |    ^
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> v(H);
  for(int i=0;i<H;i++){
    cin >> v.at(i);
  }
  
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(v[i][j] == '.'){
        int cny=0;
        for(int h=i-1;h<i+2;h++){
          for(int w=j-1;w<j+2;j++){
            if(w<0||h<0||h>=H||w>=W) continue;
            if(v[h][w]=='#') 
              cnt++;
          }
        }
        v[i][j] =static_cast<char> (cnt);
      }
    }
  }
  for(int i=0; i<H; i++){
    cout << v.at(i) << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:15: error: 'cnt' was not declared in this scope; did you mean 'cny'?
   21 |               cnt++;
      |               ^~~
      |               cny
a.cc:24:37: error: 'cnt' was not declared in this scope; did you mean 'cny'?
   24 |         v[i][j] =static_cast<char> (cnt);
      |                                     ^~~
      |                                     cny
Language: C++

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

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

int main() {
  int H,W;
  cin>>H>>W;
  vector<vector<char>> data(H+2,vector<char>(W+2,'.'));
  for(int i=1;i<=H;i++){
    for(int j=1;j<=W;j++){
      cin>>data[i][j];
    }
  }
  rep(i,H){
    rep(j,W){
      if(data[i+1][j+1]=='#'){cout<<#;}
      else{
        int count=0;
        rep(k,8){
          if(data[i+1+dx[k]][j+1+dy[k]]=='#'){count++;}
        }
        cout<<count;
      }
    }
    cout<<endl;
  }
  
  
}

Compiler output:
a.cc:19:37: error: stray '#' in program
   19 |       if(data[i+1][j+1]=='#'){cout<<#;}
      |                                     ^
a.cc: In function 'int main()':
a.cc:19:38: error: expected primary-expression before ';' token
   19 |       if(data[i+1][j+1]=='#'){cout<<#;}
      |                                      ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int H, W; cin >> H >> W;
  vector<vector<char>> S(H, vector<char> (W));
  for(int i = 0; i < H; i++) {
    for(int j = 0; j < S.at(i).size(); j++) {
      cin >> S.at(i).at(j);
    }
  }
  for(int i = 0; i < H; i++) {
    for(int j = 0; j < S.at(i).size(); j++) {
      if(S.at(i).at(j) == '#') cout << '#';
      else {
        for(int k = i - 1; k < i + 2; k++) {
          for(int l = j - 1; l < j + 2; l++) {
            int t = 0;
            if(k >= 0 && k < H && l >= 0 && l < W && S.at(k).at(l) == '#') t++;
          }
        }
        cout << t;
      }
    }
    cout << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:17: error: 't' was not declared in this scope
   22 |         cout << t;
      |                 ^
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 ; i++)cin>>board[i];
  
  int dx[8] = {  1,  1,  1,  0,  0,  -1,  -1,  -1};
  int dy[8] = {  1, -1,  0,  1,  -1,  1,  -1,   0};
  
  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++){
        int ni = i + dy[d];
        int nj = j + dx[d];
        
        if(0 > ni or h <= ni) continue;
        if(0 > nj or w <= mj) continue;
        if(board[ni][nj] == '#') num++;
      }
    
      board[i][j] = char(num + '0')
    }
  }
  
  for(int i=0; i<h; i++)cout<<board[i]<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:8: error: expected primary-expression before '>' token
    6 |   cin>>>h>>W;
      |        ^
a.cc:6:12: error: 'W' was not declared in this scope
    6 |   cin>>>h>>W;
      |            ^
a.cc:25:27: error: 'mj' was not declared in this scope; did you mean 'nj'?
   25 |         if(0 > nj or w <= mj) continue;
      |                           ^~
      |                           nj
a.cc:29:36: error: expected ';' before '}' token
   29 |       board[i][j] = char(num + '0')
      |                                    ^
      |                                    ;
   30 |     }
      |     ~
Language: C++

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

int main() {
  int H, W, counter;
  string s0, s1, s2, s3;
  s0 = "....................................................";
  for (int i = 0; i <= H; i++){
    if (i == 0){
      cin >> s3;
      s3 = "." + s3 + ".";
      s2 = s0;
    } else{
      counter = 0;
      s1 = s2;
      s2 = s3;
      if(i == H)
      s3 = s0;
      else{
        cin >> s3;
        s3 = "." + s3 + ".";
      }
      for (j = 1; j <= W; j++){
        if (s2.at(j) == '.'){
          if (s1.at(j - 1) == '#')
          counter++;
          if (s1.at(j) == '#')
          counter++;
          if (s1.at(j + 1) == '#')
          counter++;
          if (s2.at(j - 1) == '#')
          counter++;
          if (s2.at(j + 1) == '#')
          counter++;
          if (s3.at(j - 1) == '#')
          counter++;
          if (s3.at(j) == '#')
          counter++;
          if (s3.at(j + 1) == '#')
          counter++;
          cout << counter;
        }
        else
        cout << "#";
      }
      cout << endl;
    }
  }
}


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

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

int main() {
  int H, W, counter;
  str s0, s1, s2, s3;
  s0 = "....................................................";
  for (int i = 0; i <= H; i++){
    if (i == 0){
      cin >> s3;
      s3 = "." + s3 + ".";
      s2 = s0;
    } else{
      counter = 0;
      s1 = s2;
      s2 = s3;
      if(i == H)
      s3 = s0;
      else{
        cin >> s3;
        s3 = "." + s3 + ".";
      }
      for (j = 1; j <= W; j++){
        if (s2.at(j) == '.'){
          if (s1.at(j - 1) == '#')
          counter++;
          if (s1.at(j) == '#')
          counter++;
          if (s1.at(j + 1) == '#')
          counter++;
          if (s2.at(j - 1) == '#')
          counter++;
          if (s2.at(j + 1) == '#')
          counter++;
          if (s3.at(j - 1) == '#')
          counter++;
          if (s3.at(j) == '#')
          counter++;
          if (s3.at(j + 1) == '#')
          counter++;
          cout << counter;
        }
        else
        cout << "#";
      }
      cout << endl;
    }
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'str' was not declared in this scope; did you mean 'std'?
    6 |   str s0, s1, s2, s3;
      |   ^~~
      |   std
a.cc:7:3: error: 's0' was not declared in this scope; did you mean 'y0'?
    7 |   s0 = "....................................................";
      |   ^~
      |   y0
a.cc:10:14: error: 's3' was not declared in this scope
   10 |       cin >> s3;
      |              ^~
a.cc:12:7: error: 's2' was not declared in this scope
   12 |       s2 = s0;
      |       ^~
a.cc:15:7: error: 's1' was not declared in this scope; did you mean 'y1'?
   15 |       s1 = s2;
      |       ^~
      |       y1
a.cc:15:12: error: 's2' was not declared in this scope
   15 |       s1 = s2;
      |            ^~
a.cc:16:12: error: 's3' was not declared in this scope
   16 |       s2 = s3;
      |            ^~
a.cc:23:12: error: 'j' was not declared in this scope
   23 |       for (j = 1; j <= W; j++){
      |            ^
Language: C++

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

int main(){
	string L,S;
	int H,W,M;
	cin>>H >>W;
	M = H*W;
	S = "";
	
	for(int i = 0;H>i;i++){
		cin >> L;
		S = S+L;
	}
	
	for(int j = 0;M>j;j++){
		char C;
		C = S.at(j);
		
		if(C=='.'){
			int cnt = 0;
			string E;
			for(int k = 0;k<9;k++){
				int l;
				l = (k/3 -1)*W + k%3 -1 + j;
				char D;
				if(l>-1){
					D = S.at(l);
					
					if(D=='#')
						cnt++;
				}
			}
			E = cnt.str();
			S.at(j) = E;
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:33: error: request for member 'str' in 'cnt', which is of non-class type 'int'
   34 |                         E = cnt.str();
      |                                 ^~~
a.cc:35:35: 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
   35 |                         S.at(j) = E;
      |                                   ^
      |                                   |
      |                                   std::string {aka std::__cxx11::basic_string<char>}
Language: C++

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

int main(){
	string L,S;
	int H,W,M;
	cin>>H >>W;
	M = H*W;
	S = "";
	
	for(int i = 0;H>i;i++){
		cin >> L;
		S = S+L;
	}
	
	for(int j = 0;M>j;j++){
		char C;
		C = S.at(j);
		
		if(C=='.'){
			int cnt = 0;
			char E;
			for(int k = 0;k<9;k++){
				int l;
				l = (k/3 -1)*W + k%3 -1 + j;
				char D;
				if(l>-1){
					D = S.at(l);
					
					if(D=='#')
						cnt++;
				}
			}
			E = cnt.chr();
			S.at(j) = E;
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:33: error: request for member 'chr' in 'cnt', which is of non-class type 'int'
   34 |                         E = cnt.chr();
      |                                 ^~~
Language: C++

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

int main(){
	string L,S;
	int H,W,M;
	cin>>H >>W;
	M = H*W;
	S = "";
	
	for(int i = 0;H>i;i++){
		cin >> L;
		S = S+L;
	}
	
	for(int j = 0;M>j;j++){
		char C;
		C = S.at(j);
		
		if(C=='.'){
			int cnt = 0;
			for(int k = 0;k<9;k++){
				int l;
				l = (k/3 -1)*W + k%3 -1 + j;
				char D;
				if(l>-1){
					D = S.at(l);
					
					if(D=='#')
						cnt++;
				}
			}
			
			S.at(j) = cnt.str();
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:39: error: request for member 'str' in 'cnt', which is of non-class type 'int'
   34 |                         S.at(j) = cnt.str();
      |                                       ^~~
Language: C++

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

int main(){
	string L,S;
	int H,W,M;
	cin>>H >>W;
	M = H*W;
	S = "";
	
	for(int i = 0;H>i;i++){
		cin >> L;
		S = S+L;
	}
	
	for(int j = 0;M>j;j++){
		char C;
		C = S.at(j);
		
		if(C=='.'){
			int cnt = 0;
			for(int k = 0;k<9;k++){
				int l;
				l = (k/3 -1)*W + k%3 -1 + j;
				char D;
				if(l>-1){
					D = S.at(l);
					
					if(D=='#')
						cnt++;
				}
			}
			
			S.at(j) = cnt.char();
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:39: error: expected unqualified-id before 'char'
   34 |                         S.at(j) = cnt.char();
      |                                       ^~~~
Language: C++

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

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; i++){
          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');
          
       }A
   }
   
   for(int i=0; i < h; i++) cout<<board[i]<<endl;
   
   return 0;
}
    

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

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

int main(){
	string L,S;
	int H,W,M;
	cin>>H >>W;
	M = H*W;
	S = ""
	
	for(int i = 0;H>i;i++){
		cin >> L;
		S = S+L;
	}
	
	for(int j = 0;M>j;j++){
		char C;
		C = S.at(j);
		
		if(C=='.'){
			int cnt = 0;
			for(int k = 0;k<3;k++){
				for(int l =0;l<3;l++){
				int D;
				char E;
				D = j +(k-1)*M + l -1;
				
				if(D<0)
					break;
				else
					E = S.at(D);
					if(E=='#')
						cnt++;
				}
			}
			S.at(j)=cnt;
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:15: error: expected ';' before 'for'
    9 |         S = ""
      |               ^
      |               ;
   10 | 
   11 |         for(int i = 0;H>i;i++){
      |         ~~~    
a.cc:11:25: error: 'i' was not declared in this scope
   11 |         for(int i = 0;H>i;i++){
      |                         ^
Language: C++

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

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) (v.begin(),v.end())
#define COUT(x) cout<<(x)<<endl

int main(){
    int a,b;
    cin >> a >> b;
    string bomb[50];
    REP(i,a){
        cin >> bomb[h];
    }
    const int dx[8] = {1,0,-1,0,1,-1,-1,1};
    const int dy[8] = {0,1,0,-1,1,1,-1,-1};


    REP(i,h){
        REP(j,w){
            if(bomb[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&&h<=ni)continue;
                if(nj<=w&&w<=nj)continue;
                //移動先が'#'
                if(bomb[ni][nj]=='#')continue;
            }
            bomb[i][j] = char(num + 'a');
        }
    }
    REP(i,h){
        REP(j,w){
            cout << bomb[i][j];
        }
        cout << endl;
    }
    return 0;
}    


Compiler output:
a.cc: In function 'int main()':
a.cc:20:21: error: 'h' was not declared in this scope
   20 |         cin >> bomb[h];
      |                     ^
a.cc:26:11: error: 'h' was not declared in this scope
   26 |     REP(i,h){
      |           ^
a.cc:10:33: note: in definition of macro 'REP'
   10 | #define REP(i,n) for(int i=0;i<(n);++i)
      |                                 ^
a.cc:27:15: error: 'w' was not declared in this scope
   27 |         REP(j,w){
      |               ^
a.cc:10:33: note: in definition of macro 'REP'
   10 | #define REP(i,n) for(int i=0;i<(n);++i)
      |                                 ^
a.cc:42:11: error: 'h' was not declared in this scope
   42 |     REP(i,h){
      |           ^
a.cc:10:33: note: in definition of macro 'REP'
   10 | #define REP(i,n) for(int i=0;i<(n);++i)
      |                                 ^
a.cc:43:15: error: 'w' was not declared in this scope
   43 |         REP(j,w){
      |               ^
a.cc:10:33: note: in definition of macro 'REP'
   10 | #define REP(i,n) for(int i=0;i<(n);++i)
      |                                 ^
Language: C++

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

int main(){
	int h, w;
	cin >> h >> w;
	string s;
	int count[52][52] = {{0}};
	for(int i=0; i < h; i++) {
		cin >> s[i];
		for(int j=0; j < w; j++) {
			if(s[i].at(j) != '#')
				continue;
			count[i+1][j+1] = -10;
			for(int k=-1; k <= 1; k++) {
				for(int l=-1; l <= 1; l++) {
					count[i+k+1][j+l+1]++;
				}
			}
		}
	}

	for(int i=1; i <= h; i++) {
		for(int j=1; j <= w; j++) {
			cout << ((count[i][j]>=0) ? count[i][j]+'0' : '#');
		}
		cout << endl;
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:33: error: request for member 'at' in 's.std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
   12 |                         if(s[i].at(j) != '#')
      |                                 ^~
Language: C++

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

int main(){
    int h,w;
    cin >> h >> w;
    vector<string> s(h);
    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};

    int ans;
    for (int i = 0; i < h; i++){
        for (int j = 0; j < w; j++){
            ans = 0;
            if (s[i][j] == '#'){
                continue;
            
            for (int d = 0; d < 8; d++){
                const int ni = i + dy[d];
                const int nj = j + dx[d];
                if (ni < 0 || h <= ni){
                    continue;
                }
                if (nj < 0 || w <= nj){
                    continue;
                }
                if (s[ni][nj] == '#'){
                    ans++;
                }
            }
            s[i][j] = char(ans + '0');
        }
    }
    for (int i=0; i<h; i++){
        cout << s[i] << endl;
    }
}

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

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
        int b = sc.nextInt();
        int c = 0;
        String d;
		String [] str = new String [a+2];
        String [] str2 = new String [a];
        StringBuilder sb = new StringBuilder();
        for(int i=0;i<a+2;i++){sb.append(".");}
        str[0] = sb.toString();
        str[a+1] = str[0];
        for(int i=1;i<a+1;i++){str[i] = "." + sc.next() + ".";}
        for(int i=1;i<a+1;i++){for(int j=1;j<b+1;j++){
        if(str[i].charAt(j)=="#")
        {sb.append("#");}else{c=0;}
        }
                            }
        for(int i=0;i<a;i++){System.out.println(str2[i];}  	
	}
}

Compiler output:
Main.java:21: error: ')' or ',' expected
        for(int i=0;i<a;i++){System.out.println(str2[i];}  	
                                                       ^
1 error
Language: C++

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

int main(void)
{
  int H, W;
  cin >> H >> W;
  string S[50];
  
  for (int i=0;i<H;i++){
    cin >> S.at(i);
  }
  
  int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
  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] != '#'){
        int num = 0;
        for (int k=0;k<8;k++){
          int ni = i + dx[k];
          int nj = j + dy[k];
          
          if (ni<0 || ni==W) continue;
          if (nj<0 || nj==H) continue;
          if (S[ni][nj] == '#'){
            num++;
          }
        }
        S[i][j] = num + '0';
      }
    }
  }
  
  for (int i=0;i<H;i++){
    cout << S.at(i) << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:14: error: request for member 'at' in 'S', which is of non-class type 'std::string [50]' {aka 'std::__cxx11::basic_string<char> [50]'}
   12 |     cin >> S.at(i);
      |              ^~
a.cc:38:15: error: request for member 'at' in 'S', which is of non-class type 'std::string [50]' {aka 'std::__cxx11::basic_string<char> [50]'}
   38 |     cout << S.at(i) << endl;
      |               ^~
Language: C++

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

int main(void)
{
  int H, W;
  cin >> H >> W;
  vector<string> S(50);
  
  for (int i=0;i<H;i++){
    cin >> S.at(i);
  }
  
  int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
  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] != '#'){
        int num = 0;
        for (int k=0;k<8;k++){
          int ni = i + dx[k];
          int nj = j + dy[k];
          
          if (ni<0 || ni==W) continue;
          if (nj<0 || nj==H) continue;
          if (S[ni][nj] == '#'){
            num++;
          }
        }
        S[i][j] = num + '0';
      }
    }
  }
  
  for (int i=0;i<H;i++){
    cout << S.at(i) << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: 'vector' was not declared in this scope
    9 |   vector<string> S(50);
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | #include <string>
a.cc:9:16: error: expected primary-expression before '>' token
    9 |   vector<string> S(50);
      |                ^
a.cc:9:18: error: 'S' was not declared in this scope
    9 |   vector<string> S(50);
      |                  ^
Language: C++

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

int main(void)
{
  int H, W;
  cin >> H >> W;
  vector<string> S(50);
  
  for (int i=0;i<H;i++){
    cin >> S.at(i);
  }
  
  int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
  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] != '#'){
        int num = 0;
        for (int k=0;k<8;k++){
          int ni = i + dx[k];
          int nj = j + dy[k];
          if (S[ni][nj] == '#'){
            num++;
          }
        }
        S[i][j] = num + '0';
      }
    }
  }
  
  for (int i=0;i<H;i++){
    cout << S.at(i) << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: 'vector' was not declared in this scope
    9 |   vector<string> S(50);
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | #include <string>
a.cc:9:16: error: expected primary-expression before '>' token
    9 |   vector<string> S(50);
      |                ^
a.cc:9:18: error: 'S' was not declared in this scope
    9 |   vector<string> S(50);
      |                  ^
Language: C++

#include<bits/stdc++.h>

using namespace std;

int main()
{
  int h,w;
  string s[50];
  cin>>h>>w;
  for(int i=0;i<h;i++)
  {
    cin>>s[i];
  }
  for(int i=0;i<h;i++)
  {
    for(int j=0,int count=0;j<w;i++)
    {
      if(s[i].at(j)=='#')
      {
        cout<<'#';
        continue;
      }
      for(int k=max(0,i-1);k<min(i+1,h);k++)
      {
        for(int l=max(0,j-1);l<min(j+1,w);l++)
        {
          if(s[k].at(l)=='#')
            count++;
        }
      }
      cout<<count;
    }
    cout<<endl;
  }
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:17: error: expected unqualified-id before 'int'
   16 |     for(int j=0,int count=0;j<w;i++)
      |                 ^~~
a.cc:16:17: error: expected ';' before 'int'
   16 |     for(int j=0,int count=0;j<w;i++)
      |                 ^~~
      |                 ;
a.cc:16:32: error: expected ')' before ';' token
   16 |     for(int j=0,int count=0;j<w;i++)
      |        ~                       ^
      |                                )
a.cc:16:36: error: expected ';' before ')' token
   16 |     for(int j=0,int count=0;j<w;i++)
      |                                    ^
      |                                    ;
Language: C++

#include<bits/stdc++.h>

using namespace std;

int main()
{
  int h,w;
  string s[50];
  cin>>h>>w;
  for(int i=0;i<h;i++)
  {
    cin>>s[i];
  }
  for(int i=0;i<h;i++)
  {
    for(int j=0,int count=0;j<w;i++)
    {
      if(s[i].at(j)=='#')
      {
        cout<<'#';
        continue;
      }
      for(int k=max(0,i-1);k<min(i+1,h),k++)
      {
        for(int l=max(0,j-1);l<min(j+1,w),l++)
        {
          if(s[k].at(l)=='#')
            count++;
        }
      }
      cout<<count;
    }
    cout<<endl;
  }
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:17: error: expected unqualified-id before 'int'
   16 |     for(int j=0,int count=0;j<w;i++)
      |                 ^~~
a.cc:16:17: error: expected ';' before 'int'
   16 |     for(int j=0,int count=0;j<w;i++)
      |                 ^~~
      |                 ;
a.cc:16:32: error: expected ')' before ';' token
   16 |     for(int j=0,int count=0;j<w;i++)
      |        ~                       ^
      |                                )
a.cc:16:36: error: expected ';' before ')' token
   16 |     for(int j=0,int count=0;j<w;i++)
      |                                    ^
      |                                    ;
Language: C++

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

int main()
{
  	int i, j;
	int a, b; cin >> a >> b;
  	string s[a];
  	for (i=0; i<a; i++)
      cin >> s[i];
  
  	for (i=0; i<a; i++) {
		for (j=0; j<b; j++) {
          if (s[i].at[j] == '.') {
          	int cnt = 0;
            if (s[i-1].at[j-1] == '#') cnt++;
            if (s[i-1].at[j] == '#') cnt++;
          	if (s[i-1].at[j+1] == '#') cnt++;
            if (s[i].at[j-1] == '#') cnt++;
            if (s[i].at[j+1] == '#') cnt++;
            if (s[i+1].at[j-1] == '#') cnt++;
            if (s[i+1].at[j] == '#') cnt++;
            if (s[i+1].at[j+1] == '#') cnt++;
            s[i].at[j] = cnt;
          }
        }
    }
  
  	for (i=0; i<a; i++)
      cout << s[i] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:22: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   14 |           if (s[i].at[j] == '.') {
      |                      ^
a.cc:16:26: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   16 |             if (s[i-1].at[j-1] == '#') cnt++;
      |                          ^
a.cc:17:26: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   17 |             if (s[i-1].at[j] == '#') cnt++;
      |                          ^
a.cc:18:30: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   18 |                 if (s[i-1].at[j+1] == '#') cnt++;
      |                              ^
a.cc:19:24: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   19 |             if (s[i].at[j-1] == '#') cnt++;
      |                        ^
a.cc:20:24: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   20 |             if (s[i].at[j+1] == '#') cnt++;
      |                        ^
a.cc:21:26: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   21 |             if (s[i+1].at[j-1] == '#') cnt++;
      |                          ^
a.cc:22:26: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   22 |             if (s[i+1].at[j] == '#') cnt++;
      |                          ^
a.cc:23:26: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   23 |             if (s[i+1].at[j+1] == '#') cnt++;
      |                          ^
a.cc:24:20: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   24 |             s[i].at[j] = cnt;
      |                    ^
Language: C++

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

int main () {
  int H, W;
  cin >> H >> W;
  vector<string> S(H);
  for (int i = 0; i < H; i++) {
  cin >> S.at(i);
  }
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (S.at(i).at(j) == '#') {
        continue;
      }
      else {
        int ans;
        ans = 0;
        if (j-1 >= 0) {
          if (i-1 >=0) {
            if (S.at(i-1).at(j-1) !='#') {
              ans += 1;
            }
          }
          if (S.at(i).at(j-1) !='#') {
            ans +=1;
          }
          if (i+1 < H) {
            if (S.at(i+1).at(j-1) !='#') {
              ans +=1;
            }
          }
        }
        if (i-1 >=0) {
          if (S.at(i-1).at(j) !='#') {
            ans += 1;
          }
        }
        if (i+1 < H) {
          if (S.at(i+1).at(j) !='#') {
            ans +=1;
          }
        }
        if (j+1 < W) {
          if (i-1 >=0) {
            if (S.at(i-1).at(j+1) !='#') {
              ans += 1;
            }
          }
          if (S.at(i).at(j+1) !='#') {
            ans +=1;
          }
          if (i+1 < H) {
            if (S.at(i+1).at(j+1) !='#') {
              ans +=1;
            }
          }
        }
        S.at(i).at(j) = to_string(c_str(ans));
      }
    }
  }
  for (int k = 0; k < H; k++) {
    cout << S.at(k) << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:59:35: error: 'c_str' was not declared in this scope; did you mean 'wcsstr'?
   59 |         S.at(i).at(j) = to_string(c_str(ans));
      |                                   ^~~~~
      |                                   wcsstr
Language: C++

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

char check(&mine,int i,int j,int a,int b){
  int count=0;
  if(i>0){
    if(mine.at(i-1).at(j)=='#')
      count++;
    if(mine.at(i-1).at(j-1)=='#'&&j>0)
      count++;
    if(mine.at(i-1).at(j+1)=='#'&&j<b)
      count++;
  }
  if(i<a){
    if(mine.at(i+1).at(j)=='#')
      count++;
    if(j>0&&mine.at(i-1).at(j-1)=='#')
      count++;
    if(j<b&&mine.at(i-1).at(j+1)=='#')
      count++;
  }
  if(j>0&&mine.at(i).at(j-1)=='#')
    count++;
  if(j<b&&mine.at(i).at(j+1)=='#')
    count++;
  char sum=(char)count;
  return sum;
}

int main(){
  int a,b;
  cin>>a>>b;
  vector<vector<char>> mine(a,vector<char>(b));
  for(int i=0;i<a;i++){
    for(int j=0;j<b;j++){
      cin>>mine.at(i).at(j);
    }
  }
  for(int i=0;i<a;i++){
    for(int j=0;j<b;j++){
      if(mine.at(i).at(j)=='.')
        mine.at(i).at(j)=check(mine,i,j,a,b);
    }
  }
  for(int i=0;i<a;i++){
    for(int j=0;j<b;j++){
      cout<<mine.at(i).at(j);
    }
    cout<<endl;
  }
}

Compiler output:
a.cc:4:13: error: 'mine' was not declared in this scope
    4 | char check(&mine,int i,int j,int a,int b){
      |             ^~~~
a.cc:4:18: error: expected primary-expression before 'int'
    4 | char check(&mine,int i,int j,int a,int b){
      |                  ^~~
a.cc:4:24: error: expected primary-expression before 'int'
    4 | char check(&mine,int i,int j,int a,int b){
      |                        ^~~
a.cc:4:30: error: expected primary-expression before 'int'
    4 | char check(&mine,int i,int j,int a,int b){
      |                              ^~~
a.cc:4:36: error: expected primary-expression before 'int'
    4 | char check(&mine,int i,int j,int a,int b){
      |                                    ^~~
a.cc:4:41: error: expression list treated as compound expression in initializer [-fpermissive]
    4 | char check(&mine,int i,int j,int a,int b){
      |                                         ^
a.cc: In function 'int main()':
a.cc:42:31: error: 'check' cannot be used as a function
   42 |         mine.at(i).at(j)=check(mine,i,j,a,b);
      |                          ~~~~~^~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define MAX_H 50
#define MAX_W 50

int main(){
  char S[MAX_W][MAX_H];
  int H,N;
  cin >> H >> N;
  for(int i = 0; i < W; i++){
    for(int j = 0; j < H; j++){
      cin >> S[i][j];
    }
  }
  for(int i = 0; i < W; i++){
    for(int j = 0; j < H; j++){
      if(S[i][j] == '.'){
        int count = 0;
        for(int k = -1; k < 2; k++){
          for(int l = -1;l < 2; l++){
            if(S[i + k][j+l] == '#') count++;
          }
        }
        S[i][j] = (char)count;
      }   
    }
  }
  for(int i = 0; i < W; i++){
    for(int j = 0; j < H; j++){
      cout << S[i][j];
      if(j == H - 1){cout << endl;}
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:22: error: 'W' was not declared in this scope
   10 |   for(int i = 0; i < W; i++){
      |                      ^
a.cc:15:22: error: 'W' was not declared in this scope
   15 |   for(int i = 0; i < W; i++){
      |                      ^
a.cc:28:22: error: 'W' was not declared in this scope
   28 |   for(int i = 0; i < W; i++){
      |                      ^
Language: C++

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

int main() {
  int H, W;
  char s[50+10][50+10] = {};
  cin >> H >> W;
  
  for (int i = 1; i <= H; i++) {
    for (int j = 1; j <= W; j++) {
      cin >> s[i][j];
    }
  }

  for (int i = 1; i <= H; i++) {
    for (int j = 1; j <= W; j++) {
      if (s[i][j] == '#') continue;
      
      int b = 0;
      if (s[i-1][j-1] == '#') b++;
      if (s[i-1][j  ] == '#') b++;
      if (s[i-1][j+1] == '#') b++;

      if (s[i][j-1] == '#') b++;
      if (s[i][j+1] == '#') b++;

      if (s[i+1][j-1] == '#') b++;
      if (s[i+1][j  ] == '#') b++;
      if (s[i+1][j+1] == '#') b++;
      
      s[i][j] = sprintf("%d", b);
    }
  }

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



Compiler output:
a.cc: In function 'int main()':
a.cc:32:25: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
   32 |       s[i][j] = sprintf("%d", b);
      |                         ^~~~
a.cc:32:31: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
   32 |       s[i][j] = sprintf("%d", b);
      |                               ^
      |                               |
      |                               int
In file included from /usr/include/c++/14/cstdio:42,
                 from /usr/include/c++/14/ext/string_conversions.h:45,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/stdio.h:366:44: note:   initializing argument 2 of 'int sprintf(char*, const char*, ...)'
  366 |                     const char *__restrict __format, ...) __THROWNL;
      |                     ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
Language: C++

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

int main() {
  int H, W;
  char s[50+10][50+10] = {};
  cin >> H >> W;
  
  for (int i = 1; i <= H; i++) {
    for (int j = 1; j <= W; j++) {
      cin >> s[i][j];
    }
  }

  for (int i = 1; i <= H; i++) {
    for (int j = 1; j <= W; j++) {
      if (s[i][j] == '#') continue;
      
      int b = 0;
      if (s[i-1][j-1] == '#') b++;
      if (s[i-1][j  ] == '#') b++;
      if (s[i-1][j+1] == '#') b++;

      if (s[i][j-1] == '#') b++;
      if (s[i][j+1] == '#') b++;

      if (s[i+1][j-1] == '#') b++;
      if (s[i+1][j  ] == '#') b++;
      if (s[i+1][j+1] == '#') b++;
      
      s[i][j] = sprintf("%s", b);
    }
  }

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



Compiler output:
a.cc: In function 'int main()':
a.cc:32:25: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
   32 |       s[i][j] = sprintf("%s", b);
      |                         ^~~~
a.cc:32:31: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
   32 |       s[i][j] = sprintf("%s", b);
      |                               ^
      |                               |
      |                               int
In file included from /usr/include/c++/14/cstdio:42,
                 from /usr/include/c++/14/ext/string_conversions.h:45,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/stdio.h:366:44: note:   initializing argument 2 of 'int sprintf(char*, const char*, ...)'
  366 |                     const char *__restrict __format, ...) __THROWNL;
      |                     ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~