Why test cases are failing?

please check my code

@saiyamgoyal1903
you have to memoise your code, or you can use top down DP.
If you don’t know any of these, you will encounter these topics further in the course.
I strongly recommend to solve it after studying them.

I have used dp …how one test cse is passing ?

the complexity of your code is exponential, which wont pass all the test cases.
your algorithm is correct, but it is not optimised. you have to do something linear.

@saiyamgoyal1903
actually I saw your first submission, in which you have done only recursion.
in your current submission, you are not taking mod properly.
dp[i] = (dp[i-1] + dp[i-tile])%mod;

Can u explain why we need to mod like this ?

because the answer becomes so big that it crosses the maximum size of int, long long.
so if you mod only at the final answer, the answer already crossed the limit of int, it will now give some wrong unexpected output.
to solve this problem we take mod at every step because
(a+b)%m = ((a)%m + (b)%m)%m