Language: C++

#include<bits/stdc++.h>
#include<ctime>
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:7:7: error: 'll' does not name a type
    7 | const ll maxn = 1e3 + 10;
      |       ^~
a.cc:9:9: error: 'maxn' was not declared in this scope
    9 | char mp[maxn][maxn];
      |         ^~~~
a.cc:9:15: error: 'maxn' was not declared in this scope
    9 | char mp[maxn][maxn];
      |               ^~~~
a.cc:10:10: error: 'maxn' was not declared in this scope
   10 | int step[maxn][maxn];
      |          ^~~~
a.cc:10:16: error: 'maxn' was not declared in this scope
   10 | int step[maxn][maxn];
      |                ^~~~
a.cc:11:10: error: 'maxn' was not declared in this scope
   11 | bool vis[maxn][maxn];
      |          ^~~~
a.cc:11:16: error: 'maxn' was not declared in this scope
   11 | bool vis[maxn][maxn];
      |                ^~~~
a.cc: In function 'bool check(int, int)':
a.cc:15:45: error: 'vis' was not declared in this scope
   15 |     if(x < 0 || y < 0|| x >= n || y >= m || vis[x][y] || mp[x][y] == '#') return false;
      |                                             ^~~
a.cc:15:58: error: 'mp' was not declared in this scope; did you mean 'm'?
   15 |     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:22:5: error: 'step' was not declared in this scope; did you mean 'strsep'?
   22 |     step[0][0] = 1;
      |     ^~~~
      |     strsep
a.cc:23:5: error: 'vis' was not declared in this scope
   23 |     vis[0][0] = true;
      |     ^~~
a.cc: In function 'int main()':
a.cc:43:5: error: 'init' was not declared in this scope; did you mean 'int'?
   43 |     init();
      |     ^~~~
      |     int
a.cc:48:18: error: 'mp' was not declared in this scope; did you mean 'm'?
   48 |             cin>>mp[i][j];
      |                  ^~
      |                  m