Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())

if s[0] != '1':
    print(s[1])


Fixed submission:
s = input()
k = int(input())

for i in range(k):
    if s[i] != '1':
        print(s[i])
        break
else:
    print('1')
Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

N, X = map(int, input().split())
if N == 1:
    x = abs(X - int(input()))
    print(x)
else:
    x = list(map(int, input().split()))
    x = list(map(lambda i: abs(X - i), x))
    print(reduce(math.gcd, x))

Fixed submission:
import fractions
from functools import reduce

N, X = map(int, input().split())
if N == 1:
    x = abs(X - int(input()))
    print(x)
else:
    x = list(map(int, input().split()))
    x = list(map(lambda i: abs(X - i), x))
    print(reduce(fractions.gcd, x))
Buggy python submission (verdict: Runtime Error):
s = input()
c = 0
for i in s:
    if i == +:
        c += 1
    else:
        c -= 1
print(c)

Fixed submission:
s = input()
c = 0
for i in s:
    if i == "+":
        c += 1
    else:
        c -= 1
print(c)
Buggy python submission (verdict: Runtime Error):
n = int(input())
#x = []
#y = []
#h = []
l = []
for i in range(n):
    ex,ey,eh = map(int,input().split())
    #x.append(ex)
    #y.append(ey)
    #h.append(eh)
    if eh != 0:
        l.append([ex,ey,eh])

def func(cx,cy,l1,l2):
    ans1 = -abs(l1[0]-cx)+abs(l2[0]-cx)-abs(l1[1]-cy)+abs(l2[1]-cy)
    ans2 = l1[2]-l2[2]
    if ans1 == ans2:
        return True
    else:
        return False

def func2(cx,cy,l):
    ans = l[2] + abs(l[0]-cx) +  abs(l[1]-cy)
    return ans

cx = -1
cy = -1
flag = False
for i in range(101):
    for j in range(101):
        for k in range(n-1):
            if func(i,j,l[k],l[k+1]):
                if k == n-2:
                    cx = i
                    cy = j
                    flag = True
                    break
            else:
                break
        if flag:
            break
    if flag:
        break
h = func2(cx,cy,l[0])

print(cx, cy, h)

Fixed submission:
n = int(input())
l = []
for i in range(n):
    ex,ey,eh = map(int,input().split())
    if eh != 0:
        l.append([ex,ey,eh])

def func2(cx,cy,l):
    ans = l[2] + abs(l[0]-cx) +  abs(l[1]-cy)
    return ans

if len(l) == 1:
    print(l[0][0], l[0][1], l[0][2])
    exit()

for i in range(101):
    for j in range(101):
        for k in range(len(l)-1):
            if func2(i,j,l[k]) == func2(i,j,l[k+1]):
                if k == len(l)-2:
                    print(i, j, func2(i,j,l[k]))
                    exit()
            else:
                break
Buggy python submission (verdict: Runtime Error):
import math

N,X = map(int,input().split())
x = list(map(int,input().split()))
x2 = []

for i in range(len(x)):
    x2.append(abs(x[i]-X))

gcd = x2[0]
for i in range(1,len(x2)):
    gcd = math.gcd(gcd,x2[i])
print(gcd)

Fixed submission:
N,X = map(int,input().split())
x = list(map(int,input().split()))

def gcd(x1,x2):
    while x2 != 0:
        x1,x2 = x2, x1%x2
    return x1

for i in range(len(x)):
    x[i] = abs(x[i]-X)

ans = x[0]
for i in range(1,len(x)):
    ans = gcd(ans,x[i])
print(ans)

Buggy python submission (verdict: Runtime Error):
import math

N,X = map(int,input().split())
x = list(map(int,input().split()))
x2 = []

for i in range(len(x)):
    x2.append(abs(x[i]-X))

gcd = x2[0]
for i in range(1,len(x2)-1):
    gcd = math.gcd(gcd,x2[i])
