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:
Array = [list(map(int,input().split())) for _ in range(3)]
ArrayBingo = [[0,0,0],[0,0,0,],[0,0,0]]
N = int(input())
B = []
checkR = 0
checkG = 0
checkN = 0
for i in range (N):
    B.append(int(input()))
for l in range (N):
    for j in range (3):
        for k in range (3):
            if Array[j][k]==B[l]:
                ArrayBingo[j][k]=1
for i in range (3): 
    if (ArrayBingo[i][0] == 1):
        checkR+=1
if checkR ==3:
    print('Yes')
    checkR=4
    if checkR !=4:
        checkR=0
for i in range (3): 
    if (ArrayBingo[i][1] == 1):
        checkR+=1
if checkR ==3:
    print('Yes')
    checkR=4
if checkR!=4    
    checkR=0
for i in range (3): 
    if (ArrayBingo[i][2] == 1):
        checkR+=1
if checkR ==3:
    print('Yes')
    checkR =4
else:
    checkR=0
for j in range (3):
    if (ArrayBingo[0][j] == 1):
        checkG+=1
if checkG ==3:
    print('Yes')
    checkG =4
if checkG !=4:
    checkG=0
for j in range (3):
    if (ArrayBingo[1][j] == 1):
        checkG+=1
if checkG ==3:
    print('Yes')
    checkG =4
if checkG !=4:
    checkG=0
for j in range (3):    
    if (ArrayBingo[2][j] == 1):
        checkG+=1
if checkG ==3:
    print('Yes')
    checkG =4
else:
    checkG=0
if (ArrayBingo[0][0] == 1 and ArrayBingo[1][1] == 1 and ArrayBingo [2][2] == 1) or (ArrayBingo[0][2] == 1 and ArrayBingo[1][1] == 1 and ArrayBingo [2][0] == 1):
    checkN = 1
else:
    checkN = 0
if checkR != 4 and checkG !=4 and checkN==1:
    print('Yes')
if checkR == 0 and checkG ==0 and checkN==0:
    print('No')

Submission status: Runtime Error

Solution code:
Array = [list(map(int,input().split())) for _ in range(3)]
ArrayBingo = [[0,0,0],[0,0,0,],[0,0,0]]
N = int(input())
B = []
checkR = 0
checkG = 0
checkN = 0
for i in range (N):
    B.append(int(input()))
for l in range (N):
    for j in range (3):
        for k in range (3):
            if Array[j][k]==B[l]:
                ArrayBingo[j][k]=1
for i in range (3): 
    if (ArrayBingo[i][0] == 1):
        checkR+=1
if checkG ==3:
    print(Yes)
checkR=0
for i in range (3): 
    if (ArrayBingo[i][1] == 1):
        checkR+=1
if checkG ==3:
    print(Yes)
checkR=0
for i in range (3): 
    if (ArrayBingo[i][2] == 1):
        checkR+=1
if checkG ==3:
    print(Yes)
else:
    checkR=0
for j in range (3):
    if (ArrayBingo[0][j] == 1):
        checkG+=1
if checkG ==3:
    print(Yes)
checkG=0
for j in range (3):
    if (ArrayBingo[1][j] == 1):
        checkG+=1
if checkG ==3:
    print(Yes)
checkG=0
for j in range (3):    
    if (ArrayBingo[2][j] == 1):
        checkG+=1
if checkG ==3:
    print(Yes)
else:
    checkG=0
if (ArrayBingo[0][0] == 1 and ArrayBingo[1][1] == 1 and ArrayBingo [2][2] == 1) or (ArrayBingo[0][2] == 1 and ArrayBingo[1][1] == 1 and ArrayBingo [2][0] == 1):
    checkN = 1
else:
    checkN = 0
if checkN == 1:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
Array = [list(map(int,input().split())) for _ in range(3)]
ArrayBingo = [[0,0,0],[0,0,0,],[0,0,0]]
N = int(input())
B = []
checkR = 0
checkG = 0
checkN = 0
for i in range (N):
    B.append(int(input()))
for l in range (N):
    for j in range (3):
        for k in range (3):
            if Array[j][k]==B[l]:
                ArrayBingo[j][k]=1
for i in range (3): 
    if (ArrayBingo[i][0] == 1):
        checkR+=1
if checkG ==3:
    print(Yes)
checkR=0
for i in range (3): 
    if (ArrayBingo[i][1] == 1):
        checkR+=1
if checkG ==3:
    print(Yes)
