TnT/Multi_CodeNet4Repair huggingface dataset:
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 sys
import numpy as np

lines = sys.stdin.readlines()
bingo_card = np.zeros([3,3])
for i, l in enumerate(input()):
    if i <= 2:
        bingo_card[i] = [int(num) for num in l.split()]
    else:
        bingo_card[bingo_card == int(l)] = None
        
check_arr = np.isnan(bingo_card)
if check_arr[0].sum() == 3 or check_arr[1].sum() == 3 or check_arr[2].sum() == 3:
    print('Yes')
elif check_arr[:, 0].sum() == 3 or check_arr[:, 1].sum() == 3 or check_arr[:, 2].sum() == 3:
    print('Yes')
elif check_arr[0,0] and check_arr[1,1] and check_arr[2,2]:
    print('Yes')
elif check_arr[0,2] and check_arr[1,1] and check_arr[2,0]:
    print('Yes')
else:
    print('No')

import sys
import numpy as np

lines = sys.stdin.readlines()
bingo_card = np.zeros([3,3])
for i, l in enumerate(lines):
    if i <= 2:
        bingo_card[i] = [int(num) for num in l.split()]
    else:
        bingo_card[bingo_card == int(l)] = None
        
check_arr = np.isnan(bingo_card)
if check_arr[0].sum() == 3 or check_arr[1].sum() == 3 or check_arr[2].sum() == 3:
    print('Yes')
elif check_arr[:, 0].sum() == 3 or check_arr[:, 1].sum() == 3 or check_arr[:, 2].sum() == 3:
    print('Yes')
elif check_arr[0,0] and check_arr[1,1] and check_arr[2,2]:
    print('Yes')
elif check_arr[0,2] and check_arr[1,1] and check_arr[2,0]:
    print('Yes')
else:
    print('No')


Verdicts: Runtime Error

Accepted
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):
60 88 34
92 41 43
65 73 48
10
60
43
88
11
48
73
65
41
92
34

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

for _ in range(n):
  b = int(input())
  for y in range(3):
    for x in range(3):
      if a[y][x] == b:
        a[y][x] = -1

for y in range(3):
  f = True
  for x in range(3):
    if a[y][x] != -1:
      f = False
  if f:
    print('Yes')
    exit()
    
for x in range(3):
  f = True
  for y in range(3):
    if a[y][x] != -1:
      f = False
  if f:
    print('Yes')
    exit()
    
f = True
for x in range(3):
  if a[x][x] != -1:
    f = False
if f:
  print('Yes')
  exit()
  
f = True
for x in range(3):
  if a[x][2-x] != -1:
    f = False
if f:
  print('Yes')
  exit()
  
print('No')

Verdicts: Runtime Error

Accepted
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 sys
#n=int(input())
#l = list(map(int,input().split()))
#a,b,c = map(int,input().split())

ly = []

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

lt = []

for i in range(3):
    l = []
    for j in range(3):
        l.append(ly[j][i])
    lt.append(l)

l = ly+lt + [[ly[0][0],ly[1][1],lt[2][2]]] + [[ly[0][2],ly[1][1],ly[2][0]]]
print(l)

n = int(input())
nm = []
for i in range(n):
    s = int(input())
    nm.append(s)

for i in l:
    t = [0,0,0]
    if i [0] in nm:
        t[0] = 1
    if i [1] in nm:
        t[1] = 1
    if i [2] in nm:
        t[2] = 1
    if sum(t) == 3:
        print("Yes")
        sys.exit()
print("No")

import sys
#n=int(input())
#l = list(map(int,input().split()))
#a,b,c = map(int,input().split())

ly = []

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

lt = []

for i in range(3):
    l = []
    for j in range(3):
        l.append(ly[j][i])
    lt.append(l)

l = ly+lt + [[ly[0][0],ly[1][1],lt[2][2]]] + [[ly[0][2],ly[1][1],ly[2][0]]]

n = int(input())
nm = []
for i in range(n):
    s = int(input())
    nm.append(s)

for i in l:
    t = [0,0,0]
    if i [0] in nm:
        t[0] = 1
    if i [1] in nm:
        t[1] = 1
    if i [2] in nm:
        t[2] = 1
    if sum(t) == 3:
        print("Yes")
        sys.exit()
print("No")

Verdicts: Wrong Answer

Accepted
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):
A=[]
for i in range(3):
    A.append(list(map(int,input().split())))
N=int(input())
for i in range(N):
    b=int(input())
    for ii in range(3):
        for iii in range(3):
            if A[ii][iii]==b:
                A[ii][iii]=0
print(A)
flag=False
for i in range(3):
    if A[i][:]==[0,0,0]:
        flag=True
    elif A[0][i]==0:
        if A[1][i]==0 and A[2][i]==0:
            flag=True
    elif A[1][1]==0:
        if A[0][2]==0 and A[2][0]==0:
            flag=True
        elif A[0][0]==0 and A[2][2]==0:
            flag=True
