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

import java.awt.Point;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Deque;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Scanner;

/**
 * @author kumar1
 *
 */
public class B {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		InputStream in = System.in;
		Scanner scanner = new Scanner(in);
		LinkedList<Integer> ans = new LinkedList<Integer>();
		while(true) {
			int w = scanner.nextInt();
			int h = scanner.nextInt();
			if(w == 0 && h == 0)
				break;
			ArrayList<ArrayList<Boolean> > board = new ArrayList<ArrayList<Boolean> >();
			//ArrayList<ArrayList<Boolean> > r_walls = new ArrayList<ArrayList<Boolean> >();
			//ArrayList<ArrayList<Boolean> > b_walls = new ArrayList<ArrayList<Boolean> >();
			ArrayList<Boolean> wallrow = new ArrayList<Boolean>();
			for(int i=0; i < w * 2 + 1; i++)
				wallrow.add(false);
			board.add(wallrow);
			for(int i=0; i < h; i++) {
				ArrayList<Boolean> row = new ArrayList<Boolean>();
				row.add(false);
				for(int j=0; j < w - 1; j++) {
					row.add(true);
					if(scanner.nextInt() == 0)
						row.add(true);
					else
						row.add(false);
				}
				row.add(true);
				row.add(false);
				board.add(row);
				if(i >= h - 1)
					break;
				row = new ArrayList<Boolean>();
				for(int j=0; j < w * 2 + 1; j++) {
					row.add(false);
				}
				for(int j=0; j < w; j++) {
					if(scanner.nextInt() == 0)
						row.set(1 + 2 * j, true);
				}
				board.add(row);
			}
			board.add(wallrow);
			// ここまで入力
			
			Point start = new Point(1, 1);
			Point goal = new Point(w * 2 - 1, h * 2 - 1);
			// 左, 右, 上, 下
			int[] dx = {-1, 1, 0, 0};
			int[] dy = {0, 0, -1, 1};
			int[][] fp = new int[board.size()][board.get(0).size()];
			fp[1][1] = 1;
			Deque<Point> deque = new LinkedList<Point>();
			deque.offer(start);
			while(true) {
				if(deque.isEmpty()) {
					ans.add(0);
					break;
				}
				Point crt = deque.poll();
				if(crt.equals(goal)) {
					ans.add(fp[goal.y][goal.x] / 2 + 1);
					break;
				}
				for(int i=0; i < 4; i++) {
					int nx = crt.x + dx[i];
					int ny = crt.y + dy[i];
					if(board.get(ny).get(nx) == true && fp[ny][nx] == 0) {
						deque.add(new Point(nx, ny));
						fp[ny][nx] = fp[crt.y][crt.x] + 1;
					}
				}
			}
			
		}
		scanner.close();
		
		for(Iterator<Integer> it = ans.iterator(); it.hasNext();)
			System.out.println(it.next());
	}

}

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

#include <stdio.h>

struct box {
	unsigned char up :1 ;
	unsigned char down :1 ;
	unsigned char left :1 ;
	unsigned char right :1 ;
};

#define dprintf(arg1, ... ) printf( arg1, __VA_ARGS__)
//#define dprintf(arg1, ... ) 


void nextpos( char** ppos ) {
	*ppos = strchr( *ppos, ' ' );
	if ( *ppos == NULL ) { return; }
	**ppos = '\0';
	(*ppos)++;
	return;
}

int main(void) {
	
	char format0[256] = "", format1[256] = " ";
	
	
	while(1) {
		int width, height;
		scanf("%d %d\n", &width, &height);
		if ( width == 0 && height == 0 ) { break; }
		
		struct box test[30][30];
		
		int temp[width];
		for ( int loo=0; loo< (height*2 - 1); loo++ ) {
			if ( loo % 2 == 1 ) {
				
			} else {
				
			}
		}
		
	}
	return 0;
}

Compiler output:
main.c: In function 'nextpos':
main.c:15:17: error: implicit declaration of function 'strchr' [-Wimplicit-function-declaration]
   15 |         *ppos = strchr( *ppos, ' ' );
      |                 ^~~~~~
main.c:2:1: note: include '<string.h>' or provide a declaration of 'strchr'
    1 | #include <stdio.h>
  +++ |+#include <string.h>
    2 | 
main.c:15:17: warning: incompatible implicit declaration of built-in function 'strchr' [-Wbuiltin-declaration-mismatch]
   15 |         *ppos = strchr( *ppos, ' ' );
      |                 ^~~~~~
main.c:15:17: note: include '<string.h>' or provide a declaration of 'strchr'
Language: C

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

typedef pair<int,int> P;

int main(){
  int w,h;
  bool vw[50][50],pw[50][50];
  int grid[50][50];

  while(cin >> w >>h , w||h){
    for(int i=0;i<h;i++){
      for(int j=0;j<w-1;j++)cin >> vw[i][j];
      if(i!=h-1)for(int j=0;j<w;j++)cin >> pw[i][j];
    }

    for(int i=0;i<h;i++)
      for(int j=0;j<w;j++)grid[i][j] = 0;
    
    grid[0][0] = 1;
    queue<P> q;
    q.push(P(0,0));

    while(q.size()){
      P p = q.front(); q.pop();
      int y = p.first, x = p.second;

      if(y==h-1 && x==w-1)break;

      if(0<=y-1 && !pw[y-1][x] && !grid[y-1][x]){
	grid[y-1][x] = grid[y][x]+1;
	q.push(P(y-1,x));
      }
      if(0<=x-1 && !vw[y][x-1] && !grid[y][x-1]){
	grid[y][x-1] = grid[y][x]+1;
	q.push(P(y,x-1));
      }
      if(y+1<h && !pw[y][x] && !grid[y+1][x]){
	grid[y+1][x] = grid[y][x]+1;
	q.push(P(y+1,x));
      }
      if(x+1<w && !vw[y][x] && !grid[y][x+1]){
	grid[y][x+1] = grid[y][x]+1;
	q.push(P(y,x+1));
      }
    }
    cout << grid[h-1][w-1] << endl;
  }
}

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

#include<stdio.h>
#include<string.h>
enum {WEST=1,NORTH=2,EAST=4,SOUTH=8};
int vx[]={-1,0,1,0};
int vy[]={0,-1,0,1};

int w,h;
int map[30][30];
int cost[30][30];
struct Pos{
	int y,x;
};
Pos que[900];
int head,tail;

