qyliang/CodeNanoFix huggingface dataset:
Buggy code:
X=[list(map(int,input().split()))for i in range(3)]
b=[int(input())for i in range(int(input()))]
for i in range(3):
 X[i]=[1 if i in b else 0 for i in X[i]]
print("Yes" if 3>=max(*[sum(i)for i in X],*[sum([x[i] for x in X])for i in range(3)],X[0][0]+X[1][1]+X[2][2],X[0][2]+X[1][1]+X[2][0]) else "No")

Fixed code:
X=[list(map(int,input().split()))for i in range(3)]
b=[int(input())for i in range(int(input()))]
for i in range(3):
 X[i]=[1 if i in b else 0 for i in X[i]]
print("Yes" if 3<=max(*[sum(i)for i in X],*[sum([x[i] for x in X])for i in range(3)],X[0][0]+X[1][1]+X[2][2],X[0][2]+X[1][1]+X[2][0]) else "No")
Buggy code:
import sys
A=[list(map(int,input().split())) for i in range()]
N=int(input())
b=[list(map(int,input().split())) for i in range(N)]
flat=[j for i in A for j in i]
for i,value in enumerate(flat):
    if [value] in b:
         flat[i]=-1
for i in range(3):
    if flat[i]==flat[i+1]==flat[i+2]==-1:
        print('Yes')
        sys.exit()
    if flat[i]==flat[i+3]==flat[i+6]==-1:
        print('Yes')
        sys.exit()
if flat[0]==flat[4]==flat[8]==-1 or flat[2]==flat[4]==flat[6]==-1:
    print('Yes')
    sys.exit()
print('No')

Fixed code:
import sys
A=[list(map(int,input().split())) for i in range(3)]
N=int(input())
b=[list(map(int,input().split())) for i in range(N)]
flat=[j for i in A for j in i]
for i,value in enumerate(flat):
    if [value] in b:
         flat[i]=-1
for i in range(3):
    if flat[i*3]==flat[i*3+1]==flat[i*3+2]==-1:
        print('Yes')
        sys.exit()
    if flat[i]==flat[i+3]==flat[i+6]==-1:
        print('Yes')
        sys.exit()
if flat[0]==flat[4]==flat[8]==-1 or flat[2]==flat[4]==flat[6]==-1:
    print('Yes')
    sys.exit()
print('No')
Buggy code:
a= []
for i in range(3):
  a_input = input().split()
  a.append(int(a_input))

for i in range(n):
  x = input()
  for j in range(3):
    for k in range(3):
      if x == int(a[j][k]):
        a[j][k] = "0"

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

Fixed code:
a= []
for i in range(3):
  a_input = input().split()
  a.append(a_input)

n = int(input())
for i in range(n):
  x = input()
  for j in range(3):
    for k in range(3):
      if x == a[j][k]:
        a[j][k] = "0"

for i in range(3):
    if a[0][i] == "0" and a[0][i] == a[1][i] and a[0][i] == a[2][i]:
      print("Yes")
      exit()
    elif a[i][0] == "0" and a[i][0] == a[i][1] and a[i][0] == a[i][2]:
      print("Yes")
      exit()
    elif a[0][0] == "0" and a[0][0] == a[1][1] and a[1][1] == a[2][2]:
      print("Yes")
      exit()
    elif a[0][2] == "0" and a[0][2] == a[1][1] and a[0][2] == a[2][0]:
      print("Yes")
      exit()
print("No")
Buggy code:
a = []
for _ in range(3):
    a.append(list(map(int, input().split())))
n = int(input())
b = []
for _ in range(n):
    b.append(int(input()))

check = [[False] * 3 for _ in range(3)]

for b_one in b:
    for i in range(3):
        for j in range(3):
            if a[i][j] == b_one:
                check[i][j] = True

if check[0][0] and check[0][1] and check[0][2]:
    print('Yes')
    return
if check[1][0] and check[1][1] and check[1][2]:
    print('Yes')
    return
if check[2][0] and check[2][1] and check[2][2]:
    print('Yes')
    return
if check[0][0] and check[1][0] and check[2][0]:
    print('Yes')
    return
if check[0][1] and check[1][1] and check[2][1]:
    print('Yes')
    return
if check[0][2] and check[1][2] and check[2][2]:
    print('Yes')
    return
if check[0][0] and check[1][1] and check[2][2]:
    print('Yes')
    return
