peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
def manhattan_distance(s, c):
    return abs(s[0] - c[0]) + abs(s[1] - c[1])


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

students = [list(map(int, input().split())) for _ in range(N)]
checkpoints = [list(map(int, input().split())) for _ in range(M)]

for s in students:
    ans = 0
    min_distance = manhattan_distance(s, checkpoints[0])
    for i in range(1, M):
        distance = manhattan_distance(s, checkpoints[i])
        if min_distance > distance:
            min_distance = distance
            ans = i
    print(ans + 1)
# Judge status: Wrong Answer
import sys
def I(): return int(sys.stdin.readline().rstrip())

N = I()
if N < 105:
    print(0)
elif N < 165:
    print(1)
elif N < 195:
    print(2)
else:
    print(3)
# Judge status: Accepted
N, K = map(int, input().split())
H = list(map(int, input().split()))

inf = float('inf')
dp = [inf] * (N + 1)
dp[1] = 0

for i in range(1, N):
    for j in range(1, K + 1):
        if i + j <= N:
            dp[i + j] = min(dp[i + j], dp[i] + abs(H[i - 1] - H[i + j - 1]))

print(dp[N])
# print(dp)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

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

res = 0
for i in a:
    res = gcd(res, i)
print(res)
# Judge status: Accepted
a = int(input())

print(a + a**2 + a**3 )
# Judge status: Accepted
n = int(input())

N_1 = n - 1
ans = 0
i = 1
j = 1
while i <= N_1:
    while j <= N_1:
        if i * j <=  N_1:
            ans += 1
        else:
            j = N_1
        j = j + 1
    j = 1
    i = i + 1

print(ans)
# Judge status: Accepted
import sys
import collections

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    S = input().strip()

    c = collections.Counter(S)
    c['a'] += 1
    c['a'] -= 1
    c['b'] += 1
    c['b'] -= 1
    c['c'] += 1
    c['c'] -= 1

    if c.most_common()[0][1] - c.most_common()[2][1] >= 2:
        print("NO")
    else:
        print("YES")


if __name__ == '__main__':
    main()
# Judge status: Accepted
n = int(input())
flag = True
dx, dy, dt = 0, 0, 0

for _ in range(n):
    t, x, y = map(int, input().split())
    dist = abs(dx - x) + abs(dy - y)
    if t - dt < dist or (t - dt - dist) % 2:
        flag = False
    dt, dx, dy = t, x, y

print("Yes" if flag else "No")
# Judge status: Accepted
s = input()
cur = 0
deletedpairs = 0
for i in range(len(s)):
    #print(i, deletedpairs)
    if s[i] == "S":
        cur += 1
    if s[i] == "T":
        if cur > 0:
            deletedpairs += 1
            cur -= 1
        else:
            pass

#print(deletedpairs)
print(len(s) - deletedpairs*2)
# Judge status: Accepted
n, a, b = map(int, input().split())
ans = n // (a + b) * a
rem = n % (a + b)
ans += min(rem, a)
print(ans)
# Judge status: Accepted
def f(x):
    x -= 1
    if (int(x / 26)):
        return f(int(x/26)) + chr((x % 26) + 97)
    return chr((x % 26) + 97)


n = int(input())

print(f(n))
# Judge status: Accepted
import sys
readline = sys.stdin.readline

N,M,K = map(int,readline().split())
A = [0] + list(map(int,readline().split()))
B = [0] + list(map(int,readline().split()))

for i in range(1,len(A)):
  A[i] += A[i - 1]

for i in range(1,len(B)):
  B[i] += B[i - 1]

ans = 0
b_ind = len(B) - 1
for i in range(len(A)):
  if A[i] > K:
    break
  while b_ind >= 0 and A[i] + B[b_ind] > K:
    b_ind -= 1
    
  if ans < i + b_ind:
    ans = i + b_ind
    
print(ans)
# Judge status: Accepted
# coding: utf-8
# 自分の得意な言語で
# Let's チャレンジ！！
input_line = input()
lines = input_line.split()
x=int(lines[0])
y=int(lines[1])
input_num=x*y
if(x==1 or y==1):
  print(1)
