Codeforces problem runtime error!

codeforces
dynamic-programming
runtime-error

#1

I am trying to solve this problem using unbounded knapsack problem.But I am getting runtime error (Signal 11).Can someone please explain this.Here is the link to solution.