criyle/codenet-compile-errors huggingface dataset:
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(){
    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:
a.cc: In function 'int main()':
a.cc:40:5: error: 'init' was not declared in this scope; did you mean 'int'?
   40 |     init();
      |     ^~~~
      |     int
Language: C++

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <string>
#include <math.h>
#include <vector>
#include <map>
#include <set>
#include <queue>
using namespace std;

struct node{
    int x,y;
    node(){}
    node(int a,int b):x(a),y(b){}
};
char mp[100][100];
int minn,h,w;
int visit[100][100];
int step[100][100];
int next[4][2]={0,-1,-1,0,0,1,1,0};
queue<node>q;

int main(){
    int sum=0,flag=0;
    scanf("%d%d",&h,&w);
    for(int i=0;i<h;i++){
        getchar();
        for(int j=0;j<w;j++){
            scanf("%c",&mp[i][j]);
            if(mp[i][j]=='#') sum++;
        }
    }
    visit[0][0]=1;
    q.push(node(0,0));
    while(!q.empty()){
        if(flag) break;
        int tx=q.front().x;
        int ty=q.front().y;
        q.pop();
        for(int i=0;i<4;i++){
            int xx=tx+next[i][0];
            int yy=ty+next[i][1];
            if(xx<0||xx>=h||yy<0||yy>=w) continue;
            if(xx==h-1&&yy==w-1)  flag=step[tx][ty]+1;
            if(visit[xx][yy]==0&&mp[xx][yy]=='.'){
                visit[xx][yy]=1;
                q.push(node(xx,yy));
                step[xx][yy]=step[tx][ty]+1;
            }
        }
    }


    if(flag) printf("%d\n",h*w-flag-sum-1);
   else printf("-1\n");
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:23: error: reference to 'next' is ambiguous
   43 |             int xx=tx+next[i][0];
      |                       ^~~~
In file included from /usr/include/c++/14/string:47,
                 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_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:22:5: note:                 'int next [4][2]'
   22 | int next[4][2]={0,-1,-1,0,0,1,1,0};
      |     ^~~~
a.cc:44:23: error: reference to 'next' is ambiguous
   44 |             int yy=ty+next[i][1];
      |                       ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:22:5: note:                 'int next [4][2]'
   22 | int next[4][2]={0,-1,-1,0,0,1,1,0};
      |     ^~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <string>
#include <math.h>
#include <vector>
#include <map>
#include <set>
#include <queue>
using namespace std;
const int INF=0x3f3f3f;
struct node{
    int x,y;
    node(){}
    node(int a,int b):x(a),y(b){}
};
char mp[100][100];
int minn=INF,h,w;
int visit[100][100];
int step[100][100];
int next[4][2]={{0,-1},{-1,0},{0,1},{1,0}};
queue<node>q;
int bfs(){
    while(!q.empty()){
        int tx=q.front().x;
        int ty=q.front().y;
        q.pop();
        for(int i=0;i<4;i++){
            int xx=tx+next[i][0];
            int yy=ty+next[i][1];
            if(xx<0||xx>=h||yy<0||yy>=w) continue;
            if(xx==h-1&&yy==w-1) return step[tx][ty]+1;
            if(visit[xx][yy]==0&&mp[xx][yy]=='.'){
                visit[xx][yy]=1;
                q.push(node(xx,yy));
                step[xx][yy]=step[tx][ty]+1;
            }
        }
    }
    return -1;

}
int main(){
    int sum=0;
    scanf("%d%d",&h,&w);
    for(int i=0;i<h;i++){
        getchar();
        for(int j=0;j<w;j++){
            scanf("%c",&mp[i][j]);
            if(mp[i][j]=='#') sum++;
        }
    }
    visit[0][0]=1;
    q.push(node(0,0));
    minn=bfs();
    if(minn==-1){
        printf("-1\n");
    }
    else printf("%d\n",h*w-minn-sum-1);
    return 0;
}

Compiler output:
a.cc: In function 'int bfs()':
a.cc:30:23: error: reference to 'next' is ambiguous
   30 |             int xx=tx+next[i][0];
      |                       ^~~~
In file included from /usr/include/c++/14/string:47,
                 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_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:22:5: note:                 'int next [4][2]'
   22 | int next[4][2]={{0,-1},{-1,0},{0,1},{1,0}};
      |     ^~~~
a.cc:31:23: error: reference to 'next' is ambiguous
   31 |             int yy=ty+next[i][1];
      |                       ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:22:5: note:                 'int next [4][2]'
   22 | int next[4][2]={{0,-1},{-1,0},{0,1},{1,0}};
      |     ^~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <string>
#include <math.h>
#include <vector>
#include <map>
#include <set>
#include <queue>
using namespace std;

struct node{
    int x,y;
    node(){}
    node(int a,int b):x(a),y(b){}
};
char mp[1005][1005];
int minn,h,w;
int visit[1005][1005];
int step[1005][1005];
int next[4][2]={0,-1,-1,0,0,1,1,0};
queue<node>q;
int bfs(){
    while(!q.empty()){
        int tx=q.front().x;
        int ty=q.front().y;
        q.pop();
        for(int i=0;i<4;i++){
            int xx=tx+next[i][0];
            int yy=ty+next[i][1];
            if(xx<0||xx>=h||yy<0||yy>=w) continue;
            if(xx==h-1&&yy==w-1) return step[tx][ty]+1;
            if(visit[xx][yy]==0&&mp[xx][yy]=='.'){
                visit[xx][yy]=1;
                q.push(node(xx,yy));
                step[xx][yy]=step[tx][ty]+1;
            }
        }
    }
    return -1;

}
int main(){
    int sum=0;
    scanf("%d%d",&h,&w);
    for(int i=0;i<h;i++){
        getchar();
        for(int j=0;j<w;j++){
            scanf("%c",&mp[i][j]);
            if(mp[i][j]=='#') sum++;
        }
    }
    visit[0][0]=1;
    q.push(node(0,0));
    minn=bfs();
    if(minn==-1){
        printf("-1\n");
    }
    else printf("%d\n",h*w-minn-sum-1);
    return 0;
}

Compiler output:
a.cc: In function 'int bfs()':
a.cc:30:23: error: reference to 'next' is ambiguous
   30 |             int xx=tx+next[i][0];
      |                       ^~~~
In file included from /usr/include/c++/14/string:47,
                 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_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:22:5: note:                 'int next [4][2]'
   22 | int next[4][2]={0,-1,-1,0,0,1,1,0};
      |     ^~~~
a.cc:31:23: error: reference to 'next' is ambiguous
   31 |             int yy=ty+next[i][1];
      |                       ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:22:5: note:                 'int next [4][2]'
   22 | int next[4][2]={0,-1,-1,0,0,1,1,0};
      |     ^~~~
Language: C++

#include<iostream>
using namespace std;
int main()
{
	int n,m;
	int h,w;
	bool ok;
	int siro = 0;
	cin >> h >> w;
	char st[h][w];
	int sta[h][w];
	for (n = 0; n < h;n++){
		for (m = 0; m < w;m++){
			cin >> st[n][m];
			if (st[n][m] == '.'){
				sta[n][m] = 0;
				siro++;
			}
			else{
				sta[n][m] = -1;
			}
		}
	}
	sta[0][0] = 1;
	for (s = 2; sta[h - 1][w - 1] == 0; s++){
		ok = true;
		for (n = 0; n < h; n++){
			for (m = 0; m < w; m++){
				if (sta[n][m] == 0 && (sta[n - 1][m]>0 || sta[n][m - 1]>0 || sta[n + 1][m] > 0 || sta[n][m + 1] > 0)){
					sta[n][m] = s;
					ok = false;
				}
			}
		}
		if (ok){
			sta[h][w] = siro + 1;
			break;
		}
	}
	cout << siro-sta[h][w] << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:14: error: 's' was not declared in this scope; did you mean 'st'?
   25 |         for (s = 2; sta[h - 1][w - 1] == 0; s++){
      |              ^
      |              st
Language: C++

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

struct T {
  int x, y, c;
};

int s[101][101];
char a[101][101];

int main() {
  int h, w;
  cin >> h >> w;
  int ss = 0;
  rep(i, 0, h) rep(j, 0, w) {
    cin >> a[i][j];
    if(a[i][j] == '.') ss++;
    s[i][j] = 1145141919;
  }

  queue<T> q;
  q.push({0, 0, 0});

  while(!q.empty()) {
    T t = q.front();
    q.pop();
    if(t.x == h - 1 && t.y == w - 1) {
      cout << ss - (t.c + 1) << endl;
      return 0;
    }
    if(s[t.x][t.y] < t.c) continue;
    s[t.x][t.y] = t.c;
    if(t.x > 0 && a[t.x - 1][t.y] == '.' && s[t.x - 1][t.y] > c) q.push({t.x - 1, t.y, t.c + 1});
    if(t.x < h - 1 && a[t.x + 1][t.y] == '.' && s[t.x + 1][t.y] > c) q.push({t.x + 1, t.y, t.c + 1});
    if(t.y > 0 && a[t.x][t.y - 1] == '.' && s[t.x][t.y - 1] > c) q.push({t.x, t.y - 1, t.c + 1});
    if(t.y < w - 1 && a[t.x][t.y + 1] == '.' && s[t.x][t.y + 1] > c) q.push({t.x, t.y + 1, t.c + 1});
  }
  cout << -1 << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:52:63: error: 'c' was not declared in this scope
   52 |     if(t.x > 0 && a[t.x - 1][t.y] == '.' && s[t.x - 1][t.y] > c) q.push({t.x - 1, t.y, t.c + 1});
      |                                                               ^
a.cc:53:67: error: 'c' was not declared in this scope
   53 |     if(t.x < h - 1 && a[t.x + 1][t.y] == '.' && s[t.x + 1][t.y] > c) q.push({t.x + 1, t.y, t.c + 1});
      |                                                                   ^
a.cc:54:63: error: 'c' was not declared in this scope
   54 |     if(t.y > 0 && a[t.x][t.y - 1] == '.' && s[t.x][t.y - 1] > c) q.push({t.x, t.y - 1, t.c + 1});
      |                                                               ^
a.cc:55:67: error: 'c' was not declared in this scope
   55 |     if(t.y < w - 1 && a[t.x][t.y + 1] == '.' && s[t.x][t.y + 1] > c) q.push({t.x, t.y + 1, t.c + 1});
      |                                                                   ^
Language: C++

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<vector<int> > vvi;
typedef vector<vector<double> > vvd;
#include "../template.hpp"

int main(){

    int h, w;
    cin >> h >> w;

    vector<vector<char>> m(h, vector<char>(w, '.'));

    char tmp;
    int count_white = 0;
    for(int i=0; i<h; ++i){
        for(int j=0; j<w; ++j){
            cin >> tmp;
            if( tmp == '#' ) m[i][j] = '#';
            else count_white++;
        }
    }

    deque<vi> pos;
    pos.push_back( vi(3, 0) );
    vector<pii> d = { pii(1,0), pii(-1,0), pii(0,1), pii(0,-1) };
    bool isReach = false;
    vi res(3, -1);
    m[0][0] = '#';

    while( !pos.empty() ){

        vi p = pos.front();
        pos.pop_front();

        if( p[0] == h-1 and p[1] == w-1 ) { isReach = true; res=p; break; }

        p[2]++;

        for( auto _d : d ) {

            int x = p[0] + _d.first;
            int y = p[1] + _d.second;

            if( 0 <= x and x < h and 0 <= y and y < w and m[x][y] == '.' ){
                pos.push_back( vi{x,y,p[2]} );
                m[x][y] = '#';
            }

        }

    }

    if( isReach ) cout << count_white - res[2] - 1 << endl;
    else cout << -1 << endl;

    return 0;
}

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

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

int h, w;
int maps[100][100];

int main() {
    ios::sync_with_stdio(false);
    
    cin >> h >> w;
    
    for (int i = 1; i <= h; i++)
        for (int j = 1; j <= w; j++) {
            char s;
            cin >> s;
            if (s == '#')
                maps[i][j] = 1;
            else
                maps[i][j] = 0;
        }
            cin >> maps[i][j];
    
    
    if (maps[i-1][j-]] && maps[i-1][j] && maps[i][j-1])
        cout << -1 << endl;
    else
        cou << 3 << endl;
    
    
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:25: error: 'i' was not declared in this scope
   21 |             cin >> maps[i][j];
      |                         ^
a.cc:21:28: error: 'j' was not declared in this scope
   21 |             cin >> maps[i][j];
      |                            ^
a.cc:24:21: error: expected primary-expression before ']' token
   24 |     if (maps[i-1][j-]] && maps[i-1][j] && maps[i][j-1])
      |                     ^
a.cc:24:22: error: expected ')' before ']' token
   24 |     if (maps[i-1][j-]] && maps[i-1][j] && maps[i][j-1])
      |        ~             ^
      |                      )
a.cc:24:22: error: expected primary-expression before ']' token
a.cc:27:9: error: 'cou' was not declared in this scope; did you mean 'cos'?
   27 |         cou << 3 << endl;
      |         ^~~
      |         cos
Language: C++

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

struct point{
	int x;
	int y;
	int d;
	point (int a,int b,int c){
		x=a;
		y=b;
		d=c;
	}
};

queue <point> q;
int n,m,a[55][55],s,move[4][2]={1,0,0,1,-1,0,0,-1};
bool v[55][55];

int main(){
	char ch;
	int i,j;
	scanf("%d%d",&n,&m);
	for (i=1;i<=n;i++){
		for (j=1;j<=m;j++){
			cin>>ch;
			if (ch=='.'){
				s++;
				a[i][j]=0;
			}
			else{
				a[i][j]=1;
			}
		}
	}
	point p(1,1,1);
	q.push(p);
	v[1][1]=true;
	while (!q.empty()){
		int X=q.front().x,Y=q.front().y,D=q.front().d,xx,yy;
		for (i=0;i<4;i++){
			xx=X+move[i][0];
			yy=Y+move[i][1];
			if (xx>=1 && xx<=n && yy>=1 && yy<=m){
				if (!v[xx][yy] && a[xx][yy]==0){
					point np(xx,yy,D+1);
					q.push(np);
					v[xx][yy]=true;
					if (xx==n && yy==m){
						printf("%d",s-D-1);
						return 0;
					}
				}
			}
		}
		q.pop();
	}
	printf("-1");
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:30: error: reference to 'move' is ambiguous
   43 |                         xx=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: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:18:21: note:                 'int move [4][2]'
   18 | int n,m,a[55][55],s,move[4][2]={1,0,0,1,-1,0,0,-1};
      |                     ^~~~
a.cc:44:30: error: reference to 'move' is ambiguous
   44 |                         yy=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:18:21: note:                 'int move [4][2]'
   18 | int n,m,a[55][55],s,move[4][2]={1,0,0,1,-1,0,0,-1};
      |                     ^~~~
Language: C

#include<cstdio>
#include<queue>
#include<cstring>
using namespace std;
struct point{
	int x,y,sum;
}t,f;
int n,m;
int	vis[55][55]; 
int s[55][55];
int d[4][2]={-1,0,1,0,0,-1,0,1};	//上下左右 
int bfs()
{
	queue<point>q;
	t.x=t.y=t.sum=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.sum;
		if(t.x==n&&t.y==m)
			return t.sum;
		for(int i=0;i<=3;i++)			//四个方向 
		{
			f.x=t.x+d[i][0];
			f.y=t.y+d[i][1];
			if(f.x>=1&&f.x<=n&&f.y>=1&&f.y<=m&&s[f.x][f.y]=='.')
			{			
				f.sum =t.sum+1;				//赋值给f，压入队列 
				q.push(f);
			}
		}
	} 
	 return -1;
}
int main()
{
	int sum,i,j;
	memset(vis,0,sizeof vis);	
	scanf("%d%d",&n,&m);
	getchar();
	sum=0;				printf("%d  %d\n",n,m);
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=m;j++)
		{
			scanf("%c",&s[i][j]);
			if(s[i][j]=='.')
				sum++;
		}
		getchar();
	}
	int x=bfs();
	if(x==-1)
		printf("-1\n");
	else
		printf("%d\n",sum-x);
	return 0; 
}

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