int main(){
	int tmp;
	struct Pos a,b;
	while(scanf("%d%d",&w,&h)==2&&(w|h)){
		memset(cost,-1,sizeof(cost));
		memset(map,0,sizeof(map));
		for(int i=0;i<2*h-1;i++){
			if(i&1){
				for(int j=0;j<w;j++){
					scanf("%d",&tmp);
					if(tmp==0){
						map[i/2][j] |= SOUTH;
						map[i/2+1][j] |= NORTH;
					}
				}
			}
			else{
				for(int j=0;j<w-1;j++){
					scanf("%d",&tmp);
					if(tmp==0){
						map[i/2][j] |= EAST;
						map[i/2][j+1] |= WEST;
					}
				}
			}
		}
		head=0;
		tail=0;
		a.y=a.x=0;
		cost[0][0]=1;
		que[tail++]=a;
		while(head < tail){
			a= que[head++];
			for(int i=0;i<4;i++){
				b.y = a.y+vy[i];
				b.x = a.x+vx[i];
				if( (map[a.y][a.x]&1<<i) && cost[b.y][b.x]==-1){
					cost[b.y][b.x] = cost[a.y][a.x] + 1;
					que[tail++] = b;
				}
			}
		}
		if(cost[h-1][w-1]!=-1)printf("%d\n",cost[h-1][w-1]);
		else puts("");
	}
	return 0;
}

Compiler output:
main.c:13:1: error: unknown type name 'Pos'; use 'struct' keyword to refer to the type
   13 | Pos que[900];
      | ^~~
      | struct 
main.c: In function 'main':
main.c:46:29: error: incompatible types when assigning to type 'int' from type 'struct Pos'
   46 |                 que[tail++]=a;
      |                             ^
main.c:48:28: error: incompatible types when assigning to type 'struct Pos' from type 'int'
   48 |                         a= que[head++];
      |                            ^~~
main.c:54:55: error: incompatible types when assigning to type 'int' from type 'struct Pos'
   54 |                                         que[tail++] = b;
      |                                                       ^
Language: C

#include<stdio.h>
#include<string.h>
enum {WEST=1,NORTH=2,EAST=4,SOUTH=8};
int vx[]={-1,0,1,0};
int vy[]={0,-1,0,1};

int w,h;
int map[30][30];
int cost[30][30];
struct Pos{
	int y,x;
};
Pos que[900];
int head,tail;

int main(){
	int tmp;
	int i,j;
	struct Pos a,b;
	while(scanf("%d%d",&w,&h)==2&&(w|h)){
		memset(cost,-1,sizeof(cost));
		memset(map,0,sizeof(map));
		for(i=0;i<2*h-1;i++){
			if(i&1){
				for(j=0;j<w;j++){
					scanf("%d",&tmp);
					if(tmp==0){
						map[i/2][j] |= SOUTH;
						map[i/2+1][j] |= NORTH;
					}
				}
			}
			else{
				for(j=0;j<w-1;j++){
					scanf("%d",&tmp);
					if(tmp==0){
						map[i/2][j] |= EAST;
						map[i/2][j+1] |= WEST;
					}
				}
			}
		}
		head=0;
		tail=0;
		a.y=a.x=0;
		cost[0][0]=1;
		que[tail++]=a;
		while(head < tail){
			a= que[head++];
			for(int i=0;i<4;i++){
				b.y = a.y+vy[i];
				b.x = a.x+vx[i];
				if( (map[a.y][a.x]&1<<i) && cost[b.y][b.x]==-1){
					cost[b.y][b.x] = cost[a.y][a.x] + 1;
					que[tail++] = b;
				}
			}
		}
		if(cost[h-1][w-1]!=-1)printf("%d\n",cost[h-1][w-1]);
		else puts("");
	}
	return 0;
}

Compiler output:
main.c:13:1: error: unknown type name 'Pos'; use 'struct' keyword to refer to the type
   13 | Pos que[900];
      | ^~~
      | struct 
main.c: In function 'main':
main.c:47:29: error: incompatible types when assigning to type 'int' from type 'struct Pos'
   47 |                 que[tail++]=a;
      |                             ^
main.c:49:28: error: incompatible types when assigning to type 'struct Pos' from type 'int'
   49 |                         a= que[head++];
      |                            ^~~
main.c:55:55: error: incompatible types when assigning to type 'int' from type 'struct Pos'
   55 |                                         que[tail++] = b;
      |                                                       ^
Language: C

#include <stdio.h>

#define WIDTH_MAX 30
#define HEIGHT_MAX 30

#define next( i ) ( ( ( i ) + 1 ) % ( WIDTH_MAX * HEIGHT_MAX ) )

typedef struct {
	int type;
	int min;
} FIELD;

FIELD field[ WIDTH_MAX * 2 + 1 ][ HEIGHT_MAX * 2 + 1 ] = {};
const int dx[ 4 ] = { -1, 0, 1, 0 }, dy[ 4 ] = { 0, -1, 0, 1 };

int queue[ WIDTH_MAX * HEIGHT_MAX ], front, rear;

int bfs( int, int );

int main( void ) {
	int x, y, w, h;

	for ( x = 1; x <= WIDTH_MAX * 2 - 1; x += 2 )
		field[ x ][ 0 ].type = 1;
	for ( y = 1; y <= HEIGHT_MAX * 2 - 1; y += 2 )
		field[ 0 ][ y ].type = 1;

	for ( ; scanf( "%d %d", &w, &h ), w; printf( "%d\n", bfs( w, h ) ) ) {
		for ( y = 1; y <= h * 2 - 1; y += 2 )
			for ( x = 1; x <= w * 2 - 1; x += 2 )
				field[ x ][ y ].min = 0;
		for ( x = 1; x <= w * 2 - 1; x += 2 )
			field[ x ][ h * 2 ].type = 1;
		for ( y = 1; y <= h * 2 - 1; y += 2 )
			field[ w * 2 ][ y ].type = 1;

		for ( y = 1; y <= h * 2 - 1; y++ )
			for ( x = y % 2 + 1; x <= w * 2 - 1 ; x += 2 )
				scanf( "%d", &field[ x ][ y ].type );
	}

	return 0;
}

int bfs( int w, int h ) {
	int i, x, y, tmp;

	front = rear = 0;

	queue[ rear ] = h * 2 + 2;
	rear = next( rear );

	field[ 1 ][ 1 ].min = 1;

	while ( rear != front ) {
		tmp = queue[ front ];
		front = next( front );

		x = tmp / ( h * 2 + 1 );
		y = tmp % ( h * 2 + 1 );

		if ( x == w * 2 - 1 && y == h * 2 - 1 )
			break;

		for ( i = 4; i--;  ) {
			int nx1 = x + dx[ i ], ny1 = y + dy[ i ], nx2 = nx1 + dx[ i ], ny2 = ny1 + dy[ i ];

			if ( !field[ nx1 ][ ny1 ].type && !field[ nx2 ][ ny2 ].min ) {
				queue[ rear ] = nx2 * ( h * 2 + 1 ) + ny2;
				rear = next( rear );

				field[ nx2 ][ ny2 ].min = field[ x ][ y ].min + 1;
			}
		}
	}

	return field[ w * 2 - 1 ][ h * 2 - 1 ].min != INF ? field[ w * 2 - 1 ][ h * 2 - 1 ].min : 0;
}

