Question
A single thread records start and end events for nested function calls. For each function id, work out how many time units it actually spent running, excluding the units spent inside calls it made. ```python def solve(raw: str) -> str: ... ``` ## Requirements - Line one is the number of functions; ids run from `0` to `count - 1` and every id appears at least once. Line two is the number of event lines. - Each remaining line is `<id>:<start|end>:<timestamp>` with integer fields. Events are chronological and properly nested on one thread. - An end timestamp is inclusive: the unit at that timestamp belongs to the call that is ending, so it contributes `timestamp - previous + 1` units. - When a call begins on top of a running call, credit the units since the previous boundary to the caller. After a call ends, the caller resumes at the following timestamp. - Return the exclusive totals for the ids in ascending order, joined by single spaces, as decimal text such as `3 4`. - A function may call itself; recursive spans of the same id accumulate into the same slot. - `run_case` passes `case["stdin"]` to `solve`. - Do not append a trailing newline to the returned string; return the value exactly once.