#define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; class Data { public: int in, out; bool operator<(const Data& d) const { return out < d.out; } }; int main() { int n, m; cin >> n >> m; vector v(m); for(int i=0; i> d >> h >> tmp >> m; int t = (d * 24 + h) * 60 + m; if(j == 0) v[i].in = t; else v[i].out = t + 1; } } sort(v.begin(), v.end()); multiset ms; for(int i=0; i