Problem p03362 (python)

Fixed submission:
import math
import random
m = int(input())
n = 10000
def sosuuhantei(x):
    p = x
    if p < 2:
        return false
    elif  n == 2:
        return p
    else:
        for i in range(3,math.floor(math.sqrt(x)) + 1,2):
            if x % i == 0:
                return False
        else:
             return x
sosulist = []
 
if n < 2:
    None
elif n == 2:
    sosulist.append(2)
else:
    sosulist.append(2)
    for i in range(3,n+1,2):
        sosulist.append(sosuuhantei(i))
        
while False in sosulist:
    sosulist.remove(False)

s = []
for i in range(len(sosulist)):
    if sosulist[i] % 5 == 1:
        s.append(sosulist[i])

strs = ''
for i in range(m):
    strs = strs + str(s[i]) + ' '
print(strs)

Buggy submission (verdict: Runtime Error):
import math
import random
m = int(input())
n = 20000 
def sosuuhantei(x):
    p = x
    if p < 2:
        return false
    elif  n == 2:
        return p
    else:
        for i in range(3,math.floor(math.sqrt(x)) + 1,2):
            if x % i == 0:
                return False
        else:
             return x
sosulist = []
 
if n < 2:
    None
elif n == 2:
    sosulist.append(2)
else:
    sosulist.append(2)
    for i in range(3,n+1,2):
        sosulist.append(sosuuhantei(i))

while False in sosulist:
    sosulist.remove(False)
    

import random


strs = ''
for i in range(m):
    strs = strs + str(s[i]) + ' '
print(strs)

Buggy submission (verdict: Runtime Error):
m = int(input())
a = []
sosu = []
import math
def sosuuhantei(x):
    p = x
    if p < 2:
        return False
    elif  n == 2:
        return p
    else:
        for i in range(3,math.floor(math.sqrt(x)) + 1,2):
            if x % i == 0:
                return False
        else:
             sosu.append(x)
            
    


for i in range(55556):
    sosuuhantei(i)


import random
s = random.sample(sosu,m)

strs = ''
for i in range(m):
    strs = strs + str(s[i]) + ' '
print(strs)

Buggy submission (verdict: Runtime Error):
m = int(input())
a = []
sosu = []
import math
def sosuuhantei(x):
    p = x
    if p < 2:
        return False
    elif  n == 2:
        return p
    else:
        for i in range(3,math.floor(math.sqrt(x)) + 1,2):
            if x % i == 0:
                return False
        else:
             sosu.append(x)
            
    


for i in range(55565):
    sosuuhantei(i)
    
import random
s = random.sample(sosu,m)

strs = ''
for i in range(m):
    strs = strs + str(s[i]) + ' '

Buggy submission (verdict: Runtime Error):
m = int(input())
a = []
sosu = []
import math
def sosuuhantei(x):
    p = x
    if p < 2:
        return False
    elif  n == 2:
        return p
    else:
        for i in range(3,math.floor(math.sqrt(x)) + 1,2):
            if x % i == 0:
                return False
        else:
             sosu.append(x)
            
    


for i in range(55565):
    sosuuhantei(i)
    
import random
s = random.sample(sosu,m)

strs = ''
for i in range(5):
    strs = strs + str(s[i]) + ' '

Buggy submission (verdict: Runtime Error):
m = int(input())
a = []
sosu = []
import math
def sosuuhantei(x):
    p = x
    if p < 2:
        return False
    elif  n == 2:
        return p
    else:
        for i in range(3,math.floor(math.sqrt(x)) + 1,2):
            if x % i == 0:
                return False
        else:
             sosu.append(x)
            
    


for i in range(55556):
    sosuuhantei(i)
    
import random
print(random.sample(sosu,m))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = []
sosu = []

def sosuuhantei(x):
    p = x
    if p < 2:
        return false
    elif  n == 2:
        return p
    else:
        for i in range(3,math.floor(math.sqrt(x)) + 1,2):
            if x % i == 0:
                return False
        else:
             return x
            
            
sosulist = []
 
if n < 2:
    None
elif n == 2:
    sosulist.append(2)
else:
    sosulist.append(2)
    for i in range(3,55555+1,2):
        sosulist.append(sosuuhantei(i))
import random
print(random.choice(sosulist,k = n))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = []
sosu = []

def sosuuhantei(x):
    p = x
    if p < 2:
        return false
    elif  n == 2:
        return p
    else:
        for i in range(3,math.floor(math.sqrt(x)) + 1,2):
            if x % i == 0:
                return False
        else:
             return x
            
            
sosulist = []
 
if n < 2:
    None
elif n == 2:
    sosulist.append(2)
else:
    sosulist.append(2)
    for i in range(3,55555+1,2):
        sosulist.append(sosuuhantei(i))
import random
print(random.choices(sosulist,k = 5))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = []
sosu = []

def sosuuhantei(x):
    p = x
    if p < 2:
        return false
    elif  n == 2:
        return p
    else:
        for i in range(3,math.floor(math.sqrt(x)) + 1,2):
            if x % i == 0:
                return False
        else:
             return x
            
            
sosulist = []
 
if n < 2:
    None
elif n == 2:
    sosulist.append(2)
else:
    sosulist.append(2)
    for i in range(3,55555+1,2):
        sosulist.append(sosuuhantei(i))

print(random.choices(sosulist,k = 5))