if check[0][2] and check[1][1] and check[2][0]:
    print('Yes')
    return

print('No')

Fixed code:
def resolve():
    a = []
    for _ in range(3):
        a.append(list(map(int, input().split())))
    n = int(input())
    b = []
    for _ in range(n):
        b.append(int(input()))

    check = [[False] * 3 for _ in range(3)]

    for b_one in b:
        for i in range(3):
            for j in range(3):
                if a[i][j] == b_one:
                    check[i][j] = True

    if check[0][0] and check[0][1] and check[0][2]:
        print('Yes')
        return
    if check[1][0] and check[1][1] and check[1][2]:
        print('Yes')
        return
    if check[2][0] and check[2][1] and check[2][2]:
        print('Yes')
        return
    if check[0][0] and check[1][0] and check[2][0]:
        print('Yes')
        return
    if check[0][1] and check[1][1] and check[2][1]:
        print('Yes')
        return
    if check[0][2] and check[1][2] and check[2][2]:
        print('Yes')
        return
    if check[0][0] and check[1][1] and check[2][2]:
        print('Yes')
        return
    if check[0][2] and check[1][1] and check[2][0]:
        print('Yes')
        return

    print('No')

resolve()
Buggy code:
a = []
a.append(input().split())
a.append(input().split())
a.append(input().split())
n = int(input())

for i in range(n):
  b = input()
  for j in range(3):
    for k in range(3):
      if a[j][k] == b:
        a[j][k] = "0"
        break
    else:
      continue
    break
print(a)

for i in range(3):
  if a[i][0] == a[i][1] == a[i][2] == "0":
    print("Yes")
    exit()
  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")
  exit()

print("No")

Fixed code:
a = []
a.append(input().split())
a.append(input().split())
a.append(input().split())
n = int(input())

for i in range(n):
  b = input()
  for j in range(3):
    for k in range(3):
      if a[j][k] == b:
        a[j][k] = "0"
        break
    else:
      continue
    break

for i in range(3):
  if a[i][0] == a[i][1] == a[i][2] == "0":
    print("Yes")
    exit()
  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")
  exit()

print("No")
Buggy code:
a = []
for x in range(3):
    bingo = list(int(i) for i in input().split())
    a.append(bingo)
N = int(input())
bingolist=[]
for x in range(N):
    c = int(input())
    bingolist.append(c)
b = [[0]*3 for i in range(3)]

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

bingo_tate =0
bingo_naname = 0
bingo_yoko =0
bingo_kakutei =0

for y in range(3):
    if sum(b[y]) == 3:
        bingo_kakutei=1
alist =[]
for x in range(3):
    a_l = [b[0][x],b[1][x],b[2][x]]
    alist.append(a_l)
for x in range(3):
    if sum(alist[y]) == 3:
        bingo_kakutei=1
naname = b[0][0]+b[1][1]+b[2][2]
naname2 = b[0][2]+b[1][1]+b[2][0]
if naname==3 or naname2 ==3:
    bingo_kakutei =1
    
if bingo_kakutei ==1:
    print("Yes")
else:
    print("NO")

Fixed code:
a = []
for x in range(3):
    bingo = list(int(i) for i in input().split())
    a.append(bingo)
N = int(input())
bingolist=[]
for x in range(N):
    c = int(input())
    bingolist.append(c)
b = [[0]*3 for i in range(3)]

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

bingo_tate =0
bingo_naname = 0
bingo_yoko =0
bingo_kakutei =0

for y in range(3):
    if sum(b[y]) == 3:
        bingo_kakutei=1
alist =[]
for x in range(3):
    a_l = [b[0][x],b[1][x],b[2][x]]
    alist.append(a_l)
for x in range(3):
    if sum(alist[x]) == 3:
        bingo_kakutei=1
        
naname = b[0][0]+b[1][1]+b[2][2]
naname2 = b[0][2]+b[1][1]+b[2][0]
if naname==3 or naname2 ==3:
    bingo_kakutei =1
    
if bingo_kakutei ==1:
    print("Yes")
else:
    print("No")
Buggy code:
f=lambda a:any(all(b)for b in a)or all(a[i][i]for i in(0,1,2))   
a=eval('list(map(int,input().split())),'*3)
exec('b=int(input());a=[[u*(u!=b)for u in t]for t in a];'*int(input()))
a=[[not u for u in t]for t in a]
print('NYoe s'[f(a)|f(t[::-1]for t in zip(*a))::2])

