qyliang/CodeNanoFix huggingface dataset:
Buggy code:
A = [[],[],[]]
b = []

for i in range(0,3):
    A[i] = [int(x) for x in input().split(" ")]
N = int(input())
for i in range(0,N):
  b.append(int(input()))

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

if A[0] == [0,0,0] or A[1] == [0,0,0] or A[2] == [0,0,0]:
  print("Yes")
elif [A[0][0],A[1][0],A[2][0]] == [0,0,0]:
  print("yes")
elif [A[0][1],A[1][1],A[2][1]] == [0,0,0]:
  print("yes")
elif [A[0][2],A[1][2],A[2][2]] == [0,0,0]:
  print("yes")
elif [A[0][0],A[1][1],A[2][2]] == [0,0,0]:
  print("yes")
elif [A[2][0],A[1][1],A[0][2]] == [0,0,0]:
  print("yes")
else:
  print("No")

Fixed code:
A = [[],[],[]]
b = []

for i in range(0,3):
    A[i] = [int(x) for x in input().split(" ")]
N = int(input())
for i in range(0,N):
  b.append(int(input()))

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

if A[0] == [0,0,0] or A[1] == [0,0,0] or A[2] == [0,0,0]:
  print("Yes")
elif [A[0][0],A[1][0],A[2][0]] == [0,0,0]:
  print("Yes")
elif [A[0][1],A[1][1],A[2][1]] == [0,0,0]:
  print("Yes")
elif [A[0][2],A[1][2],A[2][2]] == [0,0,0]:
  print("Yes")
elif [A[0][0],A[1][1],A[2][2]] == [0,0,0]:
  print("Yes")
elif [A[2][0],A[1][1],A[0][2]] == [0,0,0]:
  print("Yes")
else:
  print("No")
Buggy code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

def main():
    import numpy as np
    A = [list(map(int,readline().split())) for _ in range(3)]
    N, *b = map(int, read().split())
    A = np.array(A)
    B = np.zeros(A.shape)
    for i in A.reshape(-1):
        if i in b:
            print(np.where(A == i))
            B[np.where(A == i)] = 1
    for i in range(3):
        if np.all(B[i, :] == 1):
            print('Yes')
            break
        if np.all(B[:, i] == 1):
            print('Yes')
            break
    else:
        if B[0,0]==B[1,1]==B[2,2]==1:
            print('Yes')
        elif B[0,2]==B[1,1]==B[2,0]==1:
            print('Yes')
        else:
            print('No')
    print(B)
    return
if __name__ == '__main__':
    main()



Fixed code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

def main():
    import numpy as np
    A = [list(map(int,readline().split())) for _ in range(3)]
    N, *b = map(int, read().split())
    A = np.array(A)
    B = np.zeros(A.shape)
    for i in A.reshape(-1):
        if i in b:
            B[np.where(A == i)] = 1
    for i in range(3):
        if np.all(B[i, :] == 1):
            print('Yes')
            break
        if np.all(B[:, i] == 1):
            print('Yes')
            break
    else:
        if B[0,0]==B[1,1]==B[2,2]==1:
            print('Yes')
        elif B[0,2]==B[1,1]==B[2,0]==1:
            print('Yes')
        else:
            print('No')
    return
if __name__ == '__main__':
    main()
Buggy code:
import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().rstrip().split())
inl = lambda: list(map(int, input().split()))
out = lambda x, s='\n': print(s.join(map(str, x)))

a = inl()
b = inl()
c = inl()
n = ini()
bingo = []
for _ in range(n):
    bingo.append(ini())
ct = [0] * 9
for i in bingo:
    if i in a:
        ct[a.index(i)] = 1
    if i in b:
        ct[b.index(i) + 3] = 1
    if i in c:
        ct[c.index(i) + 6] = 1
if sum(ct[:3]) == 3 or sum(ct[3:6] or sum(ct[6:9]) == 3):
    print("YES")
elif ct[0] + ct[4] + ct[8] == 3 or ct[2] + ct[4] + ct[6]:
    print("YES")
else:
    print("NO")    

Fixed code:
import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().rstrip().split())
inl = lambda: list(map(int, input().split()))
out = lambda x, s='\n': print(s.join(map(str, x)))

a = inl()
b = inl()
c = inl()
n = ini()
bingo = []
for _ in range(n):
    bingo.append(ini())
