#include #include #include #include #include #include #include #include #include #include #define MOD 1000000007 #define mkp make_pair typedef long long ll; using namespace std; int N,K,Q; vector A; vector X,V; const int BACKET=150; int ans[15001]; void solve(int l,int r){ vector used(N,0); vector v; for(int i=l;i dp; dp.set(0); for(int i=0;i p=dp; for(int j=0;j>N>>K; A.resize(N); for(int i=0;i>A[i]; cin>>Q; X.resize(Q); V.resize(Q); for(int q=0;q>X[q]>>V[q]; X[q]--; } for(int q=0;q