Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
htN = int(input())
A = map(int, input().split())
C=0
while True:
  for i in A:
    if A[i]%2 != 0:
        print(C)
        exit()
    A[i]/=2
    C+=1

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
count = 0
while True:
  for i in range(N):
    if A[i]%2 != 0:
      print(count)
      exit()
    A[i] /= 2
  count+=1

Buggy python submission (verdict: Runtime Error):
htN = int(input())
A = list(map(int, input().split()))
C=0
while True:
  for i in A:
    if A[i]%2 != 0:
        print(C)
        exit()
    A[i]/=2
    C+=1

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
count = 0
while True:
  for i in range(N):
    if A[i]%2 != 0:
      print(count)
      exit()
    A[i] /= 2
  count+=1

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
C=0
while True:
  for i in A:
    if i%2 != 0:
        print(C)
        exit()
    i/=2
    C+=1

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
count = 0
while True:
  for i in range(N):
    if A[i]%2 != 0:
      print(count)
      exit()
    A[i] /= 2
  count+=1

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
C=0
while True:
  for i in A:
    if i%2 != 0::
        print(C)
        exit()
    A[i]/=2
    C+=1

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
count = 0
while True:
  for i in range(N):
    if A[i]%2 != 0:
      print(count)
      exit()
    A[i] /= 2
  count+=1

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
C=0
while true:
  for i in A:
    if i%2 != 0::
        print(C)
        exit()
    A[i]/=2
    C+=1

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
count = 0
while True:
  for i in range(N):
    if A[i]%2 != 0:
      print(count)
      exit()
    A[i] /= 2
  count+=1
Buggy python submission (verdict: Time Limit Exceeded):
import sys

N = int(input())
P = [int(v) for v in input().split()]
cnt = 0
for i in range(N):
    flg = True
    for j in range(i):
        if P[i] > P[j]:
            flg = False
            break
    if flg:
        cnt += 1
print(cnt)




Fixed submission:
import sys

N = int(input())
P = [int(v) for v in input().split()]
cnt = 0
M = 3 * 10 ** 5
for i in range(N):
    if M > P[i]:
        cnt += 1
    M = min(M,P[i])
print(cnt)
Buggy python submission (verdict: Runtime Error):
import itertools

N = int(sys.stdin.readline())
P = [int(v) for v in sys.stdin.readline().split()]
Q = [int(v) for v in sys.stdin.readline().split()]
Ps = [list(v) for v in itertools.permutations(range(1, N + 1),N)]
Ps = sorted(Ps)

def find(l1):
    for i, l3 in enumerate(Ps):
        if l3 == l1:
            return i
    return 0


print(abs(find(P) - find(Q)))



Fixed submission:
import sys
import itertools

N = int(sys.stdin.readline())
P = [int(v) for v in sys.stdin.readline().split()]
Q = [int(v) for v in sys.stdin.readline().split()]
Ps = [list(v) for v in itertools.permutations(range(1, N + 1),N)]
Ps = sorted(Ps)

def find(l1):
    for i, l3 in enumerate(Ps):
        if l3 == l1:
            return i
    return 0

print(abs(find(P) - find(Q)))
Buggy python submission (verdict: Runtime Error):
import math
A, B = [int(v) for v in input().split()]

def lcm(a, b):
    return a * b / math.gcd(a, b)
print(int(lcm(A, B)))

Fixed submission:
import fractions
A, B = [int(v) for v in input().split()]

def lcm(a, b):
    return a * b / fractions.gcd(a, b)

print(int(lcm(A, B)))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

count = 0
for p in range(1000):
    v = format(p, '03')
    found = False
    for i in range(N):
        if S[i] == v[0]:
            p1 = i
            found = True
            break
    if not found:
        continue
    found = False
    for i in range(p1 + 1, N):
        if S[i] == v[1]:
            p2 = i
            found = True
            break
    if not found:
        continue
    found = False
    for i in range(p2 + 1, N):
        if S[i] == v[2]:
            p3 = i
            found = True
            break
    if not found:
        continue
    count += 1

