Knapsack Atcoder dp educational contest

I am getting runtime error .What else can i do to optimise using recursive dp approach

The max weight in the question is upto 10^5 but you have allocated 101 space in ur weight parameter in dp.

Thanks a lot !!||||||