Coding question about infectious diseases with multiple parts: 1) Only infection status, how long has it been infected? 2) Adding immunity status. 3) After D days of infection, how long until stability? 4) Including death status.
Implement analyze_disease(events, D, last_day). Each event is [person_id, day, status], where status is S, I, T, M, or X. Return an object keyed by person ID containing infected, infection_duration, immune, days_to_stability, and dead. Infection duration ends at the first T, M, or X event, or at the end of last_day if no ending event exists.
def analyze_disease(events, D, last_day):