Test case 1,2,3 shows RUN ERROR. Please help me out

My code: https://ide.codingblocks.com/s/653546

size of array you have taken is 100 only
but in question it is mention that n can be upto 10^5
so change the size of array

Thank you for the help sir!

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.