Class assigment problem

mam output toh bilkul sahi aa raha hai magar test case kyu fail ho raha hai

hello @YASHMATHURIA123
a)use dynamic programming ,recusion will give tle.
b) use long long to avoid overlfow
c)
image
here it is testcase number