criyle/codenet-compile-errors huggingface dataset:
Language: Java

import java.io.*;
import java.util.StringTokenizer;
import java.util.Deque;
import java.util.ArrayDeque;

class Main{

static final PrintWriter out=new PrintWriter(System.out);
static final int INF=Integer.MAX_VALUE/2;

class Pair{
int x;
int y;
Pair(int x,int y){
this.x=x; this.y=y;
}
}

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
StringTokenizer st=new StringTokenizer(line);
int h=Integer.parseInt(st.nextToken());
int w=Integer.parseInt(st.nextToken());
int[][] map=new int[h][w];
for(int i=0;i<h;i++){
line=br.readLine();
for(int j=0;j<w;j++){
map[i][j]=(line.charAt(j)=='.')?INF:(int)(line.charAt(j)-'0');
}
}
int cnt=0;
while(true){
if(bfs(h,w,map)) cnt++;
else break;
}
out.println(cnt);
out.flush();
}
}

private static boolean bfs(int h,int w,int[][] map){
Deque<Pair> que=new ArrayDeque<Pair>();
int[][] hmap=new int[h][];
boolean update=false;
for(int i=0;i<h;i++) hmap[i]=map[i].clone();
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if(map[i][j]!=INF){
que.offerLast(new Pair(i,j));
}
}
}
while(!que.isEmpty()){
Pair p=que.pollFirst();
int x=p.x;
int y=p.y;
int nx;
int ny;
int cnt=0;
int[] d={-1,0,1};
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
nx=x+d[i];
ny=y+d[j];
if(hmap[nx][ny]==INF) cnt++;
}
}
if(cnt>=hmap[x][y]){
map[x][y]=INF;
update=true;
}
}
return update;
}
}

Compiler output:
Main.java:51: error: non-static variable this cannot be referenced from a static context
que.offerLast(new Pair(i,j));
              ^
1 error
Language: Java

import java.io.*;
import java.util.StringTokenizer;
import java.util.Deque;
import java.util.ArrayDeque;

class Main{

static final PrintWriter out=new PrintWriter(System.out);
static final int INF=Integer.MAX_VALUE/2;
static int[] d={-1,0,1};

static class Pair{
int x;
int y;
Pair(int x,int y){
this.x=x; this.y=y;
}
}

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
StringTokenizer st=new StringTokenizer(line);
int h=Integer.parseInt(st.nextToken());
int w=Integer.parseInt(st.nextToken());
int[][] map=new int[h][w];
for(int i=0;i<h;i++){
line=br.readLine();
for(int j=0;j<w;j++){
map[i][j]=(line.charAt(j)=='.')?INF:(int)(line.charAt(j)-'0');
}
}
int cnt=0;
while(true){
if(bfs(h,w,map)) cnt++;
else break;
}
out.println(cnt);
out.flush();
}
}

private static boolean bfs(int h,int w,int[][] map){
Deque<Pair> que=new ArrayDeque<Pair>();
int[][] hmap=new int[h][];
boolean update=false;
for(int i=0;i<h;i++) hmap[i]=map[i].clone();
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if(map[i][j]!=INF){
que.offerLast(new Pair(i,j));
}
}
}
while(!que.isEmpty()){
Pair p=que.pollFirst();
int x=p.x;
int y=p.y;
int nx;
int ny;
int cnt=0;
loop:
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
if(i==1&&j=1) continue loop;
nx=x+d[i];
ny=y+d[j];
if(hmap[nx][ny]==INF) cnt++;
if(cnt>=hmap[x][y]){
map[x][y]=INF;
update=true;
break loop;
}
}
}
}
return update;
}
}

Compiler output:
Main.java:66: error: bad operand types for binary operator '&&'
if(i==1&&j=1) continue loop;
       ^
  first type:  boolean
  second type: int
1 error
Language: Java

import java.io.*;
import java.util.StringTokenizer;
import java.util.Deque;
import java.util.ArrayDeque;

class Main{

static final PrintWriter out=new PrintWriter(System.out);
static final int INF=Integer.MAX_VALUE/2;
static int[] d={-1,0,1};

static class Pair{
int x;
int y;
Pair(int x,int y){
this.x=x; this.y=y;
}
}

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
StringTokenizer st=new StringTokenizer(line);
int h=Integer.parseInt(st.nextToken());
int w=Integer.parseInt(st.nextToken());
int[][] map=new int[h][w];
for(int i=0;i<h;i++){
line=br.readLine();
for(int j=0;j<w;j++){
map[i][j]=(line.charAt(j)=='.')?INF:(int)(line.charAt(j)-'0');
}
}
int cnt=0;
while(true){
if(bfs(h,w,map)) cnt++;
else break;
}
out.println(cnt);
out.flush();
}
}

private static boolean bfs(int h,int w,int[][] map){
Deque<Pair> que=new ArrayDeque<Pair>();
int[][] hmap=new int[h][];
boolean update=false;
for(int i=0;i<h;i++) hmap[i]=map[i].clone();
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if(map[i][j]!=INF){
que.offerLast(new Pair(i,j));
}
}
}
while(!que.isEmpty()){
Pair p=que.pollFirst();
int x=p.x;
int y=p.y;
int nx;
int ny;
int cnt1=0;
int hxy=hmap[x][y];
loop:
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
if(i==1&&j==1) continue;
nx=x+d[i];
ny=y+d[j];
if(hxy==INF) cnt1++;
else cnt2++;
if(cnt1>=hxy){
map[x][y]=INF;
update=true;
break loop;
}
if(cnt2+hxy<8) break loop;
}
}
}
return update;
}
}

Compiler output:
Main.java:71: error: cannot find symbol
else cnt2++;
     ^
  symbol:   variable cnt2
  location: class Main
Main.java:77: error: cannot find symbol
if(cnt2+hxy<8) break loop;
   ^
  symbol:   variable cnt2
  location: class Main
2 errors
Language: Java

import java.io.*;
import java.util.StringTokenizer;
import java.util.Deque;
import java.util.ArrayDeque;

class Main{

static final PrintWriter out=new PrintWriter(System.out);
static final int INF=Integer.MAX_VALUE/2;
static int[] d={-1,0,1};

static class Pair{
int x;
int y;
Pair(int x,int y){
this.x=x; this.y=y;
}
}

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
StringTokenizer st=new StringTokenizer(line);
int h=Integer.parseInt(st.nextToken());
int w=Integer.parseInt(st.nextToken());
int[][] map=new int[h][w];
for(int i=0;i<h;i++){
line=br.readLine();
for(int j=0;j<w;j++){
map[i][j]=(line.charAt(j)=='.')?INF:(int)(line.charAt(j)-'0');
}
}
int cnt=0;
while(true){
if(bfs(h,w,map)) cnt++;
else break;
}
out.println(cnt);
out.flush();
}
}