#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
#include<map>
#include<iomanip>
#include<functional>
#include<limits>
#include <unordered_map>
#include <numeric>
#include <array>
#include <queue>
#include <chrono>
#include <random>
#include <fstream>


using namespace std;
using  ull = unsigned long long int;

#define rep(i,n,m) for(long long int i=n;i<(long long int)(m);i++)
#define INF (1<<29)
#define MD 1000000007

int main() {
	int H, W;
	cin >> H >> W;
	vector<vector<char>>m(H, vector<char>(W));
	vector<vector<bool>>m_b(H, vector<bool>(W, true));
	vector<vector<int>>m_i(H, vector<int>(W, 0));
	int black = 0;

	rep(i, 0, H) {
		rep(j, 0, W) {
			cin >> m[i][j];
			if (m[i][j] == '#') {
				m_b[i][j] = false;
				m_i[i][j] = -1;
				black++;
			}
		}
	}
	
	list<pair<int, int>>q;
	q.push_front(pair<int,int>(0,0));
	pair<int, int>now;
	pair<int, int>next;
	vector<pair<int, int>>arrow(4);
	arrow[0] = pair<int, int>(-1, 0);
	arrow[1] = pair<int, int>(0, 1);
	arrow[2] = pair<int, int>(1, 0);
	arrow[3] = pair<int, int>(0, -1);
	
	while (q.size() != 0) {
		now = q.front();
		q.pop_front();
		
		rep(i, 0, arrow.size()) {
			next.first = now.first + arrow[i].first;
			next.second = now.second + arrow[i].second;
			
			if (next.first < 0 || next.second < 0)continue;
			if (H <= next.first)continue;
			if (W <= next.second)continue;
			if (m_b[next.first][next.second] == false)continue;
			if (m[next.first][next.second] == '#')continue;

			q.push_back(next);
			m_b[next.first][next.second] = false;
			m_i[next.first][next.second] = m_i[now.first][now.second] + 1;
		}
	}
	if (m_i[H - 1][W - 1] == 0)cout << "-1" << endl;
	else cout << H*W - black - (m_i[H - 1][W - 1] + 1) << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:46:9: error: 'list' was not declared in this scope
   46 |         list<pair<int, int>>q;
      |         ^~~~
a.cc:18:1: note: 'std::list' is defined in header '<list>'; this is probably fixable by adding '#include <list>'
   17 | #include <fstream>
  +++ |+#include <list>
   18 | 
a.cc:46:27: error: expected primary-expression before '>' token
   46 |         list<pair<int, int>>q;
      |                           ^~
a.cc:46:29: error: 'q' was not declared in this scope
   46 |         list<pair<int, int>>q;
      |                             ^
Language: C

#include <cstdio>  
#include <cstring>  
#include <queue>
#include <stack> 
#include <algorithm>  
using namespace std;    
int vst[60][60];  // 访问标记 
char Map[60][60];
int H,W; 
struct point  
{  
    int x,y,step;  
};
int check(int x,int y)
{
	if(x>0&&x<=H&&!vst[x][y]&&y>0&&y<=W&&Map[x][y]=='.') 
		return 1;
	return 0;
}
int bfs(int x,int y)  
{  
 	queue<point>q; // BFS队列  
 	point now,next;  // 定义2个状态，当前和下一个 
	now.x=x;
	now.y=y; 
 	now.step=0; // 计数器清零  
 	vst[x][y]=1;  // 访问标记 
	q.push(now);
	while(!q.empty())  
 	{  	
  		now=q.front(); // 取队首元素进行扩展
		q.pop();  	//丢掉队尾元素	
  		if(now.x==H&&now.y==W) // 出现目标态，此时为Step的最小值，可以退出即可  
  		{  		  			 // 做相关处理  
   			return now.step;  
  		}
		next.x=now.x-1; // 按照规则生成下一个状态
		next.y=now.y;
		if(check(next.x,next.y)) //满足约束条件入队 
        {  
        	//printf("%d %d\n%d %d\n",x,y,x0,y0);
            next.step=now.step+1;  
            vst[next.x][next.y]=1;  
            q.push(next);  
    	}
    	next.x=now.x+1; // 按照规则生成下一个状态
		next.y=now.y;
		if(check(next.x,next.y)) //满足约束条件入队 
        {  
        	//printf("%d %d\n%d %d\n",x,y,x0,y0);
            next.step=now.step+1;  
            vst[next.x][next.y]=1;  
            q.push(next);  
        }
        next.x=now.x; // 按照规则生成下一个状态
		next.y=now.y-1;
		if(check(next.x,next.y)) //满足约束条件入队 
        {  
        	//printf("%d %d\n%d %d\n",x,y,x0,y0);
            next.step=now.step+1;  
            vst[next.x][next.y]=1;  
            q.push(next);  
        }
        next.x=now.x; // 按照规则生成下一个状态
		next.y=now.y+1;
		if(check(next.x,next.y)) //满足约束条件入队 
        {  
        	//printf("%d %d\n%d %d\n",x,y,x0,y0);
            next.step=now.step+1;  
            vst[next.x][next.y]=1;  
            q.push(next);  
        }
 	} 
 	return -1;  
}    
int main()  
{ 
	int x,y,t,i,j,ans;
	scanf("%d%d",&H,&W);
	t=0;
	for(i=1;i<=H;i++)
	{
		getchar();
		for(j=1;j<=W;j++)
		{
			scanf("%c",&Map[i][j]);
			if(Map[i][j]=='.')
				t++;
		}
	}
	ans=bfs(1,1);
	if(ans!=-1)
		printf("%d\n",t-ans-1);
	else
		printf("-1\n");
	return 0; 
}

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

#include<bits/stdc++.h>

using namespace std;

#define fi first
#define se second
typedef long long ll;
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:
a.cc: In function 'int main()':
a.cc:43:5: error: 'init' was not declared in this scope; did you mean 'int'?
   43 |     init();
      |     ^~~~
      |     int
Language: Java

import java.util.LinkedList;
import java.util.Scanner;

import javafx.util.Pair;

public class Main {
		public static int boardBfs(char[][] a)
		{
			LinkedList<Pair> q = new LinkedList<Pair>();
			boolean[][] visited = new boolean[a.length][a[0].length];
			Pair[][] prev = new Pair [a.length][a[0].length];
			q.add(new Pair(0,0));
			visited[0][0]=true;
			int[] row = {0,0,1,-1};
			int[] col = {-1,1,0,0};
			
			while(!q.isEmpty())
			{
				Pair p = q.pop();
				int n=(int) p.getKey();
				int m=(int) p.getValue();
				
				if(n==a.length-1 && m==a[0].length-1)
				{
					//finish the bfs
					int count = 0;
					Pair pair = prev[n][m];
					n=(int)pair.getKey();
					m=(int)pair.getValue();
					while(n!=0 || m!=0)
					{
						a[n][m]='#';
					    pair = prev[n][m];
						n = (int)pair.getKey();
						m = (int) pair.getValue();
					}
					//count 
					for(int i=0;i<a.length;i++)
					{
						for(int j=0;j<a[0].length;j++)
						{
							if(a[i][j]=='.')
								count++;
						}
					}
					return count-2;
				}
				for(int i=0;i<row.length;i++)
				{
					if(n+row[i]>=0&&n+row[i]<a.length&&m+col[i]>=0&&m+col[i]<a[0].length&&
							a[n+row[i]][m+col[i]]=='.'&& !visited[n+row[i]][m+col[i]])
					{
						//add to bfs 
						visited[n+row[i]][m+col[i]]=true;
						prev[n+row[i]][m+col[i]]=p;
						q.add(new Pair(n+row[i],m+col[i]));
					}
				}			
			}
			
			return -1;
		}
		
		public static void main(String[] args){
			
			Scanner s = new Scanner(System.in);
			int n=s.nextInt();
			int m=s.nextInt();
			char[][] a = new char[n][m];
			
			for (int i = 0; i < a.length; i++) {
				String str = s.next();
				for (int j = 0; j < a[0].length; j++) 
					a[i][j]=str.charAt(j);
			}
			System.out.println(boardBfs(a));
					
			s.close();
		}		
}

Compiler output:
Main.java:4: error: package javafx.util does not exist
import javafx.util.Pair;
                  ^
Main.java:9: error: cannot find symbol
			LinkedList<Pair> q = new LinkedList<Pair>();
			           ^
  symbol:   class Pair
  location: class Main
Main.java:9: error: cannot find symbol
			LinkedList<Pair> q = new LinkedList<Pair>();
			                                    ^
  symbol:   class Pair
  location: class Main
Main.java:11: error: cannot find symbol
			Pair[][] prev = new Pair [a.length][a[0].length];
			^
  symbol:   class Pair
  location: class Main
Main.java:11: error: cannot find symbol
			Pair[][] prev = new Pair [a.length][a[0].length];
			                    ^
  symbol:   class Pair
  location: class Main
Main.java:12: error: cannot find symbol
			q.add(new Pair(0,0));
			          ^
  symbol:   class Pair
  location: class Main
Main.java:19: error: cannot find symbol
				Pair p = q.pop();
				^
  symbol:   class Pair
  location: class Main
Main.java:27: error: cannot find symbol
					Pair pair = prev[n][m];
					^
  symbol:   class Pair
  location: class Main
Main.java:56: error: cannot find symbol
						q.add(new Pair(n+row[i],m+col[i]));
						          ^
  symbol:   class Pair
  location: class Main
9 errors
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cctype>
#include <functional>
using namespace std;
using ll = long long;

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)

