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:
seen = [0,0,0,0,0,0,0,0,0]
seen[0],seen[1],seen[2] = (map(int,input().split()))
seen[3],seen[4],seen[5] = (map(int,input().split()))
seen[6],seen[7],seen[8] = (map(int,input().split()))
over = False
N = int(input())
for x in range(N):
  num = int(input())
  print(num)
  if num in seen:
    seen[x] = "O"
print(seen)
if seen[0] == "O":
  if seen[1] == seen[2] == "O":
    over = True
  elif seen[3] == seen[6] == "O":
    over = True
  elif seen[4] == seen[8] == "O":
    over = True
elif seen[4] == "O":
  if seen[2] == seen[6] == "O":
    over = True
  elif seen[1] == seen[7] == "O":
    over = True
  elif seen[3] == seen[5] == "O":
    over = True
elif seen[8] == "O":
  if seen[6] == seen[7] == "O":
    over = True
  if seen[2] == seen[5] == "O":
    over = True
if not over:
  print("NO")
else:
  print("YES")

Submission status: Runtime Error

Solution code:
seen = [0,0,0,0,0,0,0,0,0]
seen[0],seen[1],seen[2] = (map(int,input().split()))
seen[3],seen[4],seen[5] = (map(int,input().split()))
seen[6],seen[7],seen[8] = (map(int,input().split()))
over = False
N = int(input())
for x in range(N):
  num = int(input())
  print(num)
  if num in seen:
    seen[x] = "O"
print(seen)
if seen[0] == "O":
  if seen[1] == seen[2] == "O":
    print("YES")
    over = True
  elif seen[3] == seen[6] == "O":
    print("YES")
    over = True
  elif seen[4] == seen[8] == "O":
    print("YES")
    over = True
elif seen[4] == "O":
  if seen[2] == seen[6] == "O":
    print("YES")
    over = True
  elif seen[1] == seen[7] == "O":
    print("YES")
    over = True
  elif seen[3] == seen[5] == "O":
    print("YES")
    over = True
elif seen[8] == "O":
  if seen[6] == seen[7] == "O":
    print("YES")
  if seen[2] == seen[5] == "O":
    print("YES")
  over = True
if not over:
  print("NO")

Submission status: Runtime Error

Solution code:
nums1 = list(map(int,input().split()))
nums2 = list(map(int,input().split()))
nums3 = list(map(int,input().split()))
seen = [nums1[0],nums1[1],nums1[2],nums2[0],nums2[1],nums2[2],nums3[0],nums3[1],nums3[2]]
over = False
N = int(input())
for x in range(N):
  num = int(input())
  print(num)
  if num in seen:
    seen[x] = "O"
print(seen)
if seen[0] == "O":
  if seen[1] == seen[2] == "O":
    print("YES")
    over = True
  elif seen[3] == seen[6] == "O":
    print("YES")
    over = True
  elif seen[4] == seen[8] == "O":
    print("YES")
    over = True
elif seen[4] == "O":
  if seen[2] == seen[6] == "O":
    print("YES")
    over = True
  elif seen[1] == seen[7] == "O":
    print("YES")
    over = True
  elif seen[3] == seen[5] == "O":
    print("YES")
    over = True
elif seen[8] == "O":
  if seen[6] == seen[7] == "O":
    print("YES")
  if seen[2] == seen[5] == "O":
    print("YES")
  over = True
if not over:
  print("NO")

Submission status: Runtime Error

Solution code:
nums1 = list(map(int,input().split()))
nums2 = list(map(int,input().split()))
nums3 = list(map(int,input().split()))
seen = [nums1[0],nums1[1],nums1[2],nums2[0],nums2[1],nums2[2],nums3[0],nums3[1],nums3[2]]
over = False
N = int(input())
for x in range(N):
  num = int(input())
  if num in seen:
    seen[x] = "O"
if seen[0] == "O":
  if seen[1] == seen[2] == "O":
    print("YES")
    over = True
  elif seen[3] == seen[6] == "O":
    print("YES")
    over = True
  elif seen[4] == seen[8] == "O":
    print("YES")
    over = True
