please find the error in this program
http://www.codechef.com/viewsolution/5955233
You are getting Run time error because you are assuming that you’ll surely get ten inputs, while that is not true. As you can see in the test cases, you have to read just two inputs 12 and 2, but your code needs 8 more. You don’t need ten inputs every time, you need to read input till you get EOF. You may like using this:
while(cin>>n)
{
// do evaluations here
}