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, b, c = map(int, input().split())
d, e, f = map(int, input().split())
g, h, i = map(int, input().split())
num_count = int(input())
number_list = [0] * num_count
for i in range(num_count):
    number_list[i] = int(input())

bingo_map = [[a, b, c], [d, e, f], [g, h, i]]
bingo_answer = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]

def bingo(bingo_map, number_list):
    for number in number_list:
        for i, bingo_row in enumerate(bingo_map):
            if number in bingo_row:
                for j, bingo_number in enumerate(bingo_row):
                    if bingo_number == number:
                        bingo_answer[i][j] = 1


def check_bingo():
    return (all(bingo_answer[0]) or all(bingo_answer[1]) or all(bingo_answer[2]) or
    all(bingo_answer[0][0], bingo_answer[1][0], bingo_answer[2][0]) or
    all(bingo_answer[0][1], bingo_answer[1][1], bingo_answer[2][1]) or
    all(bingo_answer[0][2], bingo_answer[1][2], bingo_answer[2][2]) or
    all(bingo_answer[0][0], bingo_answer[1][1], bingo_answer[2][2]) or
    all(bingo_answer[2][0], bingo_answer[1][1], bingo_answer[0][2]))

bingo(bingo_map, number_list)

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

Submission status: Runtime Error

Solution code:
from sys import stdin,exit
import  numpy as np
A = [stdin.readline().rstrip().split() for _ in range(3)]
sum(A,[])
n = int(stdin.readline().rstrip())
B= [stdin.readline().rstrip().split() for _ in range(n)]
if len(B)<=2:
    print("No")
    sys.exit()
for i in range(len(B)):
    try:
        A[A.index(B[i])]=0
    except:
        continue
if A[1]+A[2]+A[3]==0 or A[1]+A[4]+A[7]==0 or A[3]+A[5]+A[7]==0 or A[4]+A[5]+A[6]==0 or A[2]+A[5]+A[8]==0 or A[1]+A[5]+A[9]==0 or A[7]+A[8]+A[9]==0 or A[3]+A[6]+A[9]==0:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
import numpy as np
A=list(list(map(int, input().split())) for _ in range(3))
N=int(input())
B=list(int(input()) for _ in range(N))
a=np.array(A)
c=a.flatten()
C=c.tolist()

for c in range(len(C)):
    for b in range(len(B)):
        if C[c]==B[b]:
            C[c]=0

            if (sum(C[:3])==0) | (sum(C[3:6])==0) | (sum(C[6:9])==0):
    print("Yes")
elif (C[0]+C[3]+C[6]==0) | (C[1]+C[4]+C[7]==0) | (C[2]+C[5]+C[8]==0):
    print("Yes")
elif (C[0]+C[4]+C[8]==0) | (C[2]+C[4]+C[6]==0): 
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
li_a = list(map(int,input().split()))
li_b = list(map(int,input().split()))
li_c = list(map(int,input().split()))
n = int(input())
li_num=[int(input()) for i in range(n)]

li_card = [li_a, li_b, li_c]

ans = False

#print(li_card)
#print(li_b)
#print(li_c)
#print(n)
#print(li_num)

for m in li_num:
    for i in range(3):
        for j in range(3):
          if li_card[i][j] == m:
              li_card[i][j] = 0

#print(li_card)

for i in range(3):
    if li_card[i][0] == li_card[i][1] == li_card[i][2]:
        ans = True
        break
    elif li_card[0][i] == li_card[1][i] == li_card[2][i]:
        ans = True
        break

if not ans:
  if li_card[0][0] == li_card[1][1] == li_card[2][2]:
      ans = True
  elif li_card[0][2] == li_card[1][1] == licard[2][0]:
      ans = True

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

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)]

a = np.array(a)
b = np.array(b)

after = np.zeros((3,3))
for i in range(N):
    after += a == b[i]
    
bool1 = (np.sum(after, axis=0)==3).sum()
bool2 = (np.sum(after, axis=1)==3).sum()
bool3 = (after[0,0]+after[1,1]+after[2,2])==3
bool4 = (after[0,2]+after[1,1]+after[2,0])==3

if bool1+bool2+bool3+bool4>0:
    ans = 'Yes'
