Language: C++

#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using vvl = vector<vector<long>>;
using pii = pair<int, int>;
using pil = pair<int, long>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20)
#define YES cout << "Yes" << endl
#define NO cout << "No" << endl
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,s,t) for(int i=s; i<t; i++)
#define RNG(i,s,t,u) for(int i=s; i<t; i+=u)
#define MOD 1000000007
#define all(vec) vec.begin(), vec.end()
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; }

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

int main(){
  int h,w;
  cin >> h >> w;
  vs d(h);
  int cnt = 0;
  rep(i,h){
    cin >> d.at(i);
    rep(j,w){
      cnt += (d.at(i).at(j) == '.');
    }
  }
  queue<pii> que;
  que.push(0,0);
  vector<vl> dist(h, vl(w, -1));
  dist.at(0).at(0);
  while(que.size()){
    pii P = que.front();
    que.pop();
    rep(i,4){
      int nx,ny;
      nx = P.first + dx[i];
      ny = P.second + dy[i];
      if(nx < 0 || nx >= h || ny < 0 || ny >= w) continue;
      if(d.at(nx).at(ny) == '#') continue;
      if(dist.at(nx).at(ny) == -1){
        dist.at(nx).at(ny) = dist.at(P.first).at(P.second) + 1;
      }
    }
  }
  if(dist.at(h-1).at(w-1) == -1) cout << -1 << endl;
  else{
    cout << cnt - (dist.at(h-1).at(w-1) + 1) << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:11: error: no matching function for call to 'std::queue<std::pair<int, int> >::push(int, int)'
   40 |   que.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:42:16: warning: ignoring return value of 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::at(size_type) [with _Tp = long int; _Alloc = std::allocator<long int>; reference = long int&; size_type = long unsigned int]', declared with attribute 'nodiscard' [-Wunused-result]
   42 |   dist.at(0).at(0);
      |   ~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53:
/usr/include/c++/14/bits/stl_vector.h:1180:7: note: declared here
 1180 |       at(size_type __n)
      |       ^~