Code giving AC in IDE, but WA in CB platform

My code gives Right Answers in my local IDE, but Wrong Answer in the Coding Blocks platform.

hello @rohan.nishant1999
please share ur code using cb ide

@rohan.nishant1999

a) use long long in place of int.

b) image

use following property for this line->
(a-b)%mod= (a-b+mod)%mod;

c)
image
use mod here as well .
(ab)%mod=(a%modb%mod)%mod

@aman212yadav Sir, in JAVA there is no long long.
And sir, is (a-b)%mod = (a%mod - b%mod)%mod or (a-b)%mod= (a-b+mod)%mod ?

both are true but to avoid negative mod for this problem , we will use the later one.

I guess long is there , so use that

Sorry sir, I didn’t paste the latest code. In the latest code I used long for the DP array but same results were there.

share ur latest code ,i will check

Yes sir, by using long and mod expressions all test cases passed.
Thanks a lot for the help sir.