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: Wrong Answer

Solution code:
a = [input().split() for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]
total = []
s = 0
 
for i in range(n):
  for k in range(3):
    for j in range(3):
      if b[i] == int(a[k][j]):
        total.append(s + k + j)
    s = s + 3
if ((0 and 1 and 2) in total) or ((3 and 4 and 5) in total) or ((6 and 7 and 8) in total) or ((0 and 3 and 6) in total) or ((1 and 4 and 7) in total) or ((2 and 5 and 8) in total) or ((0 and 4 and 8) in total) or ((2 and 4 and 6) in total):
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

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

x = 0
y = []
i = 0

for i in range(N):
    if B[i] in A == True:
      y.append(A.index(B[i]))
      
y_new = sorted(y)

return_list = []
if [(["0","1","2"]
    or ["3","4","5"]
    or ["6","7","8"]
    or ["0","4","8"]
    or ["2","4","6"]
    or ["0","3","6"]
    or ["1","4","7"]
    or ["2","5","8"]) in y_new] == True:
  print("No")
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
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 = []
for i in range(N):
    b.append(int(input()))
A = [a_1,a_2,a_3]
c = []
c_1 = []
for i in range(3):
    for j in range(3):
        for k in b:
            if A[i][j] == k:
                c.append(i)
                c_1.append(j)
#print(c)
#print(c_1)
d_0 = c.count(0)
d_1 = c.count(1)
d_2 = c.count(2)
D = [d_0,d_1,d_2]
d_3 = c_1.count(0)
d_4 = c_1.count(1)
d_5 = c_1.count(2)
D_2 = [d_3,d_4,d_5]
if (str(0) not in str(D) and str(0) not in str(D_2)):
    y = c.index(1)
    u = c_1.index(1)
    if y == u:
        print("Yes")
    else:
        print("No")
elif (str(3) in str(D) or str(3) in str(D_2)):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
c=[]
w=0
for i in range(3):
    c.append(list(map(int,input().split())))
N=int(input())
d=[]
o=0
for y in range(N):
    d.append(int(input()))
for n in d:
    for p in range(3):
        for j in range(3):
            if c[p][j]==n:
               c[p][j]=0
                
for t in c:
    for h in t:
        if c.count(0)==3:
            o=1
            break
    else:
        continue
    break
for v in range(3):
    w=0
    for k in c:
        if k[v]==0:
            w+=1
        if w==3:
            o=1
w=0
for ji in range(3):
    if c[ji][ji]==0:
        w+=1
    if w==3:
        o=1
w=0
for ji2 in range(3):
    g=3-ji2-1
    if c[ji2][g]==0:
        w+=1
    if w==3:
        o=1
for v1 in range(3):
    w=0
    for k in range(3):
        if c[k][v1]==0:
            w+=1
        if w==3:
            o=1
if o==1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
A = list(map(str, input().split()))
A += list(map(str, input().split()))
A += list(map(str, input().split()))
a = []
N = int(input())
for i in range(N):
    a.append(input())
flag = 0
for i  in a:
    if i in A:
        A[A.index(i)] = "0"
B = []
C = []
D = []
E = []
F = []
for i in range(3):
    B.append(A[4*i])
    C.append(A[2*i])
    D.append(A[3*i])
    E.append(A[3*i+1])
    F.append(A[3*i+2])
    if "0" in A[i*3:i*3+3]:
        if A.count("0") == 3:
            flag = 1
if "0" in B:
    if B.count("0") == 3:
        flag = 1
if"0"in C:
    if C.count("0") == 3:
        flag = 1
if"0"in D:
    if D.count("0") == 3:
        flag = 1
if"0"in E:
    if E.count("0") == 3:
        flag = 1
if"0"in F:
    if F.count("0") == 3:
        flag = 1
if flag == 1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
A=[]
for i in range(3):
    A.extend(list(map(int, input().split())))
