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

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = s, i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = s, i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = s; i < (n); ++i)
#define VFORS(i, s, n) for(int i = s; i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = s, i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = s, i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end());

using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;
using VD = vector<double>;
using VLL = vector<ll>;
using VS = vector<string>;
using VC = vector<char>;
using VB = vector<bool>;

const int MOD = 1000000007;
const int INF = 1000000000;

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


int dx[4] = {-1, 0, 0, 1};
int dy[4] = {0, -1, 1, 0};
int h, w;
VS s;

struct Point{
    int x, y;
    Point(int X, int Y) : x(X), y(Y){};
    //x:縦 y:横
};

int bfs(){
    queue<pair<Point, int>> que;//point, distance
    vector<VB> visited(h, VB(w, false));
    que.push(MP(Point(0, 0), 1));
    while(!que.empty()){
        pair<Point, int> pi = que.front(); que.pop();
        Point p = pi.first;
        int d = pi.second;
        visited[p.x][p.y] = true;
        
        REP(i, 4){
            int nx = p.x + dx[i], ny = p.y + dy[i];
            if(0 <= nx && nx < h && 0 <= ny && ny < w &&
               !visited[nx][ny] && s[nx][ny] == '.'){
                if(nx == h-1 && ny == w-1) return d+1;
                que.push(MP(Point(nx, ny), d+1));
            }
        }
    }
    return -1;
}

int main(){
    cin >> h >> w;
    int cnt = 0; //白のマスの数
    s.resize(h);
    REP(i, h){
        cin >> s[i];
        REP(j, w){
        if(s[i][j] == '.') ++cnt;
    }
    int mass = bfs();
    if(mass == -1){
        cout << -1 << "\n"; return 0;
    }
    cout << cnt - mass << "\n";
    return 0;
}


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

#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <queue>
#include <bits/stdc++.h>

using namespace std;


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

int H, W;
string s[110];
int dist[110][110]; 

int main() {
    
    cin >> H >> W;
	int ans = 0;
	for (int i = 0; i < H; ++i) {
        cin >> s[i];
        for (int j = 0; j < W; ++j) {
            if (s[i][j] == '.') ans++;
        }
	}
  
//幅優先探索
  
    memset(dist, -1, sizeof(dist));
	dist[0][0] = 1;
	queue<pair<int,int>> que;
	que.push(pair<int,int>(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(pair<int,int>(nx, ny));
            }
        }
	}
  
	if (dist[H-1][W-1] == -1) cout << -1 << endl;
  
	else  cout << ans - dist[H-1][W-1] << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:9: error: 'pint' was not declared in this scope; did you mean 'uint'?
   36 |         pint cur = que.front();
      |         ^~~~
      |         uint
a.cc:38:17: error: 'cur' was not declared in this scope
   38 |         int x = cur.first;
      |                 ^~~
a.cc:46:17: error: 'fi' was not declared in this scope
   46 |             if (fi[nx][ny] == '#') continue;
      |                 ^~
Language: C++

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

int maim(){
  int h,w;
  cin >> h >> w;
  const int INF = 100000000;
  vector<string> field;
  string pad(w+2,'#');
  field.push_back(pad);
  int kabe=0;
  string tmp;
  for (int i=0; i<h; i++){
    cin >> tmp;
    for (int j=0; j<w; j++){if(tmp.at(j)=='#')kabe++;}
    //field.push_back("#" + tmp + "#");
  }
}

Compiler output:
a.cc: In function 'int maim()':
a.cc:18:1: warning: no return statement in function returning non-void [-Wreturn-type]
   18 | }
      | ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

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

int maim(){
  int h,w;
  cin >> h >> w;
  const int INF = 100000000;
  vector<string> field;
  string pad(w+2,'#');
  field.push_back(pad);
  int kabe=0;
  string tmp;
  for (int i=0; i<h; i++){
    cin >> tmp;
    for (int j=0; j<w; j++){if(tmp.at(j)=='#')kabe++;}
    field.push_back("#" + tmp + "#");
  }
  field.push_back(pad);
  vector<int> ofst = {0,0,1,-1};
  vector<vector<int>> d(h+2,vector<int>(w+2,INF));
  int s_p=0;
  d[1][1] = 0;
  queue<pair<int,int>> que;
  que.push(make_pair(1,1));
  while(que.size()){
    pair<int,int> p = que.front(); que.pop();
    for(int i=0; i<4; i++){
      int ny=p.first+ofst[i],nx=p.second+ofst[3-i];
      if(ny==h&&nx==w){s_p++;goto END;}
      else if(field[ny].at(nx)=='.'&&d[ny][nx]==INF){
        que.push(make_pair(ny,nx));
        d[ny][nx] = d[p.first][p.second] + 1;
      }
    }
  }
END :
  if(s_p){
    cout << h*w - kabe - s_p << endl;
  }else{
    cout << -1 << endl;
  }
}

Compiler output:
a.cc: In function 'int maim()':
a.cc:42:1: warning: no return statement in function returning non-void [-Wreturn-type]
   42 | }
      | ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

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

int maim(){
  int h,w;
  const int INF = 100000000;
  vector<string> field;
  string pad(w+2,'#');
  field.push_back(pad);
  int kabe=0;
  string tmp;
  for (int i=0; i<h; i++){
    cin >> tmp;
    for (int j=0; j<w; j++){if(tmp.at(j)=='#')kabe++;}
    field.push_back("#" + tmp + "#");
  }
  field.push_back(pad);
  vector<int> ofst = {0,0,1,-1};
  vector<vector<int>> d(h+2,vector<int>(w+2,INF));
  int s_p=0;
  d[1][1] = 0;
  queue<pair<int,int>> que;
  que.push(make_pair(1,1));
  while(que.size()){
    pair<int,int> p = que.front(); que.pop();
    for(int i=0; i<4; i++){
      int ny=p.first+ofst[i],nx=p.second+ofst[3-i];
      if(ny==h&&nx==w){s_p++;goto END;}
      else if(field[ny].at(nx)=='.'&&d[ny][nx]==INF){
        que.push(make_pair(ny,nx));
        d[ny][nx] = d[p.first][p.second] + 1;
      }
    }
  }
END :
  if(s_p){
    cout << h*w - kabe - s_p << endl;
  }else{
    cout << -1 << endl;
  }
}
      
  

