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

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

const int MAX_SIZE = 20;
typedef pair<int, int> P;

int calc(char f[][MAX_SIZE], queue<P> q, int W, int H) {
  set<P> s;
  while (q.size()) {
    P p = q.front();
    q.pop();
    s.insert(p);
    int di[] = {-1, 1, 0, 0};
    int dj[] = {0, 0, -1, 1};
    for (int k = 0; k < 4; ++k) {
      int i = p.first  + di[k];
      int j = p.second + dj[k];
      if (i >= 0 && j >= 0 && i < H && j < W && f[i][j] == '.') {
        pair<set<P>::iterator, bool> r = s.insert(P(i, j));
        if (r.second) q.push(*r.first);
      }
    }
  }
  return s.size();
}
int main() {
  int W, H;
  char f[MAX_SIZE + 1][MAX_SIZE + 1];
  while (true) {
    queue<P> q;
    cin >> W >> H;
    if (W == 0 && H == 0) break;
    for (int i = 0; i < H; ++i) {
      cin >> f[i];
      for (int j = 0; j < W; ++j) {
        if (f[i][j] == '@') {
          q.push(P(i, j));
        }
      }
    }
    cout << calc(f, q, W, H) << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:18: error: cannot convert 'char (*)[21]' to 'char (*)[20]'
   43 |     cout << calc(f, q, W, H) << endl;
      |                  ^
      |                  |
      |                  char (*)[21]
a.cc:9:15: note:   initializing argument 1 of 'int calc(char (*)[20], std::queue<std::pair<int, int> >, int, int)'
    9 | int calc(char f[][MAX_SIZE], queue<P> q, int W, int H) {
      |          ~~~~~^~~~~~~~~~~~~
Language: C++

#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<string>
#include<map>
#include<vector>
#include<algorithm>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

using namespace std;
int ans = 0;

void bfs(char **tile, int w, int h){
  ans++;
  tile[w][h] = '#';

  if(tile[w][h-1] == '.')
  bfs(tile, w, h-1);

  if(tile[w][h+1] == '.')
  bfs(tile, w, h+1);

  if(tile[w-1][h] == '.')
  bfs(tile, w-1, h);

  if(tile[w+1][h] == '.')
  bfs(tile, w+1, h);

  return;
}


int main(){
  int W,H,index_w,index_h;

  while(true){
    cin >> W >> H;
    if(W == 0 && H == 0) break;

    char **tile;
    tile = new char* [H+2];
    REP(i,H+2) tile[i] = new char[W+2];

    REP(i,H+2){
      REP(j,W+2){
        if(i == 0 || i == H+1 || j == 0 || j == W+1) tile[i][j] = '#'; //sentry?
        else scanf(" %c",&tile[i][j]);

        if(tile[i][j] == '@') {
          index_h = j;
          index_w = i;
        }

      }
    }
    count = 0;
    bfs(tile,index_w,index_h);
    
    REP(i,H) delete[] tile[i];
    delete[] tile;
    
    cout << ans << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:59:13: error: overloaded function with no contextual type information
   59 |     count = 0;
      |             ^
Language: C++

// Red and Black.cpp : ??????????????? ??¢????????±????????§????????¨????????? ?????????????????????????????????
//

#include "stdafx.h"
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;
typedef long long ll;
//Global
int x, y;
const int MAX_N = 20;
char maze[MAX_N][MAX_N];
const int INF = 1000000;
int X, Y;//"@"???????????????
int memo[MAX_N][MAX_N];
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };
int counter;

void bsd(int a, int b) {
	maze[b][a] = '#';
	memo[b][a] = INF;
	counter++;
	for (int i = 0; i < 4; i++) {
		int nx = a + dx[i];
		int ny = b + dy[i];
		if (memo[ny][nx] == 0 && maze[ny][nx] == '.' && 0 <= nx && nx < x && 0 <= ny && ny < y) {
			bsd(nx, ny);
		}
	}

}



//solve
//??±???????????¢?´¢??§"@"??¨???????????£?????????"."????????°????±???????
void solve()
{
	//memo????????????
	for (int i = 0; i < y; i++) {
		for (int j = 0; j < x; j++) {
			memo[i][j] = 0;
		}
	}

	//"@"??¨??£??\????????????  ??????  INF??§??????  ??????  ????????????????????£?????????????????????"."??§??????
	counter = 0;//"@"??????
	bsd(X, Y);


	cout << counter << endl;

}






/*
void solve() {
	for (int i = 0; i < y; i++) {
		for (int j = 0; j < x; j++) {
			cout << maze[i][j];
		}
		cout << endl;
	}
	cout << "@???????????????" << X << Y << endl;
}
*/








//main
int main()
{
	while (true) {
		cin >> x >> y;
		if (x == 0 && y == 0)break;
		//"W"??¨"."??¨"@"?????\???
		for (int i = 0; i < y; i++) {
			for (int j = 0; j < x; j++) {
				cin >> maze[i][j];
				if (maze[i][j] == '@') {
					X = j; Y = i;//@???????????????????¨????
				}
			}
		}
		solve();
	}
    return 0;
}

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

#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;
typedef long long ll;
//Global
int x, y;
const int MAX_N = 20;
char maze[MAX_N][MAX_N+1];
const int INF = 1000000;
int X, Y;//"@"???????????????
int memo[MAX_N][MAX_N];
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };
int counter;

void bsd(int a, int b) {
	maze[b][a] = '#';
	memo[b][a] = INF;
	counter++;
	for (int i = 0; i < 4; i++) {
		int nx = a + dx[i];
		int ny = b + dy[i];
		if (memo[ny][nx] == 0 && maze[ny][nx] == '.' && 0 <= nx && nx < x && 0 <= ny && ny < y) {
			bsd(nx, ny);
		}
	}

}



//solve
//??±???????????¢?´¢??§"@"??¨???????????£?????????"."????????°????±???????
void solve()
{
	//memo????????????
	memset(memo.0, sizeof(memo));
	//for (int i = 0; i < y; i++) {
		//for (int j = 0; j < x; j++) {
			//memo[i][j] = 0;
	//	}
	//}

	//"@"??¨??£??\????????????  ??????  INF??§??????  ??????  ????????????????????£?????????????????????"."??§??????
	counter = 0;//"@"??????
	bsd(X, Y);


	cout << counter << endl;

}


//main
int main()
{
	while (true) {
		cin >> x >> y;
		if (x == 0 && y == 0)break;
		//"W"??¨"."??¨"@"?????\???
		for (int i = 0; i < y; i++) {
			for (int j = 0; j < x; j++) {
				cin >> maze[i][j];
				if (maze[i][j] == '@') {
					X = j; Y = i;//@???????????????????¨????
				}
			}
		}
		solve();
	}
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:40:20: error: expected ')' before numeric constant
   40 |         memset(memo.0, sizeof(memo));
      |               ~    ^~
      |                    )
a.cc:40:9: error: 'memset' was not declared in this scope
   40 |         memset(memo.0, sizeof(memo));
      |         ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include<queue>
  +++ |+#include <cstring>
    6 | using namespace std;
Language: C++

#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;
typedef long long ll;
//Global
int x, y;
const int MAX_N = 20;
char maze[MAX_N][MAX_N+1];
const int INF = 1000000;
int X, Y;//"@"???????????????
int memo[MAX_N][MAX_N];
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };
int counter;

void bsd(int a, int b) {
	maze[b][a] = '#';
	memo[b][a] = INF;
	counter++;
	for (int i = 0; i < 4; i++) {
		int nx = a + dx[i];
		int ny = b + dy[i];
		if (memo[ny][nx] == 0 && maze[ny][nx] == '.' && 0 <= nx && nx < x && 0 <= ny && ny < y) {
			bsd(nx, ny);
		}
	}

}



//solve
//??±???????????¢?´¢??§"@"??¨???????????£?????????"."????????°????±???????
void solve()
{
	//memo????????????
	memset(memo,0, sizeof(memo));
	//for (int i = 0; i < y; i++) {
		//for (int j = 0; j < x; j++) {
			//memo[i][j] = 0;
	//	}
	//}

	//"@"??¨??£??\????????????  ??????  INF??§??????  ??????  ????????????????????£?????????????????????"."??§??????
	counter = 0;//"@"??????
	bsd(X, Y);


	cout << counter << endl;

}


//main
int main()
{
	while (true) {
		cin >> x >> y;
		if (x == 0 && y == 0)break;
		//"W"??¨"."??¨"@"?????\???
		for (int i = 0; i < y; i++) {
			for (int j = 0; j < x; j++) {
				cin >> maze[i][j];
				if (maze[i][j] == '@') {
					X = j; Y = i;//@???????????????????¨????
				}
			}
		}
		solve();
	}
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:40:9: error: 'memset' was not declared in this scope
   40 |         memset(memo,0, sizeof(memo));
      |         ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include<queue>
  +++ |+#include <cstring>
    6 | using namespace std;
Language: C++

#include <iostream>
#include <math.h>
#include <queue>
#include <cstdio>
using namespace std;
int W, H;
char c[100][101];
bool visited[100][100];

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

void computer(){
    memset(visited,false,sizeof visited);
    queue<int> que;
    int i, j;
    for(i=0;i<H;i++){
        for(j=0;j<W;j++){
            if(c[i][j]=='@'){
                que.push(j+i*W);
                visited[i][j] = true;
                goto Skip;
            }
        }
    }
Skip:;
    
    int answer = 1;
    while( !que.empty()){
        int cur = que.front(); que.pop();
        int x = cur % W, y = cur / W;
        
        for(i=0;i<4;++i){
            int nx = x + dx[i],ny = y + dy[i];
            if(!(0<=nx && nx < W && 0<=ny && ny<H))continue;
            if(c[ny][nx]=='#' || visited[ny][nx])continue;
            que.push(nx+ny*W);
            visited[ny][nx]=true;
            ++answer;
        }
        
        
        
    }
    
    cout << answer << endl;
    
    
}

// abcdd
// efgeg

int main(){
    while(cin >> W >> H, W==0&&H==0){
        int i;
        for(i=0;i<H;++i){
            //cin >> c[i][0];
            scanf(" %s",&c[i][0]);
        }
        computer();
        
    }
    
    return 0;
}

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

//??¨??¢?´¢:??±???????????¢?´¢??????????????¢?´¢ 

//??????????????¢?????¬?????????
 
//?????°??¢??°???????????????(?????????)????????\???(?????????)
#include <stdio.h>
#include <queue>
#include <string.h>
using namespace std;	
int W,H;
char c[101][101];
bool visited[100][100];
 
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
 	
void compute();//????????????????????£?¨? 
	
int main(){
	
	while(scanf("%d %d",&W,&H),W |H){
	    int i;
		
		for(i=0;i<H;i++){
			scanf(" %s",&c[i][0]);
		}
	}
	return 0;
}

void compute(){
	
	memset(visited,false,sizeof visited);  //{????????????????????????1bit??????????????????1bit????????§?????????} 
	
	queue<int> que;
	int i,j;
	for(j=0;j<W;j++){ 
	 for(i=0;i<H;i++){
	  if(c[i][j]=='@'){
	  	que.push(j+i*H);
	  	visited[i][j]=true;
	  	 break;
	  }
	 }
	}
  int answer=1;
  while(!que.empty()){
	int cur=que.front();
	        que.pop();
	        int x=cur%H;
	        int y=cur/H;
    

  for(i=0;i<4;i++){
	int nx=x+dx[i],ny=y+dy[i];
	
  
  
  if(!(0<=nx&&nx<W&&0<=ny&&ny<H))continue;
  if(c[ny][nx]=='#'||visited[ny][nx])continue;

  que.push(nx+ny*H);
  visited[ny][nx]=true;
++answer;
    }
   }
 cout << answer << endl;
 }

Compiler output:
a.cc: In function 'void compute()':
a.cc:67:2: error: 'cout' was not declared in this scope
   67 |  cout << answer << endl;
      |  ^~~~
a.cc:9:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    8 | #include <string.h>
  +++ |+#include <iostream>
    9 | using namespace std;
a.cc:67:20: error: 'endl' was not declared in this scope
   67 |  cout << answer << endl;
      |                    ^~~~
a.cc:9:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    8 | #include <string.h>
  +++ |+#include <ostream>
    9 | using namespace std;
Language: C++

#include<iostream>
using namespace std;
int main(){
  while(1){
    int dfs(int x,int y,int count);
    
    int w,h;
    int dx[4]={0,-1,0,1};
    int dy[4]={-1,0,1,0};
    int sum=0;
    char maps[21][21];
    
    int main(){
      int sx,sy;
      cin >> h >> w;
      if(h==0 && w==0) break; 
      for(int i=0;i<h;i++){
	for(int j=0;j<w;j++){
	  cin >> maps[i][j];
	  if(maps[i][j]=='@'){
	    sy=i;
	    sx=j;
	  }
	}
      }
      int ans = dfs(sx,sy,0);
      cout << ans << endl;
    }
    
    int dfs(int x,int y,int count){
      int nx,ny;
      for(int i=0;i<4;i++){
	nx=x+dx[i];
	ny=y+dy[i];
	maps[y][x]='#';
	if(0<=nx && nx<w && 0<=ny && ny<h && maps[ny][nx]!='#'){
	  sum++;
	  dfs(nx,ny,count+1);
	}
      }
      return sum;
    }
  }
  return(0);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:13: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   13 |     int main(){
      |             ^~
a.cc:13:13: note: remove parentheses to default-initialize a variable
   13 |     int main(){
      |             ^~
      |             --
a.cc:13:13: note: or replace parentheses with braces to value-initialize a variable
a.cc:13:15: error: a function-definition is not allowed here before '{' token
   13 |     int main(){
      |               ^
a.cc:30:35: error: a function-definition is not allowed here before '{' token
   30 |     int dfs(int x,int y,int count){
      |                                   ^
Language: C++

#include <iostream>
#include <queue>

using namespace std;

struct locate{
  int x;
  int y;
};
 
char graph[20][20];
int cou = 0;
int H,W;

void bfs(locate z){
  queue<locate> Q;
  locate u;
  locate v;
  Q.push(z);
 

  while(!Q.empty()){

    u = Q.front();Q.pop();
    if(u.y < H - 1){
      if(graph[u.y + 1][u.x] == '.' && graph[u.y + 1][u.x] != 'N'){
	graph[u.y + 1][u.x] = 'N';
	cou++;
	v.y = u.y + 1;
	v.x = u.x;
	Q.push(v);
      }
    }
    if(u.x < W - 1){
      if(graph[u.y][u.x + 1] == '.' && graph[u.y][u.x + 1] != 'N'){
	graph[u.y][u.x + 1] = 'N';
	cou++;
	v.x  = u.x + 1;
	v.y = u.y;
	Q.push(v);
      }
    }
    if(u.y > 0){
      if(graph[u.y - 1][u.x] == '.' && graph[u.y - 1][u.x] != 'N'){
	graph[u.y - 1][u.x] = 'N';
	cou++;
	v.x = u.x;
	v.y = u.y - 1;
	Q.push(v);
      }
    }
    if(u.x > 0){
      if(graph[u.y][u.x - 1] == '.' && graph[u.y][u.x - 1] != 'N'){
	graph[u.y][u.x - 1] = 'N';
	cou++;
	v.x = u.x - 1;
	v.y = u.y;
	Q.push(v);
      }
    }

    /* cout << endl;
    for(int i = 0; i< H ;i++){
      for(int j = 0; j < W; j++){
	cout << graph[i][j];
      }
      cout << endl;*/
    }
  }
  
}

int main(){

  int a1,a2;
  locate a;
  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++){
	cin >> graph[i][j];
	if(graph[i][j] == '@'){
	  a1 = i;
	  a2 = j;
	}
      }
    }

    /*
      for(int i = 0; i< H ;i++){
      for(int j = 0; j < W; j++){
      cout << graph[i][j];
      }
      cout << endl;
      }
    */

    a.y = a1;
    a.x = a2;
    bfs(a);

    cout << cou+1 << endl;

    cou = 0;
    for(int i = 0;i < H ;i++){
      for(int j = 0;j < W; j++){
	graph[i][j] = 'N';
      }
    }
    cou = 0;
  }
  return 0;
}

Compiler output:
a.cc:71:1: error: expected declaration before '}' token
   71 | }
      | ^
Language: C++

#include "bits/stdc++.h"
using std::cin;
using std::cout;

int cnt = 0;
char map[21][21];

void dfs(int x, int y, int mx, int my){
    if((x < 0) || (x >= mx)){
        return;
    }
    if((y < 0) || (y >= my)){
        return;
    }
    if(map[x][y] == '#'){
        return;
    }
    map[x][y] = '#';
    cnt++;
    dfs(x+1, y, mx, my);
    dfs(x-1, y, mx, my);
    dfs(x, y+1, mx, my);
    dfs(x, y-1, mx, my);
}

int main(){
    int W, H, sx, sy;
    cin >> W >> H;

    while(W != 0 && H != 0){
        for(int i = 0; i < H; i++){
            scanf("%20s", map[i]);
            if(std::string(map[i]).find('@') != std::string::npos){
                sx = i;
                sy = std::string(map[i]).find('@');
            }
        }
        dfs(sx, sy, H, W);
        cout << cnt << std::endl;

        cin >> W >> H;
        cnt = 0;
        
    }



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

#include <iostream>
#include <algorithm>
using namespace std;
​
int W, H;
char visit[21][21];
int dfs(int h, int w){
  int sum=1;
  if(0>w || w==W || 0>h || h==H) return 0;
  if(visit[h][w]=='#')  return 0;
  if(visit[h][w]=='!')   return 0;
    visit[h][w] = '!';
    sum += dfs(h, w+1);
    sum += dfs(h, w-1);
    sum += dfs(h+1, w);
    sum += dfs(h-1, w);
  
  return sum;
}
​
int main(void){
  int w1, h1;
  string str;
  while(cin >> W >> H){
    if(W == 0 && H == 0)  break;
    for(int i=0; i<H; i++){
      cin >> str;
      for(int j=0; j<W; j++){
        visit[i][j] = str[j];
        if(visit[i][j] == '@'){
          visit[i][j] = '.';
          w1 = j; h1 = i;  
        }
      }
    }
    cout << dfs(h1, w1) <<endl;
  }
  
  return 0;
}


Compiler output:
a.cc:4:1: error: '\U0000200b' does not name a type
    4 | ​
      |  
a.cc: In function 'int dfs(int, int)':
a.cc:9:16: error: 'W' was not declared in this scope
    9 |   if(0>w || w==W || 0>h || h==H) return 0;
      |                ^
a.cc:9:31: error: 'H' was not declared in this scope
    9 |   if(0>w || w==W || 0>h || h==H) return 0;
      |                               ^
a.cc: At global scope:
a.cc:20:1: error: '\U0000200b' does not name a type
   20 | ​
      |
Language: C++

int main()
{
  int W, H, i, j, f, d, count;
  int dx[4] = {0, 1, 0, -1};
  int dy[4] = {1, 0, -1, 0};
  char map[32][32];
  char s[32];

  while (1) {
    gets(s);
    sscanf(s, "%d %d", &W, &H); if (W == 0 && H == 0) { break; }
    for (i = 0; i < 30; i++) {
      strcpy(map[i], "##############################");
    }
    
    for (i = 0; i < H; i++) {
      gets(&map[i+1][1]);
      map[i+1][W+1] = '#';
      map[i+1][W+2] = '\0';
    }

    count = 1;
    while (1) {
      f = 0;
      for (i = 1; i <= H; i++) {
        for (j = 1; j <= W; j++) {
          if (map[i][j] == '@') {
            for (d = 0; d < 4; d++) {
              if (map[i+dy[d]][j+dx[d]] == '.') {
                map[i+dy[d]][j+dx[d]] = '@';
                count++;
                f = 1;
              }
            }
          }
        }
      }
      if (!f) {
        break;
      }
    }
    printf("%d\n", count);
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: 'gets' was not declared in this scope
   10 |     gets(s);
      |     ^~~~
a.cc:11:5: error: 'sscanf' was not declared in this scope
   11 |     sscanf(s, "%d %d", &W, &H); if (W == 0 && H == 0) { break; }
      |     ^~~~~~
a.cc:13:7: error: 'strcpy' was not declared in this scope
   13 |       strcpy(map[i], "##############################");
      |       ^~~~~~
a.cc:1:1: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
  +++ |+#include <cstring>
    1 | int main()
a.cc:42:5: error: 'printf' was not declared in this scope
   42 |     printf("%d\n", count);
      |     ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int main()
Language: C++

#include <stdio.h>
int main()
{
  int W, H, i, j, f, d, count;
  int dx[4] = {0, 1, 0, -1};
  int dy[4] = {1, 0, -1, 0};
  char map[32][32];
  char s[32];

  while (1) {
    gets(s);
    sscanf(s, "%d %d", &W, &H); if (W == 0 && H == 0) { break; }
    for (i = 0; i < 30; i++) {
      strcpy(map[i], "##############################");
    }
    
    for (i = 0; i < H; i++) {
      gets(&map[i+1][1]);
      map[i+1][W+1] = '#';
      map[i+1][W+2] = '\0';
    }

    count = 1;
    while (1) {
      f = 0;
      for (i = 1; i <= H; i++) {
        for (j = 1; j <= W; j++) {
          if (map[i][j] == '@') {
            for (d = 0; d < 4; d++) {
              if (map[i+dy[d]][j+dx[d]] == '.') {
                map[i+dy[d]][j+dx[d]] = '@';
                count++;
                f = 1;
              }
            }
          }
        }
      }
      if (!f) {
        break;
      }
    }
    printf("%d\n", count);
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
   11 |     gets(s);
      |     ^~~~
      |     getw
a.cc:14:7: error: 'strcpy' was not declared in this scope
   14 |       strcpy(map[i], "##############################");
      |       ^~~~~~
a.cc:2:1: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <stdio.h>
  +++ |+#include <cstring>
    2 | int main()
Language: C++

#include <bits/stdc++.h>

using namespace std;


int main()
{
  int W, H, i, j, f, d, count;
  int dx[4] = {0, 1, 0, -1};
  int dy[4] = {1, 0, -1, 0};
  char map[32][32];
  char s[32];

  while (1) {
    gets(s);
    sscanf(s, "%d %d", &W, &H); if (W == 0 && H == 0) { break; }
    for (i = 0; i < 30; i++) {
      strcpy(map[i], "##############################");
    }
    
    for (i = 0; i < H; i++) {
      gets(&map[i+1][1]);
      map[i+1][W+1] = '#';
      map[i+1][W+2] = '\0';
    }

    count = 1;
    while (1) {
      f = 0;
      for (i = 1; i <= H; i++) {
        for (j = 1; j <= W; j++) {
          if (map[i][j] == '@') {
            for (d = 0; d < 4; d++) {
              if (map[i+dy[d]][j+dx[d]] == '.') {
                map[i+dy[d]][j+dx[d]] = '@';
                count++;
                f = 1;
              }
            }
          }
        }
      }
      if (!f) {
        break;
      }
    }
    printf("%d\n", count);
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
   15 |     gets(s);
      |     ^~~~
      |     getw
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
bool c[20][20] = {} ;
int cnt,w, h, p[20][20] = {};

int main() {
	int j, f,cx,cy;
	char in[20];
	while (1) {
		for (int i = 0; i < 400; i++) {
			c[i / 20][i % 20] = p[i / 20][i % 20] = 0;
		}
		cnt = 0;
		f = 1;
		scanf("%d %d", &w, &h);
		if (w ==0&& h == 0)
			break;
		scanf("\n", &j);
		for (int i = 0; i < h; i++) {
			scanf("%s", &in);
			for (j = 0; j < w; j++) {
				switch (in[j]) {
				case '#':
					c[j][i] = 0;
					p[j][i] = -1;
					break;
				case '@':
					cx = j;
					cy = i;
					p[j][i] = 1;
				case '.':
					c[j][i] = 1;
				}
			}
		}

		/*for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++)
				printf("%3d", c[j][i]);
			printf("\n");
		}*/

		while (f == 1) {
			f = 0;
			if (w != 1 && h != 1) {
				for (int i = 0; i < w*h; i++) {
					if (p[i / h][i%h] == 0 && (p[i / h + 1][i % h] == 1 || p[i / h - 1][i % h] == 1 || p[i / h][i % h + 1] == 1 || p[i / h][i % h - 1] == 1)) {
						p[i / h][i%h] = 1;
						f = 1;
					}
				}
			}
			if (w = 1 && h != 1) {
				for (int i = 0; i < w*h; i++) {
					if (p[i / h][i%h] == 0 && (p[i / h][i % h + 1] == 1 || p[i / h][i % h - 1] == 1)) {
						p[i / h][i%h] = 1;
						f = 1;
					}
				}
			}
			if (w != 1 && h = 1) {
				for (int i = 0; i < w*h; i++) {
					if (p[i / h][i%h] == 0 && (p[i / h + 1][i % h] == 1 || p[i / h - 1][i % h] == 1)) {
						p[i / h][i%h] = 1;
						f = 1;
					}
				}
			}


			/*for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++)
					printf("%3d", p[j][i]);
				printf("\n");
			}
			printf("\n");*/
		}

		for (int i = 0; i < w*h; i++) {
			if (p[i / h][i%h] == 1)
				cnt++;
		}
		printf("%d\n", cnt);
	}
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:61:36: error: lvalue required as left operand of assignment
   61 |                         if (w != 1 && h = 1) {
      |                             ~~~~~~~^~~~
Language: C++

#include <string>
#include <iostream>

using namespace std;

int w, h;
bool b[20][20];
bool ok[20][20];

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

void dfs(int x, int y){
	for(int i=0;i<4;i++){
		if(0<=x+dx[i]&&x+dx[i]<w&&0<=y+dy[i]&&y+dy[i]<h){
			if(!b[y+dy[i]][x+dx[i]]) continue;
			if(ok[y+dy[i]][x+dx[i]]) continue;
			ok[y+dy[i]][x+dx[i]] = true;
			dfs(x+dx[i],y+dy[i]);
		}
	}
}

int main(){
	while(cin >> w >> h){
		if(!w) break;
		int x, y;
		string s;
		memset(b,false,sizeof(b));
		for(int i=0;i<h;i++){
			cin >> s;
			for(int j=0;j<w;j++){
				b[i][j] = (s[j] !='#');
				if(s[j]=='@') x = j, y = i;
			}
		}
		memset(ok,false,sizeof(ok));
		ok[y][x] = true;
		dfs(x,y);
		int count = 0;
		for(int i=0;i<h;i++)
			for(int j=0;j<w;j++)
				count += ok[i][j];
		cout << count << endl;
	}
}

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

import java.util.*;
import java.awt.Point;

public class Main {
	static int w,h,sx,sy;
	static int[] dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1};
	static String[] field;
	static boolean[][] visited;
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		while(read()) {
			System.out.println(solve());
		}
	}
	
	static boolean read() {
		w = sc.nextInt(); h = sc.nextInt();
		if(w == 0 && h == 0) {
			return false;
		}
		field = new String[h];
		
		for(int i = 0; i < h; i++) {
			field[i] = sc.next();
			int tmp = field[i].indexOf('@');
			if(tmp != -1) {
				sy = i; sx = tmp;
			}
		}
		return true;
	}
	
	static int solve() {
		visited = new boolean[h][w];
		Queue<Point> que = new LinkedList<Point>();
		Point s = new Point(sx, sy);
		
		que.add(s);
		visited[sy][sx] = true;
		int ans = 1;
		while(!que.isEmpty()) {
			Point p = que.poll();
			for(int i = 0; i < 4; i++) {
				Point next = new Point(p.x + dx[i], p.y + dy[i]);
				if(!inField(next) || field[next.y].charAt(next.x) == '#' || visited[next.y][next.x] == true) {
					continue;
				} else {
					que.add(next);
					visited[next.y][next.x] = true;
					ans++;
				}
			}
		}
		return ans;
	}
	
	static boolean inField(Point p) {
		if(p.x >= 0 && p.x < w && p.y >= 0 && p.y < h) {
			return true;
		} else {
			return false;
		}
	}
}

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

#define B(a,x,b) ((a)<=(x)&&(x)<(b))

char T[999];
int x,y,cx,cy,i,c;

void R(a,b){
	if(B(0,a,x)&&B(0,b,y)&&T[b*20+a]){
		T[b*20+a]=0;i++;R(a-1,b);R(a+1,b);R(a,b-1);R(a,b+1);
	}
}

main(){
	for(;scanf("%d%d",&x,&y),x;){
		for(i=0;i<x*y;i++){
			int _x=i%x, _y=i/x;
			for(;(c=getchar())!='\n';);
			switch(c){
				case '@': cx=_x;cy=_y;
				case '.': T[_y*20+_x]=1; break;
				case '#': T[_y*20+_x]=0; break;
			}
		}
		i=0;
		R(cx,cy);
		printf("%d\n",i);
	}
	return 0;
}

Compiler output:
a.cc:6:6: error: variable or field 'R' declared void
    6 | void R(a,b){
      |      ^
a.cc:6:8: error: 'a' was not declared in this scope
    6 | void R(a,b){
      |        ^
a.cc:6:10: error: 'b' was not declared in this scope
    6 | void R(a,b){
      |          ^
a.cc:12:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   12 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:13:14: error: 'scanf' was not declared in this scope
   13 |         for(;scanf("%d%d",&x,&y),x;){
      |              ^~~~~
a.cc:16:33: error: 'getchar' was not declared in this scope
   16 |                         for(;(c=getchar())!='\n';);
      |                                 ^~~~~~~
a.cc:1:1: note: 'getchar' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | #define B(a,x,b) ((a)<=(x)&&(x)<(b))
a.cc:24:17: error: 'R' was not declared in this scope
   24 |                 R(cx,cy);
      |                 ^
a.cc:25:17: error: 'printf' was not declared in this scope
   25 |                 printf("%d\n",i);
      |                 ^~~~~~
a.cc:25:17: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
Language: C++


#define B(a,x,b) ((a)<=(x)&&(x)<(b))

char T[999];
int x,y,cx,cy,i,c;

void R(int a,int b){
	if(B(0,a,x)&&B(0,b,y)&&T[b*20+a]){
		T[b*20+a]=0;i++;R(a-1,b);R(a+1,b);R(a,b-1);R(a,b+1);
	}
}

main(){
	for(;scanf("%d%d",&x,&y),x;){
		for(i=0;i<x*y;i++){
			int _x=i%x, _y=i/x;
			for(;(c=getchar())!='\n';);
			switch(c){
				case '@': cx=_x;cy=_y;
				case '.': T[_y*20+_x]=1; break;
				case '#': T[_y*20+_x]=0; break;
			}
		}
		i=0;
		R(cx,cy);
		printf("%d\n",i);
	}
	return 0;
}

Compiler output:
a.cc:13:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   13 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:14:14: error: 'scanf' was not declared in this scope
   14 |         for(;scanf("%d%d",&x,&y),x;){
      |              ^~~~~
a.cc:17:33: error: 'getchar' was not declared in this scope
   17 |                         for(;(c=getchar())!='\n';);
      |                                 ^~~~~~~
a.cc:1:1: note: 'getchar' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | 
a.cc:26:17: error: 'printf' was not declared in this scope
   26 |                 printf("%d\n",i);
      |                 ^~~~~~
a.cc:26:17: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
Language: C++

#include <iostream>
#include <cmath>
#include <vector>
#include <cctype>
#include <algorithm>
#include <string>
#include <queue>
using namespace std;

char map[21][21];
int w, h;
int tile = 0;

void dfs(int x, int y){
    if (!(0 <= x && x < w && 0 <= y < h)) return;
    tile++;
    map[y][x] = '#';
    if (map[y-1][x] == '.') dfs(x, y-1);
    if (map[y+1][x] == '.') dfs(x, y+1);
    if (map[y][x-1] == '.') dfs(x-1, y);
    if (map[y][x+1] == '.') dfs(x+1, y);
}

int main(){
    int sx, sy;
    while (cin >> w >> h, w || h){
	memset(map, '#', sizeof(map));
	tile = 0;
	for (int i = 0; i < h; i++){
	    cin >> map[i];
	    for (int p = 0; p < w; p++){
		if (map[i][p] == '@'){
		    sx = p;
		    sy = i;
		}
	    }
	}

	dfs(sx, sy);

	cout << tile << endl;
    }
    
    return 0;
}

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

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

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

char field[20][20];
bool flag[20][20];
int W, H, ans;

void dfs(int x, int y) {
  //field[x][y] = '.';
  //cout << x << ' ' << y << endl;
  //cout << flag[x][y] << endl;
  //cout << ans << endl;
  for(int i = 0 ; i < 4 ; i++) {
    int nx = x + dx[i], ny = y + dy[i];
    if(0 <= nx && nx < H && 0 <= ny && ny < W && field[nx][ny] == '.' &&
       flag[nx][ny] == false) {
      ans++; flag[nx][ny] = true; dfs(nx, ny);
      //cout << "OK" << endl;
    }
    //else dfs(nx, ny);
  }
}

int main(void) {
  int x, y;
  int res;
  
  while(cin >> W >> H, W != 0 && H != 0) {
    memset(flag, false, sizeof(flag));
    ans = 1;
    for(int i = 0 ; i < H ; i++) {
      for(int j = 0 ; j < W ; j++) {
	cin >> field[i][j];
	if(field[i][j] == '@') x = i, y = j;
      }
    }
    /*for(int i = 0 ; i < H ; i++) {
      for(int j = 0 ; j < W ; j++) {
	cout << field[i][j];
      }
      cout << endl;
      }*/
    //printf("@x = %d, @y = %d\n", x, y);
    dfs(x, y);
    cout << ans << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:5: error: 'memset' was not declared in this scope
   34 |     memset(flag, false, sizeof(flag));
      |     ^~~~~~
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>
#include<cstdio>
#include<vector>

using namespace std;

int w,h;
int ans=1;
char tile[21][21];

void saiki(int x,int y){
	if(x<0 | x>h | y<0 | y>w)return;
	tile[x][y]='#';
	if(tile[x-1][y]=='.')ans++,saiki(x-1,y);
	if(tile[x+1][y]=='.')ans++,saiki(x+1,y);
	if(tile[x][y-1]=='.')ans++,saiki(x,y-1);
	if(tile[x][y+1]=='.')ans++,saiki(x,y+1);
}

int main(void){
	int a,b; 
	while(1){
		scanf("%d %d",&w,&h);
		if(w==0 && h==0)break;
		ans=1;
		memset(tile,0,sizeof(tile));
		for(a=0;a<h;a++){
			scanf("%s",tile[a]);
		}
		for(a=0;a<h;a++){
			for(b=0;b<w;b++){
				if(tile[a][b]=='@')saiki(a,b);
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}

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

#include <iostream>
using namespace std;
char S[21][21];
int count = 0;

void a(int i, int j){
	if(S[i][j] == '.'){
		count++;
		S[i][j] = '#';
		a(i - 1, j);
		a(i + 1, j);
		a(i, j + 1);
		a(i, j - 1);
	}
}


int main(){
	while(true){
		memset(S,'#',sizeof(S));
		count = 0;
		int x, y;
		cin >> x >> y;
		if(x == 0 && y == 0){
			break;
		}
		for(int i = 0; i < y; i++){
			for(int j = 0; j < x; j++){
				cin >> S[i][j];
			}
		}

		int startx, starty;
		for(int i = 0; i < y; i++){
			for(int j = 0; j < x; j++){
				if(S[i][j] == '@'){
					startx = j;
					starty = i;
					S[i][j] = '.';
					break;
				}
			}
		}
		a(starty, startx);
		cout << count << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:17: error: 'memset' was not declared in this scope
   20 |                 memset(S,'#',sizeof(S));
      |                 ^~~~~~
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 | using namespace std;
Language: C++

#include<iostream>
#include<string>
using namespace std;
int w,h;
string map[40];
int vec[4][2]={{0,1},{0,-1},{-1,0},{1,0}};
void move(int x,int y){
	int ans=0;
	map[x][y]='#';
	for(int i=0;i<4;i++){
		if((x+vec[i][0]>=0)&&(y+vec[i][1]>=0)&&(x+vec[i][0]<h)&&(y+vec[i][1]<w)){
			if(map[x+vec[i][0]][y+vec[i][1]]=='.'){
				ans+=move(x+vec[i][0],y+vec[i][1]);
			}
		}
	}
	return ans;
}

int main(){
	while(cin>>w>>h,w){
		int fx,fy;
		for(int i=0;i<h;i++){
			cin>>map[i];
		}
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				if(map[i][j]=='@'){
					fx=i;
					fy=j;
					break;
				}
			}
		}
		int ans=move(fx,fy);
		cout<<ans<<endl;
		
	}
}

Compiler output:
a.cc: In function 'void move(int, int)':
a.cc:13:42: error: void value not ignored as it ought to be
   13 |                                 ans+=move(x+vec[i][0],y+vec[i][1]);
      |                                      ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:17:16: error: return-statement with a value, in function returning 'void' [-fpermissive]
   17 |         return ans;
      |                ^~~
a.cc: In function 'int main()':
a.cc:35:29: error: void value not ignored as it ought to be
   35 |                 int ans=move(fx,fy);
      |                         ~~~~^~~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>

#define rep(i, n) for(int i = 0; i < n; i ++)
#define ALL(T) T.begin(), T.end()
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define MEMSET(v, h) memset((v), h, sizeof(v))

using namespace std;

typedef pair<int, int> pii;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;

const int INF = 1 << 24;
const int dx[4] = {1, -1, 0, 0};
const int dy[4] = {0, 0, 1, -1};

int cnt, w, h;
char m[100][100];

void dfs(pii);

int main(void){
    while(cin >> w >> h, w){
        MEMSET(m, '#');

        cnt = 0;
        pii p;

        rep(y, h){
            cin >> m[y];
            rep(x, w) if(m[y][x] == '@') m[y][x] = '.', p = mp(x, y);
        }

        dfs(p);
        cout << cnt << endl;
    }

    return 0;
}

void dfs(pii p){
    if((p.X < 0 || w <= p.X) ||
       (p.Y < 0 || h <= p.Y)) return;

    if(m[p.Y][p.X] == '.') cnt ++;
    else return;
    m[p.Y][p.X] = '#';

    rep(i, 4){
        pii next = mp(p.X + dx[i], p.Y + dy[i]);
        dfs(next);
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:22: error: 'memset' was not declared in this scope
   19 | #define MEMSET(v, h) memset((v), h, sizeof(v))
      |                      ^~~~~~
a.cc:39:9: note: in expansion of macro 'MEMSET'
   39 |         MEMSET(m, '#');
      |         ^~~~~~
a.cc:12:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   11 | #include <cmath>
  +++ |+#include <cstring>
   12 |
Language: C++

6 9
....#.
.....#
......
......
......
......
......
#@...#
.#..#.

Compiler output:
a.cc:2:5: error: stray '#' in program
    2 | ....#.
      |     ^
a.cc:3:6: error: stray '#' in program
    3 | .....#
      |      ^
a.cc:9:2: error: invalid preprocessing directive #@
    9 | #@...#
      |  ^
a.cc:10:2: error: stray '#' in program
   10 | .#..#.
      |  ^
a.cc:10:5: error: stray '#' in program
   10 | .#..#.
      |     ^
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 6 9
      | ^
Language: C++

#include <iostream>
#include <queue>

using namespace std;
typedef pair<int, int> P;

char t[20][20];
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int ans,h,w;
queue<P> q;

int bfs(int x, int y){

  q.push( P(x, y) );
  
  while( !q.empty() ){
    P now = q.front();
    q.pop();
    for( int i = 0 ; i < 4 ; i++ ){
      int nx = now.first + dx[i];
      int ny = now.second + dy[i];
      if( 0 <= nx && nx < w && 0 <= ny && ny <= h 
	  && t[ny][nx] == '.' ){
	t[ny][nx] = '#';
	q.push( P(nx, ny) );
	ans++;
      }
    }
  }
  return ans;
}

int main(void){

  int x,y;
  while( cin >> w >> h, h + w ){

    memset( t, 0, sizeof(t) );
    ans = 1;

    for( int i = 0 ; i < h ; i++ ){
      for( int j = 0 ; j < w ; j++ ){
	cin >> t[i][j];
	if( t[i][j] == '@' ){
	  x = j;
	  y = i;
	}
      }
    }
    cout << bfs(x,y) << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:5: error: 'memset' was not declared in this scope
   39 |     memset( t, 0, sizeof(t) );
      |     ^~~~~~
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++

# -*- coding: utf-8 -*-

count = 0
def dfs(i, j, island):
    global count
    print i, j
    dxy = [(1, 0), (0, 1), (-1, 0), (0, -1)]
    
    if i < 0 or i >= len(island) or j < 0 or j >= len(island[0]):
        return

    if island[i][j] == '#' or island[i][j] == 'x':
        return

    island[i][j] = 'x'
    count += 1
    
    for d in dxy:
        dfs(i+d[0], j+d[1], island)

def solve(w, h, island):
    s_i = 0
    s_j = 0
    for i, row in enumerate(island):
        for j, s in enumerate(row):
            if s == '@':
                s_i = i
                s_j = j
                break

    dfs(s_i, s_j, island)
    print count

def func():
    '''

    '''
    while True:
        global count
        wh = map(int, raw_input().split())
        w = wh[0]
        h = wh[1]
        island = []
        count = 0
        for i in range(h):
            row = []
            line = raw_input()
            for j in line:
                row.append(j)
            island.append(row)
        
        for row in island:
            for j in row:
                print j
            print ''

        solve(w, h, island)
    return None


func()
    

Compiler output:
a.cc:1:3: error: invalid preprocessing directive #-
    1 | # -*- coding: utf-8 -*-
      |   ^
a.cc:35:5: error: empty character constant
   35 |     '''
      |     ^~
a.cc:35:7: warning: missing terminating ' character
   35 |     '''
      |       ^
a.cc:35:7: error: missing terminating ' character
a.cc:37:5: error: empty character constant
   37 |     '''
      |     ^~
a.cc:37:7: warning: missing terminating ' character
   37 |     '''
      |       ^
a.cc:37:7: error: missing terminating ' character
a.cc:55:19: error: empty character constant
   55 |             print ''
      |                   ^~
a.cc:3:1: error: 'count' does not name a type
    3 | count = 0
      | ^~~~~
Language: C++

#include<iostream>
#include<algorithm>

using namespace std;
int W,H;
void solve(int,int);
char dfs[20][20];
int d_x[]={1,0,-1,0},d_y[]={0,1,0,-1};
int main(){
	
	while(1){
		int ans=0;
		cin>>W>>H;
		if(W==0&&H==0)	break;

		int dx,dy;
		for(int i=0;i<H;i++){
			for(int j=0;j<W;j++){
				cin>>dfs[j][i];
				if(dfs[j][i]=='@'){
					dx=j;
					dy=i;
				}
			}
		}
		solve(dx,dy);
		for(int i=0;i<H;i++)
			for(int j=0;j<W;j++)
				if(dfs[j][i]=='T')
					ans++;
		cout<<ans<<endl;
		memset(dfs,0,sizeof(dfs));
	}
}

void solve(int x,int y){
	dfs[x][y]='T';
	
	for(int j=0;j<4;j++){
		int mx=x+d_x[j],my=y+d_y[j];
		if(mx<0||my<0||mx>W||my>H)	continue;
		if(dfs[mx][my]=='.')
			solve(mx,my);
	}
}

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

#include<iostream>
#include<algorithm>

using namespace std;
int W,H;
void solve(int,int);
char dfs[20][20];
int d_x[]={1,0,-1,0},d_y[]={0,1,0,-1};

int main(){
	
	while(1){
		int ans=0;
		cin>>W>>H;
		if(W==0&&H==0)	break;

		int dx,dy;
		for(int i=0;i<H;i++){
			for(int j=0;j<W;j++){
				cin>>dfs[j][i];
				if(dfs[j][i]=='@'){
					dx=j;
					dy=i;
				}
			}
		}
		solve(dx,dy);
		for(int i=0;i<H;i++)
			for(int j=0;j<W;j++)
				if(dfs[j][i]=='T')
					ans++;
		cout<<ans<<endl;
		memset(dfs,0,sizeof(dfs));
	}
}

void solve(int x,int y){
	dfs[x][y]='T';
	
	for(int j=0;j<4;j++){
		int mx=x+d_x[j],my=y+d_y[j];
		if(mx<0||my<0||mx>W||my>H)	continue;
		if(dfs[mx][my]=='.')
			solve(mx,my);
	}
	return ;
}

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

#include<iostream>
#include<algorithm>
#include<memory>
#include<cstdlib>

using namespace std;
int W,H;
void solve(int,int);
char dfs[20][20];
int d_x[]={1,0,-1,0},d_y[]={0,1,0,-1};

int main(){
	
	while(1){
		int ans=0;
		cin>>W>>H;
		if(W==0&&H==0)	break;

		int dx,dy;
		for(int i=0;i<H;i++){
			for(int j=0;j<W;j++){
				cin>>dfs[j][i];
				if(dfs[j][i]=='@'){
					dx=j;
					dy=i;
				}
			}
		}
		solve(dx,dy);
		for(int i=0;i<H;i++)
			for(int j=0;j<W;j++)
				if(dfs[j][i]=='T')
					ans++;
		cout<<ans<<endl;
		memset(dfs,0,sizeof(dfs));
	}
}

void solve(int x,int y){
	dfs[x][y]='T';
	
	for(int j=0;j<4;j++){
		int mx=x+d_x[j],my=y+d_y[j];
		if(mx<0||my<0||mx>W||my>H)	continue;
		if(dfs[mx][my]=='.')
			solve(mx,my);
	}
	return ;
}

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

#include<iostream>
#include<algorithm>
#include<memory>
#include<cstdlib>

using namespace std;
int W,H;
void solve(int,int);
char dfs[20][20];
int d_x[]={1,0,-1,0},d_y[]={0,1,0,-1};

int main(){
	
	while(1){
		int ans=0;
		cin>>W>>H;
		if(W==0&&H==0)	break;

		int dx,dy;
		for(int i=0;i<H;i++){
			for(int j=0;j<W;j++){
				cin>>dfs[j][i];
				if(dfs[j][i]=='@'){
					dx=j;
					dy=i;
				}
			}
		}
		solve(dx,dy);
		for(int i=0;i<H;i++)
			for(int j=0;j<W;j++)
				if(dfs[j][i]=='T')
					ans++;
		cout<<ans<<endl;
		memset(dfs,0,sizeof(dfs));
	}
	return 0;
}

void solve(int x,int y){
	dfs[x][y]='T';
	
	for(int j=0;j<4;j++){
		int mx=x+d_x[j],my=y+d_y[j];
		if(mx<0||my<0||mx>W||my>H)	continue;
		if(dfs[mx][my]=='.')
			solve(mx,my);
	}
	return ;
}

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

#include <iostream>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <map>
#include <queue>
#include <memory.h>
using namespace std;
const int INF = 2 << 27;
#define ll long long
typedef pair<int,int> P;

int p;
int q;
int a;
int n;

int solv(int id, int v[]);
int lcm(int a, int b);
int gcd(int a, int b);

int main() {
  	while(1) {
  			cin >> p >> q >> a >> n;
  			if(p == 0 && q == 0 && a == 0 && n == 0) break;
        int x[8];
  			int ret = solv(0,x);
  			cout << ret << endl;
  	}
}

int solv(int id, int v[]) {
  if(id != 0) {
    int pp = 1;
    int qq = v[0];
    for(int i = 1; i < id; i++) {
      int llcm = lcm(qq,v[i]);
      int ql = llcm / qq;
      qq = llcm;
      pp *= ql;

      int vl = llcm / v[i];
      pp += vl;
    }
    int llcm = lcm(qq,q);
    int ql = llcm / q;
    int ppx = p * ql;

    int qql = llcm / qq;
    pp *= qql;
    if(ppx < pp) return 0;
    if(ppx == pp) return 1;
  }
  if(id >= n) return 0;
  int Max = 1;
  int now = 1;
  for(int i = 0; i < id; i++) {
    now *= v[i];
    Max = max(v[i], Max);
  }
  int ret = 0;
  int HOGE = (int)(a / now) +((a % now == 0)?1:0);
  for(int i = Max; i <= HOGE; i++) {
    v[id] = i;
    ret += solv(id+1,v);
    v[id] = 0;
  }
  return ret;
}
int gcd(int a, int b) {
  if(b > a) {
    return gcd(b,a);
  }
  if(b == 0) return a;
  return gcd(b,a % b);
}
int lcm(int a, int b) {
  return a * b / gcd(a,b);
}

Compiler output:
Main.java:1: error: illegal character: '#'
#include <iostream>
^
Main.java:2: error: illegal character: '#'
#include <vector>
^
Main.java:3: error: illegal character: '#'
#include <math.h>
^
Main.java:4: error: illegal character: '#'
#include <stdio.h>
^
Main.java:5: error: illegal character: '#'
#include <algorithm>
^
Main.java:6: error: illegal character: '#'
#include <string>
^
Main.java:7: error: illegal character: '#'
#include <map>
^
Main.java:8: error: illegal character: '#'
#include <queue>
^
Main.java:9: error: illegal character: '#'
#include <memory.h>
^
Main.java:11: error: class, interface, enum, or record expected
const int INF = 2 << 27;
^
Main.java:12: error: illegal character: '#'
#define ll long long
^
Main.java:12: error: class, interface, enum, or record expected
#define ll long long
        ^
Main.java:15: error: unnamed classes are a preview feature and are disabled by default.
int p;
^
  (use --enable-preview to enable unnamed classes)
Main.java:26: error: not a statement
  			cin >> p >> q >> a >> n;
  			                   ^
Main.java:30: error: not a statement
  			cout << ret << endl;
  			            ^
Main.java:28: error: ']' expected
        int x[8];
              ^
16 errors