Problem: 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.

Submission attempts (in order):
import numpy as np
a = [[input().split() for l 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):
    print(a[i*3:(i*3)+2])
    if check(a[i*3:(i*3)+3],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)

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)

# 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 = '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 i in a[0:8:4] or i in a[2:6:2]:
        ans = 'Yes'
print(ans)

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)


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)


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)

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)

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

# ABC157 B
import numpy as np
a = [[input().split() for l 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)+3],b) or check(a[i:i+7:3],b) or check(a[0:9:4],b) or check(a[2:7:2],b):
        ans = 'Yes'

print(ans)

Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted