getting Runtime Error for knapsack problem.

I am new to competitive programming and am having difficulties in finding what can be the possible runtime errors for this question.
Here is my solution: http://www.codechef.com/viewsolution/4176159
I’ll be really grateful if someone helps. :slight_smile:

//