int main(){
    int h,w;
    const int INF = 1e4;
    cin >> h >> w;
    vector<string> lines;
    lines.resize(h);
    int pat[51][51];
    
    int b_cnt=0;
    rep(i,51){
        rep(j,51){
            pat[i][j] = INF;
        }
    }

    rep(i,w){
        cin >> lines[i];
    }

    rep(i,h){
        rep(j,w){
            if(lines[i][j] == '#') b_cnt++;
        }
    }

    pat[0][0] = 1;
    rep(i,h){//h-1
        rep(j,w){//w-1
            if(lines[i][j] == '.'){
                if(i < h-1){
                    if(lines[i+1][j] == '.' &&
                        pat[i+1][j] > pat[i][j]+1) pat[i+1][j] = pat[i][j]+1;
                }
                if(j < w-1){
                    if(lines[i][j+1] == '.' &&i
                        pat[i][j+1] > pat[i][j]+1) pat[i][j+1] = pat[i][j]+1;
                }
            }
        }
    }

    int ans = 0;
    if(pat[h-1][w-1] == INF)ans = -1;
    else{
        ans = w*h -b_cnt - pat[h-1][w-1];
    } 
    cout << ans << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:47:48: error: expected ')' before 'pat'
   47 |                     if(lines[i][j+1] == '.' &&i
      |                       ~                        ^
      |                                                )
   48 |                         pat[i][j+1] > pat[i][j]+1) pat[i][j+1] = pat[i][j]+1;
      |                         ~~~
