Problem:


Score : 200 points

Problem Statement

We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}.

The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet.

Determine whether we will have a bingo when the N numbers are chosen, that is, the sheet will contain three marked numbers in a row, column, or diagonal.

Constraints

All values in input are integers.

1 \leq A_{i, j} \leq 100

A_{i_1, j_1} \neq A_{i_2, j_2} ((i_1, j_1) \neq (i_2, j_2))

1 \leq N \leq 10

1 \leq b_i \leq 100

b_i \neq b_j (i \neq j)

Input

Input is given from Standard Input in the following format:

A_{1, 1} A_{1, 2} A_{1, 3}
A_{2, 1} A_{2, 2} A_{2, 3}
A_{3, 1} A_{3, 2} A_{3, 3}
N
b_1
\vdots
b_N

Output

If we will have a bingo, print Yes; otherwise, print No.

Sample Input 1

84 97 66
79 89 11
61 59 7
7
89
7
87
79
24
84
30

Sample Output 1

Yes

We will mark A_{1, 1}, A_{2, 1}, A_{2, 2}, A_{3, 3}, and complete the diagonal from the top-left to the bottom-right.

Sample Input 2

41 7 46
26 89 2
78 92 8
5
6
45
16
57
17

Sample Output 2

No

We will mark nothing.

Sample Input 3

60 88 34
92 41 43
65 73 48
10
60
43
88
11
48
73
65
41
92
34

Sample Output 3

Yes

We will mark all the squares.



Sample input:
84 97 66
79 89 11
61 59 7
7
89
7
87
79
24
84
30


Sample output:
Yes

Submission status: Runtime Error

Solution code:
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
n=int(input())
ans=[[0,0,0] for i in range(3)]
count=-1
for i in range(n):
  s=int(input())
  for T in [A,B,C]:
    count+=1
    if s in T:
      ans[count][T.index(s)]=1
for i in range(3):
  if ans[i]==[1,1,1]:
    print("Yes")
    exit()
for i in range(3):
  if [ans[i][j] for j in range(3)]==[1,1,1]:
    print("Yes")
    exit()
if [ans[0][0],ans[1][1],ans[2][2]]==[1,1,1]:
  print("Yes")
  exit()
if [ans[0][2],ans[1][1],ans[2][0]]==[1,1,1]:
  print("Yes")
  exit()
print("No")

Submission status: Runtime Error

Solution code:
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
n=int(input())
ans=[[0,0,0] for i in range(3)]
for i in range(n):
  s=int(input())
  for T in [A,B,C]:
    if s in T:
      ans[T.index(s)]=1
for i in range(3):
  if ans[i]==[1,1,1]:
    print("Yes")
    exit()
for i in range(3):
  if [ans[i][j] for j in range(3)]==[1,1,1]:
    print("Yes")
    exit()
if [ans[0][0],ans[1][1],ans[2][2]]==[1,1,1]:
  print("Yes")
  exit()
if [ans[0][2],ans[1][1],ans[2][0]]==[1,1,1]:
  print("Yes")
  exit()
print("No")

Submission status: Runtime Error

Solution code:
bingo = []
tmp = input()
bingo.append(tmp.split(' '))
tmp = input()
bingo.append(tmp.split(' '))
tmp = input()
bingo.append(tmp.split(' '))
for i in len(bingo):
    bingo[i] = [int(bingo[i][0]), int(bingo[i][1]), int(bingo[i][2])]

n = input()
data = []
arr = range(int(n))
arr = list(arr)
for count in arr:
    tmp = input()
    data.append(int(tmp))

ans = []
for num in data:
    for i in len(bingo):
        for j in [0, 1, 2]:
            if bingo[i][j] is num:
                ans.append([i, j])

# 1 2 3
# 4 5 6
# 7 8 9

# 6 15 12 15 15 24 18
# more 3

# 11 12 13
# 21 22 23
# 31 32 33

if [0, 0] in ans and [0, 1] in ans and [0, 2] in ans:
    print('Yes')
    exit(0)

if [1, 0] in ans and [1, 1] in ans and [1, 2] in ans:
    print('Yes')
    exit(0)

if [2, 0] in ans and [2, 1] in ans and [2, 2] in ans:
    print('Yes')
    exit(0)

if [0, 0] in ans and [1, 0] in ans and [2, 0] in ans:
    print('Yes')
    exit(0)

if [0, 1] in ans and [1, 1] in ans and [2, 1] in ans:
    print('Yes')
    exit(0)