if flag:
    print('Yes')
else:
    print('No')

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

A=[]
for i in range(3):
    A.append(list(map(int,input().split())))
N=int(input())
for i in range(N):
    b=int(input())
    for ii in range(3):
        for iii in range(3):
            if A[ii][iii]==b:
                A[ii][iii]=0

flag=False
for i in range(3):
    if A[i][:]==[0,0,0]:
        flag=True
    elif A[0][i]==0 and A[1][i]==0 and A[2][i]==0:
        flag=True
    elif A[1][1]==0:
        if A[0][2]==0 and A[2][0]==0:
            flag=True
        elif A[0][0]==0 and A[2][2]==0:
            flag=True
if flag:
    print('Yes')
else:
    print('No')

Verdicts: Wrong Answer

Wrong Answer

Accepted
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):
l=[]
for i in range(3):
  l.append(list(map(int,input().split())))
n=int(input())
l1=[]
for i in range(n):
  l1.append(int(input())
for i in range(len(l)):
    for j in range(len(l)):
        if(l[i][j] in l1):
            l[i][j]=0
f=0
if((l[0][0]==0 and l[0][1]==0 and l[0][2]==0) or (l[1][0]==0 and l[1][1]==0 and l[1][2]==0) or (l[2][0]==0 and l[2][1]==0 and l[2][2]==0))
    f=1
elif((l[0][0]==0 and l[1][0]==0 and l[2][0]==0) or (l[0][1]==0 and l[1][1]==0 and l[2][1]==0) or (l[0][2]==0 and l[1][2]==0 and l[2][2]==0))
    f=1
elif((l[0][0]==0 and l[1][1]==0 and l[2][2]==0) or (l[0][2]==0 and l[1][1]==0 and l[2][0]==0)):
    f=1
if(f==1):
    print("Yes")
else:
    print("No")

l=[]
for i in range(3):
  l.append(list(map(int,input().split())))
n=int(input())
l1=[]
for i in range(n):
  l1.append(int(input()))
for i in range(len(l)):
    for j in range(len(l)):
        if(l[i][j] in l1):
            l[i][j]=0
f=0
if((l[0][0]==0 and l[0][1]==0 and l[0][2]==0) or (l[1][0]==0 and l[1][1]==0 and l[1][2]==0) or (l[2][0]==0 and l[2][1]==0 and l[2][2]==0)):
    f=1
elif((l[0][0]==0 and l[1][0]==0 and l[2][0]==0) or (l[0][1]==0 and l[1][1]==0 and l[2][1]==0) or (l[0][2]==0 and l[1][2]==0 and l[2][2]==0)):
    f=1
elif((l[0][0]==0 and l[1][1]==0 and l[2][2]==0) or (l[0][2]==0 and l[1][1]==0 and l[2][0]==0)):
    f=1
if(f==1):
    print("Yes")
else:
    print("No")

Verdicts: Runtime Error

Accepted
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):
card = [[int(x) for x in input().split()] for y in range(3)]
bools = [[0,0,0],[0,0,0],[0,0,0]]
n = int(input())
for _ in range(n):
  x = int(input())
  for i in range(3):
    for j in range(3):
      if x == card[i][j]:
        bools[i][j] = 1
ok = False
for i in range(3):
  if (bools[i][0], bools[i][1], bools[i][2]) == (1,1,1) or 
  (bools[0][i], bools[1][i], bools[2][i]) == (1,1,1):
    ok = True
if (bools[0][0],bools[1][1],bools[2][2]) == (1,1,1) or (bools[0][2], bools[1][1], bools[2][0]) == (1,1,1):
  ok = True
print("Yes" if ok else "No")

card = [[int(x) for x in input().split()] for y in range(3)]
bools = [[0,0,0],[0,0,0],[0,0,0]]
n = int(input())
for _ in range(n):
  x = int(input())
  for i in range(3):
    for j in range(3):
      if x == card[i][j]:
        bools[i][j] = 1
ok = False
for i in range(3):
  if (bools[i][0], bools[i][1], bools[i][2]) == (1,1,1) or (bools[0][i], bools[1][i], bools[2][i]) == (1,1,1):
    ok = True
if (bools[0][0],bools[1][1],bools[2][2]) == (1,1,1) or (bools[0][2], bools[1][1], bools[2][0]) == (1,1,1):
  ok = True
print("Yes" if ok else "No")

Verdicts: Runtime Error

Accepted
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):
a1=input().split()
a2=input().split()
a3=input().split()
A=[a1,a2,a3]
b=[int(input()) for i in range(int(input()))]
if a1[0] and a1[1] and a1[2] in b:
    print("Yes")
elif a2[0] and a2[1] and a2[2] in b:
    print("Yes")
elif a3[0] and a3[1] and a3[2] in b:
    print("Yes")
elif a1[0] and a2[0] and a3[0] in b:
    print("Yes")
