peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
def main():
    from sys import stdin
    import re

    readline = stdin.readline

    N=str(readline().rstrip())

    if ( re.match(r'.*s$',N )):
        print(N + 'es')
    else:
        print(N + 's')

main()
# Judge status: Wrong Answer
n = int(input())
s = input()
bag = []
cnt = 0
for i in s:
  if i == "I":
    cnt += 1
    bag.append(cnt)
  else:
    cnt -= 1
    bag.append(cnt)
 
print(max(bag))
# Judge status: Wrong Answer
c1=input()
c2=input()
print("YES" if c1==c2[::-1] else "No")
# Judge status: Wrong Answer
a,b,c = map(int, input().split())

tmp = a
a = b
b = tmp

tmp = a
a = c
c = a

print("{} {} {}".format(a,b,c))
# Judge status: Accepted
a,b=1,0
for c in map(int,input()):a,b=min(a+10-c-1,b+c+1),min(a+10-c,b+c)
print(b)
# Judge status: Accepted
N = input()
S = list(input())
cnt = 0
cnt_max = 0
for i in S:
  if i == 'I':
    cnt += 1
    if cnt > cnt_max:
      cnt_max = cnt
  elif i == 'D':
    cnt -= 1
print(cnt_max)
# Judge status: Wrong Answer
n=sum(list(map(int,input().split())));print(n-24 if n>=4 else n)
# Judge status: Wrong Answer
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product

def resolve():

    d,n=map(int,input().split())
    val=100**d
    if d==0 and n==100:
        print(101)
    elif d==1 and n==100:
        print(10100)
    elif d == 2 and n == 100:
        print(10010000)

    else:

        print(val*n)

resolve()
# Judge status: Accepted
A, B = map(int, input().split())

if(A>=13):
  print(B)
elif(6<=A<=12):
  print(int(B/2))
elif(A<=5):
  print("0")
# Judge status: Accepted
A, B = [int(i) for i in input().split()]

if A % 3 == 0 or B % 3 == 0 or (A + B) % 3 == 0:
    print('Possible')
else :
    print('Impossible')
# Judge status: Accepted
#agc008-a
x,y=map(int,input().split())
ans=float('inf')

#反転させるかどうか決めた後のx,yの上下関係を考える
#0,0
if y-x>0:
    ans=min(ans,y-x)
#1,0
if -x<=y:
    ans=min(ans,1+y+x)
#0,1
if x<=-y:
    ans=min(ans,1+-y-x)
#1,1
if -x<=-y:
    ans=min(ans,2+-y+x)
print(ans)
# Judge status: Wrong Answer
n=int(input())
p=list( map(int, input().split()))
ans=0
for i in range(n):
    if p[i]==i+1:
        ans=ans+1
if ans<=2:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
K,S = [int(i) for i in input().split()]
count = 0
for i in range(K+1):
    for j in range(K+1):
        k = S - i - j
        if 0 <= k and k <= K:
            count += 1

print(count)
# Judge status: Accepted
n,t=map(int,input().split())
c=[]
time=[]
re=[]
l=[]
for i in range(n):
    a,b=map(int,input().split())
    c.append(a)
    time.append(b)
    
for i in range(n):
    if time[i]>t:
        re.append(i)

for j in range(n):
    if j in re:
        continue
    else:
        l.append(c[j])

if len(l)==0:
    print('TLE')
else:
    print(min(l))
# Judge status: Wrong Answer
n, m = map(int, input().split())

ret = 0

if (n >= 3) and (m >= 3):
    ret += (n-2) * (m-2)

if (n == 1) and (m >= 3):
    ret += m - 2

if (m == 1) and (n >= 3):
    ret += n - 2

print(ret)
# Judge status: Accepted
n = int(input())
s = input()
x = 0
xmax = 0
for s0 in s:
    if s0 == 'I':
        x += 1
    else:
        x -= 1
    if x > xmax:
        xmax = x
