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

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

template <typename T>
class Queue {
private:
    vector<T> pulled, pushed;

public:
    void push(T a) {
        pushed.push_back(a);
    }

    T pop() {
        if (pulled.empty()) {
            reverse(pushed.begin(), pushed.end());
            pulled = pushed;
            pushed.clear();
        }
        T top = pulled.front();
        pulled.pop_back();
        return top;
    }

    T front() {
        return pulled.front();
    }

    int size() {
        return pulled.size() + pushed.size();
    }

    bool empty() {
        return size() == 0;
    }
};

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

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

    string S[H];
    int bnum = 0;
    for (int h = 0; h < H; ++h) {
        cin >> S[h];
        for (int w = 0; w < W; ++w) {
            if (S[h][w] == '#') ++bnum;
        }
    }

    int d[H][W];
    fill(d[0], d[H], -1);

    Queue<pair<int, int>> que;
    que.push(make_pair(0, 0));
    d[0][0] = 1;

    while (!que.empty()) {
        int x, y;
        tie(x, y) = que.pop();

        for (int i = 0; i < 4; ++i) {
            int sx = x + dx[i];
            int sy = y + dy[i];
            if (0 <= sx && sx < H && 0 <= sy && sy < W && S[sx][sy] == '.' && d[sx][sy] < 0) {
                d[sx][sy] = d[x][y] + 1;
                que.push(make_pair(sx, sy));
            }
        }
    }

    cout << (d[H - 1][W - 1] < 0 ? -1 : H * W - bnum - d[H - 1][W - 1]) << endl;
    return 0;
}


Compiler output:
a.cc: In instantiation of 'T Queue<T>::pop() [with T = std::pair<int, int>]':
a.cc:65:28:   required from here
   65 |         tie(x, y) = que.pop();
      |                     ~~~~~~~^~
a.cc:18:20: error: 'reverse' was not declared in this scope
   18 |             reverse(pushed.begin(), pushed.end());
      |             ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

template <typename T>
class Queue {
private:
    vector<T> pulled, pushed;

public:
    void push(T a) {
        pushed.push_back(a);
    }

    T pop() {
        if (pulled.empty()) {
            reverse(pushed.begin(), pushed.end());
            pulled = pushed;
            pushed.clear();
        }
        T top = pulled.front();
        pulled.pop_back();
        return top;
    }

    T front() {
        return pulled.front();
    }

    int size() {
        return pulled.size() + pushed.size();
    }

    bool empty() {
        return size() == 0;
    }
};

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

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

    string S[H];
    int bnum = 0;
    for (int h = 0; h < H; ++h) {
        cin >> S[h];
        for (int w = 0; w < W; ++w) {
            if (S[h][w] == '#') ++bnum;
        }
    }

    int d[H][W];
    fill(d[0], d[H], -1);

    Queue<pair<int, int>> que;
    que.push(make_pair(0, 0));
    d[0][0] = 1;

    while (!que.empty()) {
        int x, y;
        tie(x, y) = que.pop();

        for (int i = 0; i < 4; ++i) {
            int sx = x + dx[i];
            int sy = y + dy[i];
            if (0 <= sx && sx < H && 0 <= sy && sy < W && S[sx][sy] == '.' && d[sx][sy] < 0) {
                d[sx][sy] = d[x][y] + 1;
                que.push(make_pair(sx, sy));
            }
        }
    }

    cout << (d[H - 1][W - 1] < 0 ? -1 : H * W - bnum - d[H - 1][W - 1]) << endl;
    return 0;
}


Compiler output:
a.cc: In instantiation of 'T Queue<T>::pop() [with T = std::pair<int, int>]':
a.cc:64:28:   required from here
   64 |         tie(x, y) = que.pop();
      |                     ~~~~~~~^~
a.cc:17:20: error: 'reverse' was not declared in this scope
   17 |             reverse(pushed.begin(), pushed.end());
      |             ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

typedef pair<int,int> P;
const int INF=100000000;

int H,W;
int s[50][50];
int d[50][50];
int dx[]={1,0,-1,0},dy[]={0,1,0,-1};


int bfs(){
    for(int i=0;i<H;i++)
        for(int j=0;j<W;j++) d[i][j]=INF;
    queue<P> que;
    que.push(P(0,0));
    d[0][0]=0;

    while(que.size()){
        P p=que.front();que.pop();
        if(p.first==H-1&&p.second==W-1) return d[H-1][W-1];

        for(int i=0;i<4;i++){
            int nx=p.first+dx[i],ny=p.second+dy[i];
            if(0<=nx&&nx<H&&0<=ny&&ny<W&&d[nx][ny]==INF&&s[nx][ny]!='#'){
                d[nx][ny]=d[p.first][p.second]+1;
                que.push(P(nx,ny));
            }
        }
    }
    return false;
}