elif seen[2] == "O":
  if seen[5] == seen[8] == "O":
    print("YES")
    over = True
  elif seen[4] == seen[6] == "O":
    print("YES")
    over = True
elif seen[8] == "O" == seen[7] == seen[6] or seen[3] == seen[4] == seen[5] == "O" or seen[1] == seen[4] == seen[7] == "O":
  print("YES")
  over = True
if not over:
  print("YES")

Submission status: Runtime Error

Solution code:
nums1 = list(map(int,input().split()))
nums2 = list(map(int,input().split()))
nums3 = list(map(int,input().split()))
seen = [nums1[0],nums1[1],nums1[2],nums2[0],nums2[1],nums2[2],nums3[0],nums3[1],nums3[2]]
over = False
N = int(input())
for x in range(N):
  num = int(input())
  if num in seen:
    seen[x] = "O"
if seen[0] == "O":
  if seen[1] == seen[2] == "O":
    print("YES")
    over = True
  elif seen[3] == seen[6] == "O":
    print("YES")
    over = True
  elif seen[4] == seen[8] == "O":
    print("YES")
    over = True
elif seen[2] == "O":
  if seen[5] == seen[8] == "O":
    print("YES")
    over = True
  elif seen[4] == seen[6] == "O":
    print("YES")
    over = True
elif seen[8] == "O" == seen[7] == seen[6]:
  print("YES")
  over = True
elif seen[3] == seen[4] == seen[5] == "O":
  print("YES")
  over = True
elif seen[1] == seen[4] == seen[7] == "O":
  print("YES")
  over = True
else:
  print("NO")
if not over:
  print("YES")

Submission status: Runtime Error

Solution code:
import math
a = [0]*3
for i in range(3):
    a[i] = list(map(int,input().split()))
n = int(input())
b = [0]*n
for i in range(n):
    b[i] = int(input())

for i in range(n):
    for j in range(3):
        for k in range(3):
            if a[j][k]==b[i]:
                a[j][k]=0
for i in range(3):
    if sum(a[i]) == 0:
        print("Yes")
        exit()
for i in range(3):
    if a[0][i]+a[1][i]+a[2][i] == 0 :
        print("Yes")
        exit()
if a[0][0]+a[1][1]+a[2][2] == 0:
    print("Yes")
    exit()
if a[0][2] + a[1][1] +a[2][0] == 0:
    print("Yes")
    eixt()
print("No")

Submission status: Runtime Error

Solution code:
import numpy as np

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

n = int(input())

b = list([int(input()) for _ in range(n)])

c = [[0]*3]*3

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

c = np.array(c)

if (max(c.sum(axis=0))==3) or (max(c.sum(axis=1))==3) or \
    (sum([a[i,i] for i in range(3)])==3) or (a[2,0]+a[1,1]+a[0,2]==3):
    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)]

n = int(input())

b = list([int(input()) for _ in range(n)])

c = [[0]*3]*3

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

c = np.array(c)

if (max(c.sum(axis=0))==3) or (max(c.sum(axis=1))==3) or \
    (sum([a[i,i] for i in range(3)])==3) or (sum(a[2,0]+a[1,1]+a[0,2])==3):
    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)]

# n = int(input())

# b = list([int(input()) for _ in range(n)])

c = [[0]*3]*3

for k in b:
#     print("k={}".format(k))
    for i in range(3):
        for j in range(3):
#             print("  a={}".format(a[i][j]))
            if k == a[i][j]:
                c[i][j]=1

c = np.array(c)

if (max(c.sum(axis=0))==3) or (max(c.sum(axis=1))==3) or \
    (sum([a[i,i] for i in range(3)])==3) or (sum(a[2,0]+a[1,1]+a[0,2])==3):
    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)]
hole = [[0]*3 for i in range(3)]
ans = "No" #初期値

print(A)
print(N)
print(b)
print(hole)
print(ans)