else:
    ans = 'No'
    
print(ans)

Submission status: Runtime Error

Solution code:
import numpy as np
A=list(list(map(int, input().split())) for _ in range(3))
N=int(input())
B=list(int(input()) for _ in range(N))
a=np.array(A)
C=a.flatten()

for c in range(len(C)):
    for b in range(len(B)):
        if C[c]==B[b]:
            C[c]=0

            if (sum(C[:3])==0) | (sum(C[3:6])==0) | (sum(C[6:9])==0):
    print("Yes")
elif (C[0]+C[3]+C[6]==0) | (C[1]+C[4]+C[7]==0) | (C[2]+C[5]+C[8]==0):
    print("Yes")
elif (C[0]+C[4]+C[8]==0) | (C[2]+C[4]+C[6]==0): 
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
# a,b,c=map(int,input().split())
# s=input()
# s,t=map(str,input().split())
ans=[0]*n
anss=""
l=[]
L=[]
for i in range(m):
  s,c=map(int,input().split())
  l.append(str(s)+str(c))
  if s==1 and c==0:
    print(-1)
    exit()

l=list(set(l))
for x in l:
  L.append([x[0],x[1]])
X=[]

for i in range(len(L)):

  ans[int(L[i][0])-1] = int(L[i][1])
  if L[i][0] in X:
    print(-1)
    exit()
  else:
      X.append(L[i][0])
print(ans)
if ans[0]==0:
  if n!=1:
    ans[0]="1"
    for x in ans:
      anss+=str(x)
      print(anss)
  else:
    print(0)
else:
  for x in ans:
    anss+=str(x)
  print(anss)

Submission status: Runtime Error

Solution code:
a,b,c =map(int,input().split())
d,e,f =map(int,input().split())
g,h,i =map(int,input().split())
N=input()
z = [ input() for i inn range(N)]
if z = a and d and z= b and e and h or z= c and f and i or z =a and b and c or z=d and e and f or z = g and h and i or z=a and e and i or z =c and e and g:
  print('Yes')
else :
  print('No')

Submission status: Runtime Error

Solution code:
li_a = list(map(int,input().split()))
li_b = list(map(int,input().split()))
li_c = list(map(int,input().split()))
n = int(input())
li_num=[int(input()) for i in range(n)]

li_card = [li_a, li_b, li_c]

ans = False

#print(li_card)
#print(li_b)
#print(li_c)
#print(n)
#print(li_num)

for m in li_num:
    for i in range(3):
        for j in range(3):
          if li_card[i][j] == m:
              li_card[i][j] = 0

#print(li_card)

for i in range(3):
    if li_card[i][0] == li_card[i][1] == li_card[i][2]:
        ans = True
        break
    elif li_card[i][0] == li_card[i][1] == li_card[i][2]:
        ans = True
        break

if not ans:
  if li_card[0][0] == li_card[1][1] == li_card[2][2]:
      ans = True
  elif li_card[0][2] == li_card[1][1] == licard[2][0]:
      ans = True

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

Submission status: Runtime Error

Solution code:
bingo = []
for i in range(3):
    array = list(map(int, input().strip().split()))
    bingo.append(array)

N = int(input())
number = []

for j in range(N):
    number.append(int(input()))

result = []
for n in range(N):
    for t in range(3):
        for y in range(3):
            if(bingo[t][y] == number[n]):
                result.append([t,y])

bingo_a = 'No'
for r in range(len(result)):
    for t in range(3):
        flag = True
        for y in range(3):
            if(result[r][0] != t or result[r][1] != y):
                flag = False
    if(flag == True):
        bingo_a = 'Yes'

for r in range(len(result)):
    for y in range(3):
        flag = True
        for t in range(3):
            if(result[r][0] != t or result[r][1] != y):
                flag = False
    if(flag == True):
        bingo_a = 'Yes'

ans = 0
for rr in range(result):
    if(result[rr][0] == 0 or result[rr][1] == 0):
        ans = ans + 1
    if(result[rr][1] == 1 or result[rr][1] == 1):
        ans = ans + 1
    if(result[rr][0] == 2 or result[rr][1] == 2):
        ans = ans + 1
if(ans == 3):
    bingo_a = 'Yes'

