Language: C++

/*+lmake
 * STD = c++14
 * DEFINE += WAAUTOMATON
 */
#include <bits/stdc++.h>
using namespace std;
using LL=long long;
using ULL=unsigned long long;
#ifdef WAAUTOMATON
#define debug(args...)                                                                             \
    {                                                                                              \
        dbg, args;                                                                                 \
        cerr << endl;                                                                              \
    }
#define massert(x) assert(x)
#else
#define debug(args...) // Just strip off all debug tokens
#define massert(x)
#endif
struct debugger
{
    template<typename T> debugger& operator , (const T& v)
    {    
        cerr<<v<<" ";    
        return *this;    
    }
} dbg;
#define MAXN 100
short a[MAXN+10][MAXN+10],s[MAXN+10][MAXN+10];
int h,w;
int query(int x1,int y1,int x2,int y2)
{
	if (x1>x2 || y1>y2  || x1<0 || y1<0 || x2>h || y2>w) return -10000;
	return sum[x2][y2]-sum[x1-1][y2]-sum[x2][y1-1]+sum[x1-1][y1-1];
}
short f[MAXN+5][MAXN+5][MAXN+5][MAXN+5];
int main(){	
#ifdef WAAUTOMATON
	//freopen("in.txt","r",stdin);
#endif
	
	cin>>h>>w;
	int sx,sy;
	for(int i=1; i<=h; ++i) {
		for(int j=1; j<=w; ++j) {
			char t;
			cin>>t;
			if (t=='E') {
				sx=i; sy=j;
			} else (t=='o') {
				a[i][j]=1;
			}
		}
	}
	for(int i=1; i<=h; ++i) {
		for(int j=1; j<=w; ++j) {
			sum[i][j]=sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1]+a[i][j];
		}
	}
	for(int l=0; l<w; ++l) {
		for(int u=0; u<h; ++u) {
			for(int r=0; r<w-l; ++r) {
				for(int d=0; d<h-u; ++d) {
					f[l+1][u][r][d]=max(f[l+1][u][r][d],
						f[l][u][r][d]+query(max(sx-u,d),sy-(l+1),min(sx+d,h-u),sy-(l+1));
					f[l][u+1][r][d]=max(f[l][u+1][r][d],
						f[l][u][r][d]+query(max(sx-u,d),sy-(l+1),min(sx+d,h-u),sy-(l+1));
				}
			}
		}
	}
				
	return 0;
}


Compiler output:
a.cc: In function 'int query(int, int, int, int)':
a.cc:34:16: error: 'sum' was not declared in this scope
   34 |         return sum[x2][y2]-sum[x1-1][y2]-sum[x2][y1-1]+sum[x1-1][y1-1];
      |                ^~~
a.cc: In function 'int main()':
a.cc:50:40: error: expected ';' before '{' token
   50 |                         } else (t=='o') {
      |                                        ^~
      |                                        ;
a.cc:57:25: error: 'sum' was not declared in this scope
   57 |                         sum[i][j]=sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1]+a[i][j];
      |                         ^~~
a.cc:65:113: error: expected ')' before ';' token
   65 |                                                 f[l][u][r][d]+query(max(sx-u,d),sy-(l+1),min(sx+d,h-u),sy-(l+1));
      |                                                                                                                 ^
      |                                                                                                                 )
a.cc:64:60: note: to match this '('
   64 |                                         f[l+1][u][r][d]=max(f[l+1][u][r][d],
      |                                                            ^
a.cc:67:113: error: expected ')' before ';' token
   67 |                                                 f[l][u][r][d]+query(max(sx-u,d),sy-(l+1),min(sx+d,h-u),sy-(l+1));
      |                                                                                                                 ^
      |                                                                                                                 )
a.cc:66:60: note: to match this '('
   66 |                                         f[l][u+1][r][d]=max(f[l][u+1][r][d],
      |                                                            ^