checkR=0
for i in range (3): 
    if (ArrayBingo[i][2] == 1):
        checkR+=1
if checkG ==3:
    print(Yes)
    else:
        checkR=0
for j in range (3):
    if (ArrayBingo[0][j] == 1):
        checkG+=1
if checkG ==3:
    print(Yes)
checkG=0
for j in range (3):
    if (ArrayBingo[1][j] == 1):
        checkG+=1
if checkG ==3:
    print(Yes)
checkG=0
for j in range (3):    
    if (ArrayBingo[2][j] == 1):
        checkG+=1
if checkG ==3:
    print(Yes)
    else:
        checkG=0
if (ArrayBingo[0][0] == 1 and ArrayBingo[1][1] == 1 and ArrayBingo [2][2] == 1) or (ArrayBingo[0][2] == 1 and ArrayBingo[1][1] == 1 and ArrayBingo [2][0] == 1):
    checkN = 1
else:
    checkN = 0
if checkN == 1:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
Array = [list(map(int,input().split())) for _ in range(3)]
ArrayBingo = [[0,0,0],[0,0,0,],[0,0,0]]
N = int(input())
B = []
checkR = 0
checkG = 0
checkN = 0
for i in range (N):
    B.append(int(input()))
for l in range (N):
    for j in range (3):
        for k in range (3):
            if Array[j][k]==B[l]:
                ArrayBingo[j][k]=1
i=0
for i in range (3): 
    if ArrayBingo[i][0] == 1 and ArrayBingo[i][1] == 1 and ArrayBingo[i][2] == 1:
        checkR=1
    else:
        checkR=0
j=0
for j in range (3):
    if ArrayBingo[0][j] == 1 and ArrayBingo[1][j] == 1 and ArrayBingo[2][j] == 1:
        checkG=1
    else:
        checkG=0
if (ArrayBingo[0][0] == 1 and ArrayBingo[1][1] == 1 and ArrayBingo [2][2] == 1) or (ArrayBingo[0][2] == 1 and ArrayBingo[1][1] == 1 and ArrayBingo [2][0] == 1):
    checkN = 1
else:
    checkN = 0
if checkR==1:
    print('Yes')
    break
elif checkG == 1:
    print('Yes')
    break
elif checkN == 1:
    print('Yes')
    break
else:
    print('No')

Submission status: Runtime Error

Solution code:
Array = [list(map(str,input().split())) for _ in range(3)]
ArrayBingo = [[0,0,0][0,0,0,][0,0,0]]
N = int(input())
B = []
checkR = 0
checkG = 0
checkN = 0
for i in range (N):
    B.append(int(input()))
for j in range (3):
    for k in range (3):
        for l in range (N):
            if Array[j][k]==B[l]:
                ArrayBingo[j][k]=1
for i in range (3): 
    if [line[i] for line in ArrayBingo] != [1,1,1]:
        checkR=0
    else:
        checkR=1
for i in range (3):
    if [row[i] for row in ArrayBingo] != [1,1,1]:
        checkG=0
    else:
        checkG=1
if (ArrayBingo[1][1] == 1 and ArrayBingo[2][2] == 1 and ArrayBingo [3][3] == 1) or (ArrayBingo[1][3] == 1 and ArrayBingo[2][2] == 1 and ArrayBingo [3][1] == 1):
    checkN = 1
else:
    checkN = 0
if checkR==1 or checkG == 1 or checkN == 1:
    print(Yes)
else:
    print(No)

Submission status: Runtime Error

Solution code:
A1 = [list(map(int,input().split())) for i in range (3)]
A2 = [list(map(int,input().split())) for i in range (3)]
A3 = [list(map(int,input().split())) for i in range (3)]
A = A1 + A2 + A3
N = int(input())
b = t = []
i = j = 0

while i != N-1:
    b.append(int(input()))
    i = i + 1

while j != 9:
    if A[j] == b[j]:
        t.append(ture)
    else:
        t.append(false)
    j = j + 1

if t[0] == t[1] == t[2] == ture:
    print(Yes)
elif t[3] == t[4] == t[5] == ture:
    print(Yes)
elif t[6] == t[7] == t[8] == ture:
    print(Yes)
elif t[0] == t[3] == t[6] == ture:
    print(Yes)
elif t[1] == t[4] == t[7] == ture:
    print(Yes)
elif t[2] == t[5] == t[8] == ture:
    print(Yes)
elif t[0] == t[4] == t[8] == ture:
    print(Yes)