ct = [0] * 9
for i in bingo:
    if i in a:
        ct[a.index(i)] = 1
    if i in b:
        ct[b.index(i) + 3] = 1
    if i in c:
        ct[c.index(i) + 6] = 1
if sum(ct[:3]) == 3 or sum(ct[3:6]) == 3 or sum(ct[6:9]) == 3:
    print("Yes")
elif (ct[0] + ct[4] + ct[8]) == 3 or (ct[2] + ct[4] + ct[6]) == 3:
    print("Yes")
elif (ct[0] + ct[3] + ct[6]) == 3 or (ct[1] + ct[4] + ct[7]) == 3 or (ct[2] + ct[5] + ct[8]) == 3:
    print("Yes")
else:
    print("No")
Buggy 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')

Fixed 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')
Buggy code:
lines = [input().split() for i in range(3)]

num = int(input())
bs = []
for i in range(num):
  bs.append(input())

hits = []
for i in bs:
  for row_index in range(len(lines)):
    for col_index in range(len(line)):
      if lines[row_index][col_index] == i:
        hits.append((row_index,col_index))
row_hits = (0,0,0)
col_hits = (0,0,0)
stride_hits = (0,0)

for hit in hits:
  r = hit[0]
  c = hit[1]
  row_hits[r]++
  col_hits[c]++
  if r == c:
    stride_hits[0]++
  else if (r,c) == (0,2) or (r,c) == (1,1) or (r,c) == (2,0) :
    stride_hits[1]++

if max(row_hits)>= 3 or max(col_hits)>=3 or max(stride_hits)>= 3:
  print 'Yes'
else:
  print 'No'
  

Fixed code:
lines = [input().split() for i in range(3)]
 
num = int(input())
bs = []
for i in range(num):
  bs.append(input())
 
hits = []
for i in bs:
  for row_index in range(len(lines)):
    for col_index in range(len(lines[row_index])):
      if lines[row_index][col_index] == i:
        hits.append((row_index,col_index))
row_hits = [0,0,0]
col_hits = [0,0,0]
stride_hits = [0,0]
 
for hit in hits:
  r = hit[0]
  c = hit[1]
  row_hits[r]+=1
  col_hits[c]+=1
  if r == c:
    stride_hits[0]+=1
  if (r,c) == (0,2) or (r,c) == (1,1) or (r,c) == (2,0) :
    stride_hits[1]+=1
 
if max(row_hits)>= 3 or max(col_hits)>=3 or max(stride_hits)>= 3:
  print ('Yes')
else:
  print ('No')
Buggy code:
A = []
B = []
for i in range(3):
    a = list(map(int, input().split()))
    A.append(a)

N = int(input())

test = [[0]*3]*3

for i in range(N):
    b = int(input())
    for m in range(3):
        for n in range(3):
            if b == A[m][n]:
                test[m][n] =1

ans = 'No'
for i in range(3):
    if sum(test[i]) == 3:
        ans = 'Yes'
    if test[1][i]+test[2][i]+test[3][i] == 3:
        ans = 'Yes'

if test[0][0]+test[1][1]+test[2][2] == 3:
    ans = 'Yes'

if test[2][0]+test[1][1]+test[0][2] == 3:
    ans = 'Yes'

print(ans)


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

N = int(input())

test = [[0]*3 for _ in range(3)]

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

for b in B:
    for m in range(3):
        for n in range(3):
            if b == A[m][n]:
                test[m][n] =1

ans = 'No'

for i in range(3):
    if sum(test[i]) == 3:
        ans = 'Yes'
    if test[0][i]+test[1][i]+test[2][i] == 3:
        ans = 'Yes'

if test[0][0]+test[1][1]+test[2][2] == 3:
    ans = 'Yes'

if test[2][0]+test[1][1]+test[0][2] == 3:
    ans = 'Yes'

print(ans)
Buggy code:
A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
B = []
for _ in range(N):
    B.append(input())
    
for b in B:
    for x in range(3):
        for y in range(3) :
            if A[x][y] == b:
                A[x][y] = 0
if A[0][0] + A[1][0] + A[2][0] == 0 \
or A[0][1] + A[1][1] + A[2][1] == 0 \
or A[0][2] + A[1][2] + A[2][2] == 0 \
or A[0][0] + A[0][1] + A[0][2] == 0 \
or A[1][0] + A[1][1] + A[1][2] == 0 \
or A[2][0] + A[2][1] + A[2][2] == 0 \
or A[0][0] + A[1][1] + A[2][2] == 0 \
or A[0][2] + A[1][1] + A[2][0] == 0:
    print("Yes")
