Language: C++

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

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:5:1: error: 'pair' does not name a type
    5 | pair<int , int> d(8);
      | ^~~~
a.cc:7:27: error: 'vector' has not been declared
    7 | int cntmine(int x, int y, vector<vector<char>> &V){
      |                           ^~~~~~
a.cc:7:33: error: expected ',' or '...' before '<' token
    7 | int cntmine(int x, int y, vector<vector<char>> &V){
      |                                 ^
a.cc: In function 'int cntmine(int, int, int)':
a.cc:9:22: error: 'd' was not declared in this scope
    9 |   for(int i = 0; i < d.size(); i++){
      |                      ^
a.cc:12:14: error: 'W' was not declared in this scope
   12 |     if(dx >= W || dy >= H || dx < 0 || dy < 0) continue;
      |              ^
a.cc:12:25: error: 'H' was not declared in this scope
   12 |     if(dx >= W || dy >= H || dx < 0 || dy < 0) continue;
      |                         ^
a.cc:13:8: error: 'V' was not declared in this scope
   13 |     if(V[dy][dx] == "#") a++;
      |        ^
a.cc: In function 'int main()':
a.cc:19:3: error: 'd' was not declared in this scope
   19 |   d[0] = make_pair(0,1);
      |   ^
a.cc:19:10: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
   19 |   d[0] = make_pair(0,1);
      |          ^~~~~~~~~
      |          std::make_pair
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_pair.h:1132:5: note: 'std::make_pair' declared here
 1132 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
a.cc:29:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   29 |   cin >> H >> W;
      |   ^~~
      |   std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:30:3: error: 'vector' was not declared in this scope
   30 |   vector<vector<char>> V(H, vector<char> (W,'.'));
      |   ^~~~~~
a.cc:30:3: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:30:17: error: expected primary-expression before 'char'
   30 |   vector<vector<char>> V(H, vector<char> (W,'.'));
      |                 ^~~~
a.cc:32:39: error: 'V' was not declared in this scope
   32 |     for(int j = 0; j < W; j++) cin >> V[H][W];
      |                                       ^
a.cc:38:11: error: 'V' was not declared in this scope
   38 |       c = V[H][W];
      |           ^
a.cc:46:11: error: 'V' was not declared in this scope
   46 |       c = V[H][W];
      |           ^
a.cc:47:7: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   47 |       cout << c;
      |       ^~~~
      |       std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:49:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   49 |     cout << endl;
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:49:13: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   49 |     cout << endl;
      |             ^~~~
      |             std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~