elif t[2] == t[4] == t[6] == ture:
    print(Yes)
else:
    print(No)

Submission status: Runtime Error

Solution code:
loopin=input()

bingolist = []



A11,A12,A13,A21,A22,A23,A31,A32,A33=0,0,0,0,0,0,0,0,0


for i in range(int(loopin)):
	bingo = input()
	if bingo==a:
		A11=1
	elif bingo==b:
		A12=1	
	elif bingo==c:
		A13=1	
	elif bingo==d:
		A21=1	
	elif bingo==e:
		A22=1	
	elif bingo==f:
		A23=1	
	elif bingo==g:
		A31=1	
	elif bingo==h:
		A32=1	
	elif bingo==i:
		A33=1	

if (A11+A12+A13)==3:
	print("Yes")
elif (A21+A22+A23)==3:
	print("Yes")
elif (A31+A32+A33)==3:
	print("Yes")
elif (A11+A22+A33)==3:
	print("Yes")
elif (A13+A22+A31)==3:
	print("Yes")
else:
	print("No")

Submission status: Runtime Error

Solution code:
A=[]
for i in range(3):
    A.append(list(map(int,input().split())))
N=int(input())
for i in range(N):
    b=int(input())
    for j in range(3):
        for k in range(3):
            if A[j][k]==b:
                A[j][k]=0
 
flag=False
for i in range(3):
    if A[i][:]==[0,0,0]:
        flag=True
    elif A[0][i]==0 and A[1][i]==0 and A[2][i]==0:
        flag=True
    elif A[1][1]==0 and A[0][2]==0 and A[2][0]==0:
        flag=True
    else A[0][0]==0 and A[1][1]==0 and A[2][2]==0:
        flag=True
if flag:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
import itertools

A=[]
for i in range(3):
    try:
        A.append(list(map(int,input().split())))
    except:
        break;
A = list(itertools.chain.from_iterable(A))
n = int(input())
b=[int(input()) for i in range(n)]

for i in b:
    if i in A:
        
#print(A)
#print(b)

Submission status: Runtime Error

Solution code:
import math

A = [int(a) for _ in range(3) for a in input().split()]
punched = [False] * 9
num_to_i = {a:i for i, a in enumerate(A)}
N = int(input())
B = [int(input()) for _ in range(N)]

for b in B:
  if b in num_to_i:
    punched[num_to_i[b]] = True

# 縦
for i in range(3):
  if punched[i] and punched[i+3] and punched[i+6]:
    print("Yes")
    quit()

# 横
for i in range(3):
  if punched[i*3] and punched[i*3+1] and punched[i*3+3]:
    print("Yes")
    quit()

# 斜め
if (punched[0] and punched[4] and punched[8]) or (punched[2] and punched[4] and punched[6]):
  print("Yes")
  quit()
  
print("No")

Submission status: Runtime Error

Solution code:
#ABC157.B
A = list(input().split()for l in range(3))
N = int(input())
b = [int(input())for _ in range(N)]
for i in b:
    if i in A:
        A[A.index(i)]=0
if A[0]==0 and A[1]==0 and A[2]==0:
    print('Yes')
elif A[3]==0 and A[4]==0 and A[5]==0:
    print('Yes')
elif A[6]==0 and A[7]==0 and A[8]==0:
    print('Yes')

elif A[0]==0 and A[3]==0 and A[6]==0:
    print('Yes')
elif A[1]==0 and A[4]==0 and A[7]==0:
    print('Yes')
elif A[2]==0 and A[5]==0 and A[8]==0:
    print('Yes')

elif A[0]==0 and A[4]==0 and A[8]==0:
    print('Yes')
elif A[2]==0 and A[4]==0 and A[6]==0:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
#ABC157.B
A = list(map(int,input().split()))
N = int(input())
b = [int(input())for _ in range(N)]
for i in b:
    if i in A:
        A[A.index(i)]=0
if A[0]==0 and A[1]==0 and A[2]==0:
    print('Yes')
elif A[3]==0 and A[4]==0 and A[5]==0:
    print('Yes')
elif A[6]==0 and A[7]==0 and A[8]==0:
    print('Yes')

elif A[0]==0 and A[3]==0 and A[6]==0:
    print('Yes')
elif A[1]==0 and A[4]==0 and A[7]==0:
    print('Yes')
elif A[2]==0 and A[5]==0 and A[8]==0:
    print('Yes')

elif A[0]==0 and A[4]==0 and A[8]==0:
    print('Yes')