elif a1[1] and a2[1] and a3[1] in b:
    print("Yes")
elif a1[2] and a2[2] and a3[2] in b:
    print("Yes")
elif a1[0] and a2[1] and a3[2] in b:
    print("Yes")
elif a1[2] and a2[1] and a3[0] in b:
    print("Yes")
else:
    print("No")


a1=input().split()
a2=input().split()
a3=input().split()
A=[a1,a2,a3]
b=[int(input()) for i in range(int(input()))]
if a1[0] and a1[1] and a1[2] in b:
    print("Yes")
elif a2[0] and a2[1] and a2[2] in b:
    print("Yes")
elif a3[0] and a3[1] and a3[2] in b:
    print("Yes")
elif a1[0] and a2[0] and a3[0] in b:
    print("Yes")
elif a1[1] and a2[1] and a3[1] in b:
    print("Yes")
elif a1[2] and a2[2] and a3[2] in b:
    print("Yes")
elif a1[0] and a2[1] and a3[2] in b:
    print("Yes")
elif a1[2] and a2[1] and a3[0] in b:
    print("Yes")
else:
    print("No")


a1=input().split()
a2=input().split()
a3=input().split()
A=[a1,a2,a3]
b=int(input()) for i in range(int(input()))
if a1[0] and a1[1] and a1[2] in b:
    print("Yes")
elif a2[0] and a2[1] and a2[2] in b:
    print("Yes")
elif a3[0] and a3[1] and a3[2] in b:
    print("Yes")
elif a1[0] and a2[0] and a3[0] in b:
    print("Yes")
elif a1[1] and a2[1] and a3[1] in b:
    print("Yes")
elif a1[2] and a2[2] and a3[2] in b:
    print("Yes")
elif a1[0] and a2[1] and a3[2] in b:
    print("Yes")
elif a1[2] and a2[1] and a3[0] in b:
    print("Yes")
else:
    print("No")

def main():
    a = [input().split() for _ in range(3)]
    ans = [[0] * 3 for _ in range(3)]
    n = int(input())
    b = [input() for _ in range(n)]

    for bi in b:
        for y in range(3):
            for x in range(3):
                if bi == a[y][x]:
                    ans[y][x] = 1

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


if __name__ == '__main__':
    main()



Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Accepted
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):
A = [[0 for i in range(3)]for i2 in range(3)]
c = [[False for i in range(3)]for i2 in range(3)]
A[0] = list(map(int,input().rstrip().split(" ")))
A[1] = list(map(int,input().rstrip().split(" ")))
A[2] = list(map(int,input().rstrip().split(" ")))
int_inp = int(input())
s = 0
for i in range(int_inp):
  s = int(input())
  for i2 in range(9):
    for A[int(i2 / 3)][i2 % 3] == s:
      c[int(i2 / 3)][i2 % 3] == True
ans = False
for i in range(3):
  if c[i][0] and c[i][1] and c[i][2]:ans = True
for i in range(3):
  if c[0][i] and c[1][i] and c[2][i]:ans = True
if c[0][0] and c[1][1] and c[2][2]:ans = True
if c[2][0] and c[1][1] and c[0][2]:ans = True
if ans:
  print('Yes')
else:
  print('No')

A = [[0 for i in range(3)]for i2 in range(3)]
c = [[False for i in range(3)]for i2 in range(3)]
A[0] = list(map(int,input().rstrip().split(" ")))
A[1] = list(map(int,input().rstrip().split(" ")))
A[2] = list(map(int,input().rstrip().split(" ")))
int_inp = int(input())
s = 0
for i in range(int_inp):
  s = int(input())
  for i2 in range(9):
    if A[int(i2 / 3)][i2 % 3] == s:
      c[int(i2 / 3)][i2 % 3] = True
ans = False
for i in range(3):
  if c[i][0] and c[i][1] and c[i][2]:ans = True
for i in range(3):
  if c[0][i] and c[1][i] and c[2][i]:ans = True
if c[0][0] and c[1][1] and c[2][2]:ans = True
if c[2][0] and c[1][1] and c[0][2]:ans = True
if ans:
  print('Yes')
else:
  print('No')

Verdicts: Runtime Error

Accepted
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):
#! env/bin/local python3
# -*- coding: utf-8 -*-

import numpy as np

a_1 = list(map(int, input().split()))
a_2 = list(map(int, input().split()))
a_3 = list(map(int, input().split()))
_ = input()
pickup_number = []
while True:
    try:
        pickup_number.append(int(input()))
    except EOFError:
        break

a = np.array([a_1, a_2, a_3])
print(pickup_number)
print(a)

for pn in pickup_number:
    a[a == pn] = -1

print(a)

flag = False
if np.sum(a, axis=0)[0] == -3 or np.sum(a, axis=1)[0] == -3:
    flag = True
if np.sum(a.diagonal()) == -3 or np.sum(a[0][2] + a[1][1] + a[2][2]) == -3:
    flag = True

