Jane Street's login audit stream contains chronological events for each user. Given these events and an integer k, flag every user who has at least one consecutive run of exactly k failed logins.
A failure run counts only when it is bounded by a successful login or the beginning or end of that user's event list. A run of more than k failures does not qualify, because its full consecutive run is not exactly k.
Implement flag_users(user_events, k), where user_events is a dictionary mapping a user ID string to a list of event strings, each either `