if [0, 2] in ans and [1, 2] in ans and [2, 2] in ans:
    print('Yes')
    exit(0)

if [0, 0] in ans and [1, 1] in ans and [2, 2] in ans:
    print('Yes')
    exit(0)

if [0, 2] in ans and [1, 1] in ans and [2, 0] in ans:
    print('Yes')
    exit(0)

print('No')

Submission status: Runtime Error

Solution code:
a = [list(map(int, input().split())) for i in range(3)]
output =[[0,0,0],[0,0,0],[0,0,0]]
n = int(input())
check==False
for k in range(n):
    b=int(input())
    for i in range(3):
        for j in range(3):
            if a[i][j]==b:
                output[i][j]=1
for i in range(3):
    if output[i][0]*output[i][1]*output[i][2]==1:
        check=True
    elif output[0][i]*output[1][i]*output[2][i]==1:
        check=True
if output[0][0]*output[1][1]*output[2][2]==1:
    check=True
elif output[2][0]*output[1][1]*output[0][2]==1:
    check=True
if check==True:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
a = [list(map(int, input().split())) for i in range(3)]
output =[[0,0,0],[0,0,0],[0,0,0]]
n = int(input())
for k in range(n):
    b=int(input())
    for i in range(3):
        for j in range(3):
            if a[i][j]==b:
                output[i][j]=1
for i in range(3):
    if output[i][0]*output[i][1]*output[i][2]==1:
        check=True
    elif output[0][i]*output[1][i]*output[2][i]==1:
        check=True
if output[0][0]*output[1][1]*output[2][2]==1:
    check=True
elif output[2][0]*output[1][1]*output[0][2]==1:
    check=True
if check==True:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
A1 = list(map(int,input().split()))
A2 = list(map(int,input().split()))
A3 = list(map(int,input().split()))
N = int(input())
b_list=[]
for i in range(N):
  b_list.append(int(input))

for i in b_list:
  A1 = [x in A1 if x != i else -1]
  A2 = [y in A2 if y != i else -1]
  A3 = [z in A3 if z != i else -1]

if sum(A1)==-3 or sum(A2)==-3 or sum(A3)==-3:
  print('Yes')
  exit()
for t in range(3)
  if A1[t]+A2[t]+A3[t] == -3:
    print('Yes')
    exit()
if A1[0]+A2[1]+A3[2] == -3 or A1[2]+A2[1]+A3[0] == -3:
  print('Yes')
  exit()
print('No')

Submission status: Runtime Error

Solution code:
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(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())

