Fixed window counter limiter

Write codeHard35 minStripe style

Your task

Simulate a per-key fixed-window counter limiter. You get requests as a list of [key, timestamp] pairs in non-decreasing timestamp order, a window size, and a limit. Windows are aligned to multiples of window: the window index for time t is t // window. Within each key's current aligned window, the first limit requests are ALLOWED and the rest REJECTED; the counter resets when a request lands in a new window for that key. Return the list of booleans in input order.

Examples

fixed_window_limiter(requests: list[list], window: int, limit: int) -> list[bool]
Example 1
Inputfixed_window_limiter([["a", 0], ["a", 1], ["a", 2], ["a", 10]], 10, 2)
Output[True, True, False, True]