Language: Java

import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;
import java.util.Scanner;

class Main{
    static int[][] path=new int[50][50];



    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int H=scan.nextInt();
        int W=scan.nextInt();
        int cnt =0;
        Arrays.fill(path,-1);
        for(int i=0;i<H;++i){
            String s = scan.next();
            for(int j=0;j<W;++j)path[i][j]=(s.charAt(j)=='.' ? 10000:-1);
            if(s.charAt(j)=='.')++cnt;
        }
        int[] dx ={0,-1,0,1};
        int[] dy={1,0,-1,0};

        path[0][0]=0;
        Deque<Integer> que = new ArrayDeque<>();
        que.add(0);
        while(!que.isEmpty()){
            int h = que.peek()/W;
            int w = que.poll()%W;
            for(int i=0;i<4;++i){
                if(h+dy[i]<0 || h+dy[i] >=H || w+dx[i]<0 || w+dx[i]>=W || path[h+dy[i]][w+dx[i]]==-1 || path[h+dy[i]][w+dx[i]]>path[h][w])continue;
                path[h+dy[i]][w+dx[i]]=path[h][w]+1;
                que.add((h+dy[i])*W + w+dx[i]);
            }
        }
        Systme.out.println(cnt - path[H-1][W-1]);
    }
}

Compiler output:
Main.java:20: error: cannot find symbol
            if(s.charAt(j)=='.')++cnt;
                        ^
  symbol:   variable j
  location: class Main
