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

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

int dh[] = {1, 0, -1, 0}, dw[] = {0, 1, 0, -1};

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

  vector<string> s(H);
  for(auto& x: s){
    cin >> x;
  }

  vector<vector<int>> dists(H, vector<int>(W, INT_MAX));
  queue<pair<int, int>> que;
  que.push(make_pair(0, 0));
  dists[0][0] = 0;

  int black_cnt = 0;
  for(const auto& ss: s){
    for(const auto& sss: ss){
      if(sss == '#'){
        black_cnt++;
      }
    }
  }
  
  while(!que.empty()){
    auto now = que.front();
    que.pop();

    int h = now.first, w = now.second;
    for(int i = 0; i < 4; i++){
      int h_ = h + dh[i], w_ = w + dw[i];
      if(h_ >= 0 && h_ < H && w_ >= 0 && w_ < W && s[h_][w_] == '.' && dists[h_][w_] > dists[h][w] + 1){
        que.push(make_pair(h_, w_));
        dists[h_][w_] = dists[h][w] + 1;
      }
    }
  }
  if(dists[H - 1][W - 1] == INT_MAX){
    cout << -1 << endl;
  }else{
    cout << H * W - black_cnt - (dists[H - 1][W - 1] + 1) << endl;
  }
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:47: error: 'INT_MAX' was not declared in this scope
   18 |   vector<vector<int>> dists(H, vector<int>(W, INT_MAX));
      |                                               ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include<queue>
  +++ |+#include <climits>
    5 | using namespace std;
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <queue>
using namespace std;
using pint = pair<int,int>;
 
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
 
int H, W;
string fi[110];
int dist[110][110]; // BFS 用
 
