Language: C++

#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
lint inf=1001001001;
vector<lint> x,y;
int xn,yn;
lint a[1010],b[1010],c[1010],d[1010],e[1010],f[1010];
bool xb[4010][4010],yb[4010][4010],sumi[4010][4010];
void dfs(int u,int v){
	sumi[u][v]=true;
	//cout<<"("<<x[u]<<","<<y[v]<<")-("<<x[u+1]<<","<<y[v+1]<<")"<<endl;
	if(u>0 && !xb[u][v] && !sumi[u-1][v]) dfs(u-1,v);
	if(v>0 && !yb[u][v] && !sumi[u][v-1]) dfs(u,v-1);
	if(u<xn-2 && !xb[u+1][v] && !sumi[u+1][v]) dfs(u+1,v);
	if(v<yn-2 && !yb[u][v+1] && !sumi[u][v+1]) dfs(u,v+1);
}
int main()
{
	int n,m;
	x.pb(0);y.pb(0);x.pb(inf);y.pb(inf);x.pb(-inf);y.pb(-inf);
	cin>>n>>m;
	rep(i,n){
		cin>>a[i]>>b[i]>>c[i];
		x.pb(a[i]);x.pb(b[i]);y.pb(c[i]);
	}
	rep(i,m){
		cin>>d[i]>>e[i]>>f[i];
		x.pb(d[i]);y.pb(e[i]);y.pb(f[i]);
	}
	sort(All(x));x.erase(unique(All(x)),x.end());
	sort(All(y));y.erase(unique(All(y)),y.end());
	xn=x.size();yn=y.size();
	memset(xb,false,sizeof(xb));
	memset(yb,false,sizeof(yb));
	rep(i,n){
		int xs=lower_bound(All(x),a[i])-x.begin();
		int xg=lower_bound(All(x),b[i])-x.begin();
		int ys=lower_bound(All(y),c[i])-y.begin();
		REP(j,xs,xg) yb[j][ys]=true;
	}
	rep(i,m){
		int ys=lower_bound(All(y),e[i])-y.begin();
		int yg=lower_bound(All(y),f[i])-y.begin();
		int xs=lower_bound(All(x),d[i])-x.begin();
		REP(j,ys,yg) xb[xs][j]=true;
	}
	memset(sumi,false,sizeof(sumi));
	dfs(lower_bound(All(x),0L)-x.begin(),lower_bound(All(y),0L)-y.begin());
	lint out=0;
	rep(i,xn-1) rep(j,yn-1){
		if(sumi[i][j]) out+=(x[i+1]-x[i])*(y[j+1]-y[j]);
	}
	if(out>=inf*inf) cout<<"INF"<<endl;
	else cout<<out<<endl;
}


Compiler output:
a.cc:39:8: error: 'int yn' redeclared as different kind of entity
   39 | int xn,yn;
      |        ^~
In file included from /usr/include/features.h:523,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
                 from /usr/include/c++/14/bits/requires_hosted.h:31,
                 from /usr/include/c++/14/vector:60,
                 from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:258:1: note: previous declaration 'double yn(int, double)'
  258 | __MATHCALL (yn,, (int, _Mdouble_));
      | ^~~~~~~~~~
a.cc: In function 'void dfs(int, int)':
a.cc:48:16: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   48 |         if(v<yn-2 && !yb[u][v+1] && !sumi[u][v+1]) dfs(u,v+1);
      |              ~~^~
a.cc:48:13: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   48 |         if(v<yn-2 && !yb[u][v+1] && !sumi[u][v+1]) dfs(u,v+1);
      |            ~^~~~~
a.cc: In function 'int main()':
a.cc:65:23: error: assignment of function 'double yn(int, double)'
   65 |         xn=x.size();yn=y.size();
      |                     ~~^~~~~~~~~
a.cc:83:29: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   83 |         rep(i,xn-1) rep(j,yn-1){
      |                           ~~^~
a.cc:32:34: note: in definition of macro 'REP'
   32 | #define REP(i,a,b) for(int i=a;i<b;i++)
      |                                  ^
a.cc:83:21: note: in expansion of macro 'rep'
   83 |         rep(i,xn-1) rep(j,yn-1){
      |                     ^~~
a.cc:32:33: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   32 | #define REP(i,a,b) for(int i=a;i<b;i++)
      |                                 ^
a.cc:33:18: note: in expansion of macro 'REP'
   33 | #define rep(i,n) REP(i,0,n)
      |                  ^~~
a.cc:83:21: note: in expansion of macro 'rep'
   83 |         rep(i,xn-1) rep(j,yn-1){
      |                     ^~~