print(xmax)
# Judge status: Accepted
l = sorted(list(map(str, input().split())), reverse=True)
print(int(l[0]+l[1]) + int(l[2]))
# Judge status: Accepted

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

count = 0
while x <= y:
  x *= 2
  count += 1

print(count)
# Judge status: Accepted
n, d = map(int, input().split())
i = 0
for _ in range(n):
    x, y = map(int, input().split())
    dis = (x**2 + y**2) **0.5
    if dis <= d:
        i += 1

print(int(i))
# Judge status: Accepted
N,M = map(int, input().split())
l=0
r=N
for _ in range(M):
  ll,rr=map(int,input().split())
  l = max(l,ll)
  r = min(r,rr)
ans = r - l + 1
print(ans if ans > 0 else 0)
# Judge status: Accepted
s = input()


if 'RRR' in s:
    print(3)
elif 'RR' in s:
    print(2)
elif 'R' in s:
    print(1)
else:
    print(0)
# Judge status: Wrong Answer
N, x = list(map(int,input().split()))
a = list(map(int,input().split()))
result = 0

for i in range(N-1):
  n = a[i] + a[i+1] - x
  if n > 0:
    result += n
    a[i+1] -= n
    if a[i+1] < 0:
      a[i+1] = 0

print(result, a)
# Judge status: Wrong Answer
n = int(input())

if n == 1 or n == 2:
    print(n)
else:
    a = []
    m = 0
    for i in range(1, n):
        if m > n: break
        a.append(i)
        m += i


    for i in range(len(a) ** 2):
        g = []
        for j in range(len(a)):
            if ((i >> j) & 1):
                g.append(a[j])
        if sum(g) == n:
            print(*g)
            break
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
B = [0]
for a in A:
    B.append(B[-1] + a)

ans = float('inf')
for i in range(1,N):
    tmp = abs(B[-1]-B[i] - B[i])
    ans = min(ans, tmp)
print(ans)
# Judge status: Accepted
X = int(input())
if X == 1:
  print(1)
  exit()

def it():
  for i in range(2, X):
    x = i*i
    if x > X: return 0
    
    while x*i <= X:
      x *= i
    yield x
  
print(max(it()))
# Judge status: Accepted

lst = list(int(input()) for _ in range(6))

print("Yay!" if lst[4] - lst[0] <= lst[5] else ":(")
# Judge status: Accepted
S = input()
dp = [0] * len(S)
dp[0] = 1
dp[1] = 1 if S[0] == S[1] else 2
for i in range(2, len(S)):
    if S[i] != S[i - 1]:
        dp[i] = dp[i - 1] + 1  # ここは自明
    else:
        dp[i] = dp[i - 3] + 2
print(dp[-1])
# Judge status: Wrong Answer
from math import sqrt


N, M = map(int, input().split())

ans = 1
for i in range(1, int(sqrt(M))):
    if M % i == 0 and M / N >= i:
        ans = i

print(ans)
# Judge status: Accepted

def main():
    n = int(input())
    s = []
    for _ in range(n):
        ss = int(input())
        s.append(ss)

    sm = sum(s)
    if sm % 10 != 0:
        print(sm)
        return

    s.sort()
    for i, ss in enumerate(s):
        if ss % 10 != 0:
            print(sm - ss)
            return
    print(0)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N,M=map(int,input().split())
KA=[]
A=[]
a=0
for i in range(N):
    KA.append(list(map(int,input().split())))
for i in range(N):
    KA[i].remove(KA[i][0])
for i in range(N):
    for j in range(len(KA[i])):
        A.append(KA[i][j])
print(A)
for i in range(1,M+1):
    if N==A.count(i):
        a+=1
print(a)
# Judge status: Accepted
import math
N = int(input())
sq = math.floor(math.sqrt(N))
ans = N
for i in range(1, sq + 1):
	if(N % i == 0):
		ans = i + N // i - 2
print(ans)
# Judge status: Accepted
from itertools import product

