Harryxun/stf_run huggingface dataset:
import itertools
import operator

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

if 0 in ms:
  r = 0
else:
  r = itertools.reduce(operator.mul, li)
if r > 10 ** 18:
  r = -1
print(r)

### FIXED CODE ###

n = int(input())
ms = list(map(int, input().split()))
iter_ms = iter(ms) 
r = 1
if 0 in ms:
  r = 0
else:
    for i in range(n):
        x = next(iter_ms)
        r *= x
        if r > 10 ** 18:
            r = -1
            break
        
print(r)
be=str(input())
af=str(input())
ans=0
for i in range 3:
  	if be[i]==af[i]:
    	ans+=1
print(ans)


### FIXED CODE ###

be=input()
af=input()
ans=0
for i in range (3):
    if be[i]==af[i]:
        ans+=1
print(ans)
X = int(input())

a = str(X)
a = int(a[:-2])
b = X - a*100

if a >= 20:
    ans = 1

else:
    if a*5 >= b:
        ans = 1
    else:
        ans = 0
        
print(ans)



### FIXED CODE ###

X = int(input())

if X < 100:
    ans = 0
else:
    a = str(X)
    a = int(a[:-2])
    b = X - a*100

    if a >= 20:
        ans = 1

    else:
        if a*5 >= b:
            ans = 1
        else:
            ans = 0

print(ans)
honsu,hp=map(int , input().split())
huru=[]
nageru=[]
for i in range(honsu):
  a,b=input().split()
  huru.append(int(a))
  nageru.append(int(b))
cc=filter(lambda v:v>=max(huru) , nageru)
cou=0
for i in reversed(sorted(cc)):
  hp-=i
  cou+=1
  if hp<=0:
    break
if hp>0:
  cou+=math.ceil(hp/max(huru))
print(cou)

### FIXED CODE ###

from math import ceil
 
N, H = map(int, input().split())
a, b = [], []
 
for _ in range(N):
    a_i, b_i = map(int, input().split())
    a.append(a_i)
    b.append(b_i)
 
max_a = max(a)
b = sorted(b, reverse=True)
ans = float('inf')
th_po = 0
 
for i in range(N):
    th_po += b[i]
    
    if H >= th_po:
        ans_cand = i + 1 + ceil((H - th_po) / max_a)
    else:
        ans_cand = i + 1
    
    ans = min([ans, ans_cand])
 
print(ans)
S_list = list(map(int,input().split()))

if  (S_list[1] - S_list[0] ) / (S_list[2] - S_list[1]) == 1:
    result = "YES"
else:
    result = "No"
print(result)


### FIXED CODE ###

S_list = list(map(int,input().split()))
 
if  S_list[1] - S_list[0] == S_list[2] - S_list[1]:
    result = "YES"
else:
    result = "NO"
print(result)
a, b = map(int, raw_input().split())
area = a * b
circumference = 2*a + 2*b
print(area + ' ' + circumference)

### FIXED CODE ###

if __name__ == '__main__':
	a, b = map(int, input().split())
	area = a * b
	circumference = 2*a + 2*b
	print(area, circumference)
S = str(input())
days = {"SUN":"7","MON":"6","TUE":"5","WED":"4","THU":"3","FRI":"2","SAT":"1"}
print(days{(S)})


### FIXED CODE ###

S = str(input())
days = {"SUN":"7","MON":"6","TUE":"5","WED":"4","THU":"3","FRI":"2","SAT":"1"}
print(days[S])
n, m = map(intm input().split())
print((n - 1) * (m - 1))

### FIXED CODE ###

n, m = map(int, input().split())
print((n - 1) * (m - 1))
n = int(input())
a_list = list(map(int, input().split())) # list()を忘れずに

n_division = 0

def odd_detector(a_list):
    is_odd = 0
    for a_i in a_list:
        if a_i % 2 == 1:
            is_odd = 1
            break
    return is_odd

while odd_detector(a_list) == 0:
    a_list = [int(a/2) for a in a_list]
    n_division += 1

print(n_division)


### FIXED CODE ###

