Failing two cases Subset sum to target

@shivansh.sm1
Here, the value of sum is till 10^7 while n<=5000.
Your algorithm is also wrong.

Try to come up with solution like where dp[i][j] represents subset sum of elements from 0 to i is equal to j or not.
Tip:- First try to think recursive manner, then do Bottomup.