Language: C++

#include<cstdio>
#include<cstring>
#include<cctype>
#include<vector>
#include<set>
#include<algorithm>
#define maxn 100005
#define LL long long
using namespace std;

vector<LL>W[maxn],H[maxn];
LL n,x[maxn],y[maxn],sa[maxn],sb[maxn],Q[maxn],L,R;
LL ans=0;
bool usd[maxn];

struct node
{
    LL num,id;
    node(LL a=0,LL b=0):num(a),id(b){}
    bool operator <(const node &nxt)const
    {
        return num < nxt.num;
    }
};
set<node>w[maxn],h[maxn];

void checkw(LL x,LL up,LL dn)
{
    if(up<=dn && x == *lower_bound(sa+1,sa+1+sa[0],x))
    {
        x=lower_bound(sa+1,sa+1+sa[0],x)-sa;
        multiset<node>::iterator it = w[x] . upper_bound(node(up-1,0)) , it2;
        for(;it!=w[x].end() && (*it).num <= dn;)
        {
             Q[R++] = (*it).id;
            usd[(*it).id]=1;
            it2=it,it++;
            h[y[(*it2).id]].erase(node(sb[y[(*it2).id]] , (*it2).id));
            w[x].erase(it2);
        }
    }
}

void checkW(LL x,LL up,LL dn)
{
    if(up<=dn && x == *lower_bound(sa+1,sa+1+sa[0],x))
    {
        x=lower_bound(sa+1,sa+1+sa[0],x)-sa;
        ans+=upper_bound(W[x].begin(),W[x].end(),dn) - lower_bound(W[x].begin(),W[x].end(),up);
    }
}

void checkh(LL y,LL up,LL dn)
{
    if(up<=dn && y == *lower_bound(sb+1,sb+1+sb[0],y))
    {
        y=lower_bound(sb+1,sb+1+sb[0],y)-sb;
        set<node>::iterator it = h[y] . upper_bound(node(up-1,0)) , it2;
        for(;it!=h[y].end() && (*it).num <= dn;)
        {
            Q[R++] = (*it).id;
            usd[(*it).id]=1;
            it2=it,it++;
            w[x[(*it2).id]].erase(node(sa[x[(*it2).id]] , (*it2).id));
            h[y].erase(it2);
        }
    }
}

void checkH(LL y,LL up,LL dn)
{
    if(up<=dn && y == *lower_bound(sb+1,sb+1+sb[0],y))
    {
        y=lower_bound(sb+1,sb+1+sb[0],y)-sb;
        ans+=upper_bound(H[y].begin(),H[y].end(),dn) - lower_bound(H[y].begin(),H[y].end(),up);
    }
}


int main()
{
    LL a,b,u,v,tmp;
    scanf("%lld%lld%lld",&n,&a,&b);
    for(LL i=1;i<=n;i++) scanf("%lld%lld",&u,&v),x[i]=u+v,y[i]=u-v,sa[++sa[0]]=x[i],sb[++sb[0]]=y[i];
    tmp = max(abs(x[a] - x[b]) , abs(y[a] - y[b]));
    sort(sa+1,sa+1+sa[0]),sort(sb+1,sb+1+sb[0]);
    sa[0] = unique(sa+1,sa+1+sa[0]) - sa - 1,
    sb[0] = unique(sb+1,sb+1+sb[0]) - sb - 1;
    for(LL i=1;i<=n;i++)
    {
        x[i] = lower_bound(sa+1,sa+1+sa[0],x[i]) - sa;
        y[i] = lower_bound(sb+1,sb+1+sb[0],y[i]) - sb;
        w[x[i]].insert(node(sb[y[i]],i));
        h[y[i]].insert(node(sa[x[i]],i));
        W[x[i]].push_back(sb[y[i]]);
        H[y[i]].push_back(sa[x[i]]);
    }

    for(LL i=1;i<=sa[0];i++)
    {
        w[i].Insert(10000000000ll);
        w[i].Insert(-10000000000ll);
        W[i].push_back(-10000000000ll);
        W[i].push_back(10000000000ll);
        sort(W[i].begin(),W[i].end());
    }
    for(LL i=1;i<=sb[0];i++)
    {
        h[i].Insert(10000000000ll);
        h[i].Insert(-10000000000ll);
        H[i].push_back(-10000000000ll);
        H[i].push_back(10000000000ll);
        sort(H[i].begin(),H[i].end());
    }

    usd[a] = usd[b] = 1;
    Q[R++] = a,Q[R++] = b;
    w[x[a]].erase(node(sb[y[a]],a));
    w[x[b]].erase(node(sb[y[b]],b));
    h[y[a]].erase(node(sa[x[a]],a));
    h[y[b]].erase(node(sa[x[b]],b));
    for(;L<R;)
    {
        LL r=Q[L++];
        checkw(sa[x[r]] - tmp , sb[y[r]] - tmp  , sb[y[r]] + tmp);
        checkw(sa[x[r]] + tmp , sb[y[r]] - tmp  , sb[y[r]] + tmp);
        checkh(sb[y[r]] - tmp , sa[x[r]] - tmp  , sa[x[r]] + tmp);
        checkh(sb[y[r]] + tmp , sa[x[r]] - tmp  , sa[x[r]] + tmp);
    }

    for(LL i=1;i<=n;i++)
        if(usd[i])
        {
            checkW(sa[x[i]] - tmp , sb[y[i]] - tmp + 1 , sb[y[i]] + tmp);
            checkW(sa[x[i]] + tmp , sb[y[i]] - tmp + 1 , sb[y[i]] + tmp);
            checkH(sb[y[i]] - tmp , sa[x[i]] - tmp , sa[x[i]] + tmp);
            checkH(sb[y[i]] + tmp , sa[x[i]] - tmp + 1 , sa[x[i]] + tmp - 1);
        }

    printf("%lld\n",ans/2);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:101:14: error: 'class std::set<node>' has no member named 'Insert'; did you mean 'insert'?
  101 |         w[i].Insert(10000000000ll);
      |              ^~~~~~
      |              insert
a.cc:102:14: error: 'class std::set<node>' has no member named 'Insert'; did you mean 'insert'?
  102 |         w[i].Insert(-10000000000ll);
      |              ^~~~~~
      |              insert
a.cc:109:14: error: 'class std::set<node>' has no member named 'Insert'; did you mean 'insert'?
  109 |         h[i].Insert(10000000000ll);
      |              ^~~~~~
      |              insert
a.cc:110:14: error: 'class std::set<node>' has no member named 'Insert'; did you mean 'insert'?
  110 |         h[i].Insert(-10000000000ll);
      |              ^~~~~~
      |              insert