print('Yes' if flag else 'No')


#! env/bin/local python3
# -*- coding: utf-8 -*-

import numpy as np

a_1 = list(map(int, input().split()))
a_2 = list(map(int, input().split()))
a_3 = list(map(int, input().split()))
_ = input()
pickup_number = []
while True:
    try:
        pickup_number.append(int(input()))
    except EOFError:
        break

a = np.array([a_1, a_2, a_3])
print(pickup_number)
print(a)

for pn in pickup_number:
    a[a == pn] = -1

print(a)

flag = False
if np.sum(a, axis=0)[0] == -3 or np.sum(a, axis=1)[0] == -3:
    flag = True
if np.sum(a.diagonal()) == -3 or np.sum(a[0][2] + a[1][1] + a[2][0]) == -3:
    flag = True

print('Yes' if flag else 'No')


#! env/bin/local python3
# -*- coding: utf-8 -*-

import numpy as np

a_1 = list(map(int, input().split()))
a_2 = list(map(int, input().split()))
a_3 = list(map(int, input().split()))
_ = input()
pickup_number = []
while True:
    try:
        pickup_number.append(int(input()))
    except EOFError:
        break

a = np.array([a_1, a_2, a_3])

for pn in pickup_number:
    a[a == pn] = -1

flag = False
if -3 in np.sum(a, axis=0) or -3 in np.sum(a, axis=1):
    flag = True
if np.sum(a.diagonal()) == -3 or a[0][2] + a[1][1] + a[2][0] == -3:
    flag = True

print('Yes' if flag else 'No')


Verdicts: Wrong Answer

Wrong Answer

Accepted
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):
x1   = list(map(int, input().split()))
x2   = list(map(int, input().split()))
x3   = list(map(int, input().split()))
card = [x1, x2, x3]

numLen  = int(input())
numList = [int(input()) for _ in range(numLen)]
ans = "No"
for x in range(3):
    for y in range(3):
        for numList_i in range(numLen):
            if card[x][y] == numList[numList_i]:
                print(numList[numList_i])
                card[x][y] = "x"

for i in range(3):
    if card[i][0] == "x" and card[i][1] == "x" and card[i][2] == "x":
        ans = "Yes"
    if card[0][i] == "x" and card[1][i] == "x" and card[2][i] == "x":
        ans = "Yes"

if card[0][0] == "x" and card[1][1] == "x" and card[2][2] == "x":
    ans = "Yes"
if card[0][2] == "x" and card[1][1] == "x" and card[2][0] == "x":
    ans = "Yes"
print(ans)




x1   = list(map(int, input().split()))
x2   = list(map(int, input().split()))
x3   = list(map(int, input().split()))
card = [x1, x2, x3]

numLen  = int(input())
numList = [int(input()) for _ in range(numLen)]
ans = "No"
for x in range(3):
    for y in range(3):
        for numList_i in range(numLen):
            if card[x][y] == numList[numList_i]:
                card[x][y] = "x"

for i in range(3):
    if card[i][0] == "x" and card[i][1] == "x" and card[i][2] == "x":
        ans = "Yes"
    if card[0][i] == "x" and card[1][i] == "x" and card[2][i] == "x":
        ans = "Yes"

if card[0][0] == "x" and card[1][1] == "x" and card[2][2] == "x":
    ans = "Yes"
if card[0][2] == "x" and card[1][1] == "x" and card[2][0] == "x":
    ans = "Yes"
print(ans)




Verdicts: Wrong Answer

Accepted
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):
# -*- coding: utf-8 -*-
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))
a = [a1, a2, a3]
n = int(input())
b = []
for i in range(n):
    bn = int(input())
    b.append(bn)
for i in range(3):
    for j in range(3):
        if a[i][j] in b:
            a[i][j] = -5
print(*a)
for i in range(3):
    if sum(a[i]) == -15:
        bng = 1
for i in range(3):
     cnt = 0
     for j in range(3):
       cnt += a[j][i]
       if cnt == -15:
         bng = 1
        
cnt = 0
for i in range(3):
        cnt += a[i][i]
if cnt == -15:
        bng = 1 
                
if bng == 1:
    print("Yes")
else:
    print("No")

# -*- coding: utf-8 -*-
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))
a = [a1, a2, a3]
n = int(input())
b = []
bng = 0
for i in range(n):
    bn = int(input())
    b.append(bn)
for i in range(3):
    for j in range(3):
        if a[i][j] in b:
            a[i][j] = -5
for i in range(3):
    if sum(a[i]) == -15:
        bng = 1
for i in range(3):
     cnt = 0
     for j in range(3):
       cnt += a[j][i]
       if cnt == -15:
         bng = 1
        
cnt = 0
for i in range(3):
        cnt += a[i][i]
if cnt == -15:
        bng = 1 
if a[0][2] + a[1][1] + a[2][0] == -15:
    bng = 1
                
