Problem p03362 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N):
    ans = []
    ps = []
    n = 1
    while True:
        n += 2
        for p in ps:
            if n % p == 0:
                break
        else:
            ps.append(n)
            if n % 5 == 1:
                ans.append(n)
                if len(ans) >= N:
                    return ' '.join(map(str, ans))


def main():
    N = read_int()
    print(slv(N))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math
import random
import heapq
from collections import Counter, defaultdict
from decimal import Decimal, ROUND_HALF_UP, ROUND_CEILING
from functools import lru_cache, reduce
from itertools import combinations_with_replacement, product, combinations


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input()


def read_str_n():
    return list(map(str, input().split()))


def mt(f):
    import time
    import sys

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        print(e - s, 'sec', file=sys.stderr)
        return ret

    return wrap


def make_p():
    P = []
    m = (55555 + 1) * 5
    mask = [0] * m

    for i in range(2, m):
        # print(i)
        if mask[i] == 0:
            for j in range(m):
                if i * j >= m:
                    break
                mask[i * j] = 1
            P.append(i)

    return P


@mt
def slv(N):
    p = [
        import math
import random
import heapq
from collections import Counter, defaultdict
from decimal import Decimal, ROUND_HALF_UP, ROUND_CEILING
from functools import lru_cache, reduce
from itertools import combinations_with_replacement, product, combinations


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input()


def read_str_n():
    return list(map(str, input().split()))


def mt(f):
    import time
    import sys

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        print(e - s, 'sec', file=sys.stderr)
        return ret

    return wrap


def make_p():
    P = []
    m = 55555 + 1
    mask = [0] * m

    for i in range(2, m):
        # print(i)
        if mask[i] == 0:
            for j in range(m):
                if i * j >= m:
                    break
                mask[i * j] = 1
            P.append(i)

    return P


@mt
def slv(N):
    p = [
    2, 44497, 51577, 49871, 45631, 48299, 45827, 55061, 52859, 53857, 43499, 44383, 41681, 26701, 48799, 42101, 49549, 46573, 37223, 54829, 44771, 44507, 38201,
    45319, 51511, 52051, 55001, 44089, 55207, 45263, 14173, 49033, 45179, 50291, 47051, 45131, 54629, 34537, 51031, 49459, 49787, 55243, 1009, 44909, 45613, 52999, 47881, 52709, 48571, 41593, 41843, 48371, 34819, 55219, 52369
    ]

    return ' '.join(map(str, p[:N]))


def main():
    N = read_int()
    print(slv(N))


if __name__ == '__main__':
    main()
    ]

    return ' '.join(map(str, p[:N]))


def main():
    N = read_int()
    print(slv(N))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math
import random
import heapq
from collections import Counter, defaultdict
from decimal import Decimal, ROUND_HALF_UP, ROUND_CEILING
from functools import lru_cache, reduce
from itertools import combinations_with_replacement, product, combinations


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input()


def read_str_n():
    return list(map(str, input().split()))


def mt(f):
    import time
    import sys

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        print(e - s, 'sec', file=sys.stderr)
        return ret

    return wrap


def make_p():
    P = []
    m = 55555 + 1
    mask = [0] * m

    for i in range(2, m):
        # print(i)
        if mask[i] == 0:
            for j in range(m):
                if i * j >= m:
                    break
                mask[i * j] = 1
            P.append(i)

    return P


@mt
def slv(N):
    p = [
import math
import random
import heapq
from collections import Counter, defaultdict
from decimal import Decimal, ROUND_HALF_UP, ROUND_CEILING
from functools import lru_cache, reduce
from itertools import combinations_with_replacement, product, combinations


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input()


def read_str_n():
    return list(map(str, input().split()))


def mt(f):
    import time
    import sys

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        print(e - s, 'sec', file=sys.stderr)
        return ret

    return wrap


def make_p():
    P = []
    m = 55555 + 1
    mask = [0] * m

    for i in range(2, m):
        # print(i)
        if mask[i] == 0:
            for j in range(m):
                if i * j >= m:
                    break
                mask[i * j] = 1
            P.append(i)

    return P


@mt
def slv(N):
    p = [
        2, 10781, 10853, 10313, 10937, 9587, 10499, 10487, 10399, 9479, 9343,
        10607, 10631, 10477, 9973, 10559, 10093, 10691, 11093, 10079, 10613,
        10177, 10733, 10831, 10903, 10993, 10331, 10369, 10799, 10651, 11071,
        10567, 10883, 10627, 10453, 10193, 10837, 9533, 10091, 10711, 9851,
        11083, 10433, 9941, 10321, 11059, 10529, 10303, 10357, 10391, 11003,
        10531, 10103, 10889, 10753
    ]

    return ' '.join(map(str, p[:N]))


def main():
    N = read_int()
    print(slv(N))


if __name__ == '__main__':
    main()
    ]

    return ' '.join(map(str, p[:N]))


def main():
    N = read_int()
    print(slv(N))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math
import random
import heapq
from collections import Counter, defaultdict
from decimal import Decimal, ROUND_HALF_UP, ROUND_CEILING
from functools import lru_cache, reduce
from itertools import combinations_with_replacement, product, combinations


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input()


def read_str_n():
    return list(map(str, input().split()))


def mt(f):
    import time
    import sys

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        print(e - s, 'sec', file=sys.stderr)
        return ret

    return wrap


def make_p():
    P = []
    m = 55555 + 1
    mask = [0] * m

    for i in range(2, m):
        # print(i)
        if mask[i] == 0:
            for j in range(m):
                if i * j >= m:
                    break
                mask[i * j] = 1
            P.append(i)

    return P


@mt
def slv(N):
    p = [
        2, 10781, 10853, 10313, 10937, 9587, 10499, 10487, 10399, 9479, 9343,
        10607, 10631, 10477, 9973, 10559, 10093, 10691, 11093, 10079, 10613,
        10177, 10733, 10831, 10903, 10993, 10331, 10369, 10799, 10651, 11071,
        10567, 10883, 10627, 10453, 10193, 10837, 9533, 10091, 10711, 9851,
        11083, 10433, 9941, 10321, 11059, 10529, 10303, 10357, 10391, 11003,
        10531, 10103, 10889, 10753
    ]

    return ' '.join(str, p[:N])


def main():
    N = read_int()
    print(slv(N))


if __name__ == '__main__':
    main()