for i in range(3):
  for j in range(3):
    for k in range(N):
      if A[i][j] == b[k]:
        hole[i][j] = 1 #穴あけ
  if A[i] == [1, 1, 1]:
    ans = "Yes" #横ビンゴ、i個目の要素（配列）はそろうので判別できる

flag_diag1 = 1
flag_diag2 = 1
for j in range(3):
  flag_vert = 1 #列ごとに初期化
  for i in range(3):
    flag_vert *= hole[i][j] #3つとも1のときだけ1
  if flag_vert ==1:
    ans = "Yes" #縦ビンゴ
  flag_diag1 *= hole[j][j] #＼
  flag_diag2 *= hole[j][3-j] #／
if flag_diag1 == 1 or flag_diag2 == 1:
  ans = "Yes" #斜めビンゴ
  
print(ans)

Submission status: Runtime Error

Solution code:
A = [[j for j in list(map(int, input().split()))] for i in range(3)]
N = int(input())
B = []
for _ in range(N):
	b = int(input())
	for r in A:
		for i in range(len(r)):
			if r[i] == b:
				r[i] = 0
ans = False
for i in range(3):
	if sum(A[i]) == 0:
		ans = True
if not ans:
	for i in range(3):
		if A[0][i] + A[1][i] + A[2][i == 0:
			ans = True
if not ans:
	if A[0][0] + A[1][1] + A[2][2] == 0:
		ans = True
	elif A[0][2] + A[1][1] + A[2][0] == 0:
		ans = True
if ans:
	print('Yes')
else:
	print('No')

Submission status: Runtime Error

Solution code:
from itertools import combinations

a = [mapt(int, input().split(" ")) for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]
a.append((a[0][0], a[1][1], a[2][2]))

combinated = [sorted(i) for i in list(combinations(b, 3))]
a = [sorted(i) for i in a]

print("Yes" if any([bingo in combinated for bingo in a]) else "No")

Submission status: Runtime Error

Solution code:
import numpy as np

side = 3
A = [[0]*side]*side

for i in range(side):
    for j in range(side):
        A[i][j] = (int(x) for x in input().split())

N = input().split()

b = []
for i in range(N):
    b.append(int(x) for x in input().split())

ans="No"
for i in range(side):
    temp = A[i][0]
    if temp == A[i][1] & temp == A[i][2]:
        ans="Yes"

for j in range(side):
    temp = A[0][j]
    if temp == A[1][j] & temp == A[2][j]:
        ans="Yes"


if (A[0][0] == A[1][1]) & A[1][1] == A[2][2]:
    ans="Yes"

if (A[2][0] == A[1][1]) & A[1][1] == A[0][2]:
    ans = "Yes"

print(ans)

Submission status: Runtime Error

Solution code:
import numpy as np

side = 3
A = [[0]*side]*side

for i in range(side):
    for j in range(side):
        A[i][j] = (int(x) for x in input().split())

N = input().split()

b = []
for i in range(N):
    b.append(int(x) for x in input().split())


for i in range(side):
    temp = A[i][0]
    if temp == A[i][1] & temp == A[i][2]:
        print("Yes")
        exit(0)

for j in range(side):
    temp = A[0][j]
    if temp == A[1][j] & temp == A[2][j]:
        print("Yes")
        exit(0)


if (A[0][0] == A[1][1]) & A[1][1] == A[2][2]:
    print("Yes")
    exit(0)

if (A[2][0] == A[1][1]) & A[1][1] == A[0][2]:
    print("Yes")
    exit(0)


print("No")

Submission status: Runtime Error

Solution code:
#include<iostream>
using namespace std;
int main()
{
  int a[3][3],i,j,n,*b,flag,sum,index;
  
  for(i=0;i<3;i++)
   for(j=0;j<3;j++)
    cin>>a[i][j];
    
  cin>>n;
  b = new int[n];
  
  for(i=0;i<n;i++)
   cin>>b[i];
   
  for(index = 0; index<n;index++)
  {
	  
	  flag=0;
	  for(i=0;i<3&&!flag;i++)
	  {
		  for(j=0;j<3;j++)
		  {
			
			if(a[i][j]==b[index])
			 {
				 a[i][j]=0;
				 flag = 1;
				 break;
			 }  
		  }
	  }
  }
  flag=0;
  for(i=0;i<3;i++)
  {
	 sum=0;
	 for(j=0;j<3;j++)
	 {
		 sum+=a[i][j];
	 }
	 if(sum==0)
	 {cout<<"yes";flag=1;break;}
  }
  if(!flag)
  {
	for(i=0;i<3;i++)
    {
		 sum=0;
		 for(j=0;j<3;j++)
		 {
			 sum+=a[j][i];
		 }
		 if(sum==0)
		 {cout<<"yes";flag=1;break;}
    }
  }
  if(!flag)cout<<"no";
  
}

Submission status: Runtime Error

Solution code:
ls=[]
for i in range(3):
    ls1=list(map(int,input().split()))
    ls.append(list(ls1))
    ls1.clear()
print(ls)
N=int(input())
for i in range(N):
    b = int(input())
    for j in range(3):
        for l in range(3):
        if ls[l][j] == b:
            ls[l][j] = -1
for i in range(3):
    if ls[i][0] == ls[i][1] == ls[i][2] == -1:
        print("Yes")
        break
    elif ls[0][i] == ls[1][i] == ls[2][i] == -1:
        print("Yes")
        break
    elif ls[0][0] == ls[1][1] == ls[2][2] == -1:
        print("Yes")
        break
    elif ls[0][2] == ls[1][1] == ls[2][0] == -1:
        print("Yes")
        break
    print("No")

Submission status: Runtime Error

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

ans = 'No'
def check(a,b):
    return set(a).issubset(b)

for i in range(3):
    if check(a[i*3:i*3+2],b) or check(a[i:i+6:3],b) or check(a[0:8:4],b) or check(a[2:6:2],b):
        ans = 'Yes'

print(ans)

Submission status: Runtime Error

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

ans = 'No'
def check(a,b):
    return set(a).issubset(b)

for i in range(3):
    if check(a[j*3:j*3+2],b) or check(a[j:j+6:3],b) or check(a[0:8:4],b) or check(a[2:6:2],b):
        ans = 'Yes'

print(ans)

Submission status: Runtime Error

Solution code:
import numpy as np
a = [list(input()) for i in range(3)]
a = np.ravel(a)
n = int(input())
b = [input() for i in range(n)]
ans = 'No'
for i in b:
    for j in range(3):
        if i in a[j*3:j*3+2] or i in a[j:j+6:3]:
            ans = 'Yes'
if b in a[0:8:4] or b in a[2:6:2]:
    ans = 'Yes'
print(ans)

Submission status: Runtime Error

Solution code:
# ABC157 B
import numpy as np
a = [list(input()) for i in range(3)]
a = np.ravel(a)
n = int(input())
b = [input() for i in range(n)]
ans = 'Yes'
for i in range(3):
    if b not in a[i*3:i*3+2] or b not in a[i:i+6:3] or b not in a[0:8:4] or b not in a[2:6:2]:
        ans = 'No'
print(ans)

Submission status: Runtime Error

Solution code:
import numpy as np
a = [list(input()) for i in range(3)]
a = np.ravel(a)
n = int(input())
b = [input() for i in range(n)]
ans = 'No'
for i in range(3):
    if b == a[i*3:i*3+2] or b == a[i:i+6:3] or b == a[0:8:4] or b == a[2:6:2]:
        ans = 'Yes'
print(ans)

Submission status: Runtime Error

Solution code:
import numpy as np
a = [list(input()) for i in range(3)]
a = np.ravel(a)
n = int(input())
b = [input() for i in range(n)]
ans = 'No'
for i in range(3):
    if b in a[i*3:i*3+2] or b in a[i:i+6:3] or b in a[0:8:4] or b in a[2:6:2]:
        ans = 'Yes'
print(ans)

Submission status: Runtime Error

Solution code:
a1=input("").split(" ")
a2=input("").split(" ")
a3=input("").split(" ")
lista=[]
listmp=[]
for k in range(3):
    listmp+=[int(a1[i])]
lista+=[listmp]
listmp=[]
for k in range(3):
    listmp+=[int(a2[i])]
lista+=[listmp]
listmp=[]
for k in range(3):
    listmp+=[int(a3[i])]
lista+=[listmp]
n=int(input(""))
listn=[]
for i in range(n):
    t=int(input(""))
    listn+=[t]
for i in range(3):
    for k in range(3):
        if(lista[i][k] in listn):
            lista[i][k]=0
p=0
for i in range(3):
    s=0
    for k in range(3):
        s+=lista[i][k]

        if(s==0):
            p=1
for i in range(3):
    s=0
    for k in range(3):
        s+=lista[k][i]

        if(s==0):
            p=1
s=0
for i in range(3):
    s+=lista[i][i]
if(s==0):
    p=1
s=0
for i in range(3):
    s+=lista[i][2-i]
if(s==0):
    p=1
if(p==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 = []
for j in range(N):
    b = int(input())
    B.append(b)
A = np.array(A)
B = np.array(B)
boolean_matrix = np.isin(A, B)
if boolean_matrix.sum(axis=1).max() >= 3 or \
boolean_matrix.sum(axis=0).max() >= 3 or \
np.diag(boolean_matrix).sum() >= 3 or \
np.diag(np.fliplr(boolean_matrix)).sum() >= 3:
    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 = []
for j in range(N):
    b = int(input())
    B.append(b)
A = np.array(A)
B = np.array(B)
boolean_matrix = np.isin(A, B)
if boolean_matrix.sum(axis=1).max() >= 3 or boolean_matrix.sum(axis=0).max() >= 3 or np.diag(boolean_matrix).sum() >= 3 or np.diag(np.fliplr(boolean_matrix)).sum() >= 3:
    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 = []
for j in range(N):
    b = int(input())
    B.append(b)
A = np.array(A)
B = np.array(B)
boolean_matrix = np.isin(A, B)
if boolean_matrix.sum(axis=1).max() >= 3 or \
   boolean_matrix.sum(axis=0).max() >= 3 or \
   np.diag(boolean_matrix).sum() >= 3 or \
   np.diag(np.fliplr(boolean_matrix)).sum() >= 3:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

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

for i in range(3):
  for j in range(3):
    for k in range(N):
      if l[i][j] == q[k]:
        l[i][j] == 0
        
      if l[0][0] == 0 and l[0][1] == 0 and l[0][2] == 0:
        print('Yes')
        exit()
      elif l[1][0] == 0 and l[1][1] == 0 and l[1][2] == 0:
        print("Yes")
        exit()
      elif l[2][0] == 0 and l[2][1] == 0 and l[2][2] == 0:
        print("Yes")
        exit()
      elif l[0][0] == 0 and l[1][1] == 0 and l[2][2] == 0:
        print("Yes")
        exit()
      elif l[0][2] == 0 and l[1][1] == 0 and l[2][0] == 0:
        print("Yes")
        exit()
      elif l[0][0] == 0 and l[1][0] == 0 and l[2][0] == 0:
        print("Yes")
        exit()
      elif l[0][1] == 0 and l[1][1] == 0 and l[2][1] == 0:
        print("Yes")
        exit()
      elif l[0][2] == 0 and l[1][2] == 0 and l[2][2] == 0:
        print("Yes")
        exit()
      
print('No')

Submission status: Runtime Error

Solution code:
A=[]
i=0
for l in range(3):
    A.append(list(map(int,input().split())))
N=int(input())
B = [int(input()) for i in range(N)]
for C in B:
    for a in range(3):
        for b in range(3):
            if C==A[a][b]:
                A[a][b]=-1

for a in range(3):
    for b in range(3):
        if A[a][b]==A[-a-1][b]==A[-a-2][b]==-1:
            print("Yes")
            i=1
            break
        elif A[a][b]==A[a][-b-1]==A[a][-b-2]==-1:
            print("Yes")
            i=1
            break
        elif A[1][1]==A[2][2]==A[0][0]==-1:
            print("Yes")
            i=1
            break
        elif A[0][2]==A[1][1]==A[2][0]==-1:
            print("Yes")
            i=1
            break
    if i==1:
        break
if i==0:
    print("No")

Submission status: Runtime Error

Solution code:
bingo_list = [list(map(int,input().split())) for i in range(3)]
bingo_list = sum(bingo_list,[])
n = int(input())
bingo_number = [int(input())for i in range(n)]
check_list = [0 for i in range(9)]

for j in bingo_number:
    if j in bingo_list:
        check_list[bingo_list.index(j)] = 1

if [1,1,1] in [check_list[:3],check_list[3:6],check_list[6:],check_list[0:7:3],check_list[1:8:3]check_list[2:9:3],check_list[0:9:4],check_list[2:8:2]]:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
bingo_list = [list(map(int,input().split())) for i in range(3)]
bingo_list = sum(bingo_list,[])
n = int(input())
bingo_number = [int(input())for i in range(n)]
check_list = [0 for i in range(9)]

for j in bingo_number:
    if j in bingo_list:
        check_list[bingo_list.index(j)] = 1

if [1,1,1]in [check_list[:3],check_list[3:6],check_list[6:],check_list[0:7:3],check_list[1:8:3]check_list[2:9:3],check_list[0:9:4],check_list[2:7:2]]:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
bingo_list = [list(map(int,input().split())) for i in range(3)]
bingo_list = sum(bingo_list,[])
n = int(input())
bingo_number = [int(input())for i in range(n)]
check_list = [0 for i in range(9)]

for j in bingo_number:
    if j in bingo_list:
        check_list[bingo_list.index(j)] = 1

if [1,1,1]in [check_list[:3],check_list[3:6],check_list[6:],
             check_list[0:7:3],check_list[1:8:3]check_list[2:9:3],
             check_list[0:9:4],check_list[2:7:2]]:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
void print() {
    cout << endl;
}
template <class Head, class... Tail>
void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail) != 0)
        cout << " ";
    print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T> &vec) {
    for (auto &a : vec) {
        cout << a;
        if (&a != &vec.back())
            cout << " ";
    }
    cout << endl;
}
template <class T>
void print(vector<vector<T>> &df) {
    for (auto &vec : df) {
        print(vec);
    }
}
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define xrep(i, a, b) for (int i = int(a); i < int(b); ++i)
using ll = long long;
const int INF = 100100100;

