Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define MOD 998244353
#define INF (1<<29)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

P poInts[216000];
Int n;

Int bit[216000];
void init(){
    fill(bit, bit + 216000, 0);
}

Int get_sum(Int pos){
    if(pos < 0)return 0;
    pos++;
    Int sum = 0;
    while(pos){
        sum += bit[pos];
        pos -= pos & -pos;
    }
    return sum;
}

void add_val(Int pos, Int val){
    pos++;
    while(pos < 216000){
        bit[pos] += val;
        pos += pos & -pos;
    }
}

Int mod_pow(Int x, Int a, Int m = MOD){
    if(a == 0)return 1;
    Int res = mod_pow(x, a / 2, m);
    res = res * res % m;
    if(a % 2)res *= x;
    return res % m;
}

Int inv(Int x, Int m = MOD){
    return mod_pow(x, m-2, m);
}


vector<Int> xs, ys;

Int main(){
    cin >> n;
    for(Int i = 0;i < n;i++){
        cin >> poInts[i].first >> poInts[i].second;
        xs.push_back(poInts[i].first);
        ys.push_back(poInts[i].second);
    }
    sort(xs.begin(), xs.end());
    xs.erase(unique(xs.begin(), xs.end()), xs.end());
    sort(ys.begin(), ys.end());
    ys.erase(unique(ys.begin(), ys.end()), ys.end());
    for(Int i = 0;i < n;i++){
        poInts[i].first = lower_bound(xs.begin(), xs.end(), poInts[i].first) - xs.begin();
        poInts[i].second = lower_bound(ys.begin(), ys.end(), poInts[i].second) - ys.begin();
    }
    xs.clear();
    ys.clear();
    for(Int i = 0;i < n;i++){
        xs.push_back(poInts[i].first);
        ys.push_back(poInts[i].second);
    }
    sort(xs.begin(), xs.end());
    sort(ys.begin(), ys.end());

    Int sum = mod_pow(2, n) - 1;
    sum *= n;sum %= MOD;
    sort(poInts, poInts + n);
    for(Int i = 0;i < n;i++){
        Int x = poInts[i].first, y = poInts[i].second;
        Int l = lower_bound(xs.begin(), xs.end(), x) - xs.begin();
        Int r = xs.end() - upper_bound(xs.begin(), xs.end(), x);
        Int u = lower_bound(ys.begin(), ys.end(), y) - ys.begin();
        Int d = ys.end() - upper_bound(ys.begin(), ys.end(), y);
        sum -= mod_pow(2, l) - 1;sum %= MOD;
        sum -= mod_pow(2, r) - 1;sum %= MOD;
        sum -= mod_pow(2, u) - 1;sum %= MOD;
        sum -= mod_pow(2, d) - 1;sum %= MOD;
//        cout << i << ":" << l << " "<< r << " " << u << " " << d << endl;
    }

    init();
    for(Int i = 0;i < n;i++){
        Int x = poInts[i].first, y = poInts[i].second;
        Int ld = get_sum(y-1);
        Int lu = i - get_sum(y);
        sum += pow(2, ld) - 1;sum %= MOD;
        sum += pow(2, lu) - 1;sum %= MOD;
        add_val(y, 1);
        
//        cout << i << ":" << lu << " "<< ld << endl;
    }
    
    init();
    for(Int i = 0;i < n;i++){
        Int x = poInts[n-i-1].first, y = poInts[n-i-1].second;
        Int ld = get_sum(y-1);
        Int lu = i - get_sum(y);
        sum += pow(2, ld) - 1;sum %= MOD;
        sum += pow(2, lu) - 1;sum %= MOD;
        add_val(y, 1);
//        cout << i << ":" << lu << " "<< ld << endl;
    }
    if(sum < 0)sum += MOD;
    cout << sum << endl;
    return 0;
}


Compiler output:
a.cc:61:1: error: '::main' must return 'int'
   61 | Int main(){
      | ^~~