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

#include <stdio.h>

int que[400][2], top, end;
int dir[4][2]={{1,0}{0,1}{0,-1}{-1,0}};
char tile1[22][22], tile2[22][22];

int main(void)
{
    int w, h, i, a1, a2, b1, b2, ans;
    
    while(scanf("%d %d ", &w, &h)&&w){
        memset(tile1, 0, sizeof(tile1));
        for(i=0, a1=0; a1<h; a1++){
            scanf("%s", tile1[a1]);
            for(b1=0; b1<w; b1++){
                if(tile2[a1][b1])=='@'){
                    que[0][0]=a1, que[0][1]=b1;
                    tile1[a1][b1]=1, top=0, end=1, i=1:
                }
            }
        }
        while(top<end){
            a1=que[top][0], b1=que[top++][1];
            for(i=0; i<4; i++){
                a2=a1+dir[i][0], b2=b1+dir[i][1];
                if(a2<0||a2>=h||b2<0||b2>=w||tile2[a2][b2]=='#')
                    continue;
                tile1[a2][b2]=1;
                que[end][0]=a2, que[end][1]=b2;
            }
        }
        for(ans=0, a1=0;, a1<h; a1++)
            for(b1=0; b1<w; b1++)
                ans+=tile1[a1][b1];
        printf("%d\n", ans);
    }
}



Compiler output:
main.c:4:21: error: expected '}' before '{' token
    4 | int dir[4][2]={{1,0}{0,1}{0,-1}{-1,0}};
      |               ~     ^
main.c: In function 'main':
main.c:12:9: error: implicit declaration of function 'memset' [-Wimplicit-function-declaration]
   12 |         memset(tile1, 0, sizeof(tile1));
      |         ^~~~~~
main.c:2:1: note: include '<string.h>' or provide a declaration of 'memset'
    1 | #include <stdio.h>
  +++ |+#include <string.h>
    2 | 
main.c:12:9: warning: incompatible implicit declaration of built-in function 'memset' [-Wbuiltin-declaration-mismatch]
   12 |         memset(tile1, 0, sizeof(tile1));
      |         ^~~~~~
main.c:12:9: note: include '<string.h>' or provide a declaration of 'memset'
main.c:16:34: error: expected expression before '==' token
   16 |                 if(tile2[a1][b1])=='@'){
      |                                  ^~
main.c:16:39: error: expected statement before ')' token
   16 |                 if(tile2[a1][b1])=='@'){
      |                                       ^
main.c:18:55: error: expected ';' before ':' token
   18 |                     tile1[a1][b1]=1, top=0, end=1, i=1:
      |                                                       ^
      |                                                       ;
main.c:32:25: error: expected expression before ',' token
   32 |         for(ans=0, a1=0;, a1<h; a1++)
      |                         ^
Language: C

#include <stdio.h>

int que[400][2], top, end;
int dir[4][2]={{1,0}{0,1}{0,-1}{-1,0}};
char tile1[22][22], tile2[22][22];

int main(void)
{
    int w, h, i, a1, a2, b1, b2, ans;
    
    while(scanf("%d %d ", &w, &h)&&w){
        memset(tile1, 0, sizeof(tile1));
        for(i=0, a1=0; a1<h; a1++){
            scanf("%s", tile1[a1]);
            for(b1=0; b1<w; b1++){
                if(tile2[a1][b1])=='@'){
                    que[0][0]=a1, que[0][1]=b1;
                    tile1[a1][b1]=1, top=0, end=1, i=1:
                }
            }
        }
        while(top<end){
            a1=que[top][0], b1=que[top++][1];
            for(i=0; i<4; i++){
                a2=a1+dir[i][0], b2=b1+dir[i][1];
                if(a2<0||a2>=h||b2<0||b2>=w||tile2[a2][b2]=='#')
                    continue;
                tile1[a2][b2]=1;
                que[end][0]=a2, que[end][1]=b2;
            }
        }
        for(ans=0, a1=0; a1<h; a1++)
            for(b1=0; b1<w; b1++)
                ans+=tile1[a1][b1];
        printf("%d\n", ans);
    }
}



Compiler output:
main.c:4:21: error: expected '}' before '{' token
    4 | int dir[4][2]={{1,0}{0,1}{0,-1}{-1,0}};
      |               ~     ^
main.c: In function 'main':
main.c:12:9: error: implicit declaration of function 'memset' [-Wimplicit-function-declaration]
   12 |         memset(tile1, 0, sizeof(tile1));
      |         ^~~~~~
main.c:2:1: note: include '<string.h>' or provide a declaration of 'memset'
    1 | #include <stdio.h>
  +++ |+#include <string.h>
    2 | 
main.c:12:9: warning: incompatible implicit declaration of built-in function 'memset' [-Wbuiltin-declaration-mismatch]
   12 |         memset(tile1, 0, sizeof(tile1));
      |         ^~~~~~