print(count)


Fixed submission:
N = int(input())
S = input()

count = 0
for p in range(1000):
    v = format(p, '03')
    found = False
    pos1 = S.find(v[0])
    if pos1 == -1:
        continue
    pos2 = S[pos1 + 1:].find(v[1])
    if pos2 == -1:
        continue
    pos3 = S[pos1 + pos2 + 2:].find(v[2])
    if pos3 == -1:
        continue
    count += 1

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N = int(input())
S = input()

ss = set()

for i in range(N):
    for j in range(i + 1, N):
        for k in range(j + 1, N):
            ss.add(S[i] + S[j] + S[k])
print(len(ss))


Fixed submission:
N = int(input())
S = input()

count = 0
for p in range(1000):
    v = format(p, '03')
    found = False
    pos1 = S.find(v[0])
    if pos1 == -1:
        continue
    pos2 = S[pos1 + 1:].find(v[1])
    if pos2 == -1:
        continue
    pos3 = S[pos1 + pos2 + 2:].find(v[2])
    if pos3 == -1:
        continue
    count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
import sys
R = int(input()
print(R * R)


Fixed submission:
import sys
R = int(input())
print(R * R)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import itertools
 
N = int(input())
L = [int(v) for v in sys.stdin.readline().split()]

print(len([0 for a, b, c in itertools.combinations(L, 3) if a + b > c and b + c > a and a + c > b]))


Fixed submission:
import sys
from bisect import bisect_left

N = int(input())
A = [int(v) for v in sys.stdin.readline().split()]

A = sorted(A)

cnt = 0
for i in range(N - 2):
    for j in range(i+1, N - 1):
        ij = A[i] + A[j]
        cnt += bisect_left(A, ij) - (j + 1)
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import itertools

N = int(input())
L = [int(v) for v in sys.stdin.readline().split()]

print(len([(a, b, c) for a, b, c in itertools.combinations(L, 3) if a + b > c and b + c > a and a + c > b]))



Fixed submission:
import sys
from bisect import bisect_left

N = int(input())
A = [int(v) for v in sys.stdin.readline().split()]

A = sorted(A)

cnt = 0
for i in range(N - 2):
    for j in range(i+1, N - 1):
        ij = A[i] + A[j]
        cnt += bisect_left(A, ij) - (j + 1)
print(cnt)
Buggy python submission (verdict: Runtime Error):
inp = list(map(int, input().strip().split(' ')))

a = inp[0]
b = inp[1]

r = b * 2 + 1
m = math.ceil(a / r)
print(m)


Fixed submission:
import math

inp = list(map(int, input().strip().split(' ')))

a = inp[0]
b = inp[1]

r = b * 2 + 1
m = math.ceil(a / r)
print(m)
Buggy python submission (verdict: Time Limit Exceeded):
inp = int(input())
A = []
for a in range(inp):
    A.append(int(input()))
    
m = max(A)

for i, a in enumerate(A):
    if a == m:
        A2 = [v for i2, v in enumerate(A) if i2 != i]
        print(max(A2))
    else:
        print(m)


Fixed submission:
inp = int(input())
A = []
for a in range(inp):
    A.append(int(input()))

m = max(A)

# 最大値をとる要素が何個あるかチェック
c = 0
for a in A:
    if a == m:
        c += 1

# 二番目
if len(A) > c:
    second = max([v for v in A if v != m])    

for i, a in enumerate(A):
    if a == m:
        if c > 1:
            print(m)
        else:
            print(second)
    else:
        print(m)
Buggy python submission (verdict: Time Limit Exceeded):
import sys

N, Q = map(int, input().split())
S = input()
P = [[int(v) - 1 for v in sys.stdin.readline().split()] for _ in range(Q)]
X = [0] * (N - 1)

for i in range(N - 1):
    if S[i:i + 2] == 'AC':
        X[i] = 1

for l, r in P:
    cnt = sum(X[l:r])
    print(cnt)


Fixed submission:
import sys

N, Q = map(int, input().split())
S = input()
P = [[int(v) - 1 for v in sys.stdin.readline().split()] for _ in range(Q)]
X = [0] * (N + 1)

for i in range(N):
    if S[i:i + 2] == 'AC':
        X[i + 1] = X[i] + 1
    else:
        X[i + 1] = X[i] 


for l, r in P:
    print(X[r] - X[l])

Buggy python submission (verdict: Time Limit Exceeded):
import sys

N, Q = map(int, input().split())
S = input()
P = [[int(v) - 1 for v in sys.stdin.readline().split()] for _ in range(Q)]

for l, r in P:
    substr = S[l:r + 1]
    cnt = 0
    for i in range(len(substr) - 1):
        if substr[i:i + 2] == 'AC':
            cnt += 1
    print(cnt)


Fixed submission:
import sys

N, Q = map(int, input().split())
S = input()
P = [[int(v) - 1 for v in sys.stdin.readline().split()] for _ in range(Q)]
X = [0] * (N + 1)

for i in range(N):
    if S[i:i + 2] == 'AC':
        X[i + 1] = X[i] + 1
    else:
        X[i + 1] = X[i] 


for l, r in P:
    print(X[r] - X[l])
Buggy python submission (verdict: Time Limit Exceeded):
from sys import setrecursionlimit
setrecursionlimit(1000000) 
N = int(input())
H = list(map(int, input().split()))


def memoize(f):
    cache = {}
    def helper(x):
        if x not in cache:
            cache[x] = f(x)
        return cache[x]
    return helper



def jump(i):
    if i == 0:
        return 0
    a = abs(H[i] - H[i - 1]) + jump(i - 1)
    if i == 1:
        return a
    b = abs(H[i] - H[i - 2]) + jump(i - 2)
    return min(a, b)

memoizedjump = memoize(jump)
print(memoizedjump(N - 1))


Fixed submission:
N = int(input())

H = [int(v) for v in input().strip().split(' ')]

dp = [int(10 ** 10)] * N

dp[0] = 0
dp[1] = abs(H[0] - H[1])

for i in range(2, N):
    dp[i] = min(dp[i], dp[i - 1] + abs(H[i] - H[i - 1]))
    dp[i] = min(dp[i], dp[i - 2] + abs(H[i] - H[i - 2]))

print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
from sys import setrecursionlimit
setrecursionlimit(1000000) 
_ = input()
H = list(map(int, input().split()))

def jump(i):
    if i == 0:
        return 0
    a = abs(H[i] - H[i - 1]) + jump(i - 1)
    if i == 1:
        return a
    b = abs(H[i] - H[i - 2]) + jump(i - 2)
    return min(a, b)

print(jump(len(H) - 1))



Fixed submission:
N = int(input())

H = [int(v) for v in input().strip().split(' ')]

dp = [int(10 ** 10)] * N

dp[0] = 0
dp[1] = abs(H[0] - H[1])

for i in range(2, N):
    dp[i] = min(dp[i], dp[i - 1] + abs(H[i] - H[i - 1]))
    dp[i] = min(dp[i], dp[i - 2] + abs(H[i] - H[i - 2]))

print(dp[-1])

Buggy python submission (verdict: Runtime Error):
_ = input()
H = list(map(int, input().split()))

def jump(i):
    if i == 0:
        return 0
    a = abs(H[i] - H[i - 1]) + jump(i - 1)
    if i == 1:
        return a
    b = abs(H[i] - H[i - 2]) + jump(i - 2)
    return min(a, b)

print(jump(len(H) - 1))



Fixed submission:
N = int(input())

H = [int(v) for v in input().strip().split(' ')]

dp = [int(10 ** 10)] * N

dp[0] = 0
dp[1] = abs(H[0] - H[1])

for i in range(2, N):
    dp[i] = min(dp[i], dp[i - 1] + abs(H[i] - H[i - 1]))
    dp[i] = min(dp[i], dp[i - 2] + abs(H[i] - H[i - 2]))

print(dp[-1])
Buggy python submission (verdict: Time Limit Exceeded):
K, S = [int(v) for v in input().split()]

cnt = 0
for x in range(K + 1):
    if x > S:
        break
    for y in range(K + 1):
        if x + y > S:
            break
        for z in range(K + 1):
            if x + y + z > S:
                break
            if x + y + z == S:
                cnt += 1
print(cnt)


Fixed submission:
K, S = [int(v) for v in input().split()]

cnt = 0
for x in range(K + 1):
    for y in range(K + 1):
        if S - (x + y) >= 0 and S - (x + y) <= K:
            cnt += 1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
K, S = [int(v) for v in input().split()]

cnt = 0
for x in range(K + 1):
    for y in range(K + 1):
        for z in range(K + 1):
            if x + y + z == S:
                cnt += 1
print(cnt)
    

Fixed submission:
K, S = [int(v) for v in input().split()]

cnt = 0
for x in range(K + 1):
    for y in range(K + 1):
        if S - (x + y) >= 0 and S - (x + y) <= K:
            cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
A,B = map(int, input().split())
 
count = 1
while True:
  	if B == 1 :
        print(0)
        break
    if B - A <= 0:
        print (count)
        break
    else:
        B = B - A + 1
        count += 1

Fixed submission:
A,B = map(int, input().split())
 
count = 1
while True:
    if B == 1 :
        print(0)
        break
    if B - A <= 0:
        print (count)
        break
    else:
        B = B - A + 1
        count += 1

Buggy python submission (verdict: Runtime Error):
A,B = map(int, input().split())
 
count = 1
while True:
  	if B == 1 :
      print(0)
      break
    if B - A <= 0:
        print (count)
        break
    else:
        B = B - A + 1
        count += 1

Fixed submission:
A,B = map(int, input().split())
 
count = 1
while True:
    if B == 1 :
        print(0)
        break
    if B - A <= 0:
        print (count)
        break
    else:
        B = B - A + 1
        count += 1
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
i = 0
while "01" in s or "10" in s:
    if "01" in s:
        s = s.replace("01","",1)
        i+=2
    if "10" in s:
        s = s.replace("10","",1)
        i+=2
print (i)


Fixed submission:
s = input()
print(min(s.count("0"),s.count("1"))*2)
Buggy python submission (verdict: Time Limit Exceeded):
K,S = (int(x) for x in input().split())

count = 0
for i in range(K+1):
    for j in range(K+1):
        for k in range(K+1):
            if(i + j + k) == S:
                count += 1
print(count)

Fixed submission:
K,S = (int(x) for x in input().split())

count = 0
for x in range(K+1):
    for y in range(K+1):
            if  0 <= S - (x + y) <= K:
                count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
K,S = (int(x) for x in input().split())
result = [(x,y,z) for x in range(K+1) for y in range(K+1) for z in range(K+1) if (x + y + z) == S]

print(len(result))

Fixed submission:
K,S = (int(x) for x in input().split())

count = 0
for x in range(K+1):
    for y in range(K+1):
            if  0 <= S - (x + y) <= K:
                count += 1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
#%%
n = int(input())
a = list(map(int, input().split()))

import fractions
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(l):
    tmp = l[0]
    for i in range(1, len(l)):
        tmp = lcm_base(tmp, l[i])
    return tmp

lcm = lcm_list(a)
mod = 10**9+7


ans = 0
for i in range(n):
    tmp = lcm * pow(a[i], mod-2, mod)
    ans += tmp
    ans %= mod
print(ans)

Fixed submission:
#%%
n = int(input())
a = list(map(int, input().split()))
mod = 10**9+7

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr



tmp = [0] * (10**6+1)
for i in range(n):
    t = factorization(a[i])
    for j in range(len(t)):
        tmp[t[j][0]] = max(tmp[t[j][0]], t[j][1])

#print(tmp[:20])

lcm = 1
for i in range(1, 10**6+1):
    x = i 
    y = tmp[i] 
    for j in range(y):
        lcm *= x
        lcm %= mod

#print(lcm)

ans = 0
for i in range(n):
    q = lcm * pow(a[i], mod-2, mod)
    ans += q
    ans %= mod
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
#%%
def factorial(x, mod=10**9+7):
    # x!
    # 階乗
    # ex) factorial(5) = 120
    tmp = 1
    for i in range(1, x+1):
        tmp = (tmp * i) % mod
    return tmp

def combination(n, x, mod=10**9+7):
    # nCx, a=n!, b=x!, c=(n-x)!
    # 組み合わせ
    # ex) combination(5, 2) = 10
    tmp = factorial(n)
    tmp = (tmp * pow(factorial(x), mod-2, mod)) % mod
    tmp = (tmp * pow(factorial(n-x), mod-2, mod)) % mod
    return tmp

n, k = map(int, input().split())
mod = 10**9+7
a = list(map(int, input().split()))
a.sort()

b = combination(n, k)

l = [b] * (n-1)

for i in range(n-1):
    tmp = 0
    x = i+1
    y = (n-1)-i
    if x >= k:
        tmp += combination(x, k)
    if y >= k:
        tmp += combination(y, k)
    l[i] -= tmp

ll = [0] * (n-1)
for i in range(n-1):
    ll[i] = a[i+1] - a[i]
    ll[i] %= mod


ans = 0
for i in range(n-1):
    tmp = l[i] * ll[i]
    tmp %= mod
    ans += tmp
    ans %= mod

if ans < 0:
    ans += mod

print(ans)


Fixed submission:
#%%
kai = [1]
tt = 1
mod = 10**9+7
for i in range(1, 10**5+1):
    tt *= i
    tt %= mod
    kai.append(tt)
#print(kai)


def combination(n, x, kai, mod=10**9+7):
    # nCx, a=n!, b=x!, c=(n-x)!
    # 組み合わせ
    # ex) combination(5, 2) = 10
    tmp = kai[n]
    tmp = (tmp * pow(kai[x], mod-2, mod)) % mod
    tmp = (tmp * pow(kai[n-x], mod-2, mod)) % mod
    return tmp

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

b = combination(n, k, kai)

l = [b] * (n-1)

for i in range(n-1):
    tmp = 0
    x = i+1
    y = (n-1)-i
    if x >= k:
        tmp += combination(x, k, kai)
    if y >= k:
        tmp += combination(y, k, kai)
    l[i] -= tmp

ll = [0] * (n-1)
for i in range(n-1):
    ll[i] = a[i+1] - a[i]
    ll[i] %= mod


ans = 0
for i in range(n-1):
    tmp = l[i] * ll[i]
    tmp %= mod
    ans += tmp
    ans %= mod

if ans < 0:
    ans += mod

print(ans)
Buggy python submission (verdict: Runtime Error):
import fractions
from functools import reduce

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)


