Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair < int , int > pii;
typedef pair < LL , int > pli;
int n,m,x[80],y[80],px[80],py[80];
LL v[80];
char readch(){
	char c=getchar();
	while(c!='L' && c!='R' && c!='U' && c!='D'){
		c=getchar();
	}
	return c;
}
namespace flows{
	struct edge{
		int v,f,r;
		LL c;
		void set(int V,int F,int R,LL C){
			v=V;f=F;r=R;c=C;
		}
	}tmp;
	vector < edge > adj[1005];
	void init(){
		int i;
		for(i=0;i<1005;++i) adj[i].clear();
	}
	LL dis[1005];
	priority_queue < pli > pq;
	int predv[1005],prede[1005];
	
};
bool cmpx(int a,int b){
	return x[a]<x[b];
}
bool cmpy(int a,int b){
	return y[a]<y[b];
}
char TP[405];
int D[405],V[405];
vector < pii > consx,consy;
LL solve(int tot){
	int i,j,k;
	consx.clear();
	consy.clear();
	for(i=0;i<m;++i){
		if(TP[i]=='L')
			consx.push_back(mpr(D[i],V[i]));
		else if(TP[i]=='R' && V[i]<tot)
			consx.push_back(mpr(D[i]-1,-tot+V[i]));
		else if(TP[i]=='D')
			consy.push_back(mpr(D[i],V[i]));
		else if(TP[i]=='U' && V[i]<tot)
			consy.push_back(mpr(D[i]-1,-tot+V[i]));
	}
	sort(consx.begin(),consx.end());
	sort(consy.begin(),consy.end());
	flows::init();
	// 0: super source  1: original source  2: extra source
	flows::addedge(0,1,tot,0);
	flows::addedge(4,3,tot,0);
	int extraflow=0;
	for(i=(int)consx.size()-1;i>=0;--i){
		if(consx[i].second<0) return 0ll;
		if(!i) flows::addedge(1,6,tot,0);
		else{
			
		}
	}
}
int main(){
	int i,j,k;
	scanf("%d",&n);
	for(i=0;i<n;++i){
		scanf("%d%d%lld",x+i,y+i,v+i);
		--x[i];--y[i];
		px[i]=i;
		py[i]=i;
	}
	scanf("%d",&m);
	for(i=0;i<m;++i){
		TP[i]=readch();
		scanf("%d%d",D+i,V+i);
		--D[i];
	}
	sort(px,px+n,cmpx);
	sort(py,py+n,cmpy);
	LL res=0ll;
	for(i=0;i<=n;++i){
		UMAX(res,solve(i));
	}
	printf("%lld\n",res);
	return 0;
}

Compiler output:
a.cc: In function 'LL solve(int)':
a.cc:48:41: error: 'mpr' was not declared in this scope
   48 |                         consx.push_back(mpr(D[i],V[i]));
      |                                         ^~~
a.cc:50:41: error: 'mpr' was not declared in this scope
   50 |                         consx.push_back(mpr(D[i]-1,-tot+V[i]));
      |                                         ^~~
a.cc:52:41: error: 'mpr' was not declared in this scope
   52 |                         consy.push_back(mpr(D[i],V[i]));
      |                                         ^~~
a.cc:54:41: error: 'mpr' was not declared in this scope
   54 |                         consy.push_back(mpr(D[i]-1,-tot+V[i]));
      |                                         ^~~
a.cc:60:16: error: 'addedge' is not a member of 'flows'; did you mean 'edge'?
   60 |         flows::addedge(0,1,tot,0);
      |                ^~~~~~~
      |                edge
a.cc:61:16: error: 'addedge' is not a member of 'flows'; did you mean 'edge'?
   61 |         flows::addedge(4,3,tot,0);
      |                ^~~~~~~
      |                edge
a.cc:65:31: error: 'addedge' is not a member of 'flows'; did you mean 'edge'?
   65 |                 if(!i) flows::addedge(1,6,tot,0);
      |                               ^~~~~~~
      |                               edge
a.cc: In function 'int main()':
a.cc:90:17: error: 'UMAX' was not declared in this scope
   90 |                 UMAX(res,solve(i));
      |                 ^~~~
a.cc: In function 'LL solve(int)':
a.cc:70:1: warning: control reaches end of non-void function [-Wreturn-type]
   70 | }
      | ^