main.c:12:9: note: include '<string.h>' or provide a declaration of 'memset'
main.c:16:34: error: expected expression before '==' token
   16 |                 if(tile2[a1][b1])=='@'){
      |                                  ^~
main.c:16:39: error: expected statement before ')' token
   16 |                 if(tile2[a1][b1])=='@'){
      |                                       ^
main.c:18:55: error: expected ';' before ':' token
   18 |                     tile1[a1][b1]=1, top=0, end=1, i=1:
      |                                                       ^
      |                                                       ;
Language: C

#include <stdio.h>

int que[400][2], top, end;
int dir[4][2]={{1,0}{0,1}{0,-1}{-1,0}};
char tile1[22][22], tile2[22][22];

int main(void)
{
    int w, h, i, a1, a2, b1, b2, ans;
    
    while(scanf("%d %d ", &w, &h)&&w){
        memset(tile1, 0, sizeof(tile1));
        for(i=0, a1=0; a1<h; a1++){
            scanf("%s", tile1[a1]);
            for(b1=0; b1<w; b1++){
                if(tile2[a1][b1]=='@'){
                    que[0][0]=a1, que[0][1]=b1;
                    tile1[a1][b1]=1, top=0, end=1, i=1:
                }
            }
        }
        while(top<end){
            a1=que[top][0], b1=que[top++][1];
            for(i=0; i<4; i++){
                a2=a1+dir[i][0], b2=b1+dir[i][1];
                if(a2<0||a2>=h||b2<0||b2>=w||tile2[a2][b2]=='#')
                    continue;
                tile1[a2][b2]=1;
                que[end][0]=a2, que[end][1]=b2;
            }
        }
        for(ans=0, a1=0; a1<h; a1++)
            for(b1=0; b1<w; b1++)
                ans+=tile1[a1][b1];
        printf("%d\n", ans);
    }
}



Compiler output:
main.c:4:21: error: expected '}' before '{' token
    4 | int dir[4][2]={{1,0}{0,1}{0,-1}{-1,0}};
      |               ~     ^
main.c: In function 'main':
main.c:12:9: error: implicit declaration of function 'memset' [-Wimplicit-function-declaration]
   12 |         memset(tile1, 0, sizeof(tile1));
      |         ^~~~~~
main.c:2:1: note: include '<string.h>' or provide a declaration of 'memset'
    1 | #include <stdio.h>
  +++ |+#include <string.h>
    2 | 
main.c:12:9: warning: incompatible implicit declaration of built-in function 'memset' [-Wbuiltin-declaration-mismatch]
   12 |         memset(tile1, 0, sizeof(tile1));
      |         ^~~~~~
main.c:12:9: note: include '<string.h>' or provide a declaration of 'memset'
main.c:18:55: error: expected ';' before ':' token
   18 |                     tile1[a1][b1]=1, top=0, end=1, i=1:
      |                                                       ^
      |                                                       ;
Language: C

#include <stdio.h>

int que[400][2], top, end;
int dir[4][2]={{1,0}, {0,1}, {0,-1}, {-1,0}};
char tile1[22][22], tile2[22][22];

int main(void)
{
    int w, h, i, a1, a2, b1, b2, ans;
    
    while(scanf("%d %d ", &w, &h)&&w){
        memset(tile1, 0, sizeof(tile1));
        for(i=0, a1=0; a1<h; a1++){
            scanf("%s", tile1[a1]);
            for(b1=0; b1<w; b1++){
                if(tile2[a1][b1]=='@'){
                    que[0][0]=a1, que[0][1]=b1;
                    tile1[a1][b1]=1, top=0, end=1, i=1:
                }
            }
        }
        while(top<end){
            a1=que[top][0], b1=que[top++][1];
            for(i=0; i<4; i++){
                a2=a1+dir[i][0], b2=b1+dir[i][1];
                if(a2<0||a2>=h||b2<0||b2>=w||tile2[a2][b2]=='#')
                    continue;
                tile1[a2][b2]=1;
                que[end][0]=a2, que[end][1]=b2;
            }
        }
        for(ans=0, a1=0; a1<h; a1++)
            for(b1=0; b1<w; b1++)
                ans+=tile1[a1][b1];
        printf("%d\n", ans);
    }
}



Compiler output:
main.c: In function 'main':
main.c:12:9: error: implicit declaration of function 'memset' [-Wimplicit-function-declaration]
   12 |         memset(tile1, 0, sizeof(tile1));
      |         ^~~~~~
main.c:2:1: note: include '<string.h>' or provide a declaration of 'memset'
    1 | #include <stdio.h>
  +++ |+#include <string.h>
    2 | 
main.c:12:9: warning: incompatible implicit declaration of built-in function 'memset' [-Wbuiltin-declaration-mismatch]
   12 |         memset(tile1, 0, sizeof(tile1));
      |         ^~~~~~
main.c:12:9: note: include '<string.h>' or provide a declaration of 'memset'
main.c:18:55: error: expected ';' before ':' token
   18 |                     tile1[a1][b1]=1, top=0, end=1, i=1:
      |                                                       ^
      |                                                       ;
Language: C

#include <stdio.h>

char s[21][21];
int count, h, w;
int dx[] = { 0,0,1,-1 };
int dy[] = { 1,-1,0,0 };

void dfs(int x, int y){
	count++;
	s[y][x] = '#';
	int i;
	for(i = 0; i<4; i++){
		int nx = x + dx[i];
		int ny = y + dy[i];

		if (nx >= 0 && nx < w && ny >= 0 && ny < h && s[ny][nx] == '.') {
			dfs(nx, ny);
		}
	}
}

int main(void){
	while(0){
		scanf("%d %d", &w, &h);
		scanf("%s", &a);
		if(!w && !h){	
			break;
		}
		count = 0;
		int i, j, x, y;
		char a;
		for(i = 0; i<h; i++){
			for(j = 0; j<w; j++){
				scanf("%s", s[i][j]);
				if(s[i][j] == '@'){
					x = j;
					y = i;
				}
			}
			scanf("%s", &a);
		}
		dfs(x, y);
		printf("%d\n",count);
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:25:30: error: 'a' undeclared (first use in this function)
   25 |                 scanf("%s", &a);
      |                              ^
main.c:25:30: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
using namespace std;
#define MOD 1000000007
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec; typedef pair<int, int> pi;
int dd[] = { 0, 1, 0, -1 };


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

		char C[30][30];
		int B[30][30];

		int sx = -1; int sy = -1;
		for (int i = 0; i < H; i++)
		{
			for (int j = 0; j < W; j++)
			{
				cin >> C[i][j];
				B[i][j] = 0;
				if (C[i][j] == '@')
				{
					sy = i;
					sx = j;
				}
			}
		}

		queue<pi> Q;
		Q.push(pi(sy, sx));
		B[sy][sx] = 1;
		int ans = 1;
		while (!Q.empty())
		{
			int ty = Q.front().first; int tx = Q.front().second;
			Q.pop();

			for (int r = 0; r < 4; r++)
			{
				int y = ty + dd[r];
				int x = tx + dd[r + 1];
				if (y < 0 || y >= H || x < 0 || x >= W)continue;
				if (C[y][x] == '#')continue;
				if (B[y][x])continue;
				ans++;
				B[y][x] = 1;
				Q.push(pi(y, x));
			}
		}

		cout << ans << endl;
	}
	return 0;
}

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

import java.util.*;
    
public class Main {
  private static Scanner sc = new Scanner(System.in);
  public static void main(String...args) {
    while(sc.hasNext()) {
      final int W = sc.nextInt();
      final int H = sc.nextInt();
      if (W == 0 && H == 0)
        break;
      solve(W, H);
    }
  }
  private static void solve(final int W, final int H) {
    final char[][] map = new char[H][];
    for(int i = 0; i < H; i++)
      map[i] = sc.next().toCharArray();
    final Deque<Integer> deq = new ArrayDeque<Integer>();
    for(int i = 0; i < H; i++)
      for(int j = 0; j < W; j++)
        if(map[i][j] == '@')
          deq.offer(i * W + j);
    int ans = 0;
    while(!deq.isEmpty()) {
      final int p = deq.poll();
      final int i = p / W;
      final int j = p % W;
      for(int d = 0; d < 4; d++) {
        final int ni = i + di[d];
        final int nj = j + dj[d];
        if(0 <= ni && ni < H && 0 <= nj && nj < W && map[ni][nj] == '.') {
          map[ni][nj] = '#';
          deq.offer(ni * W + nj);
          ans++;
        }
      }
    }
    System.out.println(ans);
  }
  private static final int[] di = { 1, 0, -1, 0};
  private static final int[] dj = { 0, 1, 0, -1 };
}

Compiler output:
main.c:1:1: error: unknown type name 'import'
    1 | import java.util.*;
      | ^~~~~~
main.c:1:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    1 | import java.util.*;
      |            ^
main.c:3:1: error: unknown type name 'public'
    3 | public class Main {
      | ^~~~~~
main.c:3:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Main'
    3 | public class Main {
      |              ^~~~
Language: C++

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

#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(v) v.begin(),v.end()

using int64 = long long;

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

int main(void){
	int32 H, W;
	while(cin >> H >> W && H && W){
		vector<string> f(H+2, string(W+2, '#'));
		int sy, sx;
		REP(i, H){
			cin >> f[i+1];
			REP(j, W+2)
				if(f[i+1][j] == '@'){
					sy = i+1;
					sx = j;
				}
			f[i+1][0] = f[i+1][W+1] = '#';
		}
		bool visited[30][30] = {};
		int cnt = 0;
		
		auto dfs = [&](int y, int x){
			visited[y][x] = 1;
			cnt++;
			REP(i, 4){
				int yy = y+dy[i], xx = x+dx[i];
				if(f[yy][xx] != '#' && !visited[yy][xx]){
					dfs(yy, xx);
				}
			}
		};
		dfs(sy, sx);
		cout << cnt << endl;
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: error: 'int32' was not declared in this scope
   14 |         int32 H, W;
      |         ^~~~~
a.cc:15:22: error: 'H' was not declared in this scope
   15 |         while(cin >> H >> W && H && W){
      |                      ^
a.cc:15:27: error: 'W' was not declared in this scope
   15 |         while(cin >> H >> W && H && W){
      |                           ^
a.cc: In lambda function:
a.cc:36:41: error: use of 'dfs' before deduction of 'auto'
   36 |                                         dfs(yy, xx);
      |                                         ^~~
Language: C++

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

#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(v) v.begin(),v.end()

using int64 = long long;

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

int main(void){
	int H, W;
	while(cin >> H >> W && H && W){
		vector<string> f(H+2, string(W+2, '#'));
		int sy, sx;
		REP(i, H){
			cin >> f[i+1];
			REP(j, W+2)
				if(f[i+1][j] == '@'){
					sy = i+1;
					sx = j;
				}
			f[i+1][0] = f[i+1][W+1] = '#';
		}
		bool visited[30][30] = {};
		int cnt = 0;
		
		auto dfs = [&](int y, int x){
			visited[y][x] = 1;
			cnt++;
			REP(i, 4){
				int yy = y+dy[i], xx = x+dx[i];
				if(f[yy][xx] != '#' && !visited[yy][xx]){
					dfs(yy, xx);
				}
			}
		};
		dfs(sy, sx);
		cout << cnt << endl;
	}
}'


Compiler output:
a.cc:1:1: warning: missing terminating ' character
    1 | '#include <bits/stdc++.h>
      | ^
a.cc:1:1: error: missing terminating ' character
    1 | '#include <bits/stdc++.h>
      | ^~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:43:2: warning: missing terminating ' character
   43 | }'
      |  ^
a.cc:43:2: error: missing terminating ' character
a.cc: In function 'int main()':
a.cc:15:15: error: 'cin' was not declared in this scope
   15 |         while(cin >> H >> W && H && W){
      |               ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | '#include <bits/stdc++.h>
a.cc:16:17: error: 'vector' was not declared in this scope
   16 |                 vector<string> f(H+2, string(W+2, '#'));
      |                 ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | '#include <bits/stdc++.h>
a.cc:16:24: error: 'string' was not declared in this scope
   16 |                 vector<string> f(H+2, string(W+2, '#'));
      |                        ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
  +++ |+#include <string>
    1 | '#include <bits/stdc++.h>
a.cc:16:32: error: 'f' was not declared in this scope
   16 |                 vector<string> f(H+2, string(W+2, '#'));
      |                                ^
a.cc: In lambda function:
a.cc:36:41: error: use of 'dfs' before deduction of 'auto'
   36 |                                         dfs(yy, xx);
      |                                         ^~~
a.cc: In function 'int main()':
a.cc:41:17: error: 'cout' was not declared in this scope
   41 |                 cout << cnt << endl;
      |                 ^~~~
a.cc:41:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:41:32: error: 'endl' was not declared in this scope
   41 |                 cout << cnt << endl;
      |                                ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | '#include <bits/stdc++.h>
Language: C++

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

#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(v) v.begin(),v.end()

using int64 = long long;

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

int main(void){
	int H, W;
	while(cin >> H >> W && H && W){
		vector<string> f(H+2, string(W+2, '#'));
		int sy, sx;
		REP(i, H){
			cin >> f[i+1];
			REP(j, W+2)
				if(f[i+1][j] == '@'){
					sy = i+1;
					sx = j;
				}
			f[i+1][0] = f[i+1][W+1] = '#';
		}
		bool visited[30][30] = {};
		int cnt = 0;
		
		auto dfs = [&](int y, int x){
			visited[y][x] = 1;
			cnt++;
			REP(i, 4){
				int yy = y+dy[i], xx = x+dx[i];
				if(f[yy][xx] != '#' && !visited[yy][xx]){
					dfs(yy, xx);
				}
			}
		};
		dfs(sy, sx);
		cout << cnt << endl;
	}
}'


Compiler output:
a.cc:43:2: warning: missing terminating ' character
   43 | }'
      |  ^
a.cc:43:2: error: missing terminating ' character
a.cc: In lambda function:
a.cc:36:41: error: use of 'dfs' before deduction of 'auto'
   36 |                                         dfs(yy, xx);
      |                                         ^~~
Language: C++

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

#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(v) v.begin(),v.end()

using int64 = long long;

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

int main(void){
	int H, W;
	while(cin >> H >> W && H && W){
		vector<string> f(H+2, string(W+2, '#'));
		int sy, sx;
		REP(i, H){
			cin >> f[i+1];
			REP(j, W+2){
				if(f[i+1][j] == '@'){
					sy = i+1;
					sx = j;
				}
}
			f[i+1][0] = f[i+1][W+1] = '#';
		}
		bool visited[30][30] = {};
		int cnt = 0;
		
		auto dfs = [&](int y, int x){
			visited[y][x] = 1;
			cnt++;
			REP(i, 4){
				int yy = y+dy[i], xx = x+dx[i];
				if(f[yy][xx] != '#' && !visited[yy][xx]){
					dfs(yy, xx);
				}
			}
		};
		dfs(sy, sx);
		cout << cnt << endl;
	}
}'


Compiler output:
a.cc:44:2: warning: missing terminating ' character
   44 | }'
      |  ^
a.cc:44:2: error: missing terminating ' character
a.cc: In lambda function:
a.cc:37:41: error: use of 'dfs' before deduction of 'auto'
   37 |                                         dfs(yy, xx);
      |                                         ^~~
Language: C++

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

#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(v) v.begin(),v.end()

using int64 = long long;

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

int main(void){
	int H, W;
	while(cin >> H >> W && H && W){
		vector<string> f(H+2, string(W+2, '#'));
		int sy, sx;
		REP(i, H){
			cin >> f[i+1];
			REP(j, W+2)
				if(f[i+1][j] == '@'){
					sy = i+1;
					sx = j;
				}
			f[i+1][0] = f[i+1][W+1] = '#';
		}
		bool visited[30][30] = {};
		int cnt = 0;
		
		function<void(int, int)> dfs = [&](int y, int x){
			visited[y][x] = 1;
			cnt++;
			REP(i, 4){
				int yy = y+dy[i], xx = x+dx[i];
				if(f[yy][xx] != '#' && !visited[yy][xx]){
					dfs(yy, xx);
				}
			}
		};
		dfs(sy, sx);
		cout << cnt << endl;
	}
}'


Compiler output:
a.cc:43:2: warning: missing terminating ' character
   43 | }'
      |  ^
a.cc:43:2: error: missing terminating ' character
Language: C++

#pragma GCC optimize("O3")

#include <cstdio>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;
const int N=25;
int a[N*N];
char c[N][N];
int root(int x){
	int i=x;
	while(1){
		if(a[x]==x) break;
		x=a[x];
	}
	int j=x;
	while(1){
		if(a[i]==i) break;
		x=a[i],a[i]=j,i=x;
	}
	return j;
}
int main(){
	int m,n;
	while(scanf("%d%d",&n,&m)){
		if(m==0&&n==0) break;
		getchar();
		int i,j;
		for(i=1;i<=m*n;i++) a[i]=i;
		for(i=0;i<m;i++) gets(c[i]);
		for(i=0;i<m;i++){
			for(j=0;j<n;j++){
				if(c[i][j]=='#') continue;
				int r=root(i*n+j+1),rr;
				if(i&&c[i-1][j]!='#'){
					rr=root((i-1)*n+j+1);
					if(r!=rr) a[rr]=r;
				}
				if(i+1<m&&c[i+1][j]!='#'){
					rr=root((i+1)*n+j+1);
					if(r!=rr) a[rr]=r;
				}
				if(j&&c[i][j-1]!='#'){
					rr=root(i*n+j-1+1);
					if(r!=rr) a[rr]=r; 
				}
				if(j+1<n&&c[i][j+1]!='#'){
					rr=root(i*n+j+1+1);
					if(r!=rr) a[rr]=r;
				}
			}
		}
		int s,ans=0;
		for(i=0;i<m;i++){
			for(j=0;j<n;j++){
				if(c[i][j]=='@'){
					s=root(i*n+j+1);
					for(int k=1;k<=m*n;k++){
						if(s==root(k)) ans++;
					}
					printf("%d\n",ans);
					break;
				}
			}
			if(j<n) break;
		}
	}
	
	return 0;
}


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

#include<iostream>
#include<string>
#include<queue>
#include <utility>
#include <functional>
//#include<>
using namespace std;

const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
//#define int long long;
signed main(){
  int w, h;
  while(cin >> w >> h, w){
    int cnt{};
    vector<string> v(h);
    for(int i = 0; i < h; ++i){
      cin >> v[i];
    }
    //initialize
    pair<int, int> p;
    queue<pair<int, int>> q;	
    for(int i = 0; i < h; ++i){
      for(int j = 0; j < w; ++j){
	if(v[i][j] == '@'){
	  p = make_pair(i,j);
	  q.push(p);
	}
      }
    }
    while(!q.empty()){
      pair<int, int> p;
      p = q.front();
      q.pop();

      for(int k = 0; k < 4; ++k){
	int x = p.first + dx[k]; int y = p.second + dy[k];
	if(0 > x || h <= x || 0 > y || w <= y)continue;
	if('.' == v[x][y]){
	  v[x][y] = '@';
	  ++cn
	  q.push(make_pair(x, y));
	}
      }
    }
    cout << cnt+1 << endl;
  }
  return 0;
}



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

#include <iostream>
#include <string>

using namespace std;
int W, H;
string s[20];
int num;
int dx[4] = {0, 1, 0, -1};
int dy[4] = {-1, 0, 1, 0};

void dfs(int x, int y){
  num++;
  s[y][x] = '#';
  for(int i=0; i<4; i++){
    if(0<=x+dx[i] && x+dx[i]<W && 0<=y+dy[i] && y+dy<H && s[y+dy[i]][x+dx[i]]=='.'){
      dfs(x+dx[i], y+dy[i]);
    }
  }
}

int main(){
  while(cin >> W >> H, W || H){
    for(int i=0; i<H; i++){
      cin >> s[i];
    }
    int x, y;
    for(int i=0; i<H; i++){
      for(int j=0; j<W; j++){
	if(s[i][j] == '@'){
	  x = j;
	  y = i;
	}
      }
    }
    num = 0;
    dfs(x, y);
    cout << num << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:15:53: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   15 |     if(0<=x+dx[i] && x+dx[i]<W && 0<=y+dy[i] && y+dy<H && s[y+dy[i]][x+dx[i]]=='.'){
      |                                                 ~~~~^~
Language: C++

#include<iostream>
#include<queue>
#include<string>
#include<map>
#define F first
#define S second
using namespace std;

char c[33][33];
int w,h;

int solve(int x, int y){
  typedef pair < int, int > P;
  queue < P > que;
  int count = 0;

  que.push( P(x, y) );
  
  while(!que.empty()){
    P q = que.front(); que.pop();
    
    int dx[] = {0, 0, 1, -1};
    int dy[] = {1, -1, 0, 0};
    
    for(int i=0;i<4;i++){
      int xx = dx[i] + q.F;
      int yy = dy[i] + q.S;

      if(xx < 0 || yy < 0 || xx == w || yy == h) continue;
      if(c[yy][xx] == '#') continue;

      c[yy][xx] = '#';
      que.push( P(xx, yy) );
      count++;
    }

  }

  return count;
}

int main(){

  int sx, sy;
  while(true){
    cin >> w >> h;
    if(!w && !h) break;

    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	cin >> c[i][j];
	if(c[i][j] == '@') sx = j, sy = i;
      }
    }

    while(!que.empty()) que.pop();
    cout << solve(sx, sy) << endl;
  }

}

Compiler output:
a.cc: In function 'int main()':
a.cc:56:12: error: 'que' was not declared in this scope
   56 |     while(!que.empty()) que.pop();
      |            ^~~
Language: C++

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		while (true) {
			int w = 1;
			int h = 1;
			int moveCan = 0;

			w = scan.nextInt();
			h = scan.nextInt();

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

			char[][] table = new char[h][w];
			// int[][] num = new int[h][w];

			for (int i = 0; i < h; i++) {
				// for (int j = 0; j < w; j++) {
				table[i]/* [j] */= scan.next().toCharArray();
				// }
			}

			moveCan = AtCheck(table, w, h);
			System.out.println(moveCan);
		}

		scan.close();
	}

	public static int AtCheck(char table[][], int w, int h) {
		int befAtNum = 0;
		int aftAtNum = 0;

		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if (table[i][j] == '@')
					befAtNum++;
			}
		}

		int[][] atPlace = new int[h][w];
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if (table[i][j] == '@') {
					atPlace[i][j] = 1;
					// if (i != (h - 1) && j != (w - 1) && i != 0 && j != 0
					// && table[i - 1][j - 1]=='.')
					// atPlace[i - 1][j - 1] = 1;
					if (j != 0 && table[i][j - 1] == '.')
						atPlace[i][j - 1] = 1;
					// if (i != (h - 1) && j != (w - 1) && i != 0 && j != 0
					// && table[i + 1][j - 1]=='.')
					// atPlace[i + 1][j - 1] = 1;
					if (i != 0 && table[i - 1][j] == '.')
						atPlace[i - 1][j] = 1;
					if (i != (h - 1) && table[i + 1][j] == '.')
						atPlace[i + 1][j] = 1;
					// if (i != (h - 1) && j != (w - 1) && i != 0 && j != 0
					// && table[i - 1][j + 1]=='.')
					// atPlace[i - 1][j + 1] = 1;
					if (j != (w - 1) && table[i][j + 1] == '.')
						atPlace[i][j + 1] = 1;
					// if (i != (h - 1) && j != (w - 1) && i != 0 && j != 0
					// && table[i + 1][j + 1]=='.')
					// atPlace[i + 1][j + 1] = 1;
				}
			}
		}

		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if (atPlace[i][j] == 1)
					table[i][j] = '@';
			}
		}
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if (table[i][j] == '@')
					aftAtNum++;
			}
		}
		if (befAtNum != aftAtNum) {
			return AtCheck(table, w, h);
		} else {
			return aftAtNum;
		}
	}

}

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

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