print(input().count("1"))
N, M = map(int, input().split())

ans_list = [0]*N+1
pen_num = 0
cor_num = 0

for i in range(M):
  p_i, S_i = input().split()
  p_i = int(p_i)
  
  if (ans_list[p_i] == 0):
    if(S_i == "WA"):
      pen_num += 1
    elif(S_i == "AC"):
      cor_num += 1
      ans_list[p_i] = 1
      
print("{} {}".format(cor_num,pen_num))
  
  


### FIXED CODE ###

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

ans_list = [0]*(N+1)
pen_list = [0]*(N+1)

for i in range(M):
  p_i, S_i = input().split()
  p_i = int(p_i)
  
  if (ans_list[p_i] == 0):
    if(S_i == "WA"):
      a = pen_list[p_i]
      a += 1
      pen_list[p_i] = a
    elif(S_i == "AC"):
      ans_list[p_i] = 1

pen_lis_ans = list(itertools.compress(pen_list, ans_list))
cor_num = sum(ans_list)
pen_num = sum(pen_lis_ans)
                   
print("{} {}".format(cor_num,pen_num))
def holiday(n):
    old_dp = [0 for i in range(3)]
    for i in range(n):
        new_dp = [0 for i in range(n)]
        c = list(map(int, input().rstrip().split()))
        for i in range(3):
            for j in range(3):
                if i!=j:
                    new_dp[j] = max(new_dp[j], old_dp[i] + c[j])

        old_dp = new_dp
    return max(old_dp[0], old_dp[1], old_dp[2])

n = int(input().rstrip())

print(holiday(n))

### FIXED CODE ###

def main():
    n = int(input().rstrip())
    old_dp = [0 for i in range(3)]
    for i in range(n):
        new_dp = [0 for i in range(3)]
        c = list(map(int, input().rstrip().split()))
        for i in range(3):
            for j in range(3):
                if i!=j:
                    new_dp[j] = max(new_dp[j], old_dp[i] + c[j])

        old_dp = new_dp
    print(max(old_dp[0], old_dp[1], old_dp[2]))

if __name__ == "__main__":
    main()
def main():
    S = str(input())
    T = str(input())
    a = int(0)
    for x in range(len(S)):
      if S[x]!=T[x]:
          a = a + 1
    print(int(a))
main()

### FIXED CODE ###

def main():
    import itertools
    a = tuple(map(int,input().split()))
    b = tuple(map(int,input().split()))
    c = tuple(map(int,input().split()))
    d = (a[0],b[0],c[0])
    e = (a[1],b[1],c[1])
    f = (a[2],b[2],c[2])
    g = (a[0],b[1],c[2])
    h = (a[2],b[1],c[0])
    n = int(input())
    listB = [int(input()) for x in range(n)]
    X = itertools.permutations(listB,3)
    R = list(X)
    if a in R or b in R or c in R or d in R or e in R or f in R or g in R or h in R:
      print("Yes")
    else:
      print("No")
main()
from operator import mul
from functools import reduce
n, a, b = map(int, input().split())

def inv_felmat(a, p):
    return pow(a, p-2, p)

def cmb(n,r):
    r = min(n-r, r)
    if r == 0: return
    over = reduce(mul, range(n, n-r, -1))
    under = reduce(mul, range(1, r+1))
    under = inv_felmat(under, 10**9 + 7)
    return over * under

all = pow(2, n, 10**9 + 7) - 1 
tmp1 = 1
tmp2 = 1
# for i in range(n-a+1, n+1):
#     tmp1 *= i
# for i in range(1, a+1):
#     tmp2 *= i
tmp1 = cmb(n,a) % (10**9 + 7)
tmp3 = cmb(n,b) % (10**9 + 7)
# for i in range(n-b+1, n+1):
#     tmp3 *= i
# for i in range(1, b+1):
#     tmp4 *= i

result = all - tmp1 - tmp3
print(result%(10**9 + 7))

### FIXED CODE ###

n, a, b = [int(i) for i in input().split()]
mod = 10**9 + 7
 