vector<vector<int>> A(3);

bool bingo(vector<int> B) {
    int cnt1 = 0;
    for(int b: B) {
        rep(y, 3) {
            rep(x, 3) {
                if(A[y][x]==b) {
                    ++cnt1;
                }
            }
        }
    }
    if(cnt1==3) return true;
    int cnt2 = 0;
    for(int b: B) {
        rep(y, 3) {
            rep(x, 3) {
                if(A[x][y]==b) {
                    ++cnt2;
                }
            }
        }
    }
    if(cnt2==3) return true;
    int cnt3 = 0;
    for(int b: B) {
        rep(i, 3) {
            if(b==A[i][i]) ++cnt3;
        }
    }
    if(cnt3==3) {
        return true;
    }

    int cnt4 = 0;
    for(int b: B) {
        rep(i, 3) {
            if(b==A[2-i][i]) ++cnt4;
        }
    }
    if(cnt4==3) {
        return true;
    }
    return false; 
}

int main() {
    vector<int> row(3);
    rep(i, 3) {
        rep(j, 3) {
            cin >> row[j];
        }
        A[i] = row;
    }
    int N;
    cin >> N;
    vector<int> B(N);
    rep(i, N) {
        cin >> B[i];
    }

    bool flag = bingo(B);

    if(flag) {
        print("Yes");
    }
    else {
        print("No");
    }



    return 0;
}

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 = []

