Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
#define vector2(a,b,c) vector<vector<int>> a(b/*縦！w*/,vector<int>(c/*横！w*/))
#define INF 1e10
#define MOD 1e9+7
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;
int a,b;
int c[60][60];
int d[60][60];
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int bfs(){
  rep(i,a)rep(j,b)
    d[i][j]=INF;
  d[0][0]=0;
queue<int> q;
  q.push(P(0,0));
  while(q.size()){
  P p=q.front();
    q.pop();
    if(p.first==a-1&&p.second==b-1)
      break;
    rep(i,4){
    int nx=p.first+dx[i],ny=p.second+dy[i];
      if(0<=nx&&nx<a&&0<=ny&&ny<b&&c[nx][ny]=='.'&&d[nx][ny]==INF){
      q.push(P(nx,ny));
        d[nx][ny]=d[p.first][p.second]+1;
      }
    }
  }
  return d[a-1][b-1];
}
signed main(){
  cin>>a>>b;
  rep(i,a)rep(j,b)
    cin>>c[i][j];
  int e=0;
  rep(i,a)rep(j,b){
  if(c[i][j]=='#')
    e++;
  }
  int f=bfs();
  if(f==INF)
    cout<<-1<<endl;
  else
    cout<<a*b-e-f<<endl;
}

Compiler output:
a.cc: In function 'long long int bfs()':
a.cc:26:9: error: no matching function for call to 'std::queue<long long int>::push(std::pair<long long int, long long int>)'
   26 |   q.push(P(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 = long long int; _Sequence = std::deque<long long int, std::allocator<long long int> >; value_type = long long int]'
  283 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:283:30: note:   no known conversion for argument 1 from 'std::pair<long long int, long long int>' to 'const std::queue<long long int>::value_type&' {aka 'const long long int&'}
  283 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_queue.h:288:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(value_type&&) [with _Tp = long long int; _Sequence = std::deque<long long int, std::allocator<long long int> >; value_type = long long int]'
  288 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:288:25: note:   no known conversion for argument 1 from 'std::pair<long long int, long long int>' to 'std::queue<long long int>::value_type&&' {aka 'long long int&&'}
  288 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~
a.cc:28:14: error: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to non-scalar type 'std::pair<long long int, long long int>' requested
   28 |   P p=q.front();
      |       ~~~~~~~^~
a.cc:35:13: error: no matching function for call to 'std::queue<long long int>::push(std::pair<long long int, long long int>)'
   35 |       q.push(P(nx,ny));
      |       ~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:283:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = long long int; _Sequence = std::deque<long long int, std::allocator<long long int> >; value_type = long long int]'
  283 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:283:30: note:   no known conversion for argument 1 from 'std::pair<long long int, long long int>' to 'const std::queue<long long int>::value_type&' {aka 'const long long int&'}
  283 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_queue.h:288:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(value_type&&) [with _Tp = long long int; _Sequence = std::deque<long long int, std::allocator<long long int> >; value_type = long long int]'
  288 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:288:25: note:   no known conversion for argument 1 from 'std::pair<long long int, long long int>' to 'std::queue<long long int>::value_type&&' {aka 'long long int&&'}
  288 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~