Given a stream of events, design and implement a rate-limited alerting mechanism that suppresses duplicate alerts within a time window.
Each event is a dictionary with timestamp and key, and events arrive in nondecreasing timestamp order. Return the indices of events that should produce alerts. An event is suppressed when the same key produced an alert less than window seconds earlier; an event exactly window seconds later is allowed.
Function signature: def rate_limited_alerts(events, window):
def rate_limited_alerts(events, window):