Language: C++

 #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <iomanip>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << endl
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
int dx8[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy8[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int dx4[4] = {1, 0, -1, 0};
int dy4[4] = {0, 1, 0, -1};
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;


//ポイントは先に経路固定→bfsと思いつくこと、でその最短のdist=最低限使う白の個数
//今回みたいなスタートとゴールがあり、最初か、途中かに盤面をいじれる場合
//①探索しながら盤面変化、②先に経路固定してそのコストを考える
int H, W;
string fi[110];
int dist[110][110]; // BFS 用

int main() {
    // 入力
    cin >> H >> W;
    int wnum = 0;
    for (int i = 0; i < H; ++i) {
        cin >> fi[i];
        for (int j = 0; j < W; ++j) {
            if (fi[i][j] == '.') ++wnum;
        }
    }

    // BFS
    memset(dist, -1, sizeof(dist));
    dist[0][0] = 1;
    queue<pint> que;
    que.push(pint(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(pint(nx, ny));
            }
        }
    }
    if (dist[H-1][W-1] == -1) cout << -1 << endl;
    else  cout << wnum - dist[H-1][W-1] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:79:5: error: 'memset' was not declared in this scope
   79 |     memset(dist, -1, sizeof(dist));
      |     ^~~~~~
a.cc:19:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   18 | #include <iomanip>
  +++ |+#include <cstring>
   19 | using namespace std;
a.cc:81:11: error: 'pint' was not declared in this scope; did you mean 'uint'?
   81 |     queue<pint> que;
      |           ^~~~
      |           uint
a.cc:81:15: error: template argument 1 is invalid
   81 |     queue<pint> que;
      |               ^
a.cc:81:15: error: template argument 2 is invalid
a.cc:82:9: error: request for member 'push' in 'que', which is of non-class type 'int'
   82 |     que.push(pint(0, 0));
      |         ^~~~
a.cc:83:17: error: request for member 'empty' in 'que', which is of non-class type 'int'
   83 |     while (!que.empty()) {
      |                 ^~~~~
a.cc:84:13: error: expected ';' before 'cur'
   84 |         pint cur = que.front();
      |             ^~~~
      |             ;
a.cc:85:13: error: request for member 'pop' in 'que', which is of non-class type 'int'
   85 |         que.pop();
      |             ^~~
a.cc:86:17: error: 'cur' was not declared in this scope
   86 |         int x = cur.first;
      |                 ^~~
a.cc:89:26: error: 'dx' was not declared in this scope; did you mean 'nx'?
   89 |             int nx = x + dx[dir];
      |                          ^~
      |                          nx
a.cc:90:26: error: 'dy' was not declared in this scope; did you mean 'ny'?
   90 |             int ny = y + dy[dir];
      |                          ^~
      |                          ny
a.cc:95:21: error: request for member 'push' in 'que', which is of non-class type 'int'
   95 |                 que.push(pint(nx, ny));
      |                     ^~~~