total = pow(2, n, mod) - 1
def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)
def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res
 
at = combination(n,a)
bt = combination(n,b)
 
result = total - at - bt
result %= mod
if result < 0:
  result += mod
print(result)
k=0
ind=0
l=[]
i=int(input())
l.append(i)
def guusuu():
    k=l[ind]/2
    return int(k)
    
def kisuu():
    k=l[ind]*3+1
    return int(k)

while ind<1000:
    if l[ind]%2==0:
        l.append(guusuu())
    else:
        l.append(kisuu())
    ind+=1       

print((l.index(4))+4)

### FIXED CODE ###

a,b,c =map(int, input().split())
print(int(a*b/2))
n, m = map(int,input().split())
a = list(map(int,input()split()))
s = sum(a) #sにaの総投票数
a.sort(reserve=True)#aを降順にソート
if a[m-1] >= s*(1/4):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

n, m = map(int,input().split())
a = list(map(int,input().split()))
s = sum(a) #sにaの総投票数
a.sort(reverse=True) #aを降順にソート
if a[m-1] >= s*(1/(4*m)):
    print("Yes")
else:
    print("No")
n,q=map(int,input().split())
st=input()
ssum=[0,0]
for i in range(1,n):
    if st[i-1]=="A" and st[i]=='C':
        ssum.append(ssum[-1]+1)
    else:
        ssum.append(ssum[-1])

for i in range(q):
    a,b=map(int,input().split())
    print(ssum[b+1]-ssum[a])

### FIXED CODE ###

n,q=map(int,input().split())
st=input()
ssum=[0,0]
for i in range(1,n):
    if st[i-1]=="A" and st[i]=='C':
        ssum.append(ssum[-1]+1)
    else:
        ssum.append(ssum[-1])
#print(len(ssum))
for i in range(q):
    a,b=map(int,input().split())
    print(ssum[b]-ssum[a])
x, y, a, b, c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort()
q.sort()
r.sort()
red = p[-x:]
green = q[-y:]
ri, gi = 0, 0
for blank in r:
  if (red[ri]>green[gi] and gi<y) or ri>=x:
    if blank>green[gi]:
      green[gi] = blank
      gi += 1
  elif ri<x:
    if blank>red[ri]:
      red[ri] = r[bi]
      ri += 1
print(sum(red)+sum(green))

### FIXED CODE ###

x, y, a, b, c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort()
q.sort()
r.sort()
top_red = p[-x:]
top_green = q[-y:]
final = top_red+top_green+r
final.sort()
print(sum(final[-(x+y):]))
inport sys
for i in sys.stdin.readlines():
        a,b = i.strip().split()
        if a == "0" and b == "0":
                 break;
        if a < b:
                 print(a+" "+b)
        else:
                 print(b+" "+a)

### FIXED CODE ###

import sys
for i in sys.stdin.readlines():
        a,b = i.strip().split()
        if a == "0" and b == "0":
                break

        if int(a) < int(b):
                print("{0} {1}".format(a,b))
        else:
                print("{1} {0}".format(a,b))
N=int(input())
S=[int(input()) for _ in range(N)]

if sum(S)%10:
  print(sum(s))
  exit()

min_s1=101

for s in S:
  if s%10:
    min_s1 = min(s, min_s1)

print(sum(S) - min_s1)

### FIXED CODE ###

N=int(input())
S=[int(input()) for _ in range(N)]

if sum(S)%10:
  print(sum(S))
  exit()

else:
  S.sort()
  for s in S:
    if s%10:
      print(sum(S) - s)
      exit()
  else:
    print(0)
# input = sys.stdin.readline
from bisect import *
from collections import *
from heapq import *
# import functools
# import itertools
# import math
N,M=map(int,input().split())
XYZ=[list(map(int,input().split())) for i in range(M)]
data=[[] for i in range(N+1)]
ittenai=[]
for x,y,z in XYZ:
    data[x].append(y)
    data[y].append(x)
    ittenai.append(x)
    ittenai.append(y)


