Language: C++

#include <iostream>
#include <stdio.h>
#include <math.h>
 
using namespace std;
const int Maxh=1000+100;
 
int h,w;
int a[Maxh][Maxh];
int l[Maxh][Maxh],r[Maxh][Maxh];
int fl[Maxh][Maxh],fr[Maxh][Maxh],sl[Maxh][Maxh],sr[Maxh][Maxh];
int Res;
 
void BuildLR()
{
    for (int i=1; i<=h; i++)
    {
        for (int j=w; j>=1; j--) r[i][j]=r[i][j+1]+a[i][j];
        for (int j=1; j<=w; j++) l[i][j]=l[i][j-1]+a[i][j];
    }
}
 
void BuildFSLR()
{
    for (int i=h; i>=1; i--)
    {
        for (int j=w+1; j>=0; j--)
        {
            fl[i][j]=sl[i+1][j]+l[i][j];
            sl[i][j]=max(fl[i][j],sl[i][j+1]);
            fr[i][j]=sr[i+1][j]+r[i][j];
            sr[i][j]=max(fr[i][j],sr[i][j+1]);
        }
    }
}
 
void Solve()
{
    Res=0;
    int i=1, j=0;
    while (true)
    {
        if (fr[i][j+1]==sr[i][j+1]) Res+=r[i][j+1],i++; else j++;
        if ((i>h) || (j>=w)) break;
        if (fl[i][j]==sl[i][j]) Res+=r[i][j+1],i++; else j++;
        if ((i>h) || (j>=w)) break;
    }
 
    int S=0;
    for (int i=1; i<=h; i++) S+=r[i][1];
    S-=Res; Res=abs(Res-S);
}
 
int main()
{
    scanf("%d%d",&w,&h);
    for (int i=1; i<=h; i++)
    for (int j=1; j<=w; j++) scanf("%d",&a[i][j]);
 
    BuildLR();
    BuildFSLR();
    Solve();
 
    printf("%d",Res);
    return 0;
}


Compiler output:
a.cc:4:1: error: extended character   is not valid in an identifier
    4 |  
      | ^
a.cc:7:1: error: extended character   is not valid in an identifier
    7 |  
      | ^
a.cc:13:1: error: extended character   is not valid in an identifier
   13 |  
      | ^
a.cc:16:1: error: extended character   is not valid in an identifier
   16 |     for (int i=1; i<=h; i++)
      | ^
a.cc:16:1: error: extended character   is not valid in an identifier
a.cc:16:1: error: extended character   is not valid in an identifier
a.cc:16:1: error: extended character   is not valid in an identifier
a.cc:17:1: error: extended character   is not valid in an identifier
   17 |     {
      | ^
a.cc:17:1: error: extended character   is not valid in an identifier
a.cc:17:1: error: extended character   is not valid in an identifier
a.cc:17:1: error: extended character   is not valid in an identifier
a.cc:18:1: error: extended character   is not valid in an identifier
   18 |         for (int j=w; j>=1; j--) r[i][j]=r[i][j+1]+a[i][j];
      | ^
a.cc:18:1: error: extended character   is not valid in an identifier
a.cc:18:1: error: extended character   is not valid in an identifier
a.cc:18:1: error: extended character   is not valid in an identifier
a.cc:18:1: error: extended character   is not valid in an identifier
a.cc:18:1: error: extended character   is not valid in an identifier
a.cc:18:1: error: extended character   is not valid in an identifier
a.cc:18:1: error: extended character   is not valid in an identifier
a.cc:19:1: error: extended character   is not valid in an identifier
   19 |         for (int j=1; j<=w; j++) l[i][j]=l[i][j-1]+a[i][j];
      | ^
a.cc:19:1: error: extended character   is not valid in an identifier
a.cc:19:1: error: extended character   is not valid in an identifier
a.cc:19:1: error: extended character   is not valid in an identifier
a.cc:19:1: error: extended character   is not valid in an identifier
a.cc:19:1: error: extended character   is not valid in an identifier
a.cc:19:1: error: extended character   is not valid in an identifier
a.cc:19:1: error: extended character   is not valid in an identifier
a.cc:20:1: error: extended character   is not valid in an identifier
   20 |     }
      | ^
a.cc:20:1: error: extended character   is not valid in an identifier
a.cc:20:1: error: extended character   is not valid in an identifier
a.cc:20:1: error: extended character   is not valid in an identifier
a.cc:22:1: error: extended character   is not valid in an identifier
   22 |  
      | ^
a.cc:25:1: error: extended character   is not valid in an identifier
   25 |     for (int i=h; i>=1; i--)
      | ^