for i in range(1,n + 1):
    bc = int(input())
    b.append(bc)

for i in range(n):
    for m in range(3):
        if a1[m] == b[i]:
            a1[m] = 0
        elif a2[m] == b[i]:
            a2[m] = 0
        elif a3[m] == b[i]:
            a3[m] = 0

for i in range(3):
    if a1[i] == 0 and a2[i] == 0 and a3[i] == 0:
        print('縦')
        exit()

if a1.count(0) == 3 or a2.count(0) ==3 or a3.count(0) == 3:
    print('横')
    exit()

if a2[2] == 0:
    if a1[1] == 0 and a3[3] == 0 or a3[1] ==0 and a1[3] == 0:
        print('斜め')
        exit()

print('No')

Submission status: Runtime Error

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

val = 0
flag = False

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

val = 0
for i in range(3):
    val += A[i]
if val == 0:
    flag = True

val = A[0][2] + A[1][1] + A[2][0]
if val == 0:
    flag = True

for i in range(3):
    if sum(A[i]) == 0:
        flag = True
    
    val = 0
    for j in range(3):
        val += A[j][i]
    if val == 0:
        flag = True

if flag == True:
    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())

val = 0
flag = False

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

val = 0
for i in range(3):
    val += A[i]
if val == 0:
    flag True