A,B,C,D=map(int,input())
O=["+","-"]
X=product(O,repeat=3)

for (p,q,r) in X:
    T="{}{}{}{}{}{}{}".format(A,p,B,q,C,r,D)
    if eval(T)==7:
        print("{}=7".format(T))
        break
# Judge status: Accepted
def lucas(n, memo={}):
    if n == 0:
        return 2
    elif n == 1:
        return 1
    elif n in memo:
        return memo[n]
    else:
        memo[n] = lucas(n - 1, memo) + lucas(n - 2, memo)
        return lucas(n - 1) + lucas(n - 2)


n = int(input())
print(lucas(n))
# Judge status: Accepted
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    n,m = LI()
    if n > m:
        n,m = m,n
    ans = 0
    if n == 1:
        ans = abs(m-2)
    elif n == 2:
        ans = 0
    else:
        ans = (n-2)*(m-2)

    print(ans)
main()
# Judge status: Accepted
mod = 2019
l, r = map(int, input().split())
m = min(r, l + mod)
MN=[]
for i in range(l, m):
    for j in range(i+1, m+1):
        cand = i * j % mod
        if cand:
            MN.append(cand)
        else:
            print(0)
            exit()
print(min(MN))
# Judge status: Wrong Answer
num = int(input())
str_line = input().split(" ")
num_line = [int(n) for n in str_line]

ave = 0
for i in range(num):
    ave += num_line[i]

