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

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
   int n,k,i,j;
   cin>>n>>k;
   char c[n][k],ans[n][k];
   rep(i,n){
     rep(j,k){
     cin>>c[i][j];
     ans[i][j]='0';
     }
   }
   rep(i,n){
     rep(j,k){
     if(i-1>=0&&j-1>0){
         ans[i-1][j-1]+=1;
         }
         if(i-1>=0){
         ans[i-1][j]+=1;
         }
         if(i-1>=0&&j+1<k){
         ans[i-1][j+1]+=1;
         }
         if(j-1>=0){
         ans[i][j-1]+=1;
         }
         if(i+1<k){
         ans[i][j+1]+=1;
         }
         if(i+1<n&&j-1>=0){
         ans[i+1][j-1]+=1;
         }
         if(i+1<n){
         ans[i+1][j]+=1;
         }
         if(i+1<n&&j+1<k){
         ans[i+1][j+1]+=1;
         }
       }
     }
   }
   rep(i,n){
     rep(j,k){
       if(c[i][j]=='#'){
         ans[i][j]='#';
       }
     }
   }
     rep(i,n){
      rep(j,k){
        cout<<ans[i][j];
      }
       cout<<endl;
     }
     return 0;
}


Compiler output:
a.cc:4:19: error: expected unqualified-id before 'for'
    4 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                   ^~~