val = A[0][2] + A[1][1] + A[2][0]
if val == 0:
    flag = True

for i in range(3):
    if sum(A[i]) == 0:
        flag = True
    
    val = 0
    for j in range(3):
        val += A[j][i]
    if val == 0:
        flag = True

if flag == True:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
import numpy as np
a = []
for i in range(3):
    a.append(list(map(int, input().split())))
a = np.array(a)
for i in range(int(input())):
    try:
        x, y = np.argwhere(a==int(input()))[0]
        a[x][y] = 0
    except: pass
a = a.tolist()
def check(a):
    for i in range(3):  
        sumRow = 0;  
        for j in range(3):  
            sumRow = sumRow + a[i][j];  
        if sumRow == 0: 
            print("Yes")
            return
    #Calculates sum of each column of given matrix  
    for i in range(3):  
        sumCol = 0;  
        for j in range(3):  
            sumCol = sumCol + a[j][i];  
        if sumCol == 0:
            print("Yes")
            return 
  
    principal = 0
    secondary = 0
    for i in range(3):  
        principal += a[i][i] 
        secondary += a[i][3 - i - 1] 

    if principal == 0 or secondary == 0:
        print("Yes")
        return 

    print("No")


check(a)

Submission status: Runtime Error

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

N = int(input())

