peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
N, K = map(int, open(0).read().split())
a = 0
for i in range(1, N+1):
    j = 0
    s = i * 2**j
    while s < 10:
        j += 1
        s = i * 2**j

    a += (1/N)*(1/2)**j

print(a)
# Judge status: Wrong Answer
n = int(input())
P =list(map(int,input().split()))
print(P)
Q = sorted(P)
print(Q)
ans = 0
for i in range(n):
    if P[i] != Q [i]:
         ans +=1
print('YES' if (ans ==2 or ans==0) else 'NO')
# Judge status: Wrong Answer
import sys
S = list(input())
lis = [0] * (len(S)+1)

if len(S) == 1:
    print(1)
    sys.exit()


#最初は < を処理する
for i in range(len(S)):
    if S[i] == "<":
        lis[i+1] = lis[i] + 1




for j in range(len(S)-1,0,-1):
    if S[j] == ">":
        lis[j] = max(lis[j],lis[j+1] + 1)



print(sum(lis))
# Judge status: Accepted
N, K = map(int, input().split())
A = list(map(int, input().split()))

def test(m):
    if m <= 0:
        return False
    needed = 0
    for a in A:
        needed += (a-1)//m
        if needed > K:
            return False
    return True

lb = 1
ub = max(A)

while True:
    m = (lb + ub) // 2
    if test(m):
        if test(m-1):
            ub = m - 1
        else:
            print(m)
            exit()
    else:
        lb = m + 1
# Judge status: Accepted
S = input()

x = ""
for s in S:
  if x=="" and s=="B":
    continue
  if s=="B":
    x = x[:-1]
  else:
    x += s
    
print(x)
# Judge status: Accepted
n,a,b,c,d = [int(x) for x in input().split()]
s = input()

ans = "Yes"
if c > d:
    tmp = s[b-2:d+1].count("...")
    if tmp == 0:
        ans = "No"

tmp = s[a-1:max(c,d)].count("##")
if tmp > 0:
    ans = "No"
print(ans)
# Judge status: Wrong Answer
import sys
n=int(input())
l = [int(input()) for _ in range(n)] #複数行1文字をintでリストに
a=max(l)
l1=list(dict.fromkeys(l))
l1.remove(a)
if l1==[]:
  for i in l:
    print(i)
  sys.exit()
b=max(l1)
for i in l:
  if i==a:
    print(b)
  else:
    print(a)
# Judge status: Accepted
N=int(input())
C=list(input())
D=sorted(C)
P=0
for i in range(N):
  if C[i]!=D[i]:
    P+=1
print(P>>1)
# Judge status: Wrong Answer
c = input()
print(str(ord(c)+1))
# Judge status: Accepted
a,b,c=map(int,input().split())
num=0
for i in range(a,b+1):
  if i%c == 0:
    num+=1
print(num)
# Judge status: Accepted
s=input()
import collections
p=collections.Counter(s)
#print(p[max(p)])
if len(p)==3:
    if p[max(p,key=p.get)]-p[min(p,key=p.get)]<2:
        print("YES")
    else:
        print("NO")
if len(p)==2:
    if p[max(p,key=p.get)]>1:
        print("NO")
    else:
        print("YES")
if len(p)==1:
    if p[max(p,key=p.get)]==1:
        print("YES")
    else:
        print("NO")
# Judge status: Accepted
N=int(input())

a=N//11
b=N%11


count=0
count+=2*a
if 0<b and b<=6:
    count+=1
elif 6<b:
    count+=2

