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

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

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef pair<int,int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define EXIST(m,v) (m).find((v)) != (m).end()
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

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

#define en 


constexpr double EPS = 1e-9;
constexpr double PI  = 3.1415926535897932;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }


void Main() {
    int h, w;
    cin >> h >> w;
    vector<string> sv(h);
    REP(i, h) {
        string s;
        cin >> s;
        sv[i] = s;
    }
    queue<int> que;
    que.push(0);
    VI ansv(h*w, -1);
    ansv[0] = 0;
    while(!que.empty()) {
        int v = que.front();
        que.pop();
        if (v % w != 0) {
            if(sv[v/w][(v-1)%w] != '#' && ansv[v-1] == -1) {
                ansv[v-1] = ansv[v] + 1;
                que.push(v-1);
            }
        }
        if (v % w != w-1) {
            if(sv[v/w][(v+1)%w] != '#' && ansv[v+1] == -1) {
                ansv[v+1] = ansv[v] + 1;
                que.push(v+1);
            }
        }
        if (v / w != 0) {
            if(sv[v/w-1][v%w] != '#' && ansv[v-w] == -1) {
                ansv[v-w] = ansv[v] + 1;
                que.push(v-w);
            }
        }
        if (v / w != h-1) {
            if(sv[v/w+1][v%w] != '#' && ansv[v+w] == -1) {
                ansv[v+w] = ansv[v] + 1;
                que.push(v+w);
            }
        }
    }
    int count = 0;
    REP(i, h) {
        REP(j, w) {
            if (sv[i][j] == '.') {
                count++;
            }
        }
    }
    cout << count - ansv[w*h-1]-1 << endl;
}

int main(void){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);cout<<fixed<<setprecision(15);
    int t=1; //cin>>t;
    REP(_,t) Main();
    return 0;
}



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

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

vector<string> S;
int black = 0;
int white = 0;
int INF = 1001001001;

int main() {
	 int H, W;
	 cin >> H >> W;
	 for(int i = 0; i < H; ++i) {
		 string s;
		 cin >> s;
		 S.push_back(s);
	 }

	 for(int i = 0; i < H; ++i) {
		 for(int j = 0; j < W; ++j) {
			 if(S[i][j] == '#') ++black;
			 else ++white;
		 }
	 }

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

	 int dist[100][100];
	 queue<pair<int, int>> Q;
	 Q.push(make_pair(0, 0));

	 for(int i = 0; i < 100; ++i) {
		 for(int j = 0; j < 100; ++j) {
			 dist[i][j] = INF;
		 }
	 }

	 dist[0][0] = 0;

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

			 if(0 <= nx && nx < W && 0 <= ny && ny < H && S[ny][nx] != '#' && dist[nx][ny] == INF) {
				 Q.push(make_pair(nx, ny));
				 dist[nx][ny] = dist[q.first][q.second] + 1;
			 }
		 }
	 }
	 int g  = dist[W-1][H-1];
	 cout << white - g -1  << endl;

	return 0;
}


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

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

vector<string> S;
int black = 0;
int white = 0;
int INF = 1001001001;

int main() {
	 int H, W;
	 cin >> H >> W;
	 for(int i = 0; i < H; ++i) {
		 string s;
		 cin >> s;
		 S.push_back(s);
	 }

	 for(int i = 0; i < H; ++i) {
		 for(int j = 0; j < W; ++j) {
			 if(S[i][j] == '#') ++black;
			 else ++white;
		 }
	 }

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

	 int dist[100][100];
	 queue<pair<int, int>> Q;
	 Q.push(make_pair(0, 0));

	 for(int i = 0; i < 100; ++i) {
		 for(int j = 0; j < 100; ++j) {
			 dist[i][j] = INF;
		 }
	 }

	 dist[0][0] = 0;

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

			 if(0 <= nx && nx < W && 0 <= ny && ny < H && S[ny][nx] != '#' && dist[nx][ny] == INF) {
				 Q.push(make_pair(nx, ny));
				 dist[nx][ny] = dist[q.first][q.second] + 1;
			 }
		 }
	 }
	 int g  = dist[W-1][H-1];
	 cout << white - g -1  << endl;

	return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
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 main() {
  int H,W;
  cin>>H>>W;
  vector<string>s(H);
  for(int i=0;i<H;i++){
    cin>>s[i];
  }
  int cnt=0;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(s[i][j]=='#'){cnt++;}
    }
  }

  vector<int> dx={0,0,-1,1};
  vector<int> dy={-1,1,0,0};

  vector<vector<int>>dist(H,vector<int>(W,-1));
  queue<pair<int,int>>q;
  q.push(make_pair(0,0));
  dist[0][0]=0;
  while(!q.empty()){
    auto p=q.front();q.pop();
    int y=p.first,x=p.second;
    for(int i=0;i<4;i++){
      int ny=y+dy[i],nx=x+dx[i];
      if(ny>=H||ny<0||nx>=W||nx<0){continue;}
      if(s[ny][nx]=='#'){continue;}
      if(dist[ny][nx]!=-1){continue;}
      dist[ny][nx]=dist[y][x]+1;
      q.push(make_pair(ny,nx));
    }
  }
  if(dist[H-1][W-1]==-1){continue;}
  else{cout<<H*W-cnt-(dist[H-1][W-1]+1)<<endl;}
  return 0;  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:26: error: continue statement not within a loop
   41 |   if(dist[H-1][W-1]==-1){continue;}
      |                          ^~~~~~~~
Language: C++