N = int(input())
n=[]
while N>0:
    inp = int(input())
    if inp in A:
        n.append(inp)
    N-=1
A = [A[:3],A[3:6],A[6:9], [A[0], A[4], A[8]], [A[2], A[4], A[6]], [A[0], A[3], A[6]], [A[1], A[4], A[7]], [A[2], A[5], A[8]]]
for ele in A:
    if ele[0] in n and ele[1]in n and ele[2]in n:
        print ("Yes")
print ("No")

Submission status: Wrong Answer

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'
t_a = 0
for r in range(len(result)):
    for t in range(3):
        for y in range(3):
            if(result[r][0] == t and result[r][1] == y):
                t_a += 1
        if(t_a == 3):
            bingo_a = 'Yes'

y_a = 0
for r in range(len(result)):
    for y in range(3):
        for t in range(3):
            if(result[r][0] == t and result[r][1] == y):
                y_a += 1
        if(y_a == 3):   
            bingo_a = 'Yes'

ans = 0
for rr in range(len(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(len(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: Wrong Answer

Solution code:
bingo = []
bingo.append(list(map(int,input().split())))
bingo.append(list(map(int,input().split())))
bingo.append(list(map(int,input().split())))

#print("bingo",bingo)

score = [[0,0,0],[0,0,0],[0,0,0]]
total = 0

Input = []
while True:
    try:
        i = list(map(int, input().split()))
        Input += i
    except EOFError:
        break
        
#print("Input",Input)
for select in Input:
    for i in range(3):
        for j in range(3):
            if bingo[i][j] == select:
                score[i][j] = 1
    #print("score", score)
    for i in range(3):
        total += sum(score[i]) == 3
        total += sum(score[:][i]) == 3

    if (score[0][0] + score[1][1] + score[2][2]) == 3:
        total +=1
    if (score[0][2] + score[1][1] + score[2][0]) == 3:
        total +=1
    #print("total",total)


if total == 0:
  print('No')
else:
  print('Yes')

Submission status: Wrong Answer

Solution code:
a1 = [int(i) for i in input().split()]
a2 = [int(i) for i in input().split()]
a3 = [int(i) for i in input().split()]
n = int(input())

for i in range(n):
  b = int(input())
  if b in a1:
    for j in range(3):
      if a1[j] == b:
        a1[j] = 0
        break
  elif b in a2:
    for j in range(3):
      if a2[j] == b:
        a2[j] = 0
        break
  elif b in a3:
    for j in range(3):
      if a3[j] == b:
        a3[j] = 0
        break

        
a1[len(a1):len(a1)] = a2
a1[len(a1):len(a1)] = a3
b = 0
if a1[0] == 0 or a1[1] == 0 or a1[2] == 0:
  b += 1
elif a1[3] == 0 and a1[4] == 0 and a1[5] == 0:
  b += 1
elif a1[6] == 0 and a1[7] == 0 and a1[8] == 0:
  b += 1
elif a1[0] == 0 and a1[3] == 0 and a1[6] == 0:
  b += 1
elif a1[1] == 0 and a1[4] == 0 and a1[7] == 0:
  b += 1
elif a1[2] == 0 and a1[5] == 0 and a1[8] == 0:
  b += 1
elif a1[0] == 0 and a1[4] == 0 and a1[8] == 0:
  b += 1
elif a1[2] == 0 and a1[4] == 0 and a1[6] == 0:
  b += 1
  
if b == 1:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
a = [input().split() for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]
total = []
s = 0
 
for i in range(n):
  for k in range(3):
    for j in range(3):
      if b[i] == int(a[k][j]):
        total.append(s + j)
    s = s + 3
if ((0 and 1 and 2) in total) or ((3 and 4 and 5) in total) or ((6 and 7 and 8) in total) or ((0 and 3 and 6) in total) or ((1 and 4 and 7) in total) or ((2 and 5 and 8) in total) or ((0 and 4 and 8) in total) or ((2 and 4 and 6) in total):
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
NA=input().split()
NB=input().split()
NC=input().split()
N=int(input())
A=[input() for i in range(N)]
LA=[]
LB=[]
LC=[]
X=0
for x in NA:
	for j in range(N):
		if x==str(A[j]):
			y="100"
			break
		else:
			y=x
	LA.append(y)
for x in NB:
	for j in range(N):
		if x==str(A[j]):
			y="100"
			break
		else:
			y=x
	LB.append(y)
for x in NC:
	for j in range(N):
		if x==str(A[j]):
			y="100"
			break
		else:
			y=x
	LC.append(y)
 # NB=NB.replace(str(A[j]),"100")
  #NC=NC.replace(str(A[j]),"100")
  
  
card=[LA,LB,LC]

if  (card[0][0]=="100" and card[1][1]=="100" and card[2][2]=="100") :
  print("Yes")
  X+=1
if  (card[0][2]=="100" and card[1][1]=="100" and card[2][0]=="100") :
  print("Yes")
  X+=1
if  (card[0][0]=="100" and card[0][1]=="100" and card[0][2]=="100") :
  print("Yes")
  X+=1
if  (card[1][0]=="100" and card[1][1]=="100" and card[1][2]=="100") :
  print("Yes")
  X+=1
if  (card[2][0]=="100" and card[2][1]=="100" and card[2][2]=="100") :
  print("Yes")
  X+=1
if  (card[0][0]=="100" and card[1][0]=="100" and card[2][0]=="100") :
  print("Yes")
  X+=1
if  (card[1][0]=="100" and card[1][1]=="100" and card[2][1]=="100") :
  print("Yes")
  X+=1
if  (card[2][0]=="100" and card[2][1]=="100" and card[2][2]=="100") :
  print("Yes")
  X+=1
if X==0:
  print("No")

Submission status: Wrong Answer

Solution code:
from sys import stdin
import sys

data = [stdin.readline().rstrip().split()for _ in range(3)]
N = int(input())
B = []
for _ in range(N):
    B.append(input())

for b in B:
    for i in range(len(data)):
        for j in range(len(data[i])):
            if data[i][j] == b:
                data[i][j] = "o"

if data[0][0] ==  data[1][1] == data[2][2] == "o":
    print("yes")
    sys.exit()
elif data[0][2] ==  data[1][1] == data[2][0] == "o":
    print("yes")
    sys.exit()
else:
    for i in range(len(data)):
        if data[i][0] ==  data[i][1] == data[i][2] == "o":
            print("yes")
            sys.exit()
        for j in range(len(data[i])):
            if data[0][j] ==  data[1][j] == data[2][j] == "o":
                print("yes")
                sys.exit()
    print("No")

Submission status: Wrong Answer

Solution code:
l=[list(map(int,input().split())) for i in range(3)]
a = int(input())
q=[int(input()) for j in range(a)]
k=[[0]*3]*3
for t in range(3):
 for y in range(3):
  if l[t][y] in q:
   k[t][y] = 1
if (k[0][1] == 1 and k[0][2] == 1 and k[0][0] == 1) or (k[1][1] == 1 and k[1][2] == 1 and k[1][0] == 1) or (k[2][1] == 1 and k[2][2] == 1 and k[2][0] == 1) or (k[0][0] == 1 and k[1][0] == 1 and k[2][0] == 1) or (k[0][1] == 1 and k[1][1] == 1 and k[2][1] == 1) or (k[0][2] == 1 and k[1][2] == 1 and k[2][2] == 1) or (k[0][0] == 1 and k[1][1] == 1 and k[2][2] == 1) or (k[0][2] == 1 and k[1][1] == 1 and k[2][0] == 1):
 print("Yes")
else:
 print("No")
print(q)
print(bool((k[0][0] == 1 and k[1][0] == 1 and k[2][0] == 1)))
print(k[0][2])
print(k[1][1])

Submission status: Wrong Answer

Solution code:
a = [[]*3 for x in range(3)]
for x in range(3):
    ele = list(map(int, (input().split(" "))))
    a[x] = ele
N = int(input())
result = []
for x in range(N):
    key = int(input())
    for i in range(3):
        for j in range(3):
            if key == a[i][j]:
                result.append(key)
finalFalse = []
finalTrue = []
for i in range(3):
    for x in result:
        if result == []:
            finalFalse.append(False)
        if x == a[i][0] | a[i][1] | a[i][2]:
            finalTrue.append(True)
        elif x == a[i][i]:
            finalTrue.append(True)
        elif x == a[0][i] | a[1][i] | a[2][i]:
            finalTrue.append(True)
        else:
            finalFalse.append(False)
if(finalTrue==[]):
    print("No")
elif(all(finalTrue)==True):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:

# S, T = input().split()
# A, B = map(int, input().split())
# U = input()
# if S == U: A -= 1
# else: B -= 1
# print(A, B)

def main():
    A1 =list(map(int,input().split()))
    A2 =list(map(int,input().split()))
    A3 =list(map(int,input().split()))

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

    for i in range(N):
    
        B.append(int(input()))

    A=[]

    A.append(A1)
    A.append(A2)
    A.append(A3)

    flags = [[False,False,False],[False,False,False],[False,False,False]]


    for i in B:
        for j in range(3):

            if A[0][j] == i:
                flags[0][j] = True
            if A[1][j] == i:
                flags[1][j] = True
            if A[2][j] == i:
                flags[2][j] = True
            
            # if A[j][0] == i:
            #     flags[j][0] = True
            # if A[j][1] == i:
            #     flags[j][1] = True
            # if A[j][2] == i:
            #     flags[j][2] = True

            for k in range(3):
                if flags[k][0] == True and flags[k][1] == True and flags[k][2] == True:
                    print("Yes")
                    return
                if flags[0][k] == True and flags[0][k] == True and flags[0][k] == True:
                    print("Yes")
                    return

            if flags[0][0] == True and flags[1][1] == True and flags[2][2] == True : 
                print("Yes")
                return
            if flags[0][2] == True and flags[1][1] == True and flags[2][0] == True :
                print("Yes")
                return

    print("No")

main()

Submission status: Wrong Answer

Solution code:
import numpy as np
f = np.zeros((3, 3))
b = np.zeros((3, 3))
f[0]=list(map(int,input().split()))
f[1]=list(map(int,input().split()))
f[2]=list(map(int,input().split()))
n= int(input())
for i in range(n):
  c = int(input())
  b=np.where(f == c, 1, b)
  #print(b)
#b=np.where(b > 0, 1, 0)
#print(b)
if all(b[0][:]) or all(b[1][:]) or all(b[2][:])\
or all(b[:][0]) or all(b[:][1]) or all(b[:][2])\
or all((b[0][0],b[1][1],b[2][2])) or all((b[0][2],b[1][1],b[2][0])):
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

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'
t_a = 0
for r in range(len(result)):
    for t in range(3):
        for y in range(3):
            if(result[r][0] == t and result[r][1] == y):
                t_a += 1
        print(t_a)
        if(t_a == 3):
            bingo_a = 'Yes'

y_a = 0
for r in range(len(result)):
    for y in range(3):
        for t in range(3):
            if(result[r][0] == t and result[r][1] == y):
                y_a += 1
        if(y_a == 3):   
            bingo_a = 'Yes'

ans = 0
for rr in range(len(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(len(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: Wrong Answer

Solution code:
li=[[]]*8
for i in range(3):
    li[i] = list(map(int,input().split()))
n=int(input())
bs=[int(input()) for i in range(n)]
for i in range(3,6):
    li[i]=[li[i-3][0],li[i-3][1],li[i-3][2]]
li[6]=[li[0][0],li[1][1],li[2][2]]
li[7]=[li[0][2],li[1][1],li[2][0]]
t=0
for i in range(8):
    for j in range(n):
        if bs[j] in li[i]:
          li[i].remove(bs[j])
    if li[i]:
        continue
    else:
        t+=1
        break
if t>0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:

def find_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default


if __name__ == "__main__":
    ret = "No"
    A1 = input().split()
    A2 = input().split()
    A3 = input().split()
    A = A1 + A2 + A3
    bingo = [False]*len(A)
    N = int(input())
    B = []
    for i in range(N):
        B.append(input())
    for b in B:
        index = find_index(A, b)
        if index != False:
            bingo[index] = True
    if bingo[4]:
        if bingo[0] and bingo[8]:
            ret = "Yes"
        elif bingo[2] and bingo[6]:
            ret = "Yes"
        elif bingo[1] and bingo[7]:
            ret = "Yes"
        else:
            pass
    for i in range(3):
        if bingo[i]:
            if bingo[i+3] and bingo[i+6]:
                ret = "Yes"
            elif bingo[i:i+3]:
                ret = "Yes"
            else:
                pass
    print(ret)

Submission status: Wrong Answer

Solution code:
a = [input().split() for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]
total = []
s = 0
 
for i in range(n):
  for k in range(3):
    for j in range(3):
      if b[i] == int(a[k][j]):
        total.append(s + j)
  s = s + 3
if ((0 and 1 and 2) in total) or ((3 and 4 and 5) in total) or ((6 and 7 and 8) in total) or ((0 and 3 and 6) in total) or ((1 and 4 and 7) in total) or ((2 and 5 and 8) in total) or ((0 and 4 and 8) in total) or ((2 and 4 and 6) in total):
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
from sys import stdin
import sys
data = [stdin.readline().rstrip().split()for _ in range(3)]
N = int(input())
B = []
for _ in range(N):
    B.append(input())

for b in B:
    for i in range(len(data)):
        for j in range(len(data[i])):
            if data[i][j] == b:
                data[i][j] = "o"

if data[0][0] ==  data[1][1] == data[2][2]:
    print("yes")
    sys.exit()
elif data[0][2] ==  data[1][1] == data[2][0]:
    print("yes")
    sys.exit()
else:
    for i in range(len(data)):
        if data[i][0] ==  data[i][1] == data[i][2]:
            print("yes")
            sys.exit()
        for j in range(len(data[i])):
            if data[0][j] ==  data[1][j] == data[2][j]:
                print("yes")
                sys.exit()
    print("No")

Submission status: Wrong Answer

Solution code:
A1=[]
A2=[]
A3=[]


a11, a12, a13 = map(int,input().split())
A1.append(a11)
A1.append(a12)
A1.append(a13)

a21, a22, a23 = map(int,input().split())
A2.append(a21)
A2.append(a22)
A2.append(a23)

a31, a32, a33 = map(int,input().split())
A3.append(a31)
A3.append(a32)
A3.append(a33)

N = int(input())
for i in range(N):
    b = int(input())
    if b==A1[0]:
        A1[0] ="OK"
    if b==A1[1]:
        A1[1]="OK"
    if b==A1[2]:
        A1[2]="OK"
    if b==A2[0]:
        A2[0] ="OK"
    if b==A2[1]:
        A2[1]="OK"
    if b==A2[2]:
        A2[2]="OK"
    if b==A3[0]:
        A3[0] ="OK"
    if b==A3[1]:
        A3[1]="OK"
    if b==A3[2]:
        A3[2]="OK"

ans ="No"
if A1[0]==A1[1] and A1[0]==A1[2]:
    ans ="Yes"
if A2[0]==A2[1] and A2[0]==A2[2]:
    ans ="Yes"
if A3[0]==A3[1] and A3[0]==A3[2]:
    ans ="Yes"

if A1[0]==A2[0] and A1[0]==A3[0]:
    ans ="Yes"
if A1[1]==A2[1] and A1[1]==A3[1]:
    ans ="Yes"
if A1[2]==A2[2] and A1[1]==A3[1]:
    ans ="Yes"

if A1[0]==A2[1] and A1[0]==A3[2]:
    ans ="Yes"
if A1[2]==A2[1] and A1[2]==A3[0]:
    ans ="Yes"

print(ans)

Submission status: Wrong Answer

Solution code:
A = list(map(str, input().split()))
A += list(map(str, input().split()))
A += list(map(str, input().split()))
a = []
N = int(input())
for i in range(N):
    a.append(input())
flag = 0
for i  in a:
    if i in A:
        A[A.index(i)] = "0"
B = []
C = []
D = []
E = []
F = []
for i in range(3):
    B.append(A[4*i])
    C.append(A[2*i])
    D.append(A[3*i+1])
    E.append(A[3*i+2])
    F.append(A[3*i])
    if "0" in A[i*3:i*3+3]:
        if A.count("0") == 3:
            flag = 1
if "0" in B:
    if B.count("0") == 3:
        flag = 1
if"0"in C:
    if C.count("0") == 3:
        flag = 1
if"0"in D:
    if D.count("0") == 3:
        flag = 1
if"0"in E:
    if E.count("0") == 3:
        flag = 1
if"0"in F:
    if F.count("0") == 3:
        flag = 1
if flag == 1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
bingo = []
bingo.append(list(map(int,input().split())))
bingo.append(list(map(int,input().split())))
bingo.append(list(map(int,input().split())))

#print("bingo",bingo)

score = [[0,0,0],[0,0,0],[0,0,0]]
total = 0

Input = []
while True:
    try:
        i = list(map(int, input().split()))
        Input += i
    except EOFError:
        break
        
#print("Input",Input)
for select in Input:
    for i in range(3):
        for j in range(3):
            if bingo[i][j] == select:
                score[i][j] = 1
    #print("score", score)
    for i in range(3):
        total += sum(score[i]) == 3
        total += sum(score[:][i]) == 3

    if (score[0][0] + score[1][1] + score[2][2]) == 3:
        total +=1
    if (score[0][2] + score[1][1] + score[2][0]) == 3:
        total +=1
    #print("total",total)


if total == 0:
    print('No')
else:
  print('Yes')

Submission status: Wrong Answer

Solution code:
import numpy as np
 
xy = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
num = [list(map(int, input().split())) for _ in range(n)] 
result = [[0,0,0],[0,0,0],[0,0,0]]

def input_b(xy:list, num:int, result:list):
    for i in range(3):
        if num in xy[i]:
            for j in range(3):
                if num==xy[i][j]:
                    result[i][j]=1
    return result
  
def check_result(result:list):
    for i in range(3):
        if 3 == np.array(result[0]).sum():
            return "Yes" 
    if 3 in np.array(result[0]) + np.array(result[1]) + np.array(result[2]):
        return "Yes"
    if 3 == result[0][0] + result[1][1] + result[2][2]:
        return"Yes"
    if 3 == result[0][2] + result[1][1] + result[2][0]:
        return"yes"
    return "No"
 
for i in num:
    result=input_b(xy,i[0],result)
 
print(check_result(result))

Submission status: Wrong Answer

Solution code:
import copy
A = [[0]*3 for i in range(3)]
for i in range(3):
    A[i] = list(map(int, input().split()))
N = int(input())
b = [int(input()) for i in range(N)]
A_copy = copy.copy(A)
for i in range(3):
    for j in range(3):
        for k in range(N):
            if A[i][j] == b[k]:
                A_copy[i][j] = -1

for i in range(3):
    if A_copy[i][0] == -1 and A_copy[i][1] == -1 and A_copy[i][2] == -1:
        print("Yes")
        exit()
    if A_copy[0][i] == -1 and A_copy[0][i] == -1 and A_copy[0][i] == -1:
        print("Yes")
        exit()
if A_copy[0][0] == -1 and A_copy[1][1] == -1 and A_copy[2][2] == -1:
    print("Yes")
    exit()
if A_copy[0][2] == -1 and A_copy[1][1] == -1 and A_copy[2][0] == -1:
    print("Yes")
    exit()
print("No")

Submission status: Wrong Answer

Solution code:
def judge_bingo(m,a):
    sum_d1 = 0
    sum_d2 = 0
    for i in range(m):
        sum_h = 0
        sum_v = 0
        for j in range(m):
            sum_h += a[i][j]
            sum_v += a[j][i]
        
        if sum_h==3 or sum_v==3:
            return True
        sum_d1 += a[i][i]
        sum_d2 += a[i][-i-1]
        
    if sum_d1==3 or sum_d1==3:
        return True
    else:
        return False
    

if __name__ == "__main__":
    m = 3
    card = [[0]]*m
    bingo = [[0]*m for i in range(m)]
    for i in range(m):
        card[i] = list(map(int,input().split()))
    n = int(input())
    nums = []
    for i in range(n):
        nums.append(int(input()))
        
    sum_h = [0]*m
    for num in nums:
        for i in range(m):
            for j in range(m):
                if card[i][j]==num:
                    bingo[i][j] = 1
    if judge_bingo(m,bingo):
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
bingo_l = []
b_flg = 0
        
for _ in range(3):
    bingo_l.append(list(map(int, input().split())))

N = int(input())

kekka_l = [[0, 0, 0],[0, 0, 0],[0, 0, 0]]

for _ in range(N):
    b = int(input())
    for i in range(3):
        for j in range(3):
            if b == bingo_l[i][j]:
                kekka_l[i][j] = 1
                break

for i in range(3):
    if sum(kekka_l[i]) == 3:
        b_flg = 1
        break

sum = 0

for j in range(3):
    for i in range(3):
        sum += kekka_l[i][j]
        if sum == 3:
            b_flg = 1
            break

if kekka_l[0][0] + kekka_l[1][1] + kekka_l[2][2] == 3:
    b_flg = 1

if kekka_l[0][2] + kekka_l[1][1] + kekka_l[2][0] == 3:
    b_flg = 1

if b_flg == 1:
    print('yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import itertools
import numpy as np
a = [input().split() for i in range(3)]
n = int(input())
b = [input().split() for i in range(n)]
x = list(itertools.chain.from_iterable(a))

list1 = [x[0], x[1], x[2]]
list2 = [x[0], x[3], x[6]]
list3 = [x[0], x[4], x[8]]
list4 = [x[1], x[4], x[7]]
list5 = [x[2], x[5], x[8]]
list6 = [x[2], x[4], x[6]]
list7 = [x[3], x[4], x[5]]
list8 = [x[6], x[7], x[8]]

l1 = np.array(list1)
b1 = np.array(b)
x1 = list(itertools.chain.from_iterable(b1))
count = 0
for e1 in l1:
    if any(e1 in e2 for e2 in x1):
        count += 1
    else:
        count = count
if (count == 3):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import numpy as np
x = input()
y = input()
z = input()
xa = x.split(" ")
ya = y.split(" ")
za = z.split(" ")
A = np.array([xa,ya,za])
N = int(input())
b =[]
C = np.array([["Nomark", "Nomark", "Nomark"],["Nomark", "Nomark", "Nomark"],["Nomark", "Nomark", "Nomark"]])
for i in range(1,N+1):
    b.append(input())
for m in range(0,3):
    for n in range(0,3):
        if A[m, n] in b:
            C[m,n] = "Maru"
tate = str(np.count_nonzero(C == 'Maru', axis=0))

yoko = str(np.count_nonzero(C == 'Maru', axis=1))

if "3" in tate or "3" in yoko:
    print('Yes')
elif C[0,0] == "Maru" and C[1,1] == "Maru" and C[2,2] == "Maru":
    print("Yes")
elif C[0,2] == "Maru" and C[1,1] == "Maru" and C[2,0] == "Maru":
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
A1=[]
A2=[]
A3=[]


a11, a12, a13 = map(int,input().split())
A1.append(a11)
A1.append(a12)
A1.append(a13)

a21, a22, a23 = map(int,input().split())
A2.append(a21)
A2.append(a22)
A2.append(a23)

a31, a32, a33 = map(int,input().split())
A3.append(a31)
A3.append(a32)
A3.append(a33)

N = int(input())
for i in range(N):
    b = int(input())
    if b==A1[0]:
        A1[0] ="OK"
    if b==A1[1]:
        A1[1]="OK"
    if b==A1[2]:
        A1[2]="OK"
    if b==A2[0]:
        A2[0] ="OK"
    if b==A2[1]:
        A2[1]="OK"
    if b==A2[2]:
        A2[2]="OK"
    if b==A3[0]:
        A3[0] ="OK"
    if b==A3[1]:
        A3[1]="OK"
    if b==A3[2]:
        A3[2]="OK"

ans =" No"
if A1[0]==A1[1] and A1[0]==A1[2]:
    ans ="Yes"
if A2[0]==A2[1] and A2[0]==A2[2]:
    ans ="Yes"
if A3[0]==A3[1] and A3[0]==A3[2]:
    ans ="Yes"

if A1[0]==A2[0] and A1[0]==A3[0]:
    ans ="Yes"
if A1[1]==A2[1] and A1[1]==A3[1]:
    ans ="Yes"
if A1[2]==A2[2] and A1[1]==A3[1]:
    ans ="Yes"

if A1[0]==A2[1] and A1[0]==A3[2]:
    ans ="Yes"
if A1[2]==A2[1] and A1[2]==A3[0]:
    ans ="Yes"

print(ans)

Submission status: Wrong Answer

Solution code:
a = []
b = []
c = [[-1]*3]*3
for i in range(3):
    ai = list(map(int, input().split()))
    a.append(ai)
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:
                c[j][k] = 0

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

Submission status: Wrong Answer

Solution code:
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 = []
for i in range(N):
    b.append(int(input()))
A = [a_1,a_2,a_3]
c = []
c_1 = []
for i in range(3):
    for j in range(3):
        for k in b:
            if A[i][j] == k:
                c.append(i)
                c_1.append(j)
#print(c)
#print(c_1)
d_0 = c.count(0)
d_1 = c.count(1)
d_2 = c.count(2)
D = [d_0,d_1,d_2]
d_3 = c_1.count(0)
d_4 = c_1.count(1)
d_5 = c_1.count(2)
D_2 = [d_3,d_4,d_5]
if (str(0) not in str(D) and str(0) not in str(D_2)):
    y = c.index(1)
    u = c_1.index(1)
    if y != u:
        print("No")
    else:
        print("Yes")
elif (str(3) in str(D) or str(3) in str(D_2)):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
def checkBingo(bList):
    ret = "No"
    for i in range(3):
        for j in range(3):
            if bList[i][j] != -1:
                break
            ret = "Yes"
    for i in range(3):
        if bList[i][i] != -1:
            break
        ret = "Yes"
    for i in range(3):
        if bList[i][2-i] != -1:
            break
        ret = "Yes"
    return ret

def deleteNumber(bList, number):
    for i in range(3):
        for j in range(3):
            if bList[i][j] == number:
                bList[i][j] = -1

raw1 = map(int, input().split())
raw2 = map(int, input().split())
raw3 = map(int, input().split())
bingo = [list(raw1), list(raw2), list(raw3)]

n = int(input())
for i in range(n):
    number = int(input())
    deleteNumber(bingo, number)

print("{}".format(checkBingo(bingo)))