int main(){
    
    cin>>H>>W;
    int bcnt=0;
    
    for(int i=0;i<H;i++){
        string S;
        cin>>S;
        for(int j=0;j<W;j++){
            s[i][j]=S[j];
            if(s[i][j]=='#') bcnt++;
        }
    }
    int BFS=bfs();
    if(BFS==0) cout<<-1<<endl;
    else cout<<W*H-bcnt-BFS-1<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:5: error: 'cin' was not declared in this scope
   41 |     cin>>H>>W;
      |     ^~~
a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    3 | #include<utility>
  +++ |+#include <iostream>
    4 | using namespace std;
a.cc:53:16: error: 'cout' was not declared in this scope
   53 |     if(BFS==0) cout<<-1<<endl;
      |                ^~~~
a.cc:53:16: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:53:26: error: 'endl' was not declared in this scope
   53 |     if(BFS==0) cout<<-1<<endl;
      |                          ^~~~
a.cc:4:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    3 | #include<utility>
  +++ |+#include <ostream>
    4 | using namespace std;
a.cc:54:10: error: 'cout' was not declared in this scope
   54 |     else cout<<W*H-bcnt-BFS-1<<endl;
      |          ^~~~
a.cc:54:10: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:54:32: error: 'endl' was not declared in this scope
   54 |     else cout<<W*H-bcnt-BFS-1<<endl;
      |                                ^~~~
a.cc:54:32: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
Language: C++

#include "pch.h"
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <math.h>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
using namespace std;
typedef pair<int, int> P;
#define INF LLONG_MAX/3
#define inf INT_MAX/3
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
int gcd(int a, int b) {
	if (b == 0)return a;
	return gcd(b, a%b);
}
int lcm(int a, int b) {
	return a / gcd(a, b)*b;
}
bool prime(int p) {
	for (int i = 2;i <= sqrt(p);i++) {
		if (p%i==0)return false;
	}
	return true;
}
int modpow(int a, int b) {
	if (b == 0)return 1;
	if (b == 1)return a % MOD;
	if (b % 2)return modpow(a, b - 1)*a%MOD;
	else return modpow(a, b / 2)*modpow(a, b / 2) % MOD;
}
int comb(int a, int b) {
	if (b == 0 || a == b)return 1;
	if (b == 1)return a % MOD;
	return (comb(a - 1, b - 1) + comb(a - 1, b)) % MOD;
}
// Library End !
int g[] = { 0,1,0,-1 };
int f[] = { 1,0,-1,0 };
int h, w;
char s[55][55];
int main() {
	int t[55][55];
	cin >> h >> w;
	int cnt = 0;
	rep(i, h) {
		rep(j, w) {
			cin >> s[i][j];
			if(s[i][j]=='.')cnt++;
			t[i][j] = -1;
		}
	}
	queue <P> q;
	q.push({ 0,0 });
	t[0][0] = 1;
	while (!q.empty()) {
		P p = q.front();
		int x = p.first;
		int y = p.second;
		q.pop();
		rep(i, 4) {
			int xx = x + g[i];
			int yy = y + f[i];
			if (xx < 0 || xx>= h || yy < 0 || yy >= w || s[xx][yy] == '#' || t[xx][yy] != -1)continue;
			q.push({ p.first + g[i],p.second + f[i] });
			t[xx][yy] = t[x][y]+1;
		}
		if (t[h - 1][w - 1] != -1) {
			cout << cnt - t[h - 1][w - 1] << endl;
			return 0;
		}
	}
	return 0;
	cout <<-1<< endl;
	return 0;
}


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

#include "pch.h"
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <math.h>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
using namespace std;
typedef pair<int, int> P;
#define INF LLONG_MAX/3
#define inf INT_MAX/3
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
int gcd(int a, int b) {
	if (b == 0)return a;
	return gcd(b, a%b);
}
int lcm(int a, int b) {
	return a / gcd(a, b)*b;
}
bool prime(int p) {
	for (int i = 2;i <= sqrt(p);i++) {
		if (p%i==0)return false;
	}
	return true;
}
int modpow(int a, int b) {
	if (b == 0)return 1;
	if (b == 1)return a % MOD;
	if (b % 2)return modpow(a, b - 1)*a%MOD;
	else return modpow(a, b / 2)*modpow(a, b / 2) % MOD;
}
int comb(int a, int b) {
	if (b == 0 || a == b)return 1;
	if (b == 1)return a % MOD;
	return (comb(a - 1, b - 1) + comb(a - 1, b)) % MOD;
}
// Library End !
int g[] = { 0,1,0,-1 };
int f[] = { 1,0,-1,0 };
int h, w;
char s[55][55];
int main() {
	int t[55][55];
	cin >> h >> w;
	int cnt = 0;
	rep(i, h) {
		rep(j, w) {
			cin >> s[i][j];
			if(s[i][j]=='.')cnt++;
			t[i][j] = -1;
		}
	}
	queue <P> q;
	q.push({ 0,0 });
	t[0][0] = 1;
	while (!q.empty()) {
		P p = q.front();
		int x = p.first;
		int y = p.second;
		q.pop();
		rep(i, 4) {
			int xx = x + g[i];
			int yy = y + f[i];
			if (xx < 0 || xx>= h || yy < 0 || yy >= w || s[xx][yy] == '#' || t[xx][yy] != -1)continue;
			q.push({ p.first + g[i],p.second + f[i] });
			t[xx][yy] = t[x][y]+1;
		}
		if (t[h - 1][w - 1] != -1) {
			cout << cnt - t[h - 1][w - 1] << endl;
			return 0;
		}
	}
	return 0;
	cout <<cnt- t[h - 1][w - 1] << endl;
	return 0;
}


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

#include "pch.h"
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <math.h>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
using namespace std;
typedef pair<int, int> P;
#define INF LLONG_MAX/3
#define inf INT_MAX/3
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
int gcd(int a, int b) {
	if (b == 0)return a;
	return gcd(b, a%b);
}
int lcm(int a, int b) {
	return a / gcd(a, b)*b;
}
bool prime(int p) {
	for (int i = 2;i <= sqrt(p);i++) {
		if (p%i==0)return false;
	}
	return true;
}
int modpow(int a, int b) {
	if (b == 0)return 1;
	if (b == 1)return a % MOD;
	if (b % 2)return modpow(a, b - 1)*a%MOD;
	else return modpow(a, b / 2)*modpow(a, b / 2) % MOD;
}
int comb(int a, int b) {
	if (b == 0 || a == b)return 1;
	if (b == 1)return a % MOD;
	return (comb(a - 1, b - 1) + comb(a - 1, b)) % MOD;
}
// Library End !
int g[] = { 0,1,0,-1 };
int f[] = { 1,0,-1,0 };
int h, w;
char s[55][55];
int t[55][55];
int main() {
	cin >> h >> w;
	rep(i, h) {
		rep(j, w) {
			cin >> s[i][j];
		}
	}
	rep(i, 55) {
		rep(j, 55) {
			t[i][j] = -1;
		}
	}
	queue <P> q;
	q.push({ 0,0 });
	t[0][0] = 1;
	while (!q.empty()) {
		P p = q.front();
		q.pop();
		rep(i, 4) {
			if (p.first + g[i] < 0 || p.first + g[i] >= h || p.second + f[i] < 0 || p.second + f[i] >= w || s[p.first + g[i]][p.second + f[i]] == '#' || t[p.first + g[i]][p.second + f[i]] != -1)continue;
			q.push({ p.first + g[i],p.second + f[i] });
			t[p.first + g[i]][p.second + f[i]] = t[p.first][p.second]+1;
		}
	}
	int cnt = 0;
	rep(i, h) {
		rep(j, w) {
			if (s[i][j] == '.')cnt++;
		}
	}
	cout <<cnt- t[h - 1][w - 1] << endl;
	return 0;
}


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

#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
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 FORR(i, a, b) for (int i = a; i >= b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    int white_cnt = 0;
    REP(i, h) {
        cin >> s[i];
        REP(j, w)if(s[i][j] == '.') white_cnt++;
    }
    vector<VI> dist(h, VI(w, INT_MAX));

    queue<pair<int, int>> search_q;
    search_q.push(make_pair(0, 0));
    dist[0][0] = 0;
    while(search_q.size() > 0) {
        int x = search_q.front().first;
        int y = search_q.front().second;
        search_q.pop();
        if(x == h - 1 and y == w - 1) break;
        s[x][y] = '#';  // 探索済チェック
        REP(i, 4) {
            int adj_x = x + dx[i];
            int adj_y = y + dy[i];
            if(adj_x < 0 or h <= adj_x) continue;
            if(adj_y < 0 or w <= adj_y) continue;
            if(s[adj_x][adj_y] == '.') {
                search_q.push(make_pair(adj_x, adj_y));
                dist[adj_x][adj_y] = dist[x][y] + 1;
            }
                
        }
    }
    int ans = dist[h - 1][w - 1];
    cout << (ans == INT_MAX ? -1 : white_cnt - ans - 1) << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:30: error: 'INT_MAX' was not declared in this scope
   38 |     vector<VI> dist(h, VI(w, INT_MAX));
      |                              ^~~~~~~
a.cc:13:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   12 | #include <algorithm>
  +++ |+#include <climits>
   13 | using namespace std;
Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

char g[55][55];
int r, c;
int dp[55][55];

bool update() {
	bool change = false;
	for(int i = 0; i < r; i++) {
		if(g[i][j] == '#') continue;
		if(i > 0 && dp[i-1][j] + 1 < dp[i][j]) {
			change = true;
			dp[i][j] = 1 + dp[i-1][j];
		}
		if(i < r-1 && dp[i+1][j] + 1 < dp[i][j]) {
			change = true;
			dp[i][j] = 1 + dp[i+1][j];
		}
		if(j > 0 && dp[i][j-1] + 1 < dp[i][j]) {
			change = true;
			dp[i][j] = 1 + dp[i][j-1];
		}
		if(j < c-1 && dp[i][j+1] + 1 < dp[i][j]) {
			change = true;
			dp[i][j] = 1 + dp[i][j+1];
		}
	}
	return change;
}

int main() {
	scanf("%d%d\n", &r, &c);
	for(int i = 0; i < r; i++) {
		scanf("%s", g[i]);
		for(int j = 0; j < c; j++) {
			dp[i][j] = 1 << 25;
		}
	}
	dp[0][0] = 0;
	while(update());
	if(dp[r-1][c-1] == 1 << 25) {
		printf("-1\n");
		return 0;
	}
	int ret = -dp[r-1][c-1];
	for(int i = 0; i < r; i++) for(int j = 0; j < c; j++) if(g[i][j] == '.') ret++;
	printf("%d\n", ret);
}

Compiler output:
a.cc: In function 'bool update()':
a.cc:14:25: error: 'j' was not declared in this scope
   14 |                 if(g[i][j] == '#') continue;
      |                         ^
a.cc:15:37: error: 'j' was not declared in this scope
   15 |                 if(i > 0 && dp[i-1][j] + 1 < dp[i][j]) {
      |                                     ^
a.cc:19:39: error: 'j' was not declared in this scope
   19 |                 if(i < r-1 && dp[i+1][j] + 1 < dp[i][j]) {
      |                                       ^
a.cc:23:20: error: 'j' was not declared in this scope
   23 |                 if(j > 0 && dp[i][j-1] + 1 < dp[i][j]) {
      |                    ^
a.cc:27:20: error: 'j' was not declared in this scope
   27 |                 if(j < c-1 && dp[i][j+1] + 1 < dp[i][j]) {
      |                    ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

char g[55][55];
int r, c;
int dp[55][55];

bool update() {
	bool change = false;
	for(int i = 0; i < r; i++) {
		if(g[i][j] == '#') continue;
		if(i > 0 && dp[i-1][j] + 1 < dp[i][j]) {
			change = true;
			dp[i][j] = 1 + dp[i-1][j];
		}
		if(i < r-1 && dp[i+1][j] + 1 < dp[i][j]) {
			change = true;
			dp[i][j] = 1 + dp[i+1][j];
		}
		if(j > 0 && dp[i][j-1] + 1 < dp[i][j]) {
			change = true;
			dp[i][j] = 1 + dp[i][j-1];
		}
		if(j < c-1 && dp[i][j+1] + 1 < dp[i][j]) {
			change = true;
			dp[i][j] = 1 + dp[i][j+1];
		}
	}
	return change;
}

int main() {
	scanf("%d%d\n", &r, &c);
	for(int i = 0; i < r; i++) {
		scanf("%s", g[i]);
		for(int j = 0; j < c; j++) {
			dp[i][j] = 1 << 25);
		}
	}
	dp[0][0] = 0;
	while(update());
	int ret = -dp[r-1][c-1];
	for(int i = 0; i < r; i++) for(int j = 0; j < c; j++) if(g[i][j] == '.') ret++;
	printf("%d\n", ret);
}

Compiler output:
a.cc: In function 'bool update()':
a.cc:14:25: error: 'j' was not declared in this scope
   14 |                 if(g[i][j] == '#') continue;
      |                         ^
a.cc:15:37: error: 'j' was not declared in this scope
   15 |                 if(i > 0 && dp[i-1][j] + 1 < dp[i][j]) {
      |                                     ^
a.cc:19:39: error: 'j' was not declared in this scope
   19 |                 if(i < r-1 && dp[i+1][j] + 1 < dp[i][j]) {
      |                                       ^
a.cc:23:20: error: 'j' was not declared in this scope
   23 |                 if(j > 0 && dp[i][j-1] + 1 < dp[i][j]) {
      |                    ^
a.cc:27:20: error: 'j' was not declared in this scope
   27 |                 if(j < c-1 && dp[i][j+1] + 1 < dp[i][j]) {
      |                    ^
a.cc: In function 'int main()':
a.cc:40:43: error: expected ';' before ')' token
   40 |                         dp[i][j] = 1 << 25);
      |                                           ^
      |                                           ;
Language: Java

import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
public class Main088D {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int H = sc.nextInt();

		int W = sc.nextInt();

		int white = 0;

		char[][] maze = new char[H][W];

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

			String s = sc.next();

			for(int j=0;j<W;j++) {

				maze[i][j] = s.charAt(j);

				if(maze[i][j] == '.') white++;
			}
		}

			Queue<Point> q = new LinkedList<Point>();

			q.add(new Point(0,0,0));

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

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

			int nstep = 0;

			while(q.size()>0) {

				Point p = q.poll();

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

				int nx = p.x + dx[i];

				int ny = p.y + dy[i];

				nstep = p.step + 1;

				if(ny>=0 && nx>=0 && ny<H && nx<W) {

					if(ny == H-1 && nx == W-1) {


						System.out.println(white-nstep-1);

						return;
					}else if(maze[ny][nx] == '.') {

						q.add(new Point(ny,nx,nstep));

						maze[ny][nx] = '#';
					}

				}
				}

				if(q.size() == 0)	System.out.println(-1);


			}


	}
	public static class Point{

		int y;

		int x;

		int step;

		public Point(int y ,int x, int step) {

			this.y = y;

			this.x = x;

			this.step = step;

		}
	}

}


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

#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <functional>
#include <string>
#include <stack>
#include <set>
using namespace std;
using ll = long long;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, pair<ll, ll>> PP;

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1 << 30;
const ll INF2 = 9e18;
const double INF3 = 9e14;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int tx[8] = { -1,0,1,-1,1,-1,0,1 }, ty[8] = { -1,-1,-1,0,0,1,1,1 };
#define ALL(x) (x).begin(),(x).end()
#define pb push_back
#define fr first
#define sc second

int w, h;
ll d[110][110];
char c[110][110];

int bfs(int h, int w) {
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			d[i][j] = INF;
		}
	}
	d[0][0] = 1;
	queue<P>q;
	q.push(P(0, 0));
	while (!q.empty()) {
		P p = q.front();
		q.pop();
		int a = p.fr, b = p.sc;
		for (int i = 0; i < 4; i++) {
			int nx = a + dx[i], ny = b + dy[i];
			if (nx<0 || nx>h - 1 || ny<0 || ny>w - 1 || c[nx][ny] == "#")continue;
			if (d[nx][ny] == INF) {
				q.push(P(nx, ny));
				d[nx][ny] = d[a][b] + 1;
			}
		}
	}
	return d[h - 1][w - 1];
}

int main() {
	int cnt = 0;
	cin >> h >> w;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> c[i][j];
			if (c[i][j] == '.')cnt++;
		}
	}
	if (bfs(h, w)==INF) {
		cout << -1 << endl;
	}
	else cout << cnt - d[h - 1][w - 1] << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int bfs(int, int)':
a.cc:48:79: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   48 |                         if (nx<0 || nx>h - 1 || ny<0 || ny>w - 1 || c[nx][ny] == "#")continue;
      |                                                                     ~~~~~~~~~~^~~~~~
Language: C++

#include <iostream>

using namespace std;

int main(){
int h,w,white;
char maze[55][55];
cin >> h >> w;
    int white=0;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin >> maze[i][j];
            if(maze[i][j]=='.'){
                white++;
            }
        }
    }
cout << -1 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: redeclaration of 'int white'
    9 |     int white=0;
      |         ^~~~~
a.cc:6:9: note: 'int white' previously declared here
    6 | int h,w,white;
      |         ^~~~~
Language: C

#include <iostream> 
#include <queue>
#include <algorithm>
using namespace std;
vector<int>a[1005];
int main()
{
    int h,w;
    cin>>h>>w;
    int n;
    cin>>n;
    int f=0;
    for(int i=0; i<n; i++)
    {
        int x;
        scanf("%d",&x);
        for(int j=0;j<x;j++)
            a[f/w].push_back(i+1),f++;
    }
 
    for(int i=0; i<h; i++)
    {
        if(i&1)reverse(a[i].begin(),a[i].end());
        printf("%d",a[i][0]);
        for(int j=1; j<w; j++)
            printf(" %d",a[i][j]);
        printf("\n");
    }
    return 0;
}

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

#include<bits/stdc++.h>

using namespace std;

#define fi first
#define se second

const ll maxn = 1e3 + 10;
const int Move[4][2] = {-1,0,1,0,0,1,0,-1};
char mp[maxn][maxn];
int step[maxn][maxn];
bool vis[maxn][maxn];
int n,m;

bool check(int x,int y) {
    if(x < 0 || y < 0|| x >= n || y >= m || vis[x][y] || mp[x][y] == '#') return false;
    return true;
}

int BFS() {
    queue<pair<int ,int> > q;
    q.push(make_pair(0,0));
    step[0][0] = 1;
    vis[0][0] = true;
    while (!q.empty()) {
        pair<int ,int> t = q.front();
        q.pop();
        for(int i = 0;i < 4;i++) {
            int tox = t.fi + Move[i][0];
            int toy = t.se + Move[i][1];
            if(tox == n - 1 && toy == m - 1) return step[t.fi][t.se] + 1;
            if(check(tox,toy)) {
                vis[tox][toy] = true;
                step[tox][toy] = step[t.fi][t.se] + 1;
                q.push(make_pair(tox,toy));
            }
        }
    }
    return -1;
}


int main(){
    init();
    cin>>n>>m;
    int cnt = 0;
    for(int i = 0;i < n;i++)
        for(int j = 0;j < m;j++) {
            cin>>mp[i][j];
            if(mp[i][j] == '#') cnt++;
        }
    int res = BFS();
    if(res == -1) {
        cout<<"-1"<<endl;
    } else {
        cout<<n*m - res - cnt<<endl;
    }
    return 0;
}

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

#include "iostream"
#include "algorithm"
#include "vector"
#include "cstdio"
#include "queue"//引入队列
using namespace std;

const int SIZE = 50 + 10;//数据规模
char board[SIZE][SIZE];//“.”或“#”
bool vis[SIZE][SIZE];//标记是否到达过
const int Move[4][2] = {-1,0,1,0,0,1,0,-1};//分别代表向上、下、左、右移动一格
int step[SIZE][SIZE];//标示每一步
int H,W;//行数、列数

int check(int x, int y)
{
    if(x<0 || y<0 || x>=H || y>=W || vis[x][y] || board[x][y]=='#')
        return false;
    return true;
}//检查函数，检查当前节点是否可搜

int bfs()
{
    queue<pair<int,int> > q;//声明点队列
    pair<int,int> t;//temp
    q.push(make_pair(0,0));//起点（0，0）入队
    step[0][0]=1;//起点为1
    vis[0][0]=true;//（0，0）点到达过
    while(q.size())//只要队列不为空，一直循环
    {
        t=q.front();//把队列首的元素赋值给临时变量t
        q.pop();//清空队列

//        if(/*搜索成功的条件*/)
//            return t.step;
        for(int i=0; i<4; ++i)//遍历上下左右
        {
            int t_x=t.first+Move[i][0];//t_x是下一个点的横坐标
            int t_y=t.second+Move[i][1];//t_x是下一个点的纵坐标
            if(t_x==H-1&&t_y==W-1)//如果到达终点
            {
                return step[t.first][t.second]+1;//把起点加上
            }
            if(check(t_x,t_y))//如果该点可搜
            {
                vis[t_x][t_y]=true;//标记搜过了
                step[t_x][t_y]=step[t.first][t.second]+1;//可走的白块数加一
                q.push(make_pair(t_x,t_y));//该点入队
            }
        }
    }
    return -1;
}

int main()
{
    cin>>H>>W;
    int cnt=0;
    for(int i=0; i<H; ++i)
    {
        for(int j=0; j<W; ++j)
        {
            cin>>board[i][j];
            if(board[i][j]=='#')
                ++cnt;
        }
    }
    int res = bfs();
    if(res == -1)
    {
        cout<<"-1"<<endl;
    }
    else
    {
        cout<<H*W-cnt-res<<endl;//方块总数 减去 黑块数目 再减 走过的白块数目
    }
    return 0;
}


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

#include<iostream>
#include<math.h>
#include<algorithm>
#include<string.h>
using namespace std;
main(){
    int x,y;
    cin>>x;
    cin>>y;
    int a[53][53]={};
    int count=0;
    for(int i=1;i<=x;i++){
        string b;
        cin>>b;
        for(int j=0;j<y;j++){
            if(b[j]=='.') {
                a[i][j+1]=1;
                count++;
            }
        }   
    }
    a[1][1]=3;

    for(int k=1;k++;k<x*y){
        int flag=0;
        for(int i=1;i<=x;i++){
            for(int j=1;j<=y;j++){
                if(a[i][j]==1){
                    if(a[i-1][j]==3) a[i][j]=2;
                    else if(a[i+1][j]==3) a[i][j]=2;
                    else if(a[i][j-1]==3) a[i][j]=2;
                    else if(a[i][j+1]==3) a[i][j]=2;
                }
            }
        }
        
        for(int i=1;i<=x;i++){
            for(int j=1;j<=y;j++){
                if(a[i][j]==2) {
                    a[i][j]=3;
                    flag=1;
            }
            
        }
       
        if(a[x][y]==3) {
            count-=k;
            break;
            
        }
        if(flag==0) break;
    }
    if(a[x][y]!=3){
        cout<<-1;
    }
    cout<<count;
    return 0;
 
}

Compiler output:
a.cc:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:59:2: error: expected '}' at end of input
   59 | }
      |  ^
a.cc:6:7: note: to match this '{'
    6 | main(){
      |       ^
Language: C++

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

#define fi first
#define se second

const ll maxn = 1e3 + 10;
const int Move[4][2] = {-1,0,1,0,0,1,0,-1};
char mp[maxn][maxn];
int step[maxn][maxn];
bool vis[maxn][maxn];
int n,m;

bool check(int x,int y) {
    if(x < 0 || y < 0|| x >= n || y >= m || vis[x][y] || mp[x][y] == '#') return false;
    return true;
}

int BFS() {
    queue<pair<int ,int> > q;
    q.push(make_pair(0,0));
    step[0][0] = 1;
    vis[0][0] = true;
    while (!q.empty()) {
        pair<int ,int> t = q.front();
        q.pop();
        for(int i = 0;i < 4;i++) {
            int tox = t.fi + Move[i][0];
            int toy = t.se + Move[i][1];
            if(tox == n - 1 && toy == m - 1) return step[t.fi][t.se] + 1;
            if(check(tox,toy)) {
                vis[tox][toy] = true;
                step[tox][toy] = step[t.fi][t.se] + 1;
                q.push(make_pair(tox,toy));
            }
        }
    }
    return -1;
}


int main(){
    cin>>n>>m;
    int cnt = 0;
    for(int i = 0;i < n;i++)
        for(int j = 0;j < m;j++) {
            cin>>mp[i][j];
            if(mp[i][j] == '#') cnt++;
        }
    int res = BFS();
    if(res == -1) {
        cout<<"-1"<<endl;
    } else {
        cout<<n*m - res - cnt<<endl;
    }
    return 0;
}

Compiler output:
a.cc:11:7: error: 'll' does not name a type
   11 | const ll maxn = 1e3 + 10;
      |       ^~
a.cc:13:9: error: 'maxn' was not declared in this scope
   13 | char mp[maxn][maxn];
      |         ^~~~
a.cc:13:15: error: 'maxn' was not declared in this scope
   13 | char mp[maxn][maxn];
      |               ^~~~
a.cc:14:10: error: 'maxn' was not declared in this scope
   14 | int step[maxn][maxn];
      |          ^~~~
a.cc:14:16: error: 'maxn' was not declared in this scope
   14 | int step[maxn][maxn];
      |                ^~~~
a.cc:15:10: error: 'maxn' was not declared in this scope
   15 | bool vis[maxn][maxn];
      |          ^~~~
a.cc:15:16: error: 'maxn' was not declared in this scope
   15 | bool vis[maxn][maxn];
      |                ^~~~
a.cc: In function 'bool check(int, int)':
a.cc:19:45: error: 'vis' was not declared in this scope
   19 |     if(x < 0 || y < 0|| x >= n || y >= m || vis[x][y] || mp[x][y] == '#') return false;
      |                                             ^~~
a.cc:19:58: error: 'mp' was not declared in this scope; did you mean 'm'?
   19 |     if(x < 0 || y < 0|| x >= n || y >= m || vis[x][y] || mp[x][y] == '#') return false;
      |                                                          ^~
      |                                                          m
a.cc: In function 'int BFS()':
a.cc:26:5: error: 'step' was not declared in this scope; did you mean 'strsep'?
   26 |     step[0][0] = 1;
      |     ^~~~
      |     strsep
a.cc:27:5: error: 'vis' was not declared in this scope
   27 |     vis[0][0] = true;
      |     ^~~
a.cc: In function 'int main()':
a.cc:51:18: error: 'mp' was not declared in this scope; did you mean 'm'?
   51 |             cin>>mp[i][j];
      |                  ^~
      |                  m
Language: C++

#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <cstring>
#define M 55

using namespace std;

char mp[M][M];
int step[M][M];
bool visit[M][M];
int direct[4][2]={{-1,0},{1,0},{0,1},{0,-1}};

bool check(int tempx,int tempy,int height,int width)
{
    if(tempx<0 || tempy<0 || tempx>height || tempy>width || visit[tempx][tempy] || mp[tempx][tempy] == '#')
    {
        return false;
    }
    return true;
}

int bfs(int height, int width)
{
    queue<pair<int, int> > open;
    open.push(make_pair(0,0));
    step[0][0] = 1;
    visit[0][0] = true;
    while(!open.empty())
    {
        pair<int, int> temp = open.front();
        open.pop();
        for(int i=0; i<4; i++)
        {
            int tempx = temp.first + direct[i][0];
            int tempy = temp.second + direct[i][1];
            if(tempx == height-1 && tempy == width-1)
            {
                return step[temp.first][temp.second] + 1;
            }
            else if(check(tempx,tempy,height,width))
            {
                visit[tempx][tempy] = true;
                step[tempx][tempy] = step[temp.first][temp.second] + 1;
                open.push(make_pair(tempx,tempy));
            }
        }
    }
    return -1;
}

int main()
{
    init();
    int height, width;
    scanf("%d %d",&height,&width);
    int blacksum = 0;
    for(int i=0; i<height; i++)
    {
        for(int j=0; j<width; j++)
        {
            scanf(" %c",&mp[i][j]);
            if(mp[i][j]=='#')
            {
                blacksum++;
            }
        }
    }
    int minline = bfs(height,width);
    if(minline == -1)
    {
        printf("-1\n");
    }
    else
    {
        printf("%d\n",height*width-blacksum-minline);
    }
    return 0;
}

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

#include<stdio.h>
#include<iostream>
#include<queue>
#include<cstring>
using namespace std;
int H,W;
int move[4][2]={0,1,0,-1,-1,0,1,0};
const int SIZE=200;
struct node{
	int x,y;
	int step;
};
char board[SIZE][SIZE];
bool vis[SIZE][SIZE];
queue<node>q;
int bfs()
{
	node s;
	node n;
	node t;
	s.x=1;
	s.y=1;
	s.step=0;
	q.push(s);
	vis[1][1]=1;
	while(q.size())
	     {
	     	t=q.front();
	     	q.pop();
	     	if(t.x==H&&t.y==W)
	     	return t.step;
	        for(int i=0;i<4;++i)
	        {
	        	n=t;
	        	n.x+=move[i][0];
	        	n.y+=move[i][1];
	        	n.step=t.step+1;
	        	if(n.x>=1&&n.x<=W&&n.y>=1&&n.y<=H&&!vis[n.x][n.y])
	        	     {
	        	     	q.push(n);
					 }
			}
	         
		 }
		 return -1;
	
}
int main()
{
	cin>>H>>W;
	memset(board,0,sizeof(board));
	memset(vis,0,sizeof(vis));
	int i,j;
	for(i=1;i<=H;++i)
	for(j=1;j<=W;++j)
	cin>>board[i][j];
	int black=0;
	for(i=1;i<=H;++i)
	{
		for(j=1;j<=W;++j)
		    {
		    	if(board[i][j]=='#')
		    	     {
		    	     	vis[i][j]=1;
		    	     	black++;
					 }
			}
	}
	int x=bfs();
	if(x==-1)cout<<x<<endl;
	else cout<<H*W-black-x-1<<endl;
}

Compiler output:
a.cc: In function 'int bfs()':
a.cc:35:30: error: reference to 'move' is ambiguous
   35 |                         n.x+=move[i][0];
      |                              ^~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algobase.h:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
In file included from /usr/include/c++/14/bits/exception_ptr.h:41,
                 from /usr/include/c++/14/exception:166,
                 from /usr/include/c++/14/ios:41:
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:7:5: note:                 'int move [4][2]'
    7 | int move[4][2]={0,1,0,-1,-1,0,1,0};
      |     ^~~~
a.cc:36:30: error: reference to 'move' is ambiguous
   36 |                         n.y+=move[i][1];
      |                              ^~~~
/usr/include/c++/14/bits/stl_algobase.h:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:7:5: note:                 'int move [4][2]'
    7 | int move[4][2]={0,1,0,-1,-1,0,1,0};
      |     ^~~~
Language: C++

#include<stdio.h>
#include<iostream>
#include<queue>
#include<cstring>
using namespace std;
int H,W;
int move[4][2]={{0,1},{0,-1},{-1,0},{1,0}};
const int SIZE=200;
struct node{
	int x,y;
	int step;
};
char board[SIZE][SIZE];
bool vis[SIZE][SIZE];
queue<node>q;
int bfs()
{
	node s;
	node n;
	node t;
	s.x=1;
	s.y=1;
	s.step=0;
	q.push(s);
	vis[1][1]=1;
	while(q.size())
	     {
	     	t=q.front();
	     	q.pop();
	     	if(t.x==H&&t.y==W)
	     	return t.step;
	        for(int i=0;i<4;++i)
	        {
	        	n=t;
	        	n.x+=move[i][0];
	        	n.y+=move[i][1];
	        	n.step=t.step+1;
	        	if(n.x>=1&&n.x<=W&&n.y>=1&&n.y<=H&&!vis[n.x][n.y])
	        	     {
	        	     	q.push(n);
					 }
			}
	         
		 }
		 return -1;
	
}
int main()
{
	cin>>H>>W;
	memset(board,0,sizeof(board));
	memset(vis,0,sizeof(vis));
	int i,j;
	for(i=1;i<=H;++i)
	for(j=1;j<=W;++j)
	cin>>board[i][j];
	int black=0;
	for(i=1;i<=H;++i)
	{
		for(j=1;j<=W;++j)
		    {
		    	if(board[i][j]=='#')
		    	     {
		    	     	vis[i][j]=1;
		    	     	black++;
					 }
			}
	}
	int x=bfs();
	if(x==-1)cout<<x<<endl;
	else cout<<H*W-black-x-1<<endl;
}

Compiler output:
a.cc: In function 'int bfs()':
a.cc:35:30: error: reference to 'move' is ambiguous
   35 |                         n.x+=move[i][0];
      |                              ^~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algobase.h:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
In file included from /usr/include/c++/14/bits/exception_ptr.h:41,
                 from /usr/include/c++/14/exception:166,
                 from /usr/include/c++/14/ios:41:
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:7:5: note:                 'int move [4][2]'
    7 | int move[4][2]={{0,1},{0,-1},{-1,0},{1,0}};
      |     ^~~~
a.cc:36:30: error: reference to 'move' is ambiguous
   36 |                         n.y+=move[i][1];
      |                              ^~~~
/usr/include/c++/14/bits/stl_algobase.h:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:7:5: note:                 'int move [4][2]'
    7 | int move[4][2]={{0,1},{0,-1},{-1,0},{1,0}};
      |     ^~~~
Language: C

#include<iostream>
#include<string.h> 
#include <queue>
#include <stack>
using namespace std;
char str[55][55];
int vis[55][55];
int d[4][2] = {-1,0,1,0,0,-1,0,1};
struct figuer{
		int x, y, step;
	}t,f;
int bfs (int n, int m);
int main()
{
	memset(vis,0,sizeof(vis[0]));
	int i, j, m, n, sum;
	scanf("%d %d", &n ,&m);
	sum = 0;
	for (i = 1;i <= n;i++) {
		getchar();
		for (j = 1;j <= m;j++) {
			scanf("%c",&str[i][j]);
			if (str[i][j] == '.')
				sum++;
		}
	}
		
	int x = bfs(n,m); 
//	for ( i = 1;i <= n;i++) {
//		for (j = 1;j <= m;j++) {
//			printf("%d ",vis[i][j]);
//		}
//		printf("\n");
//	}
	if (x == -1)
		printf("%d\n",x);
	else
		printf("%d\n",sum - x);
	return 0;
} 
int bfs(int n, int m)
{
	int i;
	queue<figuer> q;			//
	t.x = t.y = t.step = 1;
	q.push(t);
	while (!q.empty()) {		//队列不为空 
		t = q.front() ;			//取第一个元素 
		q.pop();
		if (vis[t.x][t.y])		//坐标是否走过 
			continue;
		vis[t.x][t.y] = t.step;
		if (t.x == n && t.y == m) 
			return t.step;
		for (i = 0;i < 4;i++) {	//坐标移动 
			f.x = t.x + d[i][0];
			f.y = t.y + d[i][1];
			int a = f.x, b = f.y;
			if (a>=1&&a<=n&&b>=1&&b<=m&&str[a][b]=='.') {
				f.step = t.step + 1;
				q.push(f);
			}
		}	
	}
	return -1;
}

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

#include<iostream>
#include<queue>
#include<cstring>
using namespace std;
int move[4][2]={-1,0,1,0,0,1,0,-1}; 
char map[1000][1000];
int step[1000][1000];
bool visit[1000][1000];
int h,w;  
int bfs()
{
   	queue<pair<int,int> > q;
   	q.push(make_pair(0,0));
   	step[0][0]=1;
   	visit[0][0]=true;
   	while(!q.empty())
   	{
   		pair<int,int> v=q.front();
   		q.pop();
   		for(int i=0;i<4;i++)
   	   { 
   	     int x=v.first+move[i][0];
   	     int y=v.second+move[i][1];
   	     if(x==h-1&&y==w-1)return step[v.first][v.second]+1;
   	     if(x>=0&&y>=0&&x<h&&y<w&&visit[x][y]==false||map[x][y]=='.'){
   	     	visit[x][y]=true;
   	     	step[x][y]=step[v.first][v.second]+1;
   	     	q.push(make_pair(x,y));
			}
   		
	   }
	}
	return -1;
}
int main()
{
	cin>>h>>w;
	int count=0;
	memset(visit,false,sizeof(visit));
	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		{
			cin>>map[i][j];
	    	if(map[i][j]=='#')count++;
		}
	
	}
	int res=bfs();
	if(res==-1)cout<<"-1"<<endl;
	else 
	 cout<<h*w-res-count<<endl;
	return 0;
} 

Compiler output:
a.cc: In function 'int bfs()':
a.cc:22:28: error: reference to 'move' is ambiguous
   22 |              int x=v.first+move[i][0];
      |                            ^~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
In file included from /usr/include/c++/14/bits/exception_ptr.h:41,
                 from /usr/include/c++/14/exception:166,
                 from /usr/include/c++/14/ios:41:
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:5:5: note:                 'int move [4][2]'
    5 | int move[4][2]={-1,0,1,0,0,1,0,-1};
      |     ^~~~
a.cc:23:29: error: reference to 'move' is ambiguous
   23 |              int y=v.second+move[i][1];
      |                             ^~~~
/usr/include/c++/14/bits/stl_algobase.h:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:5:5: note:                 'int move [4][2]'
    5 | int move[4][2]={-1,0,1,0,0,1,0,-1};
      |     ^~~~
Language: C++

#include<iostream>
#include<queue>
#include<cstring>
using namespace std;
const long long maxn=1e3+10;
const int move[4][2]={-1,0,1,0,0,1,0,-1}; 
char map[maxn][maxn];
int step[maxn][maxn];
bool visit[maxn][maxn];
int h,w;  
int bfs()
{
   	queue<pair<int,int> > q;
   	q.push(make_pair(0,0));
   	step[0][0]=1;
   	visit[0][0]=true;
   	while(!q.empty())
   	{
   		pair<int,int> v=q.front();
   		q.pop();
   		for(int i=0;i<4;i++)
   	   { 
   	     int x=v.first+move[i][0];
   	     int y=v.second+move[i][1];
   	     if(x==h-1&&y==w-1)return step[v.first][v.second]+1;
   	     if(x>=0&&y>=0&&x<h&&y<w&&visit[x][y]==false||map[x][y]=='.'){
   	     	visit[x][y]=true;
   	     	step[x][y]=step[v.first][v.second]+1;
   	     	q.push(make_pair(x,y));
			}
   		
	   }
	}
	return -1;
}
int main()
{
	cin>>h>>w;
	int count=0;
	memset(visit,false,sizeof(visit));
	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		{
			cin>>map[i][j];
	    	if(map[i][j]=='#')count++;
		}
	
	}
	int res=bfs();
	if(res==-1)cout<<"-1"<<endl;
	else 
	 cout<<h*w-res-count<<endl;
	return 0;
} 

