Language: C++

#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<list>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>

using namespace std;

#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<bool> vb;

ll n = 0, m = 0, k = 0, ans = 0, sum = 0, cnt = 0, temp = 0;
string s;
bool flag;

//----------------------------------------------------------------------

#define MAX 10000

bool a[60][60];
bool b[60][60];

ll h, w;

void move(ll n,ll x,ll y) {
  b[x][y] = true;
  if (x==h && y==w) {
	cout << cnt - 2 - n << endl;
	exit(0);
  }
  else {
	if (a[x + 1][y]) {
	  move(n + 1, x + 1, y);
	}
	if (a[x][y + 1]) {
	  move(n + 1, x, y + 1);
	}
	if (x > 0 && !b[x-1][y]) {
	  if (a[x - 1][y]) {
		move(n, x - 1, y);
	  }
	}
	if (y > 0 && !b[x][y-1]) {
	  if (a[x][y-1]) {
		move(n, x, y-1);
	  }
	}
  }
}

int main(void) {
  ll x, y;
  char c;

  cin >> h >> w;

  FOR(i, 0, 60) {
	FOR(j, 0, 60) {
	  a[i][j] = false;
	}
  }

  FOR(i, 0, h) {
	FOR(j, 0, w) {
	  cin >> c;
	  c == '.' ? a[i][j] = true : a[i][j] = false;
	  if (a[i][j]) cnt++;
	}
  }

  ans = cnt - 2 - (h + w - 3);

  move(0, 0, 0);

  cout << "-1" << endl;

  return 0;
}

Compiler output:
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of '_OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove = true; _II = int; _OI = int]':
/usr/include/c++/14/bits/stl_algobase.h:548:42:   required from '_OI std::__copy_move_a1(_II, _II, _OI) [with bool _IsMove = true; _II = int; _OI = int]'
  548 |     { return std::__copy_move_a2<_IsMove>(__first, __last, __result); }
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:556:31:   required from '_OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove = true; _II = int; _OI = int]'
  556 |                 std::__copy_move_a1<_IsMove>(std::__niter_base(__first),
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
  557 |                                              std::__niter_base(__last),
      |                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~
  558 |                                              std::__niter_base(__result)));
      |                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:683:38:   required from '_OI std::move(_II, _II, _OI) [with _II = int; _OI = int]'
  683 |       return std::__copy_move_a<true>(std::__miter_base(__first),
      |              ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
  684 |                                       std::__miter_base(__last), __result);
      |                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:85:7:   required from here
   85 |   move(0, 0, 0);
      |   ~~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:514:64: error: no type named 'iterator_category' in 'struct std::iterator_traits<int>'
  514 |       typedef typename iterator_traits<_II>::iterator_category _Category;
      |                                                                ^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:521:51: error: no type named 'iterator_category' in 'struct std::iterator_traits<int>'
  520 |       return std::__copy_move<_IsMove, __memcpyable<_OI, _II>::__value,
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  521 |                               _Category>::__copy_m(__first, __last, __result);
      |                               ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~