@ipt Got it! If we have --balance; and m == bheap.top(), bheap.pop(); and finally balance < 0 , actually we will not visit bheap.top()at all , no need to worry about if it is available! Thank you very much!
My bad! Good catch, it should be O(logk) for remove (will update the post). It doesn't change the overall runtime complexity. If we would have used PriorityQueue then remove(object) would be linear time instead of logarithmic, affecting the overall runtime complexity.