ans = 0
for rr in range(result):
    if(result[rr][0] == 0 or result[rr][1] == 2):
        ans = ans + 1
    if(result[rr][1] == 1 or result[rr][1] == 1):
        ans = ans + 1
    if(result[rr][0] == 2 or result[rr][1] == 0):
        ans = ans + 1
if(ans == 3):
    bingo_a = 'Yes'

print(bingo_a)

Submission status: Runtime Error

Solution code:
R = 3
C = 3
matrix = [] 
print("Enter the entries rowwise:") 
 
for i in range(R):         
    a =[] 
    for j in range(C):  
         a.append(int(input())) 
    matrix.append(a) 
  
# For printing the matrix 
for i in range(R): 
    for j in range(C): 
        print(matrix[i][j], end = " ") 
    print() 

i= int(input("Enter: "))
if i in matrix:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
b = [0] * 9


def hantei():
    for i in range(3):
        if b[i * 3] == 1 and b[i * 3 + 1] == 1 and b[i * 3 + 2] == 1:
            return True
    for i in range(3):
        if b[i * 3] == 1 and b[(i+1) * 3 ] == 1 and b[(i+2) * 3 ] == 1:
            return True
    if b[0] == 1 and b[4] == 1 and b[8] == 1:
        return True
    if b[2] == 1 and b[5] == 1 and b[6] == 1:
        return True
    return False


a = [0] * 9
[a[0], a[1], a[2]] = input().split()
[a[3], a[4], a[5]] = input().split()
[a[6], a[7], a[8]] = input().split()
a = [int(i) for i in a]

n = int(input())

for i in range(n):
    c = int(input())
    for j in range(len(a)):
        if a[j] == c:
            b[j] = 1

if (hantei()):
    print("Yes")
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()))
n =  int(input())
lista = a+b+c
call_number = []
for i in range(n):
    k = int(input())
    call_number.append(k)
bingo_number_list = []
for m,n in enumerate(lista):
    if n in call_number:
        bingo_number_list.append(m)
    
lista  = [0,4,8]
list0 = [0,1,2]
list1 = [3,4,5]
list2 = [6,7,8]
list3 = [0,3,6]
list4 = [1,4,7]
list5 = [2,5,8]
list6 = [0,4,8]
list7 = [2,4,6]

for i in range(8):
    name = "list"+str(i)
    if set(name) <= set(lista):
        bingo += 1

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

Submission status: Runtime Error

Solution code:
#list_a = [int(x) for x in input().split()]
list_a = list(map(int,input().split()))

N = int(input())
#list_b = [int(x) for x in input().split()]
list_b = list(map(int,input().split()))

list_c = [0,0,0,0,0,0,0,0,0]
for i in range(N):
    for j in range(9):
        if list_a[j] == list_b[i]:
            list_c[j] = 1

flag=0
if list_c[0]==1 and list_c[1]==1 and list_c[2]==1:
    flag=1
if list_c[3]==1 and list_c[4]==1 and list_c[5]==1:
    flag=1
if list_c[6]==1 and list_c[7]==1 and list_c[8]==1:
    flag=1
if list_c[0]==1 and list_c[3]==1 and list_c[6]==1:
    flag=1
if list_c[1]==1 and list_c[4]==1 and list_c[7]==1:
    flag=1
if list_c[2]==1 and list_c[5]==1 and list_c[8]==1:
    flag=1
if list_c[0]==1 and list_c[4]==1 and list_c[8]==1:
    flag=1
if list_c[2]==1 and list_c[4]==1 and list_c[6]==1:
    flag=1
    
if flag == 1:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

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

TargetRow = int(input())
TargetList = [int(input()) for i in range(TargetRow)]

ansList = []
x = 0
flg = false
for row in BingoList:
  for num in row:
    flg = false
    for target in TargetList:
      if num == target:
        ansList.append(1)
        flg = true
    if !flg:
      ansList.append(0)

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

Submission status: Runtime Error

Solution code:
import numpy as np

card = np.array([list(map(int, input().split())) for i in range(3)])

n = int(input())

number = [int(input()) for i in range(n)]

hit = np.isin(card, number)

row = hit.all(axis=0).any()
col = hit.all(axis=1).any()

