fun main() { val builder = StringBuilder() val (n, m) = readInputLine().split(" ").map { it.toInt() } val timeList = mutableListOf>() repeat(m) { val (d, hm, o, hmo) = readInputLine().split(" ") val (h, m) = hm.split(":") val (ho, mo) = hmo.split(":") timeList.add(Pair(d.toInt() * 24 * 60 + h.toInt() * 60 + m.toInt(), o.toInt() * 24 * 60 + ho.toInt() * 60 + mo.toInt() + 1)) } timeList.sortBy { it.second } var ans = 0 val room = IntArray(n) { -1 } for (t in timeList) { for ((i, r) in room.withIndex()) { if (r <= t.first) { room[i] = -1 } } for ((i, r) in room.withIndex()) { if (r == -1) { room[i] = t.second ans++ break } } } builder.appendln(ans) print(builder.toString()) } fun readInputLine(): String { return readLine()!! }