elif A[2]==0 and A[4]==0 and A[6]==0:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
b = [int(input()) for _ in range(N)]
B = [[0,0,0],[0,0,0],[0,0,0]]

ans = 'No'
for i, row in enumerate(A):
    for j, value in enumerate(row):
        if value in b:
            B[i][j] = 1

if aB[0][0]==B[0][1]==B[0][2]==1 or B[1][0]==B[1][1]==B[1][2]==1 or B[2][0]==B[2][1]==B[2][2]==1:
    ans = 'Yes'
elif B[0][0]==B[1][0]==B[2][0]==1 or B[0][1]==B[1][1]==B[2][1]==1 or B[0][2]==B[1][2]==B[2][2]==1:
    ans = 'Yes'
elif B[0][0]==B[1][1]==B[2][2]==1 or B[2][2]==B[1][1]==B[2][0]==1:
    ans = 'Yes'
print(ans)

Submission status: Runtime Error

Solution code:
#ABC157.B
A = list(map(int,input().split()))
N = int(input())
b = list(map(int,input().split()))

for i in b:
    if i in A:
        A[A.index(i)]=0
if A[0]==0 and A[1]==0 and A[2]==0:
    print('Yes')
elif A[3]==0 and A[4]==0 and A[5]==0:
    print('Yes')
elif A[6]==0 and A[7]==0 and A[8]==0:
    print('Yes')

elif A[0]==0 and A[3]==0 and A[6]==0:
    print('Yes')
elif A[1]==0 and A[4]==0 and A[7]==0:
    print('Yes')
elif A[2]==0 and A[5]==0 and A[8]==0:
    print('Yes')

elif A[0]==0 and A[4]==0 and A[8]==0:
    print('Yes')
elif A[2]==0 and A[4]==0 and A[6]==0:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
#ABC159.B
A = list(map(int,input().split()))
N = int(input())
b = list(map(int,input().split()))

for i in b:
    if i in A:
        A[A.index(i)]=0
if A[0]==0 and A[1]==0 and A[2]==0:
    print('Yes')
elif A[3]==0 and A[4]==0 and A[5]==0:
    print('Yes')
elif A[6]==0 and A[7]==0 and A[8]==0:
    print('Yes')

elif A[0]==0 and A[3]==0 and A[6]==0:
    print('Yes')
elif A[1]==0 and A[4]==0 and A[7]==0:
    print('Yes')
elif A[2]==0 and A[5]==0 and A[8]==0:
    print('Yes')

elif A[0]==0 and A[4]==0 and A[8]==0:
    print('Yes')
elif A[2]==0 and A[4]==0 and A[6]==0:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
import numpy as np


A = [list(map(int, input().split())) for _ in range(3)]
A = np.array(A)
N = int(input())
b = [int(input()) for _ in range(N)]
b = np.array(b)
B = np.full([3,3], False)
for item in b:
    B |= A == item
#print(B)

if(np.any(np.all(B[0])|np.all(B[1])|np.all(B[2])|np.all(B[:,0])|np.all(B[:,1])|np.all(B[:,2])|(B[0,0]==B[1,1]==B[2,2]==True)|(B[0,2]==B[1,1]==B[2,0]==True))):
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
import numpy as np


A = [list(map(int, input().split())) for _ in range(3)]
A = np.array(A)
N = int(input())
b = [int(input()) for _ in range(N)]
b = np.array(b)
B = np.full([3,3], False)
for item in b:
    B |= A == item
#print(B)

if(np.any(np.all(B[0])|np.all(B[1])|np.all(B[2])|np.all(B[:,0])\
          |np.all(B[:,1])|np.all(B[:,2])\
          |(B[0,0]==B[1,1]==B[2,2]==True)|(B[0,2]==B[1,1]==B[2,0]==True))):
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
A1=input().split(" ")
A2=input().split(" ")
A3=input().split(" ")
N=int(input())
B=[input() for _ in range(N)]

A=A1+A2+A3
for i in range(3):
    for j in range(3):
        for k in range(N):
            if B[k]==A[i][j]:
                A[i][j]=="OK"

for i in range(3):
    if A[i][1]==A[i][2]==A[i][3]:
        print("Yes")
    elif A[1][i]==A[2][i]==A[3][i]:
        print("Yes")
    elif A[1][1]==A[2][2]==A[3][3]:
        print("Yes")
    elif A[1][3]==A[2][2]==A[3][1]:
        print("Yes")
    else:
        print("No")

