When-ever i submit a solution (which in my opinion is correct) it shows me

same error of time limit extended and shows the same time of 5.01 sec. This

is happening in currently running contest “Youtube Practice Problem” with

code (YTPP001).

I have checked this error by resubmitting my correct solution (that was

accepted 3-4 days ago)

and showed the same error

Which question? Your code?

As far as I can see, you’ve never had an accepted solution to PRCHECK, which is presumably what you are talking about.

The main challenge here is that the number to be checked can be quite large, so you have to use a reasonably efficient test of prime numbers. Best to expect that the number will be near the upper limit. It’s easily good enough to sieve for primes up to the square root of the limit and then test all the primes found against the submitted value.

For interest I tried a fairly slow implementation that checks for factors of the target number for all numbers from 2 up until the square of the check is greater than the target. It still passes for time.