You should try using long variables. By using int variables you will only be able to get until 13! because they are really big numbers.
Recommendation: Do not suppose that your code is correct because it works for the example cases. The testers test a wide range of cases that maybe you didn’t take into account.