Simulate a bounded deficit round-robin scheduler. queues[i] is a FIFO list of positive token costs. All deficits start at zero. For each round, visit queue indices in ascending order. If a queue is nonempty, add quantum to its deficit, then serve as many head items as fit, subtracting their costs. Never skip an oversized head to serve a later item.
Whenever a queue is empty, reset its deficit to zero. Return {"served": [queue_index,cost] pairs in service order, "remaining": final queue lists, "deficits": final credits}. This trace model has no new arrivals.
def deficit_round_robin(queues, quantum, rounds):
Constraints
0..8 queues, each with 0..16 positive integer costs ≤32.
1 ≤ quantum ≤32; 0 ≤ rounds ≤32.
Inputs satisfy these constraints; invalid-input handling is not graded. Use only Python standard library and NumPy.