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

#include <iostream>
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] = 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:17:19: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   17 |       if (s[i][j] == "#") continue;
      |           ~~~~~~~~^~~~~~
a.cc:20:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   20 |       if (s[i-1][j-1] == "#") b++;
      |           ~~~~~~~~~~~~^~~~~~
a.cc:21:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   21 |       if (s[i-1][j  ] == "#") b++;
      |           ~~~~~~~~~~~~^~~~~~
a.cc:22:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   22 |       if (s[i-1][j+1] == "#") b++;
      |           ~~~~~~~~~~~~^~~~~~
a.cc:24:21: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   24 |       if (s[i][j-1] == "#") b++;
      |           ~~~~~~~~~~^~~~~~
a.cc:25:21: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   25 |       if (s[i][j+1] == "#") b++;
      |           ~~~~~~~~~~^~~~~~
a.cc:27:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   27 |       if (s[i+1][j-1] == "#") b++;
      |           ~~~~~~~~~~~~^~~~~~
a.cc:28:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   28 |       if (s[i+1][j  ] == "#") b++;
      |           ~~~~~~~~~~~~^~~~~~
a.cc:29:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   29 |       if (s[i+1][j+1] == "#") b++;
      |           ~~~~~~~~~~~~^~~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>

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.at(i).at(j) == '#') continue;
            int count = 0;
            for (int k = i - 1; k < i + 2; k++) {
                for (int l = j - 1; l < j + 2; l++) {
                    if (k < 0 || l < 0 || k > H - 1 || l > W - 1 || (k == i && l == j)) continue;
                    if (V.at.at(l) == '#') count++;
                }
            }
            V.at(i).at(j) = count + '0';
        }
    }
    
    for (int i = 0; i < H; i++) {
        cout << V.at(i) << endl;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:27: error: invalid use of member function 'std::vector<std::__cxx11::basic_string<char> >::at' (did you forget the '()' ?)
   24 |                     if (V.at.at(l) == '#') count++;
      |                         ~~^~
a.cc:24:30: error: expected ')' before 'at'
   24 |                     if (V.at.at(l) == '#') count++;
      |                        ~     ^~
      |                              )
Language: C++

#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>

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.at(i).at(j) == '#') continue;
            int count = 0;
            for (int k = i - 1; k < i + 2; k++) {
                for (int l = j - 1; l < j + 2; l++) {
                    if (k < 0 || l < 0 || k > H - 1 || l > W - 1 || (k == i && l == j)) continue;
                    if (V.at(ik.at(l) == '#') count++;
                }
            }
            V.at(i).at(j) = count + '0';
        }
    }
    
    for (int i = 0; i < H; i++) {
        cout << V.at(i) << endl;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:30: error: 'ik' was not declared in this scope; did you mean 'k'?
   24 |                     if (V.at(ik.at(l) == '#') count++;
      |                              ^~
      |                              k
a.cc:25:17: error: expected primary-expression before '}' token
   25 |                 }
      |                 ^
a.cc:24:55: error: expected ')' before '}' token
   24 |                     if (V.at(ik.at(l) == '#') count++;
      |                        ~                              ^
      |                                                       )
   25 |                 }
      |                 ~                                      
a.cc:25:17: error: expected primary-expression before '}' token
   25 |                 }
      |                 ^
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:29:26: error: expected ')' before 'at'
   29 |           if(mine.at(i-1)at(j) == '#'){
      |             ~            ^~
      |                          )
