#include using namespace std; const uint64_t M = 1'000'000'007; enum rangeOperaion{ NUL, UPDATE, ADD }; using ll = int64_t; class segTree{ int N; ll *tree; pair *lazy; const pair nullopr=make_pair(NUL, 0); pair *range; int getParent(int child){ return child/2; } pair getChildren(int parent){ return make_pair(2*parent, 2*parent+1); } int lg(ll N){ int lgN; for(lgN=0;(1< val){ if(val.first==UPDATE) lazy[pos]=val; else if(lazy[pos].first==NUL) lazy[pos]=val; else lazy[pos].second+=val.second; } void eval(int pos){ if(lazy[pos].first==NUL) return; if(pos[2*N]; range=new pair[2*N]; for(int i=1;i<2*N;i++){ tree[i]=0; lazy[i]=nullopr; } for(int i=2*N-1;i>0;i--){ if(i>=N) range[i]=make_pair(i-N, i-N+1); else range[i]=make_pair(range[getChildren(i).first].first, range[getChildren(i).second].second); } } ~segTree(){ delete[] tree; delete[] lazy; delete[] range; } void update(ll value, int left, int right){ assert(0<=left && left> n >> m >> k; int l[3000], r[3000]; for(int i=0;i> l[i] >> r[i]; l[i]--; r[i]--; } segTree st[2] = {3000, 3000}; st[0].update(1, 0); for(int i=1;i<=k;i++){ st[i%2].update(0, 0, n); for(int j=0;j