const dx[] = {-1, 0, 1, 0};
const dy[] = {0, -1, 0, 1};
char tile[40][40];
int h, w;

int search(int nx, int ny)
{
	int sum = 0;
	if (ny == 0 || nx == 0 || ny == h + 1 || nx == w + 1)return (sum);
	if (tile[nx][ny] == '.' || tile[nx][ny] == '@'){
		sum++;
	}
	
	tile[nx][ny] = '#';
	
	for (int i = 0; i < 4; i++){
		if (tile[nx + dx[i]][ny + dy[i]] != '#'){
			sum += search(nx + dx[i], ny + dy[i]);
		}
	}
	return (sum);
}
		
int main()
{
	while (1){
		
		scanf("%d %d", &w, &h);
		
		if (h == 0 && w == 0)return (0);
		int mx, my;
		for (int i = 1; i <= h; i++){
			for (int j = 1; j <= w; j++){
				scanf(" %c", &tile[j][i]);
				if (tile[j][i] == '@'){
					mx = j;
					my = i;
				}
			}
		}
		printf("%d\n", search(mx, my));
	}

}

Compiler output:
a.cc:6:7: error: 'dx' does not name a type
    6 | const dx[] = {-1, 0, 1, 0};
      |       ^~
a.cc:7:7: error: 'dy' does not name a type
    7 | const dy[] = {0, -1, 0, 1};
      |       ^~