Compiler output:
a.cc: In function 'int maim()':
a.cc:41:1: warning: no return statement in function returning non-void [-Wreturn-type]
   41 | }
      | ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

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

int maim(){
  int h,w;
  const int INF = 100000000;
  vector<string> field;
  string pad(w+2,'#');
  field.push_back(pad);
  int kabe=0;
  string tmp;
  for (int i=0; i<h; i++){
    cin >> tmp;
    for (int j=0; j<w; j++){if(tmp.at(j)=='#')kabe++;}
    field.push_back("#" + tmp + "#");
  }
  field.push_back(pad);
  vector<int> ofst = {0,0,1,-1};
  vector<vector<int>> d(h+2,vector<int>(w+2,INF));
  int s_p=0;
  d[1][1] = 0;
  queue<pair<int,int>> que;
  que.push(make_pair(1,1));
  while(que.size()){
    pair<int,int> p = que.front(); que.pop();
    for(int i=0; i<4; i++){
      int ny=p.first+ofst[i],nx=p.second+ofst[3-i];
      if(ny==h&&nx==w){s_p++;goto END;}
      else if(field[ny][nx]=='.'&&d[ny][nx]==INF){
        que.push(make_pair(ny,nx));
        d[ny][nx] = d[p.first][p.second] + 1;
      }
    }
  }
END :
  if(s_p){
    cout << h*w - kabe - s_p << endl;
  }else{
    cout << -1 << endl;
  }
}
      
  

Compiler output:
a.cc: In function 'int maim()':
a.cc:41:1: warning: no return statement in function returning non-void [-Wreturn-type]
   41 | }
      | ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

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

int maim(){
  int h,w;
  const int INF = 100000000;
  vector<string> field;
  string pad(w+2,'#');
  field.push_back(pad);
  int kabe=0;
  string tmp;
  for (int i=0; i<h; i++){
    cin >> tmp;
    for (int j=0; j<w; j++){if(tmp.at(j)=='#')kabe++;}
    field.push_back("#" + tmp + "#");
  }
  field.puch_back(pad);
  vector<int> ofst = {0,0,1,-1};
  vector<vector<int>> d(h+2,vector<int>(w+2,INF));
  int s_p=0;
  d[1][1] = 0;
  queue<pair<int,int>> que;
  que.push(make_pair(1,1));
  while(que.size()){
    pair<int,int> p = que.front(); que.pop();
    for(int i=0; i<4; i++){
      int ny=p.first+ofst[i],nx=p.second+ofst[3-i];
      if(ny==h&&nx==w){s_p++;goto END;}
      else if(field[ny][nx]=='.'&&d[ny][nx]==INF){
        que.push(make_pair(ny,nx));
        d[ny][nx] = d[p.first][p.second] + 1;
      }
    }
  }
END :
  if(s_p){
    cout << h*w - kabe - s_p << endl;
  }else{
    cout << -1 << endl;
  }
}
      
  

Compiler output:
a.cc: In function 'int maim()':
a.cc:17:9: error: 'class std::vector<std::__cxx11::basic_string<char> >' has no member named 'puch_back'; did you mean 'push_back'?
   17 |   field.puch_back(pad);
      |         ^~~~~~~~~
      |         push_back
a.cc:41:1: warning: no return statement in function returning non-void [-Wreturn-type]
   41 | }
      | ^
Language: C++

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

int maim(){
  int h,w;
  const int INF = 100000000;
  vector<string> field;
  string pad(w+2,'#');
  field.push_back(pad);
  int kabe=0;
  string tmp;
  for (int i=0; i<h, i++){
    cin >> tmp;
    for (int j=0; j<w, j++){if(tmp.at(j)=='#')kabe++;}
    field.push_back("#" + tmp + "#");
  }
  field.puch_back(pad);
  vector<int> ofst = {0,0,1,-1};
  vector<vector<int>> d(h+2,vector<int>(w+2,INF));
  int s_p=0;
  d[1][1] = 0;
  queue<pair<int,int>> que;
  que.push(make_pair(1,1));
  while(que.size()){
    pair<int,int> p = que.front(); que.pop();
    for(int i=0; i<4; i++){
      int ny=p.first+ofst[i],nx=p.second+ofst[3-i];
      if(ny==h&&nx==w){s_p++;goto END;}
      else if(field[ny][nx]=='.'&&d[ny][nx]==INF){
        que.push(make_pair(ny,nx));
        d[ny][nx] = d[p.first][p.second] + 1;
      }
    }
  }
END :
  if(s_p){
    cout << h*w - kabe - s_p << endl;
  }else{
    cout << -1 << endl;
  }
}
      
  

Compiler output:
a.cc: In function 'int maim()':
a.cc:12:25: error: expected ';' before ')' token
   12 |   for (int i=0; i<h, i++){
      |                         ^
      |                         ;
a.cc:14:27: error: expected ';' before ')' token
   14 |     for (int j=0; j<w, j++){if(tmp.at(j)=='#')kabe++;}
      |                           ^
      |                           ;
a.cc:17:9: error: 'class std::vector<std::__cxx11::basic_string<char> >' has no member named 'puch_back'; did you mean 'push_back'?
   17 |   field.puch_back(pad);
      |         ^~~~~~~~~
      |         push_back
a.cc:41:1: warning: no return statement in function returning non-void [-Wreturn-type]
   41 | }
      | ^
Language: C++

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

using namespace std;

#define rip(i, n, s) for (int i = (s);i < (int)( n ); i++)
#define mp make_pair
typedef pair<int, int> P;

