Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
s = input()
t = set()
for i in range(len(s)):
  t.add(s[i])
o = list(t)
o.sort()
u = 'qwertyuiopasdfghjklzxcvbnm'
v = []
for i in range(len(u)):
  v.append(u[i])
v.sort()
now = 0
if len(o) == 26:
  print('None')
else:
  for i in range(26):
    if o[i] == v[i]:
      now += 1
    else:
      print(v[now])
      break

Fixed submission:
s = input()
t = set()
for i in range(len(s)):
  t.add(s[i])
o = list(t)
o.sort()
u = 'qwertyuiopasdfghjklzxcvbnm'
v = []
for i in range(len(u)):
  v.append(u[i])
v.sort()
now = 0
if len(o) == 26:
  print('None')
else:
  for i in range(26):
    if i >= len(t):
      print(v[i])
      break
    elif o[i] == v[i]:
      now += 1
    else:
      print(v[now])
      break

Buggy python submission (verdict: Runtime Error):
s = input()
t = set()
for i in range(len(s)):
  t.add(s[i])
o = list(t)
o.sort()
u = 'qwertyuiopasdfghjklzxcvbnm'
v = []
for i in range(len(u)):
  v.append(u[i])
v.sort()
now = 0
for i in range(26):
  if o[i] == v[i]:
    now += 1
  else:
    print(v[now])
    break
else:
  print('None')

Fixed submission:
s = input()
t = set()
for i in range(len(s)):
  t.add(s[i])
o = list(t)
o.sort()
u = 'qwertyuiopasdfghjklzxcvbnm'
v = []
for i in range(len(u)):
  v.append(u[i])
v.sort()
now = 0
if len(o) == 26:
  print('None')
else:
  for i in range(26):
    if i >= len(t):
      print(v[i])
      break
    elif o[i] == v[i]:
      now += 1
    else:
      print(v[now])
      break
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
b = []
for i in range(n):
  b.append(a[i])
  b.reverse()