diag1 = hit[0][0] and hit[1][1] and hit[2][2]
diag2 = hit[0][2] and hit[1][1] and hit[2][0]

print('yes' if row or col or diag1 or diag2 else 'no')

Submission status: Runtime Error

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

n = int(input())
for _ in range(n):
  m = int(input())
  for i in range(9):
    if mat[i] == m:
      mat[i] = 1000

if sum(mat[:3])>=3000:
  print("Yes")
elif sum(mat[3:6])>=3000:
  print("Yes")
elif sum(mat[6:])>=3000:
  print("Yes")
elif sum(mat[::3])>=3000:
  print("Yes")
elif sum(mat[1::3])>=3000:
  print("Yes")
elif sum(mat[2::3])>=3000:
  print("Yes")
elif sum(mat[::4])>=3000:
  print("Yes")
elif sum(mat[2:7:2])>=3000:
  print("Yes")
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()))
n =  int(input())
lista = a+b+c
call_number = []
for i in range(n):
    k = int(input())
    call_number.append(k)
bingo_number_list = []
for m,n in enumerate(lista):
    if n in call_number:
        bingo_number_list.append(m)
    
list0 = [0,1,2]
list1 = [3,4,5]
list2 = [6,7,8]
list3 = [0,3,6]
list4 = [1,4,7]
list5 = [2,5,8]
list6 = [0,4,8]
list7 = [2,4,6]

for i in range(8):
    name = "list"+str(i)
    if set(name) <= set(lista):
        bingo += 1

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

Submission status: Runtime Error

Solution code:
def main():
    A = [list(map(int,input().split(" "))) for i in range(3)]
    N = int(input())
    b_list = [int(input()) for _ in range(N)]

    for i in range(3):
        for j in range(3):
            for b in b_list:
                if(A[i][j] == b):
                    A[i][j] = 0

    flag = False
    for i in range(3):
        for j in range(3):
                if(j+2 <3 and A[i][j] == 0 and A[i][j+1] == 0 and A[i][j+2] == 0):
                    flag = True
                    break
                if(i+2<3 and A[i][j] == 0 and A[i+1][j] == 0 and A[i+2][j] == 0):
                    flag = True
                    break
                if(i+2 <3 and j+2 and A[i][j] == 0 and A[i+1][j+1] == 0 and A[i+2][j+2] == 0):
                    flag = True
                    break
                if(i-1 > 0 and j-2>0 and A[i][j] == 0 and A[i-1][j-1] == 0 and A[i-2][j-2] == 0):
                    flag = True
                    break
        if(flag):
            break

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

if __name__ == "__main__":
    main()

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())
lista = a+b+c
call_number = []
for i in range(n):
    k = int(input())
    call_number.append(k)
bingo_number_list = []
for m,n in enumerate(lista):
    if n in call_number:
        bingo_number_list.apped(m)
    
lista  = [0,4,8]
list0 = [0,1,2]
list1 = [3,4,5]
list2 = [6,7,8]
list3 = [0,3,6]
list4 = [1,4,7]
list5 = [2,5,8]
list6 = [0,4,8]
list7 = [2,4,6]

for i in range(8):
    name = "list"+str(i)
    if set(name) <= set(lista):
        bingo += 1

if bingo > 0:
    print("Yes")
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()))
n =  int(input())
lista = a+b+c
call_number = []
for i in range(n):
    k = int(input())
    call_number.append(k)
bingo_number_list = []
for m,n in enumerate(lista):
    if n in call_number:
        bingo_number_list.appedned(m)
    
lista  = [0,4,8]
list0 = [0,1,2]
list1 = [3,4,5]
list2 = [6,7,8]
list3 = [0,3,6]
list4 = [1,4,7]
list5 = [2,5,8]
list6 = [0,4,8]
list7 = [2,4,6]

for i in range(8):
    name = "list"+str(i)
    if set(name) <= set(lista):
        bingo += 1

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

Submission status: Runtime Error

Solution code:
n,m = map(int,input().split())
sc = [list(map(int,input().split())) for i in range(m)]
tmp = [-1]*n
for j in range(m):
         if tmp[(sc[j][0]-1)] != sc[j][1]:
                  if tmp[(sc[j][0]-1)] != -1:
                           print(-1)
                           exit()
         tmp[(sc[j][0]-1)] = sc[j][1]