private static boolean bfs(int h,int w,int[][] map){
Deque<Pair> que=new ArrayDeque<Pair>();
int[][] hmap=new int[h][];
boolean update=false;
for(int i=0;i<h;i++) hmap[i]=map[i].clone();
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if(map[i][j]!=INF){
que.offerLast(new Pair(i,j));
}
}
}
while(!que.isEmpty()){
Pair p=que.pollFirst();
int x=p.x;
int y=p.y;
int nx;
int ny;
int cnt1=0;
int cnt2=0;
loop:
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
if(i==1&&j==1) continue;
nx=x+d[i];
ny=y+d[j];
if(h[nx][ny]==INF) cnt1++;
else cnt2++;
if(cnt1>=h[x][y]){
map[x][y]=INF;
update=true;
break loop;
}
if(cnt2+h[x][y]<8) break loop;
}
}
}
return update;
}
}

Compiler output:
Main.java:70: error: array required, but int found
if(h[nx][ny]==INF) cnt1++;
    ^
Main.java:72: error: array required, but int found
if(cnt1>=h[x][y]){
          ^
Main.java:77: error: array required, but int found
if(cnt2+h[x][y]<8) break loop;
         ^
3 errors
Language: Java

import java.io.*;
import java.util.StringTokenizer;
import java.util.Deque;
import java.util.ArrayDeque;

class Main{

static final PrintWriter out=new PrintWriter(System.out);
static final int INF=Integer.MAX_VALUE/2;
static int[] d={-1,0,1};

static class Pair{
int x;
int y;
Pair(int x,int y){
this.x=x; this.y=y;
}
}

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
StringTokenizer st=new StringTokenizer(line);
int h=Integer.parseInt(st.nextToken());
int w=Integer.parseInt(st.nextToken());
int[][] map=new int[h][w];
for(int i=0;i<h;i++){
line=br.readLine();
for(int j=0;j<w;j++){
map[i][j]=(line.charAt(j)=='.')?INF:(int)(line.charAt(j)-'0');
}
}
int cnt=0;
while(true){
if(bfs(h,w,map)) cnt++;
else break;
}
out.println(cnt);
out.flush();
}
}

private static boolean bfs(int h,int w,int[][] map){
Deque<Pair> que=new ArrayDeque<Pair>();
int[][] hmap=new int[h][];
boolean update=false;
for(int i=0;i<h;i++) hmap[i]=map[i].clone();
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if(map[i][j]!=INF){
que.offerLast(new Pair(i,j));
}
}
}
while(!que.isEmpty()){
Pair p=que.pollFirst();
int x=p.x;
int y=p.y;
int nx;
int ny;
int cnt1=0;
int cnt2=0;
int hxy=hmap[x][y]
loop:
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
if(i==1&&j==1) continue;
nx=x+d[i];
ny=y+d[j];
if(hmap[nx][ny]==INF) cnt1++;
if(hmap[nx][ny]<INF) cnt2++;
if(cnt1>=hxy){
map[x][y]=INF;
update=true;
break loop;
}
if(cnt2>8-hxy) break loop;
}
}
}
return update;
}
}

Compiler output:
Main.java:64: error: ';' expected
int hxy=hmap[x][y]
                  ^
1 error
Language: Java

import java.io.*;
import java.util.StringTokenizer;
import java.util.Deque;
import java.util.ArrayDeque;

class Main{

static final PrintWriter out=new PrintWriter(System.out);
static final int INF=Integer.MAX_VALUE/2;
static int[] d={-1,0,1};

static class TPair{
int t;
int x;
int y;
TPair(int t,int x,int y){
this.t=t; this.x=x; this.y=y;
}
}

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
StringTokenizer st=new StringTokenizer(line);
int h=Integer.parseInt(st.nextToken());
int w=Integer.parseInt(st.nextToken());
int[][] map=new int[h][w];
for(int i=0;i<h;i++){
line=br.readLine();
for(int j=0;j<w;j++){
map[i][j]=(line.charAt(j)=='.')?INF:(int)(line.charAt(j)-'0');
}
}
out.println(bfs(h,w,map));
out.flush();
}
}

private static int bfs(int h,int w,int[][] map){
Deque<Pair> que=new ArrayDeque<Pair>();
int[][] hmap=new int[h][];
int ans=-1;
for(int i=0;i<h;i++) hmap[i]=map[i].clone();
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if(map[i][j]!=INF){
que.offerLast(new TPair(0,i,j));
}
}
}
while(!que.isEmpty()){
TPair p=que.pollFirst();
if(ans!=p.t){
for(int i=0;i<h;i++) hmap[i]=map[i].clone();
ans=p.t;
}
int x=p.x;
int y=p.y;
int nx;
int ny;
int cnt1=0;
int cnt2=0;
int hxy=hmap[x][y];
loop:
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
if(i==1&&j==1) continue;
nx=x+d[i];
ny=y+d[j];
if(hmap[nx][ny]==INF) cnt1++;
if(hmap[nx][ny]<INF) cnt2++;
if(cnt1>=hxy){
map[x][y]=INF;
break loop;
}
if(cnt2>8-hxy){
que,offerLast(new TPair(ans+1,x,y));
break loop;
}
}
}
return ans;
}
}

Compiler output:
Main.java:78: error: not a statement
que,offerLast(new TPair(ans+1,x,y));
^
Main.java:78: error: ';' expected
que,offerLast(new TPair(ans+1,x,y));
   ^
Main.java:85: error: reached end of file while parsing
}
 ^
3 errors
Language: Java

import java.io.*;
import java.util.StringTokenizer;
import java.util.Deque;
import java.util.ArrayDeque;

class Main{

static final PrintWriter out=new PrintWriter(System.out);
static final int INF=Integer.MAX_VALUE/2;
static int[] d={-1,0,1};

static class TPair{
int t;
int x;
int y;
TPair(int t,int x,int y){
this.t=t; this.x=x; this.y=y;
}
}

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
StringTokenizer st=new StringTokenizer(line);
int h=Integer.parseInt(st.nextToken());
int w=Integer.parseInt(st.nextToken());
int[][] map=new int[h][w];
for(int i=0;i<h;i++){
line=br.readLine();
for(int j=0;j<w;j++){
map[i][j]=(line.charAt(j)=='.')?INF:(int)(line.charAt(j)-'0');
}
}
out.println(bfs(h,w,map));
out.flush();
}
}

private static int bfs(int h,int w,int[][] map){
Deque<TPair> que=new ArrayDeque<TPair>();
int[][] hmap=new int[h][];
int ans=-1;
for(int i=0;i<h;i++) hmap[i]=map[i].clone();
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if(map[i][j]!=INF) que.offerLast(new TPair(0,i,j));
}
}
while(!que.isEmpty()){
TPair p=que.pollFirst();
if(ans!=p.t){
for(int i=0;i<h;i++) hmap[i]=map[i].clone();
ans=p.t;
}
int x=p.x;
int y=p.y;
int nx;
int ny;
int cnt1=0;
int cnt2=0;
int hxy=hmap[x][y];
loop:
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
if(i==1&&j==1) continue;
nx=x+d[i];
ny=y+d[j];
if(hmap[nx][ny]==INF) cnt1++;
if(hmap[nx][ny]<INF) cnt2++;
if(cnt1>=hxy){
map[x][y]=INF;
break loop;
}
if(cnt2>8-hxy){
que,offerLast(new TPair(ans+1,x,y));
break loop;
}
}
}
return ans;
}
}