else:
    print("No") 


Fixed code:
A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
B = [int(input()) for i in range(N)]
for b in B:
    for x in range(3):
        for y in range(3) :
            if A[x][y] == b:
                A[x][y] = 0

if A[0][0] + A[1][0] + A[2][0] == 0 \
or A[0][1] + A[1][1] + A[2][1] == 0 \
or A[0][2] + A[1][2] + A[2][2] == 0 \
or A[0][0] + A[0][1] + A[0][2] == 0 \
or A[1][0] + A[1][1] + A[1][2] == 0 \
or A[2][0] + A[2][1] + A[2][2] == 0 \
or A[0][0] + A[1][1] + A[2][2] == 0 \
or A[0][2] + A[1][1] + A[2][0] == 0:
    print("Yes")
else:
    print("No")
Buggy 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 = [list(map(int, input().split()))for _ in range(N)]
for i in range(3):
    for j in range(N):
        if A_1[i] == b[j][0]:
            A_1[i] = "a"
        elif A_2[i] == b[j][0]:
            A_2[i] = "a"
        elif A_3[i] == b[j][0]:
            A_3[i] = "a"
print(A_1, A_2, A_3)

if A_1[0] == A_1[1] == A_1[2]:
    print("Yes")
elif A_2[0] == A_2[1] == A_2[2]:
    print("Yes")
elif A_3[0] == A_3[1] == A_3[2]:
    print("Yes")
elif A_1[0] == A_2[0] == A_3[0]:
    print("Yes")
elif A_1[1] == A_2[1] == A_3[1]:
    print("Yes")
elif A_1[2] == A_2[2] == A_3[3]:
    print("Yes")
elif A_1[0] == A_2[1] == A_3[2]:
    print("Yes")
elif A_1[2] == A_2[1] == A_3[0]:
    print("Yes")
else:
    print("No")

Fixed 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 = [(int(input())) for _ in range(N)]
for i in range(3):
    for j in range(N):
        if A_1[i] == b[j]:
            A_1[i] = 1
        elif A_2[i] == b[j]:
            A_2[i] = 1
        elif A_3[i] == b[j]:
            A_3[i] = 1


if A_1[0] == A_1[1] == A_1[2]:
    print("Yes")
elif A_2[0] == A_2[1] == A_2[2]:
    print("Yes")
elif A_3[0] == A_3[1] == A_3[2]:
    print("Yes")
elif A_1[0] == A_2[0] == A_3[0]:
    print("Yes")
elif A_1[1] == A_2[1] == A_3[1]:
    print("Yes")
elif A_1[2] == A_2[2] == A_3[2]:
    print("Yes")
elif A_1[0] == A_2[1] == A_3[2]:
    print("Yes")
elif A_1[2] == A_2[1] == A_3[0]:
    print("Yes")
else:
    print("No")
Buggy code:
def create_hole(A: List, b:List):

    N = len(A)
    Hole = [[0 for i in range(N)] for j in range(N)]
    for i in range(3):
        for j in range(3):
            for value in b:
                if A[i][j] == value: Hole[i][j] = 1

    return Hole


def check_bingo(H: List):

    N = len(H)
    rowsum = sum([sum(row) == N for row in H])
    colsum = sum([sum(row) == N for row in map(list, zip(*H))])
    digsum = sum([H[i][i] for i in range(N)]) == N
    tdigsum = sum([H[i][N-i-1] for i in range(N)]) == N

    return rowsum + colsum + digsum + tdigsum > 0


def resolve():

    A = [list(map(int, input().split())) for i in range(3)]
    N = int(input())
    b = [int(input()) for i in range(N)]
    print('Yes' if check_bingo(create_hole(A, b)) else 'No')
    
resolve()

Fixed code:
def create_hole(A: list, b:list):

    N = len(A)
    Hole = [[0 for i in range(N)] for j in range(N)]
    for i in range(3):
        for j in range(3):
            for value in b:
                if A[i][j] == value: Hole[i][j] = 1

    return Hole


def check_bingo(H: list):

    N = len(H)
    rowsum = sum([sum(row) == N for row in H])
    colsum = sum([sum(row) == N for row in map(list, zip(*H))])
    digsum = sum([H[i][i] for i in range(N)]) == N
    tdigsum = sum([H[i][N-i-1] for i in range(N)]) == N

    return rowsum + colsum + digsum + tdigsum > 0


