Language: C++

#include <iostream>
#include <iomanip>
#include <queue>
#include <utility>
#include <vector>
typedef long long ll;
using namespace std;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
vector<vector<char>> s;
vector<vector<int>> dist;
int h, w;

void bfs(queue<pair<int, int>> &q, int x, int y)
{
    repi(i, 4, 0)
    {
        int nx = x + dx[i],
            ny = y + dy[i];
        if (0 <= nx && nx < w && 0 <= ny && ny < h && s[ny][nx] != '#')
        {
            if (dist[ny][nx] > dist[y][x] + 1)
            {
                dist[ny][nx] = dist[y][x] + 1;
                q.push({nx, ny});
            }
        }
    }
}

int main()
{
    cin >> h >> w;
    s.resize(h, vector<char>(w));
    dist.resize(h, vector<int>(w, INF));
    int black = 0;
    repi(i, h, 0)
    {
        repi(j, w, 0)
        {
            cin >> s[i][j];
            if (s[i][j] == '#')
            {
                black++;
            }
        }
    }

    if (s[0][0] == '#' || s[h - 1][w - 1] == '#'){
        cout << -1 << endl;
        return 0;
    }

    queue<pair<int, int>> q;

    q.push({0, 0});
    dist[0][0] = 0;
    while (!q.empty())
    {
        pair<int, int> p = q.front();
        q.pop();
        bfs(q, p.first, p.second);
    }
    cout << h * w - black - dist[h - 1][w - 1] - 1 << endl;
    return 0;
}#include <iostream>
#include <iomanip>
#include <queue>
#include <utility>
#include <vector>
typedef long long ll;
using namespace std;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
vector<vector<char>> s;
vector<vector<int>> dist;
int h, w;

void bfs(queue<pair<int, int>> &q, int x, int y)
{
    repi(i, 4, 0)
    {
        int nx = x + dx[i],
            ny = y + dy[i];
        if (0 <= nx && nx < w && 0 <= ny && ny < h && s[ny][nx] != '#')
        {
            if (dist[ny][nx] > dist[y][x] + 1)
            {
                dist[ny][nx] = dist[y][x] + 1;
                q.push({nx, ny});
            }
        }
    }
}

int main()
{
    cin >> h >> w;
    s.resize(h, vector<char>(w));
    dist.resize(h, vector<int>(w, INF));
    int black = 0;
    repi(i, h, 0)
    {
        repi(j, w, 0)
        {
            cin >> s[i][j];
            if (s[i][j] == '#')
            {
                black++;
            }
        }
    }

    if (s[0][0] == '#' || s[h - 1][w - 1] == '#'){
        cout << -1 << endl;
        return 0;
    }

    queue<pair<int, int>> q;

    q.push({0, 0});
    dist[0][0] = 0;
    while (!q.empty())
    {
        pair<int, int> p = q.front();
        q.pop();
        bfs(q, p.first, p.second);
    }
    cout << h * w - black - dist[h - 1][w - 1] - 1 << endl;
    return 0;
}

Compiler output:
a.cc:68:2: error: stray '#' in program
   68 | }#include <iostream>
      |  ^
a.cc:68:3: error: 'include' does not name a type
   68 | }#include <iostream>
      |   ^~~~~~~
a.cc:75:10: error: redefinition of 'const ll INF'
   75 | const ll INF = 1e9;
      |          ^~~
a.cc:8:10: note: 'const ll INF' previously defined here
    8 | const ll INF = 1e9;
      |          ^~~
a.cc:76:10: error: redefinition of 'const ll MOD'
   76 | const ll MOD = 1e9 + 7;
      |          ^~~
a.cc:9:10: note: 'const ll MOD' previously defined here
    9 | const ll MOD = 1e9 + 7;
      |          ^~~
a.cc:78:5: error: redefinition of 'int dx [4]'
   78 | int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
      |     ^~
a.cc:11:5: note: 'int dx [4]' previously defined here
   11 | int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
      |     ^~
a.cc:78:28: error: redefinition of 'int dy [4]'
   78 | int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
      |                            ^~
a.cc:11:28: note: 'int dy [4]' previously defined here
   11 | int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
      |                            ^~
a.cc:79:22: error: redefinition of 'std::vector<std::vector<char> > s'
   79 | vector<vector<char>> s;
      |                      ^
a.cc:12:22: note: 'std::vector<std::vector<char> > s' previously declared here
   12 | vector<vector<char>> s;
      |                      ^
a.cc:80:21: error: redefinition of 'std::vector<std::vector<int> > dist'
   80 | vector<vector<int>> dist;
      |                     ^~~~
a.cc:13:21: note: 'std::vector<std::vector<int> > dist' previously declared here
   13 | vector<vector<int>> dist;
      |                     ^~~~
a.cc:81:5: error: redefinition of 'int h'
   81 | int h, w;
      |     ^
a.cc:14:5: note: 'int h' previously declared here
   14 | int h, w;
      |     ^
a.cc:81:8: error: redefinition of 'int w'
   81 | int h, w;
      |        ^
a.cc:14:8: note: 'int w' previously declared here
   14 | int h, w;
      |        ^
a.cc:83:6: error: redefinition of 'void bfs(std::queue<std::pair<int, int> >&, int, int)'
   83 | void bfs(queue<pair<int, int>> &q, int x, int y)
      |      ^~~
a.cc:16:6: note: 'void bfs(std::queue<std::pair<int, int> >&, int, int)' previously defined here
   16 | void bfs(queue<pair<int, int>> &q, int x, int y)
      |      ^~~
a.cc:100:5: error: redefinition of 'int main()'
  100 | int main()
      |     ^~~~
a.cc:33:5: note: 'int main()' previously defined here
   33 | int main()
      |     ^~~~