#include #include #include #include using namespace std; class seat { public: friend bool operator < (const seat&,const seat&); friend bool operator > (const seat&,const seat&); int x,width; }; bool operator < (const seat& a,const seat& b) { return (a.x (const seat& a,const seat& b) { return (a.x>b.x); } vector pos; seat tmp; int main() { int n,m,i; while(cin>>n>>m) { pos.clear(); for(i=0;i>tmp.x>>tmp.width; pos.push_back(tmp); } sort(pos.begin(),pos.end()); int count=2; for(i=0;i0) { count+=2; } else if(ans<0) { continue; } else { ++count; } } cout<