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

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

int main(void) {
  int H, W;
  int count[H][W] = {0};
  cin >> H >> W;
  string str[H], Tri[H];
  for (int i = 0; i < H; i++) {
    cin >> str[H];
    Tri[i] = str[i];
  }
  for (int i = 0; i < H; i++) {
    for (int k = 0; k < W; k++) {
      if (str[i][k] != '#') {
        T[i][j] = '0';
        for (j = -1; j <= 1; j++) {
          for (int l = -1; l <= 1; l++) {
            int ny = i + j, nx = k + l;
            if (ny < 0 || nx < 0 || ny >= H || nx >= W)
              continue;
            if (S[ny][nx] == '#')
              ++T[i][j];
          }
        }
      }
    }
    cout << T[i] << endl;
    return 0;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:9: error: 'T' was not declared in this scope
   18 |         T[i][j] = '0';
      |         ^
a.cc:18:14: error: 'j' was not declared in this scope
   18 |         T[i][j] = '0';
      |              ^
a.cc:22:27: error: 'nx' was not declared in this scope; did you mean 'ny'?
   22 |             if (ny < 0 || nx < 0 || ny >= H || nx >= W)
      |                           ^~
      |                           ny
a.cc:24:17: error: 'S' was not declared in this scope
   24 |             if (S[ny][nx] == '#')
      |                 ^
a.cc:24:23: error: 'nx' was not declared in this scope; did you mean 'ny'?
   24 |             if (S[ny][nx] == '#')
      |                       ^~
      |                       ny
a.cc:30:13: error: 'T' was not declared in this scope
   30 |     cout << T[i] << endl;
      |             ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int n,m,a[52][52],op=-10;
char c;
int main()
{
    cin>>n>>m;
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
        {
            cin>>c;
            if(c=='#')
            {
                a[i][j]=oo;
                a[i-1][j-1]++;
                a[i-1][j]++;
                a[i-1][j+1]++;
                a[i][j-1]++;
                a[i][j+1]++;
                a[i+1][j-1]++;
                a[i+1][j]++;
                a[i+1][j+1]++;
            }
        }
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
            if(a[i][j]<0)cout<<"#";
            else cout<<a[i][j];
        cout<<endl;
    }   
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:25: error: 'oo' was not declared in this scope; did you mean 'op'?
   14 |                 a[i][j]=oo;
      |                         ^~
      |                         op
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 < 0 or h <= ni) continue;
 if (nj < 0 or w <= nj) continue;
 if (board[ni][nj] == '#') num++;
 }

 board[i][j] = char(num + '#');

 }
 }

 for (int i = 0; i < h; ++i) cout << board[i] << endl;

 return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:3:2: error: 'cin' was not declared in this scope
    3 |  cin >> h >> w;
      |  ^~~
a.cc:5:2: error: 'string' was not declared in this scope
    5 |  string board[50];
      |  ^~~~~~
a.cc:7:37: error: 'board' was not declared in this scope
    7 |  for (int i = 0; i < h; ++i) cin >> board[i];
      |                                     ^~~~~
a.cc:14:6: error: 'board' was not declared in this scope
   14 |  if (board[i][j] == '#') continue;
      |      ^~~~~
a.cc:23:6: error: 'board' was not declared in this scope
   23 |  if (board[ni][nj] == '#') num++;
      |      ^~~~~
a.cc:26:2: error: 'board' was not declared in this scope
   26 |  board[i][j] = char(num + '#');
      |  ^~~~~
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;
      |                                                  ^~~~
Language: C++

#include <iostream>
#include <map>
#include <vector>
#include <math.h>
#include <string>

using namespace std;
int main() {
	int H,W;
	cin >> H >> W;

	string S[H];
	int ans[H + 2][W + 2];
	for(int i = 0;i < H;i++) {
		cin >> S[i];
	}

	for(int i = 0;i < H + 2;i++) {
		for(int j = 0;j < W + 2;j++) {
			ans[i][j] = 0;
		}
	}

	for(int i = 0;i < H;i++) {
		for(int j = 0;j < W;j++) {
			if (S[i][j] == '#') {
				ans[i-1][j-1]++;	
				ans[i-1][j]++;	
				ans[i-1][j+1]++;	
				ans[i][j-1]++;
				ans[i][j] = -1;
				ans[i][j+1]++;	
				ans[i+1][j-1]++;	
				ans[i+1][j]++;	
				ans[i+1][j=1]++;	
		}
	}
	for(int i = 1;i < H;i++) {
		for(int j = 1;j < W;j++) {
			if(ans[i][j] == -1) cout << "#";
			else cout << ans[i][j]
		}
		cout << endl;
	}



Compiler output:
a.cc: In function 'int main()':
a.cc:41:47: error: expected ';' before '}' token
   41 |                         else cout << ans[i][j]
      |                                               ^
      |                                               ;
   42 |                 }
      |                 ~                              
a.cc:44:10: error: expected '}' at end of input
   44 |         }
      |          ^
a.cc:24:34: note: to match this '{'
   24 |         for(int i = 0;i < H;i++) {
      |                                  ^
a.cc:44:10: error: expected '}' at end of input
   44 |         }
      |          ^
