Solve a producer-consumer problem: implement a runnable circular queue (initial size 10) on the whiteboard, and design how it resizes dynamically when 90% of the time it holds 7-8 elements but 10% of the time must hold 500 without losing data.
Asked in the Round 3 (onsite) stage.
Implement def circular_queue_operations(operations):. Each operation is ['enqueue', value], ['enqueue_many', values], ['dequeue'], ['size'], or ['capacity']. Return outputs from dequeue, size, and capacity in execution order. Empty dequeue returns None. Start with capacity 10, double when full, and halve when usage reaches at most 25%, never below 10. Preserve FIFO order during resizing.
def circular_queue_operations(operations):