def resolve():

    A = [list(map(int, input().split())) for i in range(3)]
    N = int(input())
    b = [int(input()) for i in range(N)]
    print('Yes' if check_bingo(create_hole(A, b)) else 'No')
    
resolve()
Buggy code:
A11, A12, A13=list(map(int,input().split()))
A21, A22, A23=list(map(int,input().split()))
A31, A32, A33=list(map(int,input().split()))
N=int(input())
b=[input() for i in range(N)]
if A11 and A12 and A13 in b:
    print('Yes')
elif A21 and A22 and A23 in b:
    print('Yes')
elif A31 and A32 and A33 in b:
    print('Yes')
elif A11 and A21 and A31 in b:
    print('Yes')
elif A12 and A22 and A32 in b:
    print('Yes')
elif A13 and A23 and A33 in b:
    print('Yes')
elif A11 and A22 and A33 in b:
    print('Yes')
elif A13 and A22 and A31 in b:
    print('Yes')
else:
  print('No')

Fixed code:
A11, A12, A13=list(map(int,input().split()))
A21, A22, A23=list(map(int,input().split()))
A31, A32, A33=list(map(int,input().split()))
N=int(input())
b=[int(input()) for i in range(N)]
if A11 in b and A12 in b and A13 in b:
    print('Yes')
elif A21 in b and A22 in b and A23 in b:
    print('Yes')
elif A31 in b and A32 in b and A33 in b:
    print('Yes')
elif A11 in b and A21 in b and A31 in b:
    print('Yes')
elif A12 in b and A22 in b and A32 in b:
    print('Yes')
elif A13 in b and A23 in b and A33 in b:
    print('Yes')
elif A11 in b and A22 in b and A33 in b:
    print('Yes')
elif A13 in b and A22 in b and A31 in b:
    print('Yes')
else:
    print('No')
Buggy code:
a = [list(map(int, input().split())) for i in range(3)]
n = int(input())

b = set(int(input() for i in range(n)))

def check():
    for i in range(3):
        if all(a[i][j] in b for j in range(3)):
            return True
        if all(a[j][i] in b for j in range(3)):
            return True
    return all(a[i][i] in b for i in range(3)) or all(a[2-i][i] in b for i in range(3))

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

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

b = set(int(input()) for i in range(n))

def check():
    for i in range(3):
        if all(a[i][j] in b for j in range(3)):
            return True
        if all(a[j][i] in b for j in range(3)):
            return True
    return all(a[i][i] in b for i in range(3)) or all(a[2-i][i] in b for i in range(3))

print('Yes' if check() else 'No')
Buggy code:
A = [list(map(int,input().split())) for i in range(3)]
N = int(input())
B = [int(input()) for i in range(N)]
card = [[False]*3]*3
for num in B:
    for i in range(3):
        for j in range(3):
            if A[i][j] == num:
                card[i][j] = True

def res(a,b,c):
    return a and b and c
ans = "No"
if res(A[0][0],A[0][1],A[0][2]) or res(A[1][0],A[1][1],A[1][2]) or res(A[2][0],A[2][1],A[2][2]) or res(A[0][0],A[1][0],A[2][0]) or res(A[0][1],A[1][1],A[2][1]) or res(A[0][2],A[1][2],A[2][2]) or res(A[0][0],A[1][1],A[2][2]) or res(A[0][2],A[1][1],A[2][0]):
    ans = "Yes"
print(ans)

Fixed code:
A = [list(map(int,input().split())) for i in range(3)]
N = int(input())
B = [int(input()) for i in range(N)]
card = [[False for i in range(3)] for j in range(3)]
for num in B:
    for i in range(3):
        for j in range(3):
            if A[i][j] == num:
                card[i][j] = True

def res(a,b,c):
    return a and b and c
ans = "No"
if res(card[0][0],card[0][1],card[0][2]) or res(card[1][0],card[1][1],card[1][2]) or res(card[2][0],card[2][1],card[2][2]) or res(card[0][0],card[1][0],card[2][0]) or res(card[0][1],card[1][1],card[2][1]) or res(card[0][2],card[1][2],card[2][2]) or res(card[0][0],card[1][1],card[2][2]) or res(card[0][2],card[1][1],card[2][0]):
    ans = "Yes"
print(ans)
Buggy code:
A=[list(map(int,input().split())) for i in range(3)]
n=int(input())

