Harryxun/stf_run huggingface dataset:
n,m=map(int,input().split())
o,p,q,r=[],[],[],[]
def kyori(a,b,c,d):return abs(a-b)+abs(c-d)
for i in range(n):
  a,b=map(int,input().split())
  o.append(a)
  p.append(b)
for i in range(m):
  a,b=map(int,input().split())
  q.append(a)
  r.append(b)
for i in range(n):
  mind=kyori(a[i],b[i],c[0],d[0])
  minn=1
  for j in range(m-1):
    a=kyori(a[i],b[i],c[j+1],d[j+1])
    if a<mind:
      mind=a
      minn=j+2
  print(minn)

### FIXED CODE ###

n,m=map(int,input().split())
o,p,q,r=[],[],[],[]
def kyori(a,b,c,d):return abs(a-c)+abs(b-d)
for i in range(n):
  a,b=map(int,input().split())
  o.append(a)
  p.append(b)
for i in range(m):
  a,b=map(int,input().split())
  q.append(a)
  r.append(b)
for i in range(n):
  mind=kyori(o[i],p[i],q[0],r[0])
  minn=1
  for j in range(m-1):
    a=kyori(o[i],p[i],q[j+1],r[j+1])
    if a<mind:
      mind=a
      minn=j+2
  print(minn)
a

### FIXED CODE ###

a=float(input())
print(a*2*3.1415926535)
from math import gamma
cnt=0
h,w,a,b=map(int,input().split())
for k in range(0,h-a):
    cnt+= (int((gamma(b+k)*gamma(h+w-k-b-1))/(gamma(k+1)*gamma(b)*gamma(w-b)*gamma(h-k))))//(10^9+7)
print(cnt)

### FIXED CODE ###

# D　イロハちゃんと升目
cnt=0
h,w,a,b=map(int,input().split())
def find_power(n):
    # 0!からn!までのびっくりを出してくれる関数
    powlist=[0]*(n+1)
    powlist[0]=1
    powlist[1]=1
    for i in range(2,n+1):
        powlist[i]=powlist[i-1]*i%(10**9+7)
    return powlist

def find_inv_power(n):
    #0!からn!までの逆元を10**9+7で割ったあまりリストを作る関数
    powlist=find_power(n)
    check=powlist[-1]
    first=1
    uselist=[0]*(n+1)
    secondlist=[0]*30
    secondlist[0]=check
    secondlist[1]=check**2
    for i in range(28):
        secondlist[i+2]=(secondlist[i+1]**2)%(10**9+7)
    a=format(10**9+5,"b")
    for j in range(30):
        if a[29-j]=="1":
            first=(first*secondlist[j])%(10**9+7)
    uselist[n]=first
    for i in range(n,0,-1):
        uselist[i-1]=(uselist[i]*i)%(10**9+7)
    return uselist

powlist=find_power(h+w+1)
invlist=find_inv_power(h+w+1)
def combi(n,r):
    a=powlist
    b=invlist
    if n<r:
        return 0
    elif n>=r:
        return (a[n]*b[r]*b[n-r])%(10**9+7)

for i in range(h-a):
    cnt+=(combi(b+i-1,i)*combi(w+h-2-b-i,h-1-i))%(10**9+7)
print(cnt%(10**9+7))
n,q=map(int,input().split())
tree = [set() for _ in range(n)]
for i in range(n-1):
    a,b=map(int,input().split())
    tree[a-1].add(b)
ans=[0]*n
def add_l(x):    
    for i in list(tree[x-1]):
        add_l(i)
        tree[x-1] |= (tree[i-1])

add_l(1)
#print(tree)

for i in range(q):
    
    p,x=map(int,input().split())
    ans[p-1]+=x
    for j in list(tree[p-1]):
        ans[j-1]+=x