ittenai=set(ittenai)
count=N-len(ittenai)
while ittenai:
    x=ittenai.pop(x)
    stack=deque([x])

    count+=1
    while stack:
        num=stack.popleft()
        for i in data[num]:
            if i in ittenai:
                ittenai.remove(i)
                stack.append(i)
print(count)


### FIXED CODE ###

# input = sys.stdin.readline
from bisect import *
from collections import *
from heapq import *
# import functools
# import itertools
# import math
N,M=map(int,input().split())
XYZ=[list(map(int,input().split())) for i in range(M)]
data=[[] for i in range(N+1)]
ittenai=[]
for x,y,z in XYZ:
    data[x].append(y)
    data[y].append(x)
    ittenai.append(x)
    ittenai.append(y)


ittenai=set(ittenai)
count=N-len(ittenai)
while ittenai:
    x=ittenai.pop()
    stack=deque([x])

    count+=1
    while stack:
        num=stack.popleft()
        for i in data[num]:
            if i in ittenai:
                ittenai.remove(i)
                stack.append(i)
print(count)
class Trio:
    __pre=None
    __val=None
    __nex=None
    def __init__(self,val,p=None,n=None):
        self.__pre=p
        self.__val=val
        self.__nex=n
    
    def get_pre(self):return self.__pre
    
    def get_nex(self):return self.__nex
    
    def set_pre(self,n):self.__pre=n
        
    def set_nex(self,n):self.__nex=n
    
    def set_val(self,n):self.__val=n
    
    def get_val(self):return self.__val
    
class Queue:
    top = back = None
    def __init__(self):
        pass
    
    def enqueue(self,n):
        if(self.top==None):
            self.top = self.back = Trio(n)
        else:
            self.back.set_nex(Trio(n,p=self.back))
            self.back=self.back.get_nex()
    
    def dequeue(self):
        if(self.top==self.back):
            a,self.top,self.back=self.top.get_val(),None,None
            return a
        elif(self.top==None):
            return None
        else:
            self.top=self.top.get_nex()
            oldtop=self.top.get_pre()
            self.top.set_pre(None)
            return oldtop.get_val()

s = input()
n,limit=map(int,s.split())
que=Queue()
for i in range(n):
    lis=input().split()
    que.enqueue((lis[0],int(lis[1])))

time=0
while(True):
    elm=que.dequeue()
    if(elm==None):
        break
    elif(elm[1]>limit):
        que.enqueue((elm[0],elm[1]-limit))
        time+=100
    else:
        time+=elm[1]
        print(elm[0],time)

### FIXED CODE ###

class Trio:
    __pre=None
    __val=None
    __nex=None
    def __init__(self,val,p=None,n=None):
        self.__pre=p
        self.__val=val
        self.__nex=n
    
    def get_pre(self):return self.__pre
    
    def get_nex(self):return self.__nex
    
    def set_pre(self,n):self.__pre=n
        
    def set_nex(self,n):self.__nex=n
    
    def set_val(self,n):self.__val=n
    
    def get_val(self):return self.__val
    
class Queue:
    top = back = None
    def __init__(self):
        pass
    
    def enqueue(self,n):
        if(self.top==None):
            self.top = self.back = Trio(n)
        else:
            self.back.set_nex(Trio(n,p=self.back))
            self.back=self.back.get_nex()
    
    def dequeue(self):
        if(self.top==None):
            return None
        elif(self.top==self.back):
            a=self.top.get_val()
            self.top,self.back=None,None
            return a
        else:
            self.top=self.top.get_nex()
            oldtop=self.top.get_pre()
            self.top.set_pre(None)
            return oldtop.get_val()

s = input()
n,limit=map(int,s.split())
que=Queue()
for i in range(n):
    lis=input().split()
    que.enqueue((lis[0],int(lis[1])))

time=0
while(True):
    elm=que.dequeue()
    if(elm==None):
        break
    elif(elm[1]>limit):
        que.enqueue((elm[0],elm[1]-limit))
        time+=limit
    else:
        time+=elm[1]
        print(elm[0],time)
S = input()
S_list = list(S)