int main() {
  cin >> H >> W;
  int wnum = 0;
  for(int i=0; i<H; i++){
    cin >> fi[i];
    for(int j=0; j<W; j++){
      if(fi[i][j] == '.') wnum++;
    }
  }
  
  memset(dist, -1, sizeof(dist));
  dist[0][0] = 1;
  queue<pint> que;
  que.push(pint(0, 0));
  while(!que.empty()){
    pint cur = que.front();
    que.pop;
    int x = cur.first;
    int y = cur.second;
    for(int dir=0; dir<4; dir++){
      int nx = x + dx[dir];
      int ny = y + dy[dir];
      if(nx<0 || nx>=H || ny<0 || ny>=W) continue;
      if(fi[nx][ny] == '#') continue;
      if(dist[nx][ny] == -1){
        dist[nx][ny] = dist[x][y] + 1;
        que.push(pint(nx, ny));
      }
    }
  }
  
  if(dist[H-1][W-1] == -1) cout << -1 << endl;
  else cout << wnum - dist[H-1][W-1] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:9: error: invalid use of non-static member function 'void std::queue<_Tp, _Sequence>::pop() [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >]'
   32 |     que.pop;
      |     ~~~~^~~
In file included from /usr/include/c++/14/queue:66,
                 from a.cc:5:
/usr/include/c++/14/bits/stl_queue.h:316:7: note: declared here
  316 |       pop()
      |       ^~~
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <queue>
using namespace std;
using pint = pair<int,int>;
 
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
 
int H, W;
string fi[110];
int dist[110][110]; // BFS 用
 
int main() {
  cin >> H >> W;
  int wnum = 0;
  for(int i=0; i<H; i++){
    cin >> fi[i];
    for(int j=0; j<W; j++){
      if(fi[i][j] == '.') wnum++;
    }
  }
  
  memset(dist, -1, sizeof(dist));
  dist[0][0] = 1;
  queue<pint> que;
  que.push(pint(0, 0));
  while(!que.empty()){
    pint cur = que.front();
    que.pop;
    int x = cur.first;
    int y = cur.second;
    for(int dir=0; dir<4; dur++){
      int nx = x + dx[dir];
      int ny = y + dy[dir];
      if(nx<0 || nx>=H || ny<0 || ny>=W) continue;
      if(fi[nx][ny] == '#') continue;
      if(dist[nx][ny] == -1){
        dist[nx][ny] = dist[x][y] + 1;
        que.push(pint(nx, ny));
      }
    }
  }
  
  if(dist[H-1][W-1] == -1) cout << -1 << endl;
  else cout << wnum - dist[H-1][W-1] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:9: error: invalid use of non-static member function 'void std::queue<_Tp, _Sequence>::pop() [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >]'
   32 |     que.pop;
      |     ~~~~^~~
In file included from /usr/include/c++/14/queue:66,
                 from a.cc:5:
/usr/include/c++/14/bits/stl_queue.h:316:7: note: declared here
  316 |       pop()
      |       ^~~
a.cc:35:27: error: 'dur' was not declared in this scope; did you mean 'dir'?
   35 |     for(int dir=0; dir<4; dur++){
      |                           ^~~
      |                           dir
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <queue>
using namespace std;
using pint = pair<int,int>;

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

int H, W;
string fi[110];
int dist[110][110]; // BFS 用

int main() {
  cin >> H >> W;
  int wnum = 0;
  for(int i=0; i<H; i++){
    cin >> fi[i];
    for(int j=0; j<W; j++){
      if(fi[i][j] == '.') wnum++;
    }
  }
  
  memset(dist, -1, sizeof(dist));
  dist[0][0] = 1;
  queue<pint> que;
  que.push(pint(0, 0));
  while(!que.empty()){
    pint cur = que.front;
    que.pop;
    int x = cur.first;
    int y = cur.second;
    for(int dir=0; dir<4; dur++){
      int nx = x + dx[dir];
      int ny = y + dy[dir];
      if(nx<0 || nx>=H || ny<0 || ny>=W) continue;
      if(fi[nx][ny] == '#') continue;
      if(dist[nx][ny] == -1){
        dist[nx][ny] = dist[x][y] + 1;
        que.push(pint(nx, ny));
      }
    }
  }
  
  if(dist[H-1][W-1] == -1) cout << -1 << endl;
  else cout << wnum - dist[H-1][W-1] << endl;
}
      
  

Compiler output:
a.cc: In function 'int main()':
a.cc:31:20: error: conversion from '<unresolved overloaded function type>' to non-scalar type 'pint' {aka 'std::pair<int, int>'} requested
   31 |     pint cur = que.front;
      |                ~~~~^~~~~
a.cc:32:9: error: invalid use of non-static member function 'void std::queue<_Tp, _Sequence>::pop() [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >]'
   32 |     que.pop;
      |     ~~~~^~~
In file included from /usr/include/c++/14/queue:66,
                 from a.cc:5:
/usr/include/c++/14/bits/stl_queue.h:316:7: note: declared here
  316 |       pop()
      |       ^~~
a.cc:35:27: error: 'dur' was not declared in this scope; did you mean 'dir'?
   35 |     for(int dir=0; dir<4; dur++){
      |                           ^~~
      |                           dir
Language: C++

#bfs
def bfs(s,sx,sy,gx,gy):
    from collections import deque
    inf = float("inf")
    dx = [1,0,-1,0]
    dy = [0,1,0,-1]
    d = [[inf for _ in  range(w)] for _ in  range(h)]
    que = deque()
    que.append([sx,sy])
    d[sx][sy] = 1
    while que:
        p = que.popleft()
        if p[0] == gx and p[1] == gy:
            break
        for i in range(4):
            nx = p[0] + dx[i]
            ny = p[1] + dy[i]
            if 0 <= nx < h and 0 <= ny < w and s[nx][ny] == '.' and d[nx][ny] == inf:
                que.append([nx,ny])
                d[nx][ny] = d[p[0]][p[1]] + 1
    return d[gx][gy]

h,w = map(int,input().split())
s = [list(input()) for _ in range(h)]

cnt = 0
for i in s:
    for j in i:
        if j == ".":
            cnt+=1

print(cnt - bfs(s,0,0,h - 1,w - 1))

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #bfs
    1 | #bfs
      |  ^~~
a.cc:2:1: error: 'def' does not name a type
    2 | def bfs(s,sx,sy,gx,gy):
      | ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, n) for(int i = 1; i < n; i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define P pair<int, int>
#define 
const int dx4[4] = {1,0,-1,0};
const int dy4[4] = {0,1,0,-1};
const int dx8[8] = {-1,0,1,1,1,0,-1,-1};
const int dy8[8] = {1,1,1,0,-1,-1,-1,0};
typedef long long ll;
const int mod = 1e9+7;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int h, w;
  cin >> h >> w;
  vector<string> field(h);
  rep(i,h) cin >> field[i];
  vector<vector<int>> dis(h, vector<int>(w, -1));
  dis[0][0] = 0;
  queue<P> que;
  que.push(make_pair(0,0));
  while(!que.empty()){
    int vy = que.front().first;
    int vx = que.front().second;
    que.pop();
    rep(i,4){
      int ny = vy + dy4[i];
      int nx = vx + dx4[i];
      if(ny < 0 || ny >= h || nx < 0 || nx >= w) continue;
      if(dis[ny][nx] == -1 && field[ny][nx] == '.'){
        dis[ny][nx] = dis[vy][vx] + 1;
        que.push(make_pair(ny, nx));
      }
    }
  }
  int ans = h*w - (dis[h-1][w-1] + 1);
  int bluck = 0;
  rep(i,h)rep(j,w){
    if(field[i][j] == '#') bluck++;
  }
  ans -= bluck;
  if(dis[h-1][w-1] == -1) cout << -1 << endl;
  else cout << ans << endl;
}

Compiler output:
a.cc:8:9: error: no macro name given in #define directive
    8 | #define
      |         ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<ll, ll> P;
 
const ll MOD = 1e9 + 7;
const ll inf = 1LL<<60;
const int int_inf = 100000000;
const double eps = 1e-9;
 
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
int score[50][50] = {};
bool visited[50][50] = {false};
 
int main()
{
    int h, w, cnt = 0;
    cin >> h >> w;
 
    char grid[h][w];
 
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> grid[i][j];
            if (grid[i][j] == '#') cnt++;
        }
    }
    
    score[0][0] = 1;
 
    queue< pair<int, int> > que;
    que.push(make_pair(0, 0));
 
    while (!que.empty()) {
        auto now = que.front();
        que.pop();
 
        int now_x = now.first;
        int now_y = now.second;
 
        for (int i = 0; i < 4; i++) {
            int nx = now_x + dx[i];
            int ny = now_y + dy[i];
 
            if (nx < 0 or nx >= h or ny < 0 or ny >= w) continue;
            if (grid[nx][ny] == '#') continue;
            if (!visited[nx][ny]) {
                score[nx][ny] = score[now_x][now_y] + 1;
                que.push(make_pair(nx, ny));
                visited[nx][nw] = true;
            }
        }
    }
 
    if (!visited[h-1][w-1]) cout << -1 << endl;
    else cout << h * w - cnt - score[h-1][w-1] << endl;
 
    return 0;
}
 

Compiler output:
a.cc: In function 'int main()':
a.cc:56:29: error: 'nw' was not declared in this scope; did you mean 'ny'?
   56 |                 visited[nx][nw] = true;
      |                             ^~
      |                             ny
Language: C++

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


#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()

//#define int long long

#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second

#define mod 1000000007

template <typename T>
void print(T x)
{
	std::cout << x <<" " ;
}


template <typename T>
void println(T x)
{
	std::cout << x << "\n";
}

int h, w;
char a[50][50];
typedef pair<int, int>point;
typedef pair<point, int>ppl;

queue < ppl >que;

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

int bfs(point s,point g) {
	que.push(ppl(s,0));

	while (!que.empty()) {
		int x = que.front().first.first;
		int y = que.front().first.second;
		int dist = que.front().second;
		//cout << "x=" << x << "y=" << y << endl;
		que.pop();
		if (point(x, y) == g)return dist;
		rep(i, 4) {
			int nx = x + dx[i];
			int ny = y + dy[i];
			if (nx < 0 || h <= nx)continue;
			if (ny < 0 || w <= ny)continue;
			if (a[nx][ny] == '.') {
				que.push(ppl(point(nx, ny),dist+1));
				a[nx][ny] = '#';
			}
		}
	}
}

unsigned main(void){
	cin >> h >> w;
	int count = 0;
	rep(i, h)rep(j, w) {
		cin >> a[i][j];
		if (a[i][j] == '.')count++;
	}
	int ans = bfs(point(0,0),point(h-1,w-1));
	print(ans);
	print(count - ans - 1);
}

Compiler output:
cc1plus: error: '::main' must return 'int'
a.cc: In function 'int bfs(point, point)':
a.cc:68:1: warning: control reaches end of non-void function [-Wreturn-type]
   68 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())