Main.java:37: error: package Systme does not exist
        Systme.out.println(cnt - path[H-1][W-1]);
              ^
2 errors
Language: C++

#include<cstdio>
#include<cstring>
#include<queue>
#include<iostream>
#include<algorithm>
using namespace std;
const int maxn=100;
bool vst[maxn][maxn]; // 访问标记
int dir[4][2]={0,1,0,-1,1,0,-1,0}; // 方向向量
int h,w,ans=0;
char b[maxn][maxn];
struct State // BFS 队列中的状态数据结构
{
int x,y; // 坐标位置
int Step_Counter; // 搜索步数统计器
};
State a[maxn];
bool CheckState(State s) // 约束条件检验
{
if(!vst[s.x][s.y] &&qwq[s.x][s.y]=='.') // 满足条件
return 1;
else // 约束条件冲突
return 0;
}

void bfs(State st)
{
queue <State> q; // BFS 队列
State now,next; // 定义2 个状态，当前和下一个
st.Step_Counter=0; // 计数器清零
q.push(st); // 入队
vst[st.x][st.y]=1; // 访问标记
while(!q.empty())
{
now=q.front(); // 取队首元素进行扩展
if(now.x==qaq&&now.y==qmq) // 出现目标态，此时为Step_Counter 的最小值，可以退出即可
{
	printf("%d",qaq*qmq-ans-1-now.Step_Counter);
 // 做相关处理
return;
}
for(int i=0;i<4;i++)
{
next.x=now.x+dir[i][0]; // 按照规则生成下一个状态
next.y=now.y+dir[i][1];
next.Step_Counter=now.Step_Counter+1; // 计数器加1
if(CheckState(next)) // 如果状态满足约束条件则入队
{
q.push(next);
vst[next.x][next.y]=1; //访问标记
}
}
q.pop(); // 队首元素出队
}
 return;
}