while len(S_list) >= 5 :
    if S_list[0:5] == ['e', 'r', 'a', 's', 'e']:
        if S_list[5] == 'r' and len(S_list) >= 6:
            del S_list[0:6]
        else:
            del S_list[0:5]
    elif S_list[0:5] == ['d', 'r', 'e', 'a', 'm']:
        if S_list[5:8] == ['e', 'r', 'a'] and len(S_list) >= 8:
            del S_list[0:5]
        elif S_list[5:7] == ['e', 'r'] and S_list[7] != ['a'] and len(S_list) >= 8:
            del S_list[0:7]
        else :
            del S_list[0:5]
    else:
        print('NO')
        break


if len(S_list) == 0:
    print('YES')
elif 0<len(S_list)<5:
    print('NO')

### FIXED CODE ###

S = input()
S_list = list(S)

while len(S_list) >= 5 :
    a = len(S_list)
    if S_list[0:5] == ['e', 'r', 'a', 's', 'e']:
        if a >= 6 :
            if S_list[5] == 'r' :
                del S_list[0:6]
            else:
                del S_list[0:5]
        else:
            del S_list[0:5]
    elif S_list[0:5] == ['d', 'r', 'e', 'a', 'm']:
        if a >= 8 :
            if S_list[5:8] == ['e', 'r', 'a'] :
                del S_list[0:5]
            elif S_list[5:7] == ['e', 'r'] :
                del S_list[0:7]
            else :
                del S_list[0:5]
        elif a >= 7 :
            if S_list[5:7] == ['e', 'r'] :
                del S_list[0:7]
            else:
                del S_list[0:5]
        else :
            del S_list[0:5]
    else:
        print('NO')
        break


if len(S_list) == 0:
    print('YES')
elif 0<len(S_list)<5:
    print('NO')
num1 = int(input())
num2 = int(input())

if num1 >= 10 or num2 >= 10 :
    print(-1)
else:
    print(num1 * num2 )


### FIXED CODE ###

x , y = map(int , input(). split())
if x < 10 and y < 10 :
    print(x * y)
else:
    print(-1)
def bekijou(a,x):
  MOD = 1000000009
  ret = 1
  for _ in range(x):
    ret *= a
    ret %= MOD
    
n=int(input())
ret = 0
sum = bekijou(9,n)
MOD = 1000000009
ret = (2 * sum) % MOD
ret += MOD - bekijou(8,n)
ret = bekijou(10,n) + MOD - ret
print(ret)

### FIXED CODE ###

def bekijou(a,x):
  MOD = 1000000007
  ret = 1
  for _ in range(x):
    ret *= a
    ret %= MOD
  return ret
    
n=int(input())
MOD = 1000000007
ret = (bekijou(10,n)+MOD-((2*bekijou(9,n)) % MOD)+bekijou(8,n))%MOD
print(ret)
import string

count = {x: 0 for x in string.ascii_lowercase}
lines = ""

while True:
    try:
        lines += input().lower()
    except EOFError:
        break

for c in s:
    if 'a' <= c <= 'z':
            count[c] += 1

for key in string.ascii_lowercase:
    print("{0} : {1}".format(key, count[key]))

### FIXED CODE ###

import string

count = {x: 0 for x in string.ascii_lowercase}
lines = ""

while True:
    try:
        lines += input().lower()
    except EOFError:
        break

for c in lines:
    if 'a' <= c <= 'z':
            count[c] += 1

for key in string.ascii_lowercase:
    print("{0} : {1}".format(key, count[key]))
import sys
 
args = sys.argv
 
sum = int(args[1])+int(args[2])+int(args[3])

if sum > 21:
	print('bust')
else:
	print('win')


### FIXED CODE ###

A1,A2,A3=map(int,input().split())
if A1 + A2 + A3 > 21:
	print("bust")
else:
	print("win")
H, W = [int(str) for str in input().strip().split()]
A = [[int(str) for str in input().strip().split()] for _ in range(H)]