bs = []
for _ in range(n):
    bs.append(int(input())
       
for l in [a,b,c,d,e,f,g,h]:
    if (l[0] in bs) and (l[1] in bs) and (l[2] in bs):
        print("Yes")
        break
else:
    print("No")

Submission status: Runtime Error

Solution code:
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(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())

bs = []
for _ in range(n):
             bs.append(int(input())
       
for l in [a,b,c,d,e,f,g,h]:
    if (l[0] in bs) and (l[1] in bs) and (l[2] in bs):
        print("Yes")
        break
else:
    print("No")

Submission status: Runtime Error

Solution code:
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(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())

bs = []
for _ in range(n):
             bs.append(int(input())
       
for l in [a,b,c,d,e,f,g,h]:
             if (l[0] in bs) and (l[1] in bs) and (l[2] in bs):
             print("Yes")
             break
else:
             print("No")

Submission status: Runtime Error

Solution code:
a = list(map(int(),input().split()))
b = list(map(int(),input().split()))
c = list(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())

bs = []
for _ in range(n):
             bs.append(int(input())
       
for l in [a,b,c,d,e,f,g,h]
             if (l[0] in bs) and (l[1] in bs) and (l[2] in bs):
             print("Yes")
             break
else:
             print("No")

Submission status: Runtime Error

Solution code:
a = list(map(int(),input().split()))
b = list(map(int(),input().split()))
c = list(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())

bs = []
for _ in int(input(range(n))):
             bs.append(int(input())
       
for l in [a,b,c,d,e,f,g,h]
             if (l[0] in bs) and (l[1] in bs) and (l[2] in bs):
             print("Yes")
             break
else:
             print("No")

Submission status: Runtime Error

Solution code:
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(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())

bs = []
for _ in int(input(range(n))):
             bs.append(int(input())
       
for l in [a,b,c,d,e,f,g,h]
             if (l[0] in bs) and (l[1] in bs) and (l[2] in bs):
             print("Yes")
             break
else:
             print("No")

Submission status: Runtime Error

Solution code:
l=[list(map(int,input().split())) for i in range(3)]
n=int(input())
H=[0,0,0]
W=[0,0,0]
S=[0,0]
 
for i in range(n):
    b=int(input())
    for h in range(3):
        for w in range(3):
            if b==l[h][w]:
                H[h]+=1
                W[w]+=1
                if h==w:
                    S[0]+=1
                if h+w==4:
                    S[1]+=1
 
check=False
for h in H:
    if h==3:
        check=True
for w in W:
    if w==3:
        check=True
for s in S:
    if s==3:
        check=True
 
if check:
    print("Yes")
else:
    print("No")
l=[list(map(int,input().split())) for i in range(3)]
n=int(input())
H=[0,0,0]
W=[0,0,0]
S=[0,0]

for i in range(n):
    b=int(input())
    for h in range(3):
        for w in range(3):
            if b==l[h][w]:
                H[h]+=1
                W[w]+=1
                if h==w:
                    S[0]+=1
                if h+w==2:
                    S[1]+=1

check=False
for h in H:
    if h==3:
        check=True
for w in W:
    if w==3:
        check=True
for s in S:
    if s==3:
        check=True

if check:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
dic={}
a=[[0 for i in range(3)]for j in range(3)]
for i in range(1,100):
    dic[i]=[-1,-1]
for i in range(3):
    a[i]= list(map(int,input().split()))
    for j in range(3):
        dic[a[i][j]]=[i,j]
n=int(input())
for i in range(n):
    x=int(input())
    if(dic[x]!=[-1,-1]):
        a[dic[x][0],dic[x][1]]=0
flag=0
for i in range(3):
    if(max(a[i][1],a[i][2],a[i][0])==0):
        flag=1
        break
    elif(max(a[1][i],a[2][i],a[0][i])==0):
        flag=1
        break
if(max(a[0][0],a[1][1],a[2][2])==0):
    flag=1
elif(max(a[0][2],a[1][1],a[2][0])==0):
    flag=1
if(flag==1):
    print ('Yes')
else:
    print ('No')

Submission status: Runtime Error

Solution code:
dic={}
a=[[0 for i in range(3)]for j in range(3)]
for i in range(1,100):
    dic[i]=[-1,-1]
for i in range(3):
    for j in range(3):
        x=int(input())
        a[i][j]=3
        dic[x]=[i,j]
n=int(input())
for i in range(n):
    x=int(input())
    if(dic[x]!=[-1,-1]):
        a[dic[x][0],dic[x][1]]=0
flag=0
for i in range(3):
    if(max(a[i][1],a[i][2],a[i][0])==0):
        flag=1
        break
    elif(max(a[1][i],a[2][i],a[3][i])==0):
        flag=1
        break
if(max(a[0][0],a[1][1],a[2][2])==0):
    flag=1
elif(max(a[0][2],a[1][1],a[2][0])==0):
    flag=1
if(flag==1):
    print ('Yes')
else:
    print ('No')

Submission status: Runtime Error

Solution code:
dic={}
a=[[0 for i in range(3)]for j in range(3)]
for i in range(1,100):
  dic[i]=[-1,-1]
for i in range(3):
  for j in range(3):
    x=int(input())
    a[i][j]=3
    dic[x]=[i,j]
n=int(input())
for i in range(n):
  x=int(input())
  if(dic[x]!=[-1,-1]):
    a[dic[x][0],dic[x][1]]=0
flag=0
for i in range(3):
  if(max(a[i][1],a[i][2],a[i][0])==0):
    flag=1
    break
  elif(max(a[1][i],a[2][i],a[3][i])==0):
    flag=1
    break
if(max(a[0][0],a[1][1],a[2][2])==0):
  flag=1
elif(max(a[0][2],a[1][1],a[2][0])==0):
  flag=1
if(flag==1):
  print ('Yes')
else:
  print ('No')

Submission status: Runtime Error

Solution code:
import numpy as np
N_1=list(map(int, input().split()))
N_2=list(map(int, input().split()))
N_3=list(map(int, input().split()))
N=int(input())
a=[int(input()) for i in range(N)]

n=np.array([N_1,N_2,N_3])

for a_n in a:
    if a_n in n:
        n[n==a_n]=0
    else:
        pass

if np.all(n[0:,0])==0:
    i=+1
elif np.all(n[0:,1])==0:
    i+=1
elif np.all(n[0:,2])==0:
    i+=1
elif np.all(n[0,0:])==0:
    i+=1
elif np.all(n[1,0:])==0:
    i+=1                
elif np.all(n[2,0:])==0:
    i+=1                
elif n[0,0] and n[1,1] and n[2,2] ==0:
    i+=1                
elif n[0,2] and n[1,1] and n[2,0] ==0:
    i+=1

if i>0:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
from copy import deepcopy as dc
from copy import deepcopy as dc
import numpy as np

A = []
for _ in range(3):
    A.append(input().split(' '))
N = input()

bs = []
is_fill = dc([[0,0,0]]*3)

for n in range(N):
    for i in range(3):
        for j in range(3):
            if A[i][j] == input():
                is_fill[i][j] = max(1,is_fill[i][j])

A = np.array(A,dtype=int)
if (A.sum(axis = 0) == 3).max():
    print('Yes')
    exist
if (A.sum(axis = 1) == 3).max():
    print('Yes')
    exist
if A[1][1]==1:
    if A[0][0]+A[2][2] == 2:
        print('Yes')
        exist
    if A[0][2]+A[2][0] == 2:
        print('Yes')
        exist
print('No')

Submission status: Runtime Error

Solution code:
# coding: utf-8
import sys
A = []
A.append(map(int, raw_input().split()))
A.append(map(int, raw_input().split()))
A.append(map(int, raw_input().split()))

a = [[0,0,0],[0,0,0],[0,0,0]]

N = int(raw_input())
for i in range(N):
    b = int(raw_input())
    for j in range(3):
        if b in A[j]:
            a[j][A[j].index(b)] = 1

if 0 not in a[0]:
    print 'Yes'    
    sys.exit()
if 0 not in a[1]:
    print 'Yes'
    sys.exit()
if 0 not in a[2]:
	print 'Yes'
    sys.exit()
if a[0][0]*a[1][0]*a[2][0] == 1:
    print 'Yes'
    sys.exit()
if a[0][1]*a[1][1]*a[2][1] == 1:
    print 'Yes'
    sys.exit()
if a[0][2]*a[1][2]*a[2][2] == 1:
    print 'Yes'
    sys.exit()

if a[0][0]*a[1][1]*a[2][2] == 1:
    print 'Yes'
    sys.exit()
if a[0][2]*a[1][1]*a[2][0] == 1:
    print 'Yes'
    sys.exit()

Submission status: Runtime Error

Solution code:
a = [list(map(int, input().split())) for _ in range(3)]
    n = int(input())
    b = [int(input()) for i in range(n)]
    ai = [[1]*3 for _ in range(3)]
    for i in range(3):
        for j in range(3):
            if a[i][j] in b:
                ai[i][j] = 0
    ans = "No"
    for k in range(3):
        if sum(ai[k])== 0:
            ans = "Yes"
    for l in range(3):
        if ai[0][k]+ai[1][k]+ai[2][k] == 0:
            ans = "Yes"
    if ai[0][0]+ai[1][1]+ai[2][2] == 0 or ai[0][2]+ai[2][0]+ai[1][1] == 0:
        ans = "Yes"
    print(ans)

Submission status: Runtime Error

Solution code:
def isBingo(a):
    for i in range(3)
        if a[i][0] == a[i][1] and a[i][0] == a[i][2]:
            return 'Yes'
        elif a[0][i] == a[1][i] and a[i][0] == a[2][i]:
            return 'Yes'
    if a[0][0] == a[1][1] and a[0][0] == a[2][2]:
        return 'Yes'
    elif a[0][2] == a[1][1] and a[0][2] == a[2][0]:
        return 'Yes'
    else:
        return 'No'
    
a = []
for i in range(3):
    a.append(list(map(int, input().split())))
n = int(input())
b = []
for i in range(n):
    b.append(int(input()))

for i in range(n):
    for j in range(3):
        if b[i] in a[j]:
            a[j][a[j].index(b[i])] = -1

print(isBingo(a))

Submission status: Runtime Error

Solution code:
def isBingo(a):
    for i in range(3)
        if a[i][0] == a[i][1] and a[i][0] == a[i][2]:
            return 'Yes'
        elif a[0][i] == a[1][i] and a[i][0] == a[2][i]:
            return 'Yes'
    if a[0][0] == a[1][1] and a[0][0] == a[2][2]:
        return 'Yes'
    elif a[0][2] == a[1][1] and a[0][2] == a[2][0]
        return 'Yes'
    else:
        return 'No'
    
a = []
for i in range(3):
    a.append(list(map(int, input().split())))
n = int(input())
b = []
for i in range(n):
    b.append(int(input()))

for i in range(n):
    for j in range(3):
        if b[i] in a[j]:
            a[j][a[j].index(b[i])] = -1

print(isBingo(a))

Submission status: Runtime Error

Solution code:
# Atcoder ABC 157
# Problem B

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

n = int(input())

for _ in range(n):  #b_n roop
   b = int(input())
   for i in range(3):
    for j in range(3):
      if b == a[i][j]:
        a[i][j] = 0  #make a 0
        
for i in range(3):
    if sum(a[i]) == 0: #横チェック
     print("Yes")
     exit()
    if sum([a[0][i], a[1][i], a[2][i]]) == 0: #縦チェック
     print("Yes")
     exit()

if sum([a[0][0], a[1][1], a[2][2]]) == 0: #斜めチェック
    print("Yes")
    exit()

if sum([a[2][0], a[1][1], a[0][2]]) == 0: #逆斜めチェック
    print("Yes")
    exit()

#n(Yes)=0のとき

Submission status: Runtime Error

Solution code:
# Atcoder ABC 157
# Problem B

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

n = int(input())

for _ in range(n):  #b_n roop
   b = int(input())
   for i in range(3):
    for j in range(3):
      if b == a[i][j]:
        a[i][j] = 0  #make a 0
        
for i in range(3):
    if sum(a[i]) == 0: #横チェック
     print("Yes")
     exit()
    if sum(a[0][i],a[1][i],a[2][i]) == 0: #縦チェック
     print("Yes")
     exit()

if sum(a[0][0],a[1][1],a[2][2]) == 0: #斜めチェック
    print("Yes")
    exit()

if sum(a[2][0],a[1][1],a[0][2]) == 0: #逆斜めチェック
    print("Yes")
    exit()

#n(Yes)=0のとき
print("No")

Submission status: Runtime Error

Solution code:
# Atcoder ABC 157
# Problem B

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

n = int(input())

for _ in range(n):  #b_n roop
   b = int(input())
   for i in range(3):
    for j in range(3):
      if b == a[i][j]:
        a[i][j] == 0  #make a 0
        
for i in range(3):
    if sum(a[i]) == 0: #横チェック
     print("Yes")
     exit()
    if sum(a[0][i],a[1][i],a[2][i]) == 0: #縦チェック
     print("Yes")
     exit()

if sum(a[0][0],a[1][1],a[2][2]) == 0: #斜めチェック
    print("Yes")
    exit()

if sum(a[2][0],a[1][1],a[0][2]) == 0: #逆斜めチェック
    print("Yes")
    exit()

#n(Yes)=0のとき
print("No")

Submission status: Runtime Error

Solution code:
card = []
for _ in range(3):
    card.extend([*map(int, input().split())])

result = [0] * 9
for i in range(int(input())):
    n = int(input())
    pos_list = [idx for idx, x in enumerate(card) if n == x]
    if pos_list:
        for pos in pos_list: result[pos] = 1

indices = [
    [0, 1, 2], [3, 4, 5], [6, 7, 8],
    [0, 3, 6], [1, 4, 7], [2, 5, 8],
    [0, 4, 8], [2, 4, 6]
]

for a, b, c in indices:
    if result[a] == 1 and result[b] == 1 and result[c] == 1:
        print('Yes')
        exit()

print('No')

Submission status: Runtime Error

Solution code:
A = []
B = [0]*9

# Aには [1, 2, 3, 4, 5, 6, 7, 8, 9] の形で格納.
for _ in range(3):
    A += [int(i) for i in input().split()]

# 印をつけた数字をBに残しておく.
n=int(input())
for _ in range(n):
    b = int(input())
    for i, a in enumerate(A):
        if b == a:
            B[i] = 1

#ビンゴの可能性がある組を作っておく.
C = [[1,2,3],[4,5,6],[7,8,9],[1,4,7],[2,5,8],[3,6,9],[1,5,9],[3,5,7]]
flag = 0

# Bで1と記録が残っていれば真
for a,b,c in C:
    if B[a-1] and B[b-1] and B[c-1]:
        flag = 1
print('Yes' if Chk else 'No')

Submission status: Runtime Error

Solution code:
date = []
dict = {}
flag = 0
for i in range(3):
    temp = [int(j) for j in input().split()]
    date.append(temp)
N = int(input())

for i in  range(N):
    m = int(input())
    for j in date:
        if m in j:
            dict[m] = 1
index = list(dict.keys())

if dict[0][0] in index and dict[0][1] in index and dict[0][2] in index:
    flag = 1
if dict[1][0] in index and dict[1][1] in index and dict[1][2] in index:
    flag = 1
if dict[2][0] in index and dict[2][1] in index and dict[2][2] in index:
    flag = 1
if dict[0][0] in index and dict[1][0] in index and dict[2][0] in index:
    flag = 1
if dict[0][1] in index and dict[1][1] in index and dict[2][1] in index:
    flag = 1
if dict[0][2] in index and dict[1][2] in index and dict[2][2] in index:
    flag = 1
if dict[0][0] in index and dict[1][1] in index and dict[2][2] in index:
    flag = 1
if dict[2][0] in index and dict[1][1] in index and dict[0][2] in index:
    flag = 1
    
if flag == 1:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
def create_hole(A: List, b:List):

    N = len(A)
    Hole = [[0 for i in range(N)] for j in range(N)]
    for i in range(3):
        for j in range(3):
            for value in b:
                if A[i][j] == value: Hole[i][j] = 1

    return Hole


def check_bingo(H: List):

    N = len(H)
    rowsum = sum([sum(row) == N for row in H])
    colsum = sum([sum(row) == N for row in map(list, zip(*H))])
    digsum = sum([H[i][i] for i in range(N)]) == N
    tdigsum = sum([H[i][N-i-1] for i in range(N)]) == N

    return rowsum + colsum + digsum + tdigsum > 0


def resolve():

    A = [list(map(int, input().split())) for i in range(3)]
    N = int(input())
    b = [int(input()) for i in range(N)]
    print('Yes' if check_bingo(create_hole(A, b)) else 'No')
    
resolve()

Submission status: Runtime Error

Solution code:
from typing import List
from functools import reduce
from operator import add


def create_hole(A: List, b:List):

    N = len(A)
    Hole = [[0 for i in range(N)] for j in range(N)]
    for i in range(3):
        for j in range(3):
            for value in b:
                if A[i][j] == value: Hole[i][j] = 1

    return Hole


def check_bingo(H: List):

    N = len(H)
    rowsum = sum([sum(row) == N for row in H])
    colsum = sum([sum(row) == N for row in map(list, zip(*H))])
    digsum = sum([H[i][i] for i in range(N)]) == N
    tdigsum = sum([H[i][N-i-1] for i in range(N)]) == N

    return rowsum + colsum + digsum + tdigsum > 0


def resolve():

    A = [list(map(int, input().split())) for i in range(3)]
    N = int(input())
    b = [int(input()) for i in range(N)]
    print('Yes' if check_bingo(create_hole(A, b)) else 'No')
    
resolve()

Submission status: Runtime Error

Solution code:
from typing import List
from functools import reduce
from operator import add


def create_hole(A: List, b:List):

    N = len(A)
    Hole = [[0 for i in range(N)] for j in range(N)]
    for i in range(3):
        for j in range(3):
            for value in b:
                if A[i][j] == value: Hole[i][j] = 1

    return Hole


def check_bingo(H: List):

    N = len(H)
    rowsum = sum([sum(row) == N for row in H])
    colsum = sum([sum(row) == N for row in map(list, zip(*H))])
    digsum = sum([H[i][i] for i in range(N)]) == N
    tdigsum = sum([H[i][N-i-1] for i in range(N)]) == N

    return rowsum + colsum + digsum + tdigsum > 0


def resolve():

    A = [list(map(int, input().split())) for i in range(3)]
    N = int(input())
    b = [int(input()) for i in range(N)]
    print('Yes' if check_bingo(create_hole(A, b)) else 'No')

resolve()

Submission status: Runtime Error

Solution code:
card = []       #リスト型の変数カードを定義する。
for i in range(3):      #変数カードに三列のリスト型の数字を三行文加える。
    card.append(list(map(int,input().split())))

N = int(input())        #呼ばれる数字の数を指定する。

result = [[0,0,0],[0,0,0],[0,0,0]]      #変数resultを定義する。
for _ in range(N):      #以下の動作をN回繰り返す。
    b = int(input())        #数字を読み上げる。
    for i in range(3):      #bがAijと対応していた場合、変数resultのAijと同じ位置に1を代入する。
        for j in range(3):
            if b == card[i][j]:
                result[i][j] = 1

judge = "No"        #以下の条件に当てはまらなければNoと表示する

for i in range(3):      #横のビンゴの確認
    if result[i][0] * result[i][1] * result[i][2] == 1:
        judge = "Yes"

for i in range(3):      #縦のビンゴの確認
    if result[0][i] * result[1][i]*result[2][i] == 1:
        judge = "Yes"

if result[0][0] * result[1][1] * result[2][2] == 1:     #斜めのビンゴの確認
    judge = "Yes"

if result[0][2] * result[1][1] : result[2][1] == 1:     #斜めのビンゴの確認
    judge = "Yes"

print(judge)

Submission status: Runtime Error

Solution code:

a = list(list(map(int,input().split())) for _ in range(3))

N = int(input())

b = list(int(input()) for _ in range(N))


ax = [[0]*3]*3

for k in range(N):
    for i in range(3):
        for j in range(3):
            if a[i][j] == b[k]:ax[i][j]= 1


for i in range(3):
    xcnt = 0
    ycnt = 0
    for j in range(3):
        if ax[i][j] == 1:xcnt +=1
        if ax[j][i] == 1:ycnt +=1


xxcnt = 0
for i in range(3):
    if ax[i][i] == 1:xxcnt+=1

for i in range(3):
    if ax[3-i][i] == 1:xycnt+=1

for i in range(3):
    if ax[i][3-i] == 1:yxcnt+=1

if xcnt == 3 or ycnt == 3 or xxcnt == 3 or xycnt == 3 or yxcnt == 3:
    print("Yes")

else:
    print("No")

Submission status: Runtime Error

Solution code:
a,b,c = input().split()
d,e,f = input().split()
g,h,j = input().split()
N = input()
N = int(N)
l = []

for i in range(N):
    l.append(input())
for i in range(N):
    if a == l[i]:
        a = 'O'
for i in range(N):
    if b == l[i]:
        b = 'O'
for i in range(N):
    if c == l[i]:
        c = 'O'
for i in range(N):
    if d == l[i]:
        d = 'O'
for i in range(N):
    if e == l[i]:
        e = 'O'
for i in range(N):
    if f == l[i]:
        f = 'O'
for i in range(N):
    if g == l[i]:
        g = 'O'
for i in range(N):
    if h == l[i]:
        h = 'O'
for i in range(N):
    if j == l[i]:
        j = 'O'

if a == b and b == c:
    print('YES')
elif d == e and e == f:
    print('YES')
elif g == h and h == j:
    print('YES')
elif a == d and d == g:
    print(YES)
elif b == e and e == h:
    print('YES')
elif c == f and f == j:
    print('YES')
elif a == e and e == j:
    print('YES')
elif c == e and e == g:
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

Solution code:
a,b,c = input().split()
d,e,f = input().split()
g,h,j = input().split()
N = input()
N = int(N)
l = []

for i in range(N):
    l.append(input())
for i in range(N):
    if a == l[i]:
        a = 'O'
for i in range(N):
    if b == l[i]:
        b = 'O'
for i in range(N):
    if c == l[i]:
        c = 'O'
for i in range(N):
    if d == l[i]:
        d = 'O'
for i in range(N):
    if e == l[i]:
        e = 'O'
for i in range(N):
    if f == l[i]:
        f = 'O'
for i in range(N):
    if g == l[i]:
        g = 'O'
for i in range(N):
    if h == l[i]:
        h = 'O'
for i in range(N):
    if j == l[i]:
        j = 'O'

if a == b and b == c:
    print('YES')
elif d == e and e == f:
    print('YES')
elif g == h and h == j:
    print('YES')
elif a == d and d == g:
    print(YES)
elif b == e and e == h:
    print('YES')
elif c == f and f == j:
    print('YES')
elif a == e and e == j:
    print('YES')
elif c == e and e == g:
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

Solution code:
import sys

A = []

flag_First = True
for Count in range(3):
    for x in input().split(' '):
        x.strip('\n')
        InputValue = int(x)
        if 1<=int(x)<=100:
            if flag_First==True:
                A.append (InputValue)
                flag_First = False
            else:
                for Index in A:
                    if Index == InputValue:
                        sys.exit()

                A.append (InputValue)
        else:
            sys.exit()

N = int(input())
if N<=0 and N>10:
    sys.exit()

B = []
for Count in range(1,N+1):
    InputValue = int(input())
    if 1<=InputValue<=100:
        if Count == 1:
            B.append (InputValue)
        else:
            for Index in B:
                if Index == InputValue:
                    sys.exit()

            B.append (InputValue)

Bingo =[0,0,0,0,0,0,0,0,0]

for Item_B in B:
    for Index,Item_A in enumerate(A):
        if Item_A == Item_B:
            Bingo[Index]= 1

def CheckHorizontalBingo(Start,End):

    Flag_Bingo = True
    for Index,Item in enumerate(Bingo):
        if Start<=Index<=End:
            if Item == 0 :
                Flag_Bingo = False

    if Flag_Bingo == True:
        print(1,'YES')
        sys.exit()

CheckHorizontalBingo(0,1,2)
CheckHorizontalBingo(3,4,5)
CheckHorizontalBingo(6,7,8)

def CheckVerticalBingo(One,Two,There):

    Flag_Bingo = True
    for Index,Item in enumerate(Bingo):
        if Index==One or Index==Two or Index==There:
            if Item == 0 :
                Flag_Bingo = False

    if Flag_Bingo == True:
        print('YES')
        sys.exit()

CheckVerticalBingo(0,3,6)
CheckVerticalBingo(1,4,7)
CheckVerticalBingo(2,5,8)

def CheckDiagonalBingo(One,Two,There):

    Flag_Bingo = True
    for Index,Item in enumerate(Bingo):
        if Index==One or Index==Two or Index==There:
            if Item == 0 :
                Flag_Bingo = False

    if Flag_Bingo == True:
        print('YES')
        sys.exit()

CheckDiagonalBingo(0,4,8)
CheckDiagonalBingo(3,5,7)

print('No')

Submission status: Runtime Error

Solution code:
a

Submission status: Runtime Error

Solution code:
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
N= [int(input()) for i in range(N)]
if (p in N) or (q in N) or (r in N):
  print("Yes")
elif (p[0] in N) and (q[0] in N) and (r[0] in N):
  print("Yes")
elif (p[1] in N) and (q[1] in N) and (r[1] in N):
  print("Yes")
elif (p[2] in N) and (q[2] in N) and (r[2] in N):
  print("Yes")
elif (p[0] in N) and (q[1] in N) and (r[2] in N):
  print("Yes")
elif (p[2] in N) and (q[1] in N) and (r[0] in N):
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
N=list(map(int,input().split(\n)))
if (p in N) or (q in N) or (r in N):
  print("Yes")
elif (p[0] in N) and (q[0] in N) and (r[0] in N):
  print("Yes")
elif (p[1] in N) and (q[1] in N) and (r[1] in N):
  print("Yes")
elif (p[2] in N) and (q[2] in N) and (r[2] in N):
  print("Yes")
elif (p[0] in N) and (q[1] in N) and (r[2] in N):
  print("Yes")
elif (p[2] in N) and (q[1] in N) and (r[0] in N):
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
N = int(input()) 
s = [int(input()) for i in range(N)] 

for nu in range(len(s)):
	for i in range(3):
		for j in range(3):
			if a[i][j] == s[nu]:
				a[i][j] = 0
#縦横斜めチェック
for r in range(3):
	if a[i][0]==a[i][1]==a[i][2]==0:
		print('Yes')
		exit()
	if a[0][i]==a[1][i]==a[2][i]==0:
		print('Yes')
		exit()

if a[0][0]==a[1][1]==a[2][2]==0	or a[0][2]==a[1][1]==a[2][0]==0:	
		print('Yes')
		exit() 
print('No')

Submission status: Runtime Error

Solution code:
A = [list(map(int,input().split())) for i in range(3)]
A_flat=[]
for i in range(len(A)):
    A_flat.append(A[i][0])
    A_flat.append(A[i][1])
    A_flat.append(A[i][2])

N = int(input())
b = [int(input()) for i in range(N)]
for i in range(len(b)):
    if b[i] in A_flat:
        index = A_flat.index(b[i])
        A_flat[index] = 0

 judge=False
for i in range(3):
    if A_flat[0+i] == A_flat[3+i] == A_flat[6+i]:
        print("Yes")
        judge = True
        break
    elif A_flat[0+i*3]==A_flat[1+i*3]==A_flat[2+i*3]:
        print("Yes")
        judge = True
        break
    elif A_flat[0]==A_flat[4]==A_flat[8] or A_flat[2]==A_flat[4]==A_flat[6]:
        print("Yes")
        judge = True
        break

if judge is False:
    print("No")