Language: C++

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <cmath>

using namespace std;

typedef pair<int,int> P;
typedef pair<P,P> PP;

vector<P> xys;
vector<P> yxs;
set<P> visited;

P rev(P s) {
    return P(s.second, s.first);
}

int main(void) {
    int n,a,b;
    scanf("%d%d%d", &n, &a, &b);

    for(int i=0; i<n; i++) {
        int x,y;
        scanf("%d%d", &x, &y);
        xys.push_back( P(x+y, x-y) );
        yxs.push_back( P(x-y, x+y) );
    }
    P axy = xys[a-1];
    P bxy = xys[b-1];
    int dis = max( abs(axy.first - bxy.first), abs(axy.second - bxy.second) );

    sort(begin(xys), end(xys));
    sort(begin(yxs), end(yxs));

    queue<P> q;
    q.push( axy );
    visited.insert( axy );

    int res=0;
    while(!q.empty()) {
        P fir = q.front(); q.pop();
        auto ub = upper_bound( xys.begin(), xys.end(), P( fir.first - dis, fir.second + dis));
        for(auto p = lower_bound( xys.begin(), xys.end(), P( fir.first - dis, fir.second - dis ));
                p != ub;
                p++) {
            res++;
            if(visited.insert((*p)).second)
                q.push((*p));
           }
        }
        ub = upper_bound( yxs.begin(), yxs.end(), P( fir.second - dis, fir.first + dis - 1));
        for(auto p = lower_bound( yxs.begin(), yxs.end(), P( fir.second - dis, fir.first - dis + 1));
                p != ub;
                p++) {
            res++;
            if(visited.insert(rev(*p)).second)
                q.push(rev(*p));
           }
        }
        ub = upper_bound( xys.begin(), xys.end(), P( fir.first + dis, fir.second + dis));
        for(auto p = lower_bound( xys.begin(), xys.end(), P( fir.first + dis, fir.second - dis ));
                p != ub;
                p++) {
               res++;
            if(visited.insert((*p)).second)
                q.push((*p));
           }
        }
        ub =  upper_bound( yxs.begin(), yxs.end(), P( fir.second + dis, fir.first + dis - 1));
        for(auto p = lower_bound( yxs.begin(), yxs.end(), P( fir.second + dis, fir.first - dis + 1));
                p != ub;
                p++) {
               res++;
            if(visited.insert(rev(*p)).second)
                q.push(rev(*p));
           }
        }
    }
    printf("%d\n", res/2);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:56:9: error: 'ub' was not declared in this scope; did you mean 'b'?
   56 |         ub = upper_bound( yxs.begin(), yxs.end(), P( fir.second - dis, fir.first + dis - 1));
      |         ^~
      |         b
a.cc:56:54: error: 'fir' was not declared in this scope
   56 |         ub = upper_bound( yxs.begin(), yxs.end(), P( fir.second - dis, fir.first + dis - 1));
      |                                                      ^~~
a.cc: At global scope:
a.cc:65:9: error: 'ub' does not name a type
   65 |         ub = upper_bound( xys.begin(), xys.end(), P( fir.first + dis, fir.second + dis));
      |         ^~
a.cc:66:9: error: expected unqualified-id before 'for'
   66 |         for(auto p = lower_bound( xys.begin(), xys.end(), P( fir.first + dis, fir.second - dis ));
      |         ^~~
a.cc:67:17: error: 'p' does not name a type
   67 |                 p != ub;
      |                 ^
a.cc:68:17: error: 'p' does not name a type
   68 |                 p++) {
      |                 ^
a.cc:73:9: error: expected declaration before '}' token
   73 |         }
      |         ^
a.cc:74:9: error: 'ub' does not name a type
   74 |         ub =  upper_bound( yxs.begin(), yxs.end(), P( fir.second + dis, fir.first + dis - 1));
      |         ^~
a.cc:75:9: error: expected unqualified-id before 'for'
   75 |         for(auto p = lower_bound( yxs.begin(), yxs.end(), P( fir.second + dis, fir.first - dis + 1));
      |         ^~~
a.cc:76:17: error: 'p' does not name a type
   76 |                 p != ub;
      |                 ^
a.cc:77:17: error: 'p' does not name a type
   77 |                 p++) {
      |                 ^
a.cc:82:9: error: expected declaration before '}' token
   82 |         }
      |         ^
a.cc:83:5: error: expected declaration before '}' token
   83 |     }
      |     ^
a.cc:84:11: error: expected constructor, destructor, or type conversion before '(' token
   84 |     printf("%d\n", res/2);
      |           ^
a.cc:85:5: error: expected unqualified-id before 'return'
   85 |     return 0;
      |     ^~~~~~
a.cc:86:1: error: expected declaration before '}' token
   86 | }
      | ^