a.cc: In function 'int search(int, int)':
a.cc:22:31: error: 'dx' was not declared in this scope; did you mean 'nx'?
   22 |                 if (tile[nx + dx[i]][ny + dy[i]] != '#'){
      |                               ^~
      |                               nx
a.cc:22:43: error: 'dy' was not declared in this scope; did you mean 'ny'?
   22 |                 if (tile[nx + dx[i]][ny + dy[i]] != '#'){
      |                                           ^~
      |                                           ny
Language: C++

#include<iostream>
using namespace std;
int w,h;
char tail[21][21];
int a[]={-1,0,1,0};
int b[]={0,1,0,-1};
int cnt=0;
void func(int x,int y);
main(){
  int sx,sy;
  while(1){
    cin>> w>> h
      if(w==0&&h==0) break;
    cnt=0;
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	cin>> tail[i][j];
	if(tail[i][j]=='@'){
	  sx=j;
	  sy=i;
	}
      }
    }
    func(sx,sy);
    cout<< cnt<< endl;
  }
}

void func(int x,int y){
  tail[y][x]='#';
  cnt++;
  for(int i=0;i<4;i++){
    int nx=x+a[i];
    int ny=y+b[i];
    if(nx>=0 && nx<w && ny>=0 && ny<h && tail[ny][nx]!='#'){
      func(nx,ny);
    }
  }
}