a.cc:8:12: note: to match this '{'
    8 | int main() {
      |            ^
Language: Java

public class Solution {
    public char[][] updateBoard(char[][] board, int[] click) {
        int m = board.length, n = board[0].length;
        int row = click[0], col = click[1];
        
        if (board[row][col] == 'M') { // Mine
            board[row][col] = 'X';
        }
        else { // Empty
            // Get number of mines first.
            int count = 0;
            for (int i = -1; i < 2; i++) {
                for (int j = -1; j < 2; j++) {
                    if (i == 0 && j == 0) continue;
                    int r = row + i, c = col + j;
                    if (r < 0 || r >= m || c < 0 || c < 0 || c >= n) continue;
                    if (board[r][c] == 'M' || board[r][c] == 'X') count++;
                }
            }
            
            if (count > 0) { // If it is not a 'B', stop further DFS.
                board[row][col] = (char)(count + '0');
            }
            else { // Continue DFS to adjacent cells.
                board[row][col] = 'B';
                for (int i = -1; i < 2; i++) {
                    for (int j = -1; j < 2; j++) {
                        if (i == 0 && j == 0) continue;
                        int r = row + i, c = col + j;
                        if (r < 0 || r >= m || c < 0 || c < 0 || c >= n) continue;
                        if (board[r][c] == 'E') updateBoard(board, new int[] {r, c});
                    }
                }
            }
        }
        
        return board;
    }
}

Compiler output:
Main.java:1: error: class Solution is public, should be declared in a file named Solution.java
public class Solution {
       ^
1 error
Language: Java

public class Solution {
    public char[][] updateBoard(char[][] board, int[] click) {
        int m = board.length, n = board[0].length;
        Queue<int[]> queue = new LinkedList<>();
        queue.add(click);

        while (!queue.isEmpty()) {
            int[] cell = queue.poll();
            int row = cell[0], col = cell[1];

            if (board[row][col] == 'M') { // Mine
                board[row][col] = 'X';
            }
            else { // Empty
                // Get number of mines first.
                int count = 0;
                for (int i = -1; i < 2; i++) {
                    for (int j = -1; j < 2; j++) {
                        if (i == 0 && j == 0) continue;
                        int r = row + i, c = col + j;
                        if (r < 0 || r >= m || c < 0 || c < 0 || c >= n) continue;
                        if (board[r][c] == 'M' || board[r][c] == 'X') count++;
                    }
                }

                if (count > 0) { // If it is not a 'B', stop further BFS.
                    board[row][col] = (char)(count + '0');
                }
                else { // Continue BFS to adjacent cells.
                    board[row][col] = 'B';
                    for (int i = -1; i < 2; i++) {
                        for (int j = -1; j < 2; j++) {
                            if (i == 0 && j == 0) continue;
                            int r = row + i, c = col + j;
                            if (r < 0 || r >= m || c < 0 || c < 0 || c >= n) continue;
                            if (board[r][c] == 'E') {
                                queue.add(new int[] {r, c});
                                board[r][c] = 'B'; // Avoid to be added again.
                            }
                        }
                    }
                }
            }
        }

        return board;
    }
}

Compiler output:
Main.java:1: error: class Solution is public, should be declared in a file named Solution.java
public class Solution {
       ^
Main.java:4: error: cannot find symbol
        Queue<int[]> queue = new LinkedList<>();
        ^
  symbol:   class Queue
  location: class Solution
Main.java:4: error: cannot find symbol
        Queue<int[]> queue = new LinkedList<>();
                                 ^
  symbol:   class LinkedList
  location: class Solution
3 errors
Language: C++

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

const int oo=-10;//优化：定义常量oo小于-8，给有雷的格子标注，这样的话无论下面怎样加也不会大于0
int n,m,a[52][52];
char c;

int main()
{
    cin>>n>>m;//读入
    for(int i=1;i<=n;i++)//从1开始，有0行0列作围墙
        for(int j=1;j<=m;j++)
        {
            cin>>c;//一个一个读入矩阵的各个字符
            if(c=='#')//如果有雷
            {
                a[i][j]=oo;//标注出雷格
                a[i-1][j-1]++;//以下八行给雷格的周围的所有格子的雷数加一
                a[i-1][j]++;
                a[i-1][j+1]++;
                a[i][j-1]++;
                a[i][j+1]++;
                a[i+1][j-1]++;
                a[i+1][j]++;
                a[i+1][j+1]++;
            }
        }
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
            if(a[i][j]<0)cout<<"#";//标注的用处：如果小于0就是有雷的格子
            else cout<<a[i][j];//否则输出雷数
        printf('\n')；//省去了死亡换行的困扰
    }   
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:16: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   34 |         printf('\n')；//省去了死亡换行的困扰
      |                ^~~~
      |                |
      |                char
In file included from /usr/include/c++/14/cstdio:42,
                 from /usr/include/c++/14/ext/string_conversions.h:45,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/stdio.h:363:43: note:   initializing argument 1 of 'int printf(const char*, ...)'
  363 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
a.cc:34:21: error: expected ';' before '\U0000ff1b'
   34 |         printf('\n')；//省去了死亡换行的困扰
      |                     ^~
      |                     ;
Language: C

#include<iostream>
using namespace std;  
   
int main()  
{  
    int a,b;  
    cin >> a >> b;  
    a--,b--;  
    printf("100 100\n");  
    for(int i=0;i<50;i++)  
    {  
        for(int j=0;j<100;j++)  
        {  
            if(i%2&&j%2&&a)  
            {  
                a--;  
                printf(".");  
            }  
            else printf("#");  
        }  
        printf("\n");  
    }  
    for(int i=50;i<100;i++)  
    {  
        for(int j=0;j<100;j++)  
        {  
            if(i%2&&j%2&&b)  
            {  
                b--;  
                printf("#");  
            }  
            else printf(".");  
        }  
        printf("\n");  
    }  int i=0;
    return 0;  
} 

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

#include<iostream>
using namespace std;  
   
int main()  
{  
    int a,b;  
    cin >> a >> b;  
    a--,b--;  
    
    for(int i=0;i<50;i++)  
    {  
        for(int j=0;j<100;j++)  
        {  
            if(i%2&&j%2&&a)  
            {  
                a--;  
                printf(".");  
            }  
            else printf("#");  
        }  
        printf("\n");  
    }  
    for(int i=50;i<100;i++)  
    {  
        for(int j=0;j<100;j++)  
        {  
            if(i%2&&j%2&&b)  
            {  
                b--;  
                printf("#");  
            }  
            else printf(".");  
        }  
        printf("\n");  
    }  int i=0;
    return 0;  
} 

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

#include <iostream>
using namespace std;

int main(){
  int h,w;
  cin >> h >> w;
  char f[50][50];
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin >> f[i][j];
    }
  }
  string ans;
  int count;
  int houkou[8][2]={
    {-1,-1},
    {-1,0},
    {-1,1},
    {0,-1},
    {0,1},
    {1,-1},
    {1,0},
    {1,1}
  };
  int x,y;
  for(int i=0;i<h;i++){
    ans="";
    for(int j=0;j<w;j++){
      if(f[i][j]=='.'){
        count = 0;
        for(int k=0;k<8;k++){
          x=i+houkou[k][0];
          y=j+houkou[k][1];
          if(x<0||x>h||y<0||y<w)
            x=i;
            y=j;
          }
          if(f[x][y]=='#'){
            count++;
          }
        }
        ans.push_back('0'+count);
      }else{
        ans.push_back('#');
      }
    }
    cout << ans << endl;
  }


  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:8: error: 'else' without a previous 'if'
   43 |       }else{
      |        ^~~~
a.cc: At global scope:
a.cc:51:3: error: expected unqualified-id before 'return'
   51 |   return 0;
      |   ^~~~~~
a.cc:52:1: error: expected declaration before '}' token
   52 | }
      | ^