Compiler output:
Main.java:76: error: not a statement
que,offerLast(new TPair(ans+1,x,y));
^
Main.java:76: error: ';' expected
que,offerLast(new TPair(ans+1,x,y));
   ^
Main.java:83: error: reached end of file while parsing
}
 ^
3 errors
Language: Java

import java.io.*;
import java.util.StringTokenizer;
import java.util.Deque;
import java.util.ArrayDeque;

class Main{

static final PrintWriter out=new PrintWriter(System.out);
static final int INF=Integer.MAX_VALUE/2;
static int[] d={-1,0,1};

static class TPair{
int t;
int x;
int y;
TPair(int t,int x,int y){
this.t=t; this.x=x; this.y=y;
}
}

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
StringTokenizer st=new StringTokenizer(line);
int h=Integer.parseInt(st.nextToken());
int w=Integer.parseInt(st.nextToken());
int[][] map=new int[h][w];
for(int i=0;i<h;i++){
line=br.readLine();
for(int j=0;j<w;j++){
map[i][j]=(line.charAt(j)=='.')?INF:(int)(line.charAt(j)-'0');
}
}
out.println(bfs(h,w,map));
out.flush();
}
}

private static int bfs(int h,int w,int[][] map){
Deque<TPair> que=new ArrayDeque<TPair>();
int[][] hmap=new int[h][];
int ans=-1;
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if(map[i][j]!=INF) que.offerLast(new TPair(0,i,j));
}
}
while(!que.isEmpty()){
TPair p=que.pollFirst();
if(ans!=p.t){
if(update){
boolean update=false;
for(int i=0;i<h;i++) hmap[i]=map[i].clone();
ans=p.t;
}
else return ans;
}
int x=p.x;
int y=p.y;
int nx;
int ny;
int cnt1=0;
int cnt2=0;
int hxy=hmap[x][y];
loop:
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
if(i==1&&j==1) continue;
nx=x+d[i];
ny=y+d[j];
if(hmap[nx][ny]==INF) cnt1++;
if(hmap[nx][ny]<INF) cnt2++;
if(cnt1>=hxy){
map[x][y]=INF;
update=true;
break loop;
}
if(cnt2>8-hxy){
que.offerLast(new TPair(ans+1,x,y));
break loop;
}
}
}
}
}
}

Compiler output:
Main.java:52: error: cannot find symbol
if(update){
   ^
  symbol:   variable update
  location: class Main
Main.java:76: error: cannot find symbol
update=true;
^
  symbol:   variable update
  location: class Main
2 errors
Language: Java

import java.io.*;
import java.util.StringTokenizer;
import java.util.Deque;
import java.util.ArrayDeque;

class Main{

static final PrintWriter out=new PrintWriter(System.out);
static final int INF=Integer.MAX_VALUE/2;
static int[] d={-1,0,1};

static class TPair{
int t;
int x;
int y;
TPair(int t,int x,int y){
this.t=t; this.x=x; this.y=y;
}
}

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
StringTokenizer st=new StringTokenizer(line);
int h=Integer.parseInt(st.nextToken());
int w=Integer.parseInt(st.nextToken());
int[][] map=new int[h][w];
for(int i=0;i<h;i++){
line=br.readLine();
for(int j=0;j<w;j++){
map[i][j]=(line.charAt(j)=='.')?INF:(int)(line.charAt(j)-'0');
}
}
out.println(bfs(h,w,map));
out.flush();
}
}

private static int bfs(int h,int w,int[][] map){
Deque<TPair> que=new ArrayDeque<TPair>();
int[][] hmap=new int[h][];
boolean update=true;
int ans=-1;
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if(map[i][j]!=INF) que.offerLast(new TPair(0,i,j));
}
}
while(!que.isEmpty()){
TPair p=que.pollFirst();
if(ans!=p.t){
if(update){
update=false;
for(int i=0;i<h;i++) hmap[i]=map[i].clone();
ans=p.t;
}
else return ans;
}
int x=p.x;
int y=p.y;
int nx;
int ny;
int cnt1=0;
int cnt2=0;
int hxy=hmap[x][y];
loop:
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
if(i==1&&j==1) continue;
nx=x+d[i];
ny=y+d[j];
if(hmap[nx][ny]==INF) cnt1++;
if(hmap[nx][ny]<INF) cnt2++;
if(cnt1>=hxy){
map[x][y]=INF;
update=true;
break loop;
}
if(cnt2>8-hxy){
que.offerLast(new TPair(ans+1,x,y));
break loop;
}
}
}
}
}
}

Compiler output:
Main.java:87: error: missing return statement
}
^
1 error
Language: C

#include<stdio.h>


int h ,w ;

int mx[] = { 1 ,1 ,1 ,-1 ,-1 ,-1 ,0 ,0 } ;
int my[] = { 1 ,-1 ,0 ,1 ,-1 ,0 ,1 ,-1 } ;


char castle[ 1000 ][ 1000 ] ;
char castles[ 1000 ][ 1000 ] ;

char sand[ 1000 ][ 1000 ] ;


int dead ;

char del[ 999 * 999 ][ 2 ] ;
int DEL ;

#define x j + mx[ k ]
#define y i + my[ k ]

#define dy [ 0 ]
#define dx [ 1 ]


void make9( int i ,int j )
{
	int k ;
	for( k = 0 ; k < 8 ; ++k )
	{
		int kale = castle[ y ][ x ] ;

		if( kale < 9 && kale > -1 )
		{
			++castle[ y ][ x ] ;

			if( castle[ y ][ x ] == 9 )
			{
				make9( y ,x ) ;
			}
		}
	}
}

void look9( int H ,int W )
{
	int i ,j ;
	for( i = 1 ; i < H ; ++i )
	{
		for( j = 1 ; j < W ; ++j )
		{
			if( castle[ i ][ j ] == 9 )
			{
				make9( i ,j ) ;
			}
		}
	}
}


void input_del( int i ,int j )
{
	int minus = 0 ;

	int k ;
	for( k = 0 ; k < 8 ; ++k )
	{
		minus += castles[ y ][ x ] ;
	}

	if( castle[ i ][ j ] <= -minus )
	{
		castle[ i ][ j ] = 0 ;

		del[ DEL ] dy = i ;
		del[ DEL ] dx = j ;

		++DEL ;
	}
}