Compiler output:
a.cc: In function 'int bfs()':
a.cc:23:28: error: reference to 'move' is ambiguous
   23 |              int x=v.first+move[i][0];
      |                            ^~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
In file included from /usr/include/c++/14/bits/exception_ptr.h:41,
                 from /usr/include/c++/14/exception:166,
                 from /usr/include/c++/14/ios:41:
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:6:11: note:                 'const int move [4][2]'
    6 | const int move[4][2]={-1,0,1,0,0,1,0,-1};
      |           ^~~~
a.cc:24:29: error: reference to 'move' is ambiguous
   24 |              int y=v.second+move[i][1];
      |                             ^~~~
/usr/include/c++/14/bits/stl_algobase.h:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:6:11: note:                 'const int move [4][2]'
    6 | const int move[4][2]={-1,0,1,0,0,1,0,-1};
      |           ^~~~
Language: C

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

using namespace std;

const int Move[4][2] = {-1,0,1,0,0,1,0,-1};
char mp[100][100];
int step[100][100];
bool vis[100][100];
int n,m;

bool check(int x,int y) {
    if(x < 0 || y < 0|| x >= n || y >= m || vis[x][y] || mp[x][y] == '#') return false;
    return true;
}

int BFS() {
    queue<pair<int ,int> > q;
    q.push(make_pair(0,0));
    step[0][0] = 1;
    vis[0][0] = true;
    while (!q.empty()) {
        pair<int ,int> t = q.front();
        q.pop();
        for(int i = 0;i < 4;i++) {
            int tox = t.first + Move[i][0];
            int toy = t.second + Move[i][1];
            if(tox == n - 1 && toy == m - 1)   return step[t.first][t.second] + 1;
            if(check(tox,toy)) {
                vis[tox][toy] = true;
                step[tox][toy] = step[t.first][t.second] + 1;
                q.push(make_pair(tox,toy));
            }
        }
    }
    return -1;
}


