Maximum Power(Traveloka hiring challenge)

Has anyone solved the maximum power problem from the traveloka hiring challenge completely (not partial)? My solution shows WA.

Number of testcases: T <= 10
Number of Queries: Q <= 100000
Type of Queries:

  1. A X(Add a number X into array)
  2. I X(Increment all the value of array by X)
  3. D X(Decrement all the value of array by X)
  4. P X(Find the Xth largest value in array)
    Initially the array is empty.

I have seen similar question on hackerrank, in such questions keep track of the queries and process all of them in a single iteration in time complexity o(n+q).

Can you tell me what’s wrong with my code?