Language: C++

#include<iostream>

using namespace std;


#define rep(i,n) for(ll i=0;i<(ll)(n);i++)

int main(){
	int n;
	while(cin>>n){
		if(n==0)break;
		int data[101][101];
		rep(i,n){
			rep(j,n){
				cin>>data[i][j];
			}
		}

		int ans=-999999999;

		rep(i,n){
			rep(j,n){
				int dp[101][101];
				rep(k,101)rep(l,101)dp[k][l]=-999999999;
				dp[i][j]=data[i][j];

				for(int k=i;k<n;k++){
					for(int l=j;l<n;l++){
						if(l+1<n){
							int right=0;
							for(int loop=i;loop<=k;loop++) right+=data[loop][l+1];
							dp[k][l+1]=dp[k][l]+right;
						}
						if(k+1<n){
							int under=0;
							for(int loop=j;loop<=l;loop++) under+=data[k+1][loop];
							dp[k+1][l]=dp[k][l]+under;
						}
						if(l+1<n && k+1<n)
							dp[k+1][l+1]=dp[k][l+1]+dp[k+1][l]-dp[k][l]+data[k+1][l+1];
					}
				}

				for(int k=i;k<n;k++)for(int l=j;l<n;l++){
					ans=max(ans,dp[k][l]);
				}
			}
		}
		cout<<ans<<endl;

	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:22: error: 'll' was not declared in this scope
    6 | #define rep(i,n) for(ll i=0;i<(ll)(n);i++)
      |                      ^~
a.cc:13:17: note: in expansion of macro 'rep'
   13 |                 rep(i,n){
      |                 ^~~
a.cc:13:21: error: 'i' was not declared in this scope
   13 |                 rep(i,n){
      |                     ^
a.cc:6:29: note: in definition of macro 'rep'
    6 | #define rep(i,n) for(ll i=0;i<(ll)(n);i++)
      |                             ^
a.cc:14:29: error: expected ';' before 'j'
   14 |                         rep(j,n){
      |                             ^
a.cc:6:25: note: in definition of macro 'rep'
    6 | #define rep(i,n) for(ll i=0;i<(ll)(n);i++)
      |                         ^
a.cc:14:29: error: 'j' was not declared in this scope
   14 |                         rep(j,n){
      |                             ^
a.cc:6:29: note: in definition of macro 'rep'
    6 | #define rep(i,n) for(ll i=0;i<(ll)(n);i++)
      |                             ^
a.cc:6:22: error: 'll' was not declared in this scope
    6 | #define rep(i,n) for(ll i=0;i<(ll)(n);i++)
      |                      ^~
a.cc:21:17: note: in expansion of macro 'rep'
   21 |                 rep(i,n){
      |                 ^~~
a.cc:21:21: error: 'i' was not declared in this scope
   21 |                 rep(i,n){
      |                     ^
a.cc:6:29: note: in definition of macro 'rep'
    6 | #define rep(i,n) for(ll i=0;i<(ll)(n);i++)
      |                             ^
a.cc:22:29: error: expected ';' before 'j'
   22 |                         rep(j,n){
      |                             ^
a.cc:6:25: note: in definition of macro 'rep'
    6 | #define rep(i,n) for(ll i=0;i<(ll)(n);i++)
      |                         ^
a.cc:22:29: error: 'j' was not declared in this scope
   22 |                         rep(j,n){
      |                             ^
a.cc:6:29: note: in definition of macro 'rep'
    6 | #define rep(i,n) for(ll i=0;i<(ll)(n);i++)
      |                             ^
a.cc:24:37: error: expected ';' before 'k'
   24 |                                 rep(k,101)rep(l,101)dp[k][l]=-999999999;
      |                                     ^
a.cc:6:25: note: in definition of macro 'rep'
    6 | #define rep(i,n) for(ll i=0;i<(ll)(n);i++)
      |                         ^
a.cc:24:37: error: 'k' was not declared in this scope
   24 |                                 rep(k,101)rep(l,101)dp[k][l]=-999999999;
      |                                     ^
a.cc:6:29: note: in definition of macro 'rep'
    6 | #define rep(i,n) for(ll i=0;i<(ll)(n);i++)
      |                             ^
a.cc:24:47: error: expected ';' before 'l'
   24 |                                 rep(k,101)rep(l,101)dp[k][l]=-999999999;
      |                                               ^
a.cc:6:25: note: in definition of macro 'rep'
    6 | #define rep(i,n) for(ll i=0;i<(ll)(n);i++)
      |                         ^
a.cc:24:47: error: 'l' was not declared in this scope
   24 |                                 rep(k,101)rep(l,101)dp[k][l]=-999999999;
      |                                               ^
a.cc:6:29: note: in definition of macro 'rep'
    6 | #define rep(i,n) for(ll i=0;i<(ll)(n);i++)
      |                             ^