Testcase 3 not passing showing timelimit reached

code:

@myself.yash.srivastav you have to use prime sieve here