Fixed code:
f=lambda a:any(all(b)for b in a)|all(a[i][i]for i in(0,1,2))   
a=eval('list(map(int,input().split())),'*3)
exec('b=int(input());a=[[u*(u!=b)for u in t]for t in a];'*int(input()))
a=[[not u for u in t]for t in a]
print('NYoe s'[f(a)|f([t[::-1]for t in zip(*a)])::2])
Buggy code:
from itertools import product

A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
B = [int(input()) for _ in range(N)]
bingo = [[0] * 3 for _ in range(3)]
for b in B:
    for i, j in product(range(3), repeat=2):
        if A[i][j] == b:
            bingo[i][j] = 1
            break
flag = False
for i in range(3):
    if sum(A[i]) == 3:
        flag = True
        break
else:
    for j in range(3):
        if sum(A[i][j] for i in range(3)) == 3:
            flag = True
            break
    else:
        if sum(A[i][i] for i in range(3)) == 3 or sum(A[i][2-i] for i in range(3)):
            flag = True
print('Yes' if flag else 'No')

Fixed code:
from itertools import product

A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
B = [int(input()) for _ in range(N)]
bingo = [[0] * 3 for _ in range(3)]
for b in B:
    for i, j in product(range(3), repeat=2):
        if A[i][j] == b:
            bingo[i][j] = 1
            break
flag = False
for i in range(3):
    if sum(bingo[i][j] for j in range(3)) == 3:
        flag = True
for j in range(3):
    if sum(bingo[i][j] for i in range(3)) == 3:
        flag = True
if sum(bingo[i][i] for i in range(3)) == 3 or sum(bingo[i][2-i] for i in range(3)) == 3:
    flag = True
print('Yes' if flag else 'No')
Buggy code:
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
A3 = list(map(int, input().split()))
n = int(input())
b = [int(input()) for i in range(n)]
ans = [[1, 1, 1], [1, 1, 1], [1, 1, 1]]
tmp = []
for i in range(3):
    for j in range(len(b)):
        if b[j] == A1[i]:
            A1[i] = 0
        elif b[j] == A2[i]:
            A2[i] = 0
        
        elif b[j] == A3[i]:
            A3[i] = 0

if sum(A1) == 0 or sum(A2) == 0 or sum(A3) == 0:
    print("Yes")

elif A1[0]+A2[0]+A3[0] == 0 or A1[1]+A2[1]+A3[1] == 0 or A1[2]+A2[2]+A3[2] == 0:
    print("Yes")

elif A1[0]+A2[1]+A3[2] == 0 or A1[2]+A2[1]+A3[0]:
    print("Yes")

else:
    print("No")


Fixed code:
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
A3 = list(map(int, input().split()))
n = int(input())
b = [int(input()) for i in range(n)]
ans = [[1, 1, 1], [1, 1, 1], [1, 1, 1]]
tmp = []
for i in range(3):
    for j in range(len(b)):
        if b[j] == A1[i]:
            A1[i] = 0
        elif b[j] == A2[i]:
            A2[i] = 0
        
        elif b[j] == A3[i]:
            A3[i] = 0


if sum(A1) == 0 or sum(A2) == 0 or sum(A3) == 0:
    print("Yes")

elif A1[0]+A2[0]+A3[0] == 0 or A1[1]+A2[1]+A3[1] == 0 or A1[2]+A2[2]+A3[2] == 0:
    print("Yes")

elif A1[0]+A2[1]+A3[2] == 0 or A1[2]+A2[1]+A3[0] == 0:
    print("Yes")

else:
    print("No")
Buggy code:
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))
result = 'No'

n = int(input())
for i in range(n):
	In = int(input())
    
	a1 = ['' if a1[j] == In else a1[j] for j in range(3)]
	a2 = ['' if a2[j] == In else a2[j] for j in range(3)]
	a3 = ['' if a3[j] == In else a3[j] for j in range(3)]

print(a1)
print(a2)
print(a3)
# tate
for i in range(2):
	if a1[i] == '' and a2[i] == '' and a3[i] == '':
		result = 'Yes'
		break
# yoko
if a1.count('') == 3:
		result = 'Yes'
if a2.count('') == 3:
		result = 'Yes'
if a3.count('') == 3:
		result = 'Yes'

# naname
if a1[0] == '' and a2[1] == '' and a3[2] == '':
		result = 'Yes'
    
