Language: C++

#include "IntMod.h"
typedef IntMod<1000000007> MInt;

//#include "Union_Find.h"

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <list>
#include <bitset>

using namespace std;
#define REP(i,a,n) for(int i = (a); i < (int)(n); ++i)
#define REPM(i,n,a) for(int i = ((n) - 1); i >= (a); --i)
#define EPS 0.0001
#define INF 0x3FFFFFFF
#define INFLL 0x3FFFFFFF3FFFFFFF
#define INFD 1.0e+308
#define FLOAT setprecision(16)
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> PP;

template <class T, class U>
istream& operator>>(istream& ist, pair<T, U>& right) { return ist >> right.first >> right.second; }
template <class T, class U>
ostream& operator<<(ostream& ost, pair<T, U>& right) { return ost << right.first << ' ' << right.second; }
template <class T, class TCompatible, size_t N>
void Fill(T(&dest)[N], const TCompatible& val) { fill(begin(dest), end(dest), val); }
template <class T, class TCompatible, size_t M, size_t N>
void Fill(T(&dest)[M][N], const TCompatible& val) { for (int i = 0; i < M; ++i) Fill(dest[i], val); }
//sum, 累積和
// 負のときの割り算に注意
#if 1
#include <array>
#include <unordered_set>
#include <unordered_map>
template<class T>
using PriorityQ = priority_queue<T, vector<T>, greater<T> >;	// コスト小を優先
#endif

struct CompBySecond {
	bool operator()(const PP& a, const PP& b) const {
		return a.second < b.second || (a.second == b.second && a.first < b.first);
	}
};

template<class T>
class Array {
	T* ptr_m;
	size_t size_m;
};

//#include "Union_Find.h"

int N, K, A, B;
PP S;
set<PP> XS;
set<PP, CompBySecond> YS;
PP X[100001];
PP Y[100001];
bool used[100001];

queue<PP> Q;

void sub(set<PP>::iterator lit, set<PP>::iterator rit, bool x) {
	for (auto it = lit; it != rit; ++it) {
		x ? YS.erase(*it) : XS.erase(*it);
		Q.push(*it);
	}
	x ? XS.erase(lit, rit) : YS.erase(lit, rit);
}

int solve() {
	Q.push(S);
	while (!Q.empty()) {
		PP p = Q.front(); Q.pop();
		LL l = p.first - K, r = p.first + K, d = p.second - K, u = p.second + K;
		PP ld = PP(l, d), lu = PP(l, u), rd = PP(r, d), ru = PP(r, u);
		sub(XS.lower_bound(ld), XS.upper_bound(lu), true);
		sub(XS.lower_bound(rd), XS.upper_bound(ru), true);
		sub(YS.upper_bound(ld), YS.lower_bound(rd), false);
		sub(YS.upper_bound(lu), YS.lower_bound(ru), false);
	}

	Fill(used, true);
	for (PP p : XS) {
		used[find(X, X + N, p) - X] = false;
	}

	LL count = 0;
	REP(i, 0, N) {
		if (!used[i]) continue;
		PP p = X[i];
		LL l = p.first - K, r = p.first + K, d = p.second - K, u = p.second + K;
		count += upper_bound(X, X + N, PP(l, u)) - lower_bound(X, X + N, PP(l, d));
		count += upper_bound(X, X + N, PP(r, u)) - lower_bound(X, X + N, PP(r, d));
		count += lower_bound(Y, Y + N, PP(r, d), CompBySecond()) - upper_bound(Y, Y + N, PP(l, d), CompBySecond());
		count += lower_bound(Y, Y + N, PP(r, u), CompBySecond()) - upper_bound(Y, Y + N, PP(l, u), CompBySecond());
	}
	return count / 2;
}

int main() {
	cin >> N >> A >> B;
	--A; --B;
	REP(i, 0, N) {
		int x, y;
		cin >> x >> y;
		PP p{ x + y, x - y };
		X[i] = Y[i] = p;
		XS.insert(p);
		YS.insert(p);
	}
	S = X[A];
	K = max(abs(X[A].first - X[B].first), abs(X[A].second - X[B].second));
	sort(X, X + N);
	sort(Y, Y + N, CompBySecond());
	cout << solve() << endl;
	return 0;
}

Compiler output:
a.cc:1:10: fatal error: IntMod.h: No such file or directory
    1 | #include "IntMod.h"
      |          ^~~~~~~~~~
compilation terminated.