#define endl "\n"

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
void initialize( void );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;
template <typename T, typename K> struct P {
	T a; K b;
};
typedef P <int, int> Pii;
int main( void ){
	// initialize();
	int H, W;
	cin >> H >> W;
	vector <vector <P <int, bool> > > maze( H, vector <P <int, bool> >( W, P <int, bool>{-1, false} ));
	int cnt = 0;
	rep( i, 0, H ){
		rep( j, 0, W ){
			char s; cin >> s;
			maze[ i ][ j ].b = ( s == '.' );
			if (maze[ i ][ j ].b)
				cnt++;
		}
	}
	maze[ 0 ][ 0 ].a = 1;
	is_in_que[ 0 ][ 0 ] = true;
	queue <Pii> q;
	q.push( Pii{0, 0} );
	while(!q.empty()){
		const int vect[ 4 ][ 2 ] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1} };
		int dist = maze[ q.front().a ][ q.front().b ].a + 1;
		rep( i, 0, 4 ){
			int x = q.front().a + vect[ i ][ 0 ], y = q.front().b + vect[ i ][ 1 ];
			if (y < 0 || x < 0 || x == H || y == W ){
				continue;
			}
			if (!maze[ x ][ y ].b){
				continue;
			}
			if (maze[ x ][ y ].a == -1){
				maze[ x ][ y ].a = dist;
				q.push( Pii{x, y} );
				maze[ x ][ y ].b = false;
			}
		}
		q.pop();
	}
	int ans = cnt - maze[ H - 1 ][ W - 1 ].a;
	if (maze[ H - 1 ][ W - 1 ].a == -1)
		ans = -1;
	cout << ans << endl;
}

template <class T> bool chmax( T& a, T b ) {
	if (a < b){
		a = b; return true;
	}
	return false;
}
template <class T> bool chmin( T& a, T b ) {
	if (a > b){
		a = b; return true;
	}
	return false;
}
int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}
void initialize( void ){
	cout << fixed << setprecision( 10 );
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:9: error: 'is_in_que' was not declared in this scope
   38 |         is_in_que[ 0 ][ 0 ] = true;
      |         ^~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;

int main() {
  int h,w;
  cin>>h>>w;
  char s[h][w];
  int black=0;
  int ans[h][w];
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++) {
      cin>>s[i][j];
      ans[i][j]=-1;
      if(s[i][j]=='#') black++;
    }
  }
  if(s[0][0]=='#') {
    cout<<-1<<endl;
    return 0;
  }
  ans[0][0]=0;
  queue<int> memo;
  memo.push(0);memo.push(0);
  while(!memo.empty()){
    int y=memo.front();memo.pop;
    int x=memo.front();memo.pop();
    int dy[4]={0,1,0,-1},dx[4]={1,0,-1,0};
    for(int i=0;i<4;i++){
      int ny=y+dy[i],nx=x+dx[i];
      if(ny<0 || ny>=h || nx<0 || nx>=w || s[ny][nx]=='#') continue;
      if(ans[ny][nx]!=-1) continue;
      ans[ny][nx]=ans[y][x]+1;
      memo.push(ny);memo.push(nx);
    }
  }
  if(ans[h-1][w-1]==-1) cout<<-1<<endl;
  else cout<<h*w-1-ans[h-1][w-1]-black<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:29: error: invalid use of non-static member function 'void std::queue<_Tp, _Sequence>::pop() [with _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]'
   27 |     int y=memo.front();memo.pop;
      |                        ~~~~~^~~
In file included from /usr/include/c++/14/queue:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:157,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_queue.h:316:7: note: declared here
  316 |       pop()
      |       ^~~
Language: C++

#include <iostream>
#include <queue>
#include <string>
#include <vector>

using namespace std;

class PInfo{
  public:
  	int steps;
  	int x;
  	int y;
  	PInfo(int s, int x, int y) : steps(s), x(x), y(y) {};
};