if a1[2] == '' and a2[1] == '' and a3[1] == '':
		result = 'Yes'
print(result)

Fixed code:
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))
result = 'No'

n = int(input())
for i in range(n):
	In = int(input())
    
	a1 = ['' if a1[j] == In else a1[j] for j in range(3)]
	a2 = ['' if a2[j] == In else a2[j] for j in range(3)]
	a3 = ['' if a3[j] == In else a3[j] for j in range(3)]
    
# tate
for i in range(3):
	if a1[i] == '' and a2[i] == '' and a3[i] == '':
		result = 'Yes'
		break
# yoko
if a1.count('') == 3:
		result = 'Yes'
if a2.count('') == 3:
		result = 'Yes'
if a3.count('') == 3:
		result = 'Yes'

# naname
if a1[0] == '' and a2[1] == '' and a3[2] == '':
		result = 'Yes'
    
if a1[2] == '' and a2[1] == '' and a3[0] == '':
		result = 'Yes'
print(result)
Buggy code:
a=[]
for i in range(3):
    a.append(list(map(int,input().split())))
b=[[0 for i in range(3)] for j in range(3)]
n=int(input())
for i in range(n):
    p=int(input())
    for j in range(3):
        for k in range(3):
            if p==a[i][j]:
                b[i][j]=1
for i in range(3):
    x=0
    y=0
    for j in range(3):
        if b[i][j]==1:
            x+=1
        if b[j][i]==1:
            y+=1
    if x==3 or y==3:
        print('Yes')
        exit()
if b[0][0]==b[1][1]==b[2][2]==1:
    print('Yes')
    exit()
if b[2][0]==b[1][1]==b[0][2]==1:
    print('Yes')
    exit()
print('No')

Fixed code:
a=[]
for i in range(3):
    a.append(list(map(int,input().split())))
b=[[0 for i in range(3)] for j in range(3)]
n=int(input())
for i in range(n):
    p=int(input())
    for j in range(3):
        for k in range(3):
            if p==a[j][k]:
                b[j][k]=1
for i in range(3):
    x=0
    y=0
    for j in range(3):
        if b[i][j]==1:
            x+=1
        if b[j][i]==1:
            y+=1
    if x==3 or y==3:
        print('Yes')
        exit()
if b[0][0]==b[1][1]==b[2][2]==1:
    print('Yes')
    exit()
if b[2][0]==b[1][1]==b[0][2]==1:
    print('Yes')
    exit()
print('No')
Buggy code:
a = [[0] * 3 for x in range(3)]
s = [[0] * 3 for x in range(3)]
for i in range(3):
  a[i] = [int(x) for x in input().split()]
n = int(input())
b = []
for i in range(n):
  b.append(int(input()))
for i in range(n):
  for j in range(3):
    for k in range(3):
      if b[i] == a[j][k]:
        s[j][k] = 1
res = "No"
if s[0][0] == 1 and s[0][1] == 1 and s[0][2] == 1:
  res = "Yes"
if s[1][0] == 1 and s[1][1] == 1 and s[1][2] == 1:
  res = "Yes"
if s[2][0] == 1 and s[2][1] == 1 and s[3][2] == 1:
  res = "Yes"
if s[0][0] == 1 and s[1][0] == 1 and s[2][0] == 1:
  res = "Yes"
if s[0][1] == 1 and s[1][1] == 1 and s[2][1] == 1:
  res = "Yes"
if s[0][2] == 1 and s[1][2] == 1 and s[2][2] == 1:
  res = "Yes"
if s[0][0] == 1 and s[1][1] == 1 and s[2][2] == 1:
  res = "Yes"
if s[2][0] == 1 and s[1][1] == 1 and s[0][2] == 1:
  res = "Yes"
print(res)

Fixed code:
a = [[0] * 3 for x in range(3)]
s = [[0] * 3 for x in range(3)]
for i in range(3):
  a[i] = [int(x) for x in input().split()]
n = int(input())
b = []
for i in range(n):
  b.append(int(input()))
for i in range(n):
  for j in range(3):
    for k in range(3):
      if b[i] == a[j][k]:
        s[j][k] = 1
res = "No"
if s[0][0] == 1 and s[0][1] == 1 and s[0][2] == 1:
  res = "Yes"
if s[1][0] == 1 and s[1][1] == 1 and s[1][2] == 1:
  res = "Yes"