void undo( int H ,int W )
{
	int i ,j ;
	for( i = 1 ; i < H ; ++i )
	{
		for( j = 1 ; j < W ; ++j )
		{
			if( castle[ i ][ j ] < 9 )
			{
				castle[ i ][ j ] = castles[ i ][ j ] ;
			}

			if( castle[ i ][ j ] > 0 )
			{
				castles[ i ][ j ] = 0 ;

				if( castle[ i ][ j ] == 9 )
				{
					--dead ;
				}
			}
		}
	}
}

void update( int i ,int j )
{
	--dead ;

	castles[ i ][ j ] = -1 ;

	int k ;
	for( k = 0 ; k < 8 ; ++k )
	{
		if( castle[ y ][ x ] < 9 && castle[ y ][ x ] > 0 )
		{
			input_del( y ,x ) ;
		}
	}
}


//	castle checker
void check( int i = 0 ,int j = 0 )
{
	puts( "" ) ;

	while( i < h )
	{
		while( j < w )
		{
			printf( "%2d" ,castle[ i ][ j++ ] ) ;
		}

		++i ; j = 0 ;

		puts( "" ) ;
	}

	puts( "" ) ;
}

//	castles checker
void checks( int i = 0 ,int j = 0 )
{
	puts( "" ) ;

	while( i < h )
	{
		while( j < w )
		{
			printf( "%2d" ,castles[ i ][ j++ ] ) ;
		}

		++i ; j = 0 ;

		puts( "" ) ;
	}

	puts( "" ) ;
}


int main()
{
	scanf( "%d %d" ,&h ,&w ) ;

	int i ,j ;
	for( i = 0 ; i < h ; ++i )
	{
		getchar() ;

		for( j = 0 ; j < w ; ++j )
		{
			char c = getchar() ;

			if( c == '.' )
			{
				castles[ i ][ j ] = castle[ i ][ j ] = -1 ;
			}

			else
			{
				++dead ;

				castles[ i ][ j ] = castle[ i ][ j ] = c - '0' ;
			}
		}
	}


	look9( h - 1 ,w - 1 ) ;

	undo( h - 1 ,w - 1 ) ;


	for( i = 1 ; i < h - 1 ; ++i )
	{
		for( j = 1 ; j < w - 1 ; ++j )
		{
			if( castle[ i ][ j ] > 0 && castle[ i ][ j ] < 9 )
			{
				input_del( i ,j ) ;
			}
		}
	}


	int ans = 0 ;

	int next_del = 0 ;

	while( dead )
	{
		++ans ;
		
		int limit = DEL ;
		for( i = next_del ,next_del = limit ; i < limit ; ++i )
		{
			if( del[ i ] dy > 0 )
			{
				update( del[ i ] dy ,del[ i ] dx ) ;
			}
		}
	}

	printf( "%d\n" ,ans ) ;
	
	return 0 ;
}

Compiler output:
main.c:127:19: error: expected ';', ',' or ')' before '=' token
  127 | void check( int i = 0 ,int j = 0 )
      |                   ^
main.c:147:20: error: expected ';', ',' or ')' before '=' token
  147 | void checks( int i = 0 ,int j = 0 )
      |                    ^
Language: C++

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

string S[2000];
int x[2000][2000];
int z[2000][2000];

int main() {
	int n, m;
	char T[10] = { '.','1','2','3','4','5','6','7','8','9' };
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		cin >> S[i];
		for (int j = 0; j < m; j++) {
			for (int k = 0; k < 10; k++) {
				if (S[i][j] == T[k]) {
					x[i][j] = k;
				}
			}
		}
	}
	int t = 1;
	int p = 0;
	int sum=0;
	while (t != 0) {
		memset(z, 0, sizeof(z));
		t = 0;
		sum++;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				if (x[i][j] >= 1) {
					p = 0;
					for (int k = -1; k <= 1; k++) {
						for (int l = -1; l <= 1; l++) {
							if (x[i + k][j + l] == 0) {
								p++;
							}
						}
					}
					if (p >= x[i][j]) {
						z[i][j] = 1;
						t++;
					}
				}
			}
		}
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				if (z[i][j] == 1) {
					x[i][j] = 0;
				}
			}
		}
	}
	cout << sum-1 << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:17: error: 'memset' was not declared in this scope
   27 |                 memset(z, 0, sizeof(z));
      |                 ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<iostream>
  +++ |+#include <cstring>
    2 | #include<string>
Language: C++

// JOI14-quest5.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

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

int height, width;
int beach[1000][1000] = { 0 };

using namespace std;
queue<int> que_i, que_j;

int power(int i, int j) {
	int count = 0;

	if (beach[i - 1][j] == 0) {
		count++;
	}
	if (beach[i][j + 1] == 0) {
		count++;
	}
	if (beach[i + 1][j] == 0) {
		count++;
	}
	if (beach[i][j - 1] == 0) {
		count++;
	}

	if (beach[i - 1][j + 1] == 0) {
		count++;
	}
	if (beach[i + 1][j + 1] == 0) {
		count++;
	}
	if (beach[i + 1][j - 1] == 0) {
		count++;
	}
	if (beach[i - 1][j - 1] == 0) {
		count++;
	}

	return count;
}

void around(int i, int j) {
	if (beach[i - 1][j] != 0) {
		if (beach[i - 1][j] <= power(i - 1, j)) {
			que_i.push(i - 1);
			que_j.push(j);
		}
	}
	if (beach[i][j + 1] != 0) {
		if (beach[i][j + 1] <= power(i, j + 1)) {
			que_i.push(i);
			que_j.push(j + 1);
		}
	}
	if (beach[i + 1][j] != 0) {
		if (beach[i + 1][j] <= power(i + 1, j)) {
			que_i.push(i + 1);
			que_j.push(j);
		}
	}
	if (beach[i][j - 1] != 0) {
		if (beach[i][j - 1] <= power(i, j - 1)) {
			que_i.push(i);
			que_j.push(j - 1);
		}
	}

	if (beach[i - 1][j + 1] != 0) {
		if (beach[i - 1][j + 1] <= power(i - 1, j + 1)) {
			que_i.push(i - 1);
			que_j.push(j + 1);
		}
	}
	if (beach[i + 1][j + 1] != 0) {
		if (beach[i + 1][j + 1] <= power(i + 1, j + 1)) {
			que_i.push(i + 1);
			que_j.push(j + 1);
		}
	}
	if (beach[i + 1][j - 1] != 0) {
		if (beach[i + 1][j - 1] <= power(i + 1, j - 1)) {
			que_i.push(i + 1);
			que_j.push(j - 1);
		}
	}
	if (beach[i - 1][j - 1] != 0) {
		if (beach[i - 1][j - 1] <= power(i - 1, j - 1)) {
			que_i.push(i - 1);
			que_j.push(j - 1);
		}
	}
}

