Language: C++

#include<iostream>

using namespace std;

#define fi first
#define se second

const ll maxn = 1e3 + 10;
const int Move[4][2] = {-1,0,1,0,0,1,0,-1};
char mp[maxn][maxn];
int step[maxn][maxn];
bool vis[maxn][maxn];
int n,m;

bool check(int x,int y) {
    if(x < 0 || y < 0|| x >= n || y >= m || vis[x][y] || mp[x][y] == '#') return false;
    return true;
}

int BFS() {
    queue<pair<int ,int> > q;
    q.push(make_pair(0,0));
    step[0][0] = 1;
    vis[0][0] = true;
    while (!q.empty()) {
        pair<int ,int> t = q.front();
        q.pop();
        for(int i = 0;i < 4;i++) {
            int tox = t.fi + Move[i][0];
            int toy = t.se + Move[i][1];
            if(tox == n - 1 && toy == m - 1) return step[t.fi][t.se] + 1;
            if(check(tox,toy)) {
                vis[tox][toy] = true;
                step[tox][toy] = step[t.fi][t.se] + 1;
                q.push(make_pair(tox,toy));
            }
        }
    }
    return -1;
}


int main(){
    init();
    cin>>n>>m;
    int cnt = 0;
    for(int i = 0;i < n;i++)
        for(int j = 0;j < m;j++) {
            cin>>mp[i][j];
            if(mp[i][j] == '#') cnt++;
        }
    int res = BFS();
    if(res == -1) {
        cout<<"-1"<<endl;
    } else {
        cout<<n*m - res - cnt<<endl;
    }
    return 0;
}

Compiler output:
a.cc:8:7: error: 'll' does not name a type
    8 | const ll maxn = 1e3 + 10;
      |       ^~
a.cc:10:9: error: 'maxn' was not declared in this scope
   10 | char mp[maxn][maxn];
      |         ^~~~
a.cc:10:15: error: 'maxn' was not declared in this scope
   10 | char mp[maxn][maxn];
      |               ^~~~
a.cc:11:10: error: 'maxn' was not declared in this scope
   11 | int step[maxn][maxn];
      |          ^~~~
a.cc:11:16: error: 'maxn' was not declared in this scope
   11 | int step[maxn][maxn];
      |                ^~~~
a.cc:12:10: error: 'maxn' was not declared in this scope
   12 | bool vis[maxn][maxn];
      |          ^~~~
a.cc:12:16: error: 'maxn' was not declared in this scope
   12 | bool vis[maxn][maxn];
      |                ^~~~
a.cc: In function 'bool check(int, int)':
a.cc:16:45: error: 'vis' was not declared in this scope
   16 |     if(x < 0 || y < 0|| x >= n || y >= m || vis[x][y] || mp[x][y] == '#') return false;
      |                                             ^~~
a.cc:16:58: error: 'mp' was not declared in this scope; did you mean 'm'?
   16 |     if(x < 0 || y < 0|| x >= n || y >= m || vis[x][y] || mp[x][y] == '#') return false;
      |                                                          ^~
      |                                                          m
a.cc: In function 'int BFS()':
a.cc:21:5: error: 'queue' was not declared in this scope
   21 |     queue<pair<int ,int> > q;
      |     ^~~~~
a.cc:2:1: note: 'std::queue' is defined in header '<queue>'; this is probably fixable by adding '#include <queue>'
    1 | #include<iostream>
  +++ |+#include <queue>
    2 | 
a.cc:21:26: error: expected primary-expression before '>' token
   21 |     queue<pair<int ,int> > q;
      |                          ^
a.cc:21:28: error: 'q' was not declared in this scope
   21 |     queue<pair<int ,int> > q;
      |                            ^
a.cc:23:5: error: 'step' was not declared in this scope
   23 |     step[0][0] = 1;
      |     ^~~~
a.cc:24:5: error: 'vis' was not declared in this scope
   24 |     vis[0][0] = true;
      |     ^~~
a.cc: In function 'int main()':
a.cc:44:5: error: 'init' was not declared in this scope; did you mean 'int'?
   44 |     init();
      |     ^~~~
      |     int
a.cc:49:18: error: 'mp' was not declared in this scope; did you mean 'm'?
   49 |             cin>>mp[i][j];
      |                  ^~
      |                  m