int main(){
    cin>>n>>m;
    int cnt = 0;
    for(int i = 0;i < n;i++)
        for(int j = 0;j < m;j++) {
            cin>>mp[i][j];
            if(mp[i][j] == '#') cnt++;
        }
    int res = BFS();
    if(res == -1) {
        cout<<"-1"<<endl;
    } else {
    	
        cout<< n*m - res - cnt<<endl;
    }
    return 0;
}

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

#include<bits/stdc++.h>

using namespace std;

const int Move[4][2] = {-1,0,1,0,0,1,0,-1};
char mp[100][100];
int step[100][100];
bool vis[100][100];
int n,m;

bool check(int x,int y) {
    if(x < 0 || y < 0|| x >= n || y >= m || vis[x][y] || mp[x][y] == '#') return false;
    return true;
}

int BFS() {
    queue<pair<int ,int> > q;
    q.push(make_pair(0,0));
    step[0][0] = 1;
    vis[0][0] = true;
    while (!q.empty()) {
        pair<int ,int> t = q.front();
        q.pop();
        for(int i = 0;i < 4;i++) {
            int tox = t.first + Move[i][0];
            int toy = t.second + Move[i][1];
            if(tox == n - 1 && toy == m - 1)   return step[t.first][t.second] + 1;
            if(check(tox,toy)) {
                vis[tox][toy] = true;
                step[tox][toy] = step[t.first][t.second] + 1;
                q.push(make_pair(tox,toy));
            }
        }
    }
    return -1;
}


int main(){
    cin>>n>>m;
    int cnt = 0;
    for(int i = 0;i < n;i++)
        for(int j = 0;j < m;j++) {
            cin>>mp[i][j];
            if(mp[i][j] == '#') cnt++;
        }
    int res = BFS();
    if(res == -1) {
        cout<<"-1"<<endl;
    } else {
    	
        cout<< n*m - res - cnt<<endl;
    }
    return 0;
}

Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.