Facing runtime error in savkono problem

problem : https://www.codechef.com/LRNDSA03/problems/SAVKONO
solution : https://www.codechef.com/viewsolution/33634981

I used heap data structure.
First I built max heap on array of attacking power of soldiers then
each time I subtracted z by max(arr[0]) and reduced max by half and heapify, I contunued this process untill z <= 0, I am getting correct result on manual input, but while submit, it gives run time error.


well done