if bng == 1:
    print("Yes")
else:
    print("No")

Verdicts: Runtime Error

Accepted
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):
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
n=int(input())
ans=[[0,0,0] for i in range(3)]
count=-1
for i in range(n):
  s=int(input())
  for T in [A,B,C]:
    count+=1
    if s in T:
      ans[count][T.index(s)]=1
for i in range(3):
  if ans[i]==[1,1,1]:
    print("Yes")
    exit()
for i in range(3):
  if [ans[i][j] for j in range(3)]==[1,1,1]:
    print("Yes")
    exit()
if [ans[0][0],ans[1][1],ans[2][2]]==[1,1,1]:
  print("Yes")
  exit()
if [ans[0][2],ans[1][1],ans[2][0]]==[1,1,1]:
  print("Yes")
  exit()
print("No")


A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
n=int(input())
ans=[[0,0,0] for i in range(3)]
for i in range(n):
  s=int(input())
  for T in [A,B,C]:
    if s in T:
      ans[T.index(s)]=1
for i in range(3):
  if ans[i]==[1,1,1]:
    print("Yes")
    exit()
for i in range(3):
  if [ans[i][j] for j in range(3)]==[1,1,1]:
    print("Yes")
    exit()
if [ans[0][0],ans[1][1],ans[2][2]]==[1,1,1]:
  print("Yes")
  exit()
if [ans[0][2],ans[1][1],ans[2][0]]==[1,1,1]:
  print("Yes")
  exit()
print("No")

A=[]
for i in range(3):
  a,b,c=map(int,input().split())
  A+=[a,b,c]
  
n=int(input())
T=[0]*9
for i in range(n):
  p=int(input())
  if p in A:
    T[A.index(p)]=1
    
if [1,1,1] in [T[0:3],T[3:6],T[6:9],T[0:7:3],T[1:9:3],T[2:9:3],T[0:10:4],T[2:7:2]]:
  print("Yes")
else:
  print("No")

Verdicts: Runtime Error

Runtime Error

Accepted
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 = []
for _ in range(3):
    a.append(list(map(int, input().split())))
a = list(np.array(a).flatten())
N = int(input())
index = []
for _ in range(N):
    b_i = int(input())
    if b_i in a:
        indexes = [i for i, x in enumerate(a) if x == b_i]
        for i in indexes:
            index.append(i)
print(index)
for i in sorted(index):
    if i + 1 in index and i + 2 in index:
        print("Yes")
        exit()
    if i + 2 in index and i + 4 in index:
        print("Yes")
        exit()
    if i + 3 in index and i + 6 in index:
        print("Yes")
        exit()
    if i + 4 in index and i + 8 in index:
        print("Yes")
        exit()
print("No")

import numpy as np
a = []
for _ in range(3):
    a.append(list(map(int, input().split())))
a = list(np.array(a).flatten())
N = int(input())
index = []
for _ in range(N):
    b_i = int(input())
    if b_i in a:
        index.append(a.index(b_i))
for i in sorted(index):
    if 0 in index and 1 in index and 2 in index:
        print("Yes")
        exit()
    elif 0 in index and 3 in index and 6 in index:
        print("Yes")
        exit()
    elif 0 in index and 4 in index and 8 in index:
        print("Yes")
        exit()
    elif 1 in index and 4 in index and 7 in index:
        print("Yes")
        exit()
    elif 2 in index and 5 in index and 8 in index:
        print("Yes")
        exit()
    elif 2 in index and 4 in index and 6 in index:
        print("Yes")
        exit()
    elif 3 in index and 4 in index and 5 in index:
        print("Yes")
        exit()
    elif 6 in index and 7 in index and 8 in index:
        print("Yes")
        exit()
print("No")

Verdicts: Wrong Answer

Accepted
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):
from numpy import *
A = [ list(map(int,input().split(" "))) for i in range(3)]
N=int(input())
b = [input() for i in range(N)]
C=zeros((3,3))
for i in range(0,3):
  for j in range(0,3):
    for k in range(0,N):
      if A[i][j]==b[k]:
        C[i][j]==1     

 # if C[i]==[1,1,1]:
  #  print('Yes')
if C[0][0]==1 and C[1][1]==1 and C[2][2]==1:
  print("Yes") 
elif C[0][2]==1 and C[1][1]==1 and C[2][0]==1:  
   print("Yes") 
elif C[0][0]==1 and C[1][0]==1 and C[2][0]==1:
  print("Yes")    
elif C[0][1]==1 and C[1][1]==1 and C[2][1]==1:
  print("Yes")  
elif C[0][2]==1 and C[1][2]==1 and C[2][2]==1:
  print("Yes") 
elif C[0][0]==1 and C[0][1]==1 and C[0][2]==1:
  print("Yes")   
elif C[1][0]==1 and C[1][1]==1 and C[1][2]==1:
  print("Yes")   