Compiler output:
main.c: In function 'bfs':
main.c:77:55: error: 'INF' undeclared (first use in this function)
   77 |         return field[ w * 2 - 1 ][ h * 2 - 1 ].min != INF ? field[ w * 2 - 1 ][ h * 2 - 1 ].min : 0;
      |                                                       ^~~
main.c:77:55: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

//
//  main.cpp
//  AOJ1166
//
//  Created by aki33524 on 2014/07/06.
//  Copyright (c) 2014年 aki33524. All rights reserved.
//

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

typedef pair<int, int> P;
const int INF = 1e8;
int dh[] = {1, 0, -1, 0};
int dw[] = {0, 1, 0, -1};

int W, H;
int d[50][50];
int maze[50][50];

void solve(){
    queue<P> que;
    for(int h=0; h<H; h++)
        for(int w=0; w<W; w++)
            d[h][w] = INF;
    
    que.push(P(0, 0));
    d[0][0] = 1;
    
    while(!que.empty()){
        P p = que.front(); que.pop();
        for(int i=0; i<4; i++){
            int nh = p.first + dh[i];
            int nw = p.second + dw[i];
            if(0<=nh&&nh<H && 0<=nw&&nw<W && !(maze[p.first][p.second]&(1<<i)) && d[nh][nw]==INF){
                que.push(P(nh, nw));
                d[nh][nw] = d[p.first][p.second] + 1;
            }
        }
    }
    cout << (d[H-1][W-1]==INF ? 0 : d[H-1][W-1]) << endl;
}

int main(int argc, const char * argv[]){
    while(cin>>W>>H, W|H){
        memset(maze, 0, sizeof(maze));
        
        for(int h=0; h<H*2-1; h++){
            if(h%2 == 0){
                for(int w=0; w<W-1; w++){
                    int a;
                    cin >> a;
                    if(a){
                        maze[h/2][w] |= (1<<1);
                        maze[h/2][w+1] |= (1<<3);
                    }
                }
            }else{
                for(int w=0; w<W; w++){
                    int a;
                    cin >> a;
                    if(a){
                        maze[h/2][w] |= (1<<0);
                        maze[h/2+1][w] |= (1<<2);
                    }
                }
            }
        }
        solve();
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:48:9: error: 'memset' was not declared in this scope
   48 |         memset(maze, 0, sizeof(maze));
      |         ^~~~~~
a.cc:11:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   10 | #include <queue>
  +++ |+#include <cstring>
   11 | #include <vector>
Language: C++

#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctype.h>
#include <string> 
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
 
using namespace std;
 
// ??????x????????????y????????????
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
 
int meiro[40][40][40][40];
// meiro[a][b][c][d] ... (a, b)??????(c, d)????§???????????£????????????°1??????????????°0
int tesu[40][40];
int issearched[40][40];
int w, h;
 
void tansaku(int a, int b);
 
int main()
{
    while(1){
        cin >> w >> h;
        if(w == 0 && h == 0) break;
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w; j++){
                tesu[i][j] = 0;
                issearched[i][j] = 0;
            }
        }
        for(int i = 0; i < h - 1; i++){
            for(int j = 0; j < w - 1; j++){
                cin >> meiro[j][i][j + 1][i];
                meiro[j + 1][i][j][i] =  meiro[j][i][j + 1][i];
            }
            for(int j = 0; j < w; j++){
                cin >> meiro[j][i][j][i+1];
                meiro[j][i + 1][j][i] = meiro[j][i][j][i+1]
            }
        }
        for(int i = 0; i < w - 1; i++){
            cin >> meiro[i][h - 1][i + 1][h - 1];
            meiro[i + 1][h - 1][i][h - 1] = meiro[i][h - 1][i + 1][h - 1]
        }
        tansaku(0, 0);
        cout << tesu[w - 1][h - 1] << endl;
    }
    return 0;
}
 
void tansaku(int a, int b)
{
    queue<pair<int, int> > qu;
    qu.push(pair<int, int>(a, b));
    tesu[a][b] = 1;
    issearched[a][b] = 1;
    int x, y, next_x, next_y;
    while(1){
        if(qu.empty()) break;
        x = (qu.front()).first;
        y = (qu.front()).second;
        for(int i = 0; i < 4; i++){
            next_x = x + dx[i];
            next_y = y + dy[i];
            if(next_x < 0 || next_x >= w || next_y < 0 || next_y >= h) continue;
            if(issearched[next_x][next_y] == 0 && meiro[x][y][next_x][next_y] == 0){
                issearched[next_x][next_y] = 1;
                tesu[next_x][next_y] = tesu[x][y] + 1;
                qu.push(pair<int, int>(next_x, next_y));
            }
        }
        qu.pop();
    }
    return;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:48:60: error: expected ';' before '}' token
   48 |                 meiro[j][i + 1][j][i] = meiro[j][i][j][i+1]
      |                                                            ^
      |                                                            ;
   49 |             }
      |             ~                                               
a.cc:53:74: error: expected ';' before '}' token
   53 |             meiro[i + 1][h - 1][i][h - 1] = meiro[i][h - 1][i + 1][h - 1]
      |                                                                          ^
      |                                                                          ;
   54 |         }
      |         ~
Language: C++

#include<stdio.h>
#include<iostream>
#include<math.h>
#include<algorithm>
#include<string>
#define pi 3.14159
#define Inf 9999
using namespace std;



int w, h, a[59][59];
void dfs(int y, int x, int step);
int main(){
	while(1) {
		cin >> w >> h;
		if(w == 0 && h == 0) break;
		for(int i = 0; i < 2*h-1; i++) {
			for(int j = 0; j < 2*w-1; j++) {
				if(i % 2 == 0 && j % 2 == 0) a[i][j] = Inf;
				else if(i % 2 == 1 && j % 2 == 1) a[i][j] = Inf;
				else cin >> a[i][j];
			}
		}
		a[0][0] = 1;
		if(a[0][1] == 0) dfs(0, 2, 1);
		if(a[1][0] == 0) dfs(2, 0, 1);
		if(a[2*h-2][2*w-2] == Inf) cout << 0 <<endl;
		else cout << a[2*h-2][2*w-2] <<endl;
	}
	return 0;
}