N = 0
actions = []
for i in range(H):
    jd = 1 - (i % 2) * 2
    js = list(range(W))[::jd]
    for j in js:
        if A[i][j] % 2:
            if j == js[-1]:
                if i != H - 1:
                    ti, tj = i + 1, j
            
            else:
                ti, tj = i, j + jd

            A[ti][tj] += 1
            actions.append([i + 1, j + 1, ti + 1, tj + 1])
            N += 1

print(N)
for action in actions:
    [print(a, end=' ') for a in action]
    print('')

### FIXED CODE ###

H, W = [int(str) for str in input().strip().split()]
A = [[int(str) for str in input().strip().split()] for _ in range(H)]

N = 0
actions = []
for i in range(H):
    jd = 1 - (i % 2) * 2
    js = list(range(W))[::jd]
    for j in js:
        if A[i][j] % 2 and A[i][j] != 0:
            if j == js[-1]:
                if i != H - 1:
                    ti, tj = i + 1, j
                else:
                    break
            
            else:
                ti, tj = i, j + jd

            A[ti][tj] += 1
            actions.append('{0} {1} {2} {3}'.format(i + 1, j + 1, ti + 1, tj + 1))
            N += 1

print(N)
[print(action) for action in actions]
n, k = map(int, input().split())
p = list(map(int, input().split()))
 
def S(n):
  return n * (n + 1) // 2

for i in range(k):
  ans += S(p[i]) / p[i]

