Run - error in all test cases

My code is working fine on running but the testcases are showing run-error on submitting
import math

t = int(input())

for k in range(t):
l = list()
s = str()
m = int(input())
n = int(input())
for i in range(m,n+1):
flag = True
for j in range(2,int(math.sqrt(i))+1):
if i%j==0 :
#print(“Not Prime”)
flag = False
break
if flag==True :
s = s+str(i)+" "
print(s)

Hey,
Run Error means that your algorithm is not able to pass the test cases in the given time limit.
Please read about sieve of eratosthenes method.
Thanks :slight_smile:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.