print(gcd)

Fixed submission:
N,X = map(int,input().split())
x = list(map(int,input().split()))

def gcd(x1,x2):
    while x2 != 0:
        x1,x2 = x2, x1%x2
    return x1

for i in range(len(x)):
    x[i] = abs(x[i]-X)

ans = x[0]
for i in range(1,len(x)):
    ans = gcd(ans,x[i])
print(ans)

Buggy python submission (verdict: Runtime Error):
import functools
import math

N,X = map(int,input().split())
x = list(map(int,input().split()))
x2 = []

for i in range(len(x)):
    x2.append(abs(x[i]-X))

gcd = functools.reduce(math.gcd, x2)
print(gcd)

Fixed submission:
N,X = map(int,input().split())
x = list(map(int,input().split()))

def gcd(x1,x2):
    while x2 != 0:
        x1,x2 = x2, x1%x2
    return x1

for i in range(len(x)):
    x[i] = abs(x[i]-X)

ans = x[0]
for i in range(1,len(x)):
    ans = gcd(ans,x[i])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [None]
for j in range(n):
    a.append(int(input()))

i = 1
c = 0
r = [1]
while True:
    c += 1
    i = a[i]
    if i == 2:
        print(c)
        break
    else:
        if i in r:
            print(-1)
            break
        else:
            r.append(i)

Fixed submission:
n = int(input())
a = [None]
for j in range(n):
    a.append(int(input()))

i = 1
c = 0
r = [1]
while True:
    c += 1
    i = a[i]
    if i == 2:
        print(c)
        break
    if c > (10**5):
        print(-1)
        break
Buggy python submission (verdict: Runtime Error):
(n, x) = list(map(int, input().split()))
x_list = list(map(int, input().split()))

x_list.append(x)
x_list.sort()

min_diff = 99999999999
for i in range(len(x_list) - 1):
    diff = x_list[i + 1] - x_list[i]
    if min_diff > diff:
        min_diff = diff

# 差分の最小を約分していく
x_diff = [xx - x_list[0] for xx in x_list]

for i in range(1, min_diff):
    if min_diff % i != 0:  # 約分できない場合は次の数に進む
        continue
    xx = min_diff // i
    is_divided = [j for j in x_diff if j % xx != 0]
    if len(is_divided) == 0:
        print(xx)
        exit()


Fixed submission:
(a, b) = list(map(int, input().split()))

if a % 2 == 0 or b % 2 == 0:
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Runtime Error):
(n, x) = list(map(int, input().split()))
x_list = list(map(int, input().split()))

x_list.append(x)
x_list.sort()

min_diff = 999_999_999_999
for i in range(len(x_list) - 1):
    diff = x_list[i + 1] - x_list[i]
    if min_diff > diff:
        min_diff = diff

# 差分の最小を約分していく
x_diff = [xx - x_list[0] for xx in x_list]

for i in range(1, min_diff):
    if min_diff % i != 0:  # 約分できない場合は次の数に進む
        continue
    xx = min_diff // i
    is_divided = [j for j in x_diff if j % xx != 0]
    if len(is_divided) == 0:
        print(xx)
        exit()


Fixed submission:
(n, x) = list(map(int, input().split()))
x_list = list(map(int, input().split()))

if x in x_list:
    pass
else:
    x_list.append(x)
    x_list.sort()

min_diff = 99999999999
for i in range(len(x_list) - 1):
    diff = x_list[i + 1] - x_list[i]
    if min_diff > diff:
        min_diff = diff

# 差分の最小を約分していく
x_diff = [xx - x_list[0] for xx in x_list]

for i in range(1, min_diff):
    if min_diff % i != 0:  # 約分できない場合は次の数に進む
        continue
    xx = min_diff // i
    is_divided = [j for j in x_diff if j % xx != 0]
    if len(is_divided) == 0:
        print(xx)
        exit()
print(1)
Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