print(*ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

# 遅延評価で加えてあげるだけ

N,Q = map(int,input().split())
AB = [[int(x) for x in input().split()] for _ in range(N-1)]
PX = [[int(x) for x in input().split()] for _ in range(Q)]

graph = [[] for _ in range(N+1)]
for a,b in AB:
    graph[a].append(b)
    graph[b].append(a)

value = [0] * (N+1)
for p,x in PX:
    value[p] += x

def dfs(v,parent,add):
    value[v] += add
    for x in graph[v]:
        if x == parent:
            continue
        dfs(x,v,value[v])

dfs(1,0,0)

answer = ' '.join(map(str,value[1:]))
print(answer)
list = input().split()
x = (int)list[0]
y = (int)list[1]

if(x*y%0):
  print('Even')
else:
  print('Odd')

### FIXED CODE ###

li = input().split()
x = int(li[0])
y = int(li[1])

if(x*y%2 == 0):
  print("Even")
else:
  print("Odd")
n, x = map(int, input().split())

d = 0
for i, l in enumerate(input().split()):
  d += int(l)
  if d > x:
    print(i + 1)
    break
else:
  prin(n + 1)

### FIXED CODE ###

n, x = map(int, input().split())

d = 0
for i, l in enumerate(input().split()):
  d += int(l)
  if d > x:
    print(i + 1)
    break
else:
  print(n + 1)
N = int(input())

F = [int(input().replace(" ",""),2) for _ in range(N)]
P = [list(map(int, input().split())) for _ in range(N)]


profit = float("-inf")

for i in range(1,1024):
	tmp = 0
	for j in range(N):
		if i & F[j] :
			tmp = tmp + 1
			tmp2 = P[tmp]
	profit = max(profit, tmp2)

print(profit)

### FIXED CODE ###

n = int(input())
     
f = [int(input().replace(" ", ""), 2) for _ in range(n)]
p = [list(map(int, input().split())) for _ in range(n)]
     
ans = float('-inf')
     
for i in range(1, 1024):
    price = 0
    for j in range(n):
        price += p[j][bin(i & f[j]).count('1')]
    ans = max(ans, price)
     
print(ans)
N = int(input())
A = list(map(int, input().split()))
bottom = sum(A)

ret = 1
children = 1 - A[0]
bottom -= A[0]

for i in range(N):
    children = children * 2 - A[i+1]
    if children <= 0:
      ret = -1
      break
    
    bottom -= A[i+1]
    if children >= bottom:
      children = bottom
    ret += children + A[i+1]
print(ret)


### FIXED CODE ###

h1, m1, h2, m2, k=map(int, input().split())

print((h2-h1)*60+(m2-m1)-k)
#リストAの丸太を全てx以下にK回以内の切る回数で揃えることができるかを判断する関数。
def can_or_cannot(A,K,x):
    kaisuu_sum = 0
    for i in range(len(A)):
        if A[i]%x == 0:
            temp = (A[i]//x) - 1
            kaisuu_sum += temp
        else:
            temp = A[i]//x
            kaisuu_sum += temp

        if kaisuu_sum > K:
            return 'No'

    return 'Yes'

def main():
    N,K = map(int,input().split())
    A = list(map(int,input().split()))
    A.sort()
    #二分探索するよ
    left = 0
    right = A[N-1]
    mid = 0
    while True:
        mid = int( (left + right)/2 )
        print(left,mid,right)
        judge = can_or_cannot(A,K,mid)
        print(left,mid,right,judge)
        if judge == 'No':
            left = mid+1
        elif judge == 'Yes':
            right = mid

        if left == right:
            print(left,mid,right)
            return right

print(main())


### FIXED CODE ###

#リストAの丸太を全てx以下にK回以内の切る回数で揃えることができるかを判断する関数。
def can_or_cannot(A,K,x):
    kaisuu_sum = 0
    for i in range(len(A)):
        if A[i]%x == 0:
            temp = (A[i]//x) - 1
            kaisuu_sum += temp
        else:
            temp = A[i]//x
            kaisuu_sum += temp

        if kaisuu_sum > K:
            return 'No'

    return 'Yes'

def main():
    N,K = map(int,input().split())
    A = list(map(int,input().split()))
    A.sort()
    #二分探索するよ
    left = 0
    right = A[N-1]

    if right == 1:
        return 1

    mid = 0
    while True:
        if right == 1:
            return 1
            
        mid = int( (left + right)/2 )
        #print(left,mid,right)
        judge = can_or_cannot(A,K,mid)
        #print(left,mid,right,judge)
        if judge == 'No':
            left = mid+1
        elif judge == 'Yes':
            right = mid

        if left == right:
            #print(left,mid,right)
            return right

print(main())
# coding: utf-8

from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
import math
import string
import itertools
import fractions
import heapq
import collections
import re
import array
import bisect

def eat_all(al):
    for i in range(len(al)):
        al[i] -= 1
    while True:
        if al[0] == 0:
            al.pop(0)
        else:
            break
    return al

def step(turn, a_list):
    if len(a_list) == 1:
        if a_list[0] % 2 == 0:
            return turn
        else:
            return (not turn)
    if a_list[-1] % 2 != 0:
        a_list.pop()
        return step(not turn, a_list)
    else:
        a_list = eat_all(a_list)
        a_list.pop()
        if len(a_list) == 0:
            return turn
        return step(turn, a_list)

n = int(input())
a_list = [None] * n
inputs = input().split(" ")
for i in range(n):
    a_list[i] = int(inputs[i])
a_list.sort()
win = step(1, a_list)
if win == 1:
    print("First")
else:
    print("Second")



### FIXED CODE ###

# coding: utf-8

from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
import math
import string
import itertools
import fractions
import heapq
import collections
import re
import array
import bisect


a, b = map(int, input().split(" "))

p = "Positive"
n = "Negative"
z = "Zero"

if a > 0:
    print(p)
elif a == 0 or b == 0:
        print(z)
else:
    # a < 0
    if b >= 0:
        print(z)
    else:
        # a < 0, b < 0
        if (b - a) % 2 == 0:
            print(n)
        else:
            print(p)
a = int(input())
k = list(map(int, input().split()))

count = 1

for i in range(1,len(k)+1):
  if k[i-1] > k[i]:
    count += 1

print(count)


### FIXED CODE ###

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

count = 0
min =99999999

for i in range(len(k)):
  if min > k[i]:
    min= k[i]
    count += 1

print(count)
a = input()
a = a.split(" ")
i = 0
while 1:
  if a[0]<0:
    break
  else:
    i = i+1
    a[0]=int(a[0])-int(a[1])
    
print(i)

### FIXED CODE ###

a = input()
a = a.split(" ")
i = 0
while 1:
  if int(a[0]) <= 0:
    break
  else:
    i = i+1
    a[0]=int(a[0])-int(a[1])
    
print(i)
a, b, k = map(int, input().split())
if (a == 1 or b == 1):
    print(1)
    exit(0)
div = []
ans = 0
for i in range(1, max(a, b)):
    if (a % i == 0 and b % i == 0):
        div.append(i)
div.reverse()
print(div[k - 1])


### FIXED CODE ###

a, b, k = map(int, input().split())
if (a == 1 or b == 1):
    print(1)
    exit(0)
div = []
ans = 0
for i in range(1, max(a, b) + 1):
    if (a % i == 0 and b % i == 0):
        div.append(i)
div.reverse()
print(div[k - 1])
s=input()
l=[]

p=s[0]
seq=1

for c in s[1:]:
  if c==p:
    seq+=1
  else:
    l.append(seq)
    seq=1
    p=c
ans=float("inf")

d1=min([a+b for a,b in zip(l[0::2],l[1::2])])
d2=min([a+b for a, b in zip(l[1::2],l[2::2])])
print(min(d1,d2))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)

s = input()

K = float('inf')
if all(c == '0' for c in s):
    K = len(s)
elif all(c == '1' for c in s):
    K = len(s)
else:
    for k in range(1, len(s)):
        if s[k] != s[k-1]:
            K = min(K, max(k, len(s)-k))
        else:
            continue

print(K)
import sys

def f1(m):
    j=0
    num=0
    for x in ap:
        while j<minus and x*am[j]<m:
            j+=1
        num+=j
    return plus*minus-num
            
def f2(m):
    return f3(m,ap)+f3(m,am)


def f3(m,l):
    nagasa=len(l)
    if nagasa<2: return 0
    j=nagasa-1
    num=0
    for i in range(nagasa):
        while j>-1 and l[i]*l[j]>m:
            j-=1
        num+=j+1
        if i<=j: num-=1
    return num//2

n,k=map(int,input().split())
a=list(map(int,input().split()))
ap=sorted([a[i] for i in range(n) if a[i]>0])
am=sorted([-a[i] for i in range(n) if a[i]<0])
az=sorted([a[i] for i in range(n) if a[i]==0])

plus,minus,zero=len(ap),len(am),len(az)
pz=plus*minus+zero*(zero-1)//2+zero*(n-zero)


if plus*minus>=k:
    h,l=0,ap[-1]*am[-1]
    while l-h>1:
        md=(h+l)//2
        p=f1(md)
        if p>=k: h=md
        elif p<k: l=md
    print(-h)

elif pz>=k:
    print(0)

else:
    k-=pz
    h,l=max(ap[-1]**2,am[-1]**2),min(am[1]**2,am[1]**2)-1
    while h-l>1:

        md=(h+l)//2
        p=f2(md)
        if p>=k: h=md
        elif p<k: l=md
    print(h)

### FIXED CODE ###

import sys

def f1(m):
    j=0
    num=0
    for x in ap[::-1]:
        while j<minus and x*am[j]<m:
            j+=1
        num+=j
    return plus*minus-num
            
def f2(m):
    return f3(m,ap)+f3(m,am)


def f3(m,l):
    nagasa=len(l)
    if nagasa<2: return 0
    j=nagasa-1
    num=0
    for i in range(nagasa):
        while j>-1 and l[i]*l[j]>m:
            j-=1
        num+=j+1
        if i<=j: num-=1
    return num//2

n,k=map(int,input().split())
a=list(map(int,input().split()))
ap=sorted([a[i] for i in range(n) if a[i]>0])
am=sorted([-a[i] for i in range(n) if a[i]<0])
az=sorted([a[i] for i in range(n) if a[i]==0])

plus,minus,zero=len(ap),len(am),len(az)
pz=plus*minus+zero*(zero-1)//2+zero*(n-zero)


if plus*minus>=k:
    h,l=0,10**18
    while l-h>1:
        md=(h+l)//2
        p=f1(md)
        if p>=k: h=md
        else: l=md
    print(-h)

elif pz>=k:
    print(0)

else:
    k-=pz
    h,l=10**20,0
    while h-l>1:
        md=(h+l)//2
        p=f2(md)
        if p>=k: h=md
        else: l=md
    print(h)
import math

A, B, C, D = map(int, input().split())


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


Csita = A // C
Cue = B // C

Dsita = A // D
Due = B // D

CDsita = A // lcm(C, D)
CDue = B // lcm(C, D)


# Cで割れる時
tasu = 0
if (A % C == 0):
    tasu += 1
tasu += Cue - Csita

# Dで割れる時
if (A % D == 0):
    tasu += 1
tasu += Due - Dsita

# CでもDでも割れる
hiku = 0
if (A % (lcm(C, D)) == 0):
    hiku += 1
hiku += CDue - CDsita

print((B - A + 1) - (tasu - hiku))


### FIXED CODE ###

A, B, C, D = map(int, input().split())


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


def lcm(x, y):
    return (x * y) // gcd(x, y)


C_num = B // C - A // C

D_num = B // D - A // D

lcm = lcm(C, D)
CD_num = B // lcm - A // lcm


# Cで割れる時
tasu = 0
if (A % C == 0):
    tasu += 1
tasu += C_num

# Dで割れる時
if (A % D == 0):
    tasu += 1
tasu += D_num

# CでもDでも割れる
hiku = 0
if (A % lcm == 0):
    hiku += 1
hiku += CD_num

print((B - A + 1) - (tasu - hiku))
var = input()
print(var*var*var)


### FIXED CODE ###

var = int(input())
print(var*var*var)
n = int(input())
min_s = []
max_s = []
for i in range(n):
    a, b = map(int, input().split())
    min_s.append(a)
    max_s.append(b)

min_s.sort()
max_s.sort()
if n % 2 == 0:
    min_med = (min_s[n//2-1] + min_s[n//2-1])/2
    max_med = (max_s[n//2-1] + max_s[n//2-1])/2
    print(int(max_med-min_med)*2+1)))

else:
    min_med = min_s[(n+1)//2-1]
    max_med = max_s[(n+1)//2-1]
    print(int((max_med-min_med)+1))

### FIXED CODE ###

n = int(input())
min_s = []
max_s = []
for i in range(n):
    a, b = map(int, input().split())
    min_s.append(a)
    max_s.append(b)

min_s.sort()
max_s.sort()
if n % 2 == 0:
    min_med = (min_s[n // 2 - 1] + min_s[n // 2]) / 2
    max_med = (max_s[n // 2 - 1] + max_s[n // 2]) / 2
    print(int((max_med - min_med) * 2 + 1))

else:
    min_med = min_s[(n + 1) // 2 - 1]
    max_med = max_s[(n + 1) // 2 - 1]
    print(int((max_med - min_med)+1))
x = input()
 ans = x**3
 print ans

### FIXED CODE ###

x = input()
ans = x**3
print ans
h,w,k=map(int,input().split())
c=[input() for _ in range(h)]
count=0
for H in range(h<<1):
  for W in range(W<<1):
    b=0
    for i in range(h):
      for j in range(w):
        if (W >> i) & 1 == 0 and (H >> j) & 1 == 0 and c[i][j] == "#":
          b+=1
    if b==k:
      count+=1
print(count)

### FIXED CODE ###

h,w,k=map(int,input().split())
c=[input() for _ in range(h)]
count=0
for H in range(1<<h):
  for W in range(1<<w):
    b=0
    for i in range(h):
      for j in range(w):
        if (H >> i) & 1 == 0 and (W >> j) & 1 == 0 and c[i][j] == "#":
          b+=1
    if b==k:
      count+=1
print(count)
print({25 : 'Christmas', 24 : 'Christmas Eve', 23 : 'Christmas Eve Eve', 22 : 'Christmas Eve Eve Eve'}[input()])


### FIXED CODE ###

print({25 : 'Christmas', 24 : 'Christmas Eve', 23 : 'Christmas Eve Eve', 22 : 'Christmas Eve Eve Eve'}[int(input())])
import numpy as np

N = int(input())
P = list(map(int,input().split()))

ans = np.prod(P)

if ans>10**18:
    print(-1)
    exit()

print(ans)

### FIXED CODE ###

import numpy as np

N = int(input())
P = list(map(int,input().split()))

if 0 in P:
    print(0)
    exit()

ans=1
P.sort(reverse=True)

for i in range(N):
    ans*=P[i]
    if ans>10**18:
        print(-1)
        exit()

print(ans)
a = input()
print(a.replace(',',' ')

### FIXED CODE ###

s = input().replace(","," ")
print(s)
n = int(input())
arr = []

for i in range(n):
  s1 = input()
  
  arr.append(sorted(s1))

sarr = list(set(arr))

cnt = 0

for i in sarr:
  cnt+= arr.count(i)
  
print(cnt)

### FIXED CODE ###

N = int(input())
 
S = {}
count = 0
for i in range(N):
  sorted_string = ''.join(sorted(input()))
  if sorted_string in S:
    S[sorted_string] += 1
    count += S[sorted_string]
  else:
    S[sorted_string] = 0
 
print(count)
a,b =(int(i) for i in input.split())
if a > b:
 print("a > b")
elif  a == b:
 print("a == b")
elif a > b: 
 print("a > b")


### FIXED CODE ###

a,b =map(int, input().split())
if a > b:
 print("a > b")
elif  a == b:
 print("a == b")
else : 
 print("a < b")
N,Q = map(int, input().split())
S = input()

t = [0]*Q
d = [0]*Q
for q in range(Q):
    t[q],d[q] = map(str, input().split())


s1 = 0
sN = N-1

for q in reversed(range(Q)):
    if t[q] == S[s1] and d[q] == 'L':
        s1 += 1
    elif s1 > 0:
        if d[q] == 'R' and S[s1-1] == t[q]:
            s1 -= 1
    if t[q] == S[sN] and d[q] == 'R':
        sN -= 1
    elif sN < N-1:
        if d[q] == 'L' and S[sN+1] == t[q]:
            sN += 1
    #print(s1,sN)


print(sN-s1+1)

### FIXED CODE ###

N,Q = map(int, input().split())
S = input()

t = [0]*Q
d = [0]*Q
for q in range(Q):
    t[q],d[q] = map(str, input().split())


s1 = 0
sN = N-1

for q in reversed(range(Q)):
    if t[q] == S[s1] and d[q] == 'L':
        s1 += 1
    elif s1 > 0:
        if d[q] == 'R' and S[s1-1] == t[q]:
            s1 -= 1
    if t[q] == S[sN] and d[q] == 'R':
        sN -= 1
    elif sN < N-1:
        if d[q] == 'L' and S[sN+1] == t[q]:
            sN += 1
    if s1 > sN:
        break
    #print(s1,sN)


print(sN-s1+1)
from collections import defaultdict
from operator import sub

def main():
    N = int(input())
    balls = [tuple(map(int,input().split())) for _ in range(N)]
    d = defaultdict(int)
    for i in range(N):
        for j in range(N):
            if i == j:
                continue
            d[tuple(map(sub, balls[i], balls[j]))] += 1
    try:
        mmax = max(d.values())
    except:
        print(100)
	mmax = int(N - mmax)
    print(mmax)

if __name__ == '__main__':
    main()

### FIXED CODE ###

from collections import defaultdict
from operator import sub

def main():
    N = int(input())
    balls = [tuple(map(int,input().split())) for _ in range(N)]
    d = defaultdict(int)
    for i in range(N):
        for j in range(N):
            if i == j:
                continue
            d[tuple(map(sub, balls[i], balls[j]))] += 1
    try:
        mmax = N - max(d.values(), default=0)
        print(mmax)
    except ValueError:
        print(100)

if __name__ == '__main__':
    main()
import sys
def sign(x):
    if x>0: s=1
    elif x<0: s=-1
    else s=0
    return s

def f(p1,p2,p3):
    x1,y1 = p1
    s = sign((p3[1]-y1)*(p2[0]-x1)-(p2[1]-y1)*(p3[0]-x1))
    return s

for s in sys.stdin:
    D = map(float, s.split(","))
    p1 = D[0:2]; p2 = D[2:4]; p3 = D[4:6]; p4 = D[6:8]
    print ["NO","YES"][f(p1,p3,p2) != f(p1,p3,p4) and f(p2,p4,p1) != f(p2,p4,p3)]

### FIXED CODE ###

import sys
def sign(x):
    if x>0: s=1
    elif x<0: s=-1
    else: s=0
    return s

def f(p1,p2,p3):
    x1,y1 = p1
    s = sign((p3[1]-y1)*(p2[0]-x1)-(p2[1]-y1)*(p3[0]-x1))
    return s

for s in sys.stdin:
    D = map(float, s.split(","))
    p1 = D[0:2]; p2 = D[2:4]; p3 = D[4:6]; p4 = D[6:8]
    x = f(p1,p3,p2) != f(p1,p3,p4) and f(p2,p4,p1) != f(p2,p4,p3)
    print ["NO","YES"][x]
s=str(input())
y=700
x=0
while x!=2
if s[x]=o：
　　　y+=100
 
x+=1

print(y)

### FIXED CODE ###

S = input()
s = S.count('o')*100
 
print(700+s)
a,b=input()
if a=='H':
    if b=='H':
        print('H')
    else:
        print('D')
else:
    if b=='H':
        print('D')
    else:
        print('H')

### FIXED CODE ###

a,b=input().split()
if a=='H':
    if b=='H':
        print('H')
    else:
        print('D')
else:
    if b=='H':
        print('D')
    else:
        print('H')
n = int(input())
s = input()
l = [[] for i in range(n+1)]
l[0] = ['0',0]
ans = 0
for i in range(1,n+1):
    l[i] = [s[i-1:],i]
l.sort()
for i in range(n):
    for j in range(i+1,n):
        m = min(len(l[i][0]),len(l[j][0]))
        x = l[i][0]
        y = l[j][0]
        z = 0
        while z < m:
            if x[z] != y[z]:
                break
            z += 1
        if z > l[i][1] - l[j][1]:
            z = l[i][1] - l[j][1]
        ans = max(z,ans)
print(ans)

### FIXED CODE ###

s = input()
a ='Sunny'
b ='Cloudy'
c ='Rainy'
if s == a:
    print(b)
elif s == b:
    print(c)
else:
    print(a)
k=int(input())
a,b=list(map(int,input().split()))

aa=a//k
bb=b//k

if bb-aa=>1:
    print("OK")
else:
    print("NG")

### FIXED CODE ###

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


if a%k==0 or b%k==0:
    print("OK")
elif b//k-a//k>=1:
    print("OK")
elif b/k-a/k<1 and a%k>b%k:
    print("OK")
else:
    print("NG")
N, Q = map(int, input().split())
S = input()
t = [0] * (N + 1)
for i in range(N):
  if s[i]=='A' and s[i+1]=='C':
    t[i + 1] = t[i] + 1
  else:
    t[i + 1] = t[i]
for i in range(Q):
  l, r = map(int, input().split())
  print(t[r-1] - t[l-1])

### FIXED CODE ###

N, Q = map(int, input().split())
S = input()
t = [0] * (N + 1)
for i in range(N):
  if S[i : i + 2] == 'AC':
    t[i + 1] = t[i] + 1
  else:
    t[i + 1] = t[i]
for i in range(Q):
  l, r = map(int, input().split())
  print(t[r-1] - t[l-1])
#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int

def solve(N, C):
    last = [-1] * (N + 1)
    pairs = []
    for i, c in enumerate(C):
        prev = last[c - 1]
        if prev >= 0 and prev < i - 1:
            pairs.append((prev, i))
        last[c - 1] = i
    print(0)
    return
    pairs.sort()
    count = [0] * N
    count[0] = 1
    idx = 0
    for i in range(N):
        if i > 0:
            count[i] += count[i - 1]
            count[i] %= MOD
        while idx < len(pairs) and pairs[idx][0] == i:
            count[pairs[idx][1]] += count[i]
            count[pairs[idx][1]] %= MOD
            idx += 1
    print(count[N - 1])
    return


# Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    C = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, C)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int
MAX_N = 200000

def solve(N, C):
    last = [-1] * MAX_N
    pairs = []
    for i, c in enumerate(C):
        try:
            prev = last[c - 1]
        except:
            if c >= N:
                return
            else:
                raise Exception()
        if prev >= 0 and prev < i - 1:
            pairs.append((prev, i))
        last[c - 1] = i
    pairs.sort()
    count = [0] * N
    count[0] = 1
    idx = 0
    for i in range(N):
        if i > 0:
            count[i] += count[i - 1]
            count[i] %= MOD
        while idx < len(pairs) and pairs[idx][0] == i:
            count[pairs[idx][1]] += count[i]
            count[pairs[idx][1]] %= MOD
            idx += 1
    print(count[N - 1])
    return


# Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    C = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, C)

if __name__ == '__main__':
    main()
s = int(input())
if s <= 2:
  print(2)
elif s <= 3:
  print(3)
elif s <= 5:
  print(5)

while True:
  for i in range(2,s // 2):
    if s % i == 0:
      break
  if i == s //2 -1:
    print(s)
    exit()
  s += 1

"""
prime_data = [2,3,5]

for i in range(3,10**5):
  tmp = int(i//2)
  for j in range(2,tmp):
    if i % j == 0:
      break
    if j == tmp-1:
      prime_data.append(i)
print(prime_data)
"""

### FIXED CODE ###

s = int(input())
if s <= 2:
  print(2)
  exit()
elif s <= 3:
  print(3)
  exit()
elif s <= 5:
  print(5)
  exit()

while True:
  for i in range(2,s // 2):
    if s % i == 0:
      break
  if i == s //2 -1:
    print(s)
    exit()
  s += 1

"""
prime_data = [2,3,5]

for i in range(3,10**5):
  tmp = int(i//2)
  for j in range(2,tmp):
    if i % j == 0:
      break
    if j == tmp-1:
      prime_data.append(i)
print(prime_data)
"""