int main(){
    int h,w;cin >> h >> w;
    vector<string> da(h);
    rip(i,h,0) cin >> da[i];
    vector<vector<int>> li(h,vector<int>(w,-1));
    queue<pair<P, int>> q;
    q.push(mp(mp(0,0),1));
    while(!q.empty()){
        auto now = q.front();
        q.pop();
        int x = now.first.first,y = now.first.second;
        if(li[x][y] > 0 || da[x][y] == '#') continue;
        li[x][y] = now.second;
        rip(i,4,0){
            if(0 <= x + dist[i][0] && x + dist[i][0] < h && 0 <= y + dist[i][1] && y + dist[i][1] < w) q.push(mp(mp(x + dist[i][0], y + dist[i][1]),now.second + 1));
        }
    }
    int ans = h * w;
    rip(i, h, 0){
        rip(j, w, 0){
            if(da[i][j] == '#') ans--;
        }
    }
    //vvdeb(li);
    ans -= li[h-1][w-1];
    if(li[h-1][w-1]==-1) ans = -1;
    printf("%d\n",ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:25: error: 'dist' was not declared in this scope
   25 |             if(0 <= x + dist[i][0] && x + dist[i][0] < h && 0 <= y + dist[i][1] && y + dist[i][1] < w) q.push(mp(mp(x + dist[i][0], y + dist[i][1]),now.second + 1));
      |                         ^~~~
Language: C++

#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<utility>
#include<tuple>
 
// North, west, south, east
int dx[] = {-1, 0, 1, 0};
int dt[] = {0, -1, 0, 1};
 
int main(void){
    int h, w;
    std::cin >> h >> w;
 
    int countAll = h * w;
    int countOriginalBlack = 0;
 
    std::vector<std::vector<char>> board(h, std::vector<char>(w));
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            std::cin >> board[i][j];
            if(board[i][j] == '#') countOriginalBlack++;
        }
    }
 
    int sx = 0;
    int sy = 0;
    int gx = h - 1;
    int gy = w - 1;
 
    std::queue<std::pair<int,int>> que;
 
    // //11/08/2019 added: to record the distance from the start 
    std::vector<std::vector<int>> distance(h, std::vector<int>(w));
 
    // //11/08/2019 added: not to  check the position already visited 
    std::vector<std::vector<int>> dualcheck(h, std::vector<int>(w));
 
    //the distance from the start to the start must be 0
    distance[sx][sy] = 0;
    dualcheck[sx][sy]++;
 
    //push the Coordinate 
    que.push({sx, sy});
 
    while(que.size()){
        int x, y;
        std::tie(x,y) = que.front();
 
        //after completing addition to the tie, que.front must be deleted
        que.pop();
        for(int i = 0; i < 4; i++){
 
            //neighborhood of the maze[y][x]
            int nx = x + dx[i];
            int ny = y + dy[i];
 
            //Outside of the maze, or the wall is inappropriate
            if(nx < 0 || nx >= h || ny < 0 || ny >= w || board[nx][ny] == '#'){
                continue;
            }
 
            //11/08/2019 added: not to count the place already visited
            if(dualcheck[nx][ny] != 0) continue;
            
            //the coordinate can be plus 1
            distance[nx][ny] = distance[y][x] + 1;
 
            //11/08/2019 added: not to count the place already visited
            dualcheck[nx][ny]++;
            que.push({nx, ny});
        }
    }
 
    int minRouteLength = distance[gx][gy];
    int ans = countAll - countOriginalBlack - minRouteLength - 1;
 
    if(!distance[gx][gy]) ans = -1;
 
    std::cout << ans << std::endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:57:26: error: 'dy' was not declared in this scope; did you mean 'ny'?
   57 |             int ny = y + dy[i];
      |                          ^~
      |                          ny
Language: C++

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

// DAME:
int main() {
    int h, w, wnum=0;
    cin >> h >> w;
    vector< vector<char> > s(h, vector<char>(w));
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            cin >> s[i][j];
            if(s[i][j]=='.'){
                wnum++;
            }
        }
    }

    // TIPS: 幅優先探索BFS
    // queueの使い方
    vector< vector<int> > dist(h, vector<int>(w, INF));
    queue< pair<int, int> > que;
    que.push(make_pair(0, 0));

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

    while(!que.empty()){
        pair<int> 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){
                // 白マスかつ最短距離か判定
                if(s[nx][ny]=='.' && dist[x][y]+1 < dist[nx][ny]){
                    // 最短距離を更新
                    dist[nx][ny] = dist[x][y]+1;
                    // queueに追加
                    que.push({nx, ny});
                }
            }
        }
    }

    if(dist[h-1][w-1] == INF){
        // ゴールできない
        cout << -1 << endl;
        return 0;
    }

    cout << wnum-dist[h-1][w-1] << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:17: error: wrong number of template arguments (1, should be 2)
   30 |         pair<int> cur = que.front();
      |                 ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_pair.h:89:12: note: provided for 'template<class _T1, class _T2> struct std::pair'
   89 |     struct pair;
      |            ^~~~
a.cc:30:34: error: cannot convert '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} to 'int' in initialization
   30 |         pair<int> cur = que.front();
      |                         ~~~~~~~~~^~
      |                                  |
      |                                  __gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type {aka std::pair<int, int>}
a.cc:32:21: error: request for member 'first' in 'cur', which is of non-class type 'int'
   32 |         int x = cur.first;
      |                     ^~~~~
a.cc:33:21: error: request for member 'second' in 'cur', which is of non-class type 'int'
   33 |         int y = cur.second;
      |                     ^~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int h,w;
const int m=50;
vector<vector<char>> s(m,vector<char>(m));
vector<vector<int>> t(m,vector<int>(m));
queue<pair<int,int>> q;

