Language: C++

//各点iの上下左右にある点の数を考えれば、点iが内部に含まれるような部分集合の個数が求めれられる
//平面走査 (line sweep)
//BIT or segment tree
#include <iostream>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
using namespace std;
static const int mod = 99824435;
typedef long long ll;
typedef pair<int, int> P;
struct mint{
  ll x;
  mint(ll x=0):x(x%mod){}
  mint& operator+=(const mint a){
    if ((x += a.x) >= mod) {
      x -= mod;
    }
    return *this;
  }

  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) {
      x -= mod;
    }
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) { return 1;}
    mint a = pow(t>>1);
    a *= a;
    if (t&1) {a *= *this; }
    return a;
  }
  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a){
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

template<typename T>

struct BIT {
  int n;
  vector<T> d;
  BIT(int n=0):n(n), d(n+1){}
  void add(int i, T x=1) {
    for (i++; i <= n; i+=i&-i) {
      d[i]+=x;
    }
  }
  T sum(int i){
    T x = 0;
    for (i++; i; i -= i&-i) {
      x += d[i];
    }
    return x;
  }
};

mint f(int a, int b, int c, int d){
  mint res = 0;
  vector<int> num = {a, b, c, d};
  vector<mint> o(4), ox(4);
  for (int i = 0; i < 4; i++) {
    ox[i] = mint(2).pow(num[i]);
    o[i] = ox[i] - 1;
  }

  res += ox[0]*o[1]*o[2]*ox[3];
  res += o[0]*ox[1]*ox[2]*o[3];
  res -= o[0]*o[1]*o[2]*o[3];
  res += ox[0]*ox[1]*ox[2]*ox[3];

  return res;
}

int main() {
  int n;
  cin >> n;
  vector<P> p(n);

  for (int i = 0; i < n; i++) {
    cin >> p[i].first >> p[i].second;
  }

  {//compress x
    map<int, int> mp;
    for (int i = 0; i < n; i++) {
      mp[p[i].first] = 0;
    }
    int j = 0;
    for (auto&& x : mp) {
      x.second = j++;
    }
    for (int i = 0; i < n; i++) {
      p[i].first = mp[p[i].first];
    }
  }

  {//compress y
    map<int, int> mp;
    for (int i = 0; i < n; i++) {
      mp[p[i].second] = 0;
    }
    int j = 0;
    for (auto&& x : mp) {
      x.second = j++;
    }
    for (int i = 0; i < n; i++) {
      p[i].second = mp[p[i].second];
    }
  }

  sort(p.begin(), p.end(), cmp);

  vector<int> a(n);
  vector<int> b(n);
  vector<int> c(n);
  vector<int> d(n);

  for (int _ = 0; _<2; _++) {
    {//calc a, b
      BIT<int> bit(n);
      for (int i=0;i<n;i++){
        a[i] = bit.sum(p[i].second);
        b[i] = i - a[i];
        bit.add(p[i].second);
      }
    }
    reverse(p.begin(), p.end());
    swap(a, c);
    swap(b, d);
    reverse(a.begin(), a.end());
    reverse(b.begin(), b.end());
    reverse(c.begin(), c.end());
    reverse(d.begin(), d.end());
  }
  mint ans = 0;
  for (int i = 0; i < n; i++) {
    ans += f(a[i], b[i], c[i], d[i]);
  }
  cout << ans.x << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:140:28: error: 'cmp' was not declared in this scope
  140 |   sort(p.begin(), p.end(), cmp);
      |                            ^~~