void dfs(int y, int x, int step) {
	if(y < 0 || x < 0 || y >= 2*h-1 || x >= 2*w-1) return;
	if(step >= a[y][x]) return;
	else {
		step++;
		a[y][x] = step;
		if(x + 1 < 2*w-1) {
			if(a[y][x+1] == 0) dfs(y, x+2, step);
		}
		if(y+1 < 2*h-1) { 
			if(a[y+1][x] == 0) dfs(y+2, x, step);
		if(y - 1 >= 0) {
			if(a[y-1][x] == 0) dfs(y-2, x, step);
		}
		if(x - 1 >= 0) {
			if(a[y][x-1] == 0) dfs(y, x-2, step);
		}
	}
	return;
}

Compiler output:
a.cc: In function 'void dfs(int, int, int)':
a.cc:53:2: error: expected '}' at end of input
   53 | }
      |  ^
a.cc:34:34: note: to match this '{'
   34 | void dfs(int y, int x, int step) {
      |                                  ^
Language: C++

#include<stdio.h>
#include<iostream>
#include<math.h>
#include<algorithm>
#include<string>
#include<utility>
#include<queue>
#define pi 3.14159
#define Inf 99999

using namespace std;
typedef std::pair<int, int> mypair;
int w, h, a[59][59];
queue<mypair> qu;
void bfs(int y, int x, int step);

int main(){
	while(1) {
		cin >> w >> h;
		if(w == 0 && h == 0) break;
		for(int i = 0; i < 2*h-1; i++) {
			for(int j = 0; j < 2*w-1; j++) {
				if(i % 2 == 0 && j % 2 == 0) a[i][j] = Inf;
				else if(i % 2 == 1 && j % 2 == 1) a[i][j] = Inf;
				else cin >> a[i][j];
			}
		}
		a[0][0] = 1;
		if(a[0][1] == 0) qu.push(mypair(0, 2));
		if(a[1][0] == 0) qu.push(mypair(2, 0));
		bfs(qu.front().first, qu.front().second, 1);
		if(a[2*h-2][2*w-2] == Inf) cout << 0 <<endl;
		else cout << a[2*h-2][2*w-2] <<endl;
		}
	}
	return 0;
}

void bfs(int y, int x, int step) {
	qu.pop();
	if(y < 0 || x < 0 || y >= 2*h-1 || x >= 2*w-1) return;
	if(step >= a[y][x]) return;
	else {
		step++;
		a[y][x] = step;
		if(y == 2*h-2 && x == 2*w-2) return;
		if(x + 1 < 2*w-1) {
			if(a[y][x+1] == 0) {
				qu.push(mypair(y, x+2));
				bfs(qu.front().first, qu.front().second, step);
			}
		}
		if(y+1 < 2*h-1) { 
			if(a[y+1][x] == 0) {
				qu.push(mypair(y+2, x));
				bfs(qu.front().first, qu.front().second, step);
			}
		}
		if(y - 1 >= 0) {
			if(a[y-1][x] == 0) {
				qu.push(mypair(y-2, x));
				bfs(qu.front().first, qu.front().second, step);
			}
		}
		if(x - 1 >= 0) {
			if(a[y][x-1] == 0) {
				qu.push(mypair(y, x-2));
				bfs(qu.front().first, qu.front().second, step);
			}
		}
	}
	return;
}

Compiler output:
a.cc:36:9: error: expected unqualified-id before 'return'
   36 |         return 0;
      |         ^~~~~~
a.cc:37:1: error: expected declaration before '}' token
   37 | }
      | ^
Language: C++



#include <iostream>
#include <algorithm>
#include <stdlib.h>
#include <string>
#include <queue>
#include <map>
#include <stack>
using namespace std;
 
int dx[8]={1,-1,0,0,1,1,-1,-1};
int dy[8]={0,0,1,-1,-1,1,-1,1};
 
 
int main() {
int tate,yoko;
while(cin>>yoko>>tate && yoko){
int t[35][35]={0},y[35][35]={0};
for(int i=0;i<2*tate-1;i++){
if(i%2==0){
for(int j=0;j<yoko-1;j++) cin>>y[i/2][j];
}
else{
for(int j=0;j<yoko;j++) cin>>t[i/2][j];
}
}
int su[35][35]={0};
queue<pair<pair<int,int>,int > > qu;
qu.push(make_pair(make_pair(0,0),0));
su[0][0]=1;
int ans;
while(1){
if(qu.size()==0){
ans=-1;
break;
}
pair<pair<int,int>,int > dd=qu.front();
qu.pop();
int t1=dd.first.first,y1=dd.first.second;
if(dd.first.first==tate-1 && dd.first.second==yoko-1){
ans=dd.second;
break;
}
for(int i=0;i<4;i++){
if(0>t1+dx[i] || t1+dx[i]>=tate || 0>y1+dy[i] || y1+dy[i]>=yoko) continue;
if((i==0 && su[t1+dx[i]][y1+dy[i]]==0 && t[t1][y1]==0) ||(i==1 && su[t1+dx[i]][y1+dy[i]]==0 && t[t1+dx[i]][y1+dx[i]]==0)||(i==2 && su[t1+dx[i]][y1+dy[i]]==0 && y[t1][y1]==0) || (i==4 && su[t1+dx[i]][y1+dy[i]]==0 && y[t1+dx[i]][y1+dy[i]]==0) ){
qu.push(make_pair(make_pair(t1+dx[i],y1+dy[i]),dd.second+1));
su[t1+dx[i]][y1+dy[i]]=1;
}

}



}

cout<<ans+1<<endl;
}

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


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.PriorityQueue;

public class Main{

	 static int array[][];
	 static int gi=0,gj=0;
     static	int h,w;
	static int wall_yoko[][];
	static int wall_tate[][];

	 public static void main(String[] args)throws Exception{

	 BufferedReader br = new BufferedReader(new InputStreamReader(System.in));


	 while(true){

    String readLine = br.readLine();
    readLine = readLine.trim();
    String[] num = readLine.split("[\\s]+");

    w = Integer.parseInt(num[0]);
    h = Integer.parseInt(num[1]);

    if(w==0 && h==0)
    	return;


    wall_yoko = new int[h][w-1];
    wall_tate = new int[h-1][w];

    array = new int[h][w];

    for(int i=0;i<h;i++){
    	for(int j=0;j<w;j++){
    			array[i][j]=Integer.MAX_VALUE;
    	}}

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

    	//?¨?????£????????????????
    	readLine= br.readLine();
    	readLine = readLine.trim();
    	String[] yoko = readLine.split("[\\s]+");
    	for(int j=0;j<w-1;j++)
    		wall_yoko[i][j]=Integer.parseInt(yoko[j]);

    	//???????£????????????????
    	if(i<h-1){
    	readLine= br.readLine();
    	readLine = readLine.trim();
    	String[] tate = readLine.split("[\\s]+");
    	for(int j=0;j<w;j++)
    		wall_tate[i][j]=Integer.parseInt(tate[j]);
    	}
    }

    	//?????????????????¢?´¢????§?
        gi=h;
        gj=w;

    	search(0,0,0);

    	if(array[h-1][w-1] == Integer.MAX_VALUE)
    		System.out.println(0);
    	else
    		System.out.println(array[h-1][w-1]);



    	/* array??????????¢????
        for(int i=0;i<h;i++){
	    	for(int j=0;j<w;j++){
	        	System.out.print(" "+array[i][j] );


	    	}System.out.println("");
        }
*/


	 }//while1??????

}

	 public static void search(int i,int j,int count){

		 count++;

		 //??¢?´¢???????????????????????°????????????
		 if(array[i][j] <= count)
			 return;
		 //????????????????????????????????????????????????????????????????°????????????°??????????????´??°
		 if(array[i][j]>count)
			 array[i][j]=count;

		 PriorityQueue<Integer> queue = new PriorityQueue<Integer>();



		 //????????¢?´¢
		 try{
		 if(j+1<w && wall_yoko[i][j]==0)
			 search(i,j+1,count);
		 }catch(Exception e){}

		 //????????¢?´¢

		 try{
		 if(j-1>=0 && wall_yoko[i][j-1]==0)
			 search(i,j-1,count);
		 }catch(Exception e){}

		 //????????¢?´¢
		 try{
		 if(i+1<h && wall_tate[i][j]==0)
			 search(i+1,j,count);
		 }catch(Exception e){}
		 //????????¢?´¢
		 try{
		 if(i-1>=0 &&wall_tate[i-1][j]==0)
				 search(i-1,j,count);
		 }catch(Exception e){}



	 }

}