a.cc:45:4: note: in expansion of macro 'rep'
   45 |    rep(i,n){
      |    ^~~
a.cc:45:8: error: 'i' does not name a type
   45 |    rep(i,n){
      |        ^
a.cc:4:35: note: in definition of macro 'rep'
    4 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                                   ^
a.cc:45:8: error: 'i' does not name a type
   45 |    rep(i,n){
      |        ^
a.cc:4:49: note: in definition of macro 'rep'
    4 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                                                 ^
a.cc:4:19: error: expected unqualified-id before 'for'
    4 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                   ^~~
a.cc:52:6: note: in expansion of macro 'rep'
   52 |      rep(i,n){
      |      ^~~
a.cc:52:10: error: 'i' does not name a type
   52 |      rep(i,n){
      |          ^
a.cc:4:35: note: in definition of macro 'rep'
    4 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                                   ^
a.cc:52:10: error: 'i' does not name a type
   52 |      rep(i,n){
      |          ^
a.cc:4:49: note: in definition of macro 'rep'
    4 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                                                 ^
a.cc:58:6: error: expected unqualified-id before 'return'
   58 |      return 0;
      |      ^~~~~~
a.cc:59:1: error: expected declaration before '}' token
   59 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
   int n,k;
   cin>>n>>k;
   char c[n][k],ans[n][k];
   rep(i,n){
     rep(j,k){
     cin>>c[i][j];
     ans[i][j]='0';
     }
   }
   rep(i,n){
     rep(j,k){
     if(i-1>=0&&j-1>0){
         ans[i-1][j-1]+=1;
         }
         if(i-1>=0){
         ans[i-1][j]+=1;
         }
         if(i-1>=0&&j+1<k){
         ans[i-1][j+1]+=1;
         }
         if(j-1>=0){
         ans[i][j-1]+=1;
         }
         if(i+1<k){
         ans[i][j+1]+=1;
         }
         if(i+1<n&&j-1>=0){
         ans[i+1][j-1]+=1;
         }
         if(i+1<n){
         ans[i+1][j]+=1;
         }
         if(i+1<n&&j+1<k){
         ans[i+1][j+1]+=1;
         }
       }
     }
   }
   rep(i,n){
     rep(j,k){
       if(c[i][j]=='#'){
         ans[i][j]='#';
       }
     }
   }
     rep(i,n){
      rep(j,k){
        cout<<ans[i][j];
      }
       cout<<endl;
     }
     return 0;
}


Compiler output:
a.cc:4:19: error: expected unqualified-id before 'for'
    4 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                   ^~~
a.cc:45:4: note: in expansion of macro 'rep'
   45 |    rep(i,n){
      |    ^~~
a.cc:45:8: error: 'i' does not name a type
   45 |    rep(i,n){
      |        ^
a.cc:4:35: note: in definition of macro 'rep'
    4 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                                   ^
a.cc:45:8: error: 'i' does not name a type
   45 |    rep(i,n){
      |        ^
a.cc:4:49: note: in definition of macro 'rep'
    4 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                                                 ^
a.cc:4:19: error: expected unqualified-id before 'for'
    4 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                   ^~~
a.cc:52:6: note: in expansion of macro 'rep'
   52 |      rep(i,n){
      |      ^~~
a.cc:52:10: error: 'i' does not name a type
   52 |      rep(i,n){
      |          ^
a.cc:4:35: note: in definition of macro 'rep'
    4 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                                   ^
a.cc:52:10: error: 'i' does not name a type
   52 |      rep(i,n){
      |          ^
a.cc:4:49: note: in definition of macro 'rep'
    4 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                                                 ^
a.cc:58:6: error: expected unqualified-id before 'return'
   58 |      return 0;
      |      ^~~~~~
a.cc:59:1: error: expected declaration before '}' token
   59 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
   int n,k;
   cin>>n>>k;
   char c[n][k],ans[n][k];
   rep(i,n){
     rep(j,k){
     cin>>c[i][j];
     ans[i][j]='0';
     }
   }
   rep(i,n){
     rep(j,k){
       if(c[i][j]=='#'){
         ans[i-1][j-1]+=1;
         ans[i-1][j]+=1;
         ans[i-1][j+1]+=1;
         ans[i][j-1]+=1;
         ans[i][j+1]+=1;
         ans[i+1][j-1]+=1;
         ans[i+1][j]+=1;
         ans[i+1][j+1]+=1;
       }
     }
   rep(i,n){
     rep(j,k){
       if(c[i][j]=='#'){
         ans[i][j]='#';
       }
     }
   }
     rep(i,n){
      rep(j,k){
        cout<<c[i][j];
      }
       cout<<endl;
     }
     return 0;
}


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

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
   int n,k;
   cin>>n>>k;
   char c[n][k],ans[n][k];
   rep(i,n){
     rep(j,k){
     cin>>c[i][j];
     ans[i][j]='0';
     }
   }
   rep(i,n){
     rep(j,k){
       if(c[i][j]=='#'){
         ans[i-1][j-1]+=1;
         ans[i-1][j]+=1;
         ans[i-1][j+1]+=1;
         ans[i][j-1]+=1;
         ans[i][j+1]+=1;
         ans[i+1][j-1]+=1;
         ans[i+1][j]+=1;
         ans[i+1][j+1]+=1;
       }
     }
   rep(i,n){
     rep(j,k){
       if(c[i][j]=='#'){
         ans[i][j]='#';
       }
     }
     rep(i,n){
      rep(j,k){
        cout<<c[i][j];
      }
       cout<<endl;
     }
     return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:2: error: expected '}' at end of input
   42 | }
      |  ^
a.cc:16:12: note: to match this '{'
   16 |    rep(i,n){
      |            ^
a.cc:42:2: error: expected '}' at end of input
   42 | }
      |  ^
a.cc:6:12: note: to match this '{'
    6 | int main() {
      |            ^
Language: C++

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

int main() {
  
  int H, W;
  cin >> H >> W;
  
  string a, b, c;
  
  string nulll;
  for(int i=0;i<52;i++)nulll+=".";
  for (int i = 1; i <= H; i++) {
    
    // (i-1)行、i行、(i+1)行の情報を取り出す
    
    if (H == 1) {
      a = nulll;
      cin >> b;
      b = "." + b + ".";
      c = nulll;
    }
    
    else {
    
      if (i == 1) {
        a = nulll;
        cin >> b >> c;
        b = "." + b + ".";
        c = "." + c + ".";
      }
    
      else if (i == H) {
        a = b;
        b = c;
        c = nulll;
      }
    
      else {
        a = b;
        b = c;
        cin >> c;
        c = "." + c + ".";
      }
    
    }
    
    for (int j = 1; j <= W; j++){
      
      // (i,j)を書き換える
      
      char x = b.at(j);
      
      if (x == '.') {
        
        int counter = 0;
        
        if (a.at(j-1) == '#') counter++;
        if (a.at(j) == '#') counter++;
        if (a.at(j+1) == '#') counter++;
        if (b.at(j-1) == '#') counter++;
        if (b.at(j+1) == '#') counter++;
        if (c.at(j-1) == '#') counter++;
        if (c.at(j) == '#') counter++;
        if (c.at(j+1) == '#') counter++;
        
        char y;
        y = '0' + counter;
        b.at(j) = y;
        
      }
      
    }
    
    string d = b.erase(b.begin(),b.begin()+1);
    string e = d.erase(d.begin()+W,d.begin()+W+1);
    
    cout << e << endl;
    
  }
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:75:23: error: conversion from 'std::__cxx11::basic_string<char>::iterator' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   75 |     string d = b.erase(b.begin(),b.begin()+1);
      |                ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
a.cc:76:23: error: conversion from 'std::__cxx11::basic_string<char>::iterator' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   76 |     string e = d.erase(d.begin()+W,d.begin()+W+1);
      |                ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

int main() {
  
  int H, W;
  cin >> H >> W;
  
  string a, b, c;
  
  string nulll;
  for(int i=0;i<52;i++)nulll+=".";
  for (int i = 1; i <= H; i++) {
    
    // (i-1)行、i行、(i+1)行の情報を取り出す
    
    if (H == 1) {
      a = nulll;
      cin >> b;
      b = "." + b + ".";
      c = nulll;
    }
    
    else {
    
      if (i == 1) {
        a = nulll;
        cin >> b >> c;
        b = "." + b + ".";
        c = "." + c + ".";
      }
    
      else if (i == H) {
        a = b;
        b = c;
        c = nulll;
      }
    
      else {
        a = b;
        b = c;
        cin >> c;
        c = "." + c + ".";
      }
    
    }
    
    for (int j = 1; j <= W; j++){
      
      // (i,j)を書き換える
      
      char x = b.at(j);
      
      if (x == '.') {
        
        int counter = 0;
        
        if (a.at(j-1) == '#') counter++;
        if (a.at(j) == '#') counter++;
        if (a.at(j+1) == '#') counter++;
        if (b.at(j-1) == '#') counter++;
        if (b.at(j+1) == '#') counter++;
        if (c.at(j-1) == '#') counter++;
        if (c.at(j) == '#') counter++;
        if (c.at(j+1) == '#') counter++;
        
        char y;
        y = '0' + counter;
        b.at(j) = y;
        
      }
      
    }
    
    string d = b.erase(b.begin(),b.begin()+1);
    string e = d.erase(d.begin()+W,b.begin()+W+1);
    
    cout << e << endl;
    
  }
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:75:23: error: conversion from 'std::__cxx11::basic_string<char>::iterator' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   75 |     string d = b.erase(b.begin(),b.begin()+1);
      |                ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
a.cc:76:23: error: conversion from 'std::__cxx11::basic_string<char>::iterator' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   76 |     string e = d.erase(d.begin()+W,b.begin()+W+1);
      |                ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

int main() {
  
  int H, W;
  cin >> H >> W;
  
  string a, b, c;　// 注目したい列をbとしてaとcはその上と下
  
  string null = "....................................................";
  
  for (int i = 1; i <= H; i++) {
    
    // (i-1)行、i行、(i+1)行の情報を取り出す
    
    if (H == 1) {
      a = null;
      cin >> b;
      b = "." + b + ".";
      c = null;
    }
    
    else {
    
      if (i == 1) {
        a = null;
        cin >> b >> c;
        b = "." + b + ".";
        c = "." + c + '.';
      }
    
      else if (i == H) {
        a = b;
        b = c;
        c = null;
      }
    
      else {
        a = b;
        b = c;
        cin >> c;
        c = "." + c + ".";
      }
    
    }
    
    for (int j = 1; j <= W; j++){
      
      // (i,j)を書き換える
      
      char x = b.at(j);
      
      if (x == '.') {
        
        int counter = 0;
        
        if (a.at(j-1) == '#') counter++;
        if (a.at(j) == '#') counter++;
        if (a.at(j+1) == '#') counter++;
        if (b.at(j-1) == '#') counter++;
        if (b.at(j+1) == '#') counter++;
        if (c.at(j-1) == '#') counter++;
        if (c.at(j) == '#') counter++;
        if (c.at(j+1) == '#') counter++;
        
        char y;
        y = '0' + counter;
        b.at(j) = y;
        
      }
      
    }
    
    string d = b.erase(0,1);
    string e = d.erase(W,1);
    
    cout << e << endl;
    
  }
  
}

Compiler output:
a.cc:9:18: error: extended character 　 is not valid in an identifier
    9 |   string a, b, c;　// 注目したい列をbとしてaとcはその上と下
      |                  ^
a.cc: In function 'int main()':
a.cc:9:18: error: '\U00003000' was not declared in this scope
    9 |   string a, b, c;　// 注目したい列をbとしてaとcはその上と下
      |                  ^~
a.cc:18:11: error: 'null' was not declared in this scope
   18 |       a = null;
      |           ^~~~
a.cc:27:13: error: 'null' was not declared in this scope
   27 |         a = null;
      |             ^~~~
a.cc:36:13: error: 'null' was not declared in this scope
   36 |         c = null;
      |             ^~~~
Language: C++

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

int main(){
  int H,W;
  cin >>H>>W;
  
  string S[W];
  
  rep(i,0,W) 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};
  
  rep(x,0,H){
    rep(y,0,W){
      if(S[x][y]=='#') continue;
      int num = 0;
      rep(d,0,8){
        const int nx = x + dy[d];
        const int ny = y + dx[d];
        
        if(nx<0 or H<=nx)continue;
        if(ny<0 or W<=ny)continue;
        if(S[nx][ny]=='#') num++;
      }
      S[x][y] = char(num + '0');
    }
  }
  rep(i,0,W) cout << S[i] << endl;


Compiler output:
a.cc: In function 'int main()':
a.cc:30:35: error: expected '}' at end of input
   30 |   rep(i,0,W) cout << S[i] << endl;
      |                                   ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
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=0;i<w+2;i++){
    m.at(0).at(i)='.';
    m.at(h+1).at(i)='.';
  }
  for(int i=0;i<h+2;i++){
    m.at(i).at(0)='.';
    m.at(i).at(w+1)='.';
  }
  for(int i=1;i<h+1;i++){
    string s;cin>>s;
    for(int j=1;j<w+1;j++)m.at(i).at(j)=s.at(j-1);
  }
  for(int i=1;i<h+1;i++){
    for(int j=1;j<w=1;j++){
      if(m.at(i).at(j)=='.'){
        int a=0;
        if(m.at(i-1).at(j-1)=='#')a++;
        if(m.at(i-1).at(j)=='#')a++;
        if(m.at(i-1).at(j+1)=='#')a++;
        if(m.at(i).at(j-1)=='#')a++;
        if(m.at(i).at(j+1)=='#')a++;
        if(m.at(i+1).at(j-1)=='#')a++;
        if(m.at(i+1).at(j)=='#')a++;
        if(m.at(i+1).at(j+1)=='#')a++;
        m.at(i).at(j)=a;
      }
    }
  }
  for(int i=1;i<h+1;i++){
    for(int j=1;j<w+1;j++){
      cout<<m.at(i).at(j);
    }
    cout<<endl;
  }
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:19:18: error: lvalue required as left operand of assignment
   19 |     for(int j=1;j<w=1;j++){
      |                 ~^~
Language: C++

#include<iostream>
#include<string>
#include<vector>
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];
	}
	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			if(s[i][j] == ".") s[i][j] = "0";
		}
	}
	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			if(s[i][j] == "#") {
				if(i!=0) {
					if(j!=0)
						s[i-1][j-1]++;
					s[i-1][j]++;
					if(j !=w - 1)
						s[i-1][j+1]++;
				}
				if(j!=0)
					s[i][j-1]++;
				s[i][j]++;
				if(j !=w - 1)
					s[i][j+1]++;
				if(i!=h-1) {
					if(j!=0)
						s[i+1][j-1]++;
					s[i+1][j]++;
					if(j !=w - 1)
						s[i+1][j+1]++;
				}
			}
		}
	}
	for(int i=0; i<h; i++){
		cout << s[i] << endl;
	}
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:15:36: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   15 |                         if(s[i][j] == ".") s[i][j] = "0";
a.cc:15:54: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive]
   15 |                         if(s[i][j] == ".") s[i][j] = "0";
      |                                                      ^~~
      |                                                      |
      |                                                      const char*
a.cc:20:36: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   20 |                         if(s[i][j] == "#") {
Language: C

#include <iostream>
#include <vector>

using namespace std;

int main(){
  int h,w;cin>>h>>w;
  vector<string> board(h);
  for(int i=0;i<h;i++){
    cin>>board[i];
  }
  const int x[8] = {-1,0,1,-1,1,-1,0,1};
  const int y[8] = {1,1,1,0,0,-1,-1,-1};

  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(board[i][j]=='#') continue;
      int cnt=0;
      for(int k=0;k<8;++k){
        const int iy = i + y[k];
        const int jx = j + x[k];
        if(iy<0 || h<=iy) continue;
        if(jx<0 || w<=jx) continue;
        if(board[iy][jx]=='#') cnt++;
      }
      board[i][j] = char(cnt+'0');
    }
  }
  for(int i=0;i<h;i++) cout<<board[i]<<endl;
}

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

        #include <bits/stdc++.h>
        using namespace std;
         
        int main() {
        int H, W;
        cin >> H >> W;
        Matrix<int> Si(H+1,W+1);
        string s[H];
        
          for (int i = 0; i < H; i++){
            cin >> s[i];
          }
     
          for (int i = 0; i < H+1; i++){
            for (int j = 0; j < W+1; j++){
               Si[i][j]=0;
            }
          }
          
          for (int i = 0; i < H; i++){
            for (int j = 0; j < W; j++){
             if(s[i].at(j)=='#'){
               Si[i][j]++;
               Si[i][j+1]++;
               Si[i][j+2]++;
               Si[i+1][j]++;
               //Si[i+1][j+1]++;
               Si[i+1][j+2]++;
               Si[i+2][j]++;
               Si[i+2][j+1]++;
               Si[i+2][j+2]++;
             }
            }
          }
          for (int i = 0; i < H; i++){
            for (int j = 0; j < W; j++){
             if(s[i].at(j)!='#'){
               cout << Si[i+1][j+1];
             }
              else{
                cout << '#';
              }
            }
           cout << endl;
          }        
          return 0;
        }

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'Matrix' was not declared in this scope
    7 |         Matrix<int> Si(H+1,W+1);
      |         ^~~~~~
a.cc:7:16: error: expected primary-expression before 'int'
    7 |         Matrix<int> Si(H+1,W+1);
      |                ^~~
a.cc:16:16: error: 'Si' was not declared in this scope; did you mean 'i'?
   16 |                Si[i][j]=0;
      |                ^~
      |                i
a.cc:23:16: error: 'Si' was not declared in this scope; did you mean 'i'?
   23 |                Si[i][j]++;
      |                ^~
      |                i
a.cc:38:24: error: 'Si' was not declared in this scope; did you mean 'i'?
   38 |                cout << Si[i+1][j+1];
      |                        ^~
      |                        i
Language: C++

6 6
#####.
#.#.##
####.#
.#..#.
#.##..
#.#...

Compiler output:
a.cc:2:1: error: stray '##' in program
    2 | #####.
      | ^~
a.cc:2:3: error: stray '##' in program
    2 | #####.
      |   ^~
a.cc:2:5: error: stray '#' in program
    2 | #####.
      |     ^
a.cc:3:2: error: invalid preprocessing directive #.
    3 | #.#.##
      |  ^
a.cc:4:1: error: stray '##' in program
    4 | ####.#
      | ^~
a.cc:4:3: error: stray '##' in program
    4 | ####.#
      |   ^~
a.cc:4:6: error: stray '#' in program
    4 | ####.#
      |      ^
a.cc:5:2: error: stray '#' in program
    5 | .#..#.
      |  ^
a.cc:5:5: error: stray '#' in program
    5 | .#..#.
      |     ^
a.cc:6:2: error: invalid preprocessing directive #.
    6 | #.##..
      |  ^
a.cc:7:2: error: invalid preprocessing directive #.
    7 | #.#...
      |  ^
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 6 6
      | ^
Language: C++

int main() {
  int h, w;

  cin >> h >> w;

  string s[h];

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

  for(int i = 0; i < h; i++) {
    for(int j = 0; j < w; j++) {
      int count = 0;
      if (s[i].at(j) != '#') {

        if (i > 0) {
          if (j > 0) {
            if (s[i-1].at(j-1) == '#')
              count++;
          }

          if (s[i-1].at(j) == '#')
            count++;

          if (j < w -1) {
            if (s[i-1].at(j+1) == '#')
              count++;
            }
        }

        if (j > 0) {
          if (s[i].at(j-1) == '#')
            count++;
        }

        if (j < w -1) {
          if (s[i].at(j+1) == '#')
            count++;
        }

        if ( i != h - 1) {
          if (j > 0) {
            if (s[i+1].at(j-1) == '#')
              count++;
          }

          if (s[i+1].at(j) == '#')
            count++;

          if (j < w -1) {
            if (s[i+1].at(j+1) == '#')
              count++;
          }
        }
        s[i].at(j) = to_string(count).at(0);
      }
    }
    cout << s[i] << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:3: error: 'cin' was not declared in this scope
    4 |   cin >> h >> w;
      |   ^~~
a.cc:6:3: error: 'string' was not declared in this scope
    6 |   string s[h];
      |   ^~~~~~
a.cc:8:7: error: 'i' was not declared in this scope
    8 |   rep(i, h) {
      |       ^
a.cc:8:3: error: 'rep' was not declared in this scope
    8 |   rep(i, h) {
      |   ^~~
a.cc:15:11: error: 's' was not declared in this scope
   15 |       if (s[i].at(j) != '#') {
      |           ^
a.cc:56:22: error: 'to_string' was not declared in this scope
   56 |         s[i].at(j) = to_string(count).at(0);
      |                      ^~~~~~~~~
a.cc:59:5: error: 'cout' was not declared in this scope
   59 |     cout << s[i] << endl;
      |     ^~~~
a.cc:59:13: error: 's' was not declared in this scope
   59 |     cout << s[i] << endl;
      |             ^
a.cc:59:21: error: 'endl' was not declared in this scope
   59 |     cout << s[i] << endl;
      |                     ^~~~
Language: C++

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

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

string board[50];

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

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

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

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

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

}
}

for (int i = 0; i < h; ++i) cout << printf("%d", board[i]) << endl;

return 0;
}

Compiler output:
a.cc:17:20: error: extended character ’ is not valid in an identifier
   17 | if (board[i][j] == ’#’) continue;
      |                    ^
a.cc:17:21: error: stray '#' in program
   17 | if (board[i][j] == ’#’) continue;
      |                     ^
a.cc:17:22: error: extended character ’ is not valid in an identifier
   17 | if (board[i][j] == ’#’) continue;
      |                      ^
a.cc: In function 'int main()':
a.cc:17:20: error: '\U00002019' was not declared in this scope
   17 | if (board[i][j] == ’#’) continue;
      |                    ^
a.cc:17:21: error: expected ')' before '\U00002019'
   17 | if (board[i][j] == ’#’) continue;
      |    ~                ^~
      |                     )
Language: C++

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

char itoa(int n)
{
  return (char)(n+48);
}

int main() {
  int h, w;
  cin >> h >> w;
  string *s = new string[h];
  for (int i = 0; i < h; i++)
    cin >> s[i];
  
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (s[i][j] == '#') {
        cout << s[i][j];
        continue;
      }
      if (i == 0 && j == 0)
        s[i][j] = itoa((s[i+1][j]=='#')+(s[i][j+1]=='#')+(s[i+1][j+1]=='#'));
      else if (i == 0 && j == w-1)
        s[i][j] = itoa((s[i+1][j]=='#')+(s[i][j-1]=='#')+(s[i+1][j-1]=='#'));
      else if (i == h-1 && j == 0)
        s[i][j] = itoa((s[i-1][j]=='#')+(s[i][j+1]=='#')+(s[i-1][j+1]=='#'));
      else if (i == h-1 && j == w-1)
        s[i][j] = itoa((s[i-1][j]=='#')+(s[i][j-1]=='#')+(s[i-1][j-1]=='#'));
      else if (i == 0)
        s[i][j] = itoa((s[i][j-1]=='#')+(s[i+1][j-1]=='#')+(s[i+1][j]=='#')+(s[i][j+1]=='#')+(s[i+1][j+1]=='#'));
      else if (j == 0)
        s[i][j] = itoa((s[i-1][j]=='#')+(s[i-1][j+1]=='#')+(s[i+1][j]=='#')+(s[i][j+1]=='#')+(s[i+1][j+1]=='#'));
      else if (i == h-1)
        s[i][j] = itoa((s[i][j-1]=='#')+(s[i-1][j-1]=='#')+(s[i-1][j]=='#')+(s[i][j+1]=='#')+(s[i-1][j+1]=='#'));
      else if (j == w-1)
        s[i][j] = itoa((s[i-1][j]=='#')+(s[i-1][j-1]=='#')+(s[i+1][j]=='#')+(s[i][j-1]=='#')+(s[i+1][j-1]=='#'));
      else
        s[i][j] = itoa((s[i-1][j]=='#')+(s[i-1][j+1]=='#')+(s[i][j+1]=='#')+(s[i+1][j+1]=='#')+(s[i+1][j]=='#')+(s[i+1][j-1]=='#')+(s[i][j-1]=='#')+(s[i-1][j-1]=='#'));
      cout << s[i][j];
    }
    cout << endl;
  }
  
  for (int i = 0; i < h; i++)
    delete s[i];
}


Compiler output:
a.cc: In function 'int main()':
a.cc:47:15: error: type 'std::string' {aka 'class std::__cxx11::basic_string<char>'} argument given to 'delete', expected pointer
   47 |     delete s[i];
      |            ~~~^
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int hight = sc.nextInt();
		int width = sc.nextInt();
        
        ArrayList<String> list = new ArrayList<>();
      
        for (int i =0; i < hight; i++) {
          	// 文字列の入力
            list.add(sc.next());
        }
      
        String mine = "#";
      
        int[][] value = new int[hight][];
        for(int count = 0; count < hight; count++) {
          String[] s = list.get(count).split("");
          for(int i = 0; i < width; i++) {
            if (mine.equal(s[i])) {
              // 地雷箇所はマイナス値になるようにする
              value[count][i] = -10;
              boolean hasAbove = count > 0;
              boolean hasUnder = count + 1 < width;
              // 上
              if (hasAbove) {
                value[count - 1][i] += 1;
              }
              // 下
              if (hasUnder) {
                value[count + 1][i] += 1;
              }
              
              // 左列が存在するとき
              if (i > 0) {
                // 左
                value[count][i - 1] += 1;
                // 左上
                if (hasAbove) {
                  value[count - 1][i - 1] += 1;
                }
                // 左下
                if (hasUnder) {
                  value[count + 1][i - 1] += 1;
                }
              }
              // 右列が存在するとき 
              if (i + 1 < width) {
                // 右
                value[count][i + 1] += 1;
                // 右上
                if (hasAbove) {
                  value[count - 1][i + 1] += 1;
                }
                // 右下
                if (hasUnder) {
                  value[count + 1][i + i] += 1;
                }
              }
            }
          }
        }
                
        for (int[] childValue : value) {
            String s = "";
            for(int i : childValue) {
              if (i < 0) {
                s += "#";
              } else {
                s += String.valueOf(i);
              }
            }
            // 出力
			System.out.println(s);
        }
	}
}


Compiler output:
Main.java:22: error: cannot find symbol
            if (mine.equal(s[i])) {
                    ^
  symbol:   method equal(String)
  location: variable mine of type String
1 error
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int hight = sc.nextInt();
		int width = sc.nextInt();
        
        ArrayList<String> list = new ArrayList<>();
      
        for (int i =0; i < hight; i++) {
          	// 文字列の入力
            list.add(sc.next());
        }
      
        int[][] value = new int[hight][];
        for(int count = 0; count < hight; count++) {
          String[] s = list.get(count).split("");
          for(int i = 0; i < width; i++) {
            if (s[i].equal("#")) {
              // 地雷箇所はマイナス値になるようにする
              value[count][i] = -10;
              boolean hasAbove = count > 0;
              boolean hasUnder = count + 1 < width;
              // 上
              if (hasAbove) {
                value[count - 1][i] += 1;
              }
              // 下
              if (hasUnder) {
                value[count + 1][i] += 1;
              }
              
              // 左列が存在するとき
              if (i > 0) {
                // 左
                value[count][i - 1] += 1;
                // 左上
                if (hasAbove) {
                  value[count - 1][i - 1] += 1;
                }
                // 左下
                if (hasUnder) {
                  value[count + 1][i - 1] += 1;
                }
              }
              // 右列が存在するとき 
              if (i + 1 < width) {
                // 右
                value[count][i + 1] += 1;
                // 右上
                if (hasAbove) {
                  value[count - 1][i + 1] += 1;
                }
                // 右下
                if (hasUnder) {
                  value[count + 1][i + i] += 1;
                }
              }
            }
          }
        }
                
        for (int[] childValue : value) {
            String s = "";
            for(int i : childValue) {
              if (i < 0) {
                s += "#";
              } else {
                s += String.valueOf(i);
              }
            }
            // 出力
			System.out.println(s);
        }
	}
}


Compiler output:
Main.java:20: error: cannot find symbol
            if (s[i].equal("#")) {
                    ^
  symbol:   method equal(String)
  location: class String
1 error
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int hight = sc.nextInt();
		int width = sc.nextInt();
        
        ArrayList<String> list = new ArrayList<>();
      
        for (int i =0; i < hight; i++) {
          	// 文字列の入力
            list.add(sc.next());
        }
      
        int[][] value = new int[hight][];
        for(int count = 0; count < hight; count++) {
          for(int i = 0; i < width; i++) {
            String[] s = list.get(i).split("");
            if (s[i].equal("#")) {
              // 地雷箇所はマイナス値になるようにする
              value[count][i] = -10;
              boolean hasAbove = count > 0;
              boolean hasUnder = count + 1 < width;
              // 上
              if (hasAbove) {
                value[count - 1][i] += 1;
              }
              // 下
              if (hasUnder) {
                value[count + 1][i] += 1;
              }
              
              // 左列が存在するとき
              if (i > 0) {
                // 左
                value[count][i - 1] += 1;
                // 左上
                if (hasAbove) {
                  value[count - 1][i - 1] += 1;
                }
                // 左下
                if (hasUnder) {
                  value[count + 1][i - 1] += 1;
                }
              }
              // 右列が存在するとき 
              if (i + 1 < width) {
                // 右
                value[count][i + 1] += 1;
                // 右上
                if (hasAbove) {
                  value[count - 1][i + 1] += 1;
                }
                // 右下
                if (hasUnder) {
                  value[count + 1][i + i] += 1;
                }
              }
            }
          }
        }
                
        for (int[] childValue : value) {
            String s = "";
            for(int i : childValue) {
              if (i < 0) {
                s += "#";
              } else {
                s += String.valueOf(i);
              }
            }
            // 出力
			System.out.println(s);
        }
	}
}


Compiler output:
Main.java:20: error: cannot find symbol
            if (s[i].equal("#")) {
                    ^
  symbol:   method equal(String)
  location: class String
1 error
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int hight = sc.nextInt();
		int width = sc.nextInt();
        
        ArrayList<String> list = new ArrayList<>();
      
        for (int i =0; i < hight; i++) {
          	// 文字列の入力
            list.add(sc.next());
        }
      
        int[][] value = new int[hight][];
        for(int count = 0; count < hight; count++) {
          for(int i = 0; i < width; i++) {
            String s = list.get(i);
            if (s.charAt(i).equal("#")) {
              // 地雷箇所はマイナス値になるようにする
              value[count][i] = -10;
              boolean hasAbove = count > 0;
              boolean hasUnder = count + 1 < width;
              // 上
              if (hasAbove) {
                value[count - 1][i] += 1;
              }
              // 下
              if (hasUnder) {
                value[count + 1][i] += 1;
              }
              
              // 左列が存在するとき
              if (i > 0) {
                // 左
                value[count][i - 1] += 1;
                // 左上
                if (hasAbove) {
                  value[count - 1][i - 1] += 1;
                }
                // 左下
                if (hasUnder) {
                  value[count + 1][i - 1] += 1;
                }
              }
              // 右列が存在するとき 
              if (i + 1 < width) {
                // 右
                value[count][i + 1] += 1;
                // 右上
                if (hasAbove) {
                  value[count - 1][i + 1] += 1;
                }
                // 右下
                if (hasUnder) {
                  value[count + 1][i + i] += 1;
                }
              }
            }
          }
        }
                
        for (int[] childValue : value) {
            String s = "";
            for(int i : childValue) {
              if (i < 0) {
                s += "#";
              } else {
                s += String.valueOf(i);
              }
            }
            // 出力
			System.out.println(s);
        }
	}
}


Compiler output:
Main.java:20: error: char cannot be dereferenced
            if (s.charAt(i).equal("#")) {
                           ^
1 error
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int hight = sc.nextInt();
		int width = sc.nextInt();
        
        ArrayList<String> list = new ArrayList<>();
      
        for (int i =0; i < hight; i++) {
          	// 文字列の入力
            list.add(sc.next());
        }
      
        int[][] value = new int[hight][];
        for(int count = 0; count < hight; count++) {
          for(int i = 0; i < width; i++) {
            if (s.charAt(i).equal("#")) {
              // 地雷箇所はマイナス値になるようにする
              value[count][i] = -10;
              boolean hasAbove = count > 0;
              boolean hasUnder = count + 1 < width;
              // 上
              if (hasAbove) {
                value[count - 1][i] += 1;
              }
              // 下
              if (hasUnder) {
                value[count + 1][i] += 1;
              }
              
              // 左列が存在するとき
              if (i > 0) {
                // 左
                value[count][i - 1] += 1;
                // 左上
                if (hasAbove) {
                  value[count - 1][i - 1] += 1;
                }
                // 左下
                if (hasUnder) {
                  value[count + 1][i - 1] += 1;
                }
              }
              // 右列が存在するとき 
              if (i + 1 < width) {
                // 右
                value[count][i + 1] += 1;
                // 右上
                if (hasAbove) {
                  value[count - 1][i + 1] += 1;
                }
                // 右下
                if (hasUnder) {
                  value[count + 1][i + i] += 1;
                }
              }
            }
          }
        }
                
        for (int[] childValue : value) {
            String s = "";
            for(int i : childValue) {
              if (i < 0) {
                s += "#";
              } else {
                s += String.valueOf(i);
              }
            }
            // 出力
			System.out.println(s);
        }
	}
}


Compiler output:
Main.java:19: error: cannot find symbol
            if (s.charAt(i).equal("#")) {
                ^
  symbol:   variable s
  location: class Main
1 error
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int hight = sc.nextInt();
		int width = sc.nextInt();
        
        ArrayList<String> list = new ArrayList<>();
      
        for (int i =0; i < hight; i++) {
          	// 文字列の入力
            list.add(sc.next());
        }
      
        int[][] value = new int[hight][];
        for(int count = 0; count < hight; count++) {
          for(int i = 0; i < width; i++) {
            if (s.charAt(i).equal("#") {
              // 地雷箇所はマイナス値になるようにする
              value[count][i] = -10;
              boolean hasAbove = count > 0;
              boolean hasUnder = count + 1 < width;
              // 上
              if (hasAbove) {
                value[count - 1][i] += 1;
              }
              // 下
              if (hasUnder) {
                value[count + 1][i] += 1;
              }
              
              // 左列が存在するとき
              if (i > 0) {
                // 左
                value[count][i - 1] += 1;
                // 左上
                if (hasAbove) {
                  value[count - 1][i - 1] += 1;
                }
                // 左下
                if (hasUnder) {
                  value[count + 1][i - 1] += 1;
                }
              }
              // 右列が存在するとき 
              if (i + 1 < width) {
                // 右
                value[count][i + 1] += 1;
                // 右上
                if (hasAbove) {
                  value[count - 1][i + 1] += 1;
                }
                // 右下
                if (hasUnder) {
                  value[count + 1][i + i] += 1;
                }
              }
            }
          }
        }
                
        for (int[] childValue : value) {
            String s = "";
            for(int i : childValue) {
              if (i < 0) {
                s += "#";
              } else {
                s += String.valueOf(i);
              }
            }
            // 出力
			System.out.println(s);
        }
	}
}

Compiler output:
Main.java:19: error: ')' expected
            if (s.charAt(i).equal("#") {
                                      ^
1 error
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define fs first
#define sc second
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main(){
  int h,w;
  cin>>h>>w;
  vector<vector<char>>s(h,vector<char>(w));
  for(int n=0;n<h;n++){
    for(int m=0;m<w;m++){
  if(s[n][m]=='.'){
    for(int i=-1;i<=1;i++){
      int cnt=0;
      for(int j=-1;j<=1;j++){
        if(s[n+i][m+j]=='#')cnt++; s[n][m]=cnt;}}}}
  rep(i,h){
    rep(j,w){
  cout<<s[i][j];
    }
    cout<<endl;
  }
}

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

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

int main() {
  int h,w;
  cin>>h>>w;
  char vec[55][55];
  int ans[h+2][w+2]={};

  for (int i=0; i<h; i++){
    for (omt j=0; j<w;j++){
      cin>>vec[i][j];
      if (vec[i][j]=='#') {
        for (int y = 0; y < 3; y++) {
          for (int x = 0; x < 3; x++) {
            ans[i+y][j+x]++;
          }
        }
      }
    }
  }
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (vec[i][j]=='#') cout<<'#';
      else cout<<ans[i+1][j+1];
    }
    cout<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:10: error: 'omt' was not declared in this scope
   11 |     for (omt j=0; j<w;j++){
      |          ^~~
a.cc:11:19: error: 'j' was not declared in this scope
   11 |     for (omt j=0; j<w;j++){
      |                   ^
Language: C++

#include <iostream>
#include <vector>
#include <map>

using namespace std;

vector<pair<int , int>> d(8);
int H, W;

int cntmine(int x, int y, vector<vector<char>> &V){
  int a = 0;
  for(int i = 0; i < d.size(); i++){
    int dx = x + d[i].first;
    int dy = y + d[i].second;
    if(dx >= W || dy >= H || dx < 0 || dy < 0) continue;
    if(V[dy][dx] == "#") a++;
  }
  return a;
}

int main(){
  d[0] = make_pair(0,1);
  d[1] = make_pair(1,0);
  d[2] = make_pair(0,-1);
  d[3] = make_pair(-1,0);
  d[4] = make_pair(1,1);
  d[5] = make_pair(1,-1);
  d[6] = make_pair(-1,1);
  d[7] = make_pair(-1,-1);
  
  cin >> H >> W;
  vector<vector<char>> V(H, vector<char> (W,'.'));
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++) cin >> V[H][W];
  }
  
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      char c;
      c = V[H][W];
      if(c == '.') V[i][j] = cntmine(j,i,V);
    }
  }
  
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      char c;
      c = V[H][W];
      cout << c;
    }
    cout << endl;
  }
}


Compiler output:
a.cc: In function 'int cntmine(int, int, std::vector<std::vector<char> >&)':
a.cc:16:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   16 |     if(V[dy][dx] == "#") a++;
Language: C++

#include <iostream>
#include <vector>
#include <map>

using namespace std;

vector<pair<int , int>> d(8);

int cntmine(int x, int y, vector<vector<char>> &V){
  int a = 0;
  for(int i = 0; i < d.size(); i++){
    int dx = x + d[i].first;
    int dy = y + d[i].second;
    if(dx >= W || dy >= H || dx < 0 || dy < 0) continue;
    if(V[dy][dx] == "#") a++;
  }
  return a;
}

int main(){
  d[0] = make_pair(0,1);
  d[1] = make_pair(1,0);
  d[2] = make_pair(0,-1);
  d[3] = make_pair(-1,0);
  d[4] = make_pair(1,1);
  d[5] = make_pair(1,-1);
  d[6] = make_pair(-1,1);
  d[7] = make_pair(-1,-1);
  
  int H, W;
  cin >> H >> W;
  vector<vector<char>> V(H, vector<char> (W,'.'));
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++) cin >> V[H][W];
  }
  
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      char c;
      c = V[H][W];
      if(c == '.') V[i][j] = cntmine(j,i,V);
    }
  }
  
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      char c;
      c = V[H][W];
      cout << c;
    }
    cout << endl;
  }
}