//---------------------------------------------------------------
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#include<algorithm>
//---------------------------------------------------------------
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define SIZE 100005
#define INF 1e18
#define all(x) x.begin(),x.end()
#define fi first
#define se second
#define vec vector
using pint = pair<int,int>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
//---------------------------------------------------------------
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const double pi = acos(-1);
const int mod = 1000000007;
struct mint {
int64_t x;
mint(int64_t x=0):x((x%mod+mod)%mod){}
mint operator-() const { return mint(-x);}
mint& operator+=(const mint a) {if ((x += a.x) >= mod) x -= mod;return *this;}
mint& operator-=(const mint a) {if ((x += mod-a.x) >= mod) x -= mod;return *this;}
mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
mint operator+(const mint a) const { return mint(*this) += a;}
mint operator-(const mint a) const { return mint(*this) -= a;}
mint operator*(const mint a) const { return mint(*this) *= a;}
mint pow(int64_t t) const {if (!t) return 1;mint a = pow(t>>1);a *= a;if (t&1) a *= *this;return a;}
mint inv() const { return pow(mod-2);}
mint& operator/=(const mint a) { return *this *= a.inv();}
mint operator/(const mint a) {return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
//---------------------------------------------------------------

//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

ll h,w;
vec<string> f;

void dfs(ll y, ll x){
    rep(k,4){
        ll ny = y + dy[k]; ll nx = x + dx[k];
        if(ny<0 || ny >= h || nx<0 || nx>=w) continue;
        if(f[ny][nx] == '#')continue;
        dist[ny][nx] = min(dist[ny][nx], dist[y][x] + 1);  
        dfs(ny,nx);
    }
}

int main() {

    
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);


    cin>>h>>w;
    f.resize(h);
    rep(i,h) cin>>f[i];

    ll w = 0;
    rep(i,h)rep(j,w){
        if(f[i][j] == '.') ++w;
    }
    vec<vll> dist(55,vll(55,1000));

    dist[0][0] = 1;

    dfs(0,0);
    
    
    if(dist[h-1][w-1] == 1000) cout<<"-1"<<endl;
    else cout<< w - dist[h-1][w-1] <<endl;
    return 0; 
}

Compiler output:
a.cc: In function 'void dfs(ll, ll)':
a.cc:65:9: error: 'dist' was not declared in this scope
   65 |         dist[ny][nx] = min(dist[ny][nx], dist[y][x] + 1);
      |         ^~~~
Language: C++

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

ll h,w;
char s[55][55];
ll dist[55][55];
ll dx[4]={1,0.-1,0};
ll dy[4]={0,1,0,-1};

int main(){
    cin >> h >> w;
    ll countw=0;
    for(ll i=0;i<h;i++){
        for(ll j=0;j<w;j++){
            cin >> s[i][j];
            if(s[i][j]=='.') countw++;
            dist[i][j]=-1;
        }
    }
    queue<pair<ll,ll>> que;
    dist[0][0]=1;
    que.push(make_pair(0,0));
    while(!que.empty()){
        auto v=que.front();
        que.pop();
        for(ll i=0;i<4;i++){
            pair<ll,ll> nv;
            nv.first=v.first+dx[i];
            nv.second=v.second+dy[i];
            if(nv.first<0||nv.first>=h||nv.second<0||nv.second>=w) continue;
            if(s[nv.first][nv.second]=='#'||dist[nv.first][nv.second]!=-1) continue;
            dist[nv.first][nv.second]=dist[v.first][v.second]+1;
            que.push(nv);
        }
    }
    ll res;
    if(dist[h-1][w-1]==-1) res=-1;
    else res=countw-dist[h-1][w-1];
    cout << res << endl;
}


Compiler output:
a.cc:8:15: error: narrowing conversion of '-1.0e+0' from 'double' to 'll' {aka 'long long int'} [-Wnarrowing]
    8 | ll dx[4]={1,0.-1,0};
      |             ~~^~
Language: C

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int h,w;
  int x,y;
  int nx,ny;
  int count=0;
  cin>>h>>w;
  int f[h][w];
  vector<int>xx={1,0,-1,0};
  vector<int>yy={0,1,0,-1};
  int inf=10000000;
  queue<pair<int,int>>q;
  char c;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin>>c;
      if(c=='.'){
        f[i][j]=inf;
      }
      else {
        f[i][j]=0;
        count++;
      }
    }
  }
  q.push(pair(0,0));
  f[0][0]=0;
  while(q.size()>0){
    tie(x,y)=q.front();
    q.pop();
    for(int i=0;i<4;i++){
      nx=x+xx[i];
      ny=y+yy[i];
      if(nx<0||ny<0||nx>=w||ny>=h)continue;
      if(f[ny][nx]==0)continue;
      if(f[ny][nx]>f[y][x]+1){
        f[ny][nx]=f[y][x]+1;
        q.push(pair(nx,ny));
      }      
    }
  }
  if(f[h-1][w-1]==inf){
    cout<<-1;
  }else{
    cout<<h*w-f[h-1][w-1]-count-1;
  }
  
}

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

#include<bits/stdc++.h>
using namespace std;
bool visit[100][100];
int fx[] = {0,0,1,-1};
int fy[] = {1,-1,0,0};
int dist[100][100];
int main()
{
    int n,m;
    cin >> n >> m ;
    char ara[n+10][m+10];

    int cnt = 0;
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<m; j++)
        {
            cin >> ara[i][j] ;
            dist[i][j] = INT_MAX;
            if(ara[i][j]=='.')cnt++;
        }
    }
   // cout << cnt << " " << n*m << endl;

   // memset(dist,2,sizeof dist);


    queue <pair<int,int> > q;
    bool mrk = 0;
    if(ara[0][0]=='.' && ara[n-1][m-1]=='.')
    q.push({0,0}),dist[0][0] = 0,visit[0][0] = 1;
    else mrk = 1;

    //cout << dist[n-1][m-1] << endl;
    if(!mrk)
    while(!q.empty())
    {
        pair<int,int> prnt = q.front() ;
        q.pop();
        int px = prnt.first;
        int py = prnt.second;
        for(int i=0; i<4; i++)
        {

            int cx = px + fx[i];
            int cy = py + fy[i];

            if(cx>=0 && cx<n && cy>=0 && cy<m && ara[cx][cy]=='.' && dist[cx][cy]>dist[px][py]+1)
            {
    //            cout << px << " " << py << endl;
      //          cout << cx << " " << cy << endl;
                dist[cx][cy] = dist[px][py]+1 ;
                q.push({cx,cy});
            }
        }

    }

    int rasta =  dist[n-1][m-1]+1 ;
      if(!mrk)
      cout << cnt - rasta << endl;
      else cout << "-1" << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:34: error: reference to 'visit' is ambiguous
   31 |     q.push({0,0}),dist[0][0] = 0,visit[0][0] = 1;
      |                                  ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
                 from a.cc:1:
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:3:6: note:                 'bool visit [100][100]'
    3 | bool visit[100][100];
      |      ^~~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define rng(a) a.begin(),a.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