if s[2][0] == 1 and s[2][1] == 1 and s[2][2] == 1:
  res = "Yes"
if s[0][0] == 1 and s[1][0] == 1 and s[2][0] == 1:
  res = "Yes"
if s[0][1] == 1 and s[1][1] == 1 and s[2][1] == 1:
  res = "Yes"
if s[0][2] == 1 and s[1][2] == 1 and s[2][2] == 1:
  res = "Yes"
if s[0][0] == 1 and s[1][1] == 1 and s[2][2] == 1:
  res = "Yes"
if s[2][0] == 1 and s[1][1] == 1 and s[0][2] == 1:
  res = "Yes"
print(res)
Buggy code:
s = []
for i in range(3):
    array = list(map(int,input().split()))
    s.append(array)
N = int(input())
t = [int(input()) for i in range(N)]

for i in range(N):
    for j in range(3):
        for l in range(3):
            if t[i] == s[j][l]
            s[j][l] = 0

if sum(s[0]) == 0 or sum(s[1]) == 0 or sum(s[2]) == 0 or s[0][0]+s[1][0]+s[2][0] == 0 or s[0][1]+s[1][1]+s[2][1] == 0 or s[0][2]+s[1][2]+s[2][2] == 0 or s[0][0]+s[1][1]+s[2][2] == 0 or s[2][0]+s[1][1]+s[0][2] == 0:
    print("Yes")
else:
    print("No")

Fixed code:
s = []
for i in range(3):
    array = list(map(int,input().split()))
    s.append(array)
N = int(input())
t = [int(input()) for i in range(N)]
 
for i in range(N):
    for j in range(3):
        for l in range(3):
            if t[i] == s[j][l]:
                s[j][l] = 0
 
if sum(s[0]) == 0 or sum(s[1]) == 0 or sum(s[2]) == 0 or s[0][0]+s[1][0]+s[2][0] == 0 or s[0][1]+s[1][1]+s[2][1] == 0 or s[0][2]+s[1][2]+s[2][2] == 0 or s[0][0]+s[1][1]+s[2][2] == 0 or s[2][0]+s[1][1]+s[0][2] == 0:
    print("Yes")
else:
    print("No")
Buggy code:
As = [list(map(int, input().split())) for x in range(3)]
N = int(input())
bs = [int(input()) for x in range(N)]


def create_bingo_card():
  result = [[0, 0, 0] for x in range(3)]
  i = 0
  while True:
    i2 = 0
    while True:
      if bs[i2] in As[i]:
        result[i][As[i].index(bs[i2])] += 1
      i2 += 1
      if i2 == len(bs):
        break
    i += 1
    if i == len(As):
      break
  return result


def solvd(bingo):
  tmp = [bingo[0][0], bingo[1][1], bingo[2][2]]
  if check1(tmp):
    print("Yes")
    return

  tmp = [bingo[0][2], bingo[1][1], bingo[2][0]]
  if check1(tmp):
    print("Yes")
    return

  r = 0
  for x in range(3):
    tmp = [bingo[0][x], bingo[1][x], bingo[2][x]]
    if check1(tmp):
      print("Yes")
      return

    bingoSet = set(bingo[x])
    if check2(bingoSet):
      r += 1

  if r == 3:
    print("Yes")
    return
  print("No")


def check1(s):
  return s.count(1) == 3


def check2(s):
  return not (0 in list(s))


def main():
  Cs = create_bingo_card()
  print(Cs)
  solvd(Cs)


if __name__ == "__main__":
    main()



Fixed code:
As = [list(map(int, input().split())) for x in range(3)]
N = int(input())
bs = [int(input()) for x in range(N)]


def create_bingo_card():
  result = [[0, 0, 0] for x in range(3)]
  i = 0
  while True:
    i2 = 0
    while True:
      if bs[i2] in As[i]:
        result[i][As[i].index(bs[i2])] += 1
      i2 += 1
      if i2 == len(bs):
        break
    i += 1
    if i == len(As):
      break
  return result


def solvd(bingo):
  tmp = [bingo[0][0], bingo[1][1], bingo[2][2]]
  if check1(tmp):
    print("Yes")
    return

  tmp = [bingo[0][2], bingo[1][1], bingo[2][0]]
  if check1(tmp):
    print("Yes")
    return

  r = 0
  for x in range(3):
    tmp = [bingo[0][x], bingo[1][x], bingo[2][x]]
    if check1(tmp):
      print("Yes")
      return

    bingoSet = set(bingo[x])
    if check2(bingoSet):
      r += 1

  if r >= 1:
    print("Yes")
    return
  print("No")