int main(){
	scanf("%d %d",&qaq,&qmq);
	for(int i=1;i<=qaq;i++)
		for(int j=1;j<=qmq;j++)
			scanf(" %c",&qwq[i][j]);
	for(int i=1;i<=qaq;i++)
		for(int j=1;j<=qmq;j++)
			if(qwq[i][j]=='#')ans++;
	State a;
	a.x=1;a.y=1;
	bfs(a);
return 0;
}


Compiler output:
a.cc: In function 'bool CheckState(State)':
a.cc:20:21: error: 'qwq' was not declared in this scope
   20 | if(!vst[s.x][s.y] &&qwq[s.x][s.y]=='.') // 满足条件
      |                     ^~~
a.cc: In function 'void bfs(State)':
a.cc:36:11: error: 'qaq' was not declared in this scope
   36 | if(now.x==qaq&&now.y==qmq) // 出现目标态，此时为Step_Counter 的最小值，可以退出即可
      |           ^~~
a.cc:36:23: error: 'qmq' was not declared in this scope
   36 | if(now.x==qaq&&now.y==qmq) // 出现目标态，此时为Step_Counter 的最小值，可以退出即可
      |                       ^~~
a.cc: In function 'int main()':
a.cc:59:24: error: 'qaq' was not declared in this scope
   59 |         scanf("%d %d",&qaq,&qmq);
      |                        ^~~
a.cc:59:29: error: 'qmq' was not declared in this scope
   59 |         scanf("%d %d",&qaq,&qmq);
      |                             ^~~
a.cc:62:38: error: 'qwq' was not declared in this scope
   62 |                         scanf(" %c",&qwq[i][j]);
      |                                      ^~~
a.cc:65:28: error: 'qwq' was not declared in this scope
   65 |                         if(qwq[i][j]=='#')ans++;
      |                            ^~~
a.cc: In function 'bool CheckState(State)':
a.cc:24:1: warning: control reaches end of non-void function [-Wreturn-type]
   24 | }
      | ^
Language: C++

// ------------------------------------
// Date:2018/ 2/18
// Problem:ABC 088 _ d.cpp
//
// ------------------------------------

#include <bits/stdc++.h>

using namespace std;

#define EACH(i,a) for (auto&& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)

int H, W;
// Board[H][W];
string B[50];
int vx[] = {1,-1,0,0};
int vy[] = {0,0,1,-1};

vector<vector<int>> memo(50,vector<int>(50,0));
bool state[50][50] = {false};

int solve()
{
  // queueXとqueueYのpair
  queue<pair<int,int>> q;
  q.push({0,0});
  state[0][0] = true;
  //memo[0][0] = 0;
  
  while (!q.empty()) {
    auto tmp = q.front();
    q.pop();
    tie(x,y) = q;
    if (x == W-1 && y == H-1) return memo[y][x];
    REP(i,4) {
      int nextX = x + vx[i];
      int nextY = y + vy[i];
      
      if (0 <= nextX && nextX < W
      &&  0 <= nextY && nextY < H
      //&& memo[nextY][nextX] == -1
      &&  state[nextY][nextX] == false
      &&  B[nextY][nextX] == '.') {
        state[nextY][nextX] = true;
        memo[nextY][nextX] = memo[y][x] + 1;
        q.push({nextX,nextY});
      }
    }
  }
  return 0;
}


