SIGSEGV in STICKS problem?

Problem Code : CodeChef: Practical coding for everyone
My Solution : CodeChef: Practical coding for everyone

I know that this line is causing SIGSEGV issue

printf("%d\n",replic_arr[m-1]*replic_arr[m-2]);

but I did took care, that the array doesn’t go out of bounds, please help me figure out where my array goes out of bounds or SIGSEGV