Compiler output:
a.cc: In function 'int cntmine(int, int, std::vector<std::vector<char> >&)':
a.cc:14:14: error: 'W' was not declared in this scope
   14 |     if(dx >= W || dy >= H || dx < 0 || dy < 0) continue;
      |              ^
a.cc:14:25: error: 'H' was not declared in this scope
   14 |     if(dx >= W || dy >= H || dx < 0 || dy < 0) continue;
      |                         ^
a.cc:15:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   15 |     if(V[dy][dx] == "#") a++;
Language: C++

#include <iostream>
#include <vector>
#include <map>

using namespace std;

vector<pair<int , int>> d(8);

int cntmine(int x, int y, vector<vector<char>> &V){
  int a = 0;
  for(int i = 0; i < d.size(); i++){
    int dx = x + d.first;
    int dy = y + d.second;
    if(dx >= W || dy >= H || dx < 0 || dy < 0) continue;
    if(V[dy][dx] == "#") a++;
  }
  return a;
}

int main(){
  d[0] = make_pair(0,1);
  d[1] = make_pair(1,0);
  d[2] = make_pair(0,-1);
  d[3] = make_pair(-1,0);
  d[4] = make_pair(1,1);
  d[5] = make_pair(1,-1);
  d[6] = make_pair(-1,1);
  d[7] = make_pair(-1,-1);
  
  int H, W;
  cin >> H >> W;
  vector<vector<char>> V(H, vector<char> (W,'.'));
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++) cin >> V[H][W];
  }
  
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      char c;
      c = V[H][W];
      if(c == '.') V[i][j] = cntmine(j,i,V);
    }
  }
  
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      char c;
      c = V[H][W];
      cout << c;
    }
    cout << endl;
  }
}


