What is the error in my code?

I was solving “MIN QUERY 1” question. I have cleared sample test cases, still, it is showing run time error upon submission.

I am not able to find out the error. Plz help me find that.

Here’s the link to my code: https://ide.codingblocks.com/s/344374

@siddharth_1_3277
This is the updated code.
I have marked the changes in comments.
If you face any difficulty, please revert.

Please mark the doubt as resolved if my explanation was able to clear it.

Plz share the code link in which you have made changes

@siddharth_1_3277

This is the updated code.
If you face any difficulty, please revert.

Please mark the doubt as resolved if my explanation was able to clear it.