#pragma GCC optimize("Ofast") #pragma GCC optimize(1) #pragma GCC optimize(2) #pragma GCC optimize(3) #pragma GCC target("popcnt") #include using namespace std; typedef long long ll; typedef string str; typedef pair pii; #define F first #define S second #define pb push_back #define pq priority_queue #define all(x) (x).begin(),(x).end() #define bug(x) cerr << (x) << '\n' #define yn(x) cout << (x==1?"Yes\n":"No\n") #define PI 3.14159265358979323 #define Ststone ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0) const ll max_n=2e5+20,max_int=2147483647,mod1=1e9+7,mod2=998244353; const bool online = 0; ll dx[8] = {1,0,0,-1,1,1,-1,-1}; ll dy[8] = {0,1,-1,0,1,-1,1,-1}; ll t,n,q,m,k,a,b,c,d,e,f,x,bit[max_n][3]; vector v1,v2,v3,v4; vector v,era,out; vector> ans; char cc; str s; void update(ll index,ll dalta,ll num){ while(index<=max_n){ bit[index][num] += dalta; index += index&(-index); } } ll query(ll index,ll num){ ll sum = 0; while(index){ sum += bit[index][num]; index -= index&(-index); } return sum; } void solve(){ cin >> n; for(ll i=1;i<=n;i++){ cin >> a >> b; v1.pb(a); v2.pb(b); v.pb({b,i}); era.pb({a+b-1,i}); update(i,a,0); } cin >> q; for(ll i=0;i> a >> b >> c; ans.pb({{a,i},{b,c}}); } sort(all(v)); sort(all(era)); sort(all(ans)); ll l = 0,r = 0; for(ll i=0;i> t; t = 1; for(ll i=1;i<=t;i++){ //cout << "Case #"<