#include<iostream> #include<algorithm> #include<cstdio> using namespace std; pair<int,int> b[1000001]; int main() { int l,m,sum,sum1,i,s; cin>>l>>m; for(i=0;i<m;i++) cin>>b[i].first>>b[i].second; sort(b,b+m); s=b[0].s...