int _tmain(int argc, _TCHAR* argv[])
{
	

	scanf("%d %d", &height, &width);

	char c;
	for (int i = 0; i < height; i++) {
		for (int j = 0; j < width; j++) {
			c = getchar();
			if (c == '\n') {
				j--;
				continue;
			}
			else if (c == '.') {
				beach[i][j] = 0;
			}
			else {
				beach[i][j] = c - 48;
			}
		}
	}

	for (int i = 0; i < height; i++) {
		for (int j = 0; j < width; j++) {
			if (beach[i][j] != 0) {
				if (beach[i][j] <= power(i, j)) {
					que_i.push(i);
					que_j.push(j);
				}
			}
		}
	}

	int wave = 0, x[1000], y[1000], count, save, size;
	while (que_i.empty() == false) {
		wave++;
		count = 0;
		size = que_i.size();
		for (int i = 0; i < size; i++) {
			if (beach[que_i.front()][que_j.front()] != 0) {
				
				beach[que_i.front()][que_j.front()] = 0;
				y[count] = que_i.front();
				x[count] = que_j.front();
				count++;
			}
			que_i.pop();
			que_j.pop();
		}

		for (int i = 0; i < count; i++) {
			around(y[i], x[i]);
		}
	}

	printf("%d\n", wave);

	return 0;
}

Compiler output:
a.cc:98:22: error: '_TCHAR' has not been declared
   98 | int _tmain(int argc, _TCHAR* argv[])
      |                      ^~~~~~
Language: C++

#include <iostream>
#include <cstdlib>
#include <queue>
#include <Windows.h>

using namespace std;

int x, y;
char m[1024][1024];
int map[1024][1024];
queue<pair<int, pair<int, int> > > q;
pair<int, pair<int, int> > temp;


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

void check_map() {

	for (int i = 0; i < y; i++) {
		for (int i1 = 0; i1 < x; i1++) {
			int cnt = 0;
			if (m[i][i1] == '.') {
				map[i][i1] = 0;
				q.push(make_pair(0, make_pair(i, i1)));
			}
			else {
				map[i][i1] = m[i][i1] - '0';
			}
		}
	}
}

int main()
{
	int cnt = 0;

	cin >> y >> x;

	for (int i = 0; i < y; i++) {
		for (int i1 = 0; i1 < x; i1++) {
			cin >> m[i][i1];
		}
	}

	check_map();
		
	while (!q.empty()) {

		temp = q.front();

		q.pop();

		cnt = temp.first;

		for (int i = 0; i < 8; i++) {
			if ((map[temp.second.first + dy[i]][temp.second.second + dx[i]] -= 1) == 0)
				q.push(make_pair(temp.first + 1, make_pair(temp.second.first + dy[i], temp.second.second + dx[i])));
		}

	}

	cout << cnt << endl;
	return 0;
}

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

#include <queue>
#include <cstdio>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>

#pragma warning(disable : 4996)

#define INF 1000000000

using namespace std;

const vector<int> dx = { 0, 1, 1, 1, 0, -1, -1, -1 };
const vector<int> dy = { -1, -1, 0, 1, 1, 1, 0, -1 };

int H, W; vector<string> M;

vector<vector<int> > state;

int check(int x, int y, int s)
{
	int ret = 0;

	for (int dir = 0; dir < 8; dir++)
	{
		if (state[y + dy[dir]][x + dx[dir]] < s || M[y + dy[dir]][x + dx[dir]] == '.')
		{
			ret++;
		}
	}

	return ret;
}

int main()
{
	scanf("%d", &H);
	scanf("%d", &W);

	M = vector<string>(H);

	for (int i = 0; i < H; i++) cin >> M[i];

	state = vector<vector<int> >(H, vector<int>(W, INF));

	queue<pair<int, int> > que;

	for (int i = 1; i < H - 1; i++)
	{
		for (int j = 1; j < W - 1; j++)
		{
			if (check(j, i, 1) >= M[i][j] - 48 && M[i][j] != '.')
			{
				que.push(make_pair(j, i)); state[i][j] = 1;
			}
		}
	}

	while (!que.empty())
	{
		int x = que.front().first;
		int y = que.front().second; que.pop();

		for (int dir = 0; dir < 8; dir++)
		{
			int x2 = x + dx[dir];
			int y2 = y + dy[dir];

			if (state[y2][x2] == INF && M[y2][x2] != '.' && check(x2, y2) >= M[y2][x2])
			{
				state[y2][x2] = state[y][x] + 1;

				que.push(make_pair(x2, y2));
			}
		}
	}

	int ret = 0;

	for (int i = 1; i < H - 1; i++)
	{
		for (int j = 1; j < W - 1; j++)
		{
			if (state[i][j] != INF)
			{
				ret = max(ret, state[i][j]);
			}
		}
	}

	printf("%d\n", ret);

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:70:78: error: too few arguments to function 'int check(int, int, int)'
   70 |                         if (state[y2][x2] == INF && M[y2][x2] != '.' && check(x2, y2) >= M[y2][x2])
      |                                                                         ~~~~~^~~~~~~~
a.cc:21:5: note: declared here
   21 | int check(int x, int y, int s)
      |     ^~~~~
Language: C++

#include <cstdio>
#include <algorithm>
#include <queue>
using namespace std;
 
int h, w, ans;
int castle[1001][1001], times[1001][1001];
int dx[] = {-1, 0, 1, -1, 1, -1, 0, 1}, dy[] = {-1, -1, -1, 0, 0, 1, 1, 1};
char beach[1001][1001];
 
int main(){
    scanf("%d%d", &h, &w);
    for(int i = 0; i < h; i++){
        scanf("%s", &beach[i]);
    }
 
    queue< pair<int, int> > Q;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            if(beach[i][j] == '.'){
                Q.push(P(i, j));
            } else{
                castle[i][j] = beach[i][j] - '0';
            }
        }
    }
 
    while(Q.size()){
        P p = Q.front();
        Q.pop();
        ans = max(ans, times[p.first][p.second]);
 
        for(int i = 0; i < 8; i++){
            int y = p.first + dy[i], x = p.second + dx[i];
            if(y < 0 || y >= h || x < 0 || x >= w){
                continue;
            }
 
            castle[y][x]--;
            if(castle[y][x] == 0){
                Q.push(P(y, x));
                times[y][x] = times[p.first][p.second] + 1;
            }
        }
    }
 
    printf("%d\n", ans);
 
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:24: error: 'P' was not declared in this scope
   21 |                 Q.push(P(i, j));
      |                        ^
a.cc:29:9: error: 'P' was not declared in this scope
   29 |         P p = Q.front();
      |         ^
a.cc:31:30: error: 'p' was not declared in this scope
   31 |         ans = max(ans, times[p.first][p.second]);
      |                              ^
