Getting TLE

Getting TLE :

Solution Link : CodeChef: Practical coding for everyone

Your code times out for the following test case

Input

1
4
1 Like