def check1(s):
  return s.count(1) == 3


def check2(s):
  return not (0 in list(s))


def main():
  Cs = create_bingo_card()
  solvd(Cs)


if __name__ == "__main__":
    main()
Buggy code:
A=[list(map(int,input().split())) for i in range(3)]
AB=[[0 for i in range(3)] for j in range(3)]
N=int(input())
for i in range(N):
    x=input()
    for j in range(3):
        for k in range(3):
            if A[i][j]==x:
                AB[i][j]=1
c=1
for i in range(3):
    if A[i][0]*A[i][1]*A[i][2]==1:
        c=0
        print("Yes")
        break
    if A[0][i]*A[1][i]*A[2][i]==1:
        c=0
        print("Yes")
        break
    if A[0][0]*A[1][1]*A[2][2]==1:
        c=0
        print("Yes")
        break
    if A[0][2]*A[1][1]*A[2][0]==1:
        c=0
        print("Yes")
        
if c==1:
    print("No")

Fixed code:
A=[list(map(int,input().split())) for i in range(3)]
AB=[[0 for i in range(3)] for j in range(3)]
N=int(input())
for i in range(N):
    x=int(input())
    for j in range(3):
        for k in range(3):
            if A[j][k]==x:
                AB[j][k]=1
c=1
for i in range(3):
    if AB[i][0]*AB[i][1]*AB[i][2]==1:
        c=0
        break
    if AB[0][i]*AB[1][i]*AB[2][i]==1:
        c=0
        break
    if AB[0][0]*AB[1][1]*AB[2][2]==1:
        c=0
        break
    if AB[0][2]*AB[1][1]*AB[2][0]==1:
        c=0
        break
        

if c==1:
    print("No")
else:
  	print("Yes")
Buggy code:
A = [list(map(int,input().split())) for i in range(3)]
n = int(input())
for j in range(n):
  b = int(input())
  for j in range(3):
    for k in range(3): 
    	if b==A[j][k]:
      		A[j][k]=-1
print(A)
for k in range(3):
  if A[k][:]==[-1,-1,-1]:
    print('Yes')
    exit(0)
 
for k in range(3):
  if sum(A[:][k])==[-1,-1,-1]:
    print('Yes')
    exit(0)
 
if (A[0][0]==A[1][1]==A[2][2]==[-1,-1,-1])or(A[2][0]==A[1][1]==A[0][2]==[-1,-1,-1]): 
    print('Yes')
    exit(0)
    
print('No')

Fixed code:
A = [list(map(int,input().split())) for i in range(3)]
n = int(input())
for j in range(n):
  b = int(input())
  for j in range(3):
    for k in range(3): 
    	if b==A[j][k]:
      		A[j][k]=-1

for k in range(3):
  if A[k][:]==[-1,-1,-1]:
    print('Yes')
    exit(0)

ri = [[_[k] for _ in A]for k in range(3)]

for k in range(3):
  if ri[:][k]==[-1,-1,-1]:
    print('Yes')
    exit(0)
    
if (A[0][0]==A[1][1]==A[2][2]==-1)or(A[2][0]==A[1][1]==A[0][2]==-1): 
    print('Yes')
    exit(0)
    
print('No')
Buggy code:
card = []
for i in range(3):
    a1,a2,a3 = map(int,input().split())
    card.append([a1,a2,a3])
print(card)

n = int(input())

for i in range(n):
    num = int(input())
    for j in [0,1,2]:
        for k in [0,1,2]:
         if num == card[j][k]:
             card[j][k] = 0
if card[0] == [0,0,0] or card[1] == [0,0,0] or card[2] == [0,0,0]:
    print('Yes')
elif [card[i][0] for i in range(3)] == [0,0,0] or [card[i][1] for i in range(3)] == [0,0,0] or [card[i][2] for i in range(3)] == [0,0,0]:
    print('Yes')
elif [card[0][0],card[1][1],card[2][2]] == [0,0,0] or [card[0][2],card[1][1],card[2][0]] == [0,0,0]:
    print('Yes')
else:
    print('No')


Fixed code:
card = []
for i in range(3):
    a1,a2,a3 = map(int,input().split())
    card.append([a1,a2,a3])

n = int(input())

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

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