Why Runtime Error(SIGSEGV) in only 5th sub-task

Problem name: “Angled Flip” (CodeChef) .
I am trying to find out the reason behind runtime error in this code (CodeChef).
The logic behind my solution is as same as described in the official solution (CodeChef). Still I am unable to find the reason out. Can anyone tell me what’s wrong in my code that causes the runtime-error?

this is your code but accepted CodeChef

Thanks for your reply.
You used vector instead of array(2-dimensional).
Would you like to tell me why did vector work perfectly but array fail ?

I think the array is going out of bounds whereas the vector size will be allocated according to the input