B = [int(input()) for i in range(N)]

C = [[0,0,0],[0,0,0],[0,0,0]]
Ans = "No"

for i in range(3):
    for j in range(3):
        if A[i][j] in B:         #AijはリストBに含まれるかどうか
            C[i][j] = 1

for i in range(3):
    if C[i][1]+C[i][2]+C[i][3] == 3:
        Ans ="Yes"

for i in range(3):
    if C[1][i]+C[2][i]+C[3][i] == 3:
        Ans ="Yes"
        
if C[1][1]+C[2][2]+C[3][2] == 3 or C[1][3]+C[2][2]+C[3][1] == 3:
    Ans = "Yes"
    
print(Ans)

Submission status: Runtime Error

Solution code:
def resolve():
    A = [list(map(int, input().split())) for _ in range(3)]
    N = int(input())
    B = [int(input()) for _ in range(N)]
    punch = [[False for _ in range(3)] for _ in range(3)]
    for i in range(3):
        for j in range(3):
            if A[i][j] in B:
                punch[i][j] = True
    print(punch, file=sys.stderr)
    ans = "No"
    for i in range(3):
        if False not in punch[i]:
            ans = "Yes"
            break
        for j in range(3):
            if not punch[j][i]:
                break
        else:
            ans = "Yes"
            break
    if (punch[0][0] and punch[1][1] and punch[2][2]) or (
            punch[0][2] and punch[1][1] and punch[2][0]):
        ans = "Yes"
    print(ans)


resolve()

Submission status: Runtime Error

