#include using namespace std; using ll = long long; #define rep(i,n) for(int i=0; i<(int)(n); i++) #define MOD int(1e9)+7 #define MOD2 int(998244353) #define INF int(1e9)+7 #define LINF ll(1e18)+7 #define PI acos(-1) #define P pair template inline bool chmax(T &a, const T &b){ if(a inline bool chmin(T &a, const T &b){ if(a>b) {a=b; return true;} else return false; } //Graph struct Edge{ int to; ll cost; Edge(int _to, ll _cost) : to(_to), cost(_cost) {} }; typedef vector Edges; typedef vector Graph; void add_edge(Graph &g,int from,int to,ll cost,bool rev,ll rev_cost){ g[from].push_back(Edge(to,cost)); if(rev) g[to].push_back(Edge(from,rev_cost)); } int n,q; int light[510000]; void solve(){ cin>>n>>q; int sum=0; while(q--){ int l,r; cin>>l>>r; l--; for(int i=l; i