if tmp[0] == -1 and len(tmp) >= 2:
         print(-1)
         exit()
elif tmp[0] == -1 and len(tmp) == 1:
         print(0)
         exit()
else:
         for k in range(n):
                  if tmp[k] == -1:
                           tmp[k] = 0
                  print("{}".format(tmp[k]), end = "")

Submission status: Runtime Error

Solution code:
A = np.array([list(map(int,input().split())),list(map(int,input().split())),list(map(int,input().split()))])
N = int(input())
B = [input() for _  in range(N)]
for z in range(N):
    for x in range(3):
        for y in range(3):
            if B[z] == A[x][y]:
                A[x][y] = 1000
for x in range(3):
    if A[x] ==[1000, 1000, 1000] or A.T[x] == [1000, 1000, 1000]:
        print('Yes')
    if A[0][1] == A[1][1] == A[2][2] or A[0][2] == A[1][1] == A[2][0]:   
        print('Yes')
    else:
        print('No')

Submission status: Runtime Error

Solution code:
import numpy as np
lst = []
nums = []
for _ in range(3):
    l = []
    l = list(map(int, input().split()))
    lst.append(l)
    lst = np.array(lst)
n = int(input())
for _ in range(n):
    nums.append(int(input()))

for h in range(3):
    for w in range(3):
        if array[h][w] in nums:
            array[h][w] = 0

i = 0
for h in range(3):
    if sum(array[:, h]) == 0:
        i = 1
for w in range(3):
    if sum(array[w]) == 0:
        i = 1
if sum(np.diag(np.fliplr(array))) == 0:
    i = 1
if sum(np.diag(array)) == 0:
    i = 1

if i == 1:
    print("Yes")
else:
    print('No')

Submission status: Runtime Error

Solution code:
def cal(lst1, lst2, lst3):
    for i in range(3):
        if lst1[i] in lst3:
            lst2[i] = 1

def judge(a, b, c):
    if a == 1 and (a == b == c):
        return True
    else:
        return False

A_1 = list(map(int, input().split()))
A_2 = list(map(int, input().split()))
A_3 = list(map(int, input().split()))
N = int(input())
b = [int(input()) for _ in range(N)]
C_1 = [0, 0, 0]
C_2 = [0, 0, 0]
C_3 = [0, 0, 0]
cal(A_1, C_1, b)
cal(A_2, C_2, b)
cal(A_3, C_3, b)

a, b, c, d, e, f, g, h = False
# 縦
a = judge(C_1[0], C_2[0], C_3[0])
b = judge(C_1[1], C_2[1], C_3[1])
c = judge(C_1[2], C_2[2], C_3[2])

# 横
d = judge(C_1[0], C_1[1], C_1[2])
e = judge(C_2[0], C_2[1], C_2[2])
f = judge(C_3[0], C_3[1], C_3[2])

g = judge(C_1[0], C_2[1], C_3[2])
h = judge(C_1[2], C_2[1], C_3[0])

lst = [a, b, c, d, e, f, g]

if True in lst:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
a=[]
b=[]
nums=[]
ans="No"

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

n=int(input())

for i in range(n):
    s=int(input())
    b.append(s)

for i in range(n):
    for j in range(3):
        for k in range(3):
            if b[i]==a[j][k]:
                a[j][k]=0
                num=10*(j+1)+k+1
                nums.append(num)

nums.sort()


if A[0][0]==A[0][1]==A[0][2]==0:
    ans="Yes"
if A[1][0]==A[1][1]==A[1][2]==0:
        ans="Yes"
if A[2][0]==A[2][1]==A[2][2]==0:
    ans="Yes"
if A[0][0]==A[1][0]==A[2][0]==0:
    ans="Yes"
if A[0][1]==A[1][1]==A[2][1]==0:
        ans="Yes"
if A[0][2]==A[1][2]==A[2][2]==0:
    ans="Yes"
        
if 11 in nums and 22 in nums and 33 in nums:
    ans="Yes"

if 13 in nums and 22 in nums and 31 in nums:
    ans="Yes"
    
print(ans)

