Sponsored
Use these hints if you're stuck. Try solving on your own first.
At each query, try to save and update the sum of the elements needed to calculate MKAverage.
You can use BSTs for fast insertion and deletion of the elements.
Solve with full IDE support and test cases