a.cc:35:35: error: 'x' was not declared in this scope
   35 |             if(y < 0 || y >= h || x < 0 || x >= w){
      |                                   ^
a.cc:39:23: error: 'x' was not declared in this scope
   39 |             castle[y][x]--;
      |                       ^
Language: C++

#include <cstdio>
#include <algorithm>
#include <queue>
using namespace std;
 
int h, w, ans;
int castle[1001][1001], times[1001][1001];
int dx[] = {-1, 0, 1, -1, 1, -1, 0, 1}, dy[] = {-1, -1, -1, 0, 0, 1, 1, 1};
char beach[1001][1001];
 
int main(){
    scanf("%d%d", &h, &w);
    for(int i = 0; i < h; i++){
        scanf("%s", &beach[i]);
    }
 
    queue< pair<int, int> > Q;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            if(beach[i][j] == '.'){
                Q.push(P(i, j));
            } else{
                castle[i][j] = beach[i][j] - '0';
            }
        }
    }
 
    while(Q.size()){
        pair<int, int> p = Q.front();
        Q.pop();
        ans = max(ans, times[p.first][p.second]);
 
        for(int i = 0; i < 8; i++){
            int y = p.first + dy[i], x = p.second + dx[i];
            if(y < 0 || y >= h || x < 0 || x >= w){
                continue;
            }
 
            castle[y][x]--;
            if(castle[y][x] == 0){
                Q.push(P(y, x));
                times[y][x] = times[p.first][p.second] + 1;
            }
        }
    }
 
    printf("%d\n", ans);
 
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:24: error: 'P' was not declared in this scope
   21 |                 Q.push(P(i, j));
      |                        ^
a.cc:41:24: error: 'P' was not declared in this scope
   41 |                 Q.push(P(y, x));
      |                        ^
Language: C++

#include "iostream"
#include "queue"
#include "Utility"
#include "math.h"

using namespace std;
int H, W;
char status[1002][1002];
int field[1002][1002];
pair<int, int> dir[8] = {make_pair(0,1),make_pair(1,1),make_pair(1,0),make_pair(1,-1),make_pair(0,-1),make_pair(-1,-1),make_pair(-1,0),make_pair(-1,1)};
queue<pair<int,int> > Q;
queue<pair<int, int> >del;
int ans = 0;
int box = 0;
int num = 0;
int x, y;

int main() {
	cin >> H >>W;
	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			cin >> status[i][j];
			if (status[i][j] == '.') {
				field[i][j] = 0;
			}
			else {
				field[i][j] = status[i][j] - '0';
			}
		}
	}
	/*for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			cout << field[i][j];
		}
		cout << "\n";
	}
	cout << "\n";*/
	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			box = 0;
			if (field[i][j] != 0) {
				for (int k = 0; k < 8; k++) {
					if (field[i + dir[k].first][j + dir[k].second] == 0)box++;
				}
				if (box >= field[i][j]) {
					Q.push(make_pair(i, j));
					ans = 1;
				}
			}
		}
	}
	del = Q;
	while (!del.empty()) {
		y = del.front().first;
		x = del.front().second;
		field[y][x] = 0;
		del.pop();
	}
	while (1) {
		/*for (int i = 1; i <= H; i++) {
			for (int j = 1; j <= W; j++) {
				cout << field[i][j];
			}
			cout << "\n";
		}
		cout << "\n";*/
		num = Q.size();
		for (int i = 0; i < num; i++) {
			y = Q.front().first;
			x = Q.front().second;
			for (int j = 0; j < 8; j++) {
				if (field[y + dir[j].first][x + dir[j].second] != 0) {
					box = 0;
					for (int k = 0; k < 8; k++) {
						if (field[y + dir[j].first + dir[k].first][x + dir[j].second + dir[k].second] == 0)box++;
					}
					if (box >= field[y + dir[j].first][x + dir[j].second]) {
						Q.push(make_pair(y + dir[j].first, x + dir[j].second));
					}
				}
			}
			Q.pop();
		}
		if (Q.empty())break;
		ans++;
		del = Q;
		while (!del.empty()) {
			y = del.front().first;
			x = del.front().second;
			field[y][x] = 0;
			del.pop();
		}
	}
	cout << ans << "\n";
	return 0;
}

Compiler output:
a.cc:3:10: fatal error: Utility: No such file or directory
    3 | #include "Utility"
      |          ^~~~~~~~~
compilation terminated.
Language: C++

#include <cstdio>
#include <algorithm>
#include <queue>
using namespace std;
typedef pair<int, int> P;
 
int h, w, ans;
int castle[1001][1001], times[1001][1001];
int dx[] = {-1, 0, 1, -1, 1, -1, 0, 1}, dy[] = {-1, -1, -1, 0, 0, 1, 1, 1};
char beach[1001][1001];
 
inline int input(){
	int temp;
	scanf("%d", &temp);
	return temp;
}

int main(){
    h = input();
	w = input();
    for(int i = 0; i < h; i++){
        beach[i] = input();
    }
 
    queue<P> Q;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            if(beach[i][j] == '.'){
                Q.push(P(i, j));
            } else{
                castle[i][j] = beach[i][j] - '0';
            }
        }
    }
 
    while(Q.size()){
        P p = Q.front();
        Q.pop();
        ans = max(ans, times[p.first][p.second]);
 
        for(int i = 0; i < 8; i++){
            int y = p.first + dy[i], x = p.second + dx[i];
            if(y < 0 || y >= h || x < 0 || x >= w){
                continue;
            }
 
            castle[y][x]--;
            if(castle[y][x] == 0){
                Q.push(P(y, x));
                times[y][x] = times[p.first][p.second] + 1;
            }
        }
    }
 
    printf("%d\n", ans);
 
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:18: error: incompatible types in assignment of 'int' to 'char [1001]'
   22 |         beach[i] = input();
      |         ~~~~~~~~~^~~~~~~~~
Language: C++

#include <cstdio>
#include <algorithm>
#include <queue>
using namespace std;
typedef pair<int, int> P;
 
int h, w, ans;
int castle[1001][1001], times[1001][1001];
int dx[] = {-1, 0, 1, -1, 1, -1, 0, 1}, dy[] = {-1, -1, -1, 0, 0, 1, 1, 1};
char beach[1001][1001];
 
inline int input_i(){
	int temp;
	scanf("%d", &temp);
	return temp;
}

inline char input_c(){
	char temp;
	scanf("%c", &temp);
	return temp;
}


int main(){
    h = input_i();
    w = input_i();
    for(int i = 0; i < h; i++){
        beach[i] = input_c();
    }
 
    queue<P> Q;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            if(beach[i][j] == '.'){
                Q.push(P(i, j));
            } else{
                castle[i][j] = beach[i][j] - '0';
            }
        }
    }
 
    while(Q.size()){
        P p = Q.front();
        Q.pop();
        ans = max(ans, times[p.first][p.second]);
 
        for(int i = 0; i < 8; i++){
            int y = p.first + dy[i], x = p.second + dx[i];
            if(y < 0 || y >= h || x < 0 || x >= w){
                continue;
            }
 
            castle[y][x]--;
            if(castle[y][x] == 0){
                Q.push(P(y, x));
                times[y][x] = times[p.first][p.second] + 1;
            }
        }
    }
 
    printf("%d\n", ans);
 
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:18: error: incompatible types in assignment of 'char' to 'char [1001]'
   29 |         beach[i] = input_c();
      |         ~~~~~~~~~^~~~~~~~~~~
