#include using namespace std; //#include //using namespace atcoder; using ll=long long; using Graph=vector>>>; #define MAX 1000000 #define MOD 1000000007 #define INF 1000000000 int main(){ int N,M; cin>>N>>M; vector> lr(M); for(int i=0;i>lr[i].first>>lr[i].second; } sort(lr.begin(),lr.end()); priority_queue,greater> pq; int i=0; int cnt=0; while(i