criyle/codenet-compile-errors huggingface dataset:
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(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:12:13: error: 'i' was not declared in this scope
   12 |         for(i=0; i<H; ++i){
      |             ^
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:26:54: error: expected ';' before '}' token
   26 |                                 T[i][j]=char(count+0)
      |                                                      ^
      |                                                      ;
   27 |                         }else{
      |                         ~                             
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*
a.cc:28:44: error: expected ';' before '}' token
   28 |                                 T[i][j]="#"
      |                                            ^
      |                                            ;
   29 |                         }
      |                         ~
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(i=0; i<H; ++i){
		cin >> T[i];
	}
	for(i=0; i<H; ++i){
		for(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:11:9: error: expected ',' or ';' before 'const'
   11 |         const int dy[8] = {0,1,0,-1,1,1,-1,-1}
      |         ^~~~~
a.cc:12:13: error: 'i' was not declared in this scope
   12 |         for(i=0; i<H; ++i){
      |             ^
a.cc:15:13: error: 'i' was not declared in this scope
   15 |         for(i=0; i<H; ++i){
      |             ^
a.cc:16:21: error: 'j' was not declared in this scope
   16 |                 for(j=0; j<W; ++j){
      |                     ^
a.cc:20:60: error: 'dy' was not declared in this scope; did you mean 'dx'?
   20 |                                         const int ni = i + dy[n];
      |                                                            ^~
      |                                                            dx
a.cc:24:54: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   24 |                                         if(T[ni][nj] == "#") count++;
Language: C++

#include <bits/stdc++.h>
using namespace std;
int ans[50][50];
int main()
{
    int H,W;cin >> H >> W;
    vector<string> ma;
    string str;
    for(int a = 0;a < H;a++){
        cin >> str;
        ma.push_back(str);
    }
    for(int a = 0;a < H;a++){
        string s = ma.at(a);
        for(int b = 0;b < W;b++){
            if(s.at(b)=='#'){
                ans[a][b]+=10000;
                if(a!=0){
                    ans[a-1][b]++;
                }
                if(a!=H-1){
                    ans[a+1][b]++;
                }
                if(b!=0){
                    ans[a][b-1]++;
                }
                if(b!=W-1){
                    ans[a][b+1]++;
                }
                if(a!=0&&b!=0){
                    ans[a-1][b-1]++;
                }
                if(a!=0&&b!=W-1){
                    ans[a-1][b+1]++;
                }
                if(a!=H-1&&b!=0){
                    ans[a+1][b-1]++;
                }
                if(a!=H-1&&b!=W-1){
                    ans[a+1][b+1]++;
                }
        }
    }
    for(int a = 0;a < H;a++){
        for(int b = 0;b < W;b++){
            if(ans[a][b]>=1000){
                cout<<"#";
            }else{
                cout<<ans[a][b];
            }

        }
        cout<<endl;
    }
    return 0;
}


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

#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) (x=min(x,y))
#define chmax(x,y) (x=max(x,y))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

string s[100];

int main(){
	rep(i, h) cin>>s[i];
	rep(i, h) rep(j, w){
		if(s[i][j]=='#') continue;
		int cnt = 0;
		rep(i2, 3) rep(j2, 3){
			int ii = i+i2-1, jj = j+j2-1;
			if(ii<0||ii>=h||jj<0||jj>=w) continue;
			cnt += s[i][j]=='#';
		}
		s[i][j] = '0'+cnt;
	}
	rep(i, h) cout<<s[i]<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:16: error: 'h' was not declared in this scope
   44 |         rep(i, h) cin>>s[i];
      |                ^
a.cc:28:41: note: in definition of macro 'rep'
   28 | #define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
      |                                         ^
a.cc:45:16: error: 'h' was not declared in this scope
   45 |         rep(i, h) rep(j, w){
      |                ^
a.cc:28:41: note: in definition of macro 'rep'
   28 | #define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
      |                                         ^
a.cc:45:26: error: 'w' was not declared in this scope
   45 |         rep(i, h) rep(j, w){
      |                          ^
a.cc:28:41: note: in definition of macro 'rep'
   28 | #define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
      |                                         ^
a.cc:55:16: error: 'h' was not declared in this scope
   55 |         rep(i, h) cout<<s[i]<<endl;
      |                ^
a.cc:28:41: note: in definition of macro 'rep'
   28 | #define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
      |                                         ^
Language: C++

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

Compiler output:
a.cc:1:9: error: expected unqualified-id before 'for'
    1 |         for (int i = 0; i < H; i++)
      |         ^~~
a.cc:1:25: error: 'i' does not name a type
    1 |         for (int i = 0; i < H; i++)
      |                         ^
a.cc:1:32: error: 'i' does not name a type
    1 |         for (int i = 0; i < H; i++)
      |                                ^
Language: C

#include <stdio.h>

int main(void){
  int s, w, sum; 
  scanf("%d %d", &s, &w);
  char c[s][w];
  for(int i = 0; i < s; i++){
    scanf("%s", c[i]);
  }

  for(i = 0; i < s; i++){
    for(int j=0; j < w; j++){
      sum = 0;
      if(c[i][j] == '#') putchar('#');
      else{
	for(int d = -1; d <= 1; d++){
	  for(int e = -1; e <= 1; e++){
	    if(c[i+e][j+d] == '#'){
	      sum++;
	    }
	  }
	}	
	printf("%d", sum);
      }
    }
    putchar('\n');
  }
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:11:7: error: 'i' undeclared (first use in this function)
   11 |   for(i = 0; i < s; i++){
      |       ^
main.c:11:7: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

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

int main() {
  string bord[50];
  int h,w;
  int dx[]={1,1,0,-1,-1,-1,0,1};
  int dy[]={0,1,1,1,0,-1,-1,-1};

  cin>>h>>w;

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

  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(bord[i][j]=='.'){
        int cnt=0;
        for(int k=0;k<8;k++){
          int x=i;dx[k];
          int y=i+dy[k];
          if(x>=0;&&x<h&&y>=0&&y<w&&bord[x][y]=='#') cont++
        }
        bord[i][j]='0'+cont;
      }
    }
  }
  for(int i=0;i<h;i++) cout<<bord[i]<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:22: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   22 |           if(x>=0;&&x<h&&y>=0&&y<w&&bord[x][y]=='#') cont++
      |                   ~~~^~
a.cc:22:54: error: 'cont' was not declared in this scope; did you mean 'cnt'?
   22 |           if(x>=0;&&x<h&&y>=0&&y<w&&bord[x][y]=='#') cont++
      |                                                      ^~~~
      |                                                      cnt
a.cc:24:24: error: 'cont' was not declared in this scope; did you mean 'cnt'?
   24 |         bord[i][j]='0'+cont;
      |                        ^~~~
      |                        cnt
a.cc:22:21: error: label 'x' used but not defined
   22 |           if(x>=0;&&x<h&&y>=0&&y<w&&bord[x][y]=='#') cont++
      |                     ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
char a;
int c[111][111]={0};
int h,w;
int test;
int n;
cin >> h >> w;
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
cin >> a;
if(a=='#'){
c[h][w]=11111;
c[max(0,i-1)][j]++;
c[max(0,i+1)][j]++;
c[i][max(0,j-1)]++;
c[i][max(0,j-1)]++;
}
}

for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if(c[i][j]==11111)cout << '#';
else cout << c[i][j];
}
cout << endl;
}
}


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

3 5
#####
#####
#####

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:1: error: stray '##' in program
    3 | #####
      | ^~
a.cc:3:3: error: stray '##' in program
    3 | #####
      |   ^~
a.cc:3:5: error: stray '#' in program
    3 | #####
      |     ^
a.cc:4:1: error: stray '##' in program
    4 | #####
      | ^~
a.cc:4:3: error: stray '##' in program
    4 | #####
      |   ^~
a.cc:4:5: error: stray '#' in program
    4 | #####
      |     ^
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 3 5
      | ^
Language: C++

#include <stdio.h>

int main(int argc, const char * argv[]) {
    
    int cols,rows;
    int count_bom=0;
    
    scanf("%d",&rows);
    scanf("%d",&cols);
    
    char c[cols*rows];
    char c_copy[cols*rows];
    
    for (int i = 0; i < rows; ++i) cin >> c[i];
    
    scanf("%s",c);
    
    *c_copy = *c;
    
    for(int y=0;y<rows;y++){
        for(int x=0;x<cols;x++){
            
            if(c[y*cols+x] == '#')
            {
                c_copy[y*cols+x] = '#';
            }
            else
            {
            
                for(int s_y=y-1;s_y<y+1;s_y++){
                    for(int s_x=x-1;s_x<x+1;s_x++){
                    
                        if(s_y < 0 || s_x < 0 || s_y > rows-1 || s_x > cols-1)
                        {
                            
                        }else
                        {
                            if(c[s_y*cols+s_x] == '#')
                            {
                                count_bom ++;
                            }
                        }
                    
                    }
                }
            
                c_copy[y*cols+x] = count_bom;
                count_bom = 0;
                
            }
        }
    }
    
 
    
    return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:14:36: error: 'cin' was not declared in this scope
   14 |     for (int i = 0; i < rows; ++i) cin >> c[i];
      |                                    ^~~
Language: C++

    int cols,rows;
    int count_bom=0;
    
    scanf("%d",&rows);
    scanf("%d",&cols);
    
    char c[cols*rows];
    char c_copy[cols*rows];

    scanf("%s",c);
    
    *c_copy = *c;
    
    for(int y=0;y<rows;y++){
        for(int x=0;x<cols;x++){
            
            if(c[y*cols+x] == '#')
            {
                c_copy[y*cols+x] = '#';
            }
            else
            {
            
                for(int s_y=y-1;s_y<y+1;s_y++){
                    for(int s_x=x-1;s_x<x+1;s_x++){
                    
                        if(s_y < 0 || s_x < 0 || s_y > rows-1 || s_x > cols-1)
                        {
                            
                        }else
                        {
                            if(c[s_y*cols+s_x] == '#')
                            {
                                count_bom ++;
                            }
                        }
                    
                    }
                }
            
                c_copy[y*cols+x] = count_bom;
                count_bom = 0;
                
            }
        }
    }


Compiler output:
a.cc:4:10: error: expected constructor, destructor, or type conversion before '(' token
    4 |     scanf("%d",&rows);
      |          ^
a.cc:5:10: error: expected constructor, destructor, or type conversion before '(' token
    5 |     scanf("%d",&cols);
      |          ^
a.cc:7:16: error: size of array 'c' is not an integral constant-expression
    7 |     char c[cols*rows];
      |            ~~~~^~~~~
a.cc:8:21: error: size of array 'c_copy' is not an integral constant-expression
    8 |     char c_copy[cols*rows];
      |                 ~~~~^~~~~
a.cc:10:10: error: expected constructor, destructor, or type conversion before '(' token
   10 |     scanf("%s",c);
      |          ^
a.cc:12:13: error: expected constructor, destructor, or type conversion before '=' token
   12 |     *c_copy = *c;
      |             ^
a.cc:14:5: error: expected unqualified-id before 'for'
   14 |     for(int y=0;y<rows;y++){
      |     ^~~
a.cc:14:17: error: 'y' does not name a type
   14 |     for(int y=0;y<rows;y++){
      |                 ^
a.cc:14:24: error: 'y' does not name a type
   14 |     for(int y=0;y<rows;y++){
      |                        ^
Language: C++

#include<string>
#include<iostream>
#include<vector>
#define ten(x,y) x + y*W
using namespace std;

int i, j;
int H, W;
string s;

int count(int x, int y) {
	int a = 0;
	vector<int> v;
	v.push_back(ten(--x, --y));
	v.push_back(ten(++x, y));
	v.push_back(ten(++x, y));
	v.push_back(ten(x, ++y));
	v.push_back(ten(x, ++y));
	v.push_back(ten(--x, y));
	v.push_back(ten(--x, y));
	v.push_back(ten(x, --y));
	for (int p : v)if (s[p] == '#')a++;
	return a;
}

int main() {
	cin >> H >> W;
	for(i=0;i<H;i++) {
		cin >> s;
		cin.ignore;
		for (j = 0; j < W; j++) {
			if (s[ten(i, j)] == '#')cout << '#';
			else cout << count(i, j);
		}
		cout << endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:21: error: statement cannot resolve address of overloaded function
   30 |                 cin.ignore;
      |                 ~~~~^~~~~~
Language: C++

#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <string>
#include <utility>
#include <vector>

using namespace std;

int main() {
  int h, w;
  cin >> h >> w;
  char map[h][w];
  int count = 0;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cin >> map[i][j];
    }
  }
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if(map[i][j]=="#"){
        count++;
      }
    }
  }

      return 0;
    }


Compiler output:
a.cc: In function 'int main()':
a.cc:25:19: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   25 |       if(map[i][j]=="#"){
      |          ~~~~~~~~~^~~~~
Language: C

#include <stdio.h>

#define SIZE 50;

int main(int argc, char *argv[]) {
  int h, w;
  scanf("%d %d\n", &h, &w);
  char map[SIZE][SIZE];
  for (int i = 0; i < h; ++i) {
    scanf("%s\n", map[i]);
  }

  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      if (map[i][j] == '.') {
        int c = 0;
        if (0 < i) {
          if (map[i - 1][j] == '#') ++c;
          if (j < w - 1 && map[i - 1][j + 1] == '#') ++c;
          if (0 < j && map[i - 1][j - 1]== '#') ++c;
        }
        if (j < w - 1 && map[i][j + 1] == '#') ++c;
        if (0 < j && map[i][j - 1]== '#') ++c;
        if (i < h - 1) {
          if (map[i + 1][j] == '#') ++c;
          if (j < w - 1 && map[i + 1][j + 1] == '#') ++c;
          if (0 < j && map[i + 1][j - 1]== '#') ++c;
        }
        map[i][j] = c;
      }
    }
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:3:16: error: expected ']' before ';' token
    3 | #define SIZE 50;
      |                ^
main.c:8:12: note: in expansion of macro 'SIZE'
    8 |   char map[SIZE][SIZE];
      |            ^~~~
main.c:8:22: error: expected statement before ']' token
    8 |   char map[SIZE][SIZE];
      |                      ^
main.c:10:19: error: 'map' undeclared (first use in this function)
   10 |     scanf("%s\n", map[i]);
      |                   ^~~
main.c:10:19: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int H, W;
    string t;
    vector<string> M;
    cin >> H >> W;
    for (int i=0; i<H; ++i) {
        cin >> t;
        M.emplace_back(t);
    }
    
    for (int y=0; y<H; ++y) {
        string s;
        for (int x=0; x<W; ++x) {
            if (M[y][x] == '#') {
                s += "#";
                continue;
            }
            int b = 0;
            for (int py = max(y-1, 0); py < min(y+2, H); ++py) {
                for (int px = max(x-1, 0); px < min(x+2, W); ++px) {
                    if (M[py][@x] == '#') { b += 1; }
                }
            }
            s += to_string(b);
        }
        cout << s << endl;
    }
    
    return 0;
}

Compiler output:
a.cc:27:31: error: stray '@' in program
   27 |                     if (M[py][@x] == '#') { b += 1; }
      |                               ^
Language: C++

#include <bits/stdc++.h>
 
using namespace std;
const int N = 51;
vector<vector<int>> res(N, vector<int>(N, 0));
 
int dx[8] = {1,1,1,0,0,-1,-1,-1};
int dy[8] = {1,0,-1,1,-1,1,0,-1};
 
int main(){
    ios_base::sync_with_stdio (false);
    //freopen ("joke.in","r",stdin);
	//freopen ("joke.out","w",stdout);
	int H, W;
  	vector<string> g;
  	string s;
  	for(int i=0; i<H; ++i){
    	cin >> s;
      	g.push_back(s);
    }
  	
  	for(int y = 0; y < H; ++y){
    	for(int x = 0; x < W; ++x){
        	for(int d = 0; d < 8; ++d){
            	int xx = x + dx[d];
              	int yy = y + dy[d];
              	if(xx<W && xx>=0 && yy<H && yy>=0){
                	if(g[yy][xx]=='#'){
                    	res[y][x]++;
                    }
                }
            }
        }
    }
  	
    for(int y = 0; y < H; ++y){
    	for(int x = 0; x < W; ++x){
        	cout << ((g[y][x]=='#') ? '#' : res[y][x];
        }
      	cout << endl;
    }
  
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:58: error: expected ')' before ';' token
   38 |                 cout << ((g[y][x]=='#') ? '#' : res[y][x];
      |                         ~                                ^
      |                                                          )
Language: C++

#include <bits/stdc++.h>

using namespace std;
const int N = 51;
vector<vector<int>> res(N, vector<int>(N, 0));

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

int main(){
    ios_base::sync_with_stdio (false);
    //freopen ("joke.in","r",stdin);
	//freopen ("joke.out","w",stdout);
	int H, W;
  	vector<string> g;
  	string s;
  	for(int i=0; i<H; ++i){
    	cin >> s;
      	g.push_back(s);
    }
  	
  	for(int y = 0; y < H; ++y){
    	for(int x = 0; x < W; ++x){
        	for(int d = 0; d < 8; ++d){
            	int xx = x + dx[d];
              	int yy = y + dy[d];
              	if(xx<W && xx>=0 && yy<H && yy>=0){
                	if(g[yy][xx]=='#'){
                    	res[y][x]++;
                    }
                }
            }
        }
    }
  	
    for(int y = 0; y < H; ++y){
    	for(int x = 0; x < W; ++x){
        	cout << ((g[yy][xx]=='#') ? '#' : res[y][x];
        }
      	cout << endl;
    }
  
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:29: error: 'yy' was not declared in this scope; did you mean 'y'?
   38 |                 cout << ((g[yy][xx]=='#') ? '#' : res[y][x];
      |                             ^~
      |                             y
a.cc:38:33: error: 'xx' was not declared in this scope; did you mean 'x'?
   38 |                 cout << ((g[yy][xx]=='#') ? '#' : res[y][x];
      |                                 ^~
      |                                 x
a.cc:38:60: error: expected ')' before ';' token
   38 |                 cout << ((g[yy][xx]=='#') ? '#' : res[y][x];
      |                         ~                                  ^
      |                                                            )
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:37:14: error: expected '}' at end of input
   37 |     return 0;
      |              ^
a.cc:8:1: note: to match this '{'
    8 | {
      | ^
Language: C++

#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
  int H,W;
  cin >> H;
  cin >> W;
  vector<string> tmp(H);

  for (int i=0; i<H; i++) {
        cin >> tmp[i];
  }

  for (int i=0; i<H; i++) {
      for (int j=0; j<W; j++) {
        if (tmp[i][j] == '.') {
          int s=0;

          for (int k=-1; k<2; k++) {
              for (int l=-1; l<2; l++) {
                if (i+k => 0 && i+k < H && j+l =>0 && j+l < W) {
                  if (tmp[i+k][j+l] == '#') {
                    s = s+1;
                  }
                }
              }
          }
          char s2 = '0' + s;
          tmp[i][j] = s2;
      }
    }
  }

  for (int i=0;i<H; i++) {
    cout << tmp[i] << endl;
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:26: error: expected primary-expression before '>' token
   24 |                 if (i+k => 0 && i+k < H && j+l =>0 && j+l < W) {
      |                          ^
a.cc:24:49: error: expected primary-expression before '>' token
   24 |                 if (i+k => 0 && i+k < H && j+l =>0 && j+l < W) {
      |                                                 ^
Language: C++

#include <iostream>
#include <string>

using namespace std;

int main(){
    int H, W, i, j;
    string s[55];

    cin >> H >> W;
    for (i = 0; i < H; ++i) cin >> s[i];

    int dx, dy;
    for (i = 0; i < H; ++i){
        for (j = 0; j < W; ++j){
            if (s[i][j] == '#') cout << '#';
            else{
                int cnt = 0;
                for (dx = -1; dx <= 1; ++dx){
                    for (dy = -1; dy <= 1; ++dy){
                        int di = i + dx;
                        int dj = j + dy;
                        if (di >= 0 && dj >= 0 && di < H && dj < W && s[di][dj] == '#') ++cnt;
                    }
                }
            }
            cout << cnt;
        }
        cout << endl;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:21: error: 'cnt' was not declared in this scope; did you mean 'int'?
   27 |             cout << cnt;
      |                     ^~~
      |                     int
Language: C++

#include <iostream>
using namespace std;

int main() {
	int h, w;
	cin >> h >> w;
	char bom[50][50];
	for (int i = 0; i != h; i++) {
		for (int j = 0; j != w; j++) {
			cin >> bom[j][i];
		}
	}
	int countBomAtack = 0;
	for (int i = 0; i != h; i++) {
		for (int j = 0; j != w j++) {
			if (bom[j][i] == '#') {
				cout << '#';
				break;
			}
			if (bom[j - 1][i - 1] == '#') {
				countBomAtack += 1;
			}
			if (bom[j][i - 1] == '#') {
				countBomAtack += 1;
			}
			if (bom[j + 1][i - 1] == '#') {
				countBomAtack += 1;
			}
			if (bom[j - 1][i] == '#') {
				countBomAtack += 1;
			}
			if(bom[j + 1][i] == '#'){
				countBomAtack += 1;
			}
			if (bom[j - 1][i - 1] == '#') {
				countBomAtack += 1;
			}
			if (bom[j - 1][i] == '#') {
				countBomAtack += 1;
			}
			if (bom[j - 1][i + 1] == '#') {
				countBomAtack += 1;
			}
			cout << countBomAtack;
		}
		cout << '\n';
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:39: error: expected ';' before 'j'
   15 |                 for (int j = 0; j != w j++) {
      |                                       ^~
      |                                       ;
Language: C++

#include<iostream>
using namespace std;
int main(){
char mas[55][55];
int h,w;
cin>>h>>w;
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
cin>>mas[i][j];
}
}
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
int a=0;
if(mas[h][w]!='#'){
for(int k=i-1;k<=i+1;k++){
for(int l=j-1;j<=j+1;j++){
if(mas[k][l]=='#'){
a++;
}
}
}

mas[h][w]=a;
 
}
}
for(int i=0;i<h;i++){
for(int j=0;j<w-1;j++){
cout<<mas[i][j]<<flush;
}
cout<<mas[i][w-1]<<endl;
}
return 0;}

Compiler output:
a.cc:25:1: error: extended character   is not valid in an identifier
   25 |  
      | ^
a.cc: In function 'int main()':
a.cc:25:1: error: '\U000000a0' was not declared in this scope
   25 |  
      | ^
a.cc:34:11: error: expected '}' at end of input
   34 | return 0;}
      |           ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include <iostream>
using namespace std;
int main(){
  char[a15][20];
  int x,b,h,j;
  cin>>x;
  cin>>b;
  for(j=1;j<=x;j++){
    for(h=1;h<=b;h++){
      cin>>a[j][h];
      if(a[j][h]=='.'){
        a[j][h]=0;
        if(a[j-1][h]=='#'){
          a[j][h]+=1;}
        if(a[j-1][h-1]=='#'){
          a[j][h]+=1;}
        if(a[j][h-1]=='#'){
          a[j][h]+=1;}
        if(a[j-1][h+1]=='#'){
          a[j][h]+=1;}
        if(a[j+1][h-1]=='#'){
          a[j][h]+=1;}
        if(a[j+1][h+1]=='#'){
          a[j][h]+=1;}
        if(a[j][h+1]=='#'){
          a[j][h]+=1;}
        if(a[j+1][h]=='#'){
          a[j][h]+=1;}
      }
    }
  }
  for(j=1;j<=x;j++){
    for(h=1;h<=b;h++){
      cout<<a[j][h];
    }
    cout<<endl;
  }
}
        
        

Compiler output:
a.cc: In function 'int main()':
a.cc:4:7: error: structured binding declaration cannot have type 'char'
    4 |   char[a15][20];
      |       ^~~~~
a.cc:4:7: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:4:12: error: expected initializer before '[' token
    4 |   char[a15][20];
      |            ^
a.cc:4:12: error: expected ';' before '[' token
a.cc:10:12: error: 'a' was not declared in this scope
   10 |       cin>>a[j][h];
      |            ^
a.cc:34:13: error: 'a' was not declared in this scope
   34 |       cout<<a[j][h];
      |             ^
Language: C++

#include<iostream>
using namespace std;
int main(){
char mas[55][55];
int h,w;
cin>>h>>w;
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
cin>>mas[i][j];
}
}
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
int a=0;
if(mas[h][w]!='#'){
for(int k=i-1;k<=i+1;k++){
for(int l=j-1;j<=j+1;j++){
if(mas[k][l]=='#'){
a++;
}
}
mas[h][w]=a;

}
}
for(int i=0;i<h;i++){
for(int j=0;j<w-1;j++){
cout<<mas[i][j]<<flush;
}
cout<<mas[i][w-1]<<endl;
}
return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:11: error: expected '}' at end of input
   32 | return 0;}
      |           ^
a.cc:12:21: note: to match this '{'
   12 | for(int i=0;i<h;i++){
      |                     ^
a.cc:32:11: error: expected '}' at end of input
   32 | return 0;}
      |           ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C

#include <stdio.h>
char s[55][55]={};
int bomb(int i,int j){
  return (s[i][j] == '#')? 1:0;
}
int main(){
  int h,w;
  int a[55][55]={};
  scanf("%d%d",&h,&w);
  for(int i=0;i<h;i++){
    scanf("%s",s[i]);
  }
  
                      a[0][0]+=bomb(0,1);
  a[0][0]+=bomb(1,0); a[0][0]+=bomb(1,1);
  for(int j=1;j<w-1;j++){
    a[i][j]+=bomb(i,j-1);                       a[i][j]+=bomb(i,j+1);
    a[i][j]+=bomb(i+1,j-1);a[i][j]+=bomb(i+1,j);a[i][j]+=bomb(i+1,j+1);
  }
  a[0][w-1]+=bomb(0,w-2);
  a[0][w-1]+=bomb(1,w-2); a[0][w-1]+=bomb(1,w-1);
  
  for(int i=1;i<h-1;i++){
    a[i][0]+=bomb(i-1,0);a[i][0]+=bomb(i-1,1);
                         a[i][0]+=bomb(i,1);
    a[i][0]+=bomb(i+1,0);a[i][j]+=bomb(i+1,1);
    for(int j=1;j<w-1;j++){
      a[i][j]+=bomb(i-1,j-1);a[i][j]+=bomb(i-1,j);a[i][j]+=bomb(i-1,j+1);
      a[i][j]+=bomb(i,j-1);                       a[i][j]+=bomb(i,j+1);
      a[i][j]+=bomb(i+1,j-1);a[i][j]+=bomb(i+1,j);a[i][j]+=bomb(i+1,j+1);
    }
    a[i][w-1]+=bomb(i-1,w-2);a[i][w-1]+=bomb(i-1,w-1);
    a[i][w-1]+=bomb(i,w-2);
    a[i][w-1]+=bomb(i+1,w-2);a[i][w-1]+=bomb(i+1,w-1);
  }
  
  a[h-1][0]+=bomb(h-2,0);a[h-1][0]+=bomb(h-2,1);
                         a[h-1][0]+=bomb(h-1,1);
  for(int j=1;j<w-1;j++){
    a[i][j]+=bomb(i-1,j-1);a[i][j]+=bomb(i-1,j);a[i][j]+=bomb(i-1,j+1);
    a[i][j]+=bomb(i,j-1);                       a[i][j]+=bomb(i,j+1);
  }
  a[h-1][w-1]+=bomb(h-2,w-2);a[h-1][w-1]+=bomb(h-2,w-1);
  a[h-1][w-1]+=bomb(h-1,w-2);
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      printf("%d",a[i][j]);
    }
    printf("\n");
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:17:7: error: 'i' undeclared (first use in this function)
   17 |     a[i][j]+=bomb(i,j-1);                       a[i][j]+=bomb(i,j+1);
      |       ^
main.c:17:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:26:31: error: 'j' undeclared (first use in this function)
   26 |     a[i][0]+=bomb(i+1,0);a[i][j]+=bomb(i+1,1);
      |                               ^
Language: C

#include <stdio.h>
#include <math.h>
int main (void){
  int a[256];
  char block[256][50];
  char result[256][50];
  char moziretu[256];
  int i=0;
  int m=0;
  int j=0;
  int bomb;
  int yoko=0;
  int tate=0;
  int mozi=0; //文字数                                                          
  char str[256];
  scanf("%[^\n]",str);
  while(1){
    if(str[i]==' '||str[i]=='\n'||str[i]=='\0'){
      a[mozi]=0;
      while(j!=0){
        a[mozi]+=(str[i-j]-'0')*pow(10,j-1);
        j--;
      }
      mozi++;
      if(m==-1){
        a[mozi-1]=a[mozi-1]*-1;
        m=0;
      }
      j=-1;
      if(str[i]=='\n'||str[i]=='\0')break;
    }
    if(str[i]=='-'){
     m=-1;
     j--;
   }
    i++;
    j++;
  }
  for(tate=0;tate<a[0];tate++){
    scanf("%[^\n]",moziretu);
    for(yoko=0;yoko<a[1];yoko++){
      block[tate][yoko]=moziretu[yoko];
    }
  }
  for(tate=0;tate<a[0];tate++){
    for(yoko=0;yoko<a[1];yoko++){
      bomb=0;
      if(tate!=0){
      if(block[tate-1][yoko-1]=='#'&&yoko!=0)bomb++:
      if(block[tate-1][yoko]=='#')bomb++:
      if(block[tate-1][yoko+1]=='#'&&yoko!=a[1]-1)bomb++:
      }
      if(block[tate][yoko-1]=='#'&&yoko!=0)bomb++:
      if(block[tate][yoko+1]=='#'&&yoko!=a[1]-1)bomb++:
      if(tate!=a[0]){
      if(block[tate+1][yoko-1]=='#'&&yoko!=0)bomb++:
      if(block[tate+1][yoko]=='#')bomb++:
      if(block[tate+1][yoko+1]=='#'&&yoko!=a[1]-1)bomb++:
      }
      result[tate][yoko]=bomb;
    }
  }
  for(tate=0;tate<a[0];tate++){
    for(yoko=0;yoko<a[1];yoko++){
      printf("%c",block[tate][yoko]);
    }
     print("\n");
  }
}

Compiler output:
main.c: In function 'main':
main.c:49:52: error: expected ';' before ':' token
   49 |       if(block[tate-1][yoko-1]=='#'&&yoko!=0)bomb++:
      |                                                    ^
      |                                                    ;
main.c:53:50: error: expected ';' before ':' token
   53 |       if(block[tate][yoko-1]=='#'&&yoko!=0)bomb++:
      |                                                  ^
      |                                                  ;
main.c:67:6: error: implicit declaration of function 'print'; did you mean 'lrint'? [-Wimplicit-function-declaration]
   67 |      print("\n");
      |      ^~~~~
      |      lrint
Language: C

#include <stdio.h>
#include <math.h>
int main (void){
  int a[256];
  char block[256][50];
  char moziretu[256];
  int i=0;
  int m=0;
  int j=0;
  int yoko=0;
  int tate=0;
  int mozi=0; //文字数                                                          
  char str[256];
  scanf("%[^\n]",str);
  while(1){
    if(str[i]==' '||str[i]=='\n'||str[i]=='\0'){
      a[mozi]=0;
      while(j!=0){
        a[mozi]+=(str[i-j]-'0')*pow(10,j-1);
        j--;
      }
      mozi++;
      if(m==-1){
        a[mozi-1]=a[mozi-1]*-1;
        m=0;
      }
      j=-1;
      if(str[i]=='\n'||str[i]=='\0')break;
    }
    if(str[i]=='-'){
     m=-1;
     j--;
   }
    i++;
    j++;
  }
  for(tate=0;tate<a[0];tate++){
    scanf("%[^\n]",moziretu);
    for(yoko=0;yoko<a[1];tate++){
      a[tate][yoko]=moziretu[yoko];
    }
  }
}

Compiler output:
main.c: In function 'main':
main.c:40:14: error: subscripted value is neither array nor pointer nor vector
   40 |       a[tate][yoko]=moziretu[yoko];
      |              ^
Language: C++

#include <stdio.h>
#include <stdlib.h>

int H,W;

char check(int i,int j,char** field){
  if(i < 0 || j < 0){
    return 0;
  }
  if(i >= H || j >= W)
    return 0;

  if(field[i][j] == '#')
    return 1;

  return 0;
}

int main(void)

{

  scanf("%d %d",&H,&W);

  char** field;
  field = malloc(sizeof(char*) * H);
  int i,j;
  for(i = 0; i < H;i++){
    field[i] = malloc(sizeof(char) * W);
  }
  
  for(i = 0; i < H; i++){
    for(j = 0; j < W;j++)
      scanf(" %c",&field[i][j]);
  }
//printf("debug : loadcmp\n");
//for(i = 0;i < H;i++)
//  for(j=0; j < W;j++)
//    printf(" | %c | ",field[i][j]);

  for(i = 0; i < H; i++){
    for(j = 0; j < W;j++){
      if(field[i][j] == '.'){
        field[i][j] = check(i + 1,j + 1,field) + check(i + 1, j ,field) + check(i,j+1,field) 
                     +check(i - 1,j - 1,field) + check(i - 1, j, field) + check(i,j-1,field)
                     +check(i + 1,j - 1,field) + check(i - 1, j + 1,field) + '0';
      }
    }
  }
//printf("debug : calccmp\n");
  for(i = 0; i < H; i++){
    for(j = 0; j < W; j++){
      printf("%c",field[i][j]);
    }
    printf("\n");
  }

  for(i = 0; i <H ;i++){
    free(field[i]);
  }
  free(field);
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:17: error: invalid conversion from 'void*' to 'char**' [-fpermissive]
   26 |   field = malloc(sizeof(char*) * H);
      |           ~~~~~~^~~~~~~~~~~~~~~~~~~
      |                 |
      |                 void*
a.cc:29:22: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
   29 |     field[i] = malloc(sizeof(char) * W);
      |                ~~~~~~^~~~~~~~~~~~~~~~~~
      |                      |
      |                      void*
Language: C++

#include<stdio.h>
#include<iostream>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<map>
#include<vector>
using namespace std;
typedef long long LL;
#define ms(a,b) memset(a,b,sizeof(a))

char m[50][50];
int h,w;
bool f(int a,int b)
{
    if(a<h&&a>=0&&b<w&&b>=0&&m[a][b]=='#') return true;
    return false;
}
int dir[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};
int main()
{
    //ios::sync_with_stdio(0);cin.tie(0);
    while(~scanf("%d%d",&h,&w)){
        getchar();
        for(int i=0;i<h;i++) gets(m[i]);
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                if(f(i,j)){printf("#");continue;}
                int ans=0;
                for(int k=0;k<8;k++){
                    if(f(i+dir[k][0],j+dir[k][1])) ans++;
                }
                printf("%d",ans);
            }
            printf("\n");
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:30: error: 'gets' was not declared in this scope; did you mean 'getw'?
   25 |         for(int i=0;i<h;i++) gets(m[i]);
      |                              ^~~~
      |                              getw
Language: C++

#include<stdio.h>
#include<iostream>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<map>
#include<vector>
using namespace std;
typedef long long LL;
#define ms(a,b) memset(a,b,sizeof(a))

char m[60][60];
int h,w;
bool f(int a,int b)
{
    if(a<h&&a>=0&&b<w&&b>=0&&m[a][b]=='#') return true;
    return false;
}
int dir[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};
int main()
{
    //ios::sync_with_stdio(0);cin.tie(0);
    while(~scanf("%d%d",&h,&w)){
        getchar();
        for(int i=0;i<h;i++) gets(m[i]);
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                if(f(i,j)){printf("#");continue;}
                int ans=0;
                for(int k=0;k<8;k++){
                    if(f(i+dir[k][0],j+dir[k][1])) ans++;
                }
                printf("%d",ans);
            }
            printf("\n");
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:30: error: 'gets' was not declared in this scope; did you mean 'getw'?
   25 |         for(int i=0;i<h;i++) gets(m[i]);
      |                              ^~~~
      |                              getw
Language: C

#include <stdio.h>

char mine(char s[][],int i,int j){
  int x,count=0;
  for(x=j-1;j<=j+1;j++)
    if(s[i-1][x]=='#') count++;
  if(s[i][j-1]=='#') count++;
  if(s[i][j+1]=='#') count++;
  for(x=j-1;j<=j+1;j++)
    if(s[i+1][x]=='#') count++;
  return(count);
}

int main(void){
  char s[50][50];
  int i,j;
  int H,W;
  scanf("%d %d",&H,&W);
  for(i=0;i<H;i++) scanf("%s",s[i]);
  for(i=0;i<H;i++)
    for(j=0;j<W;j++)
      s[i][j]='mine(s,i,j)';
  for(i=0;i<H;i++) printf("%s",s[i]);
  return(0);
}


Compiler output:
main.c:3:16: error: array type has incomplete element type 'char[]'
    3 | char mine(char s[][],int i,int j){
      |                ^
main.c:3:16: note: declaration of 's' as multidimensional array must have bounds for all dimensions except the first
main.c: In function 'main':
main.c:22:15: warning: multi-character literal with 11 characters exceeds 'int' size of 4 bytes
   22 |       s[i][j]='mine(s,i,j)';
      |               ^~~~~~~~~~~~~
main.c:22:15: warning: overflow in conversion from 'int' to 'char' changes value from '1764518441' to '41' [-Woverflow]
Language: C++

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main()
{
	int n,m;
	char sh[55][55];
	int d[9][2]={
		{-1,0},{-1,1},{0,1},{1,1},{1,0},{1,-1},{0,-1},{-1,-1}
	};
	scanf("%d %d",&n,&m);
	for(int i=0;i<n;i++)
		scanf("%s",sh[i]);
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			if(sh[i][j]=='.')
			{
				int s=0;
				for(int k=0;k<8;k++)
				{
					int x=i+d[k][0],y=j+d[k][1];
					if(x<n&&y<m)
					{
						if(sh[x][y]=='#')s++;
					}
				}
				sh[i][j]=s+48+'\0';
			}
		}
	}
	for(int i=0;i<n;i++)
	{
		printf("%s\n",sh[i]);
	}
	
	return 0;
}

16-软工-王素云 2017/10/14 20:40:50
你真胖


Compiler output:
a.cc:42:1: error: expected unqualified-id before numeric constant
   42 | 16-软工-王素云 2017/10/14 20:40:50
      | ^~
Language: C++

#include<stdio.h>
#include<iostream>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<map>
#include<vector>
using namespace std;
typedef long long LL;
#define ms(a,b) memset(a,b,sizeof(a))

char m[60][60];
int h,w;
bool f(int a,int b)
{
    if(a<h&&a>=0&&b<w&&b>=0&&m[a][b]=='#') return true;
    return false;
}
int main()
{
    //ios::sync_with_stdio(0);cin.tie(0);
    while(~scanf("%d%d",&h,&w)){
        getchar();
        for(int i=0;i<h;i++) gets(m[i]);
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                if(f(i,j)){printf("%c",m[i][j]);continue;}
                int ans=0;
                if(f(i-1,j)) ans++;
                if(f(i-1,j+1)) ans++;
                if(f(i-1,j-1)) ans++;
                if(f(i,j-1)) ans++;
                if(f(i,j+1)) ans++;
                if(f(i+1,j)) ans++;
                if(f(i+1,j+1)) ans++;
                if(f(i+1,j-1)) ans++;
                printf("%d",ans);
            }
            printf("\n");
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:30: error: 'gets' was not declared in this scope; did you mean 'getw'?
   24 |         for(int i=0;i<h;i++) gets(m[i]);
      |                              ^~~~
      |                              getw
Language: C++

//#include <bits/stdc++.h>                          //include all library
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <sstream>
#include <vector>
#include <stack>
#include <queue>
#include <string.h>
#include <functional> // greater<int> はfunctionalヘッダ
using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)          //REP(i, 10){...} //i=0～i=9までのループ
#define REPR(i, n) for(int i = n;i >= 0;i--)        //REPR(i, 10){...} //i=10～i=0までのループ
#define FOR(i, m, n) for(int i = m;i < n;i++)       //FOR(i, 3, 10){...} //i=3～i=9までのループ
#define FORR(i, m, n) for(int i = m;i >= n;i--)     //FORR(i, 10, 3){...} //i=10～i=3までのループ
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
#define PI 3.141592653589
#define npos -1

int main()
{
  int h,w;
  cin >> h >>w;
  int bom[h][w];
  //int b[h][w];
  //REP(i,h) REP(j,w) b[i][j]=0;
  int array_x[8] ={1,1,1,0,-1,-1,-1,0};
  int array_y[8] ={1,0,-1,-1,-1,0,1,1};

  REP(i,h)
  {
  	string str;
  	cin >> str;
  	REP(j,w)
  	{
  		char str1 = str[j];
  		if(str1=='.') bom[i][j]=0;
  		else bom[i][j]=1;
  	}
  }

  REP(i,h)
  {
  	REP(j,w)
  	{
  		int count=0;
 		 	if(bom[i][j]==1) cout << "#";
 		 	else
 		 	{
  			REP(k,8)
  			{
  				int x=i+array_x[k];
  				int y=j+array_y[k];
  				if(x>=0 and y>=0 and x<h and y<w and bom[x][y]==1) count++;
  			}
  			cout << count;
  		}

  	}

  	cout << endl;

  }


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

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int H = sc.nextInt();
			int W = sc.nextInt();
			String map[][] = new String[H][W];

			String S;
			for (int i = 0; i < H; i++) {
				S = sc.next();
				for (int j = 0; j < W; j++) {
					map[i][j] = ".";
					if (S.charAt(j + 1) == '#') {
						map[i][j] = "#";
					}
				}
			}

			int count;
			StringBuffer sb = new StringBuffer();
			for (int i = 0; i < H; i++) {
				sb.setLength(0);
				for (int j = 0; j < W; j++) {
					count = 0;
					if (i - 1 >= 0 && j - 1 >= 0 && map[i - 1][j - 1].equals("#")) {
						count++;
					}
					if (i - 1 >= 0 && map[i - 1][j].equals("#")) {
						count++;
					}
					if (i - 1 >= 0 && j + 1 < W && map[i - 1][j + 1].equals("#")) {
						count++;
					}
					if (j - 1 >= 0 && map[i][j - 1].equals("#")) {
						count++;
					}
					if (j + 1 < W && map[i][j + 1].equals("#")) {
						count++;
					}
					if (i + 1 < H && j - 1 >= 0 && map[i + 1][j - 1].equals("#")) {
						count++;
					}
					if (i + 1 < H && map[i + 1][j].equals("#")) {
						count++;
					}
					if (i + 1 < H && j + 1 < W && map[i + 1][j + 1].equals("#")) {
						count++;
					}
					sb.append(count);
				}
				System.out.println(sb);
			}
		}
	}

Compiler output:
Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
	public static void main(String[] args) {
	              ^
  (use --enable-preview to enable unnamed classes)
1 error
Language: C++

#include "bits/stdc++.h"
using namespace std;
int main(){
  int H,W; cin >> H >>W;
  vector<vector<char>> m(H+2,vector<char>(W+2,'@'));
  for(int i = 1; i <= H;++)for(int j =1 ; j<=W;j++)cin>>m[i][j];
  int dx[8] = {0,1,1,1,0,-1,-1,-1};
  int dy[8] = {-1,-1,0,1,1,1,0,-1};
  vector<vector<int>> v(H+2,vector<int>(W+2,-1));
  for(int i = 1; i <= H;++)for(int j =1 ; j<=W;j++){
    if(m[i][j]=='@')continue;
    int cnt=0;
    for(int k=0;k < 9;k++){
      int nx = i+dx[k],ny=j+dy[k];
      if(m[nx][ny]=='#')cnt++;
    }
    v[i][j]=cnt;
  }
  for(int i = 1; i <= H;++){
    for(int j =1 ; j<=W;j++){
      if(v[i][j]==-1)cout<<'#';
      else cout<<v[i][j];
    }
    cout<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:27: error: expected primary-expression before ')' token
    6 |   for(int i = 1; i <= H;++)for(int j =1 ; j<=W;j++)cin>>m[i][j];
      |                           ^
a.cc:10:27: error: expected primary-expression before ')' token
   10 |   for(int i = 1; i <= H;++)for(int j =1 ; j<=W;j++){
      |                           ^
a.cc:19:27: error: expected primary-expression before ')' token
   19 |   for(int i = 1; i <= H;++){
      |                           ^