n = int(input())
a = list(map(int, input().split()))

a_lcm = reduce(lambda x, y: (x * y) // math.gcd(x, y), a)
m = a_lcm - 1
a_mod = [m % ax for ax in a]

print(sum(a_mod))


Fixed submission:
from functools import reduce

n = int(input())
a = list(map(int, input().split()))

def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)


a_lcm = reduce(lambda x, y: (x * y) // gcd(x, y), a)
m = a_lcm - 1
a_mod = [m % ax for ax in a]

print(sum(a_mod))
Buggy python submission (verdict: Runtime Error):
import sys

a, b = input().split(" ")
if a*b % 2 == 0:
  print("Even")
else:
  print("Odd")


Fixed submission:
a, b = input().split(" ")
a = int(a)
b = int(b)
if a * b % 2 == 0:
    print("Even")
else:
    print("Odd")

Buggy python submission (verdict: Runtime Error):
import sys

a, b = input().split(" ")
if a*b % 2 == 0:
  print("Even")
else:
  print("Odd")

Fixed submission:
a, b = input().split(" ")
a = int(a)
b = int(b)
if a * b % 2 == 0:
    print("Even")
else:
    print("Odd")
Buggy python submission (verdict: Runtime Error):
N = int(raw_input())

if N == 1:
    print 'Hello World'
else:
    A = int(raw_input())
    B = int(raw_input())
    print str(A+B)




Fixed submission:
N = int(raw_input())

if N == 1:
    print 'Hello World'
else:
    A = int(raw_input())
    B = int(raw_input())
    print str(A+B)
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!

import itertools

N = int(input())
ta = [list(map(int,input().split())) for _ in range(N)]
for Cx, Cy in itertools.product(range(101),range(101)):
    # もしcx,cyが決まっていた場合矛盾が起こらないか
    # H = abs(x-cx)+abs(y-cy) + h
    H = None
    for [x,y,h] in ta:
        if h == 0:
            pass
        else:
            if H is None:
                H = h + abs(x-Cx)+abs(y-Cy)
            else:
                if H != h + abs(x-Cx)+abs(y-Cy):
                    break
        if h != max(H - abs(x-Cx) - abs(y-Cy),0):
            break
    else:
        break
print(Cx,Cy,H)


Fixed submission:
# coding: utf-8
# Your code here!

import itertools

N = int(input())
ta = [list(map(int,input().split())) for _ in range(N)]
for Cx, Cy in itertools.product(range(101),range(101)):
    # もしcx,cyが決まっていた場合矛盾が起こらないか
    # H = abs(x-cx)+abs(y-cy) + h
    H = None
    for [x,y,h] in ta:
        if h == 0:
            pass
        else:
            if H is None:
                H = h + abs(x-Cx)+abs(y-Cy)
            else:
                if H != h + abs(x-Cx)+abs(y-Cy):
                    break
    for [x,y,h] in ta:
        if h != max(H - abs(x-Cx) - abs(y-Cy),0):
            break
    else:
        break
print(Cx,Cy,H)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
import math

N, X = map(int,input().split())
x = list(map(int,input().split()))

d = [abs(X-x[i]) for i in range(N)]
gcd = d[0]

for i in range(N-1):
    gcd = math.gcd(gcd,d[i+1])

print(gcd)

Fixed submission:
import sys
input = sys.stdin.readline
import math

N, X = map(int,input().split())
x = list(map(int,input().split()))

d = [abs(X-x[i]) for i in range(N)]
oppai = d[0]

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a


for i in range(N-1):
    oppai = gcd(oppai,d[i+1])

print(oppai)

Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
import math
from functools import reduce

N, X = map(int,input().split())
x = list(map(int,input().split()))

d = [abs(X-x[i]) for i in range(N)]

def gcd(numbers):
    return reduce(math.gcd, numbers)

print(gcd(d))

Fixed submission:
import sys
input = sys.stdin.readline
import math

N, X = map(int,input().split())
x = list(map(int,input().split()))

d = [abs(X-x[i]) for i in range(N)]
oppai = d[0]

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a


for i in range(N-1):
    oppai = gcd(oppai,d[i+1])

print(oppai)
Buggy python submission (verdict: Runtime Error):
n = int(input())
for i in range(n):
    t, x, y = map(int, input().split())
    if x + y < t or (x + y + t) % 2:
        print("No")
        exit()
print("Yes")

Fixed submission:
n = int(input())
t = [0 for _ in range(n+1)]
x = [0 for _ in range(n+1)]
y = [0 for _ in range(n+1)]
for i in range(n):
    t[i+1], x[i+1], y[i+1] = [int(z) for z in input().split()]
    if t[i+1] - t[i] < abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i]) or (t[i+1] % 2 != (abs(x[i+1]) + abs(y[i+1])) % 2):
        print('No')
        exit()
