Language: C++

#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int n,x[N],sa[N],rank[N];
bool cmp(int a,int b){return x[a]<x[b];}
int cnt,inv[N];
vector<int> e[N];
struct segment_tree{
	int id[N];
	#define lc x<<1
	#define rc x<<1|1
	void init(int x,int l,int r,bool tp){
		if (l==r) return void(id[x]=(tp?inv[l]:l));
		int mid=(l+r)>>1;
		init(lc,l,mid,tp);
		init(rc,mid+1,r,tp);
		id[x]=++cnt;
		if (tp){
			e[id[x]].push_back(id[lc]);
			e[id[x]].push_back(id[rc]);
		}
		else{
			e[id[lc]].push_back(id[x]);
			e[id[rc]].push_back(id[x]);
		}
	}
	void addedge(int x,int l,int r,int L,int R,int p,bool tp){
		if (l>=L&&r<=R){
			if (tp) e[p].push_back(id[x]);
			else e[id[x]].push_back(p);
			return;
		}
		int mid=(l+r)>>1;
		if (L<=mid) addedge(lc,l,mid,L,R,p,tp);
		if (R>mid) addedge(rc,mid+1,r,L,R,p,tp);
	}
}T1,T2;
int dfn[N],low[N],scc[N],sta[N],top;
bool ins[N];
void tarjan(int x){
	static int cnt=0;
	dfn[x]=low[x]=++cnt;
	ins[sta[++top]=x]=1;
	for (int i=0;i<e[x].size();i++){
		int v=e[x][i];
		if (!dfn[v]) tarjan(v),low[x]=min(low[x],low[v]);else
		if (ins[v]) low[x]=min(low[x],dfn[v]);
	}
	if (low[x]==dfn[x]){
		while (sta[top]!=x) scc[sta[top]]=x,ins[sta[top--]]=0;
		scc[x]=x;ins[x]=0;top--;
	}
}
bool check(int ans){
	for (int i=1;i<=cnt;i++) e[i].clear();
	cnt=n+n;
	T1.init(1,1,n+n,0);
	T2.init(1,1,n+n,1);
	for (int i=1;i<=cnt;i++) dfn[i]=0;
	for (int i=1,l=1,r=1;i<=n+n;i++){
		while (x[sa[l]]<=x[sa[i]]-ans) l++;
		while (r<n+n&&x[sa[r+1]]<x[sa[i]]+ans) r++;
		if (l<i){
			T1.addedge(1,1,n+n,l,i-1,inv[i],0);
			T2.addedge(1,1,n+n,l,i-1,i,1);
		}
		if (i<r){
			T1.addedge(1,1,n+n,i+1,r,inv[i],0);
			T2.addedge(1,1,n+n,i+1,r,i,1);
		}
	}
	for (int i=1;i<=cnt;i++)
		if (!dfn[i]) tarjan(i);
	for (int i=1;i<=n+n;i++)
		if (scc[i]==scc[inv[i]]) return 0;
	return 1;
}
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d%d",&x[i],&x[i+n]);
	for (int i=1;i<=n+n;i++) sa[i]=i;
	sort(sa+1,sa+n+n+1,cmp);
	for (int i=1;i<=n+n;i++) rank[sa[i]]=i;
	for (int i=1;i<=n;i++) inv[rank[i]]=rank[i+n],inv[rank[i+n]]=rank[i];
	int l=0,r=1e9;
	while (l<r){
		int mid=(l+r)>>1;
		if (check(mid+1)) l=mid+1;else r=mid;
	}
	printf("%d\n",l);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:84:34: error: reference to 'rank' is ambiguous
   84 |         for (int i=1;i<=n+n;i++) rank[sa[i]]=i;
      |                                  ^~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
                 from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:4:18: note:                 'int rank [100010]'
    4 | int n,x[N],sa[N],rank[N];
      |                  ^~~~
a.cc:85:36: error: reference to 'rank' is ambiguous
   85 |         for (int i=1;i<=n;i++) inv[rank[i]]=rank[i+n],inv[rank[i+n]]=rank[i];
      |                                    ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:4:18: note:                 'int rank [100010]'
    4 | int n,x[N],sa[N],rank[N];
      |                  ^~~~
a.cc:85:45: error: reference to 'rank' is ambiguous
   85 |         for (int i=1;i<=n;i++) inv[rank[i]]=rank[i+n],inv[rank[i+n]]=rank[i];
      |                                             ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:4:18: note:                 'int rank [100010]'
    4 | int n,x[N],sa[N],rank[N];
      |                  ^~~~
a.cc:85:59: error: reference to 'rank' is ambiguous
   85 |         for (int i=1;i<=n;i++) inv[rank[i]]=rank[i+n],inv[rank[i+n]]=rank[i];
      |                                                           ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:4:18: note:                 'int rank [100010]'
    4 | int n,x[N],sa[N],rank[N];
      |                  ^~~~
a.cc:85:70: error: reference to 'rank' is ambiguous
   85 |         for (int i=1;i<=n;i++) inv[rank[i]]=rank[i+n],inv[rank[i+n]]=rank[i];
      |                                                                      ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:4:18: note:                 'int rank [100010]'
    4 | int n,x[N],sa[N],rank[N];
      |                  ^~~~