n, m = map(int, input().split())
a = list(map(int, input().split()))
flag = True
ans = 0

for i in range(n):
    a[i] /= 2
tmp = int(gcd_list(a))
#print(tmp)
for i in range(n):
    a[i] //= tmp
    a[i] = int(a[i])
    if a[i] % 2 == 0:
        flag = False

if flag:
    tmp = lcm_list(a)
    ans = (m+tmp) // (2*tmp) 
else:
    ans = 0

print(ans)



Fixed submission:
#%%
import fractions
def gcd_base(x, y):
    return fractions.gcd(x, y)

def gcd_list(l):
    tmp = l[0]
    for i in range(1, len(l)):
        tmp = gcd_base(tmp, l[i])
    return tmp

import fractions
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(l):
    tmp = l[0]
    for i in range(1, len(l)):
        tmp = lcm_base(tmp, l[i])
        if tmp > 10**9:
            tmp = -1
            break
    return tmp

n, m = map(int, input().split())
a = list(map(lambda x: int(x)//2 , input().split()))
f1 = True

lcm = lcm_list(a)
if lcm == -1:
    ans = 0
else:
    for i in range(n):
        if (lcm // a[i]) % 2 == 0:
            ans = 0 
            f1 = False
            break
    if f1:
        ans = (m + lcm) // (2 * lcm)
print(ans)

Buggy python submission (verdict: Runtime Error):
import fractions
from functools import reduce

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)


n, m = map(int, input().split())
a = list(map(int, input().split()))
flag = True
for i in range(n):
    if a[i] % 2 == 1:
        flag = False
ans = 0

for i in range(n):
    a[i] /= 2
tmp = int(gcd_list(a))
for i in range(n):
    a[i] //= tmp
    a[i] = int(a[i])
    if a[i] % 2 == 0:
        flag = False

if flag:
    tmp = lcm_list(a)
    ans = (m-tmp) // (2*tmp) + 1
else:
    ans = 0

print(ans)



Fixed submission:
#%%
import fractions
def gcd_base(x, y):
    return fractions.gcd(x, y)

def gcd_list(l):
    tmp = l[0]
    for i in range(1, len(l)):
        tmp = gcd_base(tmp, l[i])
    return tmp

import fractions
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(l):
    tmp = l[0]
    for i in range(1, len(l)):
        tmp = lcm_base(tmp, l[i])
        if tmp > 10**9:
            tmp = -1
            break
    return tmp

n, m = map(int, input().split())
a = list(map(lambda x: int(x)//2 , input().split()))
f1 = True

lcm = lcm_list(a)
if lcm == -1:
    ans = 0
else:
    for i in range(n):
        if (lcm // a[i]) % 2 == 0:
            ans = 0 
            f1 = False
            break
    if f1:
        ans = (m + lcm) // (2 * lcm)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
#%%
import math

# 素数判定関数
def isPrime(num):
    # 2未満の数字は素数ではない
    if num < 2: return False
    # 2は素数
    elif num == 2: return True
    # 偶数は素数ではない
    elif num % 2 == 0: return False

    # 3 ~ numまでループし、途中で割り切れる数があるか検索
    # 途中で割り切れる場合は素数ではない
    for i in range(3, math.floor(math.sqrt(num))+1, 2):
        if num % i == 0:
            return False

    # 素数
    return True

# 素数判定
def callIsPrime(input_num=1000):
    numbers = []
    # ループしながら素数を検索する
    for i in range(1, input_num):
        if isPrime(i):
            numbers.append(i)

    # 素数配列を返す
    return numbers

# 関数の呼び出し
l = callIsPrime(10**6)

x = int(input())
for i in range(len(l)):
    if l[i] >= x:
        print(l[i])
        break

# %%


Fixed submission:

#%%
import math

# 素数判定関数
def isPrime(num):
    # 2未満の数字は素数ではない
    if num < 2: return False
    # 2は素数
    elif num == 2: return True
    # 偶数は素数ではない
    elif num % 2 == 0: return False

    # 3 ~ numまでループし、途中で割り切れる数があるか検索
    # 途中で割り切れる場合は素数ではない
    for i in range(3, math.floor(math.sqrt(num))+1, 2):
        if num % i == 0:
            return False

    # 素数
    return True

# 素数判定
def callIsPrime(input_num=(10**5) * 2):
    numbers = []
    # ループしながら素数を検索する
    for i in range(1, input_num):
        if isPrime(i):
            numbers.append(i)

    # 素数配列を返す
    return numbers

# 関数の呼び出し
l = callIsPrime((10**5) * 2)
#print(l)

x = int(input())
for i in range(len(l)):
    if l[i] >= x:
        print(l[i])
        break

# %%