ave = -(-ave//num)

wa = 0
for i in range(num):
    temp = num_line[i] - ave
    wa += temp*temp
    
print(wa)
# Judge status: Accepted

n,m = map(int, input().split(' '))
h = list(map(int, input().split(' ')))
a = [list(map(int, input().split(' '))) for _ in range(m)]

res = [set() for _ in range(n)]

for i,j in a:
    res[i-1].add(j-1)
    res[j-1].add(i-1)
ans = 0
res = [j if j != set() else set([i]) for i,j in enumerate(res)]
for i in range(n):
    for j in res[i]:
        if i == j:
            ans += 1
            break
        if h[i] <= h[j]:
            break
    else:
        ans += 1
print(ans)
# Judge status: Accepted
a,b=map(int, input().split())
s=sum(map(int, input().split()))
print('Yes' if s >= a else 'No')
# Judge status: Accepted
s1 = str(input())
s2 = str(input())
diff=[]
for i in range(0,len(s1)-len(s2)+1):
  str1 = s1[i:i+len(s2)]
  #print(str1)
  val=0
  for i in range(len(str1)):
    if(abs(ord(str1[i])-ord(s2[i])) > 0):
      val += 1
  diff.append(val)
print(min(diff))
# Judge status: Accepted
n,a,b = map(int,input().split())
s=input()

AB=0
B=0
for i in range(n):
    if s[i] =='a':
        if AB<a+b:
            AB+=1
            print('Yes')
        else:
            print('No')
    elif s[i] =='b':
        B+=1
        if AB<a+b and B<=b:
            AB+=1
            print('Yes')
        else:
            print('No')
    else:
        print('No')
# Judge status: Accepted
#!/usr/bin/env python3
n, *h = map(int, open(0).read().split())
r = [0] * n
for i in range(1, n):
    if h[i - 1] >= h[i]:
        r[i] = r[i - 1] + 1
    else:
        r[i] = 0
print(max(r))
# Judge status: Accepted
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input():
    return sys.stdin.readline().rstrip()

def main():
    l=list(map(int,input().split('/')))
    if l[0]<2019 or l[1]<=4:
        print('Heisei')
    else:
        print('TBD')

if __name__ == '__main__':
    main()
# Judge status: Accepted
N = int(input())
li = []
for i in input().split():
    li.append(int(i))

a = 1
count = 0
for i in li:
    if a % 2 == 1 and i % 2 == 1:
        count += 1
    a += 1
print(count)
# Judge status: Accepted
from itertools import *

n, m, q = map(int, input().split())
abcd = []
for i in range(q):
    abcd.append(list(map(int, input().split())))
    abcd[i][0] -= 1
    abcd[i][1] -= 1

numbers = []
for i in range(1, m + 1):
    numbers.append(i)
    
cwr = list(combinations_with_replacement(numbers, n))

ans = 0
for c in cwr:
    cnt = 0
    for i in range(q):
        if c[abcd[i][1]] - c[abcd[i][0]] == abcd[i][2]:
            cnt += abcd[i][3]
    
    ans = max(ans, cnt)

print(ans)
# Judge status: Wrong Answer
A, B = map(int, input().split())

time = A + B
if time > 24:
  time = time - 24
print(time)
# Judge status: Accepted
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

x = I()
if x == 3 or x == 5 or x == 7:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
a,b,c,d=map(int,input().split())
print("Yes" if (c//b+c%b>0)<=(a//d+a%d>0) else "No")
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

ans = 1
if 0 in A:
    print(0)
else:
    for i in range(N):
        ans *= A[i]
        if 10 ** 18 < ans:
            ans = -1
            break
    print(ans)
# Judge status: Wrong Answer
import sys
import math
s=str(input())
s1=len(s)
k=0
a=0
p=list()
if s1<4:
    print(0)
    sys.exit()
for i in range(s1):
    b=(int(s[s1-i-1])*10**i)%2019
    a=a+b
    p.append(a%2019)
for i in range(1,2019):
    l=p.count(i)
    if l>=2:
        k=k+l-1
print(k+math.factorial(p.count(0)))
# Judge status: Accepted
import math
N = int(input())
A = int(math.sqrt(N))
print(A * A)
# Judge status: Wrong Answer
N ,X, T = map(int,input().split())

if N %X ==0:
	a = N // X + 1
else:
	a = N//X
total = a *T
print(total)
# Judge status: Wrong Answer
s = input()

s = list(s)

ans = True

fs = 0
sl = -1
fl = (len(s) - 1) // 2
ss = (len(s) + 3) // 2
for i in range(fl // 2):
    if s[fs+i] == s[fl-i] and s[fl-i] == s[ss+i] and s[ss+i] == s[sl-i]:
        pass
    else:
        ans = False
        break

if ans:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
N, M, *A = map(int, open(0).read().split())
vote = sum(A) / (4*M)
num = list(filter(lambda x: x > vote, A))
num = len(num)
if num >= M:
	print("Yes")
else:
	print("No")
# Judge status: Accepted
from itertools import permutations

def f(a,g):
    return ((a+(g-1))//g)*g

A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())

P=[A,B,C,D,E]
Q=permutations(P)

M=10**100
for (v,w,x,y,z) in Q:
    M=min(M,f(v,10)+f(w,10)+f(x,10)+f(y,10)+z)
print(M)
# Judge status: Wrong Answer
import sys
import math

a = []
for l in sys.stdin:
    a.append(l)
    
N,D = a[0].split(' ')
N = int(N)
D = float(D)

x = []
y = []
count = 0
dist = 0.0
for i in range(1,N):
	x, y = a[i].split(' ')
	x = int(x)
	y = int(y)
	dist = math.sqrt(x*x+y*y)
	if dist <= D:
		count = count + 1

print(count)
# Judge status: Accepted
n,k=map(int,input().split())
a=list(map(int,input().split()))
for i in range(0,n-k):
    if a[i]<a[i+k]:
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
s = input()
t = input()

s = ''.join(s)
t = ''.join(t)


count = 0
maxcount = 0
slen = len(s)
tlen = len(t)
j = 0

while j <= slen-tlen:
    k = j
    for i in range(tlen):
        if t[i] == s[k]:
            count += 1
        k+= 1
    j += 1
    if count > maxcount :
        maxcount = count
    count = 0
print(len(t)-maxcount)
# Judge status: Accepted
a=int(input())
b=int(input())
h=int(input())

print(((a+b)*h)//2)
# Judge status: Wrong Answer
a, b = map(int, input().split())

if a + b> 24:
    print(str(a + b - 24))
else:
    print(str(a + b))
# Judge status: Accepted
K,A,B = map(int,input().split())
if B-A-2 <= 0:
  print(K+1)
  exit()

if K-1 < A:
  print(K+1)
  exit()
  
K -= (A-1)
num = K//2
nokori = K%2
#print(K,num,nokori)
ans = A+num*(B-A)+nokori
print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
k = 0
for i in a:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            pass
        else:
            k += 1
    else:
        pass

if k != 0:
    print('DENIED')
else:
    print('APPROVED')
# Judge status: Accepted
import bisect

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

L.sort()
res = 0
for i in range(N):
    for j in range(i+1, N):
        query = L[i] + L[j]
        res += bisect.bisect_left(L, query) - j - 1

print(res)
# Judge status: Accepted
from collections import defaultdict
N = int(input())
a = list(map(int, input().split()))
d = defaultdict(int)
ans = 0
for i in a:
    d[i] += 1
ans1 = []
for v, c in d.items():
    if c >= 2:
        ans1.append(v)

ans1.sort(reverse=True)
if len(ans1) > 1:
    ans = ans1[0] * ans1[1]

ans2 = []
for v, c in d.items():
    if c >= 4:
        ans2.append(v)

ans2.sort(reverse=True)

if len(ans2) > 0:
    ans = max(ans, ans2[0] * ans2[0])

print(ans)
# Judge status: Accepted
s=t=0
for i in input():
    if i=="S":
        s+=1
    elif s>0:s-=1
    else:t+=1
print(s+t)
# Judge status: Accepted
A, B, C = map(int, input().split())

if A + B + C == 17 and max(A, B, C) == 7 and min(A, B, C) == 5:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
N=int(input())
 
a=0
w=0
t=0
r=0
 
for i in range(N):
  s=input()
  if s=="AC":
    a+=1
  elif s=="WA":
    w+=1
  elif s=="TLE":
    t+=1
  elif s=="RE":
    r+=1

print("AC ×",a)
print("WA ×",w)
print("TLE ×",t)
print("RE ×",r)
# Judge status: Accepted
n = int(input())
if n == 0:
    print(0)
    exit()
ans = []
while abs(n) > 0:
    ans.append(n%2)
    n = (n - (n % 2)) // -2
print(''.join(map(str, ans[::-1])))
# Judge status: Accepted
A, B, C = map(int,input().split())
print('Yes' if A<C<B or A>C>B else 'No')
# Judge status: Wrong Answer
w,a,b = map(int,input().split())

print(max(b-(a+w),w-b))
# Judge status: Accepted
#!/usr/bin/env python3

import numpy as np


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

median = np.median(x)
x_sorted = sorted(x)

index = len(x)//2-1

for i in x:
    if i == median:
        print(i)
    elif i < median:
        print(x_sorted[index+1])
    else:
        print(x_sorted[index])
# Judge status: Accepted
from collections import defaultdict
n = int(input())
a = list(map(int,input().split()))
c = defaultdict(int)
for x in a:
  c[x] += 1

sq = False
top, sec = 0,0
for k,v in c.items():
    if v < 2:
        continue
    if k > top:
        sq = v >= 4
        sec = top
        top = k
    elif k > sec:
        sec = k

if sq:
    print(top * top)
else:
    print(top * sec)
# Judge status: Accepted
n = int(input())
a = [0 for i in range(n)]

for z in range(1, int(n**0.5+1)):
    for y in range(1, int(n**0.5+1)):
        for x in range(1, int(n**0.5+1)):
            i = x*x + y*y + z*z + x*y + y*z + x*z
            if i <= n: a[i-1] += 1 

for i in range(n):
    print(a[i])
# Judge status: Accepted
a,b,c,x,y=map(int,input().split())
minpr=10e+10
memo=None
if x>=y:
  for i in range(x+1):
    price= i*a+ 2*(x-i)*c+ max(0,y-(x-i))*b
    minpr=min(price,minpr)
  print(minpr)
else:
  
  for i in range(y+1):
    price= i*b+ 2*(y-i)*c+ max(0,x-(y-i))*a
    minpr=min(price,minpr)
  print(minpr)
# Judge status: Accepted
n=int(input())
while True:
  if list(str(n))[0]==list(str(n))[1]==list(str(n))[2]:
    break
  n+=1
print(n)
# Judge status: Accepted
if int(input()) >=1000:
  print("ABD")
else:
  print("ABC")
# Judge status: Accepted
a,b = (int(input()) for _ in range(2))
print("Yes" if a%500<=b else "No")
# Judge status: Accepted
from collections import Counter
import math
n = int(input())
res = 0
all = []
for i in range(n):
    s = input()
    sor = sorted(s)
    all.append("".join(sor))
counter = dict(Counter(all))
for i in counter.values():
    if i > 1: 
        res += math.factorial(i)/(2*math.factorial(i-2))
print(int(res))
# Judge status: Wrong Answer
x, a, b = map(int, input().split())

if a-b > 0:
    print("delicious")

if a-b < 0:
    if b-a < x:
        print('safe')
if b > x+a:
    print("dangerous")
# Judge status: Wrong Answer
def Multiple_Gift(x , y):

    ans = 1

    while x < y:
        if x * 2 < y:
            ans += 1
        x = x * 2

    return ans

def main():
    x , y = map(int , input().split())
    print(Multiple_Gift(x , y))

if __name__ == '__main__':
    main()
# Judge status: Accepted
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    c = input()
    L = list("aiueo")
    print("vowel" if c in L else "consonant")


if __name__ == '__main__':
    resolve()
# Judge status: Accepted
a = int(input())
ans = a + a ** 2 + a ** 3
print(ans)
# Judge status: Accepted
h,n = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(n)]
INF = 10 ** 18
dp = [10 ** 18] * (h+1)
dp[0] = 0
for i in range(h):
  for a,b in ab:
    c = min(h,i+a)
    dp[c] = min(dp[c],dp[i]+b)
ans = dp[h]
print(ans)
# Judge status: Wrong Answer
import numpy as np
from fractions import gcd
from functools import reduce
from math import floor

N ,M = map(int, input().split())
A = list(set(list(map(int, input().split()))))

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

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

lcm = lcm_list(A)
least_lcm = lcm // 2
print(max(floor( (M - least_lcm) // lcm + 1), 0))
# Judge status: Accepted
n=int(input())
a=[]
a=list(map(int,input().split()))
ave=sum(a)/n
if ave<int(ave)+0.5:
  ave=int(ave)
else:
  ave=int(ave)+1
ans=0
for i in range(n):
  ans+=(a[i]-ave)**2
print(ans)
# Judge status: Accepted
import sys

input = sys.stdin.readline

def main():
    ans = 'no'
    s = input()
    if len(s) == len(set(s)):
        ans = 'yes'
    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Accepted
a,b,c = map(int,input().split())
print("Yes")  if a<c<b or a>c>b else print("No")
# Judge status: Accepted
def main():
  import sys
  n,*d=map(int,sys.stdin.buffer.read().split())
  e=[0]*n
  for i in d:e[i]+=1
  a=1if d[0]<1else 0
  for i in d[1:]:a=a*e[i-1]%998244353
  print(a)
main()
# Judge status: Accepted
import numpy as np,sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,M = LI()
ab = np.array([LI() for _ in range(N)])
cd = np.array([LI() for _ in range(M)])
for x in ab:
    vector = np.sum(np.abs(cd-x),axis=1).tolist()
    print(vector.index(min(vector))+1)
# Judge status: Wrong Answer
from math import log2,ceil

def main():
    N,K = map(int,input().split())
    ans = 0
    for i in range(1,N + 1):
        digit = ceil(log2(K) - log2(i))
        ans += (1/N)*0.5**digit
    print(ans)
    return


if __name__ == "__main__":
    main()
# Judge status: Accepted
M=2019
a=i=0
d=[1]+[0]*M
p=1
for j in input()[::-1]:i=(i+int(j)*p)%M;a+=d[i];d[i]+=1;p=p*10%M
print(a)
# Judge status: Wrong Answer
a = input()
a.split(" ")
if a[0] == a[1]:
    print("yes")
else:
    print("no")
# Judge status: Wrong Answer
a, b = map(int, input().split())
if (b % a == 0):
  print(b + a)
else:
  print(b - a)
# Judge status: Accepted
x,k,d = map(int, input().split())
x = abs(x)
a= x//d
b = x%d
if a>=k:
  print(x-k*d)
  exit(0)
c = abs(b-d)
if (k-a)%2==0:
  print(b)
else:
  print(c)
# Judge status: Accepted
import math
n,k=map(int,input().split())

if n%k==0:
  print(0)
else:
  max=math.floor(7/3)
  min=7%3
  print(max-min)
# Judge status: Accepted
import sys
def input():
    return sys.stdin.readline().rstrip('\n')
    

def calc(N):
    ans = 0
    for i in range(1, N + 1):
        k = N // i
        ans += i * k * (k + 1) // 2
    return ans



N = int(input())
print(calc(N))
# Judge status: Accepted
n =int(input())
l =list(map(int ,input().split()))
if sum(l)- max(l) >max(l):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
S,T = map(str,input().split())
A,B = map(int,input().split())
U = input()

if S==U: A -= 1
if T==U: B -= 1
  
print(str(A) + " " + str(B))
# Judge status: Wrong Answer
import math

x = input().split(" ")
a = int(x[0])
b = int(x[1])
c = int(x[2])
d = int(x[3])

c_count = (b//c)-((a-1)//c)
d_count = (b//d)-((a-1)//d)
print(c_count)
print(d_count)
# Judge status: Accepted
n, w = map(int, input().split())
wv = [tuple(map(int, input().split())) for _ in range(n)]
 
dp = [0] * (w+1)
for wi, vi in wv:
    for sum_w in reversed(range(wi, w+1)):
        dp[sum_w] = max(dp[sum_w], dp[sum_w - wi] + vi)
print(dp[w])
# Judge status: Accepted
n=int(input())
a=[]
for i in range(n):
    a.append(int(input()))
m=max(a)
b=sorted(a)
m2=b[-2]
for i in range(n):
    if a[i]==m:
        print(m2)
    else:
        print(m)
# Judge status: Wrong Answer
n,m=map(int, input().split())
num=0
l=[]
if n%2==0:
    num=n//m
else:
    num=(n//m)+1
for i in range(m):
    l.append(num)
    num=num-1
l.reverse()
for i in l:
    print(i,end=" ")
    print(n-i)
# Judge status: Wrong Answer
from math import log2
n, k = map(int, input().split())
To = []
A = list(map(int, input().split()))
A = list(map(lambda x: x - 1, A))
To.append(A)
for i in range(int(log2(k))):
    N = [0 for i in range(n)]
    for j in range(n):
        N[j] = To[i][To[i][j]]
    To.append(N)

v = 0
for i in reversed(range(int(log2(k)) + 1)):
    l = 1 << i
    print(i)
    if l <= k:
        v = To[i][v]
        k -= l
    else:
        pass

print(v + 1)
# Judge status: Accepted
n=input()
if n[len(n)-1] == "s":
    print (n+"es")
else:
    print (n+"s")
# Judge status: Accepted
N = int(input())

memo = {}

def luca(N):
    if N in memo:
        return memo[N]
    else:
        memo[N] = 0
    if N == 0:
        memo[N] = 2
        return 2
    if N == 1:
        memo[N] = 1
        return 1
    memo[N] = luca(N-1) + luca(N-2)
    return memo[N]

print(luca(N))