Language: C++

#include <cstdio>
#include <algorithm>
#include <queue>
using namespace std;
typedef pair<int, int> P;
 
int h, w, ans;
int castle[1001][1001], times[1001][1001];
int dx[] = {-1, 0, 1, -1, 1, -1, 0, 1}, dy[] = {-1, -1, -1, 0, 0, 1, 1, 1};
char beach[1001][1001];
 
inline int input_i(){
	int temp;
	scanf("%d", &temp);
	return temp;
}

inline string input_c(){
	string temp;
	scanf("%s", temp);
	return temp;
}


int main(){
    h = input_i();
    w = input_i();
    for(int i = 0; i < h; i++){
        beach[i] = input_s();
    }
 
    queue<P> Q;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            if(beach[i][j] == '.'){
                Q.push(P(i, j));
            } else{
                castle[i][j] = beach[i][j] - '0';
            }
        }
    }
 
    while(Q.size()){
        P p = Q.front();
        Q.pop();
        ans = max(ans, times[p.first][p.second]);
 
        for(int i = 0; i < 8; i++){
            int y = p.first + dy[i], x = p.second + dx[i];
            if(y < 0 || y >= h || x < 0 || x >= w){
                continue;
            }
 
            castle[y][x]--;
            if(castle[y][x] == 0){
                Q.push(P(y, x));
                times[y][x] = times[p.first][p.second] + 1;
            }
        }
    }
 
    printf("%d\n", ans);
 
    return 0;
}

Compiler output:
a.cc:18:8: error: 'string' does not name a type; did you mean 'stdin'?
   18 | inline string input_c(){
      |        ^~~~~~
      |        stdin
a.cc: In function 'int main()':
a.cc:29:20: error: 'input_s' was not declared in this scope; did you mean 'input_i'?
   29 |         beach[i] = input_s();
      |                    ^~~~~~~
      |                    input_i
Language: C++

#include <cstdio>
#include <algorithm>
#include <queue>
using namespace std;
typedef pair<int, int> P;
 
int h, w, ans;
int castle[1001][1001], times[1001][1001];
int dx[] = {-1, 0, 1, -1, 1, -1, 0, 1}, dy[] = {-1, -1, -1, 0, 0, 1, 1, 1};
char beach[1001][1001];
 
inline int input_i(){
	int temp;
	scanf("%d", &temp);
	return temp;
}

inline string input_s(){
	string temp;
	scanf("%s", temp);
	return temp;
}


int main(){
    h = input_i();
    w = input_i();
    for(int i = 0; i < h; i++){
        beach[i] = input_s();
    }
 
    queue<P> Q;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            if(beach[i][j] == '.'){
                Q.push(P(i, j));
            } else{
                castle[i][j] = beach[i][j] - '0';
            }
        }
    }
 
    while(Q.size()){
        P p = Q.front();
        Q.pop();
        ans = max(ans, times[p.first][p.second]);
 
        for(int i = 0; i < 8; i++){
            int y = p.first + dy[i], x = p.second + dx[i];
            if(y < 0 || y >= h || x < 0 || x >= w){
                continue;
            }
 
            castle[y][x]--;
            if(castle[y][x] == 0){
                Q.push(P(y, x));
                times[y][x] = times[p.first][p.second] + 1;
            }
        }
    }
 
    printf("%d\n", ans);
 
    return 0;
}

Compiler output:
a.cc:18:8: error: 'string' does not name a type; did you mean 'stdin'?
   18 | inline string input_s(){
      |        ^~~~~~
      |        stdin
a.cc: In function 'int main()':
a.cc:29:20: error: 'input_s' was not declared in this scope; did you mean 'input_i'?
   29 |         beach[i] = input_s();
      |                    ^~~~~~~
      |                    input_i
Language: C++

#include <cstdio>
#include <string>
#include <algorithm>
#include <queue>
using namespace std;
typedef pair<int, int> P;
 
int h, w, ans;
int castle[1001][1001], times[1001][1001];
int dx[] = {-1, 0, 1, -1, 1, -1, 0, 1}, dy[] = {-1, -1, -1, 0, 0, 1, 1, 1};
char beach[1001][1001];
 
inline int input_i(){
	int temp;
	scanf("%d", &temp);
	return temp;
}

inline string input_s(){
	string temp;
	scanf("%s", temp);
	return temp;
}


int main(){
    h = input_i();
    w = input_i();
    for(int i = 0; i < h; i++){
        beach[i] = input_s();
    }
 
    queue<P> Q;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            if(beach[i][j] == '.'){
                Q.push(P(i, j));
            } else{
                castle[i][j] = beach[i][j] - '0';
            }
        }
    }
 
    while(Q.size()){
        P p = Q.front();
        Q.pop();
        ans = max(ans, times[p.first][p.second]);
 
        for(int i = 0; i < 8; i++){
            int y = p.first + dy[i], x = p.second + dx[i];
            if(y < 0 || y >= h || x < 0 || x >= w){
                continue;
            }
 
            castle[y][x]--;
            if(castle[y][x] == 0){
                Q.push(P(y, x));
                times[y][x] = times[p.first][p.second] + 1;
            }
        }
    }
 
    printf("%d\n", ans);
 
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:18: error: incompatible types in assignment of 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'char [1001]'
   30 |         beach[i] = input_s();
      |         ~~~~~~~~~^~~~~~~~~~~
Language: C++