else:
  if((x*y)%2==1):
    print(int(input_num/2)+1)
  else:
    print(int(input_num/2))
# Judge status: Accepted
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))

import math
print(math.ceil((N-1)/(K-1)))
# Judge status: Accepted
def main():
    x = int(input())
    if x:
        print(0)
    else:
        print(1)

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
a = input()

b = ["s", "o", "x", "sh", "ch"]
if a[-2:] in b:
    print(a + "es")
else:
    print(a + "s")
# Judge status: Wrong Answer
N = int(input())
S = input()

b = 0
w = 0
stones = []
for i in S:
    if i == "#":
        b += 1
    else:
        w += 1
    stones.append((b,w))

bb = S.count("#")
ww = N-bb

ans = 1e9

for b,w in stones:
    ans = min(ans,b+ww-w)

print(ans)
# Judge status: Accepted
S = input()

ans = 0
for i in range(1,len(S)):
    if S[i] == S[i-1]:
        ans += 1

if ans >= 1:
    print("Bad")
else:
    print("Good")
# Judge status: Wrong Answer
n = int(input())

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

import collections
c = collections.Counter(a)

for i in range(n-1):
    num = a[i]
    print(c[num+1])
# Judge status: Accepted
a,b,c = list(map(int, input().split()))

if((b-a) == (c-b)):
        print("YES")
else:
        print("NO")
# Judge status: Wrong Answer
import sys
n=int(input())
s=input()
if len(s)%2==1:
    print('No')
    sys.exit()