Compiler output:
a.cc:2:1: error: 'import' does not name a type
    2 | import java.io.BufferedReader;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import java.io.InputStreamReader;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
    4 | import java.util.PriorityQueue;
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: expected unqualified-id before 'public'
    6 | public class Main{
      | ^~~~~~
Language: C++

#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <sstream>
#include <string>
#include <unordered_map>
#include <vector>

#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<i_i, int> p_i;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
template<class T> using vv=vector<vector<T> >;
typedef deque<int> di;
typedef deque<deque<int> > ddi;

int main() {
  vi results;

  while (true) {
    int w, h;
    cin >> w >> h;
    if (w==0) { break; }
    vvi vertical(h, vi(w+1, 1));
    vvi horizontal((h+1), vi(w, 1));
    
    for (int iw = 1; iw < w; iw++) {
      cin >> vertical[0][iw];
    }
    for (int ih = 1; ih < h; ih++) {
      for (int iw_hor = 0 ; iw_hor < w ; iw_hor++) {
        cin >> horizontal[ih][iw_hor];
      }
      for (int iw_ver = 1; iw_ver < w; iw_ver++) {
        cin >> vertical[ih][iw_ver];
      }
    }

    vvi md(h, vi(w, INT_MAX)); // min_distance, INT_MAX: not reached
    md[0][0] = 1;
    ddi bfs = {{0, 0}};
    while (!bfs.empty()) {
      di current = bfs.front(); // {h, w}
      vvi fq_ver = {{1, 1}, {0, -1}}; // wall, grid
      vvi fq_hor = {{1, 1}, {0, -1}}; // wall, grid
      for (auto dir : fq_ver) {
        if (vertical[current[0]][current[1] + dir[0]] == 0 &&
            md[current[0]][current[1] + dir[1]] == INT_MAX) {
          md[current[0]][current[1] + dir[1]] = md[current[0]][current[1]] + 1;
          bfs.push_back({current[0], current[1] + dir[1]});
        }
      }
      for (auto dir : fq_hor) {
        if (horizontal[current[0] + dir[0]][current[1]] == 0 &&
            md[current[0] + dir[1]][current[1]] == INT_MAX) {
          md[current[0] + dir[1]][current[1]] = md[current[0]][current[1]] + 1;
          bfs.push_back({current[0] + dir[1], current[1]});
        }
      }
      bfs.pop_front();
    }
    if (md[h-1][w-1] == INT_MAX) {
      md[h-1][w-1] = 0;
    }
    results.push_back(md[h-1][w-1]);
  }

  for (int i = 0 ; i < results.size() ; i++) {
    printf("%d\n", results[i]);
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:21: error: 'INT_MAX' was not declared in this scope
   54 |     vvi md(h, vi(w, INT_MAX)); // min_distance, INT_MAX: not reached
      |                     ^~~~~~~
a.cc:13:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   12 | #include <vector>
  +++ |+#include <climits>
   13 |
Language: C++

#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <sstream>
#include <string>
#include <unordered_map>
#include <vector>

#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<i_i, int> p_i;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
template<class T> using vv=vector<vector<T> >;
typedef deque<int> di;
typedef deque<deque<int> > ddi;

int main() {
  vi results;

  while (true) {
    int w, h;
    cin >> w >> h;
    if (w==0) { break; }
    vvi vertical(h, vi(w+1, 1));
    vvi horizontal((h+1), vi(w, 1));
    
    for (int iw = 1; iw < w; iw++) {
      cin >> vertical[0][iw];
    }
    for (int ih = 1; ih < h; ih++) {
      for (int iw_hor = 0 ; iw_hor < w ; iw_hor++) {
        cin >> horizontal[ih][iw_hor];
      }
      for (int iw_ver = 1; iw_ver < w; iw_ver++) {
        cin >> vertical[ih][iw_ver];
      }
    }

    vvi md(h, vi(w, INT_MAX)); // min_distance, INT_MAX: not reached
    md[0][0] = 1;
    ddi bfs = {{0, 0}};
    while (!bfs.empty()) {
      di current = bfs.front(); // {h, w}
      vvi fq_ver = {{1, 1}, {0, -1}}; // wall, grid
      vvi fq_hor = {{1, 1}, {0, -1}}; // wall, grid
      for (auto dir : fq_ver) {
        if (vertical[current[0]][current[1] + dir[0]] == 0 &&
            md[current[0]][current[1] + dir[1]] == INT_MAX) {
          md[current[0]][current[1] + dir[1]] = md[current[0]][current[1]] + 1;
          bfs.push_back({current[0], current[1] + dir[1]});
        }
      }
      for (auto dir : fq_hor) {
        if (horizontal[current[0] + dir[0]][current[1]] == 0 &&
            md[current[0] + dir[1]][current[1]] == INT_MAX) {
          md[current[0] + dir[1]][current[1]] = md[current[0]][current[1]] + 1;
          bfs.push_back({current[0] + dir[1], current[1]});
        }
      }
      bfs.pop_front();
    }
    if (md[h-1][w-1] == INT_MAX) {
      md[h-1][w-1] = 0;
    }
    results.push_back(md[h-1][w-1]);
  }

  for (int i = 0 ; i < results.size() ; i++) {
    printf("%d\n", results[i]);
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:55:21: error: 'INT_MAX' was not declared in this scope
   55 |     vvi md(h, vi(w, INT_MAX)); // min_distance, INT_MAX: not reached
      |                     ^~~~~~~
a.cc:14:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   13 | #include <vector>
  +++ |+#include <climits>
   14 |
Language: C++

2 3
 1
0 1
 0
1 0
 1
9 4
 1 0 1 0 0 0 0 0
0 1 1 0 1 1 0 0 0
 1 0 1 1 0 0 0 0
0 0 0 0 0 0 0 1 1
 0 0 0 1 0 0 1 1
0 0 0 0 1 1 0 0 0
 0 0 0 0 0 0 1 0
12 5
 1 0 0 0 0 0 0 0 0 0 0
0 0 0 1 1 0 0 0 0 0 0 0
 1 0 1 0 0 0 0 0 0 0 0
0 0 0 0 0 0 1 1 0 0 0 0
 0 0 1 0 0 1 0 1 0 0 0
0 0 0 1 1 0 1 1 0 1 1 0
 0 0 0 0 0 1 0 0 1 0 0
0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 1 0 0
0 0

Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 2 3
      | ^
Language: C++

#define MYDEBUG
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
???
#ifdef MYDEBUG
#define debug(x) cout<<#x<<": "<<x<<endl 
#else
#define debug(x)
#endif
#define ll long long
#define ull unsigned long long
#define eps 1e-14
#define all(x) x.begin(), x.end()
using namespace std;
???
template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
  out << "[";
  size_t last = v.size() - 1;
  for (size_t i = 0; i < v.size(); ++i) {
    out << v[i];
    if (i != last)
      out << ",";
  }
  out << "]";
  return out;
}
???
int W,H;
const int MAXW = 30*2+1;
int cnt[MAXW][MAXW];
int ng[MAXW][MAXW];
int di[4] = {-2,0,2,0};
int dj[4] = {0,2,0,-2};
int W2,H2;
???
void bfs(int si, int sj, int gi, int gj){
	queue<int> qi;
	queue<int> qj;
	qi.push(si);
	qj.push(sj);
	while(!qi.empty()){
		int i = qi.front(), j = qj.front();
		qi.pop(); qj.pop();
		if(i==gi&&j==gj) return;
		for(int k=0; k<4; ++k){
			int ni=i+di[k], nj=j+dj[k];
			if(0<=ni&&ni<H2&&0<=nj&&nj<W2&&//???????????????????????????
			cnt[ni][nj]==0&&//????¨????(=0)????????¢?´¢
			ng[i+di[k]/2][j+dj[k]/2]==0){//???????£?????????????(i??¨i+2?????????i+2/2)
				qi.push(ni);
				qj.push(nj);
				cnt[ni][nj]=cnt[i][j]+1;
			}
		}
	}
}
???
void solve(){
	//ifstream cin("/storage/emulated/0/AppProjects/AtCoder/jni/in.txt");
	while(true){
		cin >> W >> H;
		if(W==0&&H==0) return;
		W2=2*W-1;
		H2=2*H-1;
		for(int i=0; i<MAXW; ++i){
			for(int j=0; j<MAXW; ++j){
				ng[i][j]=0;
				cnt[i][j]=0;
			}
		}
		for(int i=0; i<H; ++i){
			for(int j=0; j<W-1; j++){//v
				cin >> ng[i*2][j*2+1];
			}
			if(i==H-1) break;
			for(int j=0; j<W; j++){//h
				cin >> ng[i*2+1][j*2];
			}
		}
		bfs(0,0,H2-1, W2-1);
		int ans = cnt[H2-1][W2-1];
		if(ans>0) ans++;
		cout << ans << endl;
	}
}
???
int main() {
	solve();
}

Compiler output:
a.cc:12:1: error: expected unqualified-id before '?' token
   12 | ???
      | ^
a.cc:23:1: error: expected unqualified-id before '?' token
   23 | ???
      | ^
a.cc:36:1: error: expected unqualified-id before '?' token
   36 | ???
      | ^
a.cc:44:1: error: expected unqualified-id before '?' token
   44 | ???
      | ^
a.cc:66:1: error: expected unqualified-id before '?' token
   66 | ???
      | ^
a.cc:95:1: error: expected unqualified-id before '?' token
   95 | ???
      | ^
Language: C++

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

int main(){
  int w,h;
  int map[30][30];		//?£???????,???,???,??????????????????????????????1,2,4,8????????????
  while(cin >> w >> h && w>0 && h>0){
    for(int i=0;i<h;i++)
      for(int j=0;j<w;j++)
        map[i][j]=0;

    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
        if(i==0) map[i][j]|=1;
        else{
          int wall;
          cin >> wall;
          if(wall==1){
            map[i-1][j]|=8;
            map[i][j]|=1;
          }
        }
        if(i==h-1) map[i][j]|=8;
      }

      map[i][0]|=2;
      for(int j=1;j<w;j++){
        int wall;
        cin >> wall;
        if(wall==1){
          map[i][j-1]|=4;
          map[i][j]|=2;
        }
      }
      map[i][w-1]|=4;
    }

    int d[30][30];
    for(int i=0;i<h;i++)
      for(int j=0;j<w;j++)
        d[i][j]=0;

    d[0][0]=1;
    queue<int> cur=0*w+0;
    int sh[4]={-w,-1,1,w};

    while(!cur.empty()){
      for(int i=0;i<4;i++){
        if((map[cur.front()/w][cur.front()%w] & (1<<i))==0 && d[(cur.front()+sh[i])/w][(cur.front()+sh[i])%w]==0){
          d[(cur.front()+sh[i])/w][(cur.front()+sh[i])%w]=d[cur.front()/w][cur.front()%w]+1;
          cur.push(cur.front()+sh[i]);
        }
      }
      cur.pop();
    }

    cout << d[h-1][w-1] << endl;

    return 0;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:23: error: conversion from 'int' to non-scalar type 'std::queue<int>' requested
   45 |     queue<int> cur=0*w+0;
      |                    ~~~^~
Language: C++

#include <iostream>
#include <queue>

using namespace std;

#define all(x) x.begin(), x.end()

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

struct state { int y, x, step; };

int main() {
        int w, h;
        while (cin >> w >> h && w) {
                int can[33][33][4];
                bool used[33][33];
                for (int i = 0; i < 33; i ++) {
                        for (int j = 0; j < 33; j ++) {
                                for (int d = 0; d < 4; d ++) {
                                        can[i][j][d] = true;
                                }
                        }
                }
                memset(used, 0, sizeof used);
                for (int y = 0; y < 2 * h - 1; y ++) {
                        int ww = (y % 2 == 0 ? w - 1: w);
                        for (int x = 0; x < ww; x ++) {
                                int a;
                                cin >> a;
                                if (a == 1) { 
                                        if (y % 2 == 0) {
                                                can[y / 2][x][0] = false;
                                                can[y / 2][x + 1][2] = false;
                                        } else {
                                                can[y / 2][x][1] = false;
                                                can[y / 2 + 1][x][3] = false;
                                        }
                                }
                        }
                }
                queue<state> q;
                q.push((state) { 0, 0, 0 });
                used[0][0] = true;
                int ans = 0x3f3f3f3f;
                while (!q.empty()) {
                        state s = q.front(); q.pop();
                        if (s.y == h - 1 && s.x == w - 1) {
                                ans = s.step;
                                break;
                        }
                        for (int d = 0; d < 4; d ++) {
                                int yy = s.y + dy[d], xx = s.x + dx[d];
                                if (yy < 0 || yy > h - 1 || xx < 0 || xx > w - 1) continue;
                                if (!can[s.y][s.x][d]) continue;
                                if (used[yy][xx]) continue;
                                used[yy][xx] = true;
                                q.push((state) { yy, xx, s.step + 1 });
                        }
                }
                cout << (ans == 0x3f3f3f3f ? 0 : ans + 1) << endl;
        }
        return 0;
}

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

#include <iostream>
#include <queue>

using namespace std;

#define all(x) x.begin(), x.end()

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

struct state { int y, x, step; };

int main() {
        int w, h;
        while (cin >> w >> h && w) {
                int can[33][33][4];
                bool used[33][33];
                for (int i = 0; i < 33; i ++) {
                        for (int j = 0; j < 33; j ++) {
                                for (int d = 0; d < 4; d ++) {
                                        can[i][j][d] = true;
                                }
                        }
                }
                memset(used, 0, sizeof(used));
                for (int y = 0; y < 2 * h - 1; y ++) {
                        int ww = (y % 2 == 0 ? w - 1: w);
                        for (int x = 0; x < ww; x ++) {
                                int a;
                                cin >> a;
                                if (a == 1) { 
                                        if (y % 2 == 0) {
                                                can[y / 2][x][0] = false;
                                                can[y / 2][x + 1][2] = false;
                                        } else {
                                                can[y / 2][x][1] = false;
                                                can[y / 2 + 1][x][3] = false;
                                        }
                                }
                        }
                }
                queue<state> q;
                q.push((state) { 0, 0, 0 });
                used[0][0] = true;
                int ans = 0x3f3f3f3f;
                while (!q.empty()) {
                        state s = q.front(); q.pop();
                        if (s.y == h - 1 && s.x == w - 1) {
                                ans = s.step;
                                break;
                        }
                        for (int d = 0; d < 4; d ++) {
                                int yy = s.y + dy[d], xx = s.x + dx[d];
                                if (yy < 0 || yy > h - 1 || xx < 0 || xx > w - 1) continue;
                                if (!can[s.y][s.x][d]) continue;
                                if (used[yy][xx]) continue;
                                used[yy][xx] = true;
                                q.push((state) { yy, xx, s.step + 1 });
                        }
                }
                cout << (ans == 0x3f3f3f3f ? 0 : ans + 1) << endl;
        }
        return 0;
}

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

#include <iostream>
#include <queue>

using namespace std;

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

int main(){
    int w, h;
    string s[59];
    int step[30][30];
    while(cin >> w >> h, w){
        getline(cin, s[0]);
        for(int i=0;i<2*h-1;i++) getline(cin, s[i]);
        for(int i=0;i<2*h-1;i++) s[i] += " ";
        memset(step, -1, sizeof(step));
        queue< pair<int, int> > qu; qu.push(make_pair(0,0));
        step[0][0] = 1;
        while(!qu.empty()){
            pair<int, int> p = qu.front(); qu.pop();
            int x = p.first, y = p.second;
            for(int i=0;i<4;i++){
                int nx = x+dx[i], ny = y+dy[i];
                if(nx<0||h<=nx||ny<0||w<=ny) continue;
                if(s[2*x+dx[i]][2*y+dy[i]]=='1') continue;
                if(step[nx][ny]!=-1) continue;
                step[nx][ny] = step[x][y] + 1;
                qu.push(make_pair(nx, ny));
            }
        }
        cout << (step[h-1][w-1] == -1 ? 0 : step[h-1][w-1]) << endl;
    }
}

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

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

int memo[1024][1024];

int main() {
  for(;;) {
  int R, C;
  cin >> C >> R >> ws;
  if( C == 0 && R == 0 ) break;
  C = C * 2 - 1;
  R = R * 2 - 1;

  vector<string> vs;
  for(int i = 0; i < R; i++) {
    string line;
    getline(cin, line);
    vs.push_back(line);
  }
    
  memset(memo, -1, sizeof(memo));
  memo[0][0] = 1;
  queue<int> q;
  q.push(0);  q.push(0);
  while( !q.empty() ) {
    int x = q.front(); q.pop();
    int y = q.front(); q.pop();
    
    const int dx[] = {0, 0, 1, -1};
    const int dy[] = {1, -1, 0, 0};

    for(int k = 0; k < 4; k++) {
      int nx = x + dx[k];
      int ny = y + dy[k];

      if( 0 <= nx && nx < R && 0 <= ny && ny < C ) {
        if( vs[nx][ny] == '0' ) {
          nx += dx[k];
          ny += dy[k];

          if( memo[nx][ny] == -1 ) {
            memo[nx][ny] = memo[x][y] + 1;
            q.push(nx);
            q.push(ny);
          }
          
        }
      }
      
    }
    
  }
  
  int res = memo[R - 1][C - 1];
  if( res == -1 ) res = 0;

  cout << res << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:3: error: 'memset' was not declared in this scope
   23 |   memset(memo, -1, sizeof(memo));
      |   ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include<queue>
  +++ |+#include <cstring>
    4 | using namespace std;
Language: C++

// ACM-ICPCà\I2010 B. À}Æ½¸

#include <iostream>
#include <queue>

using namespace std;

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

int main(){
	int w, h;
	string s[59];
	int step[30][30];
	while(cin >> w >> h, w){
		getline(cin, s[0]);
		for(int i=0;i<2*h-1;i++) getline(cin, s[i]);
		for(int i=0;i<2*h-1;i++) s[i] += " ";
		memset(step, -1, sizeof(step));
		queue< pair<int, int> > qu; qu.push(make_pair(0,0));
		step[0][0] = 1;
		while(!qu.empty()){
			pair<int, int> p = qu.front(); qu.pop();
			int x = p.first, y = p.second;
			for(int i=0;i<4;i++){
				int nx = x+dx[i], ny = y+dy[i];
				if(nx<0||h<=nx||ny<0||w<=ny) continue;
				if(s[2*x+dx[i]][2*y+dy[i]]=='1') continue;
				if(step[nx][ny]!=-1) continue;
				step[nx][ny] = step[x][y] + 1;
				qu.push(make_pair(nx, ny));
			}
		}
		cout << (step[h-1][w-1] == -1 ? 0 : step[h-1][w-1]) << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:17: error: 'memset' was not declared in this scope
   19 |                 memset(step, -1, sizeof(step));
      |                 ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <queue>
  +++ |+#include <cstring>
    5 |
Language: C++

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

typedef pair<int, int> P;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
bool g[40][40][40][40];
int memo[40][40];

int main(){
  int w, h;
  int can;
  while(cin >> w >> h && (w || h)){
    
    memset(g, false, sizeof(g));
    for(int i = 1; i <= h * 2 - 1; i++){
      if(i % 2 == 1){
	for(int j = 1; j <= w - 1; j++){
	  cin >> can;
	  if(can == 0){
	    g[i/2+1][j][i/2+1][j+1] = true;
	    g[i/2+1][j+1][i/2+1][j] = true;
	  }
	}
	
      }else{
	for(int j = 1; j <= w; j++){
	  cin >> can;
	  if(can == 0){
	    g[i/2][j][i/2+1][j] = true;
	    g[i/2+1][j][i/2][j] = true;
	  }
	}
      }
    }
  
    memset(memo, -1, sizeof(memo));
    memo[1][1] = 1;
    queue<P> que;
    que.push(P(1, 1));
    while(!que.empty()){
      P p = que.front();
      que.pop();
      int y = p.first;
      int x = p.second;
      for(int i = 0; i < 4; i++){
	int y2 = y + dy[i];
	int x2 = x + dx[i];
	if(g[y][x][y2][x2] && memo[y2][x2] == -1){
	 
	  memo[y2][x2] = memo[y][x] + 1;
	  que.push(P(y2, x2));
	}
      }
    }
    int res = memo[h][w];
    if(res == -1) cout << 0 << endl;
    else cout << res << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:5: error: 'memset' was not declared in this scope
   17 |     memset(g, false, sizeof(g));
      |     ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <algorithm>
  +++ |+#include <cstring>
    4 | using namespace std;
Language: C++

#include<iostream>
using namespace std;

int a[40][40];
int b[40][40];
int m[40][40];
int w,h;
int f(int x,int y,int d){
	if(m[x][y]<=d)return 0;
	m[x][y]=d;
	x>0&&!a[x-1][y]&&f(x-1,y,d+1);
	x<w-1&&!a[x][y]&&f(x+1,y,d+1);
	y>0&&!b[x][y-1]&&f(x,y-1,d+1);
	y<h-1&&!b[x][y]&&f(x,y+1,d+1);
	return 0;
}

int main(){
	for(;cin>>w>>h,w;){
		for(int i=0;i<40;i++)for(int j=0;j<40;j++){
			m[i][j]=INT_MAX/3;
		}
		for(int i=0;i<h-1;i++){
			for(int j=0;j<w-1;j++){
				cin>>a[j][i];
			}
			for(int j=0;j<w;j++){
				cin>>a[j][i];
			}
		}
		for(int i=0;i<w-1;i++){
			cin>>a[i][h-1];
		}
		f(0,0,1);
		if(m[w-1][h-1]!=INT_MAX/3){
			cout<<m[w-1][h-1]<<endl;
		}else{
			cout<<0<<endl;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:33: error: 'INT_MAX' was not declared in this scope
   21 |                         m[i][j]=INT_MAX/3;
      |                                 ^~~~~~~
a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include<iostream>
  +++ |+#include <climits>
    2 | using namespace std;
a.cc:35:33: error: 'INT_MAX' was not declared in this scope
   35 |                 if(m[w-1][h-1]!=INT_MAX/3){
      |                                 ^~~~~~~
a.cc:35:33: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include<iostream>
using namespace std;

int a[40][40];
int b[40][40];
int m[40][40];
int w,h;
int f(int x,int y,int d){
	if(m[x][y]<=d)return 0;
	m[x][y]=d;
	x>0&&!a[x-1][y]&&f(x-1,y,d+1);
	x<w-1&&!a[x][y]&&f(x+1,y,d+1);
	y>0&&!b[x][y-1]&&f(x,y-1,d+1);
	y<h-1&&!b[x][y]&&f(x,y+1,d+1);
	return 0;
}

int main(){
	for(;cin>>w>>h,w;){
		for(int i=0;i<40;i++)for(int j=0;j<40;j++){
			m[i][j]=INT_MAX/3;
		}
		for(int i=0;i<h-1;i++){
			for(int j=0;j<w-1;j++){
				cin>>a[j][i];
			}
			for(int j=0;j<w;j++){
				cin>>b[j][i];
			}
		}
		for(int i=0;i<w-1;i++){
			cin>>a[i][h-1];
		}
		f(0,0,1);
		if(m[w-1][h-1]!=INT_MAX/3){
			cout<<m[w-1][h-1]<<endl;
		}else{
			cout<<0<<endl;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:33: error: 'INT_MAX' was not declared in this scope
   21 |                         m[i][j]=INT_MAX/3;
      |                                 ^~~~~~~
a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include<iostream>
  +++ |+#include <climits>
    2 | using namespace std;
a.cc:35:33: error: 'INT_MAX' was not declared in this scope
   35 |                 if(m[w-1][h-1]!=INT_MAX/3){
      |                                 ^~~~~~~
a.cc:35:33: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'