Runtime Error

Here is my code :
https://www.codechef.com/viewsolution/72444629

Can anyone help me! why I am getting runtime error. New in C++. Please help.