#include <queue>
#include <string>
#include <iostream>
using namespace std;
struct state { int x, y; };
int dx[] = { 0, 1, 1, 1, 0, -1, -1, -1 };
int dy[] = { 1, 1, 0, -1, -1, -1, 0, 1 };
int H, W, dist[1009][1009]; string s[1009];
int main() {
	ios::sync_with_stdio(false);
	cin >> H >> W;
	queue<state> que;
	for (int i = 0; i < H; i++) {
		cin >> s[i];
		for (int j = 0; j < W; j++) {
			if (s[i][j] == '.') {
				dist[i][j] = 0;
				que.push(state{ i, j });
			}
			else dist[i][j] = -1;
		}
	}
	int ret = 0;
	while (!que.empty()) {
		state u = que.front(); que.pop();
		ret = max(ret, dist[u.x][u.y]);
		for (int i = 0; i < 8; i++) {
			int tx = u.x + dx[i], ty = u.y + dy[i];
			if (0 <= tx && tx < H && 0 <= ty && ty < W && dist[tx][ty] == -1) {
				vector<int> v;
				for (int j = 0; j < 8; j++) {
					int rx = tx + dx[j], ry = ty + dy[j];
					if (0 <= rx && rx < H && 0 <= ry && ry < W && dist[rx][ry] != -1) {
						v.push_back(dist[rx][ry]);
					}
				}
				sort(v.begin(), v.end());
				if (v.size() >= s[tx][ty] - 48) {
					dist[tx][ty] = v[s[tx][ty] - 49] + 1;
					que.push(state{ tx, ty });
				}
			}
		}
	}
	cout << ret << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:33: error: 'sort' was not declared in this scope; did you mean 'short'?
   37 |                                 sort(v.begin(), v.end());
      |                                 ^~~~
      |                                 short
Language: C++

#include <iostream>
#include <utility>
#include <vector>

using namespace std;

int h,w;
char bch[1003][1003];

int bfs ()
{
    int ans=0, cas[1003][1003],c;
    vector<pair<int, int>> que, vec;
    for (int i=1; i<h-1; i++)
    {
        for (int j=1; j<w-1; j++)
        {
            if (bch[i][j]!='.')
            {
                c=0;
                if (bch[i-1][j-1]=='.') c++;
                if (bch[i-1][j]=='.') c++;
                if (bch[i-1][j+1]=='.') c++;
                if (bch[i][j-1]=='.') c++;
                if (bch[i][j+1]=='.') c++;
                if (bch[i+1][j-1]=='.') c++;
                if (bch[i+1][j]=='.') c++;
                if (bch[i+1][j+1]=='.') c++;
                cas[i][j]=cbch[i][j]-'0'-c;
                if (cas[i][j]<=0) que.push_back({i, j});
            }
        }
    }
    while (1)
    {
        if (que.empty())
        {
            ans++;
            for (auto u : vec)
            {
                int i=u.first, j=u.second;
                if (bch[i-1][j-1]!='.') { cas[i-1][j-1]--; if (cas[i-1][j-1]==0) que.push_back({i-1, j-1}); }
                if (bch[i-1][j]!='.') { cas[i-1][j]--; if (cas[i-1][j]==0) que.push_back({i-1, j}); }
                if (bch[i-1][j+1]!='.') { cas[i-1][j+1]--; if (cas[i-1][j+1]==0) que.push_back({i-1, j+1}); }
                if (bch[i][j-1]!='.') { cas[i][j-1]--; if (cas[i][j-1]==0) que.push_back({i, j-1}); }
                if (bch[i][j+1]!='.') { cas[i][j+1]--; if (cas[i][j+1]==0) que.push_back({i, j+1}); }
                if (bch[i+1][j-1]!='.') { cas[i+1][j-1]--; if (cas[i+1][j-1]==0) que.push_back({i+1, j-1}); }
                if (bch[i+1][j]!='.') { cas[i+1][j]--; if (cas[i+1][j]==0) que.push_back({i+1, j}); }
                if (bch[i+1][j+1]!='.') { cas[i+1][j+1]--; if (cas[i+1][j+1]==0) que.push_back({i+1, j+1}); }
            }
            vec.clear();
        }
        if (que.empty()) break;
        vec.swap(que);
    }
    return ans;
}

int main()
{
    cin>>h>>w;
    for (int i=0; i<h; i++) for (int j=0; j<w; j++) cin>>bch[i][j];
    cout<<bfs()<<'\n';
    return 0;
}



Compiler output:
a.cc: In function 'int bfs()':
a.cc:29:27: error: 'cbch' was not declared in this scope; did you mean 'bch'?
   29 |                 cas[i][j]=cbch[i][j]-'0'-c;
      |                           ^~~~
      |                           bch
Language: C++

#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define MMP(a, b, c) make_pair(make_pair(a, b), c)
#define MAX 1000000000
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN (LL)-9223372036854775807
#define LL_MAX (LL)9223372036854775807
#define PI 3.14159265359

//最大値 セグメント木
struct SegmentTree{
private:
	vector<LL> nodes;
	int n;
public:
	void reset(int N){ //初期化する O(N)
		nodes.clear();
		n = 1;
		while(n < N) n *= 2;
		n = 2 * n -1;
		for(int i=0; i<n; i++) nodes.push_back(LL_MIN);
	}
	void update(int i, LL x){ //値を変更する O(log N)
		i += n / 2;
		nodes[i] = x;
		while(i > 0){
			i = (i-1)/2; //親の取得は(i-1)/2
			nodes[i] = max(nodes[i*2+1], nodes[i*2+2]); //子の取得はi*2+1,i*2+2
		}
	}
	LL maximum(int a, int b){ //[a,b)の最大値を求める O(log N)
		return query(a, b, 0, 0, n/2+1);
	}
private:
	LL query(int a, int b, int k, int l, int r){
		if(r <= a || b <= l) return LL_MIN; //交差する場合
		if(a <= l && r <= b) return nodes[k]; //完全に含む場合
		LL valueL = query(a, b, k*2+1, l, (l+r)/2);
		LL valueR = query(a, b, k*2+2, (l+r)/2, r);
		return max(valueL, valueR);
	}
};

int N;
LL D;
LL X[30],Y[30];
SegmentTree st;
LL ans;

vector<pair<LL,LL> > mae; //X_b-X_a , Y_b-X_b
void mae_search(int now, LL f, LL s){
	if(now == N/2){
		mae.push_back(MP(f,s));
		return;
	}
	mae_search(now+1, f, s);
	mae_search(now+1, f-X[now], s-Y[now]);
	mae_search(now+1, f+X[now], s+Y[now]);
}

void ato_search(int now, LL f, LL s){
	if(now == N){
		int a = lower_bound(mae.begin(), mae.end(), MP(-D-f, (LL)0) ) - mae.begin();
		int b = upper_bound(mae.begin(), mae.end(), MP(D-f, LL_MAX) ) - mae.begin();
		//ans = max(ans, st.maximum(a, b));
		for(auto itr=a; itr!=b; itr++){
			ans = max(ans, s+itr->second);
		}
		return;
	}
	ato_search(now+1, f, s);
	ato_search(now+1, f-X[now], s-Y[now]);
	ato_search(now+1, f+X[now], s+Y[now]);
}

int main() {
	iostream::sync_with_stdio(false);
	
	cin >> N >> D;
	for(int i=0; i<N; i++) cin >> X[i] >> Y[i];

	mae_search(0, 0, 0);
	sort(mae.begin(), mae.end());
	st.reset(mae.size());
	for(int i=0; i<mae.size(); i++){
		st.update(i, mae[i].second);
	}

	ans = 0;
	ato_search(N/2, 0, 0);

	cout << ans << endl;

	return 0;
}


Compiler output:
a.cc: In function 'void ato_search(int, long long int, long long int)':
a.cc:89:45: error: base operand of '->' is not a pointer
   89 |                         ans = max(ans, s+itr->second);
      |                                             ^~