for i in range(k, n):
  ans = max(ans, ans + S(p[i]) / p[i] - S(p[i - k] / p[i - k])
  
print(ans)


### FIXED CODE ###

n, k = map(int, input().split())
p = list(map(int, input().split()))

ans = 0
for i in range(k):
    ans += (p[i] + 1) / 2
t = ans
for i in range(k, n):
    t += (p[i] + 1) / 2 - (p[i - k] + 1) / 2
    ans = max(ans, t)

print(ans)
def resolve():
    from scipy.sparse import csr_matrix
    from scipy.sparse.csgraph import floyd_warshall

    N,X,Y=map(int,input().split())
    # 距離行列の生成
    dist_matrix = [[0] * (N) for _ in range(N)]
    for i in range(N):
        dist_matrix[i][i] = 0
    for i in range(N-1):
        dist_matrix[i][i+1] = 1
        dist_matrix[i+1][i]=1
    dist_matrix[X-1][Y-1] = 1
    dist_matrix[Y-1][X-1] = 1


    graph = csr_matrix(dist_matrix)
    # ワーシャルフロイド
    dist_matrix = floyd_warshall(csgraph=graph, directed=False)
    ans = [0] * N
    for lst in dist_matrix:
        for i in range(len(lst)):
            ans[int(lst[i])] += 1

    for j in range(1, N):
        print(ans[j] // 2)






resolve()

### FIXED CODE ###

# import bisect
# from collections import Counter, deque
# import copy
# from fractions import gcd
# from functools import reduce
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np

def resolve():
    from heapq import heappush, heappop

    # 長点数V、直接移動先とコストを記したリストg、スタート地点rをとって、
    # rからiに行くまでの最低コストがdist[i]であることを意味するリストdistを返す関数
    def dijkstra(V, g, r):

        dist = [INF] * V
        queue = [(0, r)]  # queueの要素(c,v)は、コストcで直接vに行けることを意味する
        dist[r] = 0  # スタート地点rにはコスト0で行ける

        while queue:
            c, v = heappop(queue)
            if dist[v] < c:  # すでに記録されているコストの方が小さいので更新不要
                continue
            for cost, t in g[v]:
                if dist[v] + cost < dist[t]:
                    dist[t] = dist[v] + cost
                    heappush(queue, (dist[t], t))

        return dist

    N,X,Y=map(int,input().split())
    V, E= N,N
    g = [[] for i in range(V)]

    for i in range(N-1):
        g[i].append((1, i+1))
        g[i+1].append((1, i))  # g[s]の要素(cost,t)はsからコストcostでtに直接行けることを意味する
        # g[s]の要素(cost,t)はsからコストcostでtに直接行けることを意味する
    g[X-1].append((1, Y-1))
    g[Y-1].append((1, X-1))

    INF = 10 ** 10
    ans = [0] * N

    for r in range(N):
        for i in dijkstra(V, g, r):
            if i<INF:
                ans[i]+=1

    for j in range(1, N):
        print(ans[j] // 2)


resolve()
a,b,c=map(int,input().split())
if(((a==5)or(a==7)) and ((b==5)or(b==7)) and ((c==5)or(c==7))):
  ifa+B+c==17:
    print("YES")
  else:
    print("NO")
else:
  print("NO")  

### FIXED CODE ###

a,b,c=map(int,input().split())
if(((a==5)or(a==7)) and ((b==5)or(b==7)) and ((c==5)or(c==7))):
  if(a+b+c==17):
    print("YES")
  else:
    print("NO")
else:
  print("NO")
# coding:utf-8
# C - Grand Garden

N = int(input())
h =  [int(i) for i in input().split()]
h += [0]
ans = 0

while True:
    mini_ans = 0
    for i in range(N+1):
        if h[i] != 0:
            h[i] -= 1
            add = True
        else:
            if add:
                mini_ans += 1
            add = False
    if mini_ans == 0:
        break
    else:
        ans += mini_ans

print(ans)

### FIXED CODE ###

N = int(input())
h = list(map(int,input().split()))
h += [0]
add = False
ans = 0
for n in range(100):
    for i in range(N+1):
        if h[i] != 0:
            h[i] -= 1
            add = True
        else:
            if add:
                ans += 1
            add = False
print(ans)
N = int(input())

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

ans = []
sum = 0

for j in range(min(a), max(a)):
    for num in a:
        sum += (num - j) ** 2
    else:
        ans.append(sum)
        sum = 0

print(min(ans))


### FIXED CODE ###

N = int(input())

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

ans = []
sum = 0

for j in range(min(a), max(a)):
    for num in a:
        sum += (num - j) ** 2
    else:
        ans.append(sum)
        sum = 0

if len(ans) == 0:
    print(0)
else:
    print(min(ans))
A1_1,A1_2,A1_3 = map(int, input().split())
A2_1,A2_2,A2_3 = map(int, input().split())
A3_1,A3_2,A3_3 = map(int, input().split())
N =int(input())
B = []
for _ in range(N+4):
    B.append(input())

a=str('yes')
b=str('no')
if A1_1 in B and A1_2 in B and A1_3 in B:
     print(a)
elif A2_1 in B and A2_2 in B and A2_3 in B:
    print(a)
elif A3_1 in B and A3_2 in B and A3_3 in B:
     print(a)
elif A1_1 in B and A2_1 in B and A3_1 in B:
    print(a)
elif A1_2 in B and A2_2 in B and A3_2 in B:
    print(a)
elif A1_3 in B and A2_3 in B and A3_3 in B:
    print(a)
elif A1_1 in B and A2_2 in B and A3_3 in B:
     print(a)
elif A1_3 in B and A2_2 in B and A3_1 in B:
    print(a)
else:
    print(b)

### FIXED CODE ###

A1_1,A1_2,A1_3 = map(int, input().split())
A2_1,A2_2,A2_3 = map(int, input().split())
A3_1,A3_2,A3_3 = map(int, input().split())
N =int(input())
B = []
for _ in range(N):
    B.append(int(input()))

a=str('Yes')
b=str('No')
if A1_1 in B and A1_2 in B and A1_3 in B:
     print(a)
elif A2_1 in B and A2_2 in B and A2_3 in B:
    print(a)
elif A3_1 in B and A3_2 in B and A3_3 in B:
     print(a)
elif A1_1 in B and A2_1 in B and A3_1 in B:
    print(a)
elif A1_2 in B and A2_2 in B and A3_2 in B:
    print(a)
elif A1_3 in B and A2_3 in B and A3_3 in B:
    print(a)
elif A1_1 in B and A2_2 in B and A3_3 in B:
     print(a)
elif A1_3 in B and A2_2 in B and A3_1 in B:
    print(a)
else:
    print(b)