print('Yes')

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
t = [0 for _ in range(n+1)]
x = [0 for _ in range(n+1)]
y = [0 for _ in range(n+1)]
for i in range(n):
    t[i+1], x[i+1], y[i+1] = [int(z) for z in input().split()]
    # print(t,x,y)
dt = [t[i+1] - t[i] for i in range(n)]
dist = [abs(x[i+1] - x[i]) + abs(y[i+1] - y[i]) for i in range(n)]
# print(dt, dist)
result = True

while result:
    for i in range(n):
        if not dt > dist and (t[i] % 2 != (abs(x[i])+abs(y[i])) % 2):
            result = False

if result:
    print('Yes')
else:
    print('No')

Fixed submission:
n = int(input())
t = [0 for _ in range(n+1)]
x = [0 for _ in range(n+1)]
y = [0 for _ in range(n+1)]
for i in range(n):
    t[i+1], x[i+1], y[i+1] = [int(z) for z in input().split()]
    if t[i+1] - t[i] < abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i]) or (t[i+1] % 2 != (abs(x[i+1]) + abs(y[i+1])) % 2):
        print('No')
        exit()
print('Yes')

Buggy python submission (verdict: Time Limit Exceeded):
def test():
    n = int(input())
    t = [0 for _ in range(n+1)]
    x = [0 for _ in range(n+1)]
    y = [0 for _ in range(n+1)]
    for i in range(n):
        t[i+1], x[i+1], y[i+1] = [int(z) for z in input().split()]
        # print(t,x,y)
    dt = [t[i+1] - t[i] for i in range(n)]
    dist = [abs(x[i+1] - x[i]) + abs(y[i+1] - y[i]) for i in range(n)]
    # print(dt, dist)
    result = "Yes"

    for i in range(len(t)):
        if not t[i] % 2 == (abs(x[i])+abs(y[i])) % 2:
            result = "No"

    for i in range(len(dt)):
        if dt < dist:
            result = "No"

    print(result)


test()


Fixed submission:
n = int(input())
t = [0 for _ in range(n+1)]
x = [0 for _ in range(n+1)]
y = [0 for _ in range(n+1)]
for i in range(n):
    t[i+1], x[i+1], y[i+1] = [int(z) for z in input().split()]
    if t[i+1] - t[i] < abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i]) or (t[i+1] % 2 != (abs(x[i+1]) + abs(y[i+1])) % 2):
        print('No')
        exit()
print('Yes')
Buggy python submission (verdict: Runtime Error):
def test():
    s = input()
    divide = ["dream", "dreamer", "erase", "eraser"]
    dp = [0 for i in range(10010)]

    dp[0] = 1
    for i in range(len(dp)):
        if dp[len(s)] == 1:
            print('YES')
            return 0
        if dp[i] == 0:
            continue
        for d in divide:
            if s[i:i+len(d)] == d:
                dp[i+len(d)] = 1
    print('NO')

test()

