Worker uptime total
Your task
A cron supervisor logs "<ts> START" when a worker comes up and "<ts> STOP" when it goes down, with ts as integer Unix seconds. The log is chronological and well-formed: events strictly alternate beginning with START, so a STOP always closes the most recent START. Given the log and the current time now (now >= every logged ts), return the worker's total uptime in seconds. If the log ends with a START, the final run is still going and counts up to now. An empty log means zero uptime.
Examples
total_uptime(events: list[str], now: int) -> intExample 1
Input
total_uptime(["100 START", "250 STOP", "300 START"], 400)Output
250