int main(){
  int H, W, wcounts = 0;
  string tmp;
  cin >> H >> W;
  
  vector<string> grid;
  vector<vector<bool>> visited;
  for (int i=0; i<H; i++){
    cin >> tmp;
    grid.emplace_back(tmp);
    wcounts += count(tmp.begin(), tmp.end(), '.');
    
    visited.emplace_back(vector<bool>(W, false));
  }
  queue<PInfo> Q;
  Q.emplace(PInfo(0, 0, 0));
  bool flag = false;
  while (!Q.empty()){
    PInfo e = Q.front();
    Q.pop();
    if (visited[e.y][e.x] || grid[e.x][e.y] == '#') continue;
    if (e.x == W - 1 && e.y == H - 1){
      flag = true;
      wcounts -= e.steps;
      break;
    }
    
    if (e.x > 0) Q.emplace(PInfo(e.steps + 1, e.x - 1, e.y));
    if (e.x < W - 1) Q.emplace(PInfo(e.steps + 1, e.x + 1, e.y));
    if (e.y > 0) Q.emplace(PInfo(e.steps + 1, e.x, e.y - 1));
    if (e.y < H - 1) Q.emplace(PInfo(e.steps + 1, e.x, e.y + 1));
  }
  
  if (!flag){
    cout << -1 << endl;
  }
  else{
    cout << wcounts << endl;
  }
  return 0;
}
                           
    
  
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:26:16: error: 'count' was not declared in this scope; did you mean 'wcounts'?
   26 |     wcounts += count(tmp.begin(), tmp.end(), '.');
      |                ^~~~~
      |                wcounts
Language: C++

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

string s[55];
int h, w, a[55][55], v[55][55];

int main()
{
    cin >> h >> w;
    int b = 0;
    for (int i = 0; i < h; ++i)
        cin >> s[i];

    for (int i = 0; i < h; ++i)
        for (int j = 0; j < w; ++j)
            v[i][j] = -1;
    dfs(0, 0);

    queue<pair<int, int>> q;

    q.push({0, 0});

    while (!q.empty())
    {
        auto t = q.front();
        q.pop();
        int dx[] = {-1, 0, 0, 1},
            dy[] = {0, 1, -1, 0};
        for (int k = 0; k < 4; ++k)
        {
            int xx = t.first + dx[k],
                yy = t.second + dy[k];
            if (0 <= xx && xx < w && 0 <= yy && yy < h && s[yy][xx] == '.' && v[yy][xx] == -1)
            {
                v[yy][xx] = v[t.second][t.first] + 1;
                q.push({xx, yy});
            }
        }
    }

    if (v[h - 1][w - 1] == -1)
        return cout << -1 << endl, 0;

    for (int i = 0; i < h; ++i)
        for (int j = 0; j < w; ++j)
            b += (s[i][j] == '#');
    cout << h * w - b - v[h - 1][w - 1] << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:5: error: 'dfs' was not declared in this scope
   19 |     dfs(0, 0);
      |     ^~~
Language: C++

#include<bits/stdc++.h>

using namespace std;

typedef pair<<int,int>> P;

int H,W;
char s[50][51];

int d[50][50];

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

int bfs(){
  queue<P> que;

  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      d[i][j] = 100000;
    }
  }

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

  while(que.size()){
    P p = que.front();
    que.pop();
    if(p.first == H - 1 && p.second == W - 1) break;
    for(int i = 0; i < 4; i++){
        int nx = p.first + dx[i];
        int ny = p.second + dy[i];

        if(0 <= nx && nx < H && 0 <= ny && ny < W && s[nx][ny] != '#' && d[nx][ny] > 1000){
          que.push(P(nx,ny));
          d[nx][ny] = d[p.first][p.second] + 1;
        }
    }
  }

  return d[H - 1][W - 1];
}

int main(){
  cin >> H >> W;
  for(int i = 0; i < H; i++) cin >> s[i];
  int ans = H * W;

  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      if(s[i][j] == '#') ans--;
    }
  }

  int dis = bfs();

  if(dis > 100){
    cout << -1 << endl;
  }

  ans -= dis;

  cout << ans << endl;

  return 0;
}

Compiler output:
a.cc:5:13: error: expected unqualified-id before '<<' token
    5 | typedef pair<<int,int>> P;
      |             ^~
a.cc: In function 'int bfs()':
a.cc:16:9: error: 'P' was not declared in this scope
   16 |   queue<P> que;
      |         ^
a.cc:16:10: error: template argument 1 is invalid
   16 |   queue<P> que;
      |          ^
a.cc:16:10: error: template argument 2 is invalid
a.cc:24:7: error: request for member 'push' in 'que', which is of non-class type 'int'
   24 |   que.push(P(0,0));
      |       ^~~~