elif C[2][0]==1 and C[2][1]==1 and C[2][2]==1:
  print("Yes") 
else:
  print("No")

from numpy import *
import itertools

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

b=[]
for i in range(N):
  b.append(int(input())) 
C=zeros((3,3))
for i in range(0,3):
  for j in range(0,3): 
    for k in range(0,N):
      if A[i][j]==b[k]:
        C[i][j]=1     
if C[0][0]==1 and C[1][1]==1 and C[2][2]==1:
  print("Yes") 
elif C[0][2]==1 and C[1][1]==1 and C[2][0]==1:  
   print("Yes") 
elif C[0][0]==1 and C[1][0]==1 and C[2][0]==1:
  print("Yes")    
elif C[0][1]==1 and C[1][1]==1 and C[2][1]==1:
  print("Yes")  
elif C[0][2]==1 and C[1][2]==1 and C[2][2]==1:
  print("Yes") 
elif C[0][0]==1 and C[0][1]==1 and C[0][2]==1:
  print("Yes")   
elif C[1][0]==1 and C[1][1]==1 and C[1][2]==1:
  print("Yes")   
elif C[2][0]==1 and C[2][1]==1 and C[2][2]==1:
  print("Yes") 
else:
  print("No") 

Verdicts: Wrong Answer

Accepted
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):
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
maru=111
flag=0
n=int(input())
for k in range(0,n):
    e=int(input())
    for i in range(0,3):    
        if e==a[i]:
            a[i]=maru
        if e==b[i]:
            b[i]=maru
        if e==c[i]:
            c[i]=maru

for j in range(0,3):
    if a[j]==b[j] and b[j]==c[j]:
        if c[j]==maru:
            flag==1
            
if a[0]==a[1] and a[1]==a[2]:
    if a[0]==maru:
        flag=1
if b[0]==b[1] and b[1]==b[2]:
    if b[0]==maru:
        flag=1
if c[0]==c[1] and c[1]==c[2]:
    if c[0]==maru:
        flag=1

if a[0]==b[1] and b[1]==c[2]:
    if c[2]==maru:
        flag=1

if a[2]==b[1] and b[1]==c[0]:
    if c[2]==maru:
        flag=1

print(a)
print(b)
print(c)

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


a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
maru=111
flag=0
n=int(input())
for k in range(0,n):
    e=int(input())
    for i in range(0,3):    
        if e==a[i]:
            a[i]=maru
        if e==b[i]:
            b[i]=maru
        if e==c[i]:
            c[i]=maru

for j in range(0,3):
    if a[j]==b[j] and b[j]==c[j]:
        if c[j]==maru:
            flag=1
            
if a[0]==a[1] and a[1]==a[2]:
    if a[0]==maru:
        flag=1
if b[0]==b[1] and b[1]==b[2]:
    if b[0]==maru:
        flag=1
if c[0]==c[1] and c[1]==c[2]:
    if c[0]==maru:
        flag=1

if a[0]==b[1] and b[1]==c[2]:
    if c[2]==maru:
        flag=1

if a[2]==b[1] and b[1]==c[0]:
    if c[0]==maru:
        flag=1


print(a)
print(b)
print(c)

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


a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
maru=111
flag=0
n=int(input())
for k in range(0,n):
    e=int(input())
    for i in range(0,3):    
        if e==a[i]:
            a[i]=maru
        if e==b[i]:
            b[i]=maru
        if e==c[i]:
            c[i]=maru

for j in range(0,3):
    if a[j]==b[j] and b[j]==c[j]:
        if c[j]==maru:
            flag=1
            
if a[0]==a[1] and a[1]==a[2]:
    if a[0]==maru:
        flag=1
if b[0]==b[1] and b[1]==b[2]:
    if b[0]==maru:
        flag=1
if c[0]==c[1] and c[1]==c[2]:
    if c[0]==maru:
        flag=1

if a[0]==b[1] and b[1]==c[2]:
    if c[2]==maru:
        flag=1

if a[2]==b[1] and b[1]==c[0]:
    if c[0]==maru:
        flag=1



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


Verdicts: Wrong Answer

Wrong Answer

Accepted
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):
A     = [list(map(int, input().split())) for i in range(3)]
N     = int(input())
lst_b = [int(input()) for i in range(N)]


def main(A, N, lst_b):
    
    matrix_result = [[False]*3 for i in range(3)]
    flag_bingo = False

    for b in lst_b:
        for i in range(3):
            for j in range(3):
                if A[i][j] == b:
                    matrix_result[i][j] = True
        
    for i in range(3):
        
        if (matrix_result[0][i] and matrix_result[1][i] and matrix_result[2][i]):
            flag_bingo = True
        
        if (matrix_result[i][0] and matrix_result[i][1] and matrix_result[i][2]):
            flag_bingo = True
    
    
    if (matrix_result[0][0] and matrix_result[1][1] and matrix_result[2][2]):
        flag_bingo = True
    elif (matrix_result[0][2] and matrix_result[1][1] and matrix_result[2][0]):
        flag_bingo = True

    print(matrix_result)
    
    if flag_bingo: return "Yes"
    else         : return "No"
    