Submission status: Runtime Error

Solution code:
import numpy as np

sheet=[input().split() for l in range(3)]
n=int(input())
b=[input() for i in range(n)]
a=np.array(sheet)
c=0

for i in range(3):
    for j in range(3):
        for k in range(n):
            if a[i][j]==b[k]:
                a[i][j]="x"


if a[0][0]==a[1][1]==a[2][2]="x":
    c+=1

if a[0][2]==a[1][1]==a[2][0]="x":
    c+=1

for z in range(3):
    if a[0][z]==a[1][z]==a[2][z]="x":
        c+=1

if c!=0:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
list = []
for i in range(3):
	tmp = input().split()
    list.append(tmp)
n = int(input())
for i in range(n):
  tmp = int(input())
  loop_break = False
  for j in range(3):
    for k in range(3):
      if list[j][k] == tmp:
        list[j][k] = 0
        loop_break = True
        break
    if loop_break == True:
      break
for i in range(3):
  if list[i][0] == 0:
	if list[i][0] == list[i][1] and list[i][1] == list[i][2]:
	  print('Yes')
	  quit()
  if list[0][i] == 0:
    if list[0][i] == list[1][i] and list[1][i] == list[2][i]:
      print('Yes')
      quit()
if list[1][1] == 0:
  if list[0][0] == 0 and list[2][2] == 0:
    print('Yes')
    quit()
  if list[0][2] == 0 and list[2][0] == 0:
    print('Yes')
    quit()
print('No')

Submission status: Runtime Error

Solution code:
import sys
import math
from io import StringIO


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

table = [int(s) for s in input().split()]
table += [int(s) for s in input().split()]
table += [int(s) for s in input().split()]

lis = [int(input()) for _ in range(int(input()))]

ans = [ n in lis for n in table ]

for line in lines:
  valid = True
  for num in line:
    if not ans[num] :
      valid = False
      break

      if valid:
        print('Yes')
        return

      print('No')

Submission status: Runtime Error

Solution code:

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

table = [int(s) for s in input().split()]
table += [int(s) for s in input().split()]
table += [int(s) for s in input().split()]

lis = [int(input()) for _ in range(int(input()))]

ans = [ n in lis for n in table ]

for line in lines:
  valid = True
  for num in line:
    if not ans[num] :
      valid = False
      break

      if valid:
        print('Yes')
        return

      print('No')

Submission status: Runtime Error

Solution code:
A=[list(map(int,input().split())) for i in range(3)]
n=int(input())

for i in range(n):
  o=int(input())
  for x in range(3):
    for y in range(3):
      if o == A[x][y]:
        A[x][y]=-1
for x in range(3):
  if A[x][0]==-1:
    f=True
    for y in range(3):
      if A[x][y]!=-1:
        f=False
    if f:
      print('Yes')
      exit()
