Language: C++

V#include<bits/stdc++.h>
using namespace std;

struct SegTree{

    int sz;
    vector<long long> dat,laz;

    SegTree(){
        sz=1<<18;
        dat.resize(sz<<1);
        laz.resize(sz<<1);
    };

    void upd(int id,int l,int r,int ql,int qr,long long val){
        if(qr<l||r<ql)return;
        if(ql<=l&&r<=qr){
            laz[id]+=val;
            dat[id]+=val;
            return;
        }
        laz[id<<1]+=laz[id];
        dat[id<<1]+=laz[id];
        laz[id<<1|1]+=laz[id];
        dat[id<<1|1]+=laz[id];
        laz[id]=0;
        upd(id<<1,l,l+r>>1,ql,qr,val);
        upd(id<<1|1,(l+r>>1)+1,r,ql,qr,val);
        dat[id]=min(dat[id<<1],dat[id<<1|1]);
    }

    long long qry(int id,int l,int r,int ql,int qr){
        if(qr<l||r<ql)return 1e18;
        if(ql<=l&&r<=qr){
            return dat[id];
        }
        laz[id<<1]+=laz[id];
        dat[id<<1]+=laz[id];
        laz[id<<1|1]+=laz[id];
        dat[id<<1|1]+=laz[id];
        laz[id]=0;
        return min(qry(id<<1,l,l+r>>1,ql,qr),qry(id<<1|1,(l+r>>1)+1,r,ql,qr));
    }

    void upd(int l,int r,long long d){
        upd(1,1,sz,l,r,d);
    }

    long long qry(int l,int r){
        return qry(1,1,sz,l,r);
    }
};

int n,m;
int a[200005],b[200005];
SegTree y,x;

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>m;
    for(int i=1;i<=m;i++)y.upd(i,i,-i);
    for(int i=1;i<=n;i++){
        cin>>a[i]>>b[i];
        x.upd(b[i]+1,b[i]+1,min(y.qry(1,b[i])-(-b[i]-1)-x.qry(b[i]+1,b[i]+1),0ll));
        y.upd(b[i]+1,b[i]+1,min(y.qry(1,b[i])-y.qry(b[i]+1,b[i]+1),0ll));
        x.upd(a[i],b[i],1e9);
        y.upd(a[i],b[i],1e9);
        x.upd(1,m,1);
        y.upd(1,m,1);
        if(x.qry(1,m)>=1e9)cout<<"-1\n";
        else cout<<x.qry(1,m)<<'\n';
    }

    return 0;
}


Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | V#include<bits/stdc++.h>
      |  ^
a.cc:1:1: error: 'V' does not name a type
    1 | V#include<bits/stdc++.h>
      | ^
a.cc:7:5: error: 'vector' does not name a type
    7 |     vector<long long> dat,laz;
      |     ^~~~~~
a.cc: In constructor 'SegTree::SegTree()':
a.cc:11:9: error: 'dat' was not declared in this scope
   11 |         dat.resize(sz<<1);
      |         ^~~
a.cc:12:9: error: 'laz' was not declared in this scope
   12 |         laz.resize(sz<<1);
      |         ^~~
a.cc: In member function 'void SegTree::upd(int, int, int, int, int, long long int)':
a.cc:18:13: error: 'laz' was not declared in this scope
   18 |             laz[id]+=val;
      |             ^~~
a.cc:19:13: error: 'dat' was not declared in this scope
   19 |             dat[id]+=val;
      |             ^~~
a.cc:22:9: error: 'laz' was not declared in this scope
   22 |         laz[id<<1]+=laz[id];
      |         ^~~
a.cc:23:9: error: 'dat' was not declared in this scope
   23 |         dat[id<<1]+=laz[id];
      |         ^~~
a.cc:29:17: error: 'min' was not declared in this scope
   29 |         dat[id]=min(dat[id<<1],dat[id<<1|1]);
      |                 ^~~
a.cc: In member function 'long long int SegTree::qry(int, int, int, int, int)':
a.cc:35:20: error: 'dat' was not declared in this scope
   35 |             return dat[id];
      |                    ^~~
a.cc:37:9: error: 'laz' was not declared in this scope
   37 |         laz[id<<1]+=laz[id];
      |         ^~~
a.cc:38:9: error: 'dat' was not declared in this scope
   38 |         dat[id<<1]+=laz[id];
      |         ^~~
a.cc:42:16: error: 'min' was not declared in this scope
   42 |         return min(qry(id<<1,l,l+r>>1,ql,qr),qry(id<<1|1,(l+r>>1)+1,r,ql,qr));
      |                ^~~
a.cc: In function 'int main()':
a.cc:60:5: error: 'ios' has not been declared
   60 |     ios::sync_with_stdio(false);
      |     ^~~
a.cc:61:5: error: 'cin' was not declared in this scope
   61 |     cin.tie(0);
      |     ^~~
a.cc:62:5: error: 'cout' was not declared in this scope
   62 |     cout.tie(0);
      |     ^~~~
a.cc:67:29: error: 'min' was not declared in this scope; did you mean 'main'?
   67 |         x.upd(b[i]+1,b[i]+1,min(y.qry(1,b[i])-(-b[i]-1)-x.qry(b[i]+1,b[i]+1),0ll));
      |                             ^~~
      |                             main