Compiler output:
a.cc: In function 'int cntmine(int, int, std::vector<std::vector<char> >&)':
a.cc:12:20: error: 'class std::vector<std::pair<int, int> >' has no member named 'first'
   12 |     int dx = x + d.first;
      |                    ^~~~~
a.cc:13:20: error: 'class std::vector<std::pair<int, int> >' has no member named 'second'
   13 |     int dy = y + d.second;
      |                    ^~~~~~
a.cc:14:14: error: 'W' was not declared in this scope
   14 |     if(dx >= W || dy >= H || dx < 0 || dy < 0) continue;
      |              ^
a.cc:14:25: error: 'H' was not declared in this scope
   14 |     if(dx >= W || dy >= H || dx < 0 || dy < 0) continue;
      |                         ^
a.cc:15:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   15 |     if(V[dy][dx] == "#") a++;
Language: C++

#include<bits/stdc++.h>
using namespace std;
char a[105][105],b[105][105];
int main()
{
	int n,m,cnt=0;
	cin>>n>>m;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			cin>>a[i][j];
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
		{ 
			if(a[i][j]=='#')
			{
				continue;
			}
			if(a[i+1][j]=='#')
				b[i][j]++;
			if(a[i-1][j]=='#')
				b[i][j]++;
			if(a[i][j+1]=='#')
				b[i][j]++;
			if(a[i][j-1]=='#')
				b[i][j]++;
			if(a[i+1][j+1]=='#')
				b[i][j]++;	
			if(a[i+1][j-1]=='#')
				b[i][j]++;
			if(a[i-1][j+1]=='#')
				b[i][j]++
			if(a[i-1][j-1]=='#')
				b[i][j]++;
			a[i][j]=b[i][j]+48;	
		}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
			cout<<a[i][j];
		cout<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:42: error: expected ';' before 'if'
   31 |                                 b[i][j]++
      |                                          ^
      |                                          ;
   32 |                         if(a[i-1][j-1]=='#')
      |                         ~~
Language: C++

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


int main(){
    int H,W;
    string S[50];
    int mine[50][50] ={};
    int dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
    int dy[8] = {0, 1, 1,  1,  0, -1,-1,-1};
    cin >> H >> W;
    rep(i,H+1){
        cin >> S[i+1];
    }
    rep(i,H){
        rep(j,W){
            int cnt = 0;
            rep(l,8){
                if(j+dx[l] < 0 || i+dy[l] < 0 || W <=j+dx[l] || H <=i+dy[l]){
                    continue;
                }
                cnt += (S[j+dx[l]][i+dx[l]] == '#'? 1 : 0);
            }
            cout << (S[i][j]=='#'? "#":cnt);
        }
        cout << endl;
    }

    //cout <<  (flag ? "Yes" : "No") << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:34: error: operands to '?:' have different types 'const char*' and 'int'
   30 |             cout << (S[i][j]=='#'? "#":cnt);