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

Problem name: “Angled Flip” (CodeChef: Practical coding for everyone) .
I am trying to find out the reason behind runtime error in this code (CodeChef: Practical coding for everyone).
The logic behind my solution is as same as described in the official solution (CodeChef: Practical coding for everyone). 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: Practical coding for everyone

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