a.cc:29:21: error: could not convert 'mine.std::vector<std::vector<char> >::at(((std::vector<std::vector<char> >::size_type)(i - 1)))' from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<char> >, std::vector<char> >::value_type' {aka 'std::vector<char>'} to 'bool'
   29 |           if(mine.at(i-1)at(j) == '#'){
      |              ~~~~~~~^~~~~
      |                     |
      |                     __gnu_cxx::__alloc_traits<std::allocator<std::vector<char> >, std::vector<char> >::value_type {aka std::vector<char>}
Language: C++

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

int main() {
  int h,w;
  int ans[h+2][w+2];
  for(int i=0;i<h+2;i++){
    for(int j=0;j<w+2;j++){
      ans[i][j]=0;
    }
  }
  string s;
  for(int i=0;i<h;i++){
    cin >> s;
    for(int j=0;j<w;j++){
      if(s.at[j]=='#'){
        ans[i][j]++;
        ans[i][j+1]++;
        ans[i][j+2]++;
        ans[i+1][j]++;
        ans[i+1][j+1]+=10;
        ans[i+1][j+2]++;
        ans[i+2][j]++;
        ans[i+2][j+1]++;
        ans[i+2][j+2]++;
      }
    }
  }
  for(int i=1;i<h+1;i++){
    for(int j=1;j<w+1;j++){
      if(ans[i][j]>9)cout << '#';
      else cout << ans[i][j];
    }
    cout << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:14: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   16 |       if(s.at[j]=='#'){
      |              ^
Language: C++

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

int Check(int, int, int, int, string* );
int main() {
  ostringstream oss;
  string s[50];
  int num[50][50] = {};
  int h, w;
  
  cin >> h >> w;
  rep(i, h){
	rep(j, w){
      if(s[i].at(j) == '#')
        num[i][j] = 9;
      else
      	num[i][j] = Check(i, j, h, w, s);
    }
  }
  
  rep(i,h){
  	rep(j, w){
      char c;
      oss << num[i][j];
      c = oss.str().c_str();
      if(c == '9')
        s[i].at(j) == '#';
      else
        s[i].at(j) == c;  
    }
  }
  
  rep(i, h)
    cout << s[i] << endl;
  
}

int Check(int i, int j, int h, int w, string* s){
  int rp_h = 3, rp_w = 3, h_PorD = -1, w_LorR = -1;
  int count = 0;
  
  if(i % (h - 1) == 0){
    rp_h--;
    if(i == 0)
      h_PorD = 1;
  }
  if( j % (w - 1) == 0){
    rp_w--;
    if(j == 0)
      w_LorR == 1;
  }
  
  rep(k, rp_h){
  	rep(l, rp_w){
      if(s[( i + k ) + h_PorD ].at((j + l) + w_LorR) == '#')
              	count++;
    }
  } 
  
  return count;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:27:26: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   27 |       c = oss.str().c_str();
      |           ~~~~~~~~~~~~~~~^~
      |                          |
      |                          const char*
Language: C++

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

int Check(int, int, int, int, string* );
int main() {
  ostringstream oss;
  string s[50];
  int num[50][50] = {};
  int h, w;
  
  cin >> h >> w;
  rep(i, h){
	rep(j, w){
      if(s[i].at(j) == '#')
        num[i][j] = 9;
      else
      	num[i][j] = Check(i, j, h, w, s);
    }
  }
  
  rep(i,h){
  	rep(j, w){
      char c;
      oss << num[i][j];
      c = const_cast<char*>oss.str().c_str();
      if(c == '9')
        s[i].at(j) == '#';
      else
        s[i].at(j) == c;  
    }
  }
  
  rep(i, h)
    cout << s[i] << endl;
  
}

int Check(int i, int j, int h, int w, string* s){
  int rp_h = 3, rp_w = 3, h_PorD = -1, w_LorR = -1;
  int count = 0;
  
  if(i % (h - 1) == 0){
    rp_h--;
    if(i == 0)
      h_PorD = 1;
  }
  if( j % (w - 1) == 0){
    rp_w--;
    if(j == 0)
      w_LorR == 1;
  }
  
  rep(k, rp_h){
  	rep(l, rp_w){
      if(s[( i + k ) + h_PorD ].at((j + l) + w_LorR) == '#')
              	count++;
    }
  } 
  
  return count;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:27:28: error: expected '(' before 'oss'
   27 |       c = const_cast<char*>oss.str().c_str();
      |                            ^~~
      |                            (
a.cc:27:45: error: expected ')' before ';' token
   27 |       c = const_cast<char*>oss.str().c_str();
      |                                             ^
      |                                             )
a.cc:27:11: error: invalid conversion from 'char*' to 'char' [-fpermissive]
   27 |       c = const_cast<char*>oss.str().c_str();
Language: C++

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

int Check(int, int, int, int, string* );
int main() {
  ostringstream oss;
  string s[50];
  int num[50][50] = {};
  int h, w;
  
  cin >> h >> w;
  rep(i, h){
	rep(j, w){
      if(s[i].at(j) == '#')
        num[i][j] = 9;
      else
      	num[i][j] = Check(i, j, h, w, s[i]);
    }
  }
  
  rep(i,h){
  	rep(j, w){
      char c;
      oss << num[i][j];
      c = oss.str().c_str();
      if(c == '9')
        s[i].at(j) == '#';
      else
        s[i].at(j) == c;  
    }
  }
  
  rep(i, h)
    cout << s[i] << endl;
  
}

int Check(int i, int j, int h, int w, string* s){
  int rp_h = 3, rp_w = 3, h_PorD = -1, w_LorR = -1;
  int count = 0;
  
  if(i % (h - 1) == 0){
    rp_h--;
    if(i == 0)
      h_PorD = 1;
  }
  if( j % (w - 1) == 0){
    rp_w--;
    if(j == 0)
      w_LorR == 1;
  }
  
  rep(k, rp_h){
  	rep(l, rp_w){
      if(s[( i + k ) + h_PorD ].at((j + l) + w_LorR) == '#')
              	count++;
    }
  } 
  
  return count;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:19:42: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'std::string*' {aka 'std::__cxx11::basic_string<char>*'}
   19 |         num[i][j] = Check(i, j, h, w, s[i]);
      |                                       ~~~^
      |                                          |
      |                                          std::string {aka std::__cxx11::basic_string<char>}
a.cc:6:31: note:   initializing argument 5 of 'int Check(int, int, int, int, std::string*)'
    6 | int Check(int, int, int, int, string* );
      |                               ^~~~~~~
a.cc:27:26: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   27 |       c = oss.str().c_str();
      |           ~~~~~~~~~~~~~~~^~
      |                          |
      |                          const char*
Language: C++

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

int Check(int, int, int, int, string* );
int main() {
  ostringstream oss;
  string s[50];
  int num[50][50] = {};
  int h, w;
  
  cin >> h >> w;
  rep(i, h){
	rep(j, w){
      if(s[i].at(j) == '#')
        num[i][j] = 9;
      else
      	num[i][j] = Check(i, j, h, w, s[i]);
    }
  }
  
  rep(i,h){
  	rep(j, w){
      char c;
      oss << num[i][j];
      c = oss.str().c_str();
      if(c == '9')
        s[i].at(j) == '#';
      else
        s[i].at(j) == c;  
    }
  }
  
  rep(i, h)
    cout << s[i] << endl;
  
}

void Check(int i, int j, int h, int w, string* s){
  int rp_h = 3, rp_w = 3, h_PorD = -1, w_LorR = -1;
  int count = 0;
  
  if(i % (h - 1) == 0){
    rp_h--;
    if(i == 0)
      h_PorD = 1;
  }
  if( j % (w - 1) == 0){
    rp_w--;
    if(j == 0)
      w_LorR == 1;
  }
  
  rep(k, rp_h){
  	rep(l, rp_w){
      if(s[( i + k ) + h_PorD ].at((j + l) + w_LorR) == '#')
              	count++;
    }
  }    
  }
  return count;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:19:42: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'std::string*' {aka 'std::__cxx11::basic_string<char>*'}
   19 |         num[i][j] = Check(i, j, h, w, s[i]);
      |                                       ~~~^
      |                                          |
      |                                          std::string {aka std::__cxx11::basic_string<char>}
a.cc:6:31: note:   initializing argument 5 of 'int Check(int, int, int, int, std::string*)'
    6 | int Check(int, int, int, int, string* );
      |                               ^~~~~~~
a.cc:27:26: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   27 |       c = oss.str().c_str();
      |           ~~~~~~~~~~~~~~~^~
      |                          |
      |                          const char*
a.cc: At global scope:
a.cc:40:6: error: ambiguating new declaration of 'void Check(int, int, int, int, std::string*)'
   40 | void Check(int i, int j, int h, int w, string* s){
      |      ^~~~~
a.cc:6:5: note: old declaration 'int Check(int, int, int, int, std::string*)'
    6 | int Check(int, int, int, int, string* );
      |     ^~~~~
a.cc:62:3: error: expected unqualified-id before 'return'
   62 |   return count;
      |   ^~~~~~
a.cc:63:1: error: expected declaration before '}' token
   63 | }
      | ^
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;i < w;j++){
      bomb = 0;
      if(S[i].at[j] == '.') {
        for(int dx = -1; dx <= 1; dx++)
          for(int dy = -1; dy <= 1;dy++) {
            int dh = i + dy;
            int dw = j + dx;
            if(dh > 0 || dh < h || dw > 0 || dw > w)
              if(S[dh].at(dw) == '#')
                bomb++;
          }
        S[i].at(j) = to_string(bomb).at(0);
      }
    }
  for(int i=0;i < h;i++)
    cout << S[i] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:7: error: 'bomb' was not declared in this scope
   12 |       bomb = 0;
      |       ^~~~
a.cc:13:17: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   13 |       if(S[i].at[j] == '.') {
      |                 ^
Language: C++

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

int main(){
  int H,W = 0;
  cin >> H >> W;
  vector<string> s(H);
  vector<int> dx = {1,0,-1,0,1,-1,1,-1};
  vector<int> dy = {0,1,0,-1,1,-1,-1,1};
  int bomb = 0;
  for(int i=0;i<H;i++)
    cin >> s(i);
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(s.at(i).at(j)=='#'){
        cout << '#';
        if(j==W-1)
          cout << endl;
      }
      else if(s.at(i).at(j)=='.'){
        for(int dir = 0;dir<8;dir++){
          int nx = i+dx.at(dir);
          int ny = j+dy.at(dir);
          if(nx<0||ny<0||nx>=H||ny>=W)
            continue;
          else if(s.at(nx).at(ny)=='#')
            bomb++;
        }
        cout << bomb;
        bomb = 0;
        if(j==W-1)
          cout << endl;
      }
    }  
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: no match for call to '(std::vector<std::__cxx11::basic_string<char> >) (int&)'
   12 |     cin >> s(i);
      |            ~^~~
Language: C++

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

int main(){
  int H,W = 0;
  cin >> H >> W;
  vector<string> s(H);
  vector<int> dx = {1,0,-1,0,1,-1,1,-1};
  vector<int> dy = {0,1,0,-1,1,-1,-1,1};
  int bomb = 0;
  for(int i=0;i<H;i++)
    cin >> s(i);
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(s.at(i).at(j)=='#'){
        cout << '#';
        if(j==W-1)
          cout << endl;
      }
      else if(s.at(i).at(j)=='.'){
        for(int dir = 0;dir<8;dir++){
          nx = i+dx.at(dir);
          ny = j+dy.at(dir);
          if(nx<0||ny<0||nx>=H||ny>=W)
            continue;
          else if(s.at(nx).at(ny)=='#')
            bomb++;
        }
        cout << bomb;
        bomb = 0;
        if(j==W-1)
          cout << endl;
      }
    }  
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: no match for call to '(std::vector<std::__cxx11::basic_string<char> >) (int&)'
   12 |     cin >> s(i);
      |            ~^~~
a.cc:22:11: error: 'nx' was not declared in this scope; did you mean 'dx'?
   22 |           nx = i+dx.at(dir);
      |           ^~
      |           dx
a.cc:23:11: error: 'ny' was not declared in this scope; did you mean 'dy'?
   23 |           ny = j+dy.at(dir);
      |           ^~
      |           dy
Language: C++

#include<iostream>
using namespace std;

int main(){
  int H,W = 0;
  cin >> H >> W;
  vector<string> s(H);
  vector<int> dx = {1,0,-1,0,1,-1,1,-1};
  vector<int> dy = {0,1,0,-1,1,-1,-1,1};
  int bomb = 0;
  for(int i=0;i<H;i++)
    cin >> s;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(s.at(i).at(j)=='#'){
        cout << '#';
        if(j==W-1)
          cout << endl;
      }
      else if(s.at(i).at(j)=='.'){
        for(int dir = 0;dir<8;dir++){
          nx = i+dx.at(dir);
          ny = j+dy.at(dir);
          if(nx<0||ny<0||nx>=H||ny>=W)
            continue;
          else if(s.at(nx).at(ny)=='#')
            bomb++;
        }
        cout << bomb;
        bomb = 0;
        if(j==W-1)
          cout << endl;
      }
    }  
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'vector' was not declared in this scope
    7 |   vector<string> s(H);
      |   ^~~~~~
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 | using namespace std;
a.cc:7:16: error: expected primary-expression before '>' token
    7 |   vector<string> s(H);
      |                ^
a.cc:7:18: error: 's' was not declared in this scope
    7 |   vector<string> s(H);
      |                  ^
a.cc:8:10: error: expected primary-expression before 'int'
    8 |   vector<int> dx = {1,0,-1,0,1,-1,1,-1};
      |          ^~~
a.cc:9:10: error: expected primary-expression before 'int'
    9 |   vector<int> dy = {0,1,0,-1,1,-1,-1,1};
      |          ^~~
a.cc:22:11: error: 'nx' was not declared in this scope
   22 |           nx = i+dx.at(dir);
      |           ^~
a.cc:22:18: error: 'dx' was not declared in this scope
   22 |           nx = i+dx.at(dir);
      |                  ^~
a.cc:23:11: error: 'ny' was not declared in this scope
   23 |           ny = j+dy.at(dir);
      |           ^~
a.cc:23:18: error: 'dy' was not declared in this scope
   23 |           ny = j+dy.at(dir);
      |                  ^~
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:35:24: error: expected ';' before '}' token
   35 |       cout << c.at(i+j)
      |                        ^
      |                        ;
   36 |     }
      |     ~
Language: C++

#include<iostream>
using namespace std;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'vector' was not declared in this scope
    8 |   vector<char> c(H*W);
      |   ^~~~~~
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 | using namespace std;
a.cc:8:10: error: expected primary-expression before 'char'
    8 |   vector<char> c(H*W);
      |          ^~~~
a.cc:10:12: error: 'c' was not declared in this scope
   10 |     cin >> c.at(i);
      |            ^
a.cc:12:8: error: 'c' was not declared in this scope
   12 |     if(c.at(i)=='.'){
      |        ^
a.cc:35:15: error: 'c' was not declared in this scope
   35 |       cout << c.at(i+j)
      |               ^
Language: C++

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

int main() {
	int h, w;
	cin >> h >> w;
	vector<vector<char>> a(h + 2, vector<char>(w + 2,'.'));
	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			cin >> a.at(i).at(j);
		}
	}
	for (int i = 1; i <= h; i++) {
		for (int j = 1; j < =w; j++) {
			if (a.at(i).at(j) == '#') continue;
			int cnt = 0;
			if (a.at(i - 1).at(j - 1) == '#') cnt++;
			if (a.at(i).at(j - 1) == '#') cnt++;
			if (a.at(i + 1).at(j - 1) == '#') cnt++;
			if (a.at(i - 1).at(j) == '#') cnt++;
			if (a.at(i + 1).at(j) == '#') cnt++;
			if (a.at(i - 1).at(j+1) == '#') cnt++;
			if (a.at(i).at(j + 1) == '#') cnt++;
			if (a.at(i + 1).at(j + 1) == '#') cnt++;
			a.at(i).at(j) = (char)('0' + cnt);
		}
	}
	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			cout << a.at(i).at(j) << " ";
		}
		cout << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:37: error: expected primary-expression before '=' token
   15 |                 for (int j = 1; j < =w; j++) {
      |                                     ^
Language: C++

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

int main() {
	int h, w;
	cin >> h >> w;
	vector<vector<char>> a(h + 2, vector<char>(w + 2,'.'));
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> a.at(i).at(j);
		}
	}
	for (int i = 1; i <= h; i++) {
		for (int j = 1; j < =w; j++) {
			if (a.at(i).at(j) == '#') continue;
			int cnt = 0;
			if (a.at(i - 1).at(j - 1) == '#') cnt++;
			if (a.at(i).at(j - 1) == '#') cnt++;
			if (a.at(i + 1).at(j - 1) == '#') cnt++;
			if (a.at(i - 1).at(j) == '#') cnt++;
			if (a.at(i + 1).at(j) == '#') cnt++;
			if (a.at(i - 1).at(j+1) == '#') cnt++;
			if (a.at(i).at(j + 1) == '#') cnt++;
			if (a.at(i + 1).at(j + 1) == '#') cnt++;
			a.at(i).at(j) = (char)('0' + cnt);
		}
	}
	for (int i = 1; i <= h; i++) {
		for (int j = 0; j <= w; j++) {
			cout << a.at(i).at(j) << " ";
		}
		cout << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:37: error: expected primary-expression before '=' token
   15 |                 for (int j = 1; j < =w; j++) {
      |                                     ^
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];
    }

    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 k=0;k<8;k++){
                const int ni=i+dy;
                const int nj=j+dx;
                if(ni<0||ni>=h) continue;
                if(nj<0||nj>=w) continue;
                if(board[ni][nj]=='#') num++;
            }
            board[i][j]==char('0'+num);
        }
    }
    for(int i=0;i<h;i++){
        cout << board[i] << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:31: error: invalid conversion from 'const int*' to 'int' [-fpermissive]
   22 |                 const int ni=i+dy;
      |                              ~^~~
      |                               |
      |                               const int*
a.cc:23:31: error: invalid conversion from 'const int*' to 'int' [-fpermissive]
   23 |                 const int nj=j+dx;
      |                              ~^~~
      |                               |
      |                               const int*
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, 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(board[i][j]=='#'){
                continue;
            }
            int num=0;
            for(int k=0;k<8;k++){
                int ni=i+dy;
                int nj=j+dx;
                if(ni<0||ni>=h) continue;
                if(nj<0||nj>=w) continue;
                if(board[ni][nj]=='#') num++;
            }
            board[i][j]==char('0'+num);
        }
    }
    for(int i=0;i<h;i++){
        cout << board[i] << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:25: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   22 |                 int ni=i+dy;
      |                        ~^~~
      |                         |
      |                         int*
a.cc:23:25: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   23 |                 int nj=j+dx;
      |                        ~^~~
      |                         |
      |                         int*
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];
    }

    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 k=0;k<8;k++){
                const int ni=i+dy;
                const int nj=j+dx;
                if(ni<0||ni>=h) continue;
                if(nj<0||nj>=w) 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:22:31: error: invalid conversion from 'const int*' to 'int' [-fpermissive]
   22 |                 const int ni=i+dy;
      |                              ~^~~
      |                               |
      |                               const int*
a.cc:23:31: error: invalid conversion from 'const int*' to 'int' [-fpermissive]
   23 |                 const int nj=j+dx;
      |                              ~^~~
      |                               |
      |                               const int*
a.cc:29:22: error: 'j' was not declared in this scope
   29 |             board[i][j]==char(num+'0');
      |                      ^
a.cc:29:31: error: 'num' was not declared in this scope; did you mean 'enum'?
   29 |             board[i][j]==char(num+'0');
      |                               ^~~
      |                               enum
a.cc: At global scope:
a.cc:33:5: error: expected unqualified-id before 'for'
   33 |     for(int i=0;i<h;i++){
      |     ^~~
a.cc:33:17: error: 'i' does not name a type
   33 |     for(int i=0;i<h;i++){
      |                 ^
a.cc:33:21: error: 'i' does not name a type
   33 |     for(int i=0;i<h;i++){
      |                     ^
a.cc:36:1: error: expected declaration before '}' token
   36 | }
      | ^
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];
    }

    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 k=0;k<8;k++){
                int ni=i+dy;
                int nj=j+dx;
                if(ni<0||ni>=h) continue;
                if(nj<0||nj>=w) 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:22:25: error: invalid conversion from 'const int*' to 'int' [-fpermissive]
   22 |                 int ni=i+dy;
      |                        ~^~~
      |                         |
      |                         const int*
a.cc:23:25: error: invalid conversion from 'const int*' to 'int' [-fpermissive]
   23 |                 int nj=j+dx;
      |                        ~^~~
      |                         |
      |                         const int*
a.cc:29:22: error: 'j' was not declared in this scope
   29 |             board[i][j]==char(num+'0');
      |                      ^
a.cc:29:31: error: 'num' was not declared in this scope; did you mean 'enum'?
   29 |             board[i][j]==char(num+'0');
      |                               ^~~
      |                               enum
a.cc: At global scope:
a.cc:33:5: error: expected unqualified-id before 'for'
   33 |     for(int i=0;i<h;i++){
      |     ^~~
a.cc:33:17: error: 'i' does not name a type
   33 |     for(int i=0;i<h;i++){
      |                 ^
a.cc:33:21: error: 'i' does not name a type
   33 |     for(int i=0;i<h;i++){
      |                     ^
a.cc:36:1: error: expected declaration before '}' token
   36 | }
      | ^
Language: C++

#include<stdio.h>
#include<string.h>
#include<iostream>
using namespace std;
int main()
{
	char p[55][55];
	int m,n;
	scanf("%d %d",&m,&n);
	getchar();
	for(int i=0;i<m;i++)
	{
		gets(p[i]);
	} 
	
	for(int i=0;i<m;i++)
	{
		for(int j=0;j<n;j++)
		{
			if(p[i][j]=='.')
			{				
					int e=0;
					if(p[i-1][j-1]=='#')
					e++;
					if(p[i-1][j]=='#')
					e++;
					if(p[i-1][j+1]=='#')
					e++;
					if(p[i][j+1]=='#')
					e++;
					if(p[i][j-1]=='#')
					e++;
					if(p[i+1][j-1]=='#')
					e++;
					if(p[i+1][j]=='#')
					e++;
					if(p[i+1][j+1]=='#')
					e++;
					p[i][j]='0'+e;
				}		
		}
	}
	for(int i=0;i<m;i++)
	{
		for(int j=0;j<n;j++)
		{
			printf("%c",p[i][j]);
		}
		printf("\n");
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:17: error: 'gets' was not declared in this scope; did you mean 'getw'?
   13 |                 gets(p[i]);
      |                 ^~~~
      |                 getw
Language: C++

#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string.h>
using namespace std;
int dir[8][2] = { -1, 0, 0, -1, 1, 0, 0, 1, -1, -1, 1, 1, -1, 1, 1, -1 };
int n, m, s = 0;
bool vir[105][105];
char a[105][105];
void dfs(int a, int b)
{
    for (int i = 0; i < 8; i++)
    {
        int nx = a + dir[i][0];
        int ny = b + dir[i][1];
        if (a[nx][ny] == '#')
        {
            s++;
            vir[nx][ny] = true;
        }
        dfs(nx, ny);
    }
    printf("%d", s);
}
int main()
{
    int i, j, x, y;
    scanf("%d%d", &m, &n);
    for (i = 0; i < m; i++)
        for (j = 0; j < n; j++)
            scanf("%c", &a[i][j]);
    for (i = 0; i < m; i++)
        for (j = 0; j < n; j++)
        {
            if (a[i][j] != '#')
            {
                x = i;
                y = j;
            } else
                printf("%c",'#');
        }
    dfs(x, y);
    return 0;
}


Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:16:14: error: invalid types 'int[int]' for array subscript
   16 |         if (a[nx][ny] == '#')
      |              ^
Language: C

#include<stdio.h>
int main()
{
    char ch[51][51];
    int count,i,j,H,W;
    scanf("%d %d",&H,&W);
    ch[0][0]=getchar();
    for(i=0;i<H;i++)
    {
        for(j=0;j<W;j++)
            scanf("%c",&ch[i][j]);
        ch[i+1][0]=getchar();
    }
    for(i=0;i<H;i++)
    {
        count=0;
        for(j=0;j<W;j++)
        {
            count=0;
            if(ch[i][j]=='.')
            {
                if(ch[i-1][j]=='#')
                   count++;
                if(ch[i-1][j+1]=='#')
                   count++;
                if(ch[i][j+1]=='#')
                   count++;
                if(ch[i+1][j+1]=='#')
                   count++;
                if(ch[i+1][j]=='#')
                   count++;
                if(ch[i+1][j-1]=='#')
                   count++;
                if(ch[i][j-1]=='#')
                   count++;
                if(ch[i-1][j-1]=='#')
                   count++;
                ch[i][j]=count+'0';
            }
        }
    }
    for(i=0;i<H;i++)
 

Compiler output:
main.c: In function 'main':
main.c:42:5: error: expected expression at end of input
   42 |     for(i=0;i<H;i++)
      |     ^~~
main.c:42:5: error: expected declaration or statement at end of input
Language: C++

package main

import (
    "bufio"
    "fmt"
    "os"
)

func max(a, b int) int {
  if a > b {
    return a
  } else {
    return b
  }
}
func min(a, b int) int {
  if a > b {
    return b
  } else {
    return a
  }
}

func main() {
    r := bufio.NewReader(os.Stdin)
    wr := bufio.NewWriter(os.Stdout)
    defer wr.Flush()

    var(
      h int
      w int
    )
    fmt.Fscan(r, &h, &w)
    s := make([][]byte, h)
    for i := 0; i < h; i++ {
      s[i] = make([]byte, w)
      fmt.Fscan(r, &s[i])
    }
    for i := 0; i < h; i++ {
      for j := 0; j < w; j++ {
        ans := 0
        for x := max(i - 1, 0); x < min(i + 2, h); x++ {
          for y := max(j - 1, 0); y < min(j + 2, w); y++ {
            if x == i && y == j {
              continue
            } else if s[x][y] == '#' {
              ans++
            }
          }
        }
        if s[i][j] == '#' {
          fmt.Fprint(wr, "#")
        } else {
          fmt.Fprint(wr, ans)
        }
      }
      fmt.Fprintln(wr)
    }
}


Compiler output:
a.cc:1:1: error: 'package' does not name a type
    1 | package main
      | ^~~~~~~
a.cc:16:1: error: 'func' does not name a type
   16 | func min(a, b int) int {
      | ^~~~
a.cc:24:1: error: 'func' does not name a type
   24 | func main() {
      | ^~~~
Language: C++

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

int main(){
  int H,W;
  cin>>H>>W;
  string SH,SW,answer;
  for(int i=0;i<H;i++){
    cin>>SW;
    answer='0'(SW.size());
    cout<<answer<<endl;
    }
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:15: error: expression cannot be used as a function
   10 |     answer='0'(SW.size());
      |            ~~~^~~~~~~~~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)


int main() {
  int H, W;
  cin >> H >> W;
  vector<string> S(H);
  rep(i, H) cin >> S.at(i);

  vector<int> dx(8);
  dx = {-1, -1, -1, 0, 0, 1, 1, 1};
  vector<int> dy(8);
  dy = {-1, 0, 1, -1, 1, -1, 0, 1};

  rep(i, H) {
    rep(j, W) {
      int cnt = 0;
      char c = S.at(i).at(j);
      if (c == '.') {
        rep(k, 8) {
          int x = i + dx.at(k);
          int y = j + dy.at(k);
          if (x >= 0 && x < H) {
            if (y >= 0 && y < W) {
              char ca = S.at(x).at(y);
              if (ca == "#") cnt++;
            }
          }
        }
        S.at(i).at(j) = char(cnt + "0");
      }
    }
  }
  rep(i, H) cout << S.at(i) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:22: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   29 |               if (ca == "#") cnt++;
      |                   ~~~^~~~~~
a.cc:33:25: error: cast from 'const char*' to 'char' loses precision [-fpermissive]
   33 |         S.at(i).at(j) = char(cnt + "0");
      |                         ^~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)


int main() {
  int H, W;
  cin >> H >> W;
  vector<string> S(H);
  rep(i, H) cin >> S.at(i);

  vector<int> dx(8);
  dx = {-1, -1, -1, 0, 0, 1, 1, 1};
  vector<int> dy(8);
  dy = {-1, 0, 1, -1, 1, -1, 0, 1};

  rep(i, H) {
    rep(j, W) {
      int cnt = 0;
      char c = S.at(i).at(j);
      if (c == ".") {
        rep(k, 8) {
          x = i + dx.at(k);
          y = j + dy.at(k);
          if (x >= 0 && x < H) {
            if (y >= 0 && y < W) {
              char ca = S.at(x).at(y);
              if (ca == "#") cnt++;
            }
          }
        }
        S.at(i).at(j) = char(cnt + "0");
      }
    }
  }
  rep(i, H) cout << S.at(i) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:13: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   22 |       if (c == ".") {
      |           ~~^~~~~~
a.cc:24:11: error: 'x' was not declared in this scope
   24 |           x = i + dx.at(k);
      |           ^
a.cc:25:11: error: 'y' was not declared in this scope
   25 |           y = j + dy.at(k);
      |           ^
a.cc:29:22: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   29 |               if (ca == "#") cnt++;
      |                   ~~~^~~~~~
a.cc:33:25: error: cast from 'const char*' to 'char' loses precision [-fpermissive]
   33 |         S.at(i).at(j) = char(cnt + "0");
      |                         ^~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)


int main() {
  int H, W;
  cin >> H >> W;
  vector<string> S(H);
  rep(i, H) cin >> S.at(i);

  vector<int> dx(8) = {-1, -1, -1, 0, 0, 1, 1, 1};
  vector<int> dy(8) = {-1, 0, 1, -1, 1, -1, 0, 1};

  rep(i, H) {
    rep(j, W) {
      int cnt = 0;
      char c = S.at(i).at(j);
      if (c == ".") {
        rep(k, 8) {
          x = i + dx.at(k);
          y = j + dy.at(k);
          if (x >= 0 && x < H) {
            if (y >= 0 && y < W) {
              char ca = S.at(x).at(y);
              if (ca == "#") cnt++;
            }
          }
        }
        S.at(i).at(j) = char(cnt + "0");
      }
    }
  }
  rep(i, H) cout << S.at(i) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:21: error: expected ',' or ';' before '=' token
   13 |   vector<int> dx(8) = {-1, -1, -1, 0, 0, 1, 1, 1};
      |                     ^
a.cc:14:21: error: expected ',' or ';' before '=' token
   14 |   vector<int> dy(8) = {-1, 0, 1, -1, 1, -1, 0, 1};
      |                     ^
a.cc:20:13: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   20 |       if (c == ".") {
      |           ~~^~~~~~
a.cc:22:11: error: 'x' was not declared in this scope
   22 |           x = i + dx.at(k);
      |           ^
a.cc:23:11: error: 'y' was not declared in this scope
   23 |           y = j + dy.at(k);
      |           ^
a.cc:27:22: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   27 |               if (ca == "#") cnt++;
      |                   ~~~^~~~~~
a.cc:31:25: error: cast from 'const char*' to 'char' loses precision [-fpermissive]
   31 |         S.at(i).at(j) = char(cnt + "0");
      |                         ^~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

int main() {
  int H, W;
  cin >> H >> W;
  vector<string> S(H);
  rep(i, H) cin >> S.at(i);

  vector<int> dx(8) = {-1, -1, -1, 0, 0, 1, 1, 1};
  vector<int> dy(8) = {-1, 0, 1, -1, 1, -1, 0, 1};

  rep(i, H) {
    rep(j, W) {
      int cnt = 0;
      char c = S.at(i).at(j);
      if (c == ".") {
        rep(k, 8) {
          x = i + dx.at(k);
          y = j + dy.at(k);
          if (x >= 0 && x < H) {
            if (y >= 0 && y < W) {
              char ca = S.at(x).at(y);
              if (ca == "#") cnt++;
            }
          }
        }
        S.at(i).at(j) = char(cnt + "0");
      }
    }
  }
  rep(i, H) cout << S.at(i) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:21: error: expected ',' or ';' before '=' token
   12 |   vector<int> dx(8) = {-1, -1, -1, 0, 0, 1, 1, 1};
      |                     ^
a.cc:13:21: error: expected ',' or ';' before '=' token
   13 |   vector<int> dy(8) = {-1, 0, 1, -1, 1, -1, 0, 1};
      |                     ^
a.cc:19:13: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   19 |       if (c == ".") {
      |           ~~^~~~~~
a.cc:21:11: error: 'x' was not declared in this scope
   21 |           x = i + dx.at(k);
      |           ^
a.cc:22:11: error: 'y' was not declared in this scope
   22 |           y = j + dy.at(k);
      |           ^
a.cc:26:22: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   26 |               if (ca == "#") cnt++;
      |                   ~~~^~~~~~
a.cc:30:25: error: cast from 'const char*' to 'char' loses precision [-fpermissive]
   30 |         S.at(i).at(j) = char(cnt + "0");
      |                         ^~~~~~~~~~~~~~~
Language: C++

int main(void) {
int h,w;
  cin >> h >> w;
  string board[50];
    for(int i =0; i<h; ++i) cin >>board[i];
  
  const int dx[8] = {1,0,-1,0,1,-1,-1,1};
  const int dy[8] = {0,1,0,-1,1,1,-1,-1};
  
  for(int i = 0; i < h; ++i) {
    for(int j = 0; j<w; ++j) {
      if(board[i][j] == '#') continue;
      
      int num = 0;
      for(int d=0; d<8; ++d) {
        const int ni = i+dy[d];
        const int nj = j=dx[d];
        
        if(ni <0orh <=ni) continue;
        if(nj <0orw <=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:3:3: error: 'cin' was not declared in this scope
    3 |   cin >> h >> w;
      |   ^~~
a.cc:4:3: error: 'string' was not declared in this scope
    4 |   string board[50];
      |   ^~~~~~
a.cc:5:35: error: 'board' was not declared in this scope
    5 |     for(int i =0; i<h; ++i) cin >>board[i];
      |                                   ^~~~~
a.cc:12:10: error: 'board' was not declared in this scope
   12 |       if(board[i][j] == '#') continue;
      |          ^~~~~
a.cc:19:16: error: unable to find numeric literal operator 'operator""orh'
   19 |         if(ni <0orh <=ni) continue;
      |                ^~~~
a.cc:20:16: error: unable to find numeric literal operator 'operator""orw'
   20 |         if(nj <0orw <=nj) continue;
      |                ^~~~
a.cc:22:12: error: 'board' was not declared in this scope
   22 |         if(board[ni][nj] == '#') num++;
      |            ^~~~~
a.cc:26:7: error: 'board' was not declared in this scope
   26 |       board[i][j] = char(num+'0');
      |       ^~~~~
a.cc:31:30: error: 'cout' was not declared in this scope
   31 |   for(int i = 0; i < h; ++i) cout << board[i] << endl;
      |                              ^~~~
a.cc:31:38: error: 'board' was not declared in this scope
   31 |   for(int i = 0; i < h; ++i) cout << board[i] << endl;
      |                                      ^~~~~
a.cc:31:50: error: 'endl' was not declared in this scope
   31 |   for(int i = 0; i < h; ++i) cout << board[i] << endl;
      |                                                  ^~~~