for y in range(3):
  if A[0][y] == -1:
    f=True
    for x in range(3):
      if A[y][[x] != -1:
        f=False
    if f:
      print('Yes')
      exit()
f=True
for i in range(3):
  if A[i][i]!=-1:
    f=False
if f:
  print('Yes')
f=True
for i in range(1,3):
  if A[-i][-i]!=-1:
    f=False
if f:
  print('Yes')

Submission status: Runtime Error

Solution code:
A=[list(map(int,input().split())) for i in range(3)]
n=int(input())

for i in range(n):
  o=int(input())
  for x in range(3):
    for y in range(3):
      if o == A[x][y]:
        A[x][y]=-1
for x in range(3):
  if A[x][0]==-1:
    f=True
    for y in range(3):
      if A[x][y]!=-1:
        f=False
    if f:
      print('Yes')
      exit()
for y in range(3):
  if A[0][y] == -1:
    f=True
    for x in range(3):
      if A[y][[x] != -1:
        f=False
    if f:
      print('Yes')
      exit()
f=True
for i in range(3):
  if A[i][i]!=-1:
    f=False
if f:
  print('Yes')
f=True
for i in range(1,3):
  if A[-i][-i]!=-1:
    f=False
if f:
  print('Yes')

Submission status: Runtime Error

Solution code:
s = 3
arr =[]
for _ in range(s):
        arr.append(list(map(int, input().rstrip().split())))
#print(arr)
 
check = [[0,0,0],[0,0,0],[0,0,0]]
#print(check)
 
#check データ
N = int(input())
#print(N)
 
for i in range(N):
    data = int(input())
    for k in range(3):
        for j in range(3):
            if data == arr[j][k]:
                check[j][k]= 1
#print(check)
 
#chek ビンゴ
answer = "No"
for k in range(3):
    if check[k][0] == 1 and check[k][1]== 1 and check[k][2] == 1:
        answer = "Yes"
 
for j in range(3):
    if check[0][j] == 1 and check[1][j] == 1 and check[2][j] == 1:
        answer = "Yes"
 
if check[0][0] == 1 and check[1][1] == 1 and check[2][2] == 1:
    answer = "Yes"
 
if check[0][2] == 1 and check[1][1] == 1 and check[2][0] == 1:
    answer = "Yes"
 
 
print(answer)
s = 3
arr =[]
for _ in range(s):
        arr.append(list(map(int, input().rstrip().split())))
print(arr)

check = [[0,0,0],[0,0,0],[0,0,0]]
#print(check)

#check データ
N = int(input())
#print(N)

for i in range(N):
    data = int(input())
    for k in range(3):
        for j in range(3):
            if data == arr[j][k]:
                check[j][k]= 1
#print(check)

#chek ビンゴ
answer = "No"
for k in range(3):
    if check[k][0] == 1 and check[k][1]== 1 and check[k][2] == 1:
        answer = "Yes"

for j in range(3):
    if check[0][j] == 1 and check[1][j] == 1 and check[2][j] == 1:
        answer = "Yes"

if check[0][0] == 1 and check[1][1] == 1 and check[2][2] == 1:
    answer = "Yes"

if check[0][2] == 1 and check[1][1] == 1 and check[2][0] == 1:
    answer = "Yes"


print(answer)
提出情報

Submission status: Runtime Error

Solution code:
    mop = [list(map(int, inp.split())) for inp in open(0)]
    a = [mop[0], mop[1], mop[2]]
    n = int(mop[3][0])
    b = []
    for i in range(n):
      b.append(int(mop[4 + i][0]))
      for j in range(3):
        for k in range(3):
          if a[j][k] == b[i]:
            a[j][k] = -1
    ree = 'No'
    for i in range(3):
      if a[0][i] == a[1][i] == a[2][i] == -1:
        ree = 'Yes'
      if a[i][0] == a[i][1] == a[i][2] == -1:
        ree = 'Yes'
    if a[0][0] == a[1][1] == a[2][2] == -1:
      ree = 'Yes'
    if a[2][0] == a[1][1] == a[0][2] == -1:
      ree = 'Yes'
    print(ree)

Submission status: Runtime Error

Solution code:
A1 = list(map(int,input().split()))
A2 = list(map(int,input().split()))
A3 = list(map(int,input().split()))
A = A1 + A2 + A3
N = int(input())
for i in range(N):
  B = int(input())
  if B == A[i]:
    A[i] == 'AC'
if A[0] == A[1] == A[2] == 'AC' or A[3] == A[4] == A[5] == 'AC' or A[6] == A[7] == A[8] == 'AC':
  print('Yes')
elif A[0] == A[3] == A[6] == 'AC' or A[1] == A[4] == A[7] == 'AC' or A[2] == A[5] == A[8] == 'AC':
  print('Yes')
elif A[0] == A[4] == A[8] == 'AC' or A[2] == A[4] == A[6] == 'AC':
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
    data_list = [list(map(int, input().split())) for _ in range(3)]
    N = int(input())
    bingo_list = [int(input()) for _ in range(N)]
    mark = [[False, False, False] for _ in range(3)]
    for i in range(3):
        for j in range(3):
            if data_list[i][j] in bingo_list:
                mark[i][j] = True
    ans = "No"
    for i in range(3):
        if all(mark[i]):
            ans = "Yes"
            break
    for j in range(3):
        if mark[0][j] and mark[1][j] and mark[2][j]:
            ans = "Yes"
            break
    if (mark[0][0] and mark[1][1] and mark[2][2]) or (mark[2][0] and mark[1][1] and mark[0][2]) :
        ans = "Yes"
    print(ans)

Submission status: Runtime Error

Solution code:
    op = [list(map(int, inp.split())) for inp in open(0)]
    a = [op[0], op[1], op[2]]
    n = int(op[3][0])
    b = []
    for i in range(n):
      b.append(int(op[4 + i][0]))
      for j in range(3):
        for k in range(3):
          if a[j][k] == b[i]:
            a[j][k] = -1
    res = 'No'
    for i in range(3):
      if a[0][i] == a[1][i] == a[2][i] == -1:
        res = 'Yes'
      if a[i][0] == a[i][1] == a[i][2] == -1:
        res = 'Yes'
    if a[0][0] == a[1][1] == a[2][2] == -1:
      res = 'Yes'
    if a[2][0] == a[1][1] == a[0][2] == -1:
      res = 'Yes'
    print(res)

Submission status: Runtime Error

Solution code:
row1=list(map(int,input().split()))
row2=list(map(int,input().split()))
row3=list(map(int,input().split()))
bingo=row1+row2+row3
num=int(input())
num_list=set()
for i in range(num):
  num_list.add(int(input()))

bingo_list=[[0,3,6],[1,4,7],[2,5,8],[0,1,2],[3,4,5],[6,7,8],[0,4,8],[2,4,6]]
num_list=list(num_list)
for i in num_list:
  if i in bingo:
    bingo[bingo.index(i)] = True

for i in bingo_list:
  if bingo[i[0]] ==True and bingo[i[1]] == True and bingo[i[2]] == True:
    print('Yes')
    return 0

print('No')

Submission status: Runtime Error

Solution code:
row1=list(map(int,input().split()))
row2=list(map(int,input().split()))
row3=list(map(int,input().split()))
bingo=row1+row2+row3
num=int(input())
num_list=set()
for i in range(num):
  num_list.add(int(input()))

bingo_list=[[0,3,6],[1,4,7],[2,5,8],[0,1,2],[3,4,5],[6,7,8],[0,4,8],[2,4,6]]
num_list=list(num_list)
for i in num_list:
  if i in bingo:
    bingo[bingo.index(i)] = True

for i in bingo_list:
  if bingo[i[0]] is True and bingo[i[1]] is True and bingo[i[2]] is True:
    print('Yes')
    return 0

print('No')

Submission status: Runtime Error

Solution code:
row1=list(map(int,input().split()))
row2=list(map(int,input().split()))
row3=list(map(int,input().split()))
bingo=row1+row2+row3
num=int(input())
num_list=set()
for i in range(num):
  num_list.add(int(input()))

bingo_list=[[0,3,6],[1,4,7],[2,5,8],[0,1,2],[3,4,5],[6,7,8],[0,4,8],[2,4,6]]
  
for i in num_list:
  if i in bingo:
    bingo[bingo.index(i)] = True

for i in bingo_list:
  if bingo[i[0]] is True and bingo[i[1]] is True and bingo[i[2]] is True:
    print('Yes')
    return 0

print('No')

Submission status: Runtime Error

Solution code:
row1=list(map(int,input().split()))
row2=list(map(int,input().split()))
row3=list(map(int,input().split()))
bingo=row1+row2+row3
num=int(input())
num_list={}
for i in range(num):
  num_list.add(int(input()))

bingo_list=[[0,3,6],[1,4,7],[2,5,8],[0,1,2],[3,4,5],[6,7,8],[0,4,8],[2,4,6]]
  
for i in num_list:
  if i in bingo:
    bingo[bingo.index(i)] = True

for i in bingo_list:
  if bingo[i[0]] is True and bingo[i[1]] is True and bingo[i[2]] is True:
    print('Yes')
    return 0

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())
numbers = list()
for i in range(N):
    numbers.append(int(input()))

bingo = False
for a in A:
    if a not in numbers:
        break
else:
    bingo = True

for b in B:
    if b not in numbers:
        break
else:
    bingo = True

for c in C:
    if c not in numbers:
        break
else:
    bingo = True

columnA = [A[0],B[0],C[0]]
for i in columnA:
    if i not in numbers:
        break
else:
    bingo = True

columnB = [A[1],B[1],C[1]]
for i in columnB:
    if i not in numbers:
        break
else:
    bingo = True

columnC = [A[2],B[2],C[2]]
for i in columnB:
    if i not in numbers:
        break
else:
    bingo = True

diagA = [A[0],B[1],C[2]]
for i in diagA:
    if i not in numbers:
        break
else:
    bingo = True

diagB = [A[3],B[2],C[1]]
for i in diagB:
    if i not in numbers:
        break
else:
    bingo = True

print("Yes" if bingo else "No")

Submission status: Runtime Error

Solution code:
a=[]
for i in range (2):
  for j in range(2):
    a.append(int(input()))
N=int(input())
for i in range(N):
  b[i]=int(input())
  
for i in range(2):
  for j in range(2):
    for k in range(N):
      if a[i][j]==b[k]:
        a[i][j]=1
      else:
        a[i][j]=0
        
if a[0][0]=1 and a[0][1]=1 and a[0][2]=1:
  print("Yes")
elif a[1][0]=1 and a[1][1]=1 and a[1][2]=1:
  print("Yes")
elif a[2][0]=1 and a[2][1]=1 and a[2][2]=1:
  print("Yes")
elif a[0][0]=1 and a[1][0]=1 and a[2][0]=1:
  print("Yes")
elif a[0][1]=1 and a[1][1]=1 and a[2][1]=1:
  print("Yes")
elif a[0][2]=1 and a[1][2]=1 and a[2][2]=1:
  print("Yes")
elif a[0][0]=1 and a[1][1]=1 and a[2][2]=1:
  print("Yes")
elif a[0][2]=1 and a[1][1]=1 and a[2][0]=1:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
A1 = [int(_) for _ in input().split()]
A2 = [int(_) for _ in input().split()]
A3 = [int(_) for _ in input().split()]
N = int(input())
P1 = [0, 0, 0]
P2 = [0, 0, 0]
P3 = [0, 0, 0]
for i in range(0, N):
    b = int(input())
    if A1.count(b) == 1:
        P1[A1.index(b)] = 1
    elif A2.count(b) == 1:
        P2[A2.index(b)] = 1
    elif A3.count(b) == 1:
        P3[A3.index(b)] = 1
if sum(P1) == 3:
    print("Yes")
    exit(1)
elif sum(P2) == 3:
    print("Yes")
    exit(1)
elif sum(P3) == 3:
    print("Yes")
    exit(1)

for i in range(0,2):
    if P1[i] + P2[i] + P3[i] == 3:
        print("Yes")
        exit(1)

a = P1[0]

if P1[0] + P2[1] + P3[2] == 3:
    print("Yes")
    exit(1)

if P1[2] + P2[1] + P3[0] == 3:
    print("Yes")
    exit(1)

print(("No"))

Submission status: Runtime Error

Solution code:
a=input()
(n,m)=a.split(" ")
n=int(n)
m=int(m)
print(n)

Submission status: Runtime Error

Solution code:
import numpy as np

A = np.empty(9)
b = np.empty(10)
place = ''

for i in range(0,7,3):
  A[i], A[i+1], A[i+2] = map(int,input().split())

N = int(input())

for n in range(N):
  b[n] = int(input())
  for j in range(9):
  	if b[n] == A[j]:
  		place = place + ' ' + str(j)

for i in range(0,7,3):
  if str(i) and str(i+1) and str(i+2) in place:
  	ans = 'Yes'

for i in range(3)	
  if str(i) and str(i+3) and str(i+6) in place:
  	ans = 'Yes'

if '0' and '4' and '8' in place:
	ans = 'Yes'
if '2' and '4' and '6' in place:
	ans = 'Yes'
else:
	ans = 'No'
print(ans)

Submission status: Runtime Error

Solution code:
a=[0]*3
a[0]=[0]*3
a[1]=[0]*3
a[2]=[0]*3
for i in range(3):
 for j in range(3):
  a[i][j]=int(input())
N=int(input())
b=[0]*N
for k in range(N):
 b[k]=int(input())

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

c=1
for i in range(3):
 if a[i][0]==a[i][1]==a[i][2]:c=0
 elif a[0][i]==a[1][i]==a[2][i]:c=0

if a[0][0]==a[1][1]==a[2][2]:c=0

if c==0:print("Yes")
else:print("No")

Submission status: Runtime Error

Solution code:
B=[];bingo=0
import numpy as np
A=np.zeros((3,3),dtype=int)
for i in range(3):
  a,b,c=map(int,input().split())
  A[i][0]=a
  A[i][1]=b
  A[i][2]=c
N=int(input())
for i in range(N):
  B.append(int(input()))
#print(A)
#print(B)
for i in range(3):
  for j in range(3):
    for k in range(N):
      if A[i][j]==B[k]:
        A[i][j]=0
#print(A)
for i in range(3):
  if sum(A[i][:])==0:
    bingo=bingo+1
for i in range(3):
  if sum(A[0][i])==0 or sum(A[1][i])==0 or sum(A[2][i])==0:
    bingo=bingo+1
if A[0][0]+A[1][1]+A[2][2]==0:
  bingo=bingo+1
if A[2][0]+A[1][1]+A[0][2]==0:
  bingo=bingo+1
print("Yes" if bingo>=1 else "No")