a.cc:25:1: error: extended character   is not valid in an identifier
a.cc:25:1: error: extended character   is not valid in an identifier
a.cc:25:1: error: extended character   is not valid in an identifier
a.cc:26:1: error: extended character   is not valid in an identifier
   26 |     {
      | ^
a.cc:26:1: error: extended character   is not valid in an identifier
a.cc:26:1: error: extended character   is not valid in an identifier
a.cc:26:1: error: extended character   is not valid in an identifier
a.cc:27:1: error: extended character   is not valid in an identifier
   27 |         for (int j=w+1; j>=0; j--)
      | ^
a.cc:27:1: error: extended character   is not valid in an identifier
a.cc:27:1: error: extended character   is not valid in an identifier
a.cc:27:1: error: extended character   is not valid in an identifier
a.cc:27:1: error: extended character   is not valid in an identifier
a.cc:27:1: error: extended character   is not valid in an identifier
a.cc:27:1: error: extended character   is not valid in an identifier
a.cc:27:1: error: extended character   is not valid in an identifier
a.cc:28:1: error: extended character   is not valid in an identifier
   28 |         {
      | ^
a.cc:28:1: error: extended character   is not valid in an identifier
a.cc:28:1: error: extended character   is not valid in an identifier
a.cc:28:1: error: extended character   is not valid in an identifier
a.cc:28:1: error: extended character   is not valid in an identifier
a.cc:28:1: error: extended character   is not valid in an identifier
a.cc:28:1: error: extended character   is not valid in an identifier
a.cc:28:1: error: extended character   is not valid in an identifier
a.cc:29:1: error: extended character   is not valid in an identifier
   29 |             fl[i][j]=sl[i+1][j]+l[i][j];
      | ^
a.cc:29:1: error: extended character   is not valid in an identifier
a.cc:29:1: error: extended character   is not valid in an identifier
a.cc:29:1: error: extended character   is not valid in an identifier
a.cc:29:1: error: extended character   is not valid in an identifier
a.cc:29:1: error: extended character   is not valid in an identifier
a.cc:29:1: error: extended character   is not valid in an identifier
a.cc:29:1: error: extended character   is not valid in an identifier
a.cc:29:1: error: extended character   is not valid in an identifier
a.cc:29:1: error: extended character   is not valid in an identifier
a.cc:29:1: error: extended character   is not valid in an identifier
a.cc:29:1: error: extended character   is not valid in an identifier
a.cc:30:1: error: extended character   is not valid in an identifier
   30 |             sl[i][j]=max(fl[i][j],sl[i][j+1]);
      | ^
a.cc:30:1: error: extended character   is not valid in an identifier
a.cc:30:1: error: extended character   is not valid in an identifier
a.cc:30:1: error: extended character   is not valid in an identifier
a.cc:30:1: error: extended character   is not valid in an identifier
a.cc:30:1: error: extended character   is not valid in an identifier
a.cc:30:1: error: extended character   is not valid in an identifier
a.cc:30:1: error: extended character   is not valid in an identifier
a.cc:30:1: error: extended character   is not valid in an identifier
a.cc:30:1: error: extended character   is not valid in an identifier
a.cc:30:1: error: extended character   is not valid in an identifier
a.cc:30:1: error: extended character   is not valid in an identifier
a.cc:31:1: error: extended character   is not valid in an identifier
   31 |             fr[i][j]=sr[i+1][j]+r[i][j];
      | ^
a.cc:31:1: error: extended character   is not valid in an identifier
a.cc:31:1: error: extended character   is not valid in an identifier
a.cc:31:1: error: extended character   is not valid in an identifier
a.cc:31:1: error: extended character   is not valid in an identifier
a.cc:31:1: error: extended character   is not valid in an identifier
a.cc:31:1: error: extended character   is not valid in an identifier
a.cc:31:1: error: extended character   is not valid in an identifier
a.cc:31:1: error: extended character   is not valid in an identifier
a.cc:31:1: error: extended character   is not valid in an identifier
a.cc:31:1: error: extended character   is not valid in an identifier
a.cc:31:1: error: extended character   is not valid in an identifier
a.cc:32:1: error: extended character   is not valid in an identifier
   32 |             sr[i][j]=max(fr[i][j],sr[i][j+1]);
      | ^
a.cc:32:1: error: extended character   is not valid in an identifier
a.cc:32:1: error: extended character   is not valid in an identifier
a.cc:32:1: error: extended character   is not valid in an identifier
a.cc:32:1: error: extended character   is not valid in an identifier
a.cc:32:1: error: extended character   is not valid in an identifier
a.cc:32:1: error: extended character   is not valid in an identifier
a.cc:32:1: error: extended character   is not valid in an identifier
a.cc:32:1: error: extended character   is not valid in an identifier
a.cc:32:1: error: extended character   is not valid in an identifier
a.cc:32:1: error: extended character   is not valid in an identifier
a.cc:32:1: error: extended character   is not valid in an identifier
a.cc:33:1: error: extended character   is not valid in an identifier
   33 |         }
      | ^
a.cc:33:1: error: extended character   is not valid in an identifier
a.cc:33:1: error: extended character   is not valid in an identifier
a.cc:33:1: error: extended character   is not valid in an identifier
a.cc:33:1: error: extended character   is not valid in an identifier
a.cc:33:1: error: extended character   is not valid in an identifier
a.cc:33:1: error: extended character   is not valid in an identifier
a.cc:33:1: error: extended character   is not valid in an identifier
a.cc:34:1: error: extended character   is not valid in an identifier
   34 |     }
      | ^
a.cc:34:1: error: extended character   is not valid in an identifier
a.cc:34:1: error: extended character   is not valid in an identifier
a.cc:34:1: error: extended character   is not valid in an identifier
a.cc:36:1: error: extended character   is not valid in an identifier
   36 |  
      | ^
a.cc:39:1: error: extended character   is not valid in an identifier
   39 |     Res=0;
      | ^
a.cc:39:1: error: extended character   is not valid in an identifier
a.cc:39:1: error: extended character   is not valid in an identifier
a.cc:39:1: error: extended character   is not valid in an identifier
a.cc:40:1: error: extended character   is not valid in an identifier
   40 |     int i=1, j=0;
      | ^
a.cc:40:1: error: extended character   is not valid in an identifier
a.cc:40:1: error: extended character   is not valid in an identifier
a.cc:40:1: error: extended character   is not valid in an identifier
a.cc:41:1: error: extended character   is not valid in an identifier
   41 |     while (true)
      | ^
a.cc:41:1: error: extended character   is not valid in an identifier
a.cc:41:1: error: extended character   is not valid in an identifier
a.cc:41:1: error: extended character   is not valid in an identifier
a.cc:42:1: error: extended character   is not valid in an identifier
   42 |     {
      | ^
a.cc:42:1: error: extended character   is not valid in an identifier
a.cc:42:1: er