Solution code:
a=[]
for i in range(3):
    a.append(list(map(int,input().split())))
n=input()
for i in range(n):
    b=int(input())
    for j in range(3):
        for k in range(3):
            if a[i][j]==b:
                a[i][j]=0

ans=0
for l in range(3):
    if a[l][0]==0 and a[l][1]==0 and a[l][2]==0:
        ans=1
        break
    elif a[0][l]==0 and a[1][l==0 and a[2][l]==:
        ans=1
        break

if ans==1:
    print("Yes")
elif a[1][1]==0 and a[2][2]==0 and a[0][0]==0:
    print("Yes")
elif a[0][2]==0 and a[1][1]==0 and a[2][0]==0:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
def main():
    top = list(map(int, input().split()))
    middle = list(map(int, input().split()))
    bottom = list(map(int, input().split()))
    N = int(input())
    taken = []
    for i in range(N):
        taken.append(int(input()))
    
    bingo = []
    bingo.append(top)
    bingo.append(middle)
    bingo.append(bottom)
    temp = [top[0], middle[0], bottom[0]]
    bingo.append(temp)
    temp = [top[1], middle[1], bottom[1]]
    bingo.append(temp)
    temp = [top[2], middle[2], bottom[2]]
    bingo.append(temp)
    temp = [top[0], middle[1], bottom[2]]
    bingo.append(temp)
    temp = [top[2], middle[1], bottom[0]]
    bingo.append(0)
 
 
    cnt = 0
    flag = 0
    for i in range(len(bingo)):
        cnt = 0
        for j in range(len(bingo[i])):
            if bingo[i][j] in taken:
                cnt += 1
        if cnt == 3:
            flag += 1
    
    if flag > 0:
        print('Yes')
    else:
        print('No')
main()

Submission status: Runtime Error

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

card = [[0] * 3 for _ in range(3)]
for i in range(3):
    for j in range(3):
        if a[i][j] == b_list:
            card[i][j] = 1

for i in range(3):
    if card[i][:] == [1,1,1] or card[:][i] == [1,1,1]:
        print('Yes')
        exit()
if sum([card[0][0], card[1][1], card[2][2]]) == 3 or sum([card[0][2], card[1][1], card[2][0]) == 3:
    print('Yes')
    exit()
print('No')

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def main():
    import math
    a = list(map(int,input().split()))
    b = list(map(int,input().split()))
    c = list(map(int,input().split()))
    d = [a[0],b[0],c[0]]
    e = [a[1],b[1],c[1]]
    f = [a[2],b[2],c[2]]
    g = [a[0],b[1],c[2]]
    h = [a[2],b[1],c[0]]
    n = int(input())
    listB = [int(input()) for x in range(n)]
    C = itertools.combinations(listB,3)
    if a in C or b in C or c in C or d in C or e in C or f in C or g in C or h in C:
      print("Yes")
    else:
      print("No")
main()

Submission status: Runtime Error

Solution code:
al = [list(map(int, input().split())) for i in range(3)]
al = sum(a, [])
n = int(input())
bl = [int(input()) for i in range(n)]
check = [0 for i in range(9)]

for b in bl:
    if b in al:
        check[al.index(b)] = 1

if [1,1,1] in [check[:3], check[3:6], check[6:], check[0:7:3], check[1:8:3], check[2:9:3], check[0:9:4], check[3:8:2]]:
    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(10)]

c = [[0 for _ in range(3)] for _ in range(3)]
result = ""

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

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

if c[0][0] == c[1][1] == c[2][2] == 1:
    result = "Yes"
elif c[0][2] == c[1][1] == c[2][0] == 1:
    result = "Yes"

if result == "":
    result ="No"

print(result)

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

c = [[0 for _ in range(3)] for _ in range(3)]
result = ""

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

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

if c[0][0] == c[1][1] == c[2][2] == 1:
    result = "Yes"
elif c[0][2] == c[1][1] == c[2][0] == 1:
    result = "Yes"

if result is None:
    result ="No"

print(result)