Compiler output:
a.cc:9:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    9 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:12:16: error: expected ';' before 'if'
   12 |     cin>> w>> h
      |                ^
      |                ;
   13 |       if(w==0&&h==0) break;
      |       ~~
Language: C++

#include<iostream>
using namespace std;

int dfs(int x,int y);
int h,w;
char ta[22][22];
//int cheak[22][22]={0};
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int cou=0;

int main(){
  int a,b;
  while(1){
    cin >> w >> h;
    if(w==0 && h==0) break;
    cou=0;
    
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	cin >> ta[i][j];
	cheak[i][j]=0;
	if(ta[i][j] == '@'){
	  a=i,b=j;
	}
      }
    }
    //cout << a << " " << b << endl;
    cout << dfs(a,b) << endl;
    /*for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
      cout << cheak[i][j];
      }
      cout << endl;
      }*/
  }
}

void dfs(int x,int y){
  //cheak[x][y]=1;
  ta[nx][ny]='#';
  cou++;
  for(int i=0;i<4;i++){
    int nx=x+dx[i];
    int ny=y+dy[i];
    if(nx>=0 && nx<h && ny>=0 && ny<w && ta[nx][ny]=='.'){
      dfs(nx,ny);
    }
  }
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:22:9: error: 'cheak' was not declared in this scope
   22 |         cheak[i][j]=0;
      |         ^~~~~
a.cc: At global scope:
a.cc:39:6: error: ambiguating new declaration of 'void dfs(int, int)'
   39 | void dfs(int x,int y){
      |      ^~~
a.cc:4:5: note: old declaration 'int dfs(int, int)'
    4 | int dfs(int x,int y);
      |     ^~~
a.cc: In function 'void dfs(int, int)':
a.cc:41:6: error: 'nx' was not declared in this scope; did you mean 'x'?
   41 |   ta[nx][ny]='#';
      |      ^~
      |      x
a.cc:41:10: error: 'ny' was not declared in this scope; did you mean 'y'?
   41 |   ta[nx][ny]='#';
      |          ^~
      |          y
Language: C++

#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define rer(i, a, b) for (int i = (int)a; i <= (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<int> > vvi;
typedef vector<pair<int, int> > vpii;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

const int inf = 1000000000;
const int mod = 1000000007;
const double eps = 1e-9;
const int dx[] = { -1, 0, 1, 0};
const int dy[] = { 0, -1, 0, 1};

string field[];

void dfs(int y, int x) {
	if (x < 0 || y < 0 || x == w || y == h) return;
	if (field[y][x] == '#') return;
	ans++;
	field[y][x] = '#';
	rep(i, 4) dfs(y + dy[i], x + dx[i]);
}

int main() {
	int W, H;
	while (cin >> W >> H, W) {
		int ans = 0;
		rep(i, H) cin >> s[i];
		rep(i, H) rep(i, W) {
			if (s[i][j] == '@') solve(i, j);
		}
	}
	return 0;
}

Compiler output:
a.cc:27:8: error: array size missing in 'field'
   27 | string field[];
      |        ^~~~~
a.cc: In function 'void dfs(int, int)':
a.cc:30:36: error: 'w' was not declared in this scope
   30 |         if (x < 0 || y < 0 || x == w || y == h) return;
      |                                    ^
a.cc:30:46: error: 'h' was not declared in this scope
   30 |         if (x < 0 || y < 0 || x == w || y == h) return;
      |                                              ^
a.cc:32:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   32 |         ans++;
      |         ^~~
      |         abs
a.cc: In function 'int main()':
a.cc:41:34: error: 's' was not declared in this scope
   41 |                 rep(i, H) cin >> s[i];
      |                                  ^
a.cc:43:29: error: 's' was not declared in this scope
   43 |                         if (s[i][j] == '@') solve(i, j);
      |                             ^
a.cc:43:34: error: 'j' was not declared in this scope
   43 |                         if (s[i][j] == '@') solve(i, j);
      |                                  ^
a.cc:43:45: error: 'solve' was not declared in this scope
   43 |                         if (s[i][j] == '@') solve(i, j);
      |                                             ^~~~~
Language: C++

#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define rer(i, a, b) for (int i = (int)a; i <= (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<int> > vvi;
typedef vector<pair<int, int> > vpii;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

const int inf = 1000000000;
const int mod = 1000000007;
const double eps = 1e-9;
const int dx[] = { -1, 0, 1, 0};
const int dy[] = { 0, -1, 0, 1};

string field[100];

void dfs(int y, int x) {
	if (x < 0 || y < 0 || x == w || y == h) return;
	if (field[y][x] == '#') return;
	ans++;
	field[y][x] = '#';
	rep(i, 4) dfs(y + dy[i], x + dx[i]);
}

int main() {
	int W, H;
	while (cin >> W >> H, W) {
		int ans = 0;
		rep(i, H) cin >> s[i];
		rep(i, H) rep(i, W) {
			if (s[i][j] == '@') solve(i, j);
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:30:36: error: 'w' was not declared in this scope
   30 |         if (x < 0 || y < 0 || x == w || y == h) return;
      |                                    ^
a.cc:30:46: error: 'h' was not declared in this scope
   30 |         if (x < 0 || y < 0 || x == w || y == h) return;
      |                                              ^
a.cc:32:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   32 |         ans++;
      |         ^~~
      |         abs
a.cc: In function 'int main()':
a.cc:41:34: error: 's' was not declared in this scope
   41 |                 rep(i, H) cin >> s[i];
      |                                  ^
a.cc:43:29: error: 's' was not declared in this scope
   43 |                         if (s[i][j] == '@') solve(i, j);
      |                             ^
a.cc:43:34: error: 'j' was not declared in this scope
   43 |                         if (s[i][j] == '@') solve(i, j);
      |                                  ^
a.cc:43:45: error: 'solve' was not declared in this scope
   43 |                         if (s[i][j] == '@') solve(i, j);
      |                                             ^~~~~
Language: C++

#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define rer(i, a, b) for (int i = (int)a; i <= (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<int> > vvi;
typedef vector<pair<int, int> > vpii;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

const int inf = 1000000000;
const int mod = 1000000007;
const double eps = 1e-9;
const int dx[] = { -1, 0, 1, 0};
const int dy[] = { 0, -1, 0, 1};

int W, H;
int ans = 0;
string field[100];

void dfs(int y, int x) {
	if (x < 0 || y < 0 || x == W || y == H) return;
	if (field[y][x] == '#') return;
	ans++;
	field[y][x] = '#';
	rep(i, 4) dfs(y + dy[i], x + dx[i]);
}

int main() {
	while (cin >> W >> H, W) {
		rep(i, H) cin >> s[i];
		rep(i, H) rep(j, W) {
			if (s[i][j] == '@') solve(i, j);
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:34: error: 's' was not declared in this scope
   41 |                 rep(i, H) cin >> s[i];
      |                                  ^
a.cc:43:29: error: 's' was not declared in this scope
   43 |                         if (s[i][j] == '@') solve(i, j);
      |                             ^
a.cc:43:45: error: 'solve' was not declared in this scope
   43 |                         if (s[i][j] == '@') solve(i, j);
      |                                             ^~~~~
Language: C++

#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define rer(i, a, b) for (int i = (int)a; i <= (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<int> > vvi;
typedef vector<pair<int, int> > vpii;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

const int inf = 1000000000;
const int mod = 1000000007;
const double eps = 1e-9;
const int dx[] = { -1, 0, 1, 0};
const int dy[] = { 0, -1, 0, 1};

int W, H;
int ans = 0;
string field[100];

void dfs(int y, int x) {
	if (x < 0 || y < 0 || x == W || y == H) return;
	if (field[y][x] == '#') return;
	ans++;
	field[y][x] = '#';
	rep(i, 4) dfs(y + dy[i], x + dx[i]);
}

int main() {
	while (cin >> W >> H, W) {
		rep(i, H) cin >> field[i];
		rep(i, H) rep(j, W) {
			if (s[i][j] == '@') solve(i, j);
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:29: error: 's' was not declared in this scope
   43 |                         if (s[i][j] == '@') solve(i, j);
      |                             ^
a.cc:43:45: error: 'solve' was not declared in this scope
   43 |                         if (s[i][j] == '@') solve(i, j);
      |                                             ^~~~~
Language: C++

#include<iostream>

char map[20][20]={0};
int number=1;
int h,w;

void debug(void) {
	for(int i=0;i<h;i++) { for(int j=0;j<w;j++) putchar(map[i][j]); putchar('\n'); }
}

void trace(int x,int y) {
	if(x-1 >= 0 && map[y][x-1]=='.') {
		map[y][x-1] = '@';
		trace(x-1,y);

		number++;
	}

	if(x+1 < w && map[y][x+1]=='.') {
		map[y][x+1] = '@';
		trace(x+1,y);
		number++;
	}
	if(y-1 >= 0 && map[y-1][x]=='.') {
		map[y-1][x] = '@';
		trace(x,y-1);
		number++;
	}

	if(y+1 < h && map[y+1][x]=='.') {
		map[y+1][x] = '@';
		trace(x,y+1);
		number++;
	}
}

int main(void) {
	char buf[21];

	int x,y;


	for(;;) {

		number=1;
		scanf("%d %d\n",&w,&h);

		if(w==0 || h==0) break;

		for(int i=0;i<h;i++) {
			fgets(buf,1024,stdin);

			memcpy(&map[i],buf,w);
		}


		for(int j=0;j<h;j++) {
			for(int i=0;i<w;i++) {
				if(map[j][i] == '@'){
					x=i;y=j;
				}
			}
		}


		trace(x,y);

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

	}

	//debug();

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:25: error: 'memcpy' was not declared in this scope
   53 |                         memcpy(&map[i],buf,w);
      |                         ^~~~~~
a.cc:2:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<iostream>
  +++ |+#include <cstring>
    2 |
Language: C++

#include <iostream>
#include <queue>
#include <utility>
#include <array>

using namespace std;

typedef pair<int, int> pii;

int height, width;
int sx, sy;
int ans = 0;
array<int, 4> dx = {0, 0, 1, -1};
array<int, 4> dy = {1, -1, 0, 0};


void bfs()
{
    queue<pii> p;
    p.push({sx, sy});
    
    while (!p.empty()) {
        pii q = p.front(); p.pop();
        
        //??????
        int cx = p.first;
        int cy = p.second;

        for (int i = 0; i < 4; ++i) {
            int nx = cx + dx.at(i);
            int ny = cy + dy.at(i);

            if (nx >= 0 && nx < width && ny >= 0 && ny < height 
                    && field.at(ny).at(nx) == '.') {

                ans++;
                p.push({nx, ny});
            }
        }
    }

    std::cout << ans << std::endl;
}


int main()
{
    while (cin >> height >> width) {
        if (height == 0 && width == 0) break;

        ans = 0;
        
        vector<vector<char>> field(height, vector<char>(width));

        for (int y = 0; y < height; ++y) {
            for (int x = 0; x < width; ++x) {
                cin >> field.at(y).at(x);

                if (field.at(y).at(x) == '@') {
                    sx = x; sy = y;
                }
            }
        }

        bfs();
    }

    return 0;
}

Compiler output:
a.cc: In function 'void bfs()':
a.cc:26:20: error: 'class std::queue<std::pair<int, int> >' has no member named 'first'
   26 |         int cx = p.first;
      |                    ^~~~~
a.cc:27:20: error: 'class std::queue<std::pair<int, int> >' has no member named 'second'
   27 |         int cy = p.second;
      |                    ^~~~~~
a.cc:34:24: error: 'field' was not declared in this scope
   34 |                     && field.at(ny).at(nx) == '.') {
      |                        ^~~~~
Language: C++

#include<iostream>
#include<algorithm>
#include<utility>
#include<queue>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define P pair<int, int>

using namespace std;
char field[20][20];
int W, H,sx,sy,nx,ny;
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
int cnt = 1;


void bfs(){
	queue<P> que;
	que.push(P(sx, sy));

	while (1){

		if (que.empty()){
			break;
		}
		P p = que.front();
		que.pop();
		
		rep(i, 4){
			nx = p.first + dx[i];
			ny = p.second + dy[i];
			if (nx >= 0 && nx < W && 0 <= ny && ny < H && field[ny][nx] == '.'){
				field[ny][nx] = '#';
				que.push(P(nx, ny));
				cnt++;
			}

		}

		/*

		rep(i, H){
			rep(j, W){
				cout << field[i][j];
			}
			cout << endl;
		}

		*/
	}



}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

  1 #include <bits/stdc++.h>
  2
  3 using namespace std;
  4
  5 int w, h, cnt;
  6 int vx[] = {0, 1, 0, -1};
  7 int vy[] = {1, 0, -1, 0};
  8 char field[20][20];
  9
 10 void solve(int x, int y){
 11
 12     ++cnt;
 13     field[y][x] = '#';
 14
 15     for(int i = 0; i < 4; ++i){
 16
 17         int nx = x + vx[i];
 18         int ny = y + vy[i];
 19
 20         if(nx >= 0 && nx < w && ny >= 0 && ny < h && field[ny][nx] == '.')
 21             solve(nx, ny);
 22
 23     }
 24
 25 }
 26
 27 int main(){
 28
 29     int sx, sy;
 30     while(cin >> w >> h){
 31
 32         if(!(w || h)) break;
 33
 34         for(int i = 0; i < h; ++i){
 35             for(int j = 0; j < w; ++j){
 36                 cin >> field[i][j];
 37                 if(field[i][j] == '@'){
 38                     sx = j;
 39                     sy = i;
 40                 }
 41             }
 42         }
 43
 44         cnt = 0;
 45
 46         solve(sx, sy);
 47
 48         cout << cnt << endl;
 49
 50     }
 51
 52 }
~

Compiler output:
a.cc:1:5: error: stray '#' in program
    1 |   1 #include <bits/stdc++.h>
      |     ^
a.cc:1:3: error: expected unqualified-id before numeric constant
    1 |   1 #include <bits/stdc++.h>
      |   ^
a.cc:4:3: error: expected unqualified-id before numeric constant
    4 |   4
      |   ^
a.cc:6:3: error: expected unqualified-id before numeric constant
    6 |   6 int vx[] = {0, 1, 0, -1};
      |   ^
a.cc:7:3: error: expected unqualified-id before numeric constant
    7 |   7 int vy[] = {1, 0, -1, 0};
      |   ^
a.cc:8:3: error: expected unqualified-id before numeric constant
    8 |   8 char field[20][20];
      |   ^
a.cc:9:3: error: expected unqualified-id before numeric constant
    9 |   9
      |   ^
a.cc:26:2: error: expected unqualified-id before numeric constant
   26 |  26
      |  ^~
a.cc:53:2: error: expected class-name at end of input
   53 | ~
      |  ^
Language: C++

#include<iostrem>
#include<utility>
#include<queue>
using namespace std;
char room[21][21];
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
typedef pair<int,int> p;


int main(){
	int x,y;
	queue<p> que;
	int w,h;
	cin>>w>>h;
	if(w+h==0) return;
	for(int a=0;a<h;a++){
		for(int b=0;b<w;b++){
			cin>>room[a][b];
			if(room[a][b]=='@'){
				x=b,y=a;
				que.push(p(b,a));
				room[a][b]='#';
			}
		}
	}
	int cnt=1;
	int nx,ny;
	while(que.size()){
		p ap=que.front();
		que.pop;
		for(int i=-1;i<=1;i++){
			nx=ap.first+dx[i];
			ny=ap.second+dy[i];
			if(0<=nx&&nx<=w&&0<=ny&&ny<=h&&room[ny][nx]!='#'){
				room[ny][nx]='#';
				que.push(p(nx,ny));
				cnt++;
			}
		}
	}
}

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

#include<iostream>
#include<utility>
#include<queue>
using namespace std;
char room[21][21];
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
typedef pair<int,int> p;


int main(){
	int x,y;
	queue<p> que;
	int w,h;
	cin>>w>>h;
	if(w+h==0) return;
	for(int a=0;a<h;a++){
		for(int b=0;b<w;b++){
			cin>>room[a][b];
			if(room[a][b]=='@'){
				x=b,y=a;
				que.push(p(b,a));
				room[a][b]='#';
			}
		}
		
	}
	int cnt=1;
	int nx,ny;
	while(que.size()){
		p ap=que.front();
		que.pop;
		for(int i=-1;i<=1;i++){
			nx=ap.first+dx[i];
			ny=ap.second+dy[i];
			if(0<=nx&&nx<=w&&0<=ny&&ny<=h&&room[ny][nx]!='#'){
				room[ny][nx]='#';
				que.push(p(nx,ny));
				cnt++;
			}
		}
	}
	cout<<cnt;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:20: error: return-statement with no value, in function returning 'int' [-fpermissive]
   15 |         if(w+h==0) return;
      |                    ^~~~~~
a.cc:31:21: error: invalid use of non-static member function 'void std::queue<_Tp, _Sequence>::pop() [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >]'
   31 |                 que.pop;
      |                 ~~~~^~~
In file included from /usr/include/c++/14/queue:66,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_queue.h:316:7: note: declared here
  316 |       pop()
      |       ^~~