print(count)
# Judge status: Accepted
import math
def c(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
  
n=int(input())

ans=0
for i in range(1,n//3+1):
  ans+=c(n-2*i-1,i-1)
print(ans%(10**9+7))
# Judge status: Accepted
n, a, b = map(int, input().split())
s = input()
tuka = 0
kaigai = 0
for i in range(n):
    if s[i] == "a" and tuka < a+b:
        tuka += 1
        print("Yes")
    elif s[i] == "b" and tuka < a+b and kaigai < b:
        tuka += 1
        kaigai += 1
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
a,b,x = map(int, input().split())
 
print(b//x-(a-1)//x)
# Judge status: Wrong Answer
from collections import Counter

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

prime = [True for i in range(10**6)]

for a in A:
    if(prime[a-1]):
        for j in range(a*2, 10**6, a):
            prime[j-1] = False

cnt = 0
for i in A:
    if(prime[i-1]):
        cnt += 1
        
c = Counter(A)
cc = sorted(c.items(), key=lambda x:x[1], reverse=True)

if(N == len(cc)):        
    print(cnt)
else:
    print(cnt-(N-len(cc)-1))
# Judge status: Accepted
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

a = -(-N//A)
b = -(-N//B)
c = -(-N//C)
d = -(-N//D)
e = -(-N//E)

ans = 5 + max(a,b,c,d,e) - 1

print(ans)
# Judge status: Wrong Answer
import sys 
input = sys.stdin.readline

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

box = [0]*(N+1)

for i in range(N,0,-1):
    k=2
    ball=a[i-1]
    #print(123,i,ball)
    while i*k<=N:
        if a[i*k-1]==1:
            ball = (ball+1)%2
        k+=1
    box[i] = ball
#print(box)
M=0
b=[]
for i in range(1,N+1):
    if box[i]==1:
        M+=1
        b.append(i)

print(M)
[print(x) for x in b]
# Judge status: Accepted
l=[i for i in input().split()]
print("YES" if int("".join(l))%4==0 else "NO")
# Judge status: Accepted
n = int(input())
for i in range(1, 10):
    if n <= i * 111:
        print(i * 111)
        exit()
# Judge status: Accepted
n,l=(int(x) for x in input().split())
a=[]
for i in range(n):
  a.append(l+i)
m=abs(a[0])
for i in range(1,n):
  if abs(a[i])<m:
    m=abs(a[i])
s=0
for i in range(n):
  if abs(a[i])!=m:
    s+=a[i]
print(s)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
sum_a = sum(a)
half_a = sum_a // 2
total = 0
ans = 0
for num in a:
    total += num
    if total >= half_a:
        ans = min(total - half_a, abs(total - num - half_a))
        if sum_a % 2 == 1:
            ans += 1
        break
    else:
        pass
print(ans)
# Judge status: Wrong Answer
A,B,C = map(int,input().split())
K = int(input())

print(max(A*2+B+C,A+B*2+C,A+B+C*2))
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
print((c + 0.5) // a * b)
# Judge status: Accepted
p,q,r = map(int,input().split())
a = min(p+q,q+r,r+p)
print(a)
# Judge status: Accepted
n=int(input())
cnt=[50]*26

for _ in range(n):
    s=input()
    curcnt=[0]*26

    for c in s:
        curcnt[ord(c)-ord('a')]+=1
    
    for i in range(26):
        cnt[i]=min(cnt[i],curcnt[i])
    
ans=''
for i in range(26):
    c=chr(i+ord('a'))
    while cnt[i]>0:
        ans=ans+c
        cnt[i]-=1
    

print(ans)
# Judge status: Wrong Answer
str = input().lower()
char_list = list(str)
if char_list[2] == char_list[3]:
    if char_list[4] == char_list[5]:
        print("Yes")
else:
    print("No")
# Judge status: Accepted
N = int(input())
problemList = list(map(int, input().split()))

problemList = sorted(problemList)
mid = N // 2

ans = problemList[mid] - problemList[mid-1]
print(ans)
# Judge status: Accepted
a,b,c,d = map(int, input())

nl = [a,b,c,d]

import itertools
op =["+","-"]
opl = list(itertools.product(op, repeat=3))

for i in range(8): #加減パターン
    res = nl[0]
    opp = opl[i]
    for j in range(3):
        if opp[j]=="+":
            res += nl[j+1]
        else:
            res -= nl[j+1]
    if res ==7:
        print(str(nl[0])+opp[0]+str(nl[1])+opp[1]+str(nl[2])+opp[2]+str(nl[3])+"=7")
        exit()
# Judge status: Wrong Answer
import numpy as np

X, Y = map(int, input().split())
l = np.log2(Y/X)
print(int(np.floor(l + 1)))
# Judge status: Wrong Answer
#D
A,B,N = map(int,input().split())
ans = 0
for x in range(1,min(10**6+1,N+1)):
    left = A*x//B
    right = A*(x//B)
    #print("x =",x,left,right)
    ans = max(ans,left-right)
print(ans)
# Judge status: Accepted
N = input()
print('hon') if N[-1] in ["2","4","5","7","9"] else print('bon') if N[-1]=="3" else print('pon')
# Judge status: Accepted
# -*- coding: utf-8 -*-

N = int(input().strip())
pas_list = [int(input().strip()) for _ in range(5)]

count = (  -(-N // min(pas_list)) ) -1+5
print(count)
# Judge status: Wrong Answer
s = input()
 
if s[2] == s[3]:
  if s[4] == s[5]:
    print('yes')
else:
  print('no')
# Judge status: Wrong Answer
import sys,collections
input = sys.stdin.readline
m=10**9+7

N=int(input())
S=input().rstrip()
Sc = collections.Counter(S)
cnt = 1
for s in Sc.values():
    cnt *= (s+1)
print(cnt-1)
# Judge status: Accepted
# B - Ringo's Favorite Numbers
D, N = map(int, input().split())

if N < 100:
	print(100 ** D * N)
else:
	print(100 ** D * (N + 1))
# Judge status: Accepted
s = str(input())
if s[0] == 'A' and s[2:-1].count('C') == 1 and (s[1:s.find('C')]+s[s.find('C')+1:]).islower():
    print('AC')
else:
    print('WA')
# 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()
y = x % 11
ans = (x // 11) * 2
if y == 0:
    pass
elif y <= 6:
    ans += 1
else:
    ans += 2
print(ans)
# Judge status: Wrong Answer
s = input()
n = len(s)
flg=False
for i in range(n-1):
    if(s[i] == s[i+1]):
        flg=True
        break

if flg:
    print("no")
else:
    print("yes")
# Judge status: Accepted
D,N = map(int,input().split())
if N!=100:
    ans = N*100**D
else:
    ans = 101*100**D 

print(ans)
# Judge status: Accepted
K, X = map(int, input().split())
for i in range(X-K+1, X+K):
    if -1000000 <= i <= 1000000:
        print(i, end=" ")
print()
# Judge status: Accepted
A, B, C = map(int, input().split())
N = A % B
M, i = 0, 2
while M != N:
    M = i * N % B
    if M == C:
        print("YES")
        break
    i += 1
else:
    print("NO")
# Judge status: Accepted
def main():
    X = int(input())
    N = X // 100
    M = X % 100
    if M == 0:
        print(1)
        return
    if M % 5 == 0 and M // 5 <= N:
        print(1)
    elif M % 5 > 0 and M // 5 + 1 <= N:
        print(1)
    else:
        print(0)

if __name__ == '__main__':
    main()
# Judge status: Accepted
N,K = map(int,input().split())
p =  list(map(int, input().split()))

p.sort()
ans = 0
for i in range(K):
    ans = ans + p[i]

print(ans)
# Judge status: Wrong Answer
l = list(input())
if l[-1] == "e":
  s = ''.join(l)
  print(s+"s")
else:
  s = ''.join(l)
  print(s+"es")
# Judge status: Accepted
import sys
import heapq, functools, collections
import random
from collections import Counter, defaultdict
 
# read line as a string
# strr = input()
 
# read line as an integer
k = int(input())
 
# read one line and parse each word as a string
# lst = input().split()
 
# read one line and parse each word as an integer
# arr = list(map(int,input().split()))
 
if k%1000 == 0:
    print(0)
else:
    print(1000 - k%1000)
# Judge status: Accepted
from itertools import *

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

aaa=[]
for i in range(m):
    aaa.append(i+1)

l=[]
for i in range(q):
    a=list(map(int,input().split()))
    l.append(a)

a=list(combinations_with_replacement(aaa,n))
ans=0
for i in a:
    aa=0
    for j in l:
        if i[j[1]-1]-i[j[0]-1]==j[2]:
            aa+=j[3]
    if aa>ans:
        ans=aa
print(ans)
# Judge status: Accepted
import math
N, D = map(int, input().split())
li = []
for i in range(N):
    li.append(list(map(int, input().split())))

count = 0
for i in range(N):
    if D >= math.sqrt(li[i][0] ** 2 + li[i][1] ** 2):
        count += 1
print(count)
# Judge status: Wrong Answer
s,w = map(int,input().split())
if w >= s//2:
    print("unsafe")
else:
    print("safe")
# Judge status: Accepted
n,m = map(int,input().split())
if n == m:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n = int(input())
s = {}
ans = 0
for i in range(n):
    a = list(input())
    sorted_a = "".join(sorted(a))
    if sorted_a in s:
        s[sorted_a] += 1
    else:
        s[sorted_a] = 0
    ans += s[sorted_a]

print(ans)
# Judge status: Accepted
h, n = map(int, input().split())
a = list(map(int, input().split()))

if h > sum(a):
    print('No')
else:
    print('Yes')
# Judge status: Accepted
a,b = map(int,input().split())

if a > 0 and b > 0:
    print("Positive")
elif a <= 0 and b >= 0:
    print("Zero")
elif a < 0 and b < 0:
    if ((b-a)-1) % 2  != 0:
        print("Negative")
    else:
        print("Positive")
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))
purged_data = []
tmp = p[0] + 1
for i, e in enumerate(p):
    if tmp > e:
        purged_data.append(e)
        tmp = e
print(len(purged_data))
# Judge status: Wrong Answer
def per(n):
    if n == 0:
        return 1
    return n * per(n-1)

n=int(input())
p=list(map(int, input().split()))
q=list(map(int, input().split()))
a=0
b=0


for i in range(1,n):
  if p[i-1]-1 !=0:
    a+=(p[i-1]-1)*per(n-i)
  else:
    a+=1

for i in range(1,n):
  if q[i-1]-1 !=0:
    b+=(q[i-1]-1)*per(n-i)
  else:
    b+=1
    
print(a)
print(b)

print(abs(a-b))
# Judge status: Accepted
if __name__ == '__main__':
	
	n = int(input())


	for i in range(n,1000):
		tmp = set(str(i))

		if len(tmp) == 1:
			print(i)
			break
# Judge status: Wrong Answer
from decimal import Decimal
n = Decimal(input())
if n == 0:
  print(0)
  exit(0)
s = ""
while True:
  m = n % -2
  s = str(abs(m)) + s
  n = n // -2
  if n == 1 or n == 0:
    break
  elif m < 0:
    n += 1
print('1'+s)
# Judge status: Wrong Answer
import sys

alist = [
  "a", "b", "c", "d", "e", "f", "g", "h", "i", "j",
  "k", "l", "m", "n", "o", "p", "q", "r", "s", "t",
  "u", "v", "w", "x", "y", "z",
]

for s in sys.stdin:
  i = 0
  for a in alist:
    if s == a:
      print(alist[i+1])
    i += 1
# Judge status: Wrong Answer
n =int(input())
w = list(input() for i in range(n))
if len(set(w))!=n:
  print('No')
else:
  if all(w[i][-1]==w[i+1][0] for i in range(n-2)):
    print('Yes')
  else:
    print('No')
# Judge status: Accepted
S = input()
List = list(S)
s_l = set(List)
if len(List)==len(s_l):
  print("yes")
else:
  print("no")
# Judge status: Accepted
N, K = map(int, input().split())
count = 0
for i in range(K,N+2):
    count += N*i-i**2+i+1
print(count%(10**9+7))
# Judge status: Wrong Answer
n = int(input())
li = list(map(int,input().split()))

dp = [0]*n
dp[1] = abs(li[1]-li[0])
for i in range(2,n):
    dp[i] = min(dp[i-1]+abs(li[i-1]-li[i]),dp[i-2]+abs(li[i]-li[i-2]))
print(dp)
# Judge status: Wrong Answer
a,b,c = map(int, input().split())
print("Yes" if b-a==c-b else "No")
# Judge status: Accepted
a,b = list(map(int, input().split()))
diff = b-a
print(diff * (diff + 1) // 2 - b)
# Judge status: Wrong Answer
A,B,M=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=100006
for i in range(M):
    x,y,c=map(int,input().split())
    ans=min(ans,a[x-1]+b[y-1]-c)
a=sorted(a)
b=sorted(b)
print(min(a[0]+b[0],ans))
# Judge status: Accepted
def resolve():
    a, b, c = map(int, input().split())
    if c-(a-b) > 0:
        print(c-(a-b))
    else:
        print(0)
resolve()
# Judge status: Accepted
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
n = ii()
l = []
for i in range(5):
    l.append(ii())

print((n+min(l)-1)//min(l)+4)
# Judge status: Accepted
from itertools import combinations_with_replacement

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

ans = 0
for A in combinations_with_replacement(range(1, M+1), N):
  tmp = 0
  for a, b, c, d in query:
    if A[b-1] - A[a-1] == c:
      tmp += d
  ans = max(ans, tmp)

print(ans)
# Judge status: Accepted
x = int(input())
y = 0
if x==1 or x==2 or x==3:
    print(1)
    exit()
else:
    for a in range(2,(x+1)):
        for b in range (2,10):
            if b==2 and a**b>x:
                print(y)
                exit()
            elif a**b<=x:
                y=max(a**b,y)
# Judge status: Accepted
coin , mon = map(int,input().split())

if coin*500 >= mon:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n,m = map(int,input().split())
h = list(map(int,input().split()))
ab = [map(int,input().split()) for _ in range(m)]
a, b = [list(i) for i in zip(*ab)]
ans = [True for _ in range(n)]
for i in range(m):
    if h[a[i]-1] > h[b[i]-1]:
        ans[b[i]-1] = False
    else:
        ans[a[i]-1] = False
answer = sum(ans)
print(answer)
# Judge status: Wrong Answer
A,B = input().split()
C = int(A + B)
ok = False
for i in range(1,200):
  if i * i == C:
    ok = True
    break

ans = 'Yes' if ok else 'No'
print(ans)
# Judge status: Wrong Answer
n = list(input())
a = int(''.join(n))
b = []
b.append(int(n[0]) * 111)
b.append(int(n[1]) * 111)
b.append(int(n[2]) * 111)
b = sorted(b)
if a % 111 == 0:
    print(a)
for i in range(3):
    if b[i] >= a:
        print(b[i])
        exit()
# Judge status: Accepted
n, a, b = map(int, input().split())
m = 10**9 + 7

def nCr(n, r, mod):
    r = min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = numer * (n+1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom, mod-2, mod) % mod

ans = pow(2, n, m) - 1 - nCr(n, a, m) - nCr(n, b, m)

while ans < 0:
    ans += m

print(ans)
# Judge status: Accepted
N, M = map(int, input().split())

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

ans = N - sum(A)

if ans >= 0:
	print(ans)
else:
	print(-1)
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
if a>b and a>c:
    print(a*10+b+c)
elif b>a and b>c:
    print(b*10+a+c)
else:
    print(c*10+a+b)
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
from collections import Counter
ctr = Counter(A)
ans = 0
for i in range(10**5):
    tmp = ctr[i-1] + ctr[i] + ctr[i+1]
    ans = max(ans,tmp)
print(ans)
# Judge status: Accepted
S = input()
T = input()

n = len(S)
m = len(T)

ans = m

for i in range(n-m+1):
    xs = S[i:i+m]
    cnt = 0
    for j in range(m):
        if xs[j] != T[j] :
            cnt += 1
    ans = min(ans, cnt)
    
print(ans)
# Judge status: Accepted
print('HTeBiDs e i'[int(input().replace('/',''))>20190430::2])
# Judge status: Accepted
H = int(input())
W = int(input())
x = max(W,H)
N = int(input())
if N%x == 0:
    print(N//x)
else:
    print(N//x+1)
# Judge status: Accepted
n = int(input())
if n%9 == 0:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
n=int(input())
p=[int(x) for x in input().split()]
a=1
b=p[0]
for i in range(1,n):
  if p[i-1]<b:
    b=p[i-1]
  if p[i]<=b:
    a+=1
print(a)
# Judge status: Accepted
A,B,C=map(int,input().split())
print("Yes" if A<C<B or B<C<A else "No")
# Judge status: Accepted
N, M = map(int, input().split()) 

start = set() #  島1から渡ることのできる島
goal = set()  #  島Nへ渡ることのできる島

for _ in range(M):
  x, y = map(int, input().split())
  if x == 1:
    start.add(y)
  elif y == N:
    goal.add(x)

if start & goal:
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')
# Judge status: Accepted
import sys

W, H, x, y = map(int, sys.stdin.readline().split())

if 2*x == W and 2*y == H:
    multi = 1
else:
    multi = 0

print(W*H/2, multi)
# Judge status: Wrong Answer
import math
s = input()
S = s[::-1]
print(S)
count = 0
for i in range(0, len(s)):
  if s[i] != S[i]:
    count += 1
print(math.floor(count/2))
# Judge status: Wrong Answer
a = int(input())
ans = a + a**2 + a**3
print(ans)
# Judge status: Accepted
n,m=map(int,input().split())
if n==1 or m==1:
    if n==1 and m==1:
        print(1)
    elif n==1:
        print(m-2)
    else:
        print(n-2)
else:
    print((n-2)*(m-2))
# Judge status: Accepted
N = int(input())
Hs = list(map(int, input().split()))

tmp = Hs[0]
for h in Hs:
    if tmp - h > 1:
        print("No")
        exit()
    if h > tmp:
        tmp = h
print("Yes")
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
bol = 0
cnt = 1
for i in range(N-1):
    if bol == 0:
        if A[i] > A[i+1]:
            bol = -1
        elif A[i] < A[i+1]:
            bol = 1
    elif bol == 1:
        if A[i] > A[i+1]:
            cnt += 1
            bol = 0
    else:
        if A[i] < A[i+1]:
            cnt += 1
            bol = 0
print(cnt)
# Judge status: Accepted
print(len(set(list(map(int,input().split())))))
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
min_num = float('inf')
for j in range(-N, N+1):
  temp = [abs(A[i]-(j+(i+1))) for i in range(len(A))]
  min_num = min(min_num, sum(temp))
print(min_num)
# Judge status: Accepted
# ABC 110: B – 1 Dimensional World's Tale
n, m, x, y = [int(s) for s in input().split()]
wants_x = [int(s) for s in input().split()]
wants_y = [int(s) for s in input().split()]

wants_x.append(x)
wants_x.sort()

wants_y.append(y)
wants_y.sort()

print('War' if x >= y or max(wants_x) >= min(wants_y) else 'No War')
# Judge status: Accepted
n=int(input())
a=input().split()
aa=1
for i in range(n):
    aa*=int(a[i])
    if aa>10**18:
        aa=-1
        break
if "0" in a:
    aa=0
print(aa)
# Judge status: Accepted
card=[list(map(int,input().split())) for i in range(3)]
n=int(input())
at=[[False for i in range(3)] for j in range(3)]
for i in range(n):
    num=int(input())
    for j in range(3):
        for h in range(3):
            if num==card[j][h]:at[j][h]=True
for i in range(3):
    if False not in at[i]:print('Yes');exit()
for j in range(3):
    if False not in (at[0][j],at[1][j],at[2][j]):print('Yes');exit()
if False not in (at[0][0],at[1][1],at[2][2]) or False not in (at[0][2],at[1][1],at[2][0]):print("Yes");exit()
print("No")
# Judge status: Wrong Answer
s=input()
print(min(s.count('0'),s.count('1')))
# Judge status: Accepted
N = int(input())

if(N % 2 == 0):
  print(0.5000000000)
else:
  M = (N+1)/2
  print(M/N)
# Judge status: Accepted
N = input()
k = int(N[0]) + 9*(len(N) - 1)
if N[1:] != '9' * (len(N) - 1):
    k -= 1     
print(k)
# Judge status: Accepted
s = input()
t = input()

ans = 0

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

print(ans)
# Judge status: Wrong Answer
X,K,D=map(int,input().split())

if X<0:
    X=-X
if K%2==0:
    K=int(K/2)
    D*=2
if K*D>X:
    print(min(X%D,-X%D))
else:
    print(X-K*D)
# Judge status: Accepted
A,B,X=map(int, input().split())
if A <= X <= A+B:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
n=int(input())
dt,dx,dy=0,0,0
for i in range(n):
  t,x,y=map(int,input().split())
  if abs(x-dx) + abs(y-dy) > t-dt or (x+y)%2!=t%2:
    print("No")
    break
  dt,dx,dy=t,x,y
else:
  print("Yes")
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))

ans=[0]*8
count=0
for i in range(n):
    if 8<=a[i]//400:
        count+=1
    else:
        ans[a[i]//400]=1
#print(ans)
if sum(ans)==0:
    print(1,min(8,count))
else:
    print(sum(ans),sum(ans)+count)
# Judge status: Wrong Answer
h1, m1, h2, m2, k = map(int, input().split())
t1 = h1*60+m2
t2 = h2*60+m2
print(t2-t1-k)
# Judge status: Wrong Answer
s = str(input())
s1 = ""
s2 = ""
flag = 0

for i in range(len(s)):
	if not 0 == i and  not len(s) == i:
		if i % 2 == 0:
			# print("---i--- {0}".format(i))
			s1 = s[0:int((len(s)-i)/2)]
			s2 = s[int((len(s)-i)/2):len(s)-i]
			# print(len(s)-i)
			# print("{0} --s1 \n {1} --s2".format(s1,s2))
			if s1 == s2:
				flag =  len(s1+s2)

print(flag)
# Judge status: Accepted

n,m=map(int,input().split())
#a=[0]*m
a=set()
for i in range(m):
#    a[i]=int(input())
    a.add(int(input()))

mod=10**9+7
dp=[0]*(n+1)
dp[0]=1
if 1 in a:
    dp[1]=0
else:
    dp[1]=1
for nn in range(2,n+1):
    if nn in a:
        dp[nn]=0
    else:
        dp[nn]=(dp[nn-1]+dp[nn-2])%mod

#print(dp)
print(dp[n])
# Judge status: Accepted
year, month, day = map(int, input().split('/'))
ans = 'Heisei'
if year > 2019 or (year == 2019 and month > 4):
    ans = 'TBD'
print(ans)
# Judge status: Accepted
X = int(input())
a = X//500
X=X%500
b=X//5
print(a*1000+b*5)
# Judge status: Wrong Answer
a, b, h = [int(input()) for _ in range(3)]
print((a + b) * 2 // h)
# Judge status: Wrong Answer
N = int(input())
AB = [0] * N
for n in range(N):
  AB[-1-n] = [int(x) for x in input().strip().split()]
ans = 0
cnt = 0
for (a, b) in AB:
  if b == 1:
    if a + cnt == 0:
      ans += 1
  else:
    t = b - ((a + cnt) % b)
    cnt += t
    ans += t
print(ans)
# Judge status: Accepted
import string

S = input()
T = input()

for a in string.ascii_lowercase:
    if S + a == T:
        print('Yes')
        exit()

print('No')