if s[1:n//2+1]==s[n//2+1:0:-1]:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
a.sort()
a.append(a[0])
div = a[0]
minVal = a[0]
for i in range(n+1):
    mod = a[i] % div
    if mod > 0 and minVal > mod:
        minVal = min(mod, div - mod)
        div = minVal
    else:
        continue
print(minVal)
# Judge status: Accepted
import fractions
def sks(a,b):
    return (a*b)//fractions.gcd(a,b)
c=int(input())
result=1
for a in range(c):
    result=sks(result,int(input()))
print(result)
# Judge status: Wrong Answer
N = int(input())
if N % 9 == 0:
    print("yes")
else:
    print("no")
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
money = 1000

for i in range(N-1):
    if A[i] < A[i+1]:
        d = money // A[i]
        money = money % A[i]
        money += d * A[i+1]
        
print(money)
# Judge status: Accepted
import math


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


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

a = [i for i in range((x-k)+1, x+k)]
print(*a)
# Judge status: Accepted
# ruisekiwa by numpy

import numpy as np

N,K = map(int,input().split())
p = np.array(list(map(int,input().split())))

b=np.concatenate([np.array([0]),np.cumsum(p)])

K_sum = b[K:] - b[:-K]
    
print((max(K_sum)+K)/2)
# Judge status: Accepted
import sys
MAX_INT = int(10e15)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

s = S()
t = s[::-1]
N = len(s)

dp = [[MAX_INT]*2 for i in range(N+1)]
dp[0][0] = 0
for i in range(N):
  num = int(t[i])
  dp[i+1][0] = min(dp[i][0] + num, dp[i][1] + num +1)
  dp[i+1][1] = min(dp[i][0] + 10-num, dp[i][1] + 10-num-1)
print(min(dp[-1][0], dp[-1][1]+1))
# Judge status: Accepted
N = int(input())

if N == 0 :
    print(0)
    exit()

ans = []

while N :
    r = abs(N%2)
    ans.append(int(r))
    N = (N-r)//(-2)

ans.reverse()
print(*ans, sep="")
# Judge status: Accepted
S = input()
a = [0] * (len(S) + 1)
for i in range(len(S)):
    if S[i] == "<":
        a[i + 1] = a[i] + 1

for i in list(range(len(S)))[::-1]:
    if S[i] == ">" and a[i + 1] >= a[i]:
        a[i] = a[i + 1] + 1

print(sum(a))
# Judge status: Accepted
# -*- coding: utf-8 -*-
"""
Created on Fri May 15 15:49:49 2020

@author: shinba
"""

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

ans = 0

for i in range(n):
    if A[i] == i+1:
        ans += 1
        if i != n-1:
            A[i+1] = A[i]

print(ans)
# Judge status: Accepted
S=input()
print(2*(min(S.count('1'),S.count('0'))))
# Judge status: Accepted
import sys

s = int(input())

def f(n):
    if not n%2:
        return int(n/2)
    else:
        return int(3*n+1)

a = list()
a.append(s)
i = 1
r = 0
g = 0
while 1:
    n = f(a[i-1])
    for r in a:
        if r==n:
            print(i+1)
            sys.exit()
            
            
    a.append(n)
    i=i+1
# Judge status: Accepted
N,K=map(int,input().split())

ans=0
while N>=K**ans:
    ans+=1

print(ans)
# Judge status: Wrong Answer
import sys
input = lambda: sys.stdin.readline().rstrip()
s=[i for i in input()]
x=0 ; st=[[],[]]
for _ in range(int(input())):
    inp=list(map(str,input().split()))
    if len(inp)==1: x^=1
    else: st[(int(inp[1])-1)^x].append(inp[2])
if x==0:
    st[0].reverse()
    ans=st[0]+s+st[1]
elif x==1:
    st[1].reverse()
    ans=st[1]+s+st[0]
print(''.join(ans))
# Judge status: Accepted
import sys

mod = 1000000007

N, M = map(int, sys.stdin.readline().split())
A = set()
for _ in range(M):
    a = int(sys.stdin.readline())
    A.add(a)

dp = [0] * (N+1)
dp[0] = 1
dp[1] = 0 if 1 in A else 1
for i in range(1, N):
    if i+1 in A:
        continue
    dp[i+1] = dp[i] + dp[i-1]
    dp[i+1] %= mod

# print(dp)
print(dp[N])
# Judge status: Wrong Answer
ABC = list(map(int, input().split()))

mini = float('inf')

if ABC[0]%2 == ABC[1]%2 == ABC[2]%2 == 0:
    print(0)
else:
    for i in range(3):
        calc = 1
        for j in range(3):
            if i != j:
                calc *= ABC[j]
        if calc < mini:
            mini = calc
    print(calc)
# Judge status: Accepted
from fractions import *
g=gcd(*map(int,input().split()))
c=1
for i in range(2,int(g**.5)+1):
  if g<2: break
  if g%i<1: c+=1
  while g%i<1: g//=i
print(c+(g>1))
# Judge status: Accepted
N = int(input())
 
#from collections import deque
 
#Q = deque()
 
S = "a"
 
def printer(S,max_s):
    if len(S)==N:
        print(S)
    else:
        max_s = max(ord(S[-1])-ord('a'),max_s)
        for i in range(ord('a'),ord('a')+max_s+2):        
            printer(S + chr(i),max_s)
        
printer(S,0)
# Judge status: Wrong Answer
a,b=map(int,input().split())
n=b-a
s=n*(n-1)//2
print(s-b)
# Judge status: Wrong Answer
S = input()

for s in S:
  if s!="1":
    print(s)
    break
# Judge status: Accepted
n=int(input())
ans=0
for a in range(1,n):
    if n%a==0:
        ans+=n//a-1
    else:
        ans+=n//a
print(ans)
# Judge status: Accepted
h,n= map(int, input().split())
a= [list(map(int, input().split())) for i in range(n)]

dp=[float('inf')]*(h+1)
dp[0]=0
for i in range(n):
    x=a[i][0]
    y=a[i][1]
    for j in range(h+1):
        if j>=x:
            dp[j]=min(dp[j-x]+y,dp[j])
        else:
            dp[j]=min(y,dp[j])

print(dp[-1])
# Judge status: Accepted
#!/usr/bin/env python3

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

ans = 1
num = int(m**0.5)+1

for i in range(1, num):
    if m % i != 0:
        continue
    j = m//i
    if i >= n:
        ans = max(ans, j)
    if j >= n:
        ans = max(ans, i)
print(ans)
# Judge status: Wrong Answer

N = int(input())
if N % 2 == 1:
   print((N+1)/2)
else:
    print(N/2)
# Judge status: Accepted
n = int(input())
kouho = [chr(i) for i in range(97, 97+26)]
ans = []
while n>0:
    n-=1
    ans.append(kouho[n%26])
    n = n//26
ans.reverse()
print(''.join(ans))
# Judge status: Accepted
# -*- coding: utf-8 -*-
A, B, C = map(int, input().split())
print(['No', 'Yes'][A + B >= C])
# Judge status: Accepted
a = list(map(int, input().split()))
print(max(0, a[2]-(a[0]-a[1])))
# Judge status: Accepted
x = int(input())

if x//100 > 19:
    print(1)
else:
    tmp1 = x%100
    tmp2 = x//100
    if 5*tmp2<tmp1:
        print(0)
    else:
        print(1)
# Judge status: Accepted
x = input()
print("A" if x == x.upper() else "a")
# Judge status: Accepted
def main():
    a = int(input())
    b = int(input())

    if ((a+b) == 3):
        print(3)
    elif  ((a+b) == 4):
        print(2)
    else:
        print(1)

if __name__ == "__main__":
    main()
# Judge status: Accepted
A,B,C = map(int,input().split())
a = max(A,B,C)
c = min(A,B,C)
b = A+B+C-a-c
ans = a-b
if (b-c)%2==0:
    print(ans + (b-c)//2)
else:
    print(2 + ans + (b-c)//2)
# Judge status: Wrong Answer
def main():
    N = int(input())
    P = [int(i) for i in input().split()]
    ans = 0
    pre = -1
    flag = False
    for i, p in enumerate(P):
        if i+1 == p:
            ans += 1
            if i > 0 and i == pre:
                flag = True
        elif flag and i+1 != p:
            ans -= 1
            flag = False
        pre = p
    if flag:
        ans -= 1
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Accepted
W,H,x,y = map(int, input().split())
if x == W/2 and y == H/2:
    print(W*H/2, 1)
else:
    print(W*H/2, 0)
# Judge status: Accepted
n=int(input())
l = [int(x) for x in input().split(' ')]
c=0
for i in range(0,len(l),2):
  if((i+1)%2!=0 and l[i]%2!=0):
    c+=1
	  
print(c)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))

ans = 1
c = 0
for i in range(1, n):
    if a[i] > a[i-1]:
        c1 = 1
    elif a[i] < a[i-1]:
        c1 = -1
    else:
        c1 = 0
    if c != c1 and c != 0:
        ans += 1
        c = 0
        continue
    c = c1
# Judge status: Accepted
N, X = map(int, input().split())
L = list(map(int, input().split()))

current = 0
cnt = 1
for l in L:
    current += l
    if current > X:
        break
    cnt += 1

print(cnt)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
b = [0]*n

for i in range(n):
  b[i] = a.index(i+1)
  
  
print(" ".join(map(str, b)))
# Judge status: Accepted
N, K = map(int, input().split())
abn = [list(map(int, input().split())) for _ in range(N)]
abn.sort()
pool = 0
for ab in abn:
    pool += ab[1]
    if pool >= K:
        print(ab[0])
        break
# Judge status: Accepted
def main():
    import sys
    input = sys.stdin.readline
    n,m = map(int,input().split())
    A = list(map(int,input().split()))
    BC = [list(map(int,input().split())) for _ in range(m)]

    BC = sorted(BC,key=lambda x:(x[1]),reverse=True)
    append_list = []
    for b,c in BC:
        if len(append_list)>=n:
            break
        append_list+=[c]*b
    A+=append_list
    A.sort(reverse=True)
    print(sum(A[:n]))

if __name__=='__main__':
    main()
# Judge status: Accepted
s=input()
n=len(s)
S=s.count("0")
print(n-abs(S-n+S))
# Judge status: Accepted
# C - Average Length

N = int(input())
P = []
for _ in range(N):
    x, y = map(int, input().split())
    P.append((x, y))

D = []
for i in range(N):
    for j in range(i + 1, N):
        dist = (((P[i][0] - P[j][0]) ** 2) +
                ((P[i][1] - P[j][1]) ** 2)) ** (1 / 2)
        D.append(dist)

print(sum(D) / len(D) * (N - 1))
# Judge status: Wrong Answer
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

n,k=nii()
a=lnii()

ok=max(a)
ng=1

while ok-ng>1:
  m=(ok+ng)//2

  num=0
  for i in a:
    num+=i//m

  if num<=k:
    ok=m
  else:
    ng=m

print(ok)
# Judge status: Wrong Answer
import numpy as np


n, m = map(int,input().split())
a = np.array([list(input() for i in range(n))])
b = np.array([list(input() for i in range(m))])
flug = 0

for i in range(n-m+1):
    for j in range(n-m+1):
        if np.all(a[i:i+m, j:j+m] == b):
            flug =1

ans = 'Yes' if flug else 'No'
print(ans)
# Judge status: Accepted
N=int(input())
C=input()
s=0
e=N-1
ans=0
while(s<e):
  while(C[s]=="R" and s<e):
    s+=1
  while(C[e]=="W" and s<e):
    e-=1
  if s<e:
    s+=1
    e-=1
    ans+=1
print(ans)
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**5)