Fixed submission:
def test():
    s = input()
    divide = ["dream", "dreamer", "erase", "eraser"]
    dp = [0 for i in range(100010)]

    dp[0] = 1
    for i in range(len(dp)):
        if dp[len(s)] == 1:
            print('YES')
            return 0
        if dp[i] == 0:
            continue
        for d in divide:
            if s[i:i+len(d)] == d:
                dp[i+len(d)] = 1
    print('NO')

test()

Buggy python submission (verdict: Runtime Error):
def test():
    s = input()
    divide = ["dream", "dreamer", "erase", "eraser"]
    dp = [0 for i in range(10010)]

    dp[0] = 1
    for i in range(len(dp)):
        if dp[len(s)] == 1:
            print('YES')
            return 0
        if dp[i] == 0:
            continue
        for d in divide:
            if s[i:i+len(d)] == d:
                dp[i+len(d)] = 1
                print(i+len(d))
    print('NO')

test()

Fixed submission:
def test():
    s = input()
    divide = ["dream", "dreamer", "erase", "eraser"]
    dp = [0 for i in range(100010)]

    dp[0] = 1
    for i in range(len(dp)):
        if dp[len(s)] == 1:
            print('YES')
            return 0
        if dp[i] == 0:
            continue
        for d in divide:
            if s[i:i+len(d)] == d:
                dp[i+len(d)] = 1
    print('NO')

test()
Buggy python submission (verdict: Runtime Error):
n,a,b = split(input())
print (min(n*a,b))

Fixed submission:
n,a,b = input().split()
print(min(int(n)*int(a),int(b)))
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a > b:
  print(">")
else if a < b:
  print("<")
else:
  print("=")


Fixed submission:
a,b=input().split()
if a > b:
  print(">")
elif a < b:
  print("<")
else:
  print("=")
Buggy python submission (verdict: Runtime Error):
a,b = input().split()
if int(a) < int(b):
  print(0)
else
  print(int(a)-int(b))

Fixed submission:
a,b = input().split()
if int(a) < int(b):
  print(0)
else:
  print(int(a)-int(b))
Buggy python submission (verdict: Runtime Error):
print("ABC" ++ input())

Fixed submission:
print("ABC" + input())
Buggy python submission (verdict: Runtime Error):
a,b = input().split()
if a+b < 10:
  print(a+b)
else:
  print("error")

Fixed submission:
a,b = input().split()
if int(a)+int(b) < 10:
  print(int(a)+int(b))
else:
  print("error")
Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())
T = list(input())
S2, T2 = [], []
for i in S:
    S2.append(S.count(i))
for i in T:
    T2.append(T.count(i))
if S2 != T2:
    print('No')
else:
    print('Yes')


Fixed submission:
S = list(input())
T = list(input())
S2, T2 = [], []
St, Tt = [], []
for i in range(26):
    s = chr(ord('a') + i)
    St.append(S.count(s))
    Tt.append(T.count(s))
for i in range(len(S)):
    S2.append(St[ord(S[i]) - ord('a')])
    T2.append(Tt[ord(T[i]) - ord('a')])
if S2 != T2:
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    a = list(map(int, input().split()))
    p, z, m = [], 0, []
    for i in range(n):
        t = a[i] - (i + 1)
        if t > 0:
            p.append(t)
        elif t == 0:
            z += 1
        else:
            m.append(-t)
    if sum(m) > sum(p):
        p, m = m[:], p[:]

    ps, ms = sum(p), sum(m)
    pl, ml = len(p), len(m)
    p.sort()
    m.sort()
    x = 0
    ans = ms + ps
    while True:
        if pl <= 0:
            break
        t = p.pop(0)
        t, x = t - x, t
        ps -= pl * t
        pl -= 1
        if t > 0:
            ml += z
            ms += ml * t
            z = 1
        else:
            z += 1
        if ms + ps < ans:
            ans = ms + ps
    print(ans)