const int INF = 1001001001;


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

int main() {
  int h, w;
  cin >> h >> w;
  vector<vector<char>> tab(h,vector<char>(w,'#'));
  int m = 0;//'.'の数
  rep(i,h) {
    rep(j,w) {
      cin >> tab[i][j];
      if(tab[i][j]=='.') m++;
    }
  }
  rep(i,60) {
    rep(j,60) dp[i][j] = INF;
  }
  queue<P> que;
  que.push({0,0});
  while(!que.empty()) {
    auto a = que.front();
    q.pop();
    rep(i,4) {
      int x = a.first+dy[i];
      int y = a.second+dy[i];
      if(x<0||x>=h||y<0||y>=w) continue;
      if(dp[x][y]!=INF) continue;
      dp[x][y] = dp[a.first][a.second]+1;
      que.push({x,y});
    }
  }
  int ans = m - dp[1][1];
  if(ans<0) ans = -1;
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:5: error: 'q' was not declared in this scope
   32 |     q.pop();
      |     ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define rng(a) a.begin(),a.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
const int INF = 1001001001;


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

int main() {
  int h, w;
  cin >> h >> w;
  vector<vector<char>> tab(h+2,vector<char>(w+2,'#'));
  int m = 0;//'.'の数
  for(int i = 1; i <= h; i++) {
    for(int j = 1; j <= w; j++) {
      cin >> tab[i][j];
      if(tab[i][j]=='.') m++;
    }
  }
  rep(i,60) {
    rep(j,60) dp[i][j] = INF;
  }
  dp[h][w] = 1;
  for(int i = h; i >= 1; i--) {
    for(int j = w; j >= 1; j--) {
      if(tab[i][j]=='#') continue;
      rep(k,4) {
        int x = i + dx[k];
        int y = j + dy[k];
        if(tab[x][y]=='#') continue;
        dp[x][y] = min(dp[x][y],dp[i][j]+1);
      }
    }
  }
  int ans = m - dp[1][1];
  if(ans<0) ans = −1;
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc:41:19: error: extended character − is not valid in an identifier
   41 |   if(ans<0) ans = −1;
      |                   ^
a.cc: In function 'int main()':
a.cc:41:19: error: '\U000022121' was not declared in this scope
   41 |   if(ans<0) ans = −1;
      |                   ^~
Language: Java

import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int W = sc.nextInt();
        
        char s[][] = new char[H][W];
        for(int i = 0; i < H; i++) {
            s[i] = sc.next().toCharArray();
        }
        
        int whiteNum = 0;
        int distance[][] = new int[H][W];
        for(int i = 0; i < H; i++) {
            for(int j = 0; j < W; j++) {
                if( s[i][j] == '.' ) {
                    whiteNum++;
                    distance[i][j] = Integer.MAX_VALUE;
                }
            }
        }
        
        Deque<Grid> queue = new ArrayDeque<>();
        queue.add( new Grid(1, 0, 0) );
        int minVal = Integer.MAX_VALUE;
        while( !queue.isEmpty() ) {
            Grid grid = queue.poll();
            
            if( grid.i - 1 => 0 && s[grid.i - 1][grid.j] == '.' && distance[grid.i - 1][grid.j] > grid.val + 1  ) {
                distance[grid.i - 1][grid.j]  = grid.val + 1 ;
                Grid g = new Grid( grid.val + 1, grid.i - 1, grid.j );
                queue.add(g);
            }
            
            if( grid.j - 1 => 0 && s[grid.i][grid.j - 1] == '.' && distance[grid.i][grid.j - 1] > grid.val + 1 ) {
                distance[grid.i][grid.j - 1] = grid.val + 1 ;
                Grid g = new Grid( grid.val + 1, grid.i, grid.j - 1 );
                queue.add(g);
            }
            
            if( grid.i + 1 < H && s[grid.i + 1][grid.j] == '.' && distance[grid.i + 1][grid.j] > grid.val + 1 ) {
                distance[grid.i + 1][grid.j] = grid.val + 1 ;
                Grid g = new Grid( grid.val + 1, grid.i + 1, grid.j );
                queue.add(g);
            }
            
            if( grid.j + 1 < W && s[grid.i][grid.j + 1] == '.' && distance[grid.i][grid.j + 1] > grid.val + 1 ) {
                distance[grid.i][grid.j + 1] = grid.val + 1 ;
                Grid g = new Grid( grid.val + 1, grid.i, grid.j + 1);
                queue.add(g);
            }
            
            if( grid.i == H - 1 && grid.j == W - 1 ) {
                minVal = Math.min( minVal, grid.val );
            }
        }
        
        if( minVal == Integer.MAX_VALUE ) {
            System.out.println(-1);
            // throw new Exception();
        } else {
            System.out.println( whiteNum - minVal );
        }
        
    }
}

class Grid {
    int val;
    int i;
    int j;
    
    public Grid(int val, int i , int j) {
        this.val = val;
        this.i = i;
        this.j = j;
    }
}

