HI Rashmi.
I want to clarify some things.
The conditions are just to make you aware of what is the domain of all possible values. You don’t need to check every value, like in your code.
If the problem statement reads t<=100 than that means t will be less than 100
Secondly you have 10^{20} in your code, which is very large and might cause Overflow error.
To combat that, use string to store the value
I highly suggest you read the AC solutions and then make modifications to your code .
Lol, @rashimishra , I think you are using tex in your code .
You might want to use pow function and anyways I think it is not possible to fit 10^{20} in primitive data types.