Canonicalize execution traces
Your task
A test harness replays a concurrent program many times and records each run as a log. A log entry is a thread name, a colon, then an event name, and both names are non empty and hold only lowercase letters and digits. Entries appear in the order the harness observed them, so two replays of one program differ only in how the threads were interleaved. Two runs are the same execution when every thread performed the same events in the same order in both, whatever order the threads took their turns in. A thread that acts in one run and not in the other makes the two runs different. Given the runs, return how many distinct executions were observed.
Examples
distinct_executions(runs: list[list[str]]) -> intExample 1
Input
distinct_executions([["t1:a", "t2:x", "t1:b"], ["t1:a", "t1:b", "t2:x"]])Output
1Example 2
Input
distinct_executions([["t1:b", "t1:a"], ["t1:a", "t1:b"]])Output
2Example 3
Input
distinct_executions([["t1:x", "t2:y"], ["t1:x", "t1:y"]])Output
2