Submission status: Runtime Error

Solution code:
import numpy as np

a1,a2,a3 = map(int,input().split())
a4,a5,a6 = map(int,input().split())
a7,a8,a9 = map(int,input().split())

a = np.array([[a1, a2, a3], [a4, a5, a6], [a7, a8, a9]])

n = int(input())
for i in range(n):
  b = int(input())
  np.where(a == b,0,a)

if np.sum(a[1,:]) == 0:
  print("Yes")
elif  np.sum(a[2,:]) == 0:
  print("Yes")
elif  np.sum(a[3,:]) == 0:
  print("Yes")
elif  np.sum(a[:,1]) == 0:
  print("Yes")
elif  np.sum(a[:,2]) == 0:
  print("Yes")
elif  np.sum(a[:,3]) == 0:
  print("Yes")
elif a[1,1] + a[2,2] + a[3,3] == 0:
  print("Yes")
elif a[3,1] + a[2,2] + a[1,3] == 0:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
l3 = list(map(int, input().split()))
n=int(input())
b = [int(input()) for i in range(n)]
f=False
for i in range(3):
    for j in range(n):
        if l1[i]==b[j]:
            l1[i]=0
        elif l2[i]==b[j]:
            l2[i]=0
        elif l3[i]==b[j]:
            l3[i]=0
for i in range(3):
    if l1[i]==l2[i] and l2[i]==l3[i] and l1[i]==l3[i]:
        f=True
if l1[0]==l1[1] and l1[1]==l[2] and l1[0]==l1[2]:
    f=True
elif l2[0]==l2[1] and l2[1]==l2[2] and l2[0]==l2[2]:
    f=True
elif l3[0]==l3[1] and l3[1]==l3[2] and l3[0]==l3[2]:
    f=True
elif l1[0]==0 and l2[1]==0 and l3[2]==0:
    f=True
elif l3[0]==0 and l1[2]==0 and l2[1]==0:
    f=True
    
if f==True:
    print('Yes')
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()))
n =  int(input())
lista = a+b+c
call_number = []
for i in range(n):
    k = int(input())
    call_number.apped(k)
bingo_number_list = []
for m,n in enumerate(lista):
    if n in call_number:
        bingo_number_list.appedned(m)
    
lista  = [0,4,8]
list0 = [0,1,2]
list1 = [3,4,5]
list2 = [6,7,8]
list3 = [0,3,6]
list4 = [1,4,7]
list5 = [2,5,8]
list6 = [0,4,8]
list7 = [2,4,6]

for i in range(8):
    name = "list"+str(i)
    if set(name) <= set(lista):
        bingo += 1

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

Submission status: Runtime Error

Solution code:
import numpy as np
A = [list(map(int, input().split())) for i in range(0,3)]
N = int(input())
b_list =list([int(input()) for i in range(0,N)])
count = np.zeros((3,3))
for i in range(0,3):
    for j in range(0,3):
        if A[i][j] in b_list:
            count[i][j] = count + 1
if (count.sum(axis=1) % 3 ==0).any():
    print('Yes')
elif (count.sum(axis=0) % 3 ==0).any():
    print('Yes')
elif count[0][0] + count[1][1] + count[2][2]:
    print('Yes')
elif count[2][0] + count[1][1] + count[0][2]:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
x=[list(map(str,input().split())) for _ in range(3)]
N=int(input())
B=[input() for _ in range(N)]
flag=0
for i in range(3):
  for j in range(3):
    if x[i][j] in B:
      x[i][j]=True

for p in range(3):
  if x[p].count(True)==3:
    flag=1
lis=[]
lis2=[]
for a in range(3):
  for b in range(3):
    lis2.append(x[b][a])
  else:
    lis.append(lis2)
    lis2=[]

for q in range(3):
  if lis[q].count(True)==3:
    flag=1
if x[0][0]==True and x[1][1]==True and x[2][2]==True:
  flag=1
elif if x[0][2]==True and x[1][1]==True and x[2][0]==True:
if flag==1:
  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 = [int(input()) for _ in range(N)]