Language: C

#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <cstdio>


int main()
{
    char s[51][51];
    int h,w,i,j,con,ans,k,l;
    ans=0;

    for(i=0; i<=50; i++)
    {
        for(j=i; j<=50; j++)
        {
            s[i][j]=s[j][i]='.';
        }
    }
    scanf("%d%d",&h,&w);
    getchar();
    ans++;

    if(ans!=1) printf("\n");
    for(i=1; i<=h; i++)
    {
        for(j=1; j<=w; j++)
        {
            scanf("%c",&s[i][j]);
        }
        getchar();
    }
    for(i=1; i<=h; i++)
    {
        for(j=1; j<=w; j++)
        {
            if(s[i][j]!='#')
            {
                con=0;
                for(k=-1; k<=1; k++)
                {
                    for(l=-1; l<=1; l++)
                    {
                        if(s[i+k][j+l]=='#')
                            con++;
                    }
                }
                s[i][j]='0'+con;
            }
        }
    }


    for(i=1; i<=h; i++)
    {
        for(j=1; j<=w; j++)
        {
            printf("%c",s[i][j]);
        }
        printf("\n");
    }

    return 0;
}


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 a,b;  
    cin >> a >> b;  
    a--,b--;  
    printf("100 100\n");  
    for(int i=0;i<50;i++)  
    {  
        for(int j=0;j<100;j++)  
        {  
            if(i%2&&j%2&&a)  
            {  
                a--;  
                printf(".");  
            }  
            else printf("#");  
        }  
        printf("\n");  
    }  
    for(int i=50;i<100;i++)  
    {  
        for(int j=0;j<100;j++)  
        {  
            if(i%2&&j%2&&b)  
            {  
                b--;  
                printf("#");  
            }  
            else printf(".");  
        }  
        printf("\n");  
    }  
    return 0;  
}  

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