if __name__ == "__main__":

    answer = main(A, N, lst_b)
    print(answer)
    

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


def main(A, N, lst_b):
    
    matrix_result = [[False]*3 for i in range(3)]
    flag_bingo = False

    for b in lst_b:
        for i in range(3):
            for j in range(3):
                if A[i][j] == b:
                    matrix_result[i][j] = True
        
    for i in range(3):
        
        if (matrix_result[0][i] and matrix_result[1][i] and matrix_result[2][i]):
            flag_bingo = True
        
        if (matrix_result[i][0] and matrix_result[i][1] and matrix_result[i][2]):
            flag_bingo = True
    
    
    if (matrix_result[0][0] and matrix_result[1][1] and matrix_result[2][2]):
        flag_bingo = True
    elif (matrix_result[0][2] and matrix_result[1][1] and matrix_result[2][0]):
        flag_bingo = True
    
    if flag_bingo: return "Yes"
    else         : return "No"
    

if __name__ == "__main__":

    answer = main(A, N, lst_b)
    print(answer)
    

Verdicts: Wrong Answer

Accepted
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):
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()

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(temp)
 
 
    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()

Verdicts: Runtime Error

Accepted
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):
A=[]
b=[]
c=[[0,0,0],[0,0,0],[0,0,0]]
d=[[0,0,0],[0,0,0],[0,0,0]]
for i in range(3):
    x,y,z=map(int,input().split())
    A.append([x,y,z])

N = int(input())

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

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

print(c)
print(d)

if [1,1,1] in c[0:2]:
    print('Yes')
elif [1,1,1] in d[0:2]:
    print('Yes')
elif (c[0][0]+c[1][1]+c[2][2] == 3) or (d[0][0]+d[1][1]+d[2][2] == 3):
    print('Yes')
else:
    print('No')


A=[]
b=[]
c=[[0,0,0],[0,0,0],[0,0,0]]
d=[[0,0,0],[0,0,0],[0,0,0]]
for i in range(3):
    x,y,z=map(int,input().split())
    A.append([x,y,z])

N = int(input())

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

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

print(c)
print(d)

if [1,1,1] in c:
    print('Yes')
elif [1,1,1] in d:
    print('Yes')
elif (c[0][0]+c[1][1]+c[2][2] == 3) or (d[0][0]+d[1][1]+d[2][2] == 3):
    print('Yes')
else:
    print('No')


A=[]
b=[]
c=[[0,0,0],[0,0,0],[0,0,0]]
d=[[0,0,0],[0,0,0],[0,0,0]]
for i in range(3):
    x,y,z=map(int,input().split())
    A.append([x,y,z])

N = int(input())

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

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

if [1,1,1] in c:
    print('Yes')
elif [1,1,1] in d:
    print('Yes')
elif (c[0][0]+c[1][1]+c[2][2] == 3) or (c[0][2]+c[1][1]+c[2][0] == 3):
    print('Yes')
else:
    print('No')



Verdicts: Wrong Answer

Wrong Answer

Accepted
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):
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)

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)

Verdicts: Runtime Error

Accepted
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):
A = [list(map(int, input().split())) for i in range(3)]
N = int(input())
b = []
for i in range(N):
    b.append(int(input()))
x = False
for i in range(3):
    count = 0
    for j in range(3):
        for k in range(N):
            if A[i][j] == b[k]:
                count += 1
    if count == 3:
        x = True
        break
if not x:
    for i in range(3):
        count = 0
        for j in range(3):
            for k in range(N):
                if A[j][i] == b[k]:
                    count += 1
        if count == 3:
            x = True
            break
if not x:
    count = 0
    for i in range(3):
        for k in range(N):

            if A[i][i] == b[k]:
                count += 1
    if count == 3:
        x = True
if not x:
    count = 0
    for i in range(3):
        for k in range(N):
            if A[2-i][i] == b[k]:
                count += 1
    if count == 3:
        x = True

if x:
    print("YES")
else:
    print("NO")








A = [list(map(int, input().split())) for i in range(3)]
N = int(input())
b = []
for i in range(N):
    b.append(int(input()))
x = False
for i in range(3):
    count = 0
    for j in range(3):
        for k in range(N):
            if A[i][j] == b[k]:
                count += 1
    if count == 3:
        x = True
        break
if not x:
    for i in range(3):
        count = 0
        for j in range(3):
            for k in range(N):
                if A[j][i] == b[k]:
                    count += 1
        if count == 3:
            x = True
            break
if not x:
    count = 0
    for i in range(3):
        for k in range(N):

            if A[i][i] == b[k]:
                count += 1
    if count == 3:
        x = True
