Given a stream of tagged values, implement an API of the form sum(String tag, int windowSize) that returns the sum of the values for a given tag within the given window size.
Asked in the Coding II stage. Treat the window independently for each tag: it contains the most recent windowSize values added with that tag, ignoring values belonging to other tags.
Implement process_operations(operations). Each operation is a list: ['add', tag, value] or ['sum', tag, windowSize]. Return a list containing the result of every sum operation, in order.
def process_operations(operations):