int bfs(int a,int b,int x,int y){
  q.push(make_pair(a,b));
  t[a][b]=1;
  while(q.size()){
    pair<int,int> f=q.front();
    int u=f.first,v=f.second;
    if(u!=0&&s[u-1][v]=='.'&&t[u-1][v]==0){
      q.push(make_pair(u-1,v));
      t[u-1][v]=t[u][v]+1;
    }
    if(u!=h-1&&s[u+1][v]=='.'&&t[u+1][v]==0){
      q.push(make_pair(u+1,v));
      t[u+1][v]=t[u][v]+1;
    }
    if(v!=0&&s[u][v-1]=='.'&&t[u][v-1]==0){
      q.push(make_pair(u,v-1));
      t[u][v-1]=t[u][v]+1;
    }
    if(u!=w-1&&s[u][v+1]=='.'&&t[u][v+1]==0){
      q.push(make_pair(u,v+1));
      t[u][v+1]=t[u][v]+1;
    }
    q.pop();
  }
  return t[x][y];
}

int main(){
  cin >> h >> w;
  int cnt=0;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin >> s[i][j];
      if(s[i][j]=='.'){
        cnt++;
      }
    }
  }
  if(r==0){
    cout << -1 << endl;
  }
  else{
    cout << cnt-r << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:6: error: 'r' was not declared in this scope
   47 |   if(r==0){
      |      ^
Language: Java

import java.awt.Point;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
public class Main0{
    static char[][] mat;
    static int[][] cs;
    static int INF = Integer.MAX_VALUE/2;
    static int H,W;
    public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
        H = sc.nextInt();
        W = sc.nextInt();
        sc.nextLine();
        mat = new char[H][W];
        int posMarcadas = 0;
        int movX[] = new int[]{-1,1,0,0};
	int movY[] = new int[]{0,0,-1,1};
        
        String line;
        for(int i = 0; i < H; i++){
            line = sc.nextLine();
            for(int j = 0; j < W; j++){
                mat[i][j] = line.charAt(j);
                if(mat[i][j] == '#')
                    posMarcadas++;
            }
        }
        
        cs = new int[H][W];
        for(int[] c : cs)
            Arrays.fill(c, INF);
        cs[0][0] = 0;
        
        Queue<Pair<Integer, Point>> q = new LinkedList<Pair<Integer, Point>>();
        q.offer(new Pair(1, new Point(0,0)));
        Pair<Integer, Point> t;
        int x, y;
        int d;
        while(!q.isEmpty()){
            t = q.poll();
            d = t.first;
            x = t.second.x;
            y = t.second.y;
            
            if(x == H-1 && y == W-1)
                break;
            
            for(int i = 0; i < 4; i++){
                if(valido(x + movX[i], y + movY[i], d+1)){
                    q.offer(new Pair(d+1, new Point(x + movX[i], y + movY[i])));
                    cs[x + movX[i]][y + movY[i]] = d+1;
                }
            }
        }
        
        if(cs[H-1][W-1] != INF){
            System.out.println((H*W)-posMarcadas-cs[H-1][W-1]);
        }else{
            System.out.println(-1);
        }
    }
    private static boolean valido(int x, int y, int d){
        if(x >= 0 && x < H && y >= 0 && y < W && mat[x][y] == '.' && d < cs[x][y])
            return true;
        return false;
    }
    static class Pair<T, R>{
        T first;
        R second;
        public Pair(T f, R s){
            first = f;
            second = s;
        }
    }
}

Compiler output:
Main.java:6: error: class Main0 is public, should be declared in a file named Main0.java
public class Main0{
       ^
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Language: Java

import java.awt.Point;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
public class Main0{
    static char[][] mat;
    static int[][] cs;
    static int INF = Integer.MAX_VALUE/2;
    static int H,W;
    public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
        H = sc.nextInt();
        W = sc.nextInt();
        sc.nextLine();
        mat = new char[H][W];
        int posMarcadas = 0;
        int movX[] = new int[]{-1,1,0,0};
	int movY[] = new int[]{0,0,-1,1};
        
        String line;
        for(int i = 0; i < H; i++){
            line = sc.nextLine();
            for(int j = 0; j < W; j++){
                mat[i][j] = line.charAt(j);
                if(mat[i][j] == '#')
                    posMarcadas++;
            }
        }
        
        cs = new int[H][W];
        for(int[] c : cs)
            Arrays.fill(c, INF);
        cs[0][0] = 0;
        
        Queue<Pair<Integer, Point>> q = new LinkedList<Pair<Integer, Point>>();
        q.offer(new Pair(1, new Point(0,0)));
        Pair<Integer, Point> t;
        int x, y;
        int d;
        while(!q.isEmpty()){
            t = q.poll();
            d = t.first;
            x = t.second.x;
            y = t.second.y;
            
            if(x == H-1 && y == W-1)
                break;
            
            for(int i = 0; i < 4; i++){
                if(valido(x + movX[i], y + movY[i], d+1)){
                    q.offer(new Pair(d+1, new Point(x + movX[i], y + movY[i])));
                    cs[x + movX[i]][y + movY[i]] = d+1;
                }
            }
        }
        
        if(cs[H-1][W-1] != INF){
            System.out.println((H*W)-posMarcadas-cs[H-1][W-1]);
        }else{
            System.out.println(-1);
        }
    }
    private static boolean valido(int x, int y, int d){
        if(x >= 0 && x < H && y >= 0 && y < W && d < cs[x][y])
            return true;
        return false;
    }
    static class Pair<T, R>{
        T first;
        R second;
        public Pair(T f, R s){
            first = f;
            second = s;
        }
    }
}

Compiler output:
Main.java:6: error: class Main0 is public, should be declared in a file named Main0.java
public class Main0{
       ^
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
const ll mod = 1e9 + 7;

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


Compiler output:
a.cc: In function 'int main()':
a.cc:43:21: error: expected primary-expression before ',' token
   43 |         cout << -1 <, endl;
      |                     ^
Language: C++

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

ll INF = 1 << 28;

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

// ====================================================================

int main() {
  int h, w;
  cin >> h >> w;
  vector<string> g(h);
  for (int i = 0; i < h; i++) cin >> g[i];

  int count = 0;
  int dist[h][w];
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (g[i][j] == '#') count++;
      dist[i][j] = (g[i][j] == '#' ? INF : -1);
    }
  }

  dist[0][0] = 0;
  queue<pair<int, int>> q;
  q.push(make_pair(0, 0));
  while (!q.empty()) {
    int y = q.front().first;
    int x = q.front().second;
    q.pop();
    for (int i = 0; i < 4; i++) {
      if (x + dx[i] < 0 || w <= x + dx[i] || y + dy[i] < 0 || h <= y + dy[i]) continue;
      if (dist[y + dy[i]][x + dx[i]] == -1) {
        dist[y + dy[i]][x + dx[i]] = dist[y][x] + 1;
        q.push(make_pair(y + dy[i], x + dx[i]));
      }
    }
  }

  if (dist[h - 1][w - 1] == -1)
    cout << -1 << endl;
  else
    cout << h * w - count - dist[h - 1][w - 1] - 1 << endl;
}