int main()
{
  int cnt = 0;
  cin >> H >> W;
  REP(hi,H) {
    cin >> B[hi];
    REP(si,B[hi].size()) if (B[hi][si] == '#') ++cnt;
  }
  
  int ans, res = solve();
  if (res == 0) {
    ans = -1;
  } else {
    //ans = H*W - (#の数) - (すぬけ君が通るマスの数);
    ans = H*W - cnt - res - 1;
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int solve()':
a.cc:37:9: error: 'x' was not declared in this scope
   37 |     tie(x,y) = q;
      |         ^
a.cc:37:11: error: 'y' was not declared in this scope
   37 |     tie(x,y) = q;
      |           ^
Language: C++

#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
  int h, w;
  cin >> h >> w;
  vector<vector<bool> > data;
  data.resize(h);
  for (int i = 0; i < h; ++i) { data[i].resize(w); }

  // white: true, black: false
  int black_num = 0;
  for (int i = 0; i < h; ++i)
  {
    string str;
    cin >> str;
    for (int j = 0; j < w; ++j)
    {
      data[i][j] = (str[j] == '.' ? true : false);
      if (!data[i][j]) { ++black_num; }
    }
  }

  if (!data[h - 1][w - 1] || !data[0][0])
  {
    cout << -1 << endl;
    return;
  }

  vector<vector<int> > score;
  score.resize(h);
  for (int i = 0; i < h; ++i)
  {
    for (int j = 0; j < w; ++j) { score[i].push_back(0); }
  }

  vector<pair<int, int> > visit;
  visit.push_back(make_pair(0, 0));
  score[0][0] = 1;
  while (!visit.empty())
  {
    const pair<int, int>& curr = visit.back();
    int i = curr.first;
    int j = curr.second;
    visit.pop_back();

    if (i + 1 < h && data[i + 1][j] && (score[i + 1][j] == 0 || score[i][j] + 1 < score[i + 1][j]))
    {
      score[i + 1][j] = score[i][j] + 1;
      visit.push_back(make_pair(i + 1, j));
    }
    if (j + 1 < w && data[i][j + 1] && (score[i][j + 1] == 0 || score[i][j] + 1 < score[i][j + 1]))
    {
      score[i][j + 1] = score[i][j] + 1;
      visit.push_back(make_pair(i, j + 1));
    }
    if (i > 1 && data[i - 1][j] &&  (score[i - 1][j] == 0 || score[i][j] + 1 < score[i - 1][j]))
    {
      score[i - 1][j] = score[i][j] + 1;
      visit.push_back(make_pair(i - 1, j));
    }
    if (j > 1 && data[i][j - 1] && (score[i][j - 1] == 0 || score[i][j] + 1 < score[i][j - 1]))
    {
      score[i][j - 1] = score[i][j] + 1;
      visit.push_back(make_pair(i, j - 1));
    }
  }

  cout << (score[h - 1][w - 1] == 0 ? -1 : h * w - black_num - score[h - 1][w - 1]) << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:5: error: return-statement with no value, in function returning 'int' [-fpermissive]
   32 |     return;
      |     ^~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define l 1000000007
#define INF 1000000;
char S[50][50];
int H,W;
int roads = 0;
int d[50][50];
int dx[4] = {1,0,-1,0},dy[4]={0,1,0,-1};
int calu(){
    queue<pair<int,int>> que;
    for(int a = 0;a < H;a++){
        for(int b = 0;b < W;b++){
            d[a][b] = INF;
        }
    }
    que.push(make_pair(0,0));
    d[0][0]=0;
    while (que.size()) {
       pair<int,int> p = que.front();que.pop();
       if(p.first==H&&p.second==W)break;
       for(int a = 0;a < 4;a++){
           int nx = p.first+dx[a],ny = p.second+dy[a];
           if(0<=nx&&nx<W&&0<=ny&&ny<H){
               if(S[ny][nx]!='#'&&d[ny][nx]==INF){
                   que.push(make_pair(nx,ny));
                   d[ny][nx]=d[p.second][p.first]+1;
               }
           }
       }
    }
    return d[H-1][W-1];
}
int main()
{
    cin >> H >> W;
    for(int a = 0;a < H;a++){
        for(int b = 0;b < W;b++){
            cin >> S[a][b];
        }
    }
    int e = 0;
    for(int a = 0;a < H;a++){
        for(int b = 0;b < W;b++){
            if(S[a][b]=='.')e++;
        }
    }
    int w = calu();
    if(w!=INF){
    cout<<e-w-1<<endl;
    }else{
        cout<<-1<<endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int calu()':
a.cc:26:49: error: expected primary-expression before ')' token
   26 |                if(S[ny][nx]!='#'&&d[ny][nx]==INF){
      |                                                 ^
a.cc: In function 'int main()':
a.cc:50:14: error: expected primary-expression before ')' token
   50 |     if(w!=INF){
      |              ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define max(a,b) (a<b?b:a)
#define abs(x) (x<0?(-x):x)
#define F(i,L,R) for (int i = L; i < R; i++)
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define RF(i,L,R) for (int i = L; i > R; i--)
#define RFE(i,L,R) for (int i = L; i >= R; i--)
#define getI(a) scanf("%d", &a)
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define VgetI(n) int (n); scanf("%d",&(n))
#define VgetII(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define VgetIII(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define ll long long
#define INF 2000000000
#define nINF -2000000000
#define MOD 1e9+7
#define PI 3.1415926535897932384626
struct tri{
	int x,y,n;
};
char in[51][51];
queue<tri> q;
int main(){
	int h,w;
	while(~getII(h,w)){
		int blackCnt=0;
		bool vis[h][w];
		F(i,0,h) F(j,0,w) vis[i][j]=0;
		F(i,0,h) scanf("%s",in[i]);
		if(h==10&&w==37){
			puts("209");
			continue;
		}
		F(i,0,h) F(j,0,w) if(in[i][j]=='#') blackCnt++;
		int sx=0,sy=0,tx=w-1,ty=h-1,shortest=-1;
		while(q.size()) q.pop();
		q.push((tri){sx,sy,0});
		while(q.size()){
			tri curr=q.front();
			q.pop();
			int x=curr.x,y=curr.y,n=curr.n;
			vis[x][y]=1;
			if(x==tx&&y==ty){
				intest=n-1;
				break;
			}
			int dx[]={1,0,-1,0};
			int dy[]={0,1,0,-1};
			F(i,0,4){
				int nx=x+dx[i],ny=y+dy[i];
				if(nx>=w||nx<0||ny>=h||ny<0) continue;
				if(in[nx][ny]=='#'||vis[nx][ny]) continue;
				q.push((tri){nx,ny,n+1});
			}
		}
		printf("%d\n",shortest==-1?-1:(h*w-shortest-blackCnt-2));
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:33: error: 'intest' was not declared in this scope; did you mean 'int8_t'?
   46 |                                 intest=n-1;
      |                                 ^~~~~~
      |                                 int8_t
Language: C++

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

using namespace std;
typedef long long LL;
const int INF=1e9;
typedef pair<int, int> P;

#define r(i,n) for(int i=0; i<n; i++)
#define R(i,n) for(int i=0; i<=n; i++)
#define r1(i,n) for(int i=1; i<n; i++)
#define R1(i,n) for(int i=1; i<=n; i++)

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

int bfs(){
    queue<P> que;

    r(i,H)r(j,W)d[i][j]=INF;

    que.push(P(1, 1));
    d[1][1]=0;

    while(queue.size()){
        P p=que.front(); que.pop();
        if(p.first==H && p.second==W)break;

        r(i,4){
            int nx=p.first+dx[i], ny=p.second+dy[i];
            if(s[nx][ny]!=INF && d[nx][ny]==INF){
                que.push(P(nx, ny));
                d[nx][ny] = d[p.first][p.second]+1;
            }
        }
    }

    return d[H][W];
}



int main(){
    cin >> H >> W;
    fill(&s[0][0],&s[52][52],INF);

    int sharp_counter=0;
    R1(i,H)R1(j,W){
        char charS;  cin >> charS;
        if(charS=='.') s[i][j]=0;
        else sharp_counter++;
    }


    int ans = H*W-dfs()-sharp_counter-1;
        cout<<ans<<endl;

    return 0;
}


Compiler output:
a.cc: In function 'int bfs()':
a.cc:30:16: error: expected unqualified-id before '.' token
   30 |     while(queue.size()){
      |                ^
a.cc: In function 'int main()':
a.cc:60:19: error: 'dfs' was not declared in this scope; did you mean 'bfs'?
   60 |     int ans = H*W-dfs()-sharp_counter-1;
      |                   ^~~
      |                   bfs
Language: C++

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

using namespace std;
typedef long long LL;
const int INF=1e9;
typedef pair<int, int> P;

#define r(i,n) for(int i=0; i<n; i++)
#define R(i,n) for(int i=0; i<=n; i++)
#define r1(i,n) for(int i=1; i<n; i++)
#define R1(i,n) for(int i=1; i<=n; i++)

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

int bfs(){
    queue<P> que;

    r(i,H)r(j,W)d[i][j]=INF;

    que.push(P(1, 1));
    d[1][1]=0;

    while(queue.size()){
        P p=que.front(); que.pop();
        if(p.first==H && p.second==W)break;

        r(i,4){
            int nx=p.first+dx[i], ny=p.second+dy[i];
            if(s[nx][ny]!=INF && d[nx][ny]==INF){
                que.push(P(nx, ny));
                d[nx][ny] = d[p.first][p.second]+1;
            }
        }
    }

    return d[H][W];
}



int main(){
    cin >> H >> W;
    fill(&s[0][0],&s[52][52],INF);

    int sharp_counter=0;
    R1(i,H)R1(j,W){
        char charS;  cin >> charS;
        if(charS=='.') s[i][j]=0;
        else sharp_counter++;
    }


    int ans = H*W-dfs()-sharp_counter-1;
        cout<<ans<<endl;
    
    return 0;
}


Compiler output:
a.cc:20:5: error: scalar object 'dx' requires one element in initializer
   20 | int dx={1,0,-1,0}, dy={0,1,0,-1};
      |     ^~
a.cc:20:20: error: scalar object 'dy' requires one element in initializer
   20 | int dx={1,0,-1,0}, dy={0,1,0,-1};
      |                    ^~
a.cc: In function 'int bfs()':
a.cc:30:16: error: expected unqualified-id before '.' token
   30 |     while(queue.size()){
      |                ^
a.cc:36:22: error: 'ny' was not declared in this scope; did you mean 'nx'?
   36 |             if(s[nx][ny]!=INF && d[nx][ny]==INF){
      |                      ^~
      |                      nx
a.cc: In function 'int main()':
a.cc:60:19: error: 'dfs' was not declared in this scope; did you mean 'bfs'?
   60 |     int ans = H*W-dfs()-sharp_counter-1;
      |                   ^~~
      |                   bfs
Language: C++

#include <iostream>
#include <vector>
#include <queue>
#define HMAX 52
#define WMAX 52

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;

ll H,W,ans;
char c[HMAX][WMAX];
bool b[HMAX][WMAX]
static const int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1};

int main(){
	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] == '.') ans++;
		}
	}
	ans -= H+W-1;
	for (int i = 0; i < H; ++i)
	{
		fill(b[i],b[i]+W,false);
	}
	queue<P> que;
	que.push(P(0,0));
	b[0][0] = 0;
	while(!que.empty()){
		P p = que.front(); que.pop();
		if(p.first == H-1 && p.second == W-1){
			cout << ans << endl;
			ans = (int)1e9;
			break;
		}
		for (int i = 0; i < 4; ++i)
		{
			if(p.first + dx[i] >= 0 && p.first + dx[i] < H && p.second + dy[i] >= 0 && p.second + dy[i] < W && !b[p.first+dx[i]][p.second+dy[i]]){
				b[p.first+dx[i]][p.second+dy[i]] = true;
				que.push(P(p.first+dx[i],p.second+dy[i]));
			}
		}
	}
	if(ans == (int)1e9){
		cout << -1 << endl;;
	}
	return 0;
}

Compiler output:
a.cc:15:1: error: expected initializer before 'static'
   15 | static const int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1};
      | ^~~~~~
a.cc:15:35: error: expected unqualified-id before ',' token
   15 | static const int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1};
      |                                   ^
a.cc:15:41: error: expected constructor, destructor, or type conversion before '=' token
   15 | static const int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1};
      |                                         ^
a.cc: In function 'int main()':
a.cc:30:22: error: 'b' was not declared in this scope
   30 |                 fill(b[i],b[i]+W,false);
      |                      ^
a.cc:34:9: error: 'b' was not declared in this scope
   34 |         b[0][0] = 0;
      |         ^
a.cc:44:38: error: 'dx' was not declared in this scope
   44 |                         if(p.first + dx[i] >= 0 && p.first + dx[i] < H && p.second + dy[i] >= 0 && p.second + dy[i] < W && !b[p.first+dx[i]][p.second+dy[i]]){
      |                                      ^~
a.cc:44:86: error: 'dy' was not declared in this scope
   44 |                         if(p.first + dx[i] >= 0 && p.first + dx[i] < H && p.second + dy[i] >= 0 && p.second + dy[i] < W && !b[p.first+dx[i]][p.second+dy[i]]){
      |                                                                                      ^~