Please let me know why my code is giving TLE?

Code: https://ide.codingblocks.com/s/247004

hello @7nishit
please check the constraint.
value of N can be upto 10^9.

But we can’t have array of such huge dimensions. Help me to correct my code.

use map + top down dp.