Compiler output:
a.cc:4:1: error: 'll' does not name a type
    4 | ll INF = 1 << 28;
      | ^~
a.cc: In function 'int main()':
a.cc:22:38: error: 'INF' was not declared in this scope
   22 |       dist[i][j] = (g[i][j] == '#' ? INF : -1);
      |                                      ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
string MAP[100];
ll vx[4]={-1,0,1,0};
ll vy[4]={0,1,0,-1};
ll h,w;
bool check(ll x,ll y){
  if(x>=0&&x<h&&y>=0&&y<w)return true;
  else return false;
}
int main(){
  cin>>h>>w;
  ll ans=1e9;
  for(int i=0;i<h;i++)
    	cin>>MAP[i];
  queue<pair<pair<ll,ll>,ll>>que;
  bool used[100][100]={};
  used[0][0]=true;
  que.push(make_pair(make_pair(0,0),1));
  while(!que.empty()){
    pair<ll,ll>now = que.front().first;
    ll cost=que.front().second;
    que.pop();
    if(now.first==h-1&&now.second==w-1){
      ans=min(cost,ans);
      continue;
    }
    for(int i=0;i<4;i++){
      if(check(vx[i]+now.first,vy[i]+now.second)&&MAP[vx[i]+now.first][vy[i]+now.second]=='.'&&used[vx[i]+now.first][vy[i]+now.second]==false){
        que.push(make_pair(make_pair(vx[i]+now.first,vy[i].now.second),cost+1));
        used[vx[i]+now.first][vy[i]+now.second]=true;
      }
    }
  }
  ll cnt=0;
  for(int i=0;i<h;i++)for(int j=0;j<w;j++)
    if(MAP[i][j]=='#')cnt++;
  cout<<h*w-ans-cnt<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:60: error: request for member 'now' in 'vy[i]', which is of non-class type 'll' {aka 'long long int'}
   31 |         que.push(make_pair(make_pair(vx[i]+now.first,vy[i].now.second),cost+1));
      |                                                            ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
string MAP[100];
ll vx[4]={-1,0,1,0};
ll vy[4]={0,1,0,-1};
ll h,w;
bool check(ll x,ll y){
  if(x>=0&&x<h&&y>=0&&y<w)return true;
  else return false;
}
int main(){
  cin>>h>>w;
  ll ans=0;
  for(int i=0;i<h;i++)
    	cin>>MAP[i];
  queue<pair<pair<ll,ll>,ll>>que;
  bool used[100][100]={};
  used[0][0]=true;
  que.push(make_pair(make_pair(0,0),1));
  while(!que.empty()){
    pair<ll,ll>now = que.front().first;
    ll cost=que.front().second;
    que.pop();
    if(now.first==h-1&&now.second==w-1){
      ans=min(cost,ans);
      continue;
    }
    for(int i=0;i<4;i++){
      if(check(vx[i]+now.first,vy[i]+now.second)&&MAP[vx[i]+now.first][vy[i]+now.second]=='.'&&used[vx[i]+now.first][vy[i]+now.second]==false){
        que.push(make_pair(make_pair(vx[i]+now.first,vy[i].now.second),cost+1));
        used[vx[i]+now.first][vy[i]+now.second]=true;
      }
    }
  }
  ll cnt=0;
  for(int i=0;i<h;i++)for(int j=0;j<w;j++)
    if(MAP[i][j]=='#')cnt++;
  cout<<h*w-ans-cnt<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:60: error: request for member 'now' in 'vy[i]', which is of non-class type 'll' {aka 'long long int'}
   31 |         que.push(make_pair(make_pair(vx[i]+now.first,vy[i].now.second),cost+1));
      |                                                            ^~~
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <queue>
using namespace std;
typedef long long ll;

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

int main(void){
    int h, w;
    cin >> h >> w;
    
    vector<string> field;
    
    field.resize(h);
    
    int seen[60][60] = {0};
    int dist[60][60] = {0};
    
    for(int i = 0; i < h; i++){
        string tmp;
        cin >> tmp;
        field[i] = tmp;
    }
    
    queue<int> qy;
    queue<int> qx;
    
    int sx = 0;
    int sy = 0;
    
    qy.push(sy);
    qx.push(sx);
    
    seen[0][0] = 1;
    
    bool finished = false;
    int minDist;
    
    while(!qy.empty()){
        int nowX = qx.front();
        int nowY = qy.front();
        
        qx.pop();
        qy.pop();
        
        for(int i = 0; i < 4; i++){
            int nextX = nowX + dx[i];
            int nextY = nowY + dy[i];
            
            if(nextY < 0 || nextY >= h || nextX < 0 || nextX >= w){
				continue;
			}
			
			if(seen[nextY][nextX] != 0){
				continue;
			}
            
            if(field[nextY][nextX] == '#'){
				continue;
			}
			
			seen[nextY][nextX] = 1;
			dist[nextY][nextX] = dist[nowY][nowX] + 1;
			
			if(nextY == h - 1 && nextX == w - 1){
			    minDist = dist[nextY][nextX] - 1;
			    finished = true;
			    break;
			}
			
			qx.push(nextX);
			qy.push(nextY);
        }
        if(finished)break;
    }
    
    if(seen[h - 1][w - 1] == 0){
        cout << -1 << endl;
        return;
    }
    
    int whiteCounter = 0;
    for(int y = 0; y < h; y++){
        for(int x = 0; x < w; x++){
            if(field[y][x] == '.'){
                if(y == 0 && x == 0)continue;
                if(y == h - 1 && x == w - 1)continue;
                whiteCounter++;
            }
        }
    }
    
    int ans = whiteCounter - minDist;
    cout << ans << endl;
    
}


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

#pragma once
#include "stdafx.h"
#include<math.h>
#include<iostream>
#include <algorithm>
#include <string>
#include<vector>
#include<array>
#include<tuple>
#include<queue>
#include<stack>
#include<iomanip>
#include<bitset>
//AtCoderC++.cpp

using namespace std;

vector<int> _prime;
vector<int> build_prime_table(int max) {
	vector<int> table = vector<int>(max + 1, -1);
	table[0] = 0;
	table[1] = 0;
	table[2] = 1;
	for (int i = 3; i <= max; i++) {
		if (i % 2 == 0) { table[i] = 0; continue; }
		if (table[i] != -1)continue;
		table[i] = 1;
		for (int j = i + i; j <= max; j += i) {
			table[j] = 0;
		}
	}
	return table;
}

inline int ceileing(int a, int b) {
	return a % b == 0 ? a / b : a / b + 1;
}


vector<long long> comb = vector<long long>(100 * 100, -1);

long long combination(long long n, long long r) {
	if (n == 1 || n == 0)return 1;
	if (n == r)	return 1;
	else if (r == 0)return 1;
	else if (r == 1)return n;
	else if (comb[100 * (n - 1) + (r - 1)] != -1) return comb[100 * (n - 1) + (r - 1)];
	else {
		auto res = combination(n - 1, r - 1) + combination(n - 1, r);
		comb[100 * (n - 1) + (r - 1)] = res;
		return res;
	}
}


struct step {
	int x, y, steps;
	vector<pair<int, int>> history{};
};

int main() {
	int H, W; cin >> H >> W;
	auto is_white = vector<bool>(H*W);
	int white_count = 0;
	string row;
	for (size_t i = 0; i < H; i++) {
		cin >> row;
		for (size_t j = 0; j < W; j++) white_count += (is_white[i*W + j] = (row[j] == '.'));
	}
	auto q = queue<step>();
	auto visited = vector<bool>(H*W, false);
	q.push({ 0, 0,0 }); visited[0] = true;
	step s;
	auto answers = vector<step>();
	while (!q.empty()) {
		s = q.front(); q.pop(); s.history.push_back({ s.x,s.y });
		if (s.x == W - 1 && s.y == H - 1) break;
		if (s.x > 0 && is_white[s.y*W + s.x - 1]&&!visited[s.y*W + s.x - 1]) {
			q.push({ s.x - 1,s.y,s.steps + 1,s.history });
			visited[s.y*W + s.x - 1] = true;
		}
		if (s.x < W - 1 && is_white[s.y*W + s.x + 1] && !visited[s.y*W + s.x + 1]) {
			q.push({ s.x + 1,s.y,s.steps + 1,s.history });
			visited[s.y*W + s.x + 1] = true;
		}
		if (s.y > 0 && is_white[(s.y-1)*W + s.x] && !visited[(s.y - 1)*W + s.x]) {
			q.push({ s.x ,s.y - 1,s.steps + 1 ,s.history });
			visited[(s.y - 1)*W + s.x] = true;
		}
		if (s.y < H - 1 && is_white[(s.y+1)*W + s.x] && !visited[(s.y + 1)*W + s.x]) {
			q.push({ s.x ,s.y + 1,s.steps + 1,s.history });
			visited[(s.y + 1)*W + s.x] = true;
		}
	}
//	for (auto p : s.history)cout << p.first << "," << p.second << endl;
	if (s.x == W - 1 && s.y == H - 1) cout << white_count - s.steps - 1 << endl;
	else cout << -1 << endl;
}

Compiler output:
a.cc:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
a.cc:2:10: fatal error: stdafx.h: No such file or directory
    2 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

template< typename T >
struct edge { int src, to;};
void bfs(int i, int j, string *s, int **d, int H, int W){
  if(i+1 < W && j < H){
    if(s[i+1][j]=='.') d[i+1][j] = d[i][j]+1;
  }
  if(j+1 < H && i < W){
    if(s[i][j+1]=='.') d[i][j+1] = d[i][j]+1;
  }
}
  
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int H,W;
  cin >> H >> W;
  string s[H];
  rep(i,H) cin >> s[i];
  int d[H][W];
  int ans=H*W;
  rep(i,H) rep(j,W){
    d[i][j]=INT_MAX;
    if(s[i][j]=='#') ans--;
  }
  d[0][0]=0;
  queue<pair<int, int> >q;
  q.push(mp(0,0));
  while (!q.empty()) {
    pair<int, int> now = q.front(); q.pop();
    int i=now.first;
    int j=now.second;
    //    cout << i << " "<< j << endl;
    if(j < W && i+1 < H){
      if(s[i+1][j]=='.' && d[i+1][j]>d[i][j]){
	d[i+1][j] = d[i][j]+1;
	q.push(mp(i+1,j));
      }
    }
    if(i < H && j+1 < W){
      if(s[i][j+1]=='.' && d[i][j+1]>d[i][j]){
	d[i][j+1] = d[i][j]+1;
	q.push(mp(i,j+1));
      }
    }
    if(i < H && j-1 >=0){
      if(s[i][j-1]=='.' && d[i][j-1]>d[i][j]){
	d[i][j-1] = d[i][j]+1;
	q.push(mp(i,j-1));
      }
    }
    if(i-1 >=0 && j < W){
      if(s[i-1][j]=='.' && d[i-1][j]>d[i][j]){
	d[i-1][j] = d[i][j]+1;
	q.push(mp(i-1,j));
      }
    }
  }


    
  int ans=H*W;
  rep(j,H){
    rep(i,W){
      if(s[j][i]=='#') ans--;
      //      cout << d[j][i] << " ";
    }
    ///    cout << "" << endl;
  }
  if(dist==INT_MAX) cout << -1 << endl;
  else   cout << ans-(d[H-1][W-1]+1) << endl;
    
  
  return 0;
    

}


Compiler output:
a.cc: In function 'int main()':
a.cc:69:7: error: redeclaration of 'int ans'
   69 |   int ans=H*W;
      |       ^~~
a.cc:28:7: note: 'int ans' previously declared here
   28 |   int ans=H*W;
      |       ^~~
a.cc:77:6: error: 'dist' was not declared in this scope
   77 |   if(dist==INT_MAX) cout << -1 << endl;
      |      ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define R(a,b,c) for(a=b;a<=c;a++)
int main(){
  int H,W,i,j,cnt=0;
  cin>>H>>W;
  vector<int> smp((H+2)*(W+2),2);
  string ss;
  R(i,1,H){
    cin>>ss;
    R(j,1,W){
      if(ss[j-1]='#'){
        smp[i*(W+2)+j]=1;
        }else{
          smp[i*(W+2)+j]=0;
          cnt++;
        }
      }
    }
  }
  queue<int> que;
  que.push(W+3);
  smp[W+3]=1;
  smp[(W+2)*(H+1)-1]=4;
  int p,N,d[4]={1,-1,-2-W,W+2};
  cnt--;
  while(1){
    N=que.size();
    if(N==0){
      cout<<"-1";
      return 0;
    }
    while(N--){
      p=que.front();que.pop();
      R(i,0,3){
        if(smp[p+d[i]]==0){
          smp[p+d[i]]++;
          que.push(p+d[i]);
        }
        if(smp[p+d[i]]==4){
          cout<<cnt-1;
          return 0;
        }
      }
    }
    cnt--;
  }
  return 0;
}