for i in range(n):
  o=int(input())
  for x in range(3):
    for y in range(3):
      if o == A[x][y]:
        A[x][y]=-1
for x in range(3):
  if A[x][0]==-1:
    f=True
    for y in range(3):
      if A[x][y]!=-1:
        f=False
    if f:
      print('Yes')
      exit()
for y in range(3):
  if A[0][y] == -1:
    f=True
    for x in range(3):
      if A[y][[x] != -1:
        f=False
    if f:
      print('Yes')
      exit()
f=True
for i in range(3):
  if A[i][i]!=-1:
    f=False
if f:
  print('Yes')
f=True
for i in range(1,3):
  if A[-i][-i]!=-1:
    f=False
if f:
  print('Yes')

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

for i in range(n):
  o=int(input())
  for x in range(3):
    for y in range(3):
      if o == A[y][x]:
        A[y][x]=-1

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

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


f=True
for i in range(3):
  if A[i][i]!=-1:
    f=False
if f:
  print('Yes')
  exit()
f=True


for i in range(3):
  if A[i][2-i]!=-1:
    f=False
if f:
  print('Yes')
  exit()

print('No')
Buggy code:
S = [list(map(int, input().split())) for _ in range(3)]
s = []
for i in range(3):
    for j in range(3):
        s.append(S[i][j])
n = int(input())
a = [int(input()) for i in range(n)]
print(s[0]in a and s[1] in a and s[2] in a)
if (s[0]in a and s[1] in a and s[2] in a)or(s[3]in a and s[4] in a and s[5] in a)or(s[6]in a and s[7] in a and s[8] in a)or(s[0]in a and s[3] in a and s[6] in a)or(s[4]in a and s[1] in a and s[7] in a)or(s[2]in a and s[5] in a and s[8] in a)or(s[0]in a and s[4] in a and s[8] in a)or(s[2]in a and s[4] in a and s[6] in a):
    print("Yes")
else:
    print("No")

Fixed code:
S = [list(map(int, input().split())) for _ in range(3)]
s = []
for i in range(3):
    for j in range(3):
        s.append(S[i][j])
n = int(input())
a = [int(input()) for i in range(n)]
if (s[0]in a and s[1] in a and s[2] in a)or(s[3]in a and s[4] in a and s[5] in a)or(s[6]in a and s[7] in a and s[8] in a)or(s[0]in a and s[3] in a and s[6] in a)or(s[4]in a and s[1] in a and s[7] in a)or(s[2]in a and s[5] in a and s[8] in a)or(s[0]in a and s[4] in a and s[8] in a)or(s[2]in a and s[4] in a and s[6] in a):
    print("Yes")
else:
    print("No")
Buggy code:
a = [list(map(int, input().split())) for i in range(3)]
output =[[0,0,0],[0,0,0],[0,0,0]]
n = int(input())
for k in range(n):
    b=int(input())
    for i in range(3):
        for j in range(3):
            if a[i][j]==b:
                output[i][j]=1
for i in range(3):
    if output[i][0]*output[i][1]*output[i][2]==1:
        print('Yes')
    elif output[0][i]*output[1][i]*output[2][i]==1:
        print('Yes')
if output[0][0]*output[1][1]*output[2][2]==1:
    print('Yes')
elif output[2][0]*output[1][1]*output[0][2]==1:
    print('Yes')
else:
    print('No')

Fixed code:
a = [list(map(int, input().split())) for i in range(3)]
output =[[0,0,0],[0,0,0],[0,0,0]]
n = int(input())
check=False
for k in range(n):
    b=int(input())
    for i in range(3):
        for j in range(3):
            if a[i][j]==b:
                output[i][j]=1
for i in range(3):
    if output[i][0]*output[i][1]*output[i][2]==1:
        check=True
    elif output[0][i]*output[1][i]*output[2][i]==1:
        check=True
if output[0][0]*output[1][1]*output[2][2]==1:
    check=True
elif output[2][0]*output[1][1]*output[0][2]==1:
    check=True
if check==True:
    print('Yes')
else:
    print('No')
Buggy code:
import sys
A=[[0]*3 for i in range(3)]
for i in range(3):
  A[i]=list(map(int,input().split()))
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:
        A[j][k]=10**10
for i in range(3):
  if sum(A[i])==3*10**10:
    print("Yes")
    sys.exit()
a=0
for i in range(3):
  a=a+A[i][0]
if a==3**10**10:
  print("Yes")
  sys.exit()
a=0
for i in range(3):
  a=a+A[i][1]
if a==3*10**10:
  print("Yes")
  sys.exit()
a=0
for i in range(3):
  a=a+A[i][2]
if a==3*10**10:
  print("Yes")
  sys.exit()
if A[0][0]+A[1][1]+A[2][2]==3*10**10 or A[0][2]+A[1][1]+A[2][0]==3*10**10:
  print("Yes")
  sys.exit()
print("No")

Fixed code:
import sys
A=[[0]*3 for i in range(3)]
for i in range(3):
  A[i]=list(map(int,input().split()))
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:
        A[j][k]=10**10
for i in range(3):
  if sum(A[i])==3*10**10:
    print("Yes")
    sys.exit()
a=0
for i in range(3):
  a=a+A[i][0]
if a==3*10**10:
  print("Yes")
  sys.exit()
a=0
for i in range(3):
  a=a+A[i][1]
if a==3*10**10:
  print("Yes")
  sys.exit()
a=0
for i in range(3):
  a=a+A[i][2]
if a==3*10**10:
  print("Yes")
  sys.exit()
if A[0][0]+A[1][1]+A[2][2]==3*10**10 or A[0][2]+A[1][1]+A[2][0]==3*10**10:
  print("Yes")
  sys.exit()
print("No")
Buggy code:
import numpy as np

mat = []

for i in range(3):
	(a,b,c)= input().split(' ')
	mat.append((int(a),int(b),int(c)))

mat = np.array(mat).reshape(3,3)


num = int(input())
ball=[]
for i in range(num):
  ball.append(int(input()))

ball = set(ball)

for h in range(3):
  x = set(mat[h,:])
  res = ball.intersection(x) == x
  if res:
    print(res)
    exit()

for w in range(3):
  x = set(mat[:, w])
  res = ball.intersection(x) == x
  if res:
    print(res)
    exit()

x = {mat[0,0],mat[1,1], mat[2,2]}
res = ball.intersection(x) == x
if res:
  print(res)
  exit()

x = {mat[2,0],mat[1,1], mat[0,2]}  
res = ball.intersection(x) == x
if res:
  print(res)
  exit()
  
print(res)

Fixed code:
import numpy as np

mat = []

for i in range(3):
	(a,b,c)= input().split(' ')
	mat.append((int(a),int(b),int(c)))

mat = np.array(mat).reshape(3,3)


num = int(input())
ball=[]
for i in range(num):
  ball.append(int(input()))

ball = set(ball)

for h in range(3):
  x = set(mat[h,:])
  res = ball.intersection(x) == x
  if res:
    print('Yes')
    exit()

for w in range(3):
  x = set(mat[:, w])
  res = ball.intersection(x) == x
  if res:
    print('Yes')
    exit()

x = {mat[0,0],mat[1,1], mat[2,2]}
res = ball.intersection(x) == x
if res:
  print('Yes')
  exit()

x = {mat[2,0],mat[1,1], mat[0,2]}  
res = ball.intersection(x) == x
if res:
  print('Yes')
  exit()
  
print('No')
Buggy code:
a = [list(map(int,input().split())) for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]
for i in range(3):
  for j in range(3):
    for k in range(3):
      if a[i][j] == b[k]:
        a[i][j] = 0
ans = 'No'
for i in range(3):
  if a[i][0]+a[i][1]+a[i][2] == 0:
    ans = 'Yes'
  if a[0][i]+a[1][i]+a[2][i] == 0:
    ans = 'Yes'
if a[0][0]+a[1][1]+a[2][2] == 0 or a[2][0]+a[1][1]+a[0][2] == 0:
  ans = 'Yes'
print(ans)

Fixed code:
a = [list(map(int,input().split())) for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]
for i in range(3):
    for j in range(3):
      for k in range(n):
        if a[i][j] == b[k]:
            a[i][j] = 0
ans = 'No'
for i in range(3):
    if a[i][0]+a[i][1]+a[i][2] == 0:
        ans = 'Yes'
    if a[0][i]+a[1][i]+a[2][i] == 0:
        ans = 'Yes'
if a[0][0]+a[1][1]+a[2][2] == 0 or a[2][0]+a[1][1]+a[0][2] == 0:
    ans = 'Yes'
print(ans)
Buggy 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')

Fixed code:
import numpy as np
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')