peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
import sys
from fractions import gcd
inputs = sys.stdin.readlines()

n, m = map(int, inputs[0].split())
A = list(set(map(int, inputs[1].split())))

a = A[0]
for i in range(1, len(A)):
    z = gcd(a, A[i])
    x, y = a // z, A[i] // z
    if x % 2 == y % 2 == 1:
        a = x*y*z
    else:
        print(0)
        break
else:
    print(round(((m+1)/a)))
# Judge status: Wrong Answer
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
lis=[abs(a-b),abs(a-c),abs(a-d),abs(a-e),abs(b-c),abs(b-d),abs(b-e),abs(c-d),abs(c-e),abs(d-e)]
lis2=sorted(lis)
print(lis2)
if lis2[-1]<k:
    print("Yay!")
else:
    print(":(")
# Judge status: Wrong Answer
a,b,c = map(int, input().split())
print("Yes") if c >= a+b else print("No")
# Judge status: Accepted
a, b, c = map(int, input().split())
print("YNeos"[a+b<c::2])
# Judge status: Accepted
import math

n=int(input())

sum = 0
for i in range(n):

    if n%(i+1) == 0:
        sum += int(n/(i+1))-1
    else:
        sum += int(math.floor(n/(i+1)))

print(sum)
# Judge status: Wrong Answer
s=input()
l =len(s)
print("x"*(l+1))
# Judge status: Wrong Answer
a,b,m = map(int,input().split())

a = list(map(int,input().split()))
b = list(map(int,input().split()))
a.sort()
b.sort()
Min = a[0] + b[0]
x = []
y = []
c = []
for i in range(m):
    X,Y,C = map(int,input().split())
    x.append(X)
    y.append(Y)
    c.append(C)
for i in range(m):
    a_index = x[i]-1
    b_index = y[i]-1
    tmp = a[int(a_index)] + b[int(b_index)] - c[i]
    Min = min(Min,tmp)
print(Min)
# Judge status: Wrong Answer
n=int(input())

l1=list(map(int,input().split()))
l2=[l1[0]]
l=l2+l1
l.append(l1[-1])
print(l)

res=[]

for i in range(1,n+1):
    res.append(min(l[i],l[i-1]))

print(sum(res))
# Judge status: Accepted
n = int(input())
# n個の整数のリスト
num_list = []
# 偶数の桁数の整数のリスト
num_odd_list = []

# n個の整数のリストに代入
for i in range(1, n + 1):
    num_list.append(i)

# 偶数の桁数の整数をリストに代入
for j in num_list:
    if 10 <= j < 100 or 1000 <= j < 10000 or 100000<= j < 1000000:
       num_odd_list.append(j)

# 全体の整数の数から偶数の桁数の整数の数を引く
print(len(num_list) - len(num_odd_list))
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
ans=1
i=0
res=-2
if n>3:
    a1,a2=a[2]-a[1],a[1]-a[0]
    while i<n-2:
        if a[i+2]-a[i+1]!=0:
            a1=a[i+2]-a[i+1]
        if a[i+1]-a[i]!=0:
            a2=a[i+1]-a[i]
        if a1*a2<0 and i-res>=2:
            ans+=1
            res=i
        i+=1
print(ans)
# Judge status: Accepted
a,b,c=map(int,input().split())
if a<=c<=b or b<=c<=a:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
A, B = map(int, input().split())
if (A >= 13):
    print(B)
elif (A <= 5):
    print(0)
else:
    print(int(B/2))
