Can anyone please tell where i am wrong in this

i am doing it with dp solution, sample cases pass but can’t able to submit shows wrong ans

here is my link:: https://ide.codingblocks.com/s/172885