a.cc:27:13: error: request for member 'size' in 'que', which is of non-class type 'int'
   27 |   while(que.size()){
      |             ^~~~
a.cc:28:6: error: expected ';' before 'p'
   28 |     P p = que.front();
      |      ^~
      |      ;
a.cc:29:9: error: request for member 'pop' in 'que', which is of non-class type 'int'
   29 |     que.pop();
      |         ^~~
a.cc:30:8: error: 'p' was not declared in this scope
   30 |     if(p.first == H - 1 && p.second == W - 1) break;
      |        ^
a.cc:32:18: error: 'p' was not declared in this scope
   32 |         int nx = p.first + dx[i];
      |                  ^
a.cc:36:15: error: request for member 'push' in 'que', which is of non-class type 'int'
   36 |           que.push(P(nx,ny));
      |               ^~~~
Language: C++

#include<iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include<vecter>
#include<queue>
using namespace std;
using pint = pair<int,int>;

int dx[4]={0,-1,0,1};
int dy[4]={-1,0,1,0};
int H, W;
string fi[110];
int dist[110][110]; 

int main() {
    cin >> H >> W;
    int nyann = 0;
    for (int i = 0; i < H; ++i) {
        cin >> fi[i];
        for (int j = 0; j < W; ++j) {
            if (fi[i][j] == '.') ++nyann;
        }
    }

    memset(dist, -1, sizeof(dist));
    dist[0][0] = 1;
    queue<pint> que;
    que.push(pint(0, 0));
    while (!que.empty()) {
        pint c = que.front();
        que.pop();
        int x = c.first;
        int y = c.second;
        for (int dir = 0; dir < 4; ++dir) {
            int nx = x + dx[dir];
            int ny = y + dy[dir];
            if (nx < 0 || nx >= H || ny < 0 || ny >= W) continue;
            if (fi[nx][ny] == '#') continue;
            if (dist[nx][ny] == -1) {
                dist[nx][ny] = dist[x][y] + 1;
                que.push(pint(nx, ny));
            }
        }
    }
    if (dist[H-1][W-1] == -1) cout << -1 << endl;
    else  cout << nyann - dist[H-1][W-1] << endl;
}

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

#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const double PI=3.14159265358979323846;
const int64_t waru = 1000000007;
const in INF=1<<30;
#define vec2(a,y,x) vector<vector<char>> a(y,vector<char>(x))
#define vec1(a,n) vector<int> a(n);rep(i,n)cin>>a[i]

vector<int> ta={1,0,-1,0};
vector<int> su={0,1,0,-1};
using p=pair<int,int>;

int main(){
  int h,w,x,y,nx,ny;
  cin>>h>>w;
  vec2(a,h,w);
  rep(i,h)rep(j,w) cin>>a[i][j];
  int count_black=0;
  rep(i,h)rep(j,w){if(a[i][j]=='#') count_black ++;}
  vector<vector<int>> seen(h,vector<int>(w,0));
  
  int sx=1,sy=1;
  queue<p> bfs;
  p.push(p(sy,sx));
  
  while(!bfs.empty()){
     y=bfs.front().first;
     x=bfs.front().second;
     
     rep(i,4){
        ny=y+ta[i];nx=x+su[i];
        if(nx<0||ny<0||nx>=w||ny>=h) continue;
        if(nx==sx && ny==sy) continue;
        if(seen[ny][nx]!=0) continue;
        if(a[ny][nx]=='#') continue;
        seen[ny][nx] =seen[y][x]+1;
        bfs.push(p(ny,nx));
     }
  }
  int ans =h*w-count_black-seen[h-1][w-1]-1;
  cout<<ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:4: error: expected unqualified-id before '.' token
   28 |   p.push(p(sy,sx));
      |    ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const double PI=3.14159265358979323846;
const int64_t waru = 1000000007;
const in INF=1<<30;
#define vec2(a,y,x) vector<vector<char>> a(y,vector<char>(x))
#define vec1(a,n) vector<int> a(n);rep(i,n)cin>>a[i]

vector<int> ta={1,0,-1,0};
vector<int> su={0,1,0,-1};
using p=pair<int,int>

int main(){
  int h,w,x,y,nx,ny;
  cin>>h>>w;
  vec2(a,h,w);
  rep(i,h)rep(j,w) cin>>a[i][j];
  int count_black=0;
  rep(i,h)rep(j,w){if(a[i][j]=='#') count_black ++;}
  vector<vector<int>> seen(h,vector<int>(w,0));
  
  int sx=1,sy=1;
  queue<p> bfs;
  p.push(p(sy,sx));
  
  while(!bfs.empty()){
     y=bfs.front().first;
     x=bfs.front().second;
     
     rep(i,4){
        ny=y+ta[i];nx=x+su[i];
        if(nx<0||ny<0||nx>=w||ny>=h) continue;
        if(nx==sx && ny==sy) continue;
        if(seen[ny][nx]!=0) continue;
        if(a[ny][nx]=='#') continue;
        seen[ny][nx] =seen[y][x]+1;
        bfs.push(p(ny,nx));
     }
  }
  int ans =h*w-count_black-seen[h-1][w-1]-1;
  cout<<ans;
}

Compiler output:
a.cc:15:9: error: two or more data types in declaration of 'type name'
   15 | using p=pair<int,int>
      |         ^~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll h,w;
  cin>>h>>w;
  vvc t(h,vc(w));
  ll k=0;
  rep(i,h){
    rep(j,w){
      cin>>c[i][j];
      if(c[i][j]=='.') k++;
    }
  }
  
  vvll a(h,vll(w,INF));
  queue<pll> p;
  p.pu(pll(0,0));
  a[0][0]=0;
  while(p.size()){
    pll pp=p.front();
    p.pop();
    if(pp.F==h-1&&pp.S==w-1) break;
    rep(i,4){
      ll nx=dx[i]+pp.F;
      ll ny=dy[i]+pp.S;
      if(nx>=0&&nx<h&&ny>=0&&ny<w&&t[nx][ny]!='#'&&a[nx][ny]==INF){
        a[nx][ny]=a[pp.F][pp.S]+1;
        p.pu(pll(pp.F,pp.S));
      }
    }
  }
  if(a[h-1][w-1]==INF)COUT(-1);
  else{
    COUT(k-a[h-1][w-1]);
  }
}
    


Compiler output:
a.cc: In function 'int main()':
a.cc:47:12: error: 'c' was not declared in this scope
   47 |       cin>>c[i][j];
      |            ^
Language: C++

#include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll h,w;
  cin>>h>>w;
  vvc t(h,vc(w));
  ll k=0;
  rep(i,h){
    rep(j,w){
      cin>>c[i][j];
      if(c[i][j]=='.') k++;
    }
  }
  
  vvll a(h,vll(w,INF));
  queue<pll> p;
  p.pu(pll(0,0));
  a[0][0]=0;
  while(p.size()){
    pll pp=p.front();
    p.pop();
    if(pp.F==h-1&&pp.S==w-1) break;
    rep(i,4){
      ll nx=dx[i]+pp.F;
      ll ny=dy[i]+pp.S;
      if(nx>=0&&nx<h&&ny>=0&&ny<w&&c[nx][ny]!='#'&&a[nx][ny]==INF){
        a[nx][ny]=a[pp.F][pp.S]+1;
        p.pu(pll(pp.F,pp.S));
      }
    }
  }
  if(a[h-1][w-1]==INF)COUT(-1);
  else{
    COUT(k-a[h-1][w-1]);
  }
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:47:12: error: 'c' was not declared in this scope
   47 |       cin>>c[i][j];
      |            ^
a.cc:63:36: error: 'c' was not declared in this scope
   63 |       if(nx>=0&&nx<h&&ny>=0&&ny<w&&c[nx][ny]!='#'&&a[nx][ny]==INF){
      |                                    ^
Language: C++

#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <complex>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <valarray>

using namespace std;


main()
{
    int h,w; cin>>h>>w;
    vector<string> s(h);
    for(auto &ss:s) cin>>ss;
    queue<tuple<int,int,int>> que;
    que.emplace(0,0,1);
    int ans=1e9;
    bool is[55][55]={};
    is[0][0]=1;
    for(auto &r:s)
    {
        for(auto &e:r)
        {
            if(e!='.') is[0][0]=1;
        }
    }
    while(!que.empty())
    {
        int x,y,d; tie(x,y,d)=que.front();
        que.pop();
        if(x==h-1 && y==w-1) ans=d;
        int dx[]={1,0,-1,0};
        int dy[]={0,1,0,-1};
        for(int i=0;i<4;++i)
        {
            int xx=x+dx[i];
            int yy=y+dy[i];
            if(size_t(xx)<h and size_t(yy)<w and !is[xx][yy])
            {
                is[xx][yy]=1;
                que.emplace(xx,yy,d+1);
            }
        }
    }
    if(ans==INT_MAX)
    {
        cout << -1 << "\n";
    }
    else
    {
        int w{};
        for(auto &r:s)
        {
            for(auto &e:r)
            {
                if(e=='.') w++;
            }
        }
        cout << w-ans << "\n";
    }
}


Compiler output:
a.cc:23:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   23 | main()
      | ^~~~
a.cc: In function 'int main()':
a.cc:58:13: error: 'INT_MAX' was not declared in this scope
   58 |     if(ans==INT_MAX)
      |             ^~~~~~~
a.cc:19:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   18 | #include <valarray>
  +++ |+#include <climits>
   19 |
Language: C++

#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <complex>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <valarray>

using namespace std;


main()
{
    int h,w; cin>>h>>w;
    vector<string> s(h);
    for(auto &ss:s) cin>>ss;
    queue<tuple<int,int,int>> que;
    que.emplace(0,0,1);
    int ans=INT_MAX;
    bool is[55][55]={};
    is[0][0]=1;
    for(auto &r:s)
    {
        for(auto &e:r)
        {
            if(e!='.') is[0][0]=1;
        }
    }
    while(!que.empty())
    {
        int x,y,d; tie(x,y,d)=que.front();
        que.pop();
        if(x==h-1 && y==w-1) ans=d;
        int dx[]={1,0,-1,0};
        int dy[]={0,1,0,-1};
        for(int i=0;i<4;++i)
        {
            int xx=x+dx[i];
            int yy=y+dy[i];
            if(size_t(xx)<h and size_t(yy)<w and !is[xx][yy])
            {
                is[xx][yy]=1;
                que.emplace(xx,yy,d+1);
            }
        }
    }
    if(ans==INT_MAX)
    {
        cout << -1 << "\n";
    }
    else
    {
        int w{};
        for(auto &r:s)
        {
            for(auto &e:r)
            {
                if(e=='.') w++;
            }
        }
        cout << w-ans << "\n";
    }
}

Compiler output:
a.cc:23:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   23 | main()
      | ^~~~
a.cc: In function 'int main()':
a.cc:30:13: error: 'INT_MAX' was not declared in this scope
   30 |     int ans=INT_MAX;
      |             ^~~~~~~
a.cc:19:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   18 | #include <valarray>
  +++ |+#include <climits>
   19 |
Language: C++

//写経 dfsやらんとな
int H, W;
string B[50];
int dx[4] = { 0, 1, 0, -1 }, dy[4] = { -1, 0, 1, 0 };
//---------------------------------------------------------------------------------------------------
int vis[55][55];
int dp[55][55];
int check() {
    queue<pair<int, int>> que;
    que.push({ 0, 0 });
    vis[0][0] = 1;
    while (!que.empty()) {
        auto q = que.front(); que.pop();
        int x, y;
        tie(x, y) = q;
 
        if (x == W - 1 and y == H - 1) return dp[y][x];
 
        rep(d, 0, 4) {
            int xx = x + dx[d];
            int yy = y + dy[d];
            if (0 <= xx and xx < W and 0 <= yy and yy < H) {
                if (B[yy][xx] == '.' and vis[yy][xx] == 0) {
                    vis[yy][xx] = 1;
                    dp[yy][xx] = dp[y][x] + 1;
                    que.push({ xx, yy });
                }
            }
        }
    }
 
    return 0;
}
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> H >> W;
    rep(y, 0, H) cin >> B[y];
 
    int ans, res = check();
    if (!res) ans = -1;
    else {
        ans = H * W - res - 1;
        rep(y, 0, H) rep(x, 0, W) if (B[y][x] == '#') ans--;
    }
 
    printf("%d\n", ans);
}


Compiler output:
a.cc:3:1: error: 'string' does not name a type
    3 | string B[50];
      | ^~~~~~
a.cc: In function 'int check()':
a.cc:9:5: error: 'queue' was not declared in this scope
    9 |     queue<pair<int, int>> que;
      |     ^~~~~
a.cc:9:11: error: 'pair' was not declared in this scope
    9 |     queue<pair<int, int>> que;
      |           ^~~~
a.cc:9:16: error: expected primary-expression before 'int'
    9 |     queue<pair<int, int>> que;
      |                ^~~
a.cc:10:5: error: 'que' was not declared in this scope
   10 |     que.push({ 0, 0 });
      |     ^~~
a.cc:15:9: error: 'tie' was not declared in this scope
   15 |         tie(x, y) = q;
      |         ^~~
a.cc:19:13: error: 'd' was not declared in this scope
   19 |         rep(d, 0, 4) {
      |             ^
a.cc:19:9: error: 'rep' was not declared in this scope
   19 |         rep(d, 0, 4) {
      |         ^~~
a.cc: In function 'void _main()':
a.cc:36:5: error: 'cin' was not declared in this scope
   36 |     cin >> H >> W;
      |     ^~~
a.cc:37:9: error: 'y' was not declared in this scope; did you mean 'dy'?
   37 |     rep(y, 0, H) cin >> B[y];
      |         ^
      |         dy
a.cc:37:5: error: 'rep' was not declared in this scope
   37 |     rep(y, 0, H) cin >> B[y];
      |     ^~~
a.cc:46:5: error: 'printf' was not declared in this scope
   46 |     printf("%d\n", ans);
      |     ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | //写経 dfsやらんとな
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
#define vector2(a,b,c) vector<vector<char>> a(b/*縦！w*/,vector<char>(c/*横！w*/))
#define INF 1e10
#define MOD 1e9+7
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;
int a,b;
vector2(c,a,b);
bool dfs(int m,int n){
  if(m<0||n<0||a<=m||b<=n||int[m][n]=='#')
    return false;
  if(m==a-1&&n==b-1)
    return true;
  if(dfs(m-1,n)==true||dfs(m+1,n)==true||dfs(m,n+1)==true||dfs(m,n-1)==true)
    return true;
}
signed main(){
  cin>>a>>b;
  rep(i,a)rep(j,b)
    cin>>c[i][j];
  if(dfs(0,0))
    cout<<"ok"<<endl;
  else
    cout<<"NG"<<endl;
}

Compiler output:
a.cc: In function 'bool dfs(long long int, long long int)':
a.cc:3:13: error: expected primary-expression before 'long'
    3 | #define int long long
      |             ^~~~
a.cc:20:28: note: in expansion of macro 'int'
   20 |   if(m<0||n<0||a<=m||b<=n||int[m][n]=='#')
      |                            ^~~
a.cc:20:28: error: expected ')' before 'long'
   20 |   if(m<0||n<0||a<=m||b<=n||int[m][n]=='#')
      |     ~                      ^
      |                            )
a.cc:26:1: warning: control reaches end of non-void function [-Wreturn-type]
   26 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<P,ll> PPI;
#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll
#define INF 1e16
#define mod 1000000007
ll h,w,x,y;
int main(){
    cin>>h>>w;
    char s[h+1][w+1];
    bool vis[h+1][w+1];
    ll tmp = 0;
    memset(vis,0,sizeof(vis));
    rep(i,h)rep(j,w) {
        cin>>s[i][j];
        if(s[i][j]=='.') tmp++;
    }
    queue<PPI> que;
    que.push(PPI(P(0,0),0));
    ll dd[5] = {1,0,-1,0,1};
    ll ans = INF;
    s[0][0] = '#';
    while(!que.empty()){
        PPI p = que.top();que.pop();
        if(p.fi.se == h-1 and p.fi.fi == w-1){
                minch(ans,p.se);
        }
        rep(i,4){
            y = p.fi.fi + dd[i+1];
            x = p.fi.se + dd[i];
            if(0<=y and y < h and 0<=x and x < w and  s[y][x]=='.'){
                s[y][x] = '#';
                que.push(PPI(P(y,x),p.se+1));
            }
        }
    }
    if(ans == INF) cout<<-1<<endl;
    else cout<<tmp - ans-1<<endl;
return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:21: error: 'class std::queue<std::pair<std::pair<long long int, long long int>, long long int> >' has no member named 'top'; did you mean 'pop'?
   39 |         PPI p = que.top();que.pop();
      |                     ^~~
      |                     pop
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<P,ll> PPI;
#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll
#define INF 1e16
#define mod 1000000007
ll h,w,x,y;
int main(){
    cin>>h>>w;
    char s[h+1][w+1];
    bool vis[h+1][w+1];
    ll tmp = 0;
    memset(vis,0,sizeof(vis));
    rep(i,h)rep(j,w) {
        cin>>s[i][j];
        if(s[i][j]=='.') tmp++;
    }
    priority_queue<PPI> que;
    que.push(PPI(P(0,0),0));
    ll dd[5] = {1,0,-1,0,1};
    ll ans = INF;
    s[i][j] = '#';
    while(!que.empty()){
        PPI p = que.top();que.pop();
        if(p.fi.se == h-1 and p.fi.fi == w-1){
                minch(ans,p.se);
        }
        rep(i,4){
            y = p.fi.se + dd[i+1];
            x = p.fi.fi + dd[i];
            if(0<=y and y < h and 0<=x and x < w and  s[y][x]=='.'){
                s[y][x] = '#';
                que.push(PPI(P(x,y),p.se+1));
            }
        }
    }
    if(ans == INF) cout<<-1<<endl;
    else cout<<tmp - ans-1<<endl;
return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:7: error: 'i' was not declared in this scope
   37 |     s[i][j] = '#';
      |       ^
a.cc:37:10: error: 'j' was not declared in this scope
   37 |     s[i][j] = '#';
      |          ^
Language: C++

#include"bits/stdc++.h"
using namespace std;
int dy[4]={0,1,0,-1},dx[4]={1,0,-1,0};
int H,W,ans=0;
char maze[52][52];
int dist[52][52];
queue<pair<int,int>> que;
int main()
{
  cin >> H >> W;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin >> maze[i][j];
      dist[i][j] = -1;
      if(maze[i][j]=='.')
        ans++;
    }
  }
  dist[0][0] = 0;
  que.push(make_pair(0,0));
  while(!que.empty()){
    int cy=que.front().first,cx=que.front().second;
    que.pop();
    if(cy==H-1&&cx==W-1){
      ans -= dist[cy][cx];
      cout << ans << "\n";
      return 0;
    }
    for(int i=0;i<4;i++){
      int ny=cy+dy[i],nx=cx+dx[i];
      if(ny<0||H<=ny||nx<0||W<=nx||maze[ny][nx]=='#')
        continue;
      dist[ny][nx]=dist[cy][cx]+1;
      que.push(make_pair(ny,nx));
  }
  cout << "-1\n";
}


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

#include"bits/stdc++.h"
using namespace std;
int dy[4]={0,1,0,-1},dx[4]={1,0,-1,0};
int H,W,ans=0;
char maze[52][52];
int dist[52][52];
queue<pair<int,int>> que;
int main()
{
  cin >> H >> W;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin >> maze[i][j];
      dist[i][j] = -1;
      if(maze[i][j]=='\.')
        ans++;
    }
  }
  dist[0][0] = 0;
  que.push(make_pair(0,0));
  while(!que.empty()){
    int cy=que.front().first,cx=que.front().second;
    que.pop();
    if(cy==H-1&&cx==W-1){
      ans -= dist[cy][cx];
      cout << ans << "\n";
      return 0;
    }
    for(int i=0;i<4;i++){
      int ny=cy+dy[i],nx=cx+dx[i];
      if(ny<0||H<=ny||nx<0||W<=nx||maze[ny][nx]=='\#')
        continue;
      dist[ny][nx]=dist[cy][cx]+1;
      que.push(make_pair(ny,nx));
  }
  cout << "-1\n";
}


Compiler output:
a.cc:15:22: warning: unknown escape sequence: '\.'
   15 |       if(maze[i][j]=='\.')
      |                      ^~~~
a.cc:31:50: warning: unknown escape sequence: '\#'
   31 |       if(ny<0||H<=ny||nx<0||W<=nx||maze[ny][nx]=='\#')
      |                                                  ^~~~
a.cc: In function 'int main()':
a.cc:37:2: error: expected '}' at end of input
   37 | }
      |  ^
a.cc:9:1: note: to match this '{'
    9 | {
      | ^
Language: C++

#include"bits/stdc++.h"
using namespace std;
int dy[4]={0,1,0,-1},dx[4]={1,0,-1,0};
int H,W,ans=0;
char maze[52][52];
int dist[52][52];
queue<pair<int,int>> que;
int main()
{
  cin >> H >> W;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin >> maze[i][j];
      dist[i][j] = -1;
      if(maze[i][j]==".")
        ans++;
    }
  }
  dist[0][0] = 0;
  que.push(make_pair(0,0));
  while(!que.empty()){
    int cy=que.front().first,cx=que.front().second;
    que.pop();
    if(cy==H-1&&cx==W-1){
      ans -= dist[cy][cx];
      cout << ans << "\n";
      return 0;
    }
    for(int i=0;i<4;i++){
      int ny=cy+dy[i],nx=cx+dx[i];
      if(ny<0||H<=ny||nx<0||W<=nx||maze[ny][nx]=="#")
        continue;
      dist[ny][nx]=dist[cy][cx]+1;
      que.push(make_pair(ny,nx));
  }
  cout << "-1\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   15 |       if(maze[i][j]==".")
      |          ~~~~~~~~~~^~~~~
a.cc:31:48: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   31 |       if(ny<0||H<=ny||nx<0||W<=nx||maze[ny][nx]=="#")
      |                                    ~~~~~~~~~~~~^~~~~
a.cc:37:2: error: expected '}' at end of input
   37 | }
      |  ^
a.cc:9:1: note: to match this '{'
    9 | {
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef tuple<char, int, int> T;

int main()
{
    int H, W, wnum = 0,ans = -1;
    cin >> H >> W;
    vector<vchar> s(H + 1, vchar(W + 1)); //1-indexed
    for (int i = 1; i <= H; i++)
    {
        for (int j = 1; j <= W; j++)
        {
            cin >> s[i][j];
            if (s[i][j] == '.')
                wnum++;
        }
    }
    queue<tuple<char, int, int>> q;
    q.push((tuple<char, int, int>){s[1][1], 1, 1});
    vvint dis(H + 1, vint(W + 1));
    dis[1][1] = 1;
    //  int x = 0, y = 0;
    int ans = 0;
    while (q.size() != 0)
    {
       
       int y = get<1>(q.front());
       int x = get<2>(q.front());
       if(x==W and y==H)
       {
           break;
       }
       q.pop();
       s[y][x] = '#';
       if (y + 1 <= H and 1 <= y + 1 and s[y + 1][x] == '.')
       {
           dis[y + 1][x] = dis[y][x] + 1;
           s[y + 1][x] = '#';
           q.push((T){s[y + 1][x], y + 1, x});
        }
        if (y - 1 >= 1 and y - 1 <= H and s[y - 1][x] == '.')
        {
            dis[y - 1][x] = dis[y][x] + 1;
            s[y - 1][x] = '#';
            q.push((T){s[y - 1][x], y - 1, x});
        }
        if (x + 1 <= W and 1 <= x and s[y][x + 1] == '.')
        {
            dis[y][x + 1] = dis[y][x] + 1;
            s[y][x + 1] = '#';
            q.push((T){s[y][x + 1], y, x + 1});
        }
        if (x - 1 <= W and x - 1 >= 1 and s[y][x -1] == '.')
        {
            dis[y][x - 1] = dis[y][x] + 1;
            s[y][x - 1] = '#';
            q.push((T){s[y][x - 1], y, x - 1});
        }
        
    }
    if(dis[H][W] != 0)
        ans = wnum - dis[H][W];
    std::cout << ans;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:9: error: redeclaration of 'int ans'
   42 |     int ans = 0;
      |         ^~~
a.cc:25:24: note: 'int ans' previously declared here
   25 |     int H, W, wnum = 0,ans = -1;
      |                        ^~~