func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 10;   int n, m;   int cnt1[N], cnt2[N];   struct Fenwick_tree {     vector<long long> t;     int n;     void init(int _n) {       n = _n;       t.assign(n + 1, 0);     }     void add(int r, int x) {       for (; r <= n; r = (r | (r + 1))) t[r] += 1LL * x;     }     long long get_sum(int r) {       long long res = 0LL;       for (; r >= 0; r = (r & (r + 1)) - 1) res += t[r];       return res;     }     long long get_sum(int l, int r) {       if (r < l) return 0LL;       return get_sum(r) - get_sum(l - 1);     }   };   Fenwick_tree t1, t2;   int main() {     ios_base::sync_with_stdio(false);     cin >> n >> m;     t1.init(n);     t2.init(n);     long long free = 1LL * n * n;     for (int i = 0; i < m; ++i) {       int x, y;       cin >> x >> y;       if (cnt2[y] == 0)         free -= (n - 1 - t1.get_sum(1, x - 1) - t1.get_sum(x + 1, n));       if (cnt1[x] == 0)         free -= (n - 1 - t2.get_sum(1, y - 1) - t2.get_sum(y + 1, n));       if (cnt1[x] == 0 && cnt2[y] == 0) free--;       cnt1[x] = cnt2[y] = true;       if (t1.get_sum(x, x) == 0) t1.add(x, 1);       if (t2.get_sum(y, y) == 0) t2.add(y, 1);       cout << free <<    ;     }     return 0;   }   