Language: C++

#include<bits/stdc++.h>
using namespace std;
#define max(a,b) (a<b?b:a)
#define abs(x) (x<0?(-x):x)
#define F(i,L,R) for (int i = L; i < R; i++)
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define RF(i,L,R) for (int i = L; i > R; i--)
#define RFE(i,L,R) for (int i = L; i >= R; i--)
#define getI(a) scanf("%d", &a)
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define VgetI(n) int (n); scanf("%d",&(n))
#define VgetII(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define VgetIII(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define ll long long
#define INF 2000000000
#define nINF -2000000000
#define MOD 1e9+7
#define PI 3.1415926535897932384626
struct tri{
	__int8 x,y;
	short n;
};
char in[51][51];
queue<tri> q;
int main(){
	char h,w;
	while(~getII(h,w)){
		short blackCnt=0;
		bool vis[h][w];
		F(i,0,h) F(j,0,w) vis[i][j]=0;
		F(i,0,h) scanf("%s",in[i]);
		F(i,0,h) F(j,0,w) if(in[i][j]=='#') blackCnt++;
		short sx=0,sy=0,tx=w-1,ty=h-1,shortest=-1;
		while(q.size()) q.pop();
		q.push((tri){sx,sy,0});
		while(q.size()){
			tri curr=q.front();
			q.pop();
			short x=curr.x,y=curr.y,n=curr.n;
			vis[x][y]=1;
			if(in[x][y]=='#') continue;
			if(x==tx&&y==ty){
				shortest=n-1;
				break;
			}
			__int8 dx[]={1,0,-1,0};
			__int8 dy[]={0,1,0,-1};
			F(i,0,4){
				char nx=x+dx[i],ny=y+dy[i];
				if(nx>=w||nx<0||ny>=h||ny<0) continue;
				if(vis[nx][ny]) continue;
				q.push((tri){nx,ny,n+1});
			}
		}
		printf("%d\n",shortest==-1?-1:(h*w-shortest-blackCnt-2));
	}
}


Compiler output:
a.cc:21:9: error: '__int8' does not name a type; did you mean 'u_int'?
   21 |         __int8 x,y;
      |         ^~~~~~
      |         u_int
a.cc: In function 'int main()':
a.cc:36:37: error: too many initializers for 'tri'
   36 |                 q.push((tri){sx,sy,0});
      |                                     ^
a.cc:40:38: error: 'struct tri' has no member named 'x'
   40 |                         short x=curr.x,y=curr.y,n=curr.n;
      |                                      ^
a.cc:41:32: error: 'y' was not declared in this scope
   41 |                         vis[x][y]=1;
      |                                ^
a.cc:44:42: error: 'n' was not declared in this scope
   44 |                                 shortest=n-1;
      |                                          ^
a.cc:47:25: error: '__int8' was not declared in this scope; did you mean 'u_int'?
   47 |                         __int8 dx[]={1,0,-1,0};
      |                         ^~~~~~
      |                         u_int
a.cc:48:31: error: expected ';' before 'dy'
   48 |                         __int8 dy[]={0,1,0,-1};
      |                               ^~~
      |                               ;
a.cc:50:43: error: 'dx' was not declared in this scope; did you mean 'nx'?
   50 |                                 char nx=x+dx[i],ny=y+dy[i];
      |                                           ^~
      |                                           nx
a.cc:51:49: error: 'ny' was not declared in this scope; did you mean 'nx'?
   51 |                                 if(nx>=w||nx<0||ny>=h||ny<0) continue;
      |                                                 ^~
      |                                                 nx
a.cc:52:44: error: 'ny' was not declared in this scope; did you mean 'nx'?
   52 |                                 if(vis[nx][ny]) continue;
      |                                            ^~
      |                                            nx
a.cc:53:49: error: 'ny' was not declared in this scope; did you mean 'nx'?
   53 |                                 q.push((tri){nx,ny,n+1});
      |                                                 ^~
      |                                                 nx
a.cc:53:52: error: 'n' was not declared in this scope; did you mean 'nx'?
   53 |                                 q.push((tri){nx,ny,n+1});
      |                                                    ^
      |                                                    nx
a.cc:53:55: error: too many initializers for 'tri'
   53 |                                 q.push((tri){nx,ny,n+1});
      |                                                       ^