for i in range(N):
  if b[i] in A1:
    if len(list(set(A1))) == 1:
      A1 = [0] * 3
    else:
      A1[A1.index(b[i])] = 0
  elif b[i] in A2:
    if len(list(set(A2))) == 1:
      A2 = [0] * 3
    else:
      A2[A2.index(b[i])] = 0
  elif b[i] in A3:
    if len(list(set(A3))) == 1:
      A3 = [0] * 3
    else:
      A3[A3.index(b[i])] = 0


if A1[0] == 0 and A1[0] == A2[0] == A3[0]:
  ans = "Yes"
elif A1[1] == 0 and A1[1] == A2[1] == A3[1]:
  ans = "Yes"
elif A1[2] == 0 and A1[2] == A2[2] == A3[2]:
  ans = "Yes"
elif A1[0] == 0 and A1[0] == A2[1] == A3[2]:
  ans = "Yes"
elif A1[2] == 0 and A1[2] == A2[1] == A3[0]:
  ans = "Yes"
elif A[0] == [0] * 3 or A[1] == [0] * 3 or A[2] == [0] * 3:
  ans = "Yes"
else:
  ans = "No"

print(ans)

Submission status: Runtime Error

Solution code:
X = []
Y = []
Z = []
for i in range(3):
    x, y, z = map(str, input().split())
    X.append(x)
    Y.append(y)
    Z.append(z)
N = int(input())

b = map(str, [input() for i in range(N)])

for x in sorted(b, reverse=True):
    X = [s.replace(x, 'OK') for s in X]
    Y = [s.replace(x, 'OK') for s in Y]
    Z = [s.replace(x, 'OK') for s in Z]

if ('OK' in X[0] and 'OK' in X[1] and 'OK' in X[2]
    or 'OK' in Y[0] and 'OK' in Y[1] and 'OK' in Y[2]
    or 'OK' in Z[0] and 'OK' in Z[1] and 'OK' in Z[2]
    or 'OK' in X[0] and 'OK' in Y[0] and 'OK' in Z[0]
    or 'OK' in X[1] and 'OK, in Y[1] and 'OK' in Z[1]
    or 'OK' in X[2] and 'OK' in Y[2] and 'OK' in Z[2]
    or 'OK' in X[0] and 'OK' in Y[1] and 'OK' in Z[2]
    or 'OK' in X[2] and 'OK' in Y[1] and 'OK' in Z[0]):
    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()))
A = [A1,A2,A3]
bingomap = [[0,0,0],[0,0,0],[0,0,0]]
print(A)
N = int(input())
b = list()
ret = 'No'
for i in range(N):
  b.append(int(input()))
  print(b)
  for i in range(N):
    for j in range(3):
      if b[i] in A[j]:
        bingomap[j][A[j].index(b[i])] = 1
        break
    if i >= 2 :
      if checkbingo(bingomap) == True:
        ret = 'Yes'
        break
print(ret)

def checkbingo(map_):
  for i in range(3):
    if map_[i][0] * map_[i][1] * map_[i][2] == 1:
      return True
    if map_[0][i] * map_[0][i] * map_[0][i] == 1:
      return True
  if map_[0][0] * map_[1][1] * map_[2][2] == 1:
    return True
  if map_[0][2] * map_[1][1] * map_[2][0] == 1:
    return True
  return False

Submission status: Runtime Error

Solution code:
import numpy as np
A = [list(map(int, input().split())) for i in range(0,3)]
N = int(input())
b_list =list([int(input()) for i in range(0,N)])
count = np.zeros(3,3)
for i in range(0,3):
    for j in range(0,3):
        if A[i][j] in b_list:
            count[i][j] = count + (i+1)*(j+1)
if (count.sum(axis=1) % 3 ==0).any():
    print('Yes')
elif (count.sum(axis=0) % 3 ==0).any():
    print('Yes')
elif count[0][0] + count[1][1] + count[2][2]:
    print('Yes')
elif count[2][0] + count[1][1] + count[0][2]:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
port numpy as np
Flg = "No"
A = [[0]*3 for i in range(3)]
for i in range(3):
    A[i][0], A[i][1], A[i][2] = map(int, input().split())    
N = int(input())
b = [0]*N
for j in range(N):
    b[j] = int(input())

for i in range(3):
    for j in range(3):
        for k in range(N):
            if(A[i][j] == b[k]):
                A[i][j] = "*"