#include<iostream>
#include<stdio.h>
#include<cstring>
using namespace std;
char map[55][55];
int mine[55][55];
int next[8][2]={{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
int n,m;
int search(int i,int j)
{
	int k,ans=0,x,y;
	for(k=0;k<8;k++)
	{
		x=i+next[k][0];
		y=j+next[k][1];
		if(x<0 || x>n || y<0 || y>m) continue;
		if(map[x][y]=='#') ans++;
	}
	return ans;
}
int main()
{
	int i,j;
	memset(mine,0,sizeof(mine));
	while(~scanf("%d%d",&n,&m))
	{
		for(i=0;i<n;i++)
		{
			scanf("%s",map[i]);
		}
		for(i=0;i<n;i++)
		{
			for(j=0;j<m;j++)
			{
				if(map[i][j]=='.') 
				{
					printf("%d",search(i,j));
				}
				else printf("#");
			}
			printf("\n");
		}
	}
	return 0;
} 

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

#include<iostream>
#include<stdio.h>
#include<cstring>
using namespace std;
char map[55][55];
int mine[55][55];
int next[8][2]={{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
int n,m;
int search(int i,int j)
{
	int k,ans=0,x,y;
	for(k=0;k<8;k++)
	{
		x=i+next[k][0];
		y=j+next[k][1];
		if(x<0 || x>n || y<0 || y>m) continue;
		if(map[x][y]=='#') ans++;
	}
	return ans;
}
int main()
{
	int i,j;
	memset(mine,0,sizeof(mine));
	while(~scanf("%d%d",&n,&m))
	{
		for(i=0;i<n;i++)
		{
			scanf("%s",map[i]);
		}
		for(i=0;i<n;i++)
		{
			for(j=0;j<m;j++)
			{
				if(map[i][j]=='.') 
				{
					printf("%d",search(i,j));
				}
				else printf("#");
			}
			printf("\n");
		}
	}
	return 0;
} 

Compiler output:
a.cc: In function 'int search(int, int)':
a.cc:14:21: error: reference to 'next' is ambiguous
   14 |                 x=i+next[k][0];
      |                     ^~~~
In file included from /usr/include/c++/14/string:47,
                 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_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:7:5: note:                 'int next [8][2]'
    7 | int next[8][2]={{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
      |     ^~~~
a.cc:15:21: error: reference to 'next' is ambiguous
   15 |                 y=j+next[k][1];
      |                     ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:7:5: note:                 'int next [8][2]'
    7 | int next[8][2]={{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
      |     ^~~~
Language: C

#include<cstdio>  
#include<cstring>  
  
int a[50][50];  
  
int main(void)  
{  
    int n, m, count = 1, i, j,ii,jj,k=0;  
    while (scanf("%d%d", &n, &m),n)  
{  
        getchar();  
        if (count > 1) putchar('\n');  
        char ch;  
        memset(a,0,sizeof(a));  
        for (i = 1; i <= n; i++)  
        {  
            for (j = 1; j <= m; j++)  
            {  
                scanf("%c", &ch);  
                if (ch == '#')  
                {   
                	k++;
                    a[i][j] = 11;///小技巧  
                    for (ii = i - 1; ii <= i + 1; ii++)  
                        for (jj = j - 1; jj <= j + 1; jj++)  
                            a[ii][jj]++;  
                }  
            }  
            getchar();  
        }  

        for (i = 1; i <= n; i++)  
        {  
            for (j = 1; j <= m; j++)  
            {  
                if (a[i][j] > 10) putchar('#');  
                else printf("%d", a[i][j]);  
            }  
            putchar('\n');  
        }  
        
		  if(k==n*m)    printf("\nIt is possible that there is no empty square.");  
		count++; 
  }
    return 0;  
}  



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

#include <stdio.h> 
#include<string.h>  
#include <algorithm>   
using namespace std;  
typedef long long lenlen;  
const int maxn=55;  
char mp[maxn][maxn];  
int f[maxn][maxn];  
int main(){  
    int h,w;  
    scanf("%d%d",&h,&w);  
    memset(f,0,sizeof(f));  
    for(int i=0;i<h;i++){  
        scanf("%s",mp[i]);  
    }  
    for(int i=0;i<h;i++){  
        for(int j=0;j<w;j++){  
            if(mp[i][j]=='#'){  
                if(i-1>=0){  
                    f[i-1][j]++;  
                }  
                if(j-1>=0){  
                    f[i][j-1]++;  
                }  
                if(i+1<h){  
                    f[i+1][j]++;  
                }  
                if(j+1<w){  
                    f[i][j+1]++;  
                }  
                if(i-1>=0&&j-1>=0){  
                    f[i-1][j-1]++;  
                }  
                if(i+1<h&&j-1>=0){  
                    f[i+1][j-1]++;  
                }  
                if(i-1>=0&&j+1<w){  
                    f[i-1][j+1]++;  
                }  
                if(i+1<h&&j+1<w){  
                    f[i+1][j+1]++;  
                }  
            }  
        }  
    }  
    for(int i=0;i<h;i++){  
        for(int j=0;j<w;j++){  
            if(mp[i][j]=='#') printf("#");  
            else printf("%d",f[i][j]);  
        }printf("\n");  
    }  
    return 0;  
}  

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

#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <cstdio>
using namespace std;


int main()
{
    char s[51][51];
    int h,w,i,j,cons,ans,k,l;
    ans=0;

    for(i=0; i<=50; i++)
    {
        for(j=i; j<=50; j++)
        {
            s[i][j]=s[j][i]='.';
        }
    }
    scanf("%d%d",&h,&w);
    getchar();
    ans++;

    if(ans!=1) printf("\n");
    for(i=1; i<=h; i++)
    {
        for(j=1; j<=w; j++)
        {
            scanf("%c",&s[i][j]);
        }
        getchar();
    }
    for(i=1; i<=h; i++)
            if(s[i][j]!='#')
            {
                cons=0;
                for(k=-1; k<=1; k++)
                {
                    for(l=-1; l<=1; l++)
                    {
                        if(s[i+k][j+l]=='#')
                            cons++;
                    }
                }
                s[i][j]='0'+cons;
            }
        }
    }
    for(i=1; i<=h; i++)
    {
        for(j=1; j<=w; j++)
        {
            printf("%c",s[i][j]);
        }
        printf("\n");
    }

    return 0;
}  {
        for(j=1; j<=w; j++)
        {
            if(s[i][j]!='#')
            {
                cons=0;
                for(k=-1; k<=1; k++)
                {
                    for(l=-1; l<=1; l++)
                    {
                        if(s[i+k][j+l]=='#')
                            cons++;
                    }
                }
                s[i][j]='0'+cons;
            }
        }
    }
    for(i=1; i<=h; i++)
    {
        for(j=1; j<=w; j++)
        {
            printf("%c",s[i][j]);
        }
        printf("\n");
    }

    return 0;
}

Compiler output:
a.cc:50:5: error: expected declaration before '}' token
   50 |     }
      |     ^
a.cc:51:5: error: expected unqualified-id before 'for'
   51 |     for(i=1; i<=h; i++)
      |     ^~~
a.cc:51:14: error: 'i' does not name a type
   51 |     for(i=1; i<=h; i++)
      |              ^
a.cc:51:20: error: 'i' does not name a type
   51 |     for(i=1; i<=h; i++)
      |                    ^
a.cc:60:5: error: expected unqualified-id before 'return'
   60 |     return 0;
      |     ^~~~~~
a.cc:61:1: error: expected declaration before '}' token
   61 | }  {
      | ^
a.cc:61:4: error: expected unqualified-id before '{' token
   61 | }  {
      |    ^
a.cc:79:5: error: expected unqualified-id before 'for'
   79 |     for(i=1; i<=h; i++)
      |     ^~~
a.cc:79:14: error: 'i' does not name a type
   79 |     for(i=1; i<=h; i++)
      |              ^
a.cc:79:20: error: 'i' does not name a type
   79 |     for(i=1; i<=h; i++)
      |                    ^
a.cc:88:5: error: expected unqualified-id before 'return'
   88 |     return 0;
      |     ^~~~~~
a.cc:89:1: error: expected declaration before '}' token
   89 | }
      | ^
Language: C

#include <map>  
#include <stdio.h>
#include <set>  
#include <string>  
#include<string.h>  
#include <cstring>  
#include <cstdio>  
#include <algorithm>  
#include <cmath>  
#include <queue>  
#include <vector>  
using namespace std;  
typedef long long lenlen;  
const int maxn=55;  
char mp[maxn][maxn];  
int f[maxn][maxn];  
int main(){  
    int h,w;  
    scanf("%d%d",&h,&w);  
    memset(f,0,sizeof(f));  
    for(int i=0;i<h;i++){  
        scanf("%s",mp[i]);  
    }  
    for(int i=0;i<h;i++){  
        for(int j=0;j<w;j++){  
            if(mp[i][j]=='#'){  
                if(i-1>=0){  
                    f[i-1][j]++;  
                }  
                if(j-1>=0){  
                    f[i][j-1]++;  
                }  
                if(i+1<h){  
                    f[i+1][j]++;  
                }  
                if(j+1<w){  
                    f[i][j+1]++;  
                }  
                if(i-1>=0&&j-1>=0){  
                    f[i-1][j-1]++;  
                }  
                if(i+1<h&&j-1>=0){  
                    f[i+1][j-1]++;  
                }  
                if(i-1>=0&&j+1<w){  
                    f[i-1][j+1]++;  
                }  
                if(i+1<h&&j+1<w){  
                    f[i+1][j+1]++;  
                }  
            }  
        }  
    }  
    for(int i=0;i<h;i++){  
        for(int j=0;j<w;j++){  
            if(mp[i][j]=='#') printf("#");  
            else printf("%d",f[i][j]);  
        }printf("\n");  
    }  
    return 0;  
}  

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

#include <cstdio>  
#include <map>  
#include <set>  
#include <string>  
#include<string.h>  
#include <cstring>  
#include <cstdio>  
#include <algorithm>  
#include <cmath>  
#include <queue>  
#include <vector>  
using namespace std;  
typedef long long lenlen;  
const int maxn=55;  
char mp[maxn][maxn];  
int f[maxn][maxn];  
int main(){  
    int h,w;  
    scanf("%d%d",&h,&w);  
    memset(f,0,sizeof(f));  
    for(int i=0;i<h;i++){  
        scanf("%s",mp[i]);  
    }  
    for(int i=0;i<h;i++){  
        for(int j=0;j<w;j++){  
            if(mp[i][j]=='#'){  
                if(i-1>=0){  
                    f[i-1][j]++;  
                }  
                if(j-1>=0){  
                    f[i][j-1]++;  
                }  
                if(i+1<h){  
                    f[i+1][j]++;  
                }  
                if(j+1<w){  
                    f[i][j+1]++;  
                }  
                if(i-1>=0&&j-1>=0){  
                    f[i-1][j-1]++;  
                }  
                if(i+1<h&&j-1>=0){  
                    f[i+1][j-1]++;  
                }  
                if(i-1>=0&&j+1<w){  
                    f[i-1][j+1]++;  
                }  
                if(i+1<h&&j+1<w){  
                    f[i+1][j+1]++;  
                }  
            }  
        }  
    }  
    for(int i=0;i<h;i++){  
        for(int j=0;j<w;j++){  
            if(mp[i][j]=='#') printf("#");  
            else printf("%d",f[i][j]);  
        }printf("\n");  
    }  
    return 0;  
}  

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

#include <iostream>  
#include <map>  
#include <set>  
#include <string>  
#include<string.h>  
#include <cstring>  
#include <cstdio>  
#include <algorithm>  
#include <cmath>  
#include <queue>  
#include <vector>  
using namespace std;  
typedef long long lenlen;  
const int maxn=55;  
char map[maxn][maxn];  
int f[maxn][maxn];  
int main(){  
    int h,w;  
    scanf("%d%d",&h,&w);  
    memset(f,0,sizeof(f));  
    for(int i=0;i<h;i++){  
        scanf("%s",map[i]);  
    }  
    for(int i=0;i<h;i++){  
        for(int j=0;j<w;j++){  
            if(map[i][j]=='#'){  
                if(i-1>=0){  
                    f[i-1][j]++;  
                }  
                if(j-1>=0){  
                    f[i][j-1]++;  
                }  
                if(i+1<h){  
                    f[i+1][j]++;  
                }  
                if(j+1<w){  
                    f[i][j+1]++;  
                }  
                if(i-1>=0&&j-1>=0){  
                    f[i-1][j-1]++;  
                }  
                if(i+1<h&&j-1>=0){  
                    f[i+1][j-1]++;  
                }  
                if(i-1>=0&&j+1<w){  
                    f[i-1][j+1]++;  
                }  
                if(i+1<h&&j+1<w){  
                    f[i+1][j+1]++;  
                }  
            }  
        }  
    }  
    for(int i=0;i<h;i++){  
        for(int j=0;j<w;j++){  
            if(map[i][j]=='#') printf("#");  
            else printf("%d",f[i][j]);  
        }printf("\n");  
    }  
    return 0;  
}  

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

#include <iostream>  
#include <map>  
#include <set>  
#include <string>  
#include<string.h>  
#include <cstring>  
#include <cstdio>  
#include <algorithm>  
#include <cmath>  
#include <queue>  
#include <vector>  
using namespace std;  
typedef long long lenlen;  
const int maxn=55;  
char map[maxn][maxn];  
int f[maxn][maxn];  
int main(){  
    int h,w;  
    scanf("%d%d",&h,&w);  
    memset(f,0,sizeof(f));  
    for(int i=0;i<h;i++){  
        scanf("%s",map[i]);  
    }  
    for(int i=0;i<h;i++){  
        for(int j=0;j<w;j++){  
            if(map[i][j]=='#'){  
                if(i-1>=0){  
                    f[i-1][j]++;  
                }  
                if(j-1>=0){  
                    f[i][j-1]++;  
                }  
                if(i+1<h){  
                    f[i+1][j]++;  
                }  
                if(j+1<w){  
                    f[i][j+1]++;  
                }  
                if(i-1>=0&&j-1>=0){  
                    f[i-1][j-1]++;  
                }  
                if(i+1<h&&j-1>=0){  
                    f[i+1][j-1]++;  
                }  
                if(i-1>=0&&j+1<w){  
                    f[i-1][j+1]++;  
                }  
                if(i+1<h&&j+1<w){  
                    f[i+1][j+1]++;  
                }  
            }  
        }  
    }  
    for(int i=0;i<h;i++){  
        for(int j=0;j<w;j++){  
            if(map[i][j]=='#') printf("#");  
            else printf("%d",f[i][j]);  
        }printf("\n");  
    }  
    return 0;  
}  

Compiler output:
a.cc: In function 'int main()':
a.cc:22:20: error: reference to 'map' is ambiguous
   22 |         scanf("%s",map[i]);
      |                    ^~~
In file included from /usr/include/c++/14/map:63,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
  102 |     class map
      |           ^~~
a.cc:15:6: note:                 'char map [55][55]'
   15 | char map[maxn][maxn];
      |      ^~~
a.cc:26:16: error: reference to 'map' is ambiguous
   26 |             if(map[i][j]=='#'){
      |                ^~~
/usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
  102 |     class map
      |           ^~~
a.cc:15:6: note:                 'char map [55][55]'
   15 | char map[maxn][maxn];
      |      ^~~
a.cc:56:16: error: reference to 'map' is ambiguous
   56 |             if(map[i][j]=='#') printf("#");
      |                ^~~
/usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
  102 |     class map
      |           ^~~
a.cc:15:6: note:                 'char map [55][55]'
   15 | char map[maxn][maxn];
      |      ^~~
Language: C

#include <iostream>
#include<stdio.h>
using namespace std;
int main()
{
    char a[52][52];
    int i,j;
        for(i=0;i<55;i++)
        {
            for(j=i;j<55;j++)
            {
                 a[i][j]=a[j][i]='.';
            }
        }
    int h,w;
    while(cin>>h>>w)
    {
            for(i=1;i<=h;i++)
    {
            for(j=1;j<=w;j++)
                {cin>>a[i][j];}
    }
    int sum,m,n;
    for(i=1;i<=h;i++)
    {
        for(j=1;j<=w;j++)
        {
                if(a[i][j]!='#')
                {
                    sum=0;
                    if(a[i-1][j-1]=='#')sum++;
                    if(a[i-1][j]=='#')sum++;
                    if(a[i-1][j+1]=='#')sum++;
                    if(a[i][j-1]=='#')sum++;
                    if(a[i][j+1]=='#')sum++;
                    if(a[i+1][j-1]=='#')sum++;
                    if(a[i+1][j]=='#')sum++;
                    if(a[i+1][j+1]=='#')sum++;
                    a[i][j]='0'+sum;
                }
        }
    }
    cout<<endl;
    for(i=1;i<=h;i++)
    {
        for(j=1;j<=w;j++)
                cout<<a[i][j];
        cout<<endl;
    }
    }
}


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

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<set>
using namespace std;
typedef long long LL;
const int INF=0x3f3f3f3f;
const int MAXN=1e5+5;
int a[MAXN];
int G[105][105];

int main()
{
    int h,w;
    while(scanf("%d%d",&h,&w)!=EOF)
    {
        int n;
        scanf("%d",&n);
        for(int i=1;i<=n;++i)
            scanf("%d",&a[i]);
        int cnt=1;
        for(int i=1;i<=h;++i)
        {
            if(i&1)
            {
                for(int j=1;j<=w;++j)
                {
                   if(a[cnt]>0) {G[i][j]=cnt;--a[cnt];}
                   else if(a[cnt]==0) {++cnt;G[i][j]=cnt;--a[cnt];}
                }
            }else
            {
                for(int j=w;j>=1;--j)
                {
                    if(a[cnt]>0) {G[i][j]=cnt;--a[cnt];}
                    else if(a[cnt]==0) {++cnt;G[i][j]=cnt;--a[cnt];}
                }
            }
        }
        for(int i=1;i<=h;++i)
        {
            for(int j=1;j<=w;++j)
            {
                if(j!=w) printf("%d ",G[i][j]);
                else printf("%d\n",G[i][j]);
            }
        }
    }
    return 0;
}

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

#include<iostream>  
  
using namespace std;  
  
  
int coordinate[8][2] = {-1,0, -1,1, 0,1, 1,1, 1,0, 1,-1, 0,-1, -1,-1};  
  
int count(int x, int y, int a[100][100], int row, int column);  
int main()  
{  
    int number = 0;            
    int row = 1;                
    int column = 1;            
    int mineSweeper[100][100];  
    char symbol = '.';          
  
    while (cin >> row >> column)  
    {  
        if ((row == 0) || (column == 0)) 
        {  
            break;  
        }  
  
      
        for (int i=0; i<100; i++)  
        {  
            for (int j=0; j<100; j++)  
            {  
                mineSweeper[i][j] = -1;  
            }  
        }  
  
       
        for (int i=0; i<row; i++)  
        {  
            for (int j=0; j<column; j++)  
            {  
                cin >> symbol; 
  
                if (symbol == '.')    
                {  
                    mineSweeper[i][j] = 0;    
                }  
            }  
        }  
  
        if (number > 0) /  
        {  
            cout << endl;  
        }  
        number++;  
  
        
        for (int i=0; i<row; i++)  
        {  
            for (int j=0; j<column; j++)  
            {  
                if (mineSweeper[i][j] == -1)   
                {  
                    cout << '#';  
                }  
                else  
                {  
                    cout << count(i, j, mineSweeper, row, column);  
                }  
            }  
  
            cout << endl;  
        }  
    }  
  
    return 0;  
}  
  
int count(int x, int y, int a[100][100], int row, int column)  
{  
    int num = 0;    
    int xc = 0;   
    int yc = 0;     
  
    
    for (int i=0; i<8; i++)  
    {  
        xc = x + coordinate[i][0];  
        yc = y + coordinate[i][1];  
  
        
        if ((xc >= 0) && (xc < row) && (yc >= 0) && (yc < column))  
        {  
            if (a[xc][yc] == -1)  
            {  
                num ++;   
            }  
        }  
    }  
  
    return num;  
}  

Compiler output:
a.cc: In function 'int main()':
a.cc:47:25: error: expected primary-expression before '/' token
   47 |         if (number > 0) /
      |                         ^
a.cc:48:9: error: expected primary-expression before '{' token
   48 |         {
      |         ^
Language: C

include<cstdio>  
#include<cstring>  
  
int a[120][120];  
  
int main(void)  
{  
    int n, m, count = 1, i, j,ii,jj;  
    while (scanf("%d%d", &n, &m),n)  
    {  
        getchar();  
        if (count > 1) putchar('\n');  
        char ch;  
        memset(a,0,sizeof(a));  
        for (i = 1; i <= n; i++)  
        {  
            for (j = 1; j <= m; j++)  
            {  
                scanf("%c", &ch);  
                if (ch == '*')  
                {  
                    a[i][j] = 11;///小技巧  
                    for (ii = i - 1; ii <= i + 1; ii++)  
                        for (jj = j - 1; jj <= j + 1; jj++)  
                            a[ii][jj]++;  
                }  
            }  
            getchar();  
        }  
        
        for (i = 1; i <= n; i++)  
        {  
            for (j = 1; j <= m; j++)  
            {  
                if (a[i][j] > 10) putchar('*');  
                else printf("%d", a[i][j]);  
            }  
            putchar('\n');  
        }  
         
    }  
    return 0;  
}  

Compiler output:
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include<cstdio>
      |        ^
main.c:2:9: fatal error: cstring: No such file or directory
    2 | #include<cstring>
      |         ^~~~~~~~~
compilation terminated.
Language: C++

#include "iostream"
#include "algorithm"
#include "vector"
using namespace std;

const int SIZE = 50;

string board[SIZE];
bool vis[SIZE][SIZE];

char toChar(int b) {
    char u;
    char buffer[65];
    _itoa( b, buffer, 10); //正确解法一
      u = buffer[0];
    return u;
}

void dfs(int i,int j)
{
    int cnt=0;
    if(vis[i][j])
        return;
    if(board[i][j]=='.')
    {
        if(i>0&&j>0&&board[i-1][j-1]=='#')
            ++cnt;
        if(i>0&&board[i-1][j]=='#')
            ++cnt;
        if(i>0&&board[i-1][j+1]=='#')
            ++cnt;
        if(j>0&&board[i][j-1]=='#')
            ++cnt;
        if(board[i][j+1]=='#')
            ++cnt;
        if(j>0&&board[i+1][j-1]=='#')
            ++cnt;
        if(board[i+1][j]=='#')
            ++cnt;
        if(board[i+1][j+1]=='#')
            ++cnt;
        board[i][j]=toChar(cnt);
    }
    vis[i][j] = true;
}


int main()
{
    int H,W;
    int i,j;
    cin>>H>>W;
    for(i=0;i<H;++i)
        cin>>board[i];
    for(i=0; i<H; ++i)
    {
        for(j=0; j<W; ++j)
        {
            if(vis[i][j]==true)
                continue;
            dfs(i,j);
        }
    }
    for(i=0; i<H; ++i)
        cout<<board[i]<<endl;


}



Compiler output:
a.cc: In function 'char toChar(int)':
a.cc:14:5: error: '_itoa' was not declared in this scope
   14 |     _itoa( b, buffer, 10); //正确解法一
      |     ^~~~~
Language: C++

#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include<fstream>
#include<conio.h>
using namespace std;

int MAXint(int a, int b)
{
    if(a >= b)return a;
    else return b;
}

int MINint(int a, int b)
{
    if(a>=b)return b;
    else return a;
}


int main()
{
    int H, W;
    int i, j, bombnum;
    int i0, j0;
    cin>> H >> W;
    char tempc;
    string temp;
    vector <string> grid;
    for(i=0; i<H; ++i)
    {
        cin>> temp;
        grid.push_back(temp);
    }

    for(i=0; i<H; ++i)
    {
        for(j=0; j<W; ++j)
        {
            if(grid[i][j] == '#')continue;
            else
            {
                bombnum = 0;
                for(i0=MAXint(0, i-1); i0<MINint(i+2, H); ++i0)
                {
                    for(j0=MAXint(0, j-1); j0<MINint(j+2, W); ++j0)
                    {
                        if(grid[i0][j0] == '#') ++bombnum;
                    }
                }
                tempc = bombnum + 48;
                grid[i][j] = tempc;

            }
        }
    }

    for(i=0; i<H; ++i)
    {

        cout<< grid[i] << endl;

    }





    return 0;
}












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

#include<iostream>
#include<string>
using namespace std;
int main()
{
	int m,n,i,j,sum,t,t2;
	cin>>m;
	cin>>n;
	int a[m][n];
	char x;
	for(i=0;i<m;i++)
	{
		for(j=0;j<n;j++)
		{
			x=getchar();
			if(x=='\n') x=getchar();
			if(x=='.') a[i][j]=0;
			if(x=='#') a[i][j]=-233;
		}
	}
	if(a[0][0]<0)
	{                                  //左上方的角 
        a[1][0]++;a[1][1]++;a[0][1]++;
    }
    if(a[0][m-1]<0)
	{                                //右上方的角 
        a[1][m-2]++;a[0][m-2]++;a[1][m-1]++;
    }
    if(a[n-1][0]<0)
	{                                //左下方... 
        a[n-2][0]++;a[n-2][1]++;a[n-1][1]++;
    }
    if(a[n-1][m-1]<0)
	{                              //右下方... 
        a[n-2][m-1]++;a[n-2][m-2]++;a[n-1][m-1]++;
    }
         
    for(i=1;i<(n-1);i++)
	{                            
        if(a[i][0]<0)
		{                              //左边线
            for(t=-1;t<2;t++)a[i+t][0]++;
            if(m>1) for(t=-1;t<2;t++) a[i+t][1]++;
        }
        if(a[i][m-1]<0)
		{                            //右边线 
            for(t=-1;t<2;t++)a[i+t][m-1]++;
            if(m>1) for(t=-1;t<2;t++) a[i+t][m-2]++;
        }
    }
         
    for(j=1;j<(m-1);j++)
	{                              
        if(a[0][j]<0)
		{                              //上边线 
            for(t=-1;t<2;t++) a[0][j+t]++;
            if(n>1) for(t=-1;t<2;t++) a[1][j+t]++;
        }
        if(a[n-1][j]<0)
		{                            //下边线 
            for(t=-1;t<2;t++) a[n-1][j+t]++;
            if(n>1) for(t=-1;t<2;t++) a[n-2][j+t]++;
        }
    }
     
        for(i=1;i<(n-1);i++){                           //边线以内的区域 
            for(j=1;j<(m-1);j++){
                if(a[i][j]<0){
                    for(t=-1;t<2;t++) for(t2=-1;t2<2;t2++) a[i+t][j+t2]++;
                }
            }
        }
         
        for(i=0;i<n;i++){                               //输出结果，如果数字为负值则输出*（表示有雷） 
            for(j=0;j<m;j++){
                if(a[i][j]<0) cout<<"#";
                else cout<<a[i][j];
            }
            cout<<endl;
        }
	return 0;
		
} 

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

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<stdio.h>
using namespace std;

int main()
{
    int h,w,i,j,sum;
    char a[55][55];
    for(i=0;i<55;i++)
    {
        for(j=0;j<55;j++)
            a[i][j]='0';
    }
    cin>>h;cin>>w;
    for(i=1;i<=h;++i)
    {
        for(j=1;j<=w;++j)
        {
            cin>>a[i][j];
        }
        getchar();
    }
    for(i=1;i<=h;++i)
    {
        for(j=1;j<=w;++j)
        {
            sum=0;
            if(a[i][j]=='#'){cout<<"#";continue;}
            else
            {
                if(a[i-1][j-1]=='#')sum++;
                if(a[i-1][j]=='#')sum++;
                if(a[i-1][j+1]=='#')sum++;
                if(a[i][j-1]=='#')sum++;
                if(a[i][j+1]=='#')sum++;
                if(a[i+1][j-1]=='#')sum++;
                if(a[i+1][j]=='#')sum++;
                if(a[i+1][j+1]=='#')sum++;
            }
            cout<<sum;
        }
        cout<<endl;
    }
    return 0;
}


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

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

int h,w;
char s[55][55]={'-1'};
int map[55][55]={0};
int main()
{
	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]=='#')
		{
			if(s[i-1][j-1]=='.') map[i-1][j-1]++;
			if(s[i-1][j]=='.') map[i-1][j]++;
			if(s[i-1][j+1]=='.') map[i-1][j+1]++;
			if(s[i][j-1]=='.') map[i][j-1]++;
			if(s[i][j+1]=='.') map[i][j+1]++;
			if(s[i+1][j-1]=='.') map[i+1][j-1]++;
			if(s[i+1][j]=='.') map[i+1][j]++;
			if(s[i+1][j+1]=='.') map[i+1][j+1]++;
		}
	}
	for(int i=1;i<=h;i++)
	{
		for(int j=1;j<=w;j++)
		{
			if(s[i][j]=='.') cout<<map[i][j];
			if(s[i][j]=='#') cout<<s[i][j];
		}
		cout<<endl;
	} 
	return 0;
 } 

Compiler output:
a.cc:6:17: warning: multi-character character constant [-Wmultichar]
    6 | char s[55][55]={'-1'};
      |                 ^~~~
a.cc:6:17: error: narrowing conversion of '11569' from 'int' to 'char' [-Wnarrowing]
Language: C++

#include <iostream>
#include <string>

using namespace std;

int main(){
	int H, W;
	cin >> H >> W;
	string T[50];
	const int dx[8] = {1,0,-1,0,1,-1,-1,1};
	const int dy[8] = {0,1,0,-1,1,1,-1,-1};
	for(int i=0; i<H; ++i){
		cin >> T[i];
	}
	for(int i=0; i<H; ++i){
		for(int j=0; j<W; ++j){
			int count = 0;
			if(T[i][j]=="."){
				for(int n=0; n<8; ++n){
					const int ni = i + dy[n];
					const int nj = j + dx[n];
					if(ni<0 or H<=ni) continue;
					if(nj<0 or W<=nj) continue;
					if(T[ni][nj] == "#") count++;
				}
				T[i][j]=char(count+0);
			}else{
				T[i][j]="#";
			}
		}
	}
	for (int i=0; i<H; ++i) cout << T[i] << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:35: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   18 |                         if(T[i][j]=="."){
a.cc:24:54: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   24 |                                         if(T[ni][nj] == "#") count++;
a.cc:28:41: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive]
   28 |                                 T[i][j]="#";
      |                                         ^~~
      |                                         |
      |                                         const char*