#include using namespace std; using Int = long long; template inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template inline void chmax(T1 &a,T2 b){if(a vector compress(vector v){ sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end()); return v; } template map dict(const vector &v){ map res; for(Int i=0;i<(Int)v.size();i++) res[v[i]]=i; return res; } template struct BIT{ Int n; vector bit; //1-indexed BIT():n(-1){} BIT(Int n_,T d):n(n_),bit(n_+1,d){} T sum(Int i){ T s=bit[0]; for(Int x=i;x>0;x-=(x&-x)) s+=bit[x]; return s; } void add(Int i,T a){ if(i==0) return; for(Int x=i;x<=n;x+=(x&-x)) bit[x]+=a; } Int lower_bound(Int w){ if(w<=0) return 0; Int x=0,r=1; while(r0;k>>=1){ if(x+k<=n&&bit[x+k]>q; vector ts(q),xs(q),ys(q); for(Int i=0;i>ts[i]>>xs[i]>>ys[i]; vector vs; vs.emplace_back(-1); vs.emplace_back(1e9+1); for(Int i=0;i bit(mv.size(),0); Int ans=0; for(Int i=0;i