Problem 2558 · Easy
Each second take the richest pile down to its square root, found with a max heap, then sum what is left.
Open the interactive visualisation