PLEASE HELP TO FIND RUNTIME ERROR (SIGSEGV)

help
c
c-plus-plus
codechef
runtime
runtime-error

#1

http://www.codechef.com/problems/SPOON/
I AM NOT ABLE TO LOCATE MY ERROR.
I HAVE COMMENTED MY CODE TO HELP UNDERSTAND MY LOGIC.
I HAVE OBSERVED THAT ON INCREASING THE SIZE OF MY ARRAY THE TIME AFTER WHICH RUNTIME ERROR IS COMING IS ALSO INCREASING SO I GUESS MY PROGRAM S GOING IN AN INFINITE LOOP HENCE GOING OUT OF BOUND BUT IT IS WORKING FINE IN CODE::BLOCKS

http://www.codechef.com/viewsolution/6591253