Compiler output:
a.cc:22:3: error: 'que' does not name a type
   22 |   que.push(W+3);
      |   ^~~
a.cc:23:3: error: 'smp' does not name a type
   23 |   smp[W+3]=1;
      |   ^~~
a.cc:24:3: error: 'smp' does not name a type
   24 |   smp[(W+2)*(H+1)-1]=4;
      |   ^~~
a.cc:25:25: error: 'W' was not declared in this scope
   25 |   int p,N,d[4]={1,-1,-2-W,W+2};
      |                         ^
a.cc:25:27: error: 'W' was not declared in this scope
   25 |   int p,N,d[4]={1,-1,-2-W,W+2};
      |                           ^
a.cc:26:3: error: 'cnt' does not name a type; did you mean 'int'?
   26 |   cnt--;
      |   ^~~
      |   int
a.cc:27:3: error: expected unqualified-id before 'while'
   27 |   while(1){
      |   ^~~~~
a.cc:48:3: error: expected unqualified-id before 'return'
   48 |   return 0;
      |   ^~~~~~
a.cc:49:1: error: expected declaration before '}' token
   49 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define R(a,b,c) for(a=b;a<=c;a++)
int main(){int H,W,i,j,cnt=0;cin>>H>>W;vector<int> smp((H+2)*(W+2),2);string ss;R(i,1,H){cin>>ss;R(j,1,W){
if(ss[j-1]='#'){smp[i*(W+2)+j]=1;}else{smp[i*(W+2)+j]=0;cnt++;}}}
queue<int> que;
que.push(W+3);
smp[W+3]=1;smp[(W+2)*(H+1)-1]=4;int p,N,d[4]={1,-1,-2-W,W+2};cnt--;
while(1){
  N=que.size();
  if(N==0){cout<<"-1";return 0;}
  while(N--){
    p=que.fr();que.pop();
    R(i,0,3){
      if(smp[p+d[i]]==0){smp[p+d[i]]++;que.push(p+d[i]);}
if(smp[p+d[i]]==4){cout<<cnt-1;return 0;}}}cnt--;
}}
 


Compiler output:
a.cc: In function 'int main()':
a.cc:13:11: error: 'class std::queue<int>' has no member named 'fr'
   13 |     p=que.fr();que.pop();
      |           ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define R(a,b,c) for(a=b;a<=c;a++)
int main(){int H,W,i,j,cnt=0;cin>>H>>W;vector<int> smp((H+2)*(W+2),2);string ss;R(i,1,H){cin>>ss;R(j,1,W){
if(ss[j-1]='#'){smp[i*(W+2)+j]=1;}else{smp[i*(W+2)+j]=0;cnt++;}}}
queue<int> que;
que.push(W+3);
smp[W+3]=1;smp[(W+2)*(H+1)-1]=4;int p,N,d[4]={1,-1,-2-W,W+2};cnt--;
while(1){
  N=que.size();
  if(N==0){cout<<"-1";return 0;}
  while(N--){
    p=que.top();que.pop();
    R(i,0,3){
      if(smp[p+d[i]]==0){smp[p+d[i]]++;que.push[p+d[i]];}
if(smp[p+d[i]]==4){cout<<cnt-1;return 0;}}}cnt--;
}}
 

Compiler output:
a.cc: In function 'int main()':
a.cc:13:11: error: 'class std::queue<int>' has no member named 'top'; did you mean 'pop'?
   13 |     p=que.top();que.pop();
      |           ^~~
      |           pop
a.cc:15:48: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   15 |       if(smp[p+d[i]]==0){smp[p+d[i]]++;que.push[p+d[i]];}
      |                                                ^
Language: C++

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

#define REP(i, n) for(int i=0; i<n;i++)
#define REPR(i, n) for(int i=n-1 ; i>=0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)

#define INF 2e9
#define ll long long

class PAIR{
public:
    int first, second;
};

int main(){
    int h, w, i, j;
    cin>>h>>w;
    char s[h][w];
    int ans[h][w];
    int x[4] = {-1, 0, 0, 1};
    int y[4] = {0, -1, 1, 0};
    int dx, dy;
    int ans2 = 0;

    for(i=0; i<h; i++){
        for(j=0; j<w; j++){
            cin>>s[i][j];
            ans[h][w] = INF;
            if(s[i][j] == '.'){
                ans2++;
            }
        }
    }

    queue<pair<int, int> >q;

    q.push({0, 0});
    ans[0][0] = 0;

    while(!q.empty()){
        PAIR P = q.front();
        q.pop();
        for(i=0; i<4; i++){
            dx = P.first + x[i];
            dy = P.second + y[i];
            if(dx>=0 && dx<h && dy>=0 && dy<w && ans[dx][dy] == INF && s[dx][dy] == '.'){
                d[dx][dy] = d[P.first][P.second] + 1;
                q.push({dx, dy});
            }
        }
    }

    if(d[h-1][w-1] == INF){
        cout<<"-1"<<endl;
    }
    else{
        cout<<ans2-d[h-1][w-1]-1<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:25: error: conversion from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} to non-scalar type 'PAIR' requested
   42 |         PAIR P = q.front();
      |                  ~~~~~~~^~
a.cc:48:17: error: 'd' was not declared in this scope
   48 |                 d[dx][dy] = d[P.first][P.second] + 1;
      |                 ^
a.cc:54:8: error: 'd' was not declared in this scope
   54 |     if(d[h-1][w-1] == INF){
      |        ^
Language: C++

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

#define REP(i, n) for(int i=0; i<n;i++)
#define REPR(i, n) for(int i=n-1 ; i>=0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)

#define INF 2e9
#define ll long long

class PAIR{
public:
    int first, second;
};

int main(){
    int h, w, i, j;
    cin>>h>>w;
    char s[h][w];
    int ans[h][w];
    int x[4] = {-1, 0, 0, 1};
    int y[4] = {0, -1, 1, 0};
    int dx, dy;
    int ans2 = 0;

    for(i=0; i<h; i++){
        for(j=0; j<w; j++){
            cin>>s[i][j];
            ans[h][w] = INF;
            if(s[i][j] == '.'){
                ans2++;
            }
        }
    }

    queue<pair<int, int> >q;

    q.push({0, 0});
    d[0][0] = 0;

    while(!q.empty()){
        PAIR P = que.front();
        q.pop();
        for(i=0; i<4; i++){
            dx = P.first + x[i];
            dy = P.second + y[i];
            if(dx>=0 && dx<h && dy>=0 && dy<w && ans[dx][dy] == INF && s[dx][dy] == '.'){
                d[dx][dy] = d[P.first][P.second] + 1;
                Q.push({dx, dy});
            }
        }
    }

    if(d[h-1][w-1] == INF){
        cout<<"-1"<<endl;
    }
    else{
        cout<<ans2-d[h-1][w-1]-1<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:5: error: 'd' was not declared in this scope
   39 |     d[0][0] = 0;
      |     ^
a.cc:42:18: error: 'que' was not declared in this scope
   42 |         PAIR P = que.front();
      |                  ^~~
a.cc:49:17: error: 'Q' was not declared in this scope
   49 |                 Q.push({dx, dy});
      |                 ^
Language: C++

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

#define REP(i, n) for(int i=0; i<n;i++)
#define REPR(i, n) for(int i=n-1 ; i>=0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)

#define INF 2e9
#define ll long long

class PAIR{
public:
    int first, second;
};

int main(){
    int h, w, i, j;
    cin>>h>>w;
    char s[h][w];
    int vis[h][w];
    int white = 0, ans[h][w];
    int x[4] = {-1, 0, 0, 1};
    int y[4] = {0, -1, 1, 0};
    int dx, dy;
    int ans = 0;

    for(i=0; i<h; i++){
        for(j=0; j<w; j++){
            cin>>s[i][j];
            ans[h][w] = INF;
            if(s[i][j] == '.'){
                ans++;
            }
        }
    }

    queue<pair<int, int> >q;

    q.push(0, 0);
    d[0][0] = 0;

    while(!q.empty()){
        PAIR P = que.front();
        q.pop();
        for(i=0; i<4; i++){
            dx = P.first + x[i];
            dy = P.second + y[i];
            if(dx>=0 && dx<h && dy>=0 && dy<w && ans[dx][dy] == INF && s[dx][dy] == '.'){
                d[dx][dy] = d[P.first][P.second] + 1;
                Q.push(dx, dy);
            }
        }
    }

    if(d[h-1][w-1] == INF){
        cout<<"-1"<<endl;
    }
    else{
        cout<<ans-d[h-1][w-1]-1<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:9: error: conflicting declaration 'int ans'
   25 |     int ans = 0;
      |         ^~~
a.cc:21:20: note: previous declaration as 'int ans [h][w]'
   21 |     int white = 0, ans[h][w];
      |                    ^~~
a.cc:32:17: error: lvalue required as increment operand
   32 |                 ans++;
      |                 ^~~
a.cc:39:11: error: no matching function for call to 'std::queue<std::pair<int, int> >::push(int, int)'
   39 |     q.push(0, 0);
      |     ~~~~~~^~~~~~
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:283:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; value_type = std::pair<int, int>]'
  283 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:283:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_queue.h:288:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; value_type = std::pair<int, int>]'
  288 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:288:7: note:   candidate expects 1 argument, 2 provided
a.cc:40:5: error: 'd' was not declared in this scope
   40 |     d[0][0] = 0;
      |     ^
a.cc:43:18: error: 'que' was not declared in this scope
   43 |         PAIR P = que.front();
      |                  ^~~
a.cc:50:17: error: 'Q' was not declared in this scope
   50 |                 Q.push(dx, dy);
      |                 ^