main()

Fixed submission:
def main():
    n = int(input())
    a = list(map(int, input().split()))
    p, z, m = [], 0, []
    for i in range(n):
        t = a[i] - (i + 1)
        if t > 0:
            p.append(t)
        elif t == 0:
            z += 1
        else:
            m.append(-t)
    if sum(m) > sum(p):
        p, m = m[:], p[:]

    p.sort()
    ps, ms = sum(p), sum(m)
    pl, ml = len(p), len(m)
    x = 0
    ans = ms + ps
    for t in p:
        t, x = t - x, t
        ps -= pl * t
        pl -= 1
        if t > 0:
            ml += z
            ms += ml * t
            z = 1
            a = ms + ps
            if a < ans:
                ans = a
        else:
            z += 1
    print(ans)


main()

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
p = []
m = []
z = 0
for i in range(n):
    a[i] = a[i] - (i + 1)
    if a[i] > 0:
        p.append(a[i])
    elif a[i] == 0:
        z += 1
    else:
        m.append(-a[i])
if sum(m) > sum(p):
    p, m = m[:], p[:]

ps = sum(p)
ms = sum(m)
pl = len(p)
ml = len(m)
p.sort()
m.sort()
x = 0
ans = ms + ps
while True:
    if pl <= 0:
        break
    t = p.pop(0)
    t, x = t - x, t
    ps -= pl * t
    pl -= 1
    if t > 0:
        ml += z
        ms += ml * t
        z = 1
    else:
        z += 1
    if ms + ps < ans:
        ans = ms + ps
print(ans)


Fixed submission:
def main():
    n = int(input())
    a = list(map(int, input().split()))
    p, z, m = [], 0, []
    for i in range(n):
        t = a[i] - (i + 1)
        if t > 0:
            p.append(t)
        elif t == 0:
            z += 1
        else:
            m.append(-t)
    if sum(m) > sum(p):
        p, m = m[:], p[:]

    p.sort()
    ps, ms = sum(p), sum(m)
    pl, ml = len(p), len(m)
    x = 0
    ans = ms + ps
    for t in p:
        t, x = t - x, t
        ps -= pl * t
        pl -= 1
        if t > 0:
            ml += z
            ms += ml * t
            z = 1
            a = ms + ps
            if a < ans:
                ans = a
        else:
            z += 1
    print(ans)


main()
Buggy python submission (verdict: Time Limit Exceeded):
# for j in range(1, 11):

n = int(input())
# n = j
ans = n
pay = []
for i in range(1, 10):
    if 6 ** i <= 100000:
        pay.append(6 ** i)
    if 9 ** i <= 100000:
        pay.append(9 ** i)
pay.sort(reverse=True)


def func(n, times):
    for i in pay:
        n2 = n
        times2 = times
        if i <= n:
            global ans
            n2 -= i
            times2 += 1
            if ans > times2 + n2:
                ans = times2 + n2
            if n2 >= 6 and times2 < ans:
                func(n2, times2)


func(n, 0)
print(ans)


Fixed submission:
n = int(input())
ans = [n]
pay = []
for i in range(1, 10):
    if 6 ** i < 100000:
        pay.append(6 ** i)
    if 9 ** i < 100000:
        pay.append(9 ** i)
pay.sort(reverse=True)

def func(n, times):
    for i in range(len(pay)):
        n2 = n
        times2 = times
        if pay[i] <= n2:
            n2 -= pay[i]
            times2 += 1
            if ans[0] > times2 + n2:
                ans[0] = times2 + n2
            if n2 >= 6 and times2 < ans[0]:
                func(n2, times2)
            if n2 > pay[i]*2:
                break


func(n, 0)
print(ans[0])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = []
for i in range(n):
    p.append(int(input()))