print(' '.join(map(str,b)))

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = []
for i in range((n+1)//2):
  here = n-1-2*i
  b.append(str(a[here]))
for i in range(n//2):
  here = 2*i+(n%2)
  b.append(str(a[here]))
print(' '.join(b))
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
n = len(s)
t = ''
here = 0
er = 0
r = 0
flag = 1
while here < n:
  if s[here] == 'e' and here + 2 < n:
    if s[here:here+3] == 'era':
      t += 'erase'
      here += 5
      er = 0
      r = 1
    elif s[here] == 'e' and er == 1:
      t += 'er'
      here += 2
      er = 0
      r = 0
  elif s[here] == 'e' and er == 1:
    t += 'er'
    here += 2
    er = 0
    r = 0
  elif s[here] == 'd':
    t += 'dream'
    here += 5
    er = 1
    r = 0
  elif s[here] == 'r' and r == 1:
    t += 'r'
    here += 1
    er = 0
    r = 0
  else:
    flag = 0
    break
if s == t and flag == 1:
  print('YES')
else:
  print('NO')

Fixed submission:
#解説解答
s = input()
n = len(s)
here = n
t = ''
while here > 0:
  try:
    if s[here-1:here] == 'm':
      t = 'dream' + t
      here -= 5
    elif s[here-1:here] == 'e':
      t = 'erase' + t
      here -= 5
    elif s[here-3:here] == 'mer':
      t = 'dreamer' + t
      here -= 7
    elif s[here-3:here] == 'ser':
      t = 'eraser' + t
      here -= 6
    else:
      break
  except:
    break
if s == t:
  print('YES')
else:
  print('NO')
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
print('A'+b[0]+'C')

Fixed submission:
#09:23
a,b,c = input().split()
print('A'+b[0]+'C')
Buggy python submission (verdict: Runtime Error):
a,b,h = map(int,input().split())
print( (a+b) * h // 2 )

Fixed submission:
#11:10
a = int(input())
b = int(input())
h = int(input())
print((a+b)*h//2)
Buggy python submission (verdict: Time Limit Exceeded):
#解説解答
n,a = map(int,input().split())
x = list(map(int,input().split()))
dp0 = [[0 for s in range(n*a+1)] for k in range(n+1)]
dp0[0][0] = 1
dp = dp0
for j in range(n):
  now = []
  for k in range(n+1):
    add = []
    for s in range(n*a+1):
      t = s-x[j]
      if t >= 0 and k >= 1:
        add.append( dp[k][s] + dp[k-1][t] )
      else:
        add.append( dp[k][s] )
    now.append(add)
  dp = now
ans = 0
for k in range(1,n+1):
  ans += dp[k][k*a]
print(ans)

Fixed submission:
#解説解答
n,a = map(int,input().split())
x = list(map(int,input().split()))
dp0 = [[0 for s in range(n*a+1)] for k in range(n+1)]
dp0[0][0] = 1
dp = dp0
for j in range(n):
  now = []
  for k in range(n+1):
    add = []
    for s in range(n*a+1):
      t = s-x[j]
      if t >= 0 and k >= 1:
        add.append( dp[k][s] + dp[k-1][t] )
      else:
        add.append( dp[k][s] )
    now.append(add)
  dp = now
ans = 0
for k in range(1,n+1):
  ans += dp[k][k*a]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#解説解答
n,a = map(int,input().split())
x = list(map(int,input().split()))
dp0 = [[0 for s in range(n*a+1)] for k in range(n+1)]
dp0[0][0] = 1
dp = [dp0]
for j in range(n):
  now = [[] for k in range(n+1)]
  for k in range(n+1):
    for s in range(n*a+1):
      if s-x[j] >= 0 and k >= 1:
        now[k].append( dp[j][k][s] + dp[j][k-1][max(0,s-x[j])] )
      else:
        now[k].append( dp[j][k][s] )
  dp.append(now)
now = dp[n]
ans = 0
for k in range(1,n+1):
  ans += now[k][k*a]
print(ans)

Fixed submission:
#解説解答
n,a = map(int,input().split())
x = list(map(int,input().split()))
dp0 = [[0 for s in range(n*a+1)] for k in range(n+1)]
dp0[0][0] = 1
dp = dp0
for j in range(n):
  now = []
  for k in range(n+1):
    add = []
    for s in range(n*a+1):
      t = s-x[j]
      if t >= 0 and k >= 1:
        add.append( dp[k][s] + dp[k-1][t] )
      else:
        add.append( dp[k][s] )
    now.append(add)
  dp = now
ans = 0
for k in range(1,n+1):
  ans += dp[k][k*a]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,a = map(int,input().split())
c = list(map(int,input().split()))
def suc(time):
  now = n-1
  while True:
    if now == -1:
      return 'over'
      break
    if time[now] == 0:
      time[now] = 1
      return time
      break
    else:
      time[now] = 0
      now -= 1
time = [0 for _ in range(n)]
ans = 0
while time != 'over':
  now = 0
  cnt = 0
  for i in range(n):
    now += time[i] * c[i]
    cnt += time[i]
  if now == a * cnt:
    ans += 1
  time = suc(time)
print(ans-1)

Fixed submission:
#解説解答
n,a = map(int,input().split())
x = list(map(int,input().split()))
dp0 = [[0 for s in range(n*a+1)] for k in range(n+1)]
dp0[0][0] = 1
dp = dp0
for j in range(n):
  now = []
  for k in range(n+1):
    add = []
    for s in range(n*a+1):
      t = s-x[j]
      if t >= 0 and k >= 1:
        add.append( dp[k][s] + dp[k-1][t] )
      else:
        add.append( dp[k][s] )
    now.append(add)
  dp = now
ans = 0
for k in range(1,n+1):
  ans += dp[k][k*a]
print(ans)
Buggy python submission (verdict: Runtime Error):
n,K = map(int,input().split())
use = [0,1,2,3,4,5,6,7,8,9]
useless = list(map(int,input().split()))
for i in range(K):
  use.remove(useless[i])
k = 10 - K
time = [0]
def suc(time):
  now = 0
  while True:
    if now >= len(time):
      time.append(0)
      break
    elif time[now] != k-1:
      time[now] += 1
      break
    else:
      time[now] = 0
      now += 1
  return time
#print(suc([0]))
#print(suc([1,1,1,1]))
#print(suc([1,0,1,1]))
while True:
  pay = 0
  for j in range(len(time)):
    pay += use[time[j]] * 10 ** j
  if pay >= n:
    print(pay)
    break
  time = suc(time)

Fixed submission:
#ABC043
l = list(map(int,input().split()))
l.sort()
if l == [5,5,7]:
  print('YES')
else:
  print('NO')
Buggy python submission (verdict: Runtime Error):
n,K = map(int,input().split())
use = [0,1,2,3,4,5,6,7,8,9]
useless = list(map(int,input().split()))
for i in range(K):
  use.remove(useless[i])
k = 10 - K
time = [0]
def suc(time):
  now = 0
  while True:
    if now >= len(time):
      time.append(1)
      break
    elif time[now] != k-1:
      time[now] += 1
      break
    else:
      time[now] = 0
      now += 1
  return time
#print(suc([0]))
#print(suc([1,1,1,1]))
#print(suc([1,0,1,1]))
while True:
  pay = 0
  for j in range(len(time)):
    pay += use[time[j]] * 10 ** j
  if pay >= n:
    print(pay)
    break
  time = suc(time)

Fixed submission:
n,K = map(int,input().split())
use = [0,1,2,3,4,5,6,7,8,9]
useless = list(map(int,input().split()))
for i in range(K):
  use.remove(useless[i])
k = 10 - K
time = [0]
def suc(time):
  now = 0
  while True:
    if now >= len(time):
      time.append(0)
      break
    elif time[now] != k-1:
      time[now] += 1
      break
    else:
      time[now] = 0
      now += 1
  return time
#print(suc([0]))
#print(suc([1,1,1,1]))
#print(suc([1,0,1,1]))
while True:
  pay = 0
  for j in range(len(time)):
    pay += use[time[j]] * 10 ** j
  if pay >= n:
    print(pay)
    break
  time = suc(time)

Buggy python submission (verdict: Runtime Error):
n,K = map(int,input().split())
use = [0,1,2,3,4,5,6,7,8,9]
useless = list(map(int,input().split()))
for i in range(K):
  use.remove(useless[i])
k = 10 - K
time = [0]
def suc(time):
  now = 0
  while True:
    if now >= len(time):
      time.append(1)
      break
    elif time[now] != k-1:
      time[now] += 1
      break
    else:
      time[now] = 0
      now += 1
  return time
#print(suc([0]))
#print(suc([1,1,1,1]))
#print(suc([1,0,1,1]))
while True:
  pay = 0
  for j in range(len(time)):
    pay += use[time[j]] * 10 ** j
  if pay >= n:
    print(pay)
    break
  time = suc(time)

Fixed submission:
n,K = map(int,input().split())
use = [0,1,2,3,4,5,6,7,8,9]
useless = list(map(int,input().split()))
for i in range(K):
  use.remove(useless[i])
k = 10 - K
time = [0]
def suc(time):
  now = 0
  while True:
    if now >= len(time):
      time.append(0)
      break
    elif time[now] != k-1:
      time[now] += 1
      break
    else:
      time[now] = 0
      now += 1
  return time
#print(suc([0]))
#print(suc([1,1,1,1]))
#print(suc([1,0,1,1]))
while True:
  pay = 0
  for j in range(len(time)):
    pay += use[time[j]] * 10 ** j
  if pay >= n:
    print(pay)
    break
  time = suc(time)
Buggy python submission (verdict: Runtime Error):
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

N,M =map(int, input().split())
uni = UnionFind(N)

for _ in range(M):
    a,b = map(int, input().split())
    uni.union(a,b)

print(uni.group_count()-1)

Fixed submission:
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

N,M = map(int, input().split())
uni = UnionFind(N)

for _ in range(M):
    a,b = map(int, input().split())
    uni.union(a-1,b-1)

print(uni.group_count()-1)
Buggy python submission (verdict: Time Limit Exceeded):

def main():
    N = int(input())
    s = list(input())

    cnt = 0
    prej = N
    for i in range(N):
        if s[i] == "R":
            continue
        if i >= prej:
            break
        for j in list(range(i+1,prej))[::-1]:
            if s[j] == "W":
                continue
            if i >= j:
                break
            cnt += 1 
            prej = j
            break
    print(cnt)

if __name__ == "__main__":
    main()


Fixed submission:

N = int(input())
s = list(input())

reds = 0
for c in s:
    reds += 1 if c == "R" else 0

whites = 0
for i in range(reds):
    whites += 1 if s[i] == "W" else 0

print(whites)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
s = list(input())

cnt = 0
prej = N
for i in range(N):
    if s[i] == "R":
        continue
    for j in list(range(i+1,prej))[::-1]:
        if s[j] == "W":
            continue
        if i >= j:
            break
        cnt += 1 
        prej = j
        break
print(cnt)

Fixed submission:

N = int(input())
s = list(input())

reds = 0
for c in s:
    reds += 1 if c == "R" else 0

whites = 0
for i in range(reds):
    whites += 1 if s[i] == "W" else 0

print(whites)
Buggy python submission (verdict: Time Limit Exceeded):

import random

def main():
    D = int(input())
    c_list = list(map(int, input().split()))
    s_list = [list(map(int, input().split())) for _ in range(D)]
    
    basic_bad = sum(c_list)

    # 初期解生成は必要っぽい
    res = 0
    bad = 0
    last_open = [0] * 26
    t_list = [0] * D

    max_res = -1
    max_t_list = [0] * D

    # loop
    for m in range(10**5):
        t_list = [random.randint(0,25) for i in range(D)]
        res = 0
        bad = 0
        last_open = [0] * 26
        for i in range(D):
            t = t_list[i]
            
            res += s_list[i][t]
            bad += basic_bad - (i+1 - last_open[t]) * c_list[t]
            last_open[t] = i+1

            res -= bad
            
        if max_res == -1 or max_res < res:
            max_res = res
            max_t_list = t_list.copy()

    for t in max_t_list:
        print(t+1)

if __name__ == "__main__":
    main()


Fixed submission:
import random

D = int(input())
c_list = list(map(int, input().split()))
s_list = [list(map(int, input().split())) for _ in range(D)]

for i in range(D):
    print(random.randint(1,26))
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    a_list = list(map(int, input().split()))
    BITS = 30
    sum_bit = [0] * BITS
    a_bits = []

    for a in a_list:
        bits = [a>> j & 1 for j in range(BITS)]
        for i, bit in enumerate(bits):
            sum_bit[i] += bit
        a_bits.append(bits)

    for a_bit in a_bits:
        # rb -> sum_bitのビット, ab -> a_bitのビット
        res = 0
        cur = 1
        for i in range(BITS):
            res += cur if (a_bit[i] + sum_bit[i])%2 == 1 else 0
            cur *= 2
        print(res, end=" ")

if __name__ == "__main__":
    main()



Fixed submission:
def main():
    N = int(input())
    a_list = list(map(int, input().split()))
    BITS = 30
    sum_bit = [0] * BITS
    a_bits = []

    for a in a_list:
        bits = [a>> j & 1 for j in range(BITS)]
        for i, bit in enumerate(bits):
            sum_bit[i] += bit
        a_bits.append(bits)

    for a_bit in a_bits:
        # rb -> sum_bitのビット, ab -> a_bitのビット
        res = 0
        cur = 1
        for i in range(BITS):
            res += cur if (a_bit[i] + sum_bit[i])%2 == 1 else 0
            cur *= 2
        print(res, end=" ")

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
a_list = list(map(int, input().split()))
res = 1
for a in a_list:
    res *= a

print(res if res <= 10**18 else -1)

Fixed submission:
N=int(input())
a_list = list(map(int, input().split()))

if 0 in a_list:
    print(0)
    exit()

res = 1
for a in a_list:
    res *= a
    if res > 10**18:
        print(-1)
        exit()

print(res)
Buggy python submission (verdict: Time Limit Exceeded):

N, K= list(map(int, input().split()))
A_list = list(map(int, input().split()))

loop = []
trace = [0] * (N+1)

ai = 1
for i in range(N+1):
    if ai in trace:
        ind = trace.index(ai)
        loop = trace[ind:i]
        trace = trace[:ind]
        break

    trace[i] = ai # ??
    ai = A_list[ai-1]

if len(trace) > K:
    print(trace[K])
else:
    ind = K - len(trace)
    ind = ind % len(loop)
    print(loop[ind])


Fixed submission:

N, K= list(map(int, input().split()))
A_list = list(map(int, input().split()))

loop = []
trace = [0] * (N+1)
visited = set()

ai = 1
for i in range(N+1):
    if ai in visited:
        ind = trace.index(ai)
        loop = trace[ind:i]
        trace = trace[:ind]
        break
    visited.add(ai)
    
    trace[i] = ai # ??
    ai = A_list[ai-1]


if len(trace) > K:
    print(trace[K])
else:
    ind = K - len(trace)
    ind = ind % len(loop)
    print(loop[ind])

Buggy python submission (verdict: Time Limit Exceeded):
N, K= list(map(int, input().split()))
A_list = list(map(int, input().split()))

loop = []
trace = []
ai = 1
for i in range(N+1):
    if ai in trace:
        loop = trace[trace.index(ai):]
        trace = trace[:trace.index(ai)]
        break
    trace.append(ai)
    ai = A_list[ai-1]

if len(trace) > K:
    print(trace[K])
else:
    ind = K - len(trace)
    ind = ind % len(loop)
    print(loop[ind])

Fixed submission:

N, K= list(map(int, input().split()))
A_list = list(map(int, input().split()))

loop = []
trace = [0] * (N+1)
visited = set()

ai = 1
for i in range(N+1):
    if ai in visited:
        ind = trace.index(ai)
        loop = trace[ind:i]
        trace = trace[:ind]
        break
    visited.add(ai)
    
    trace[i] = ai # ??
    ai = A_list[ai-1]


if len(trace) > K:
    print(trace[K])
else:
    ind = K - len(trace)
    ind = ind % len(loop)
    print(loop[ind])
Buggy python submission (verdict: Runtime Error):
def main():
    N,M,K = map(int, input().split())
    MOD = 998244353

    dp = [[0] * N for _ in range(K+1)]
    dp[0][0] = M

    for i in range(1,N):
        dp[0][i] = (dp[0][i-1] * (M-1)) % MOD

        for k in range(1, K+1):
            dp[k][i] = (dp[k][i-1] * (M-1) + dp[k-1][i-1]) % MOD
        
    res = 0
    for k in range(K+1):
        res += dp[k][-1]
    print(res)


if __name__ == "__main__":
    main()

Fixed submission:

N,M,K = map(int, input().split())
MOD = 998244353

fact = [0] * (N+1)
inv = [0] * (N+1)

fact[0] = fact[1]  = 1
inv[1] = 1

for i in range(2, N+1):
    fact[i] = fact[i-1] * i % MOD
    inv[i] = MOD - inv[MOD%i] * (MOD//i) % MOD # //で良いのかな?

def main():
    if N == 1:
        print(M)
        return 
    num = M
    nums = [M]
    for i in reversed(range(1,N)):
        num *= i*(M-1)
        num *= inv[N-i]
        num %= MOD
        nums.append(num)
    nums.reverse()
    print(sum(nums[:K+1])%MOD)

    
if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):

import math
K = int(input())

res = 0
for a in range(K):
    for b in range(K):
        for c in range(K):
            res += math.gcd(math.gcd(a+1, b+1), c+1)
print(res)     


Fixed submission:
import math
K = int(input())

# table = np.zeros((K,K), dtype="int16")
table = [[0] * K for i in range(K)]

for a in range(K):
    for b in range(a, K):
        tmp = math.gcd(a+1, b+1)
        table[a][b] = tmp
        table[b][a] = tmp

res = 0
for a in range(K):
    for b in range(K):
        for c in range(K):
            res += table[table[a][b]-1][c]
print(res)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
Q = int(input())

for i in range(Q):
    q = input()
    if q == '1':
        S = S[::-1]
        continue
    t,f,c = q.split()
    if f == '1':
        S = c + S
    else:
        S = S + c

print(S)

Fixed submission:
S = input()
Q = int(input())



front = ''
back = ''

r_flg = False
for i in range(Q):
    q = input()
    if q == '1':
        r_flg = False if r_flg else True
        continue
        
    t,f,c = q.split()
    if not r_flg:
        if f == '1':
            front += c
        else:
            back += c
    else:
        if f == '1':
            back += c
        else:
            front += c
    
if not r_flg:
    print(front[::-1]+S+back)
else:
    print(back[::-1] + S[::-1] + front)
Buggy python submission (verdict: Time Limit Exceeded):

N, P = input().split()
p_len = len(P)
N = int(N)
P = int(P)

S = input()

cnt = 0

if P in [2,5]:
    for i in range(N):
        cnt += i+1 if int(S[i]) % P == 0 else 0
else:
    for l in range(1, N+1):
        for i in range(N+1-l):
            cnt += 1 if int(S[i:i+l]) % P == 0 else 0
print(cnt)

Fixed submission:
N, P = input().split()
p_len = len(P)
N = int(N)
P = int(P)

S = input()


cnt = 0
if P in [2,5]:
    for i in range(N):
        cnt += i+1 if int(S[i]) % P == 0 else 0
else:
    table = [0] * P # ?1
    Ui = 0
    ten = 1
    
    S = S[::-1]
    table[0] = 1 # ?2
    
    for i in range(N):
        Ui = (Ui + int(S[i]) * ten) % P # ?3
        
        cnt += table[Ui] # ?4
        
        table[Ui] += 1 # ?5
        ten = (ten * 10) % P # ?6
print(cnt)
Buggy python submission (verdict: Runtime Error):
# import numpy as np

bingo = np.zeros((3,3))
bin_bingo = np.zeros((3,3))


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

N = int(input())

for _ in range(N):
    num = int(input())
    bin_bingo = np.logical_or(bin_bingo, bingo == num)

# find bingo
lin1 = np.array([[True, True, True], [False, False, False], [False, False, False]])
lin2 = np.array([[False, False, False],[True, True, True], [False, False, False]])
lin3 = np.array([[False, False, False], [False, False, False], [True, True, True]])
col1 = lin1.T
col2 = lin2.T
col3 = lin3.T

sla1 = np.array([[True, False, False], [False, True, False], [False, False, True]])
sla2 = np.array([[False, False, True], [False, True, False], [True, False, False]])

def is_bingo(src, tmp):
    return (np.logical_and(bin_bingo, sla1) == sla1).all()

flg = False
if is_bingo(bin_bingo, lin1):
    flg = True
elif is_bingo(bin_bingo, lin2):
    flg = True
    
elif is_bingo(bin_bingo, lin3):
    flg = True

elif is_bingo(bin_bingo, col1):
    flg = True
elif is_bingo(bin_bingo, col2):
    flg = True
elif is_bingo(bin_bingo, col3):
    flg = True
elif is_bingo(bin_bingo, sla1):
    flg = True
elif is_bingo(bin_bingo, sla2):
    flg = True

if flg:
    print('Yes')
else:
    print('No')

Fixed submission:
import numpy as np

bingo = np.zeros((3,3))
bin_bingo = np.zeros((3,3))

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



N = int(input())

for _ in range(N):
    num = int(input())
    bin_bingo = np.logical_or(bin_bingo, bingo == num)

# find bingo
lin1 = np.array([[True, True, True], [False, False, False], [False, False, False]])
lin2 = np.array([[False, False, False],[True, True, True], [False, False, False]])
lin3 = np.array([[False, False, False], [False, False, False], [True, True, True]])
col1 = lin1.T
col2 = lin2.T
col3 = lin3.T

sla1 = np.array([[True, False, False], [False, True, False], [False, False, True]])
sla2 = np.array([[False, False, True], [False, True, False], [True, False, False]])

def is_bingo(src, tmp):
    return (np.logical_and(src, tmp) == tmp).all()

flg = False
if is_bingo(bin_bingo, lin1):
    flg = True
elif is_bingo(bin_bingo, lin2):
    flg = True
elif is_bingo(bin_bingo, lin3):
    flg = True
elif is_bingo(bin_bingo, col1):
    flg = True
elif is_bingo(bin_bingo, col2):
    flg = True
elif is_bingo(bin_bingo, col3):
    flg = True
elif is_bingo(bin_bingo, sla1):
    flg = True
elif is_bingo(bin_bingo, sla2):
    flg = True

if flg:
    print('Yes')
else:
    print('No')