TLE in 4 testcases and WA in 4 testcases

Refer for code:

The problem can be solved by (Sliding Window Technique using Deque) as constraints are of range 1<=N<=10^7
1<=k<=N
1 <= Ai <= 100000.
I have modified your code https://ide.codingblocks.com/s/249560
Please mark your doubt resolved and rate it.
Thanks!

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.