# x = [[1, 2, 4, 3], [2, 4, 1, 3], [2, 4, 3, 1], [4, 2, 1, 3], [4, 3, 2, 1]]
lens = []
for i in p:
    if i-1 not in lens:
        lens.append(i)
    else:
        lens[lens.index(i-1)] += 1
lens.sort()
x = 0
temp = 0
for i in lens:
    x = max(i-temp, x)
    temp = i
print(n-x)

Fixed submission:
n = int(input())
lens = [False for i in range(n + 1)]

for i in range(n):
    p = int(input())
    lens[p] = True
    lens[p - 1] = False

ps = []
for i in range(n + 1):
    if lens[i]:
        ps.append(i)

ps.sort()
x = 0
temp = 0
for i in ps:
    x = max(i - temp, x)
    temp = i
print(n - x)
Buggy python submission (verdict: Runtime Error):
n = int(input())
import math
import random
s = [1 for i in range(55555+1)]
s[0], s[1] = 0, 0
for i in range(2, int(math.sqrt(55555))+1):
    if s[i] != 0:
        for j in range(i*2, 55555, i):
            s[j] = 0
prime = []
for i in range(55555+1):
    if s[i] == 1:
        prime.append(i)

def is_prime(q):
    q = abs(q)
    if q == 2:
        return True
    if q < 2 or q & 1 == 0:
        return False
    return pow(2, q - 1, q) == 1








while True:
    a = random.sample(prime, n)
    count = 0
    while True:
        b = random.sample(a, 5)
        if is_prime(sum(b)):
            break
        else:
            count += 1
        if count > 30:
            ans = ''
            for i in a:
                ans += str(i) + ' '
            print(ans[:-1])
            # print(sum(a))
            # print(is_prime(sum(a)))
            quit()

            

Fixed submission:
a, b = map(int, input().split())
if a>b:
    print(a-1)
else :
    print(a)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
import math
import random
s = [1 for i in range(55555+1)]
s[0], s[1] = 0, 0
for i in range(2, int(math.sqrt(55555))+1):
    if s[i] != 0:
        for j in range(i*2, 55555, i):
            s[j] = 0
prime = []
for i in range(55555+1):
    if s[i] == 1:
        prime.append(i)

def is_prime(q):
    q = abs(q)
    if q == 2:
        return True
    if q < 2 or q & 1 == 0:
        return False
    return pow(2, q - 1, q) == 1








while True:
    a = random.sample(prime, n)
    count = 0
    while True:
        b = random.sample(a, 5)
        if is_prime(sum(b)):
            break
        else:
            count += 1
        if count > 1000:
            ans = ''
            for i in a:
                ans += str(i) + ' '
            print(ans[:-1])
            # print(sum(a))
            # print(is_prime(sum(a)))
            quit()


Fixed submission:
n = int(input())
import math
import random
s = [1 for i in range(55555+1)]
s[0], s[1] = 0, 0
for i in range(2, int(math.sqrt(55555))+1):
    if s[i] != 0:
        for j in range(i*2, 55555, i):
            s[j] = 0
prime = []
for i in range(55555+1):
    if s[i] == 1:
        if str(i)[-1] == '1':
            prime.append(i)

def is_prime(q):
    q = abs(q)
    if q == 2:
        return True
    if q < 2 or q & 1 == 0:
        return False
    return pow(2, q - 1, q) == 1




ans = ''
for i in range(n):
    ans += str(prime[i]) + ' '
print(ans[:-1])
# print(is_prime(sum(a)))
quit()
Buggy python submission (verdict: Time Limit Exceeded):
a, b, k = map(int, input().split())
for i in range(a, b + 1):
    if i - a + 1 <= k or b - i + 1 <= k:
        print(i)


Fixed submission:
a, b, k = map(int, input().split())
ans = []
for i in range(a, min(a + k, b + 1)):
    ans.append(i)
for i in range(b, max(b - k, a - 1), -1):
    if i not in ans:
        ans.append(i)
ans.sort()
for i in ans:
    print(i)