Compiler output:
Main.java:31: error: illegal start of expression
            if( grid.i - 1 => 0 && s[grid.i - 1][grid.j] == '.' && distance[grid.i - 1][grid.j] > grid.val + 1  ) {
                            ^
Main.java:37: error: illegal start of expression
            if( grid.j - 1 => 0 && s[grid.i][grid.j - 1] == '.' && distance[grid.i][grid.j - 1] > grid.val + 1 ) {
                            ^
2 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1000000007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define REP(i, n) for(ll i=0; i<(ll)(n); i++)
#define REPD(i, n) for(ll i=n-1; 0<=i; i--)
#define FOR(i, a, b) for(ll i=a; i<(ll)(b); i++)
#define FORD(i, a, b) for(ll i=a; (ll)(b)<=i; i--)
#define ALL(x) x.begin(), x.end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};


int main(){
    int h, w;   cin >> h >> w;
    vector<vector<char>> g(h, vector<char>(w));
    ll cnt=0;
    REP(i, h)   
        REP(j, w){
            cin >> g[i][j];
            if(g[i][j]=='.') cnt += 1;
        }
    queue<pair<int, int>> que;
    que.emplace(0, 0);
    vector<vector<ll>> path(h, vector<ll>(w, LINF));
    path[0][0]=1;
    while(!que.empty()){
        pair<int, int> p =que.front();  que.pop();
        REP(i, 4){
            int nx=p.second+dx[i], ny=p.first+dy[i];
            if(nx<0 || ny<0 || h<=ny || w<=nx) continue;
            if(g[ny][nx]=='#') continue;
            if(LINF!=path[ny][nx]) continue;
            que.emplace(ny, nxa);
            path[ny][nx] = path[p.first][p.second]+1;
        }
    }
    ll res = cnt - path.back().back();
    if(res<0) res = -1;
    cout << res << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:29: error: 'nxa' was not declared in this scope; did you mean 'nx'?
   41 |             que.emplace(ny, nxa);
      |                             ^~~
      |                             nx
Language: C++

#include <iostream>
#include <vector>
#include <queue>
using namespace std;
using P = pair<int, int>;
P u = P(-1, 0);
P d = P(1, 0);
P l = P(0, -1);
P r = P(0, 1);
P dir[4] = { u, d, l, r };

int main()
{
    int H, W;
    scanf("%d %d", &H, &W);
    vector<vector<bool>> s(H, vector<bool>(W));
    int white = 0;
    for (int i = 0; i < H; ++i)
    {
        char str[60];
        scanf("%s", str);
        for (int j = 0; j < W; ++j)
        {;
            if (str[j] == '.')
            {
                s[i][j] = true;
                ++white;
            }
            else
            {
                s[i][j] = false;
            }
        }
    }
    constexpr int inf = std::numeric_limits<int>::max();
    vector<vector<int>> dp(H, vector<int>(W, inf));
    dp[0][0] = 0;
    queue<P> q;
    q.push(P(0, 0));
    while(!q.empty())
    {
        P cur = q.front();
        q.pop();
        for (int i = 0; i < 4; ++i)
        {
            P next = P(cur.first + dir[i].first, cur.second + dir[i].second);
            if (next.first >= 0 && next.first < H && next.second >= 0 && next.second < W && s[next.first][next.second])
            {
                dp[next.first][next.second] = dp[cur.first][cur.second] + 1;
                s[next.first][next.second] = false;
                q.push(next);
            }
        }
    }
    
    if (s[H - 1][W - 1])
    {
        printf("%d\n", -1);
        return 0;
    }

    printf("%d\n", white - 1 - dp[H - 1][W - 1]); // 原点(0, 0)の白1個を引く 
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:30: error: 'numeric_limits' is not a member of 'std'
   35 |     constexpr int inf = std::numeric_limits<int>::max();
      |                              ^~~~~~~~~~~~~~
a.cc:35:45: error: expected primary-expression before 'int'
   35 |     constexpr int inf = std::numeric_limits<int>::max();
      |                                             ^~~
Language: C++

#include <algorithm>
#include <boost/dynamic_bitset.hpp>
#include <iostream>
#include <numeric>
#include <queue>
#include <string>
#include <utility>
#include <vector>

int main() {
    auto h = 0;
    auto w = 0;
    std::cin >> h >> w;

    auto maze = std::vector<std::string>();
    for (auto i_ = 0; i_ < h; ++i_) {
        auto s = std::string();
        std::cin >> s;
        maze.emplace_back(s);
    }

    auto q = std::queue<std::pair<std::pair<int, int>, int>>();
    q.emplace(0, 0, 1);

    auto visited = boost::dynamic_bitset<>(w * h);

    auto push_next_place = [&](const auto& i, const auto& j, const auto& dist) {
        if ((!visited[i * w + j]) && (maze[i][j] == '.')) {
            q.emplace(i, j, dist);
        }
    };

    while (!q.empty()) {
        const auto place = q.front().first;
        const auto dist = q.front().second;
        const auto i = place.first;
        const auto j = place.second;
        q.pop();

        visited.set(i * w + j);

        if ((i == (h - 1)) && (j == (w - 1))) {
            const auto white_space = std::accumulate(maze.begin(), maze.end(), 0, [](auto sum, const auto& a) {
                return sum + std::count(a.begin(), a.end(), '.');
            });
            std::cout << (white_space - dist) << std::endl;
            return 0;
        }

        if (i > 0) push_next_place(i - 1, j, dist + 1);
        if (i < h - 1) push_next_place(i + 1, j, dist + 1);
        if (j > 0) push_next_place(i, j - 1, dist + 1);
        if (j < w - 1) push_next_place(i, j + 1, dist + 1);
    }

    std::cout << -1 << std::endl;
    return 0;
}

Compiler output:
a.cc:2:10: fatal error: boost/dynamic_bitset.hpp: No such file or directory
    2 | #include <boost/dynamic_bitset.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <algorithm>
#include <boost/dynamic_bitset.hpp>
#include <iostream>
#include <numeric>
#include <queue>
#include <string>
#include <tuple>
#include <vector>

int main() {
    auto h = 0;
    auto w = 0;
    std::cin >> h >> w;

    auto maze = std::vector<std::string>();
    for (auto i_ = 0; i_ < h; ++i_) {
        auto s = std::string();
        std::cin >> s;
        maze.emplace_back(s);
    }

    auto q = std::queue<std::tuple<int, int, int>>();
    q.emplace(0, 0, 1);

    auto visited = boost::dynamic_bitset<>(w * h);

    auto push_next_place = [&](const auto& i, const auto& j, const auto& dist) {
        if ((!visited[i * w + j]) && (maze[i][j] == '.')) {
            q.emplace(i, j, dist);
        }
    };

    while (!q.empty()) {
        const auto [i, j, dist] = q.front();
        q.pop();

        visited.set(i * w + j);

        if ((i == (h - 1)) && (j == (w - 1))) {
            const auto white_space = std::accumulate(maze.begin(), maze.end(), 0, [](auto sum, const auto& a) {
                return sum + std::count(a.begin(), a.end(), '.');
            });
            std::cout << (white_space - dist) << std::endl;
            return 0;
        }

        if (i > 0) push_next_place(i - 1, j, dist + 1);
        if (i < h - 1) push_next_place(i + 1, j, dist + 1);
        if (j > 0) push_next_place(i, j - 1, dist + 1);
        if (j < w - 1) push_next_place(i, j + 1, dist + 1);
    }

    std::cout << -1 << std::endl;
    return 0;
}

Compiler output:
a.cc:2:10: fatal error: boost/dynamic_bitset.hpp: No such file or directory
    2 | #include <boost/dynamic_bitset.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <algorithm>
#include <boost/dynamic_bitset.hpp>
#include <iostream>
#include <numeric>
#include <queue>
#include <string>
#include <tuple>
#include <vector>

int main() {
    auto h = 0;
    auto w = 0;
    std::cin >> h >> w;

    auto maze = std::vector<std::string>();
    for (auto i_ = 0; i_ < h; ++i_) {
        auto s = std::string();
        std::cin >> s;
        maze.emplace_back(s);
    }

    auto q = std::queue<std::tuple<int, int, int>>();
    q.emplace(0, 0, 1);

    auto visited = boost::dynamic_bitset<>(w * h);

    auto push_next_place = [&visited, &maze, &w](const auto& i, const auto& j, const auto& dist) {
        if (!visited[i * w + j] && (maze[i][j] == '.')) {
            q.emplace(i, j, dist);
        }
    };

    while (!q.empty()) {
        const auto [i, j, dist] = q.front();
        q.pop();

        visited.set(i * w + j);

        if ((i == (h - 1)) && (j == (w - 1))) {
            const auto white_space = std::accumulate(maze.begin(), maze.end(), 0, [](auto sum, const auto& a) {
                return sum + std::count(a.begin(), a.end(), '.');
            });
            std::cout << (white_space - dist) << std::endl;
            return 0;
        }

        if (i > 0) push_next_place(i - 1, j, dist + 1);
        if (i < h - 1) push_next_place(i + 1, j, dist + 1);
        if (j > 0) push_next_place(i, j - 1, dist + 1);
        if (j < w - 1) push_next_place(i, j + 1, dist + 1);
    }

    std::cout << -1 << std::endl;
    return 0;
}

Compiler output:
a.cc:2:10: fatal error: boost/dynamic_bitset.hpp: No such file or directory
    2 | #include <boost/dynamic_bitset.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
using namespace std;
using Graph=vector<vector<int>>;
int main(){
int H,W;
  cin>>H>>W;
  vector<vector<char>>A(H+2,vector<char>(W+2,'#'));
  for(int i=1;i<=H;i++){
  string s; cin>>s;
    for(int j=1;j<=W;j++)
      A[i][j]=s.at(j-1);
  
  }int X[4]={-1,0,0,1};
  int Y[4]={0,1,-1,0};
  Graph G(H*W);
  for(int i=1;i<=H;i++){
  for(int j=1;j<=W;j++){
  if(A[i][j]=='.'){
      int v=W*(i-1)+j-1;
    for(int a=0;a<4){
    if(A[i+X[a]][j+Y[a]]=='.')
      G[v].push_back(W*(i+X[a])+j+Y[a]-1);
    }
  }
    }
  }queue<int>que;
  que.push(0);
  vector<int>dist(H*W,-1);
  dist[0]=0;
  while(!que.empty()){
  int v=que.front();
    que.pop();
    for(auto u:G[v]){
    if(dist[u]!=-1)
      continue;
      else
        dist[u]=dist[v]+1;
    }
  }int sum=0;
  for(int i=1;i<=H;i++){
  for(int j=1;j<=W;j++){
  if(A[i][j]=='.')
    sum++;
  }
  }if(dist[H*W-1]==-1)
    cout<<-1<<endl;
  else
    cout<<sum-dist[H*W-1]-1<<endl;
  
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:20: error: expected ';' before ')' token
   20 |     for(int a=0;a<4){
      |                    ^
      |                    ;
Language: C++

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

string s[51];
vector < pair < int, int > > g[51][51];
bool used[51][51];
int d[51][51]

void bfs (pair < int, int > root) {
    queue < pair < int, int > > q;
    q.push(root);
    used[root.first][root.second] = 1;
    while (!q.empty()) {
        pair < int, int > u = q.front();
        q.pop();
        for (auto v: g[u.first][u.second]) {
            if (!used[v.first][v.second]) {
                used[v.first][v.second] = 1;
                q.push(v);
                d[v.first][v.second] = d[u.first][u.second] + 1;
            }
        }
    }
}

signed main () {
    int h, w;
    cin >> h >> w;
    int black = 0;
    for (int i = 0; i < h; ++i) {
        cin >> s[i];
        for (int j = 0; j < w; ++j) {
            if (j && s[i][j] == '.' && s[i][j - 1] == '.') {
                g[i][j].push_back(make_pair(i, j - 1));
                g[i][j - 1].push_back(make_pair(i, j));
            }
            if (i && s[i][j] == '.' && s[i - 1][j] == '.') {
                g[i][j].push_back(make_pair(i - 1, j));
                g[i - 1][j].push_back(make_pair(i, j));
            }
            if (s[i][j] == '#')
                ++black;
        }
    }
    bfs(make_pair(0, 0));
    if (!used[h - 1][w - 1])
        cout << "-1\n";
    else
        cout << h * w - black - 1 - d[h - 1][w - 1] << '\n';
}


Compiler output:
a.cc:9:1: error: expected initializer before 'void'
    9 | void bfs (pair < int, int > root) {
      | ^~~~
a.cc: In function 'int main()':
a.cc:45:5: error: 'bfs' was not declared in this scope; did you mean 'ffs'?
   45 |     bfs(make_pair(0, 0));
      |     ^~~
      |     ffs
a.cc:49:37: error: 'd' was not declared in this scope
   49 |         cout << h * w - black - 1 - d[h - 1][w - 1] << '\n';
      |                                     ^
Language: C++

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

string s[51];
vector < pair < int, int > > g[51][51];
bool used[51][51];
int d[51][51]

void bfs (pair < int, int > root) {
    queue < pair < int, int > > q;
    q.push(root);
    used[root.first][root.second] = 1;
    while (!q.empty()) {
        pair < int, int > u = q.front();
        q.pop();
        for (auto v: g[u.first][u.second]) {
            if (!used[v.first][v.second]) {
                used[v.first][v.second] = 1;
                q.push(v);
                d[v] = d[u] + 1;
            }
        }
    }
}

signed main () {
    int h, w;
    cin >> h >> w;
    int black = 0;
    for (int i = 0; i < h; ++i) {
        cin >> s[i];
        for (int j = 0; j < w; ++j) {
            if (j && s[i][j] == '.' && s[i][j - 1] == '.') {
                g[i][j].push_back(make_pair(i, j - 1));
                g[i][j - 1].push_back(make_pair(i, j));
            }
            if (i && s[i][j] == '.' && s[i - 1][j] == '.') {
                g[i][j].push_back(make_pair(i - 1, j));
                g[i - 1][j].push_back(make_pair(i, j));
            }
            if (s[i][j] == '#')
                ++black;
        }
    }
    bfs(make_pair(0, 0));
    if (!used[h - 1][w - 1])
        cout << "-1\n";
    else
        cout << h * w - black - 1 - d[h - 1][w - 1] << '\n';
}


Compiler output:
a.cc:9:1: error: expected initializer before 'void'
    9 | void bfs (pair < int, int > root) {
      | ^~~~
a.cc: In function 'int main()':
a.cc:45:5: error: 'bfs' was not declared in this scope; did you mean 'ffs'?
   45 |     bfs(make_pair(0, 0));
      |     ^~~
      |     ffs
a.cc:49:37: error: 'd' was not declared in this scope
   49 |         cout << h * w - black - 1 - d[h - 1][w - 1] << '\n';
      |                                     ^
Language: C++

#include "bits/stdc++.h"

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define ALL(v) v.begin(),v.end()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cout<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct Edge{ll from, to, cost;};
struct node{ll cost, to;
  bool friend operator>(node a, node b){
    return a.cost>b.cost;
  }
};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

ll gcd(ll a, ll b){
  ll r = a%b;
  if(r==0) return b;
  else return gcd(b, a%b);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}

ll H, W;
llvec e[3000];
vector<string> s;
ll id(ll i, ll j){
  return i*W+j;
}

ll iniblk=0;
void gen_map(){
  rep(i, H){
    rep(j, W){
      if(s[i][j]=='.'){
        if(j-1>=0)if(s[i][j-1]=='.')e[id(i, j)].push_back(id(i, j-1));
        if(j+1<W)if(s[i][j+1]=='.')e[id(i, j)].push_back(id(i, j+1));
        if(i-1>=0)if(s[i-1][j]=='.')e[id(i, j)].push_back(id(i-1, j));
        if(i+1<H)if(s[i+1][j]=='.')e[id(i, j)].push_back(id(i+1, j));
      }else{
        iniblk++;
      }
    }
  }
  return;
}

ll bfs(){
  queue<ll> q;
  llvec d(H*W, 1e10);
  q.push(0);
  d[0] = 1;
  while(!q.empty()){
    ll c = q.front();q.pop();
    rep(i, e[c].size()){
      if(d[e[c][i]]==1e10){
        d[e[c][i]]=d[c]+1;
        q.push(e[c][i]);
      }
    }
  }
  return d[H*W-1];
}

/**************************************
** A main function starts from here  **
***************************************/
int main(){
  cin >> H >> W;
  rep(i, H){
    string h;
    cin >> h;
    s.push_back(h);
  }
  gen_map();
  cerr << iniblk << endl;
  ll tmp = bfs;
  if(tmp==1e10){cout << -1 << endl;
  }else{
    cout << H*W - iniblk - tmp<<endl;
  }
  
    
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:118:12: error: invalid conversion from 'll (*)()' {aka 'long long int (*)()'} to 'll' {aka 'long long int'} [-fpermissive]
  118 |   ll tmp = bfs;
      |            ^~~
      |            |
      |            ll (*)() {aka long long int (*)()}
Language: C++

#include<bits/stdc++.h>
#include<string>
#include<vector>
using namespace std;
typedef pair<int, int>P;
typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)
//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//素因数分解
map<ll, ll>ins;
void facterize(ll n) {
	ll a = 2;
	while (n >= a * a) {
		if (n % a == 0) {
			ins[a]++;
			ins[a] = ins[a] % 1000000007;
			n /= a;
		}
		else {
			a++;
		}
	}
	ins[n]++;
}

vector<ll>relation[20], money(20, 1);
int dp[110][110];

int keta(int x) {
	int y = 0;
	while (x > 0) {
		y++;
		x /= 10;
	}
	return y;
}

ll d[1010][1010];
char c[1010][1010];
ll dx[4] = { 0,0,-1,1 };
ll dy[4] = { -1,1,0,0 };

//long longしか使わない
int main() {
	ll h, w;
	cin >> h >> w;
	ll white = 0;
	rep(i, h) {
		rep(j, w) {
			cin >> c[i][j];
			if (c[i][j] == '.') {
				d[i][j] = 1;
				white++;
			}
		}
	}
	ll ans = 0;
	queue<pair<ll, ll>>q;
	q.push(make_pair(0, 0));
	d[0][0] = 0;
	while (!q.empty()) {
		pair<ll, ll>q2 = q.front();
		q.pop();
		ll y = q2.first;
		ll x = q2.second;
		if (y == gy && x == gx)break;
		rep(i, 4) {
			ll X = x + dx[i];
			ll Y = y + dy[i];
			if (0 <= X && X < w && 0 <= Y && Y < h) {
				if (c[Y][X] != '#') {
					d[Y][X] = d[y][x] + 1;
					q.push(make_pair(Y, X));
				}
			}
		}
	}
	ans = white - d[h][w];
	cout << ans << endl;
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:99:26: error: 'gy' was not declared in this scope; did you mean 'y'?
   99 |                 if (y == gy && x == gx)break;
      |                          ^~
      |                          y
a.cc:99:37: error: 'gx' was not declared in this scope; did you mean 'x'?
   99 |                 if (y == gy && x == gx)break;
      |                                     ^~
      |                                     x
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i = 0; i<(ll)(n); i++)
#define REPS(i,n) for (ll i = 1; i<=(ll)(n); i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define pb push_back
#define MOD 1000000007
#define MOD2 998244353
#define PI 3.141592653
#define N 60
vector<vector<ll>> ice(N,vector<ll>(N,1));
queue<vector<ll>> q;

void bfs(){
	ll nowx = q.front().at(0);
	ll nowy = q.front().at(1);
	q.pop();
	if (ice[nowx+1][nowy]==0 || ice[nowx+1][nowy]>ice[nowx][nowy]+1){
		ice[nowx+1][nowy] = ice[nowx][nowy]+1;
		q.push({nowx+1,nowy});
	}
	if (ice[nowx-1][nowy]==0 || ice[nowx-1][nowy]>ice[nowx][nowy]+1){
		ice[nowx-1][nowy] = ice[nowx][nowy]+1;
		q.push({nowx-1,nowy});
	}
	if (ice[nowx][nowy+1]==0 || ice[nowx][nowy+1]>ice[nowx][nowy]+1){
		ice[nowx][nowy+1] = ice[nowx][nowy]+1;
		q.push({nowx,nowy+1});
	}
	if (ice[nowx][nowy-1]==0 || ice[nowx][nowy-1]>ice[nowx][nowy]+1){
		ice[nowx][nowy-1] = ice[nowx][nowy]+1;
		q.push({nowx,nowy-1});
	}
}

int main(){
	ll h, w, cnt; cin >> h >> w;
	string s;
	ll cnt = 0;
	REP(i,h){
		cin >> s;
		REP(j,w){
			if (s[j]=='.') {
				ice[i+1][j+1]=0;
			}
			else {
				cnt++;
			}
		}
	}
	ice[1][1]=1;
	q.push({1,1});
	while (q.size()>0){
		bfs();
	}
	cout << h*w-ice[h][w]-cnt << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:12: error: redeclaration of 'll cnt'
   42 |         ll cnt = 0;
      |            ^~~
a.cc:40:18: note: 'll cnt' previously declared here
   40 |         ll h, w, cnt; cin >> h >> w;
      |                  ^~~
Language: C++

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

int main() {
  using pii = pair<int,int>;
  int H, W;
  cin >> H >> W;
  char s[H][W];
  int d[H][W];
  int dy[4]={0,1,0,-1}, dx[4]={1,0,-1,0};
  int w=0;
  for(int i=0;i<H;i++) {
    for(int j=0;j<W;j++) {
      cin >> s[i][j];
      if(s[i][j]=='.') w++;
      d[i][j]=-1;
    }
  }
  queue<pii> que;
  que.push(pii(0,0));
  d[0][0]=1;
  while(que.size()) {
    pii p=que.front();
    que.pop();
    if(p==pii(H-1,W-1)) break;
    for(int i=0;i<4;i++) {
      int ny=p.first()+dy[i], nx=p.second()+dx[i];
      if(0<=ny&&ny<H&&0<=nx&&nx<W&&c[ny][nx]=='.'&&d[ny][nx]==-1) {
        que.push(pii(ny,nx));
        d[ny][nx]=d[p.first()][p.second()]+1;
      }
    }
  }
  cout << w-d[H-1][W-1] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:21: error: expression cannot be used as a function
   27 |       int ny=p.first()+dy[i], nx=p.second()+dx[i];
      |              ~~~~~~~^~
a.cc:28:26: error: 'nx' was not declared in this scope; did you mean 'ny'?
   28 |       if(0<=ny&&ny<H&&0<=nx&&nx<W&&c[ny][nx]=='.'&&d[ny][nx]==-1) {
      |                          ^~
      |                          ny
a.cc:28:36: error: 'c' was not declared in this scope
   28 |       if(0<=ny&&ny<H&&0<=nx&&nx<W&&c[ny][nx]=='.'&&d[ny][nx]==-1) {
      |                                    ^
a.cc:30:28: error: expression cannot be used as a function
   30 |         d[ny][nx]=d[p.first()][p.second()]+1;
      |                     ~~~~~~~^~
a.cc:30:40: error: expression cannot be used as a function
   30 |         d[ny][nx]=d[p.first()][p.second()]+1;
      |                                ~~~~~~~~^~
Language: C++

from collections import deque

H, W = map(int, input().split())
grid = '#' * (W + 2)
for _ in range(H):
    grid += '#' + input() + 'X'
grid += '#' * (W + 2)

root = list(i for i in range(len(grid)) if grid[i] == '.')
start = root[0]
goal = root[-1]

def bfs(grid_):
    move = [1, -1, W + 2, -(W + 2)]
    se = set([start])
    q = deque([start])

    T = [-1] * len(grid)
    T[start] = 0
    while q:
        x = q.popleft()
        for dx in move:
            y = x + dx
            if grid_[y] == '#':
                continue
            if y in se:
                continue
            T[y] = T[x] + 1
            se.add(y)
            q.append(y)
    return T[goal] >= 0

ans = 0
for i in root[1:-1]:
    grid_ = grid[:i] + '#' + grid[i+1:]
    if bfs(grid_):
        ans += 1
        grid = grid_
print(ans)

Compiler output:
a.cc:1:1: error: 'from' does not name a type
    1 | from collections import deque
      | ^~~~
Language: C++

#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
using namespace std;
typedef long long ll;

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

int main(){
    ll h,w;
    cin>>h>>w;
    vector<string> board(h);
    rep(i,h) cin>>board[i];
    ll cnt=0;
    rep(i,h)rep(j,w) if(board[i][j]=='#') cnt++;
    queue<pair<ll,ll>> q;
    vector<vector<ll>> dist(h,vector<ll>(w,-1)); 
    q.push(make_pair(0,0));
    dist[0][0]=0;
    while(!q.empty()){
        ll f=q.front().first;
        ll s=q.front().second;
        q.pop();
        rep(i,4){
            ll y=f+dy[i],x=s+dx[i];
            if(y>=0&&y<h&&x>=0&&x<w&&board[y][x]=='.'&&dist[y][x]==-1){
                q.push(make_pair(y,x));
                dist[y][x]=dist[f][s]+1;
            }
        }
    }
    if(dist[h-1][w-1]==-1) cout<,-1<<endl;
    else cout<<h*w-cnt-dist[h-1][w-1]-1<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:33: error: expected primary-expression before ',' token
   33 |     if(dist[h-1][w-1]==-1) cout<,-1<<endl;
      |                                 ^
a.cc:33:36: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   33 |     if(dist[h-1][w-1]==-1) cout<,-1<<endl;
      |                                  ~~^~~~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ull = long long unsigned;
using P = pair<float,float>;
const int INF=1001001001;
const int NMAX=8;
const int MOD=1000000007;
const int dbase=80*160;


int main(){
	int h,w;
  cin>>h>>w;
  vector<string> v;
  rep(i,h){
    string temp;
    cin>>temp;
    v.emplace_back(temp);
  }
  vector<vector<int>> d(h,vector<int>(w,INF));
//  cout<<v[0][2];
 d[0][0]=0;

  
  queue <P> q;
  bool check=false;
  q.push(make_pair(0,0));
  while (!q.empty()){
    p=q.front();
    int l=p.first;
    int r=p.second;
    //cout<<l<<'l'<<r<<'r'<<endl;

    q.pop();
    if (l==h-1 and r==w-1){
      check=true; break;
    }
    if (r+1<w){
      if (v[l][r+1]=='.' and d[l][r+1]==INF) {
        q.push(make_pair(l,r+1));
        d[l][r+1]=d[l][r]+1;
      }
    }
    if (r-1>=0){
      if (v[l][r-1]=='.' and d[l][r-1]==INF) {
        q.push(make_pair(l,r-1));
        d[l][r-1]=d[l][r]+1;
      }
    }
    if (l+1<h){
      if (v[l+1][r]=='.' and d[l+1][r]==INF)  {
        q.push(make_pair(l+1,r));
        d[l+1][r]=d[l][r]+1;
      }
    }
    if (l-1>=0){
      if (v[l-1][r]=='.' and d[l-1][r]==INF)  {
        q.push(make_pair(l-1,r));
        d[l-1][r]=d[l][r]+1;
      }
    }
  //  cout<<l<<'l'<<r<<'r'<<endl;

  }

  if (check==false) {
    cout<<-1;
    return 1;
  }
  int cnt=0;
  rep(i,h)rep(j,w){
    if (v[i][j]=='.') cnt++;
  }
  //cout<<cnt<<endl;
  cnt-=d[h-1][w-1];
  cnt--;
  cout<<cnt;
  return 0;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:5: error: 'p' was not declared in this scope
   31 |     p=q.front();
      |     ^
Language: C++

#include <bits/stdc++.h>
#include <algorithm>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(x) (x).begin(), (x).end()
#define PB(x) push_back(x)
#define MP(x,y) make_pair(x,y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

const int INF=100000000;

int r,c;
int sy,sx;
int gy, gx;
char field[50][50];
int d[50][50];
int dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1};

int bfs() {
    queue<P> que;
    rep(i,50) rep(j,50)   d[i][j]=INF;
    que.push(P(sx,sy));
    d[sx][sy]=0;

    while(que.size()) {
        P p =que.front(); que.pop();
        if(p.first == gx && p.second == gy)   break;
        rep(i,4) {
            int nx = p.first + dx[i],ny = p.second + dy[i];
            if(field[nx][ny]!='#' && d[nx][ny] == INF) {
                que.push(P(nx,ny));
                d[nx][ny] = d[p.first][p.second] +1;
            }
        }
    }
    return d[gx][gy];
}
 
int main() {

    cin >> r >> c;
    sx = 0;
    sy = 0;
    gx = r-1;
    gy = c-1;
    rep(i,r)    rep(j,c)    cin >> field[i][j];

    if(bfs() == INF)    cout << -1 << endl;
    else    cout << count - bfs() - 1 << endl;

 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:27: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator-'
   51 |     else    cout << count - bfs() - 1 << endl;
      |                     ~~~~~~^~~~~~~
Language: C++

#include <bits/stdc++.h>
#include <algorithm>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(x) (x).begin(), (x).end()
#define PB(x) push_back(x)
#define MP(x,y) make_pair(x,y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

const int INF=100000000;

int r,c;
int sy,sx;
int gy, gx;
char field[50][50];
int d[50][50];
int dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1};

int bfs() {
    queue<P> que;
    rep(i,50) rep(j,50)   d[i][j]=INF;
    que.push(P(sx,sy));
    d[sx][sy]=0;

    while(que.size()) {
        P p =que.front(); que.pop();
        if(p.first == gx && p.second == gy)   break;
        rep(i,4) {
            int nx = p.first + dx[i],ny = p.second + dy[i];
            if(field[nx][ny]!='#' && d[nx][ny] == INF) {
                que.push(P(nx,ny));
                d[nx][ny] = d[p.first][p.second] +1;
            }
        }
    }
    return d[gx][gy];
}
 
int main() {

    cin >> r >> c;
    cin >> sx >> sy;
    sy--;
    sx--;
    cin >> gx >> gy;
    gy--;
    gx--;
    rep(i,r) {
        rep(j,c)    cin >> field[i][j];
    }

    if(bfs() == INF)    cout << -1 << endl;
    else    cout << count - bfs() - 1 << endl;

 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:55:27: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator-'
   55 |     else    cout << count - bfs() - 1 << endl;
      |                     ~~~~~~^~~~~~~