A_T = np.array(A).T
                
for i in range(3):
    if(A[i][0] == A[i][1] == A[i][2] == "*"):
        Flg = "Yes"        
        break
    if(A_T[i][0] == A_T[i][1] == A_T[i][2] == "*"):
        Flg = "Yes"
        break

if(A[0][0] == A[1][1] == A[2][2] == "*"):
    Flg = "Yes"

if(A[0][2] == A[1][1] == A[2][0] == "*"):
    Flg = "Yes"

print(Flg)

Submission status: Runtime Error

Solution code:
import numpy as np
 
a1,a2,a3 = map(int,input().split())
a4,a5,a6 = map(int,input().split())
a7,a8,a9 = map(int,input().split())
 
a = np.array([[a1, a2, a3], [a4, a5, a6], [a7, a8, a9]])
 
n = int(input)
for i in range(n):
  b = int(input())
  np.where(a == b,0,a)

if np.sum(a[1,:]) == 0:
  print("Yes")
elif  np.sum(a[2,:]) == 0:
  print("Yes")
elif  np.sum(a[3,:]) == 0:
  print("Yes")
elif  np.sum(a[:,1]) == 0:
  print("Yes")
elif  np.sum(a[:,2]) == 0:
  print("Yes")
elif  np.sum(a[:,3]) == 0:
  print("Yes")
elif a[1,1] + a[2,2] + a[3,3] == 0:
  print("Yes")
elif a[3,1] + a[2,2] + a[1,3] == 0:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
#157 b
a=[]
call_num=[]
for i in range(3):
    x,y,z=map(int,input().split())
    a.append(x)
    a.append(y)
    a.append(z)
n=int(input())
for i in range(n):
    x=int(input())
    if x in a:
        call_num.append(a.index(x))
bingo
ans=[[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 x in ans:
    flag=True
    for y in x:
        if y not in call_num:
            flag=False
    if flag:
        print("Yes")
        bing=True
        break
if bingo!=True:        
    print("No")

Submission status: Runtime Error

Solution code:
list_a = [int(x) for x in input().split()]
N = int(input())
list_b = [int(x) for x in input().split()]

list_c = [0,0,0,0,0,0,0,0,0]
for i in range(N):
    for j in range(9):
        if list_a[j] == list_b[i]:
            list_c[j] = 1

flag=0
if list_c[0]==1 and list_c[1]==1 and list_c[2]==1:
    flag=1
if list_c[3]==1 and list_c[4]==1 and list_c[5]==1:
    flag=1
if list_c[6]==1 and list_c[7]==1 and list_c[8]==1:
    flag=1
if list_c[0]==1 and list_c[3]==1 and list_c[6]==1:
    flag=1
if list_c[1]==1 and list_c[4]==1 and list_c[7]==1:
    flag=1
if list_c[2]==1 and list_c[5]==1 and list_c[8]==1:
    flag=1
if list_c[0]==1 and list_c[4]==1 and list_c[8]==1:
    flag=1
if list_c[2]==1 and list_c[4]==1 and list_c[6]==1:
    flag=1
    
if flag == 1:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
A,B,C=map(int,input().split())
D,E,F=map(int,input().split())
G,H,I=map(int,input().split())
N=int(input())
b=[input() for i in range(N+1)]
if b.count(A)>0 and b.count(B)>0 and b.count(C)>0:
    print("Yes")
    exit()
if b.count(D)>0 and b.count(E)>0 and b.count(F)>0:
    print("Yes")
    exit()
if b.count(G)>0 and b.count(H)>0 and b.count(I)>0:
    print("Yes")
    exit()
if b.count(A)>0 and b.count(D)>0 and b.count(G)>0:
    print("Yes")
    exit()
if b.count(B)>0 and b.count(E)>0 and b.count(H)>0:
    print("Yes")
    exit()
if b.count(C)>0 and b.count(F)>0 and b.count(I)>0:
    print("Yes")
    exit()
if b.count(A)>0 and b.count(E)>0 and b.count(I)>0:
    print("Yes")
    exit()
if b.count(C)>0 and b.count(E)>0 and b.count(G)>0:
    print("Yes")
    exit()
else:
    print("No")