Getting TLE in strongest fighter

In this strongest fighter problem, I am getting TLE in first 2 Testcases others are passing plz check if there is anything wrong in my code.

https://ide.codingblocks.com/s/364469 here is my code

refer to this Efficient Approach - (Sliding Window Technique using Deque)
We create a Deque, Qi of capacity k, that stores only useful elements of current window of k elements. An element is useful if it is in current window and is greater than all other elements on left side of it in current window. We process all array elements one by one and maintain Qi to contain useful elements of current window and these useful elements are maintained in sorted order. The element at front of the Qi is the largest and element at rear of Qi is the smallest of current window.


corrected code

Thanks, I understood the approach.