Codeforces problem runtime error!

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.