if not x:
    count = 0
    for i in range(3):
        for k in range(N):
            if A[2-i][i] == b[k]:
                count += 1
    if count == 3:
        x = True

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








Verdicts: Wrong Answer

Accepted
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 sys

input = sys.stdin.readline

A = []
b = []
B = [[0, 0, 0] for _ in range(3)]

for _ in range(3):
    A.append(list(map(int, input().split())))

N = int(input())

for _ in range(N):
    b.append(int(input()))

for value in b:
    for i in range(3):
        for j in range(3):
            if A[i][j] == value:
                B[i][j] = 1

bingo = False

if B[0][0] == 1:
    if B[0][1] == 1 and B[0][1] == 1:
        bingo = True
    if B[1][0] == 1 and B[2][0] == 1:
        bingo = True
    if B[1][1] == 1 and B[2][2] == 1:
        bingo = True

if B[1][1] == 1:
    if B[1][0] == 1 and B[1][2] == 1:
        bingo = True
    if B[0][1] == 1 and B[2][1] == 1:
        bingo = True
    if B[0][2] == 1 and B[2][0] == 1:
        bingo = True   

if B[2][2] == 1:
    if B[0][2] == 1 and B[1][2] == 1:
        bingo = True
    if B[2][0] == 1 and B[2][1] == 1:
        bingo = True
    
if bingo:
    print('Yes')
else:
    print('No')

print(B)

import sys

input = sys.stdin.readline

A = []
b = []
B = [[0, 0, 0] for _ in range(3)]

for _ in range(3):
    A.append(list(map(int, input().split())))

N = int(input())

for _ in range(N):
    b.append(int(input()))

for value in b:
    for i in range(3):
        for j in range(3):
            if A[i][j] == value:
                B[i][j] = 1

bingo = False

if B[0][0] == 1:
    if B[0][1] == 1 and B[0][2] == 1:
        bingo = True
    if B[1][0] == 1 and B[2][0] == 1:
        bingo = True
    if B[1][1] == 1 and B[2][2] == 1:
        bingo = True

if B[1][1] == 1:
    if B[1][0] == 1 and B[1][2] == 1:
        bingo = True
    if B[0][1] == 1 and B[2][1] == 1:
        bingo = True
    if B[0][2] == 1 and B[2][0] == 1:
        bingo = True   

if B[2][2] == 1:
    if B[0][2] == 1 and B[1][2] == 1:
        bingo = True
    if B[2][0] == 1 and B[2][1] == 1:
        bingo = True
    
if bingo:
    print('Yes')
else:
    print('No')



Verdicts: Wrong Answer

Accepted
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):
a = [list(map(int, input().split())) for i in range(3)]
 
num = int(input())
for i in range(num):
  now = int(input())
  for i in range(3):
    for j in range(3):
      if(a[i][j] == now):
        a[i][j] = 0
str = 'No'
for j in range(3):
  a1, a2 = 0, 0
  for i in range(3):
    if(a[i][j] != 0):
      a1 = -1
    if(a[j][i] != 0):
      a2 = -1
    if(a1 == -1 and a2 == -1 and a3 == -1 and a4 == -1):
      print('No')
      exit()
  if(a[j][j] != 0):
    a3 = -1
  if(a[j][2-j] != 0):
    a4 = -1
if(a1 == -1 and a2 == -1 and a3 == -1 and a4 == -1):
  print('No')
else:
  print('Yes')

a = [list(map(int, input().split())) for i in range(3)]
 
num = int(input())
for i in range(num):
  now = int(input())
  for i in range(3):
    for j in range(3):
      if(a[i][j] == now):
        a[i][j] = 0
        
for i in range(3):
  if(a[i][0] == 0 and a[i][1] == 0 and a[i][2] == 0):
    ans = 'yes'
  if(a[0][i] == 0 and a[1][i] == 0 and a[2][i] == 0):
    ans = 'yes'
    
if(a[0][0] == 0 and a[1][1] == 0 and a[2][2] == 0):
  ans = 'yes'
if(a[0][2] == 0 and a[1][1] == 0 and a[2][0] == 0):
  ans = 'yes'

print(ans)

a = [list(map(int, input().split())) for i in range(3)]
 
num = int(input())
for i in range(num):
  now = int(input())
  for i in range(3):
    for j in range(3):
      if(a[i][j] == now):
        a[i][j] = 0
ans = 'No'        
for i in range(3):
  if(a[i][0] == 0 and a[i][1] == 0 and a[i][2] == 0):
    ans = 'Yes'
  if(a[0][i] == 0 and a[1][i] == 0 and a[2][i] == 0):
    ans = 'Yes'
    
if(a[0][0] == 0 and a[1][1] == 0 and a[2][2] == 0):
  ans = 'Yes'
if(a[0][2] == 0 and a[1][1] == 0 and a[2][0] == 0):
  ans = 'Yes'

print(ans)

Verdicts: Runtime Error

Runtime Error

Accepted