Language: C++

#include<bits/stdc++.h>
using namespace std;
#define N 1000005
int tot,last[N],to[N],Next[N],flow[N];
long long val[N],dis[N];
int e[N],q[10000005],S,T,Lx[N],Rx[N],Ly[N],Ry[N];
int X[N],Y[N],n,m,pre[N];
struct node {
  	int id,x,y;
}b[N],A[N];
struct pa {
  	int x;
  	long long y;
}a[N];
inline void add(int x,int y,int f,long long v) {
  Next[++tot]=last[x]; last[x]=tot; to[tot]=y; flow[tot]=f; val[tot]=v;
}
#define inf 1000000000000000000ll
inline bool spfa() {
  	for (int i=S;i<=T;i++) dis[i]=inf,e[i]=0;
  	dis[S]=0; e[S]=1;
  	int l=0,r=1; q[1]=S;
  	while (l<r) {
      	int k=q[++l];
      	for (int i=last[k];i;i=Next[i]) {
          	if (!flow[i]||dis[to[i]]<=dis[S]+val[i]) continue;
          	dis[to[i]]=dis[S]+val[i];
          	pre[to[i]]=i;
          	if (!e[to[i]]) e[q[++r]=to[i]]=1;
        }
      	e[k]=0;
    }
  	return dis[T]!=inf;
}
inline long long dinic(int y) {
  	long long ans=0;
  	int s=0;
  	while (spfa()) {
      	s++;
      	for (int x=T;x!=S;x=to[pre[x]^1]) flow[pre[x]]--,flow[pre[x]^1]++,ans+=val[pre[x]];
    }
  	if (s!=y) return 0;
  	return ans;
}
inline long long work(int x) {
  for (int i=1;i<=m;i++) if (b[i].id&1) A[i]=b[i];
  else A[i]=node{b[i].id,x-b[i].x,b[i].y+1};
  for (int i=1;i<=x;i++) X[i]=2*n+i,Y[i]=2*n+i+x;
  S=0,T=Y[x]+1;
  for (int i=S;i<=T;i++) last[i]=0;
  tot=1;
  for (int i=1;i<=x;i++) Lx[i]=Ly[i]=1,Rx[i]=Ry[i]=100;
  for (int i=1;i<=m;i++) {
    if (A[i].id==1) Lx[A[i].x+1]=max(Lx[A[i].x+1],A[i].y+1);
    else if (A[i].id==2) Rx[A[i].x]=min(Rx[A[i].x],A[i].y);
    else if (A[i].id==3) Ly[A[i].x+1]=max(Ly[A[i].x+1],A[i].y+1);
    else Ry[A[i].x]=min(Ry[A[i].x],A[i].y);
  }
  for (int i=1;i<=x;i++) Lx[i]=max(Lx[i],Lx[i-1]),Ly[i]=max(Ly[i],Ly[i-1]);
  for (int i=x-1;i;i--) Rx[i]=min(Rx[i],Rx[i+1]),Ry[i]=min(Ry[i],Ry[i+1]);
  for (int i=1;i<=x;i++) if (Lx[i]>Rx[i]) return false;
  for (int i=1;i<=x;i++) add(S,X[i],1,0),add(X[i],S,0,0),add(Y[i],T,1,0),add(T,Y[i],0,0);
  for (int i=1;i<=x;i++) 
  for (int j=1;j<=n;j++) {
    	if (a[j].x>=Lx[i]&&a[j].x<=Rx[i]) add(X[i],j,1,0),add(j,X[i],0,0);
    	if (a[j].y>=Ly[i]&&a[j].y<=Ry[i]) add(j+n,Y[i],1,0),add(Y[i],j+n,0,0);
  }
  for (int i=1;i<=n;i++) add(i,i+n,1,a[i].y),add(i+n,i,0,-a[i].y);
  return dinic(x);
}
char c[15];
int main() {
  scanf("%d",&n);
  for (int i=1;i<=n;i++) scanf("%d%lld",&a[i].x,&a[i].y);
  scanf("%d",&m);
  for (int i=1;i<=m;i++) {
    	scanf("%s",c);
    	scanf("%d%d",&b[i].x,&b[i].y);
    	if (c=='L') b[i].id=1;
    	if (c=='R') b[i].id=2;
    	if (c=='D') b[i].id=3;
    	if (c=='U') b[i].id=4;
  }
  long long ans=0;
  for (int i=1;i<=n;i++) ans=max(ans,work(i));
  printf("%lld\n",ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:79:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   79 |         if (c=='L') b[i].id=1;
      |             ~^~~~~
a.cc:80:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   80 |         if (c=='R') b[i].id=2;
      |             ~^~~~~
a.cc:81:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   81 |         if (c=='D') b[i].id=3;
      |             ~^~~~~
a.cc:82:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   82 |         if (c=='U') b[i].id=4;
      |             ~^~~~~