N, M = map(int, input().split())
a = [int(i) for i in input().split()]

# 最大公約数
def gcd(a, b) :
    if b > a : 
        a, b = b, a
    
    while b != 0 :
        a, b = b, a % b
    return a
    
# 最小公倍数
def lcm(a, b) :
    return a * b // gcd(a, b)
  
f = a[0]
if N >= 2 :
  for i in range(1, N) :
    f = lcm(f, a[i])
    
print(int(M / f + 0.5))
# Judge status: Accepted
import sys
input = sys.stdin.readline


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


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

four_count = 0
two_count = 0
for v in l:
    if v % 4 == 0:
        four_count += 1
    elif v % 2 == 0:
        two_count += 1

if two_count > 0:
    if n - two_count - four_count <= four_count:
        print("Yes")
    else:
        print("No")
else:
    if n - four_count - 1 <= four_count:
        print("Yes")
    else:
        print("No")
# Judge status: Wrong Answer
# from operator import mul
# from functools import reduce

n=int(input())
a=list(map(int,input().split()))
limit=10**18

ans = 1
# ans = reduce(mul, a) #=> 1320

for i in range(n):
  ans *= a[i]
  if a[i] == 0:
    break
  elif (ans*a[i]) > limit:
    ans = -1
    continue

if ans > limit:
  print(-1)