# Judge status: Accepted
n = int(input())
*l, = map(int,input().split())
suml = sum(l)
suml2 = sum([i**2 for i in l])
ave1 = suml//n 
ave2 = -(-suml//n)
ans1 = suml2 - 2*suml*ave1 + n*ave1*ave1
ans2 = suml2 - 2*suml*ave2 + n*ave2*ave2
print(min([ans1,ans2]))
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
A1 = A
B = list(map(int, input().split()))
B1 = B
p = A

cnt = A1[0]

if N == 1:
  print(A[0] + B[0])
  exit()

for i in range(N-1):
  if sum(A[i+1:]) > sum (B[i:-1]):
    cnt += A1[i+1]
    
  else:
    cnt += B1[i]
    print(cnt + sum(B1[i+1:]))
    exit()


print(cnt + B1[-1])
# Judge status: Accepted
NS=list(input())
if NS[0]==NS[1] and NS[1]==NS[2]:
  print("Yes")
elif NS[1]==NS[2] and NS[2]==NS[3]:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
s = list(input())

ans = [0] * (len(s)+1)

for i in range(len(s)):
    if s[i] == '<':
        ans[i+1] += ans[i]+1

for i in range(len(s)-1, -1, -1):
    if s[i] == '>':
        ans[i] = max(ans[i], ans[i+1]+1)

print(sum(ans))
# Judge status: Accepted
c = input()
if c == 'a':
    print('vowel')
elif c == 'i':
    print('vowel')
elif c == 'u':
    print('vowel')
elif c == 'e':
    print('vowel')
elif c == 'o':
    print('vowel')

else:
    print('consonant')
# Judge status: Accepted
s = input()
week = ['SUN','MON','TUE','WED','THU','FRI','SAT' ]
index_s = week.index(s)
# print(index_s)
next_sunday = 7-index_s
print(next_sunday)
# Judge status: Accepted
X = int(input())

r = X%100

x5 = r//5
r5 = r%5

if r5:
  x5+=1
  
if x5*100 <= X:
  print(1)
else:
  print(0)
# Judge status: Accepted
a, b = map(int, input().split())

if a <= 0 and 0 <= b:
    print("Zero")
elif a < 0 and b < 0:
    if (abs(a)-abs(b)+1) % 2 == 1:
        print("Negative")
    else:
        print("Positive")
else:
    print("Positive")
# Judge status: Accepted
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
# INF =  float("inf")
INF = 10**18
import bisect
import statistics
mod = 10**9+7
# mod = 998244353

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

print (math.ceil(N / (2*D+1)))
# Judge status: Wrong Answer
s=list(input())
t=list(input())
frag="No"
n=min(len(s),len(t))
for i in range(n):
  if min(s)<min(t):
    frag="Yes"
    break
  elif min(s)>min(t):
    break
  else:
    s.pop(s.index(min(s)))
    t.pop(t.index(min(t)))

if len(t)>0:
  frag="Yes"

print(frag)
# Judge status: Accepted
a, b, c = map(int, input().split())
a1, a2 = a//2, (a+1)//2
x = b*c*(a2-a1)
b1, b2 = b//2, (b+1)//2
y = a*c*(b2-b1)
c1, c2 = c//2, (c+1)//2
z = a*b*(c2-c1)
print(min(x, y, z))
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
for i in reversed(range(n)):
  if b[i]>=a[i+1]:
    a[i+1], b[i], ans = 0, b[i]-a[i+1], ans+a[i+1]
  else:
    a[i+1], b[i], ans = a[i+1]-b[i], 0, ans+b[i]
  if b[i]>=a[i]:
    a[i], b[i], ans = 0, b[i]-a[i], ans+a[i]
  else:
    a[i], b[i], ans = a[i]-b[i], 0, ans+b[i]
print(ans)
# Judge status: Accepted
from collections import Counter

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

ans = 0

c = Counter()

for idx, a in enumerate(A):
    idx += 1
    
    ans += c[idx-a]
    c[idx+a] += 1
    
print(ans)
# Judge status: Wrong Answer
n,a,b = map(int,input().split())
s = input()
count_a = s.count('a')
count_b = s.count('b')

if a+b <= count_a:
  count_a = a+b
  count_b = 0
else:
  count_b = min(a+b-count_a, b)

for c in s:
  if c=='c':
    print('No')
  elif c=='a':
    print('Yes' if count_a>0 else 'No')
    count_a -= 1
  else:
    print('Yes' if count_b>0 else 'No')
    count_b -= 1
# Judge status: Accepted
import math
n, m = map(int, input().split())
ans = 0

ans += min(n, m // 2)
m -= 2 * min(n, m // 2)
#
# if m >= 2*n:
#     ans += n
#     m -= 2*n
#
# else:
#     ans += m//2
#     m -= 2*m//2

ans += math.floor(m / 4)



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

print((N-1) // max(H, W) + 1)
# Judge status: Accepted
#解説参照
#i桁目で10^i円多くはらうか否か

n_ =list(input())
n = [int(i) for i in n_]
ans = 0
if len(n_)==1:
    print(min(n[0],11-n[0]))
    exit()
dp1 = 0
dp2 = 1

for i in range(len(n)):
    dp_1 = min(dp1+n[i],dp2+10-n[i])
    dp_2 = min(dp1+n[i]+1,dp2+9-n[i])
    dp1 = dp_1
    dp2 = dp_2
print(dp1)
# Judge status: Wrong Answer
import math
n = int(input())
summ = 0
mod = 10 ** 9 + 7
sigma = 0

def comb_count(n, r, a):
    return math.factorial(n) // \
    (math.factorial(n - r) * math.factorial(a) * math.factorial(r - a))


for i in range(2, n + 1):
    for t in range(1, i):
        z = comb_count(n, i, t)
        sigma += z

    summ = summ + (sigma * 8 ** (n - i))
    summ = summ % mod

print(summ)
# Judge status: Accepted
x,y = map(int,input().split())
if y == x:
    print(0)
elif abs(y) == abs(x):
    print(1)
elif x*y > 0:
    if x < y:
        print(y-x)
    else:
        print(x-y+2)
elif x*y == 0:
    if x < y:
        print(y-x)
    else:
        print(x-y+1)
else:
    if x < y:
        print(min(y-x,abs(abs(x)-abs(y))+1))
    else:
        print(min(x-y,abs(abs(x)-abs(y))+1))
# Judge status: Wrong Answer

s = list(input())
n = len(s)
l = 0
r = 0
ans = 0

for i in range(len(s)):
    if s[i] == "A":
        l = i
        break

for i in range(n-1,i,-1):
    if s[i] == "Z":
        r = i+1

ans = max(0,r-l)
print(ans)
# Judge status: Accepted
a, b = list(map(int,input().split()))
z= 0
if b% 2!=0:
    print("No")
    quit()
else:
    while a>=0: 
        c = a*2+z*4
        if c ==b:
            print("Yes")
            quit()
        a-=1
        z+=1
print("No")
# Judge status: Accepted
# AGC 031: A – Colorful Subsequence
N = int(input())
S = input()
s = set(S)
s_count = [S.count(c) + 1 for c in s]

tmp = 1
for i in s_count:
    tmp *= i

print((tmp - 1) % (10 ** 9 + 7))
# Judge status: Wrong Answer
a,b,c = map(int,input().split())
print(max(a*10+b+c , a+b*10+c))
# Judge status: Wrong Answer
x = int(input())
ans = ["Yes" if x >= 30 and -40 <= x <= 40 else "No"]
print(ans)
# Judge status: Wrong Answer
n = int(input())
if 165 <= n:
    print(2)
elif 105 <= n:
    print(1)
else:
    print(0)
# Judge status: Wrong Answer
import numpy as np

N = int(input())
A = np.sort(np.array(list(map(int,input().split()))))

print(A[1:].sum())
# Judge status: Accepted
def sum_of_digits(n):
    sum = 0
    while(n>0):
        #一の位から切り出していく
        sum += n % 10
        n //= 10
    return sum

N,A,B = map(int,input().split())

total = 0
for i in range(1,N+1):
    sum = sum_of_digits(i)
    if A <= sum <= B:
        total += i

print(total)
# Judge status: Accepted
def binary_search(key):
    bad, good = -1, len(ans)
    while good - bad > 1:
        mid = (bad + good) // 2
        if ans[mid][-1] < key:
            good = mid
        else:
            bad = mid
    return good


N = int(input())
ans = []
for _ in range(N):
    A = int(input())
    idx = binary_search(A)
    if idx == len(ans):
        ans.append([A])
    else:
        ans[idx].append(A)
print(len(ans))
# Judge status: Wrong Answer
num=input()
moji=num.split(" ")

if int(moji[0])==7 or int(moji[0])==5:
    pass
else:
    print("NO")
    
if moji[1]==7 or moji[1]==5:
	if int(moji[0])+int(moji[1])+int(moji[2])==19:
		print("YES")
else:
	print("NO")
# Judge status: Accepted
D, T, S = map(int,input().split(" "))

if(D/S <= T):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
a,b = map(int,input().split())
print(a+b//2)
# Judge status: Wrong Answer
import fractions
from functools import reduce

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

div_num = [0 for _ in range(n)]
same = True

for i in range(n):
    tmp = a[i]
    while tmp%2 == 0:
        tmp //= 2
        div_num[i] += 1
    if div_num[0] != div_num[i]:
        same = False
        break

if same:
    lcm = reduce(lambda x, y: (x*y)//fractions.gcd(x, y), a)
    print(int((m/lcm + 1)//2))
else:
    print(0)
# Judge status: Accepted
N, D = map(int, input().split())
num = 0
import math
for i in range(N):
  X, Y = map(int, input().split())
  if math.sqrt(X**2 + Y**2) <= D:
    num += 1
print(num)
# Judge status: Wrong Answer
import math
A, B = map(int, input().split())
print(1 if A ==B else math.ceil(B/A))
# Judge status: Wrong Answer
h,n=map(int,input().split())
ans=[10**10 for i in range(h+1)]
ans[0]=0
for i in range(n):
    a,b=map(int,input().split())
    tmp=a
    while tmp<=h:
        ans[tmp]=min(ans[tmp-a]+b,ans[tmp])
        tmp+=1
print(ans[h])
# Judge status: Wrong Answer
n = int(input())
count = 0
for i in range(n):
  d1, d2 = map(int, input().split())
  if count > 2:
    break
  else:
    if d1 == d2:
      count += 1
    else:
      count == 0
if count > 2:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n = int(input())
divisor = [0 for _ in range(n+1)]
for i in range(1,n+1):
    j = 1
    while j*i<=n:
        divisor[j*i]+=1
        j+=1
ans = 0
for ix,val in enumerate(divisor):
    ans += ix*val
print(ans)
# Judge status: Accepted
import bisect

N = int(input())

A = []

for i in range(N):

    a = int(input())
    A.append(a)

A.reverse()

seq = [float("-inf")]

for i in A:

    ind = bisect.bisect_right(seq,i)

    if ind == len(seq):
        seq.append(i)
    else:
        seq[ind] = i

print (len(seq)-1)
# Judge status: Wrong Answer
import collections 

s=input()
t=input()
s= collections.Counter(s)
t= collections.Counter(t)
#print(s)
sans=[]
tans=[]

for v in s.values():
    sans.append(v)
for v in t.values():
    tans.append(v)
#print(sans,tans)
if sans==tans:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
print("".join(map(lambda x:x[0], input().split())))
# Judge status: Wrong Answer
s=input()
if s[0]!=s[1] and s[1]!=s[2] and s[2]!=s[3]:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
a,b,k = map(int,input().split())
if k<a:
    print(a-k,b)
elif a+b-k>0:
    print(0,a+b-k)
else:
    print(0,0)
# Judge status: Accepted
N,T=map(int,input().split())
cost=10**9
for _ in range(N):
    c,t=map(int,input().split())
    if t<=T:
        cost=min(cost,c)
if cost==10**9:
    print("TLE")
else:
    print(cost)
# Judge status: Accepted
N, M = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(N)]
AB = sorted(AB, key=lambda x: x[0])
r = 0
for a, b in AB:
    if M <= 0:
        break
    if b <= M:
        r += a*b
        M -= b
    elif b >= M:
        r += a*M
        break
print(r)
# Judge status: Accepted
import math
a, b = map(int, input().split())
x = math.ceil((b-a)/(a-1))+1
print(x)
# Judge status: Wrong Answer
s = input()
print("A"+s[0]+"C")
# Judge status: Wrong Answer
import math

X = int(input())


def _pow(a, x):
    if a < 0:
        return -math.pow(-a, x)
    else:
        return math.pow(a, x)


pa = 0
while True:
    pb1 = _pow(pa ** 5 - X, 1 / 5)
    pb2 = _pow((-pa)**5 - X, 1 / 5)
    if pb1.is_integer():
        print(pa, int(pb1))
        exit()
    elif pb2.is_integer():
        print(-pa, int(pb2))
        exit()
    pa += 1
# Judge status: Accepted
N,K = map(int,input().split())
L = [i for i in map(int,input().split())]
res = (N-1)//(K-1)
if (N-1) % (K-1) != 0:
  print(res+1)
else:
  print(res)
# Judge status: Accepted
"""
author : halo2halo
date : 2, Feb, 2020
"""

import sys
import itertools

import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

print(len(set(list(map(int, readline().split())))))
# Judge status: Accepted
n = int(input())
p,cr,cl = 0,0,0
c = 0 #nu of pair
s  = input()
for i in list(s):
    if i =="(":
        p+=1
        cl +=1
    else:
        cr+=1
        if p>0:
            p-=1
            c+=1


print("("*(cr-c) + s + ")"*(cl-c)  )
# Judge status: Wrong Answer
n,k=map(int,input().split())
a=[0]*200099
for i in range(200099):
  a[i]=i
s=1
for i in range(n,k-1,-1):
  s+=sum(a[i:n+1])-sum(a[0:n-i+1])+1
print(s)
# Judge status: Wrong Answer
x,y=map(int,input().split())

g1=[1,3,5,7,8,10,12]
g2=[4,6,9,11]

if x in g1 and y in g1:
    print('Yes')
elif x in g2 and y in g2:
    print('No')
elif x==2 and y==2:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
import fractions
n,x0=map(int,input().split())
d=list(map(lambda a:abs(int(a)-x0),input().split()))
ans=d[0] if len(d)==1 else fractions.gcd(d[0],d[1])
i=1
while i < n-1 and ans !=1:
    ans=min(ans,fractions.gcd(d[i],d[i+1]))
    i+=1
print(ans)
# Judge status: Wrong Answer
import math
r = int(input())
S_r = r**2 * math.pi
S_1 = 1**2 * math.pi
int(S_r / S_1)
# Judge status: Accepted
from sys import stdin
import math

s = stdin.readline().rstrip()

flag = False
ss = ''
for i in range(10):
    ss += "hi"
    if s == ss:
        flag = True
        break

if flag:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
import numpy as np

N = int(input())
X = [int(i) for i in input().split()]

for i in range(0, N):
    tmp_list = []
    if i==0:
        tmp_list = []
    else:
        tmp_list = X[:i]
    tmp_list.extend(X[i+1:])
    med = np.median(tmp_list)
    print(med)
# Judge status: Accepted
s=input()
k=int(input())
a2n = lambda c: ord(c) - ord('a') + 1
n2a = lambda c: chr(c+64).lower()
ls=list(s)
i=0
while k>0 and i<len(ls):
  a=(1-a2n(ls[i]))%26
  if k>=a:
    ls[i]='a'
    k-=a
  i+=1
if k>0:
  ls[-1]=n2a(a2n(ls[-1])+k%26)
print(''.join(ls))
# Judge status: Accepted
n,m=map(int,input().split())
ans=0
mm=m//2
if n>=mm:
    ans=mm
else:
    w=(mm-n)//2
    ans=n+w
print(ans)
# Judge status: Wrong Answer
"""
author : halo2halo
date : 24, Jan, 2020
"""

import sys

# import itertools
# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

A, B = map(int, readline().split())
S = readline().decode('utf8').rstrip()
T=S[:A]+S[A+1:]
bl = S[A] == '-' and '-' in T

print('Yes' if bl else 'No')
# Judge status: Accepted
N,K,Q=map(int,input().split())
score = [0]*N
#print(score)
for i in range(Q):
  score[int(input())-1]+=1
#print(score)
for i in range(N):
  if K-Q+score[i]>0:
    print("Yes")
  else:
    print("No")
# Judge status: Wrong Answer
N=int(input())
a=input().split()
numbers=[int(b) for b in a]
kazu=0
suuji=0
for z in numbers:
    if z%2==0:
        kazu+=1
for y in numbers:
    if y%4==0:
        suuji+=1
if kazu==N:
    print('Yes')
elif suuji==N//2:
    print('Yes')
elif kazu>=N-kazu*2-1:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
a, b, c = map(int,(input().split()))
ans = "NO"
if a-b == b-c or b-a == c-b:
  ans = "YES"
print(ans)
# Judge status: Accepted
s = int(input())
a = []
i = 1

while True:
	
	if i == 1:
		a.append(s)
	
	else:

		if a[-1] % 2 == 0:
			a.append(int(a[-1]/2))
		else:
			a.append(3 * a[-1] + 1)

	
	if a.count(a[-1]) >= 2:
		print(max([i for i, x in enumerate(a) if x == a[-1]]) + 1)
		exit()

	i += 1
# Judge status: Accepted
A,B,K = map(int,input().split())

if K*2 > B-A:
  for i in range(A,B+1):
    print(i)

else:
  for i in range(A,A+K):
    print(i)
  for j in range(B-K+1,B+1):
    print(j)
# Judge status: Accepted
s = input()
a = s.count('a')
b = s.count('b')
c = s.count('c')
a, b, c = sorted([a, b, c])
if a==b==c:
    print('YES')
elif a==b and c-b < 2:
    print('YES')
elif b-a < 2 and b==c:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
n = int(input())
an = list(map(int, input().split()))
ans = 10*9
for i in range(-100, 101):
    check = 0
    for a in an:
        check += (a-i)**2
    ans = min(ans, check)
print(ans)
# Judge status: Accepted
N = int(input())

kinds = []

for i in range(N):
  kinds.append(input())
  
print(len(set(kinds)))
# Judge status: Wrong Answer
n,x = map(int,input().split())
L = list(map(int,input().split()))

s = 0
for i in range(n):
    s += L[i]
    if s > x:
        print(i+1)
        break
else:
    print(n)
# Judge status: Wrong Answer
n = int(input())
ans = 0
m = 10**9+7
ans = pow(10,n,m)
ans-=pow(9,n,m)*2
ans+=pow(8,n,m)
print(ans)
# Judge status: Wrong Answer
a,b=map(int, input().split())
if (9-a)*(9-b)<0:
  print(-1)
else:
  print(a*b)
# Judge status: Wrong Answer
A, B, K = map(int, input().split())
x=[]
if (B-A) <= K:
    for i in range(A, B+1):
        print(i)
else:
    for i in range(A, A+K):
        x.append(i)
    for i in range(B-K+1, B+1):
        x.append(i)
    x=set(sorted(x))
    for i in x:
        print(i)
# Judge status: Accepted
n=int(input())
k=int(input())
x=int(input())
y=int(input())
if n<=k:
  print(x * n)
else:
  print(k * x +(n-k) * y)
# Judge status: Accepted
n=int(input())
if n<=999:
    print("ABC")
else:
    print("ABD")
# Judge status: Wrong Answer
num_list=int(input())
a=[1,0,0]
for i in range(num_list):
  b=[int(x) for x in input().split()]
  dt=(b[0]-a[0])
  d=(abs(b[1]-a[1])+abs(b[2]-a[2]))
  if d<=dt and d != 0 and (dt-d)%2==0:
    if i == num_list-1:
      print("Yes")
      break
    a=b
  else:
    print("No")
    break
# Judge status: Accepted
s = input()
if s == "SSS":
  print(0)
elif s == "RRR":
  print(3)
elif s == "SRR" or s == "RRS":
  print(2)
else:
  print(1)
# Judge status: Accepted
s = input()
n = len(s)
k = int(input())
for i in range(n):
  if s[i] == '1':
    k -= 1
  else:
    k = -1
 
  if k <= 0:
    print(s[i])
    break
# Judge status: Wrong Answer
n,m=map(int,input().split())
stu=[]
far=[]
for i in range(n):
    a,b=map(int,input().split())
    stu.append([a,b])
for i in range(m):
    c,d=map(int,input().split())
    far=[]
    ans=0
    for j in range(n):
        far.append(abs(stu[j][0]-c)+abs(stu[j][1]-d))
    print(far.index(min(far))+1)
# Judge status: Accepted
# -*- coding: utf-8 -*-

s = input()
t = input()

count = 0
length = len(s)

for i in range(length):
    if s[i] != t[i]:
        count += 1

print(count)
# Judge status: Accepted
n = int(input())
s = input()
left_w = 0
right_e = s.count('E')
ans = left_w + right_e
for i in range(n):
    if s[i] == 'E':
        right_e -= 1
    ans = min(ans, left_w + right_e)
    if s[i] == 'W':
        left_w += 1
print(ans)
# Judge status: Accepted
N=int(input())
S=input()

def onaji(s):
    while True:
        if len(S)%2==1:
            return 'No'
        for i in range(len(S)//2):
            if S[i]!=S[i+(len(S)//2)]:
                return 'No'
            else:
                continue
        return 'Yes'
        
print(onaji(S))
# Judge status: Accepted
from collections import Counter
n, *a = map(int, open(0).read().split())
l = Counter(a)
for ai in a:
    l[ai+1] += 1
    l[ai-1] += 1
print(l.most_common()[0][1])
# Judge status: Accepted
def main():
    s = input()
    n = len(s)

    for i in range(n):
        for j in range(n - i + 1):
            if s[:i] + s[i + j:] == "keyence":
                print("YES")
                exit()
    else:
        print("NO")


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
N, M = map(int,input().split())
A = [str(input()) for _ in range(N)]
B = [str(input()) for _ in range(M)]

res = "No"

for i in range(N-M+1):
    for j in range(N-M+1):
        if A[i][j:j+M] == B[0]:
            for k in range(1,M):
                if A[j+k][j:j+M] == B[k]:
                    pass
                else:
                    break
            res = "Yes"

print(res)
# Judge status: Accepted
s = input()
t = input()
if len(s) < len(t):
    print("UNRESTORABLE")
else:
    for i in range(len(s) - len(t), -1, -1):
        ok = True
        for j in range(len(t)):
            if s[i + j] != t[j] and s[i + j] != "?":
                ok = False
        if ok:
            print((s[:i] + t + s[i + len(t):]).replace("?", "a"))
            exit()
    print("UNRESTORABLE")
# Judge status: Wrong Answer
S = input()

q = ["h", "i"]
ans = True
for i in range(len(S)):
    if q[i%2] != S[i]:
        ans = False

if ans:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import numpy as np

n = int(input())
def solve(n):
    f = [float('inf') for _ in range(n+1)]
    f[0] = 0
    for i in range(1, n+1):
        f[i] = f[i-1] + 1
        k = 6
        l = 9
        while k <= i:
            f[i] = min(f[i], f[i-k] + 1)
            k *= 6
        while l <= i:
            f[i] = min(f[i], f[i-l] + 1)
            l *= 9
    print(f[n])
solve(n)
# Judge status: Accepted
n=int(input())
al='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ans=[]
s=input()
for i in range(len(s)):
  ans.append(al[(ord(s[i])-65+n)%26])
print(''.join(ans))
# Judge status: Accepted
N = input()

dp0 = 0  
dp1 = 1  
 
for n in N:
    n = int(n)
    dp0_new = min(dp0 + n, dp1 + (10 - n))
    n = n + 1 #繰り上げさせてる
    dp1_new = min(dp0 + n, dp1 + (10 - n))
    dp0, dp1 = dp0_new, dp1_new

print(dp0)
# Judge status: Wrong Answer
N, X = map(int, input().split())
print("YES") if N*500 >= X else print("NO")
# Judge status: Accepted
N=int(input())
if N%2==0:
  print('{:.010f}'.format((N//2)/N))
else:
  print('{:.010f}'.format((N//2+1)/N))
# Judge status: Wrong Answer
n = int(input())
num = 0
for i in range(1,n+1):
  if len(str(n))%2 == 1:
    num += 1
print(num)
# Judge status: Accepted
c=[[int(i) for i in input().split()]for j in range(3)]
for i in range(2):
    if not c[i+1][0]-c[i][0]==c[i+1][1]-c[i][1]==c[i+1][2]-c[i][2]:
        print('No')
        exit()
for i in range(2):
    if not c[0][i+1]-c[0][i]==c[1][i+1]-c[1][i]==c[2][i+1]-c[2][i]:
        print('No')   
        exit()
print('Yes')