else:
  print(ans)
# Judge status: Wrong Answer
a,b=map(int,input().split())
c= (b-a)//(a-1)+1
print(str(c))
# Judge status: Wrong Answer
a=list(map(int,input().split()))
a.sort()
count=a[2]-a[1]
print(count)
if a[0]-count%2==0:
  print((a[2]-(a[0]+count))//2)
else:
  print(2+(a[2]-(a[0]+count))//2)
# Judge status: Accepted
n, m = list(map(int, input().split()))
xxx = list(map(int, input().split()))

if n >= m:
    print(0)
    exit()
xxx.sort()
ddd = [b - a for a, b in zip(xxx, xxx[1:])]
ddd.sort()
print(sum(ddd[:m - n]))
# Judge status: Accepted
d = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(d)]

for i in range(d):
    print(1)
# Judge status: Accepted
import itertools
import math
s =int(input())
a = s
count = 0
if a <= 2:
    print(4)
    quit()
if a == 3:
    print(9)
    quit()
while a >=4:
    if a % 2 == 0:
        a /= 2
    else:
        a = 3 * a + 1
    count += 1

print(count+3)
# Judge status: Wrong Answer
def mainusbin(num):
    base = -2
    dst = ""
    i = 0
    if abs(base) > num:
        return num
    while abs(base**i) <= num:
        i += 1
        amari = num % base**i
        if amari:
            dst = "1" + dst
            num -= base**(i-1)
        else:
            dst = "0" + dst
    return dst
src = int(input())
dst = mainusbin(src)
print(dst)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
m = max(A)+10
dp = [0] * m

for x in A:
    dp[x] += 1

ans = 0
for i in range(1, m):
    if dp[i]:
        if dp[i] == 1:
            ans += 1
        for j in range(i, m, i):
            dp[j] = 0
print(ans)
# Judge status: Wrong Answer
N=int(input())
des=[list(map(int,input().split())) for _ in range(N)]
des.insert(0,[0,0,0])
for i in range(N):
    time=des[i+1][0]-des[i][0]
    d_x=abs(des[i+1][1]-des[i][1])
    d_y=abs(des[i+1][2]-des[i][2])
    if (time-(d_x+d_y))%2!=0 and time>=(d_x+d_y):
        print("No")
        exit()
print("Yes")
# Judge status: Accepted
s = str(input())
k = int(input())
i, count = 0, 0
while (i < len(s)):
  if int(s[i]) == 1:
    if (count >= k - 1):
      print('1')
      break
    count += 1
  else:
    print(s[i])
    break
  i += 1
# Judge status: Accepted
N,K = map(int, input().split())
H = [int(input()) for _ in range(N)]
H.sort()

ans = float("inf")
for i in range(N- K + 1):
    ans = min(ans, H[i + K - 1] - H[i])

print(ans)
# Judge status: Accepted
N = int(input())
A = int(input())

N = N%500

if N > A:
  print("No")
else:
  print("Yes")
# Judge status: Wrong Answer
N = 23
if N % 2 == 0:
    print(N / 2)
else:
    print(N // 2 + 1)
# Judge status: Accepted
import sys

N = int(sys.stdin.readline().strip())
A = list(map(int, sys.stdin.readline().strip().split()))


ans = 1
state = -1
for i in range(1, N):
    if state == -1:
        if A[i] < A[i-1]:
            state = 0
        elif A[i] > A[i-1]:
            state = 1
    elif (state == 0 and A[i] > A[i-1]) or (state == 1 and A[i] < A[i-1]):
        ans += 1
        state = -1
 
print(ans)
# Judge status: Accepted
s = list(input())
t = list(input())
ans = 0
for i in range(len(s)):
  if s[i] != t[i]:
    ans = ans +1
print(ans)
# Judge status: Accepted
import math
R = int(input())
H = math.pi
 
print(R*2*H)
# Judge status: Accepted
import sys
from pprint import pprint

N, K = map(int, sys.stdin.readline().split())
A = list(map(int, sys.stdin.readline().split()))

for _ in range(K):
    B = [0 for _ in range(N+1)]
    for i in range(N):
        l = max(0, i-A[i])
        r = min(i+A[i]+1 , N)
        B[l] += 1
        B[r] -= 1

    for i in range(N):
        B[i+1] += B[i]

    if A == B:
        break

    A = B[:]

print(*B[:N])
# Judge status: Accepted
import sys
input=sys.stdin.readline
n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[0]*n
for i in range(1,n):
  kk=i-k
  if kk<0:kk=0
  dp[i]=min(d+abs(hh-h[i])for d,hh in zip(dp[kk:i],h[kk:i]))
print(dp[n-1])
# Judge status: Accepted
N, K = map(int, input().split())
P = [(int(x)+1)/2 for x in input().split()]

Q=[0]*(N+1)
for n in range(N):
  Q[n+1]=Q[n]+P[n]

ans=0
for n in range(K,N+1):
  ans=max(ans, Q[n]-Q[n-K])

print(ans)
# Judge status: Wrong Answer

def main():
    # -*- coding: utf-8 -*-
    # 整数の入力
    # a = int(input())
    # スペース区切りの整数の入力
    # b, c = map(int, input().split())
    # b, c = map(int, input())

    # # 文字列の入力
    a = input()
    # 出力
    # print("{} {}".format(a+b+c, s))

    # mul = a

    if '7' in a:
        print("YES")
    else:
        print("NO")


if __name__ == '__main__':
    # main('170')
    main()
# Judge status: Wrong Answer
S=list(input())
T=list(input())
x=[0]*(len(S)+1)
for i in range(len(S)):
    for j in range(len(T)):
        if T[j]==S[i] :
            if (j-1)>=0 and (i-1)>=0 and T[j-1]==S[i-1]:
                x[i]=x[i-1]+1
            else:
                x[i]=1
print(len(T)-max(x))
# Judge status: Accepted
h, n = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(n)]
dp = [1 << 31] * (h + 10**4)
dp[0] = 0
for i in range(h):
    for a, b in AB:
        dp[i + a] = min(dp[i + a], dp[i] + b)
print(min(dp[h:]))
# Judge status: Wrong Answer
import numpy as np
 
N = int(input())
x_list = np.array(list(map(int, input().split()))).reshape(1,N)
#count = np.sum(x_list%x_list.reshape(N,1)==0, axis=0)==1
#print(np.sum(count))
# Judge status: Accepted
n = int(input())
s = input()
lis = []

for i in range(1, n):
  a = set(s[:i])
  b = set(s[i:])
  count = 0
  for c in a:
    if c in b:
      count += 1
  lis.append(count)
print(max(lis))
# Judge status: Accepted
s = int(input())

nums = {s}
while True:
    if s % 2 == 0:
        s //= 2
    else:
        s = 3 * s + 1
    if s in nums:
        break
    nums.add(s)

print(len(nums)+1)
# Judge status: Wrong Answer
N = int(input())
a = list(map(int, input().split()))

cnt = {}

for item in a:
    if item not in cnt:
        cnt[item] = 0
    cnt[item] += 1

A = list(set(a))

candidate = []

for item in A:
    if cnt[item] == 1:
        candidate.append(item)

judge = [True] *(10**6 + 1)

for item in A:
    for i in range(2, -(-(10**6)//item)):
        judge[item*i] = False

ans = 0

for item in candidate:
    if judge[item]:
        ans += 1

print(ans)
# Judge status: Accepted
s = [list(map(int,input().split())) for i in range(3)]
num = s[0][0]
ans = "No"

for i in range(num+1):
  a_1 = num - i
  b_1 = i
  
  a_2 = s[1][0] - b_1
  a_3 = s[2][0] - b_1
  b_2 = s[0][1] - a_1
  b_3 = s[0][2] - a_1
  
  if s[1][1] != a_2+b_2:
    continue
  if s[1][2] != a_2+b_3:
    continue
  if s[2][1] != a_3+b_2:
    continue
  if s[2][2] != a_3+b_3:
    continue
    
  ans = "Yes"
  
print(ans)
# Judge status: Accepted
def main():
  n=int(input())
  a=sorted(map(int,input().split()))
  maxa=a[-1]+1
  tf=[False]*maxa
  r=0
  n-=1
  for i in range(n):
    a_i=a[i]
    if tf[a_i] ==False:
      for j in range(a_i,maxa,a_i):
        tf[j]=True
      if a_i < a[i+1]:
        #print(a_i)
        r+=1
  if tf[-1] ==False:
    r+=1
  print(r)
main()
# Judge status: Accepted
n=int(input())
a=list(map(int, input().split()))
s=sum(a)
ans=0
for i in range(n):
  ans+=a[i]*(s-a[i])
print(ans//2%(10**9+7))
# Judge status: Accepted
A,B,C,K=map(int,input().split())
if A>=K:
    print(K)
elif A<K and A+B >= K:
    print(A)
else:
    print(1*A +(-1*(K-A-B)))
# Judge status: Accepted
a,b=map(int,input().split())
if a*b%2==1:
    print("Odd")
else:
    print("Even")
# Judge status: Accepted
import itertools
n,m,x=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]
costl=[]
for p in itertools.product([0,1],repeat=n):
  al=[0]*m
  cost=0
  for i in range(n):
    if p[i]==1:
      cost+=l[i][0]
      for j in range(1,m+1):
        al[j-1]+=l[i][j]
  if all(mm>=x for mm in al):
    costl.append(cost)
print(min(costl) if len(costl)>=1 else -1)