Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02702 (python)

Fixed submission:
S = input()
S = S[::-1]
L = [0]
i = 0
for x in S:
    tmp = L[-1] + pow(10, i , 2019) * int(x) 
    L.append(tmp % 2019)
    i += 1
L = sorted(L[1::])
def counter(array):
    from collections import Counter
    return list(Counter(array).most_common())
c = counter(L)
from math import factorial
def comb(n,r):
    if n == 1: return 0
    return  n * (n - 1) // 2
ans = 0
for x in c:
    if x[0] == 0: ans += x[1]
    ans += comb(x[1],2)
print(int(ans))

Buggy submission (verdict: Runtime Error):
S = input()
S = S[::-1]
L = [0]
i = 0
for x in S:
    tmp = L[-1] + 10 ** i * int(x) % 2019
 #   print(tmp % 2019)
    L.append(tmp % 2019)
    i += 1
L = sorted(L[1::])
def counter(array):
    from collections import Counter
    return list(Counter(array).most_common())
c = counter(L)
from math import factorial
def comb(n,r):
    if n == 1: return 0
    return  return n * (n - 1) // 2
ans = 0
for x in c:
    if x[0] == 0: ans += x[1]
    ans += comb(x[1],2)
#print(L,c)
print(int(ans))

Buggy submission (verdict: Runtime Error):
S = input()
S = S[::-1]
L = [0]
i = 0
for x in S:
    tmp = L[-1] + 10 ** i * int(x) % 2019
 #   print(tmp % 2019)
    L.append(tmp % 2019)
    i += 1
L = sorted(L[1::])
def counter(array):
    from collections import Counter
    return list(Counter(array).most_common())
c = counter(L)
from math import factorial
def comb(n,r):
    if n == 1: return 0
    return  return n * (n - 1) // 
ans = 0
for x in c:
    if x[0] == 0: ans += x[1]
    ans += comb(x[1],2)
#print(L,c)
print(int(ans))
Problem p03152 (python)

Fixed submission:
import sys

# %%

n, m = list(map(int, sys.stdin.readline().split()))
ary = sorted(list(map(int, sys.stdin.readline().split())), reverse=True)
bry = sorted(list(map(int, sys.stdin.readline().split())), reverse=True)
mod = 10 ** 9 + 7

# %%

if len(set(ary)) != len(ary) or len(set(bry)) != len(bry):
    print(0)

else:
    ary.append(0)
    bry.append(0)

    cnt = 1
    i = 0
    j = 0
    for num in range(n * m, 0, -1):

        if (num == ary[i]) and (num == bry[j]):
            i += 1
            j += 1

        elif (num == ary[i]) or (num == bry[j]):
            if num == ary[i]:
                cnt *= len(bry[:j])
                i += 1
            else:
                cnt *= len(ary[:i])
                j += 1

        else:
            # na = len(ary[:i])
            # nb = len(bry[:j])
            cnt *= (i * j - (n * m - num))

        cnt = cnt % mod

    print(cnt)

Buggy submission (verdict: Runtime Error):
# %%

n, m = list(map(int, input().split()))
ary = list(map(int, input().split())).sort(reverse=True)
bry = list(map(int, input().split())).sort(reverse=True)
mod = 10 ** 9 + 7

# %%

if len(set(ary)) != len(ary) or len(set(bry)) != len(bry):
    print(0)

else:
    cnt = 1
    i = 0
    j = 0
    for num in range(n * m, 0, -1):
        if (num in ary[i:]) & (num in bry[j:]):
            i += 1
            j += 1
        elif (num in ary[i:]) ^ (num in bry[j:]):
            if num in ary[i:]:
                cnt *= len([b for b in bry if num < b]) % mod
                i += 1
            else:
                cnt *= len([a for a in ary if num < a]) % mod
                j += 1
        else:
            nn = len([a for a in ary if num < a])
            nm = len([b for b in bry if num < b])
            cnt *= (nn * nm - (n * m - num)) % mod

    print(cnt % mod)
Problem p03282 (python)

Fixed submission:
# -*- coding: utf-8 -*-
s = input()
k = int(input())

l = len(s)
ones = 0
i = 0
while s[i] == '1':
    ones += 1
    i += 1
    if i == l:
        break

if ones >= k:
    print('1')
else:
    print(s[i])

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
s = input()
k = int(input())

ones = 0
i = 0
while s[i] == '1':
    ones += 1
    i += 1

if ones >= k:
    print('1')
else:
    print(s[i])
Problem p03287 (python)

Fixed submission:
# -*- coding: utf-8 -*-
from itertools import accumulate
from collections import defaultdict

n, m = map(int, input().split())
ary = [int(_) for _ in input().split()]

sum_ary = list(accumulate(ary, lambda x, y: x + y))
mod_ary = [s % m for s in sum_ary]
mod_table = defaultdict(int)
for mod in mod_ary:
    mod_table[mod] += 1
mod_table[0] += 1

print(sum([mod * (mod - 1) // 2 for mod in mod_table.values()]))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
from itertools import accumulate, combinations
from collections import defaultdict

n, m = map(int, input().split())
ary = [int(_) for _ in input().split()]

sum_ary = accumulate(ary, lambda x, y: x + y)
mod_table = defaultdict(int)
for mod in [s % m for s in (ary[0], *sum_ary)]:
    mod_table[mod] += 1

print(sum([len(list(combinations(range(v), 2))) for v in mod_table.values()]))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
from itertools import accumulate, combinations
from collections import defaultdict

n, m = map(int, input().split())
ary = [int(_) for _ in input().split()]

sum_ary = accumulate(ary, lambda x, y: x + y)
mod_table = defaultdict(int)
for mod in [s % m for s in (ary[0], *sum_ary)]:
    mod_table[mod] += 1

print(sum([len(list(combinations(range(v), 2))) for v in mod_table.values()]))
Problem p03290 (python)

Fixed submission:
# -*- coding: utf-8 -*-
from itertools import product

D, G = map(int, input().split())
pc_table = [tuple(map(int, input().split())) for _ in range(D)]

bit_table = list(product([0, 1], repeat=D))
cnts = []
for bits in bit_table:
    g = sum([
        pc_table[i][1] + 100 * (i + 1) * pc_table[i][0]
        for i, bit in enumerate(bits) if bit
    ])
    cnt = sum([pc_table[i][0] for i, bit in enumerate(bits) if bit])

    if g >= G:
        cnts.append(cnt)

    else:
        max_p = max([i for i, bit in enumerate(bits) if not bit])
        for _ in range(pc_table[max_p][0]):
            g += 100 * (max_p + 1)
            cnt += 1
            if g >= G:
                cnts.append(cnt)
                break

print(min(cnts))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
D, G = map(int, input().split())

cp = [tuple(map(int, input().split())) for i in range(D)]
cpg = [(c, (i + 1) * 100, (i + 1) * 100 * c + p)
       for i, (c, p) in enumerate(cp)]

cnt = 0
while True:

    c, p, g = cpg.pop()
    if G - g > 0:
        if cpg:
            cn, pn, gn = cpg[-1]
            if G - gn <= 0:
                cnt += cn
                break

        G -= g
        cnt += c
        continue

    else:

        if G / p < c:
            cnt += G // p if G % p == 0 else G // p + 1
            break

        if cpg:
            cn, pn, gn = cpg[-1]
            if G - gn <= 0 and cn < c:
                cnt += cn
                break

        else:
            cnt += c
            break

print(cnt)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
D, G = map(int, input().split())

cp = [tuple(map(int, input().split())) for i in range(D)]
cpg = [(c, (i + 1) * 100, (i + 1) * 100 * c + p)
       for i, (c, p) in enumerate(cp)]

cnt = 0
while True:
    c, p, g = cpg.pop()

    if G - g > 0:
        G -= g
        cnt += c
        continue

    else:

        if G / p < c:
            cnt += G // p if G % p == 0 else G // p + 1
            break

        if cpg:
            cn, pn, gn = cpg[-1]
            if G - gn <= 0 and cn < c:
                cnt += cn
                break
        else:
            cnt += c
            break

print(cnt)
Problem p03292 (python)

Fixed submission:
# -*- coding: utf-8 -*-
from itertools import permutations

ary = map(int, input().split())

min_val = float('inf')
for vals in permutations(ary):
    tmp_val = 0
    for i, val in enumerate(vals):
        if i > 0:
            tmp_val += abs(val - vals[i - 1])

    if min_val > tmp_val:
        min_val = tmp_val

print(min_val)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
n, m = map(int, input().split())
demands = [
    tuple(map(int,
              line.strip().split())) for line in sys.stdin.readlines()
]
demands.sort(key=lambda demand: demand[1])

bridge = -1
cnt = 0
for ai, bi in demands:

    if ai <= bridge:
        continue

    else:
        bridge = bi - 1
        cnt += 1

print(cnt)
Problem p03310 (python)

Fixed submission:
# -*- coding: utf-8 -*-
n = int(input())
a = [int(_) for _ in input().split()]

# my initial trial below ##############################
# from itertools import combinations
# combs = combinations(range(1, n), 3)
# grief = 10**10
# for comb in combs:
#     p = sum(a[:comb[0]])
#     q = sum(a[comb[0]:comb[1]])
#     r = sum(a[comb[1]:comb[2]])
#     s = sum(a[comb[2]:])

#     tmp = max(p, q, r, s) - min(p, q, r, s)
#     if tmp < grief:
#         grief = tmp

# print(grief)  # running time limit error

# solution below ######################################

cumul_sum = [0]
for i, ai in enumerate(a):
    cumul_sum.append(ai + cumul_sum[i])


def cal_sum(left, right):
    return cumul_sum[right] - cumul_sum[left]


def two_pointers(l, r, split, diff):
    for i in range(split, r):
        tmp_diff = abs(cal_sum(l, i) - cal_sum(i, r))
        if diff >= tmp_diff:
            diff = tmp_diff
        else:
            return i - 1, diff
    else:
        return r - 1, diff


l_split = 1
r_split = 3
griefs = []
for i in range(2, n - 1):
    # left
    l_split, l_diff = two_pointers(0, i, l_split, 10**12)
    # right
    r_split, r_diff = two_pointers(i, n, r_split, 10**12)

    p, q, r, s = cal_sum(0, l_split), cal_sum(l_split,
                                              i), cal_sum(i, r_split), cal_sum(
                                                  r_split, n)
    griefs.append(max(p, q, r, s) - min(p, q, r, s))


print(min(griefs))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
from scratch import two_pointers
from operator import add, lt
from itertools import accumulate

n = int(input())
a = [int(_) for _ in input().split()]
cul_ary = [0] + list(accumulate(a, add))

l_split = 1
r_split = 3
griefs = []

for i in range(2, n - 1):
    l_split, l_diff, p, q = two_pointers(cul_ary,
                                         0,
                                         i,
                                         l_split,
                                         lambda ary, l, r: ary[r] - ary[l],
                                         lambda left, right: abs(left - right),
                                         lambda val1, val2: True if val1 > val2 else False)

    r_split, r_diff, r, s = two_pointers(cul_ary,
                                         i,
                                         n,
                                         r_split,
                                         lambda ary, l, r: ary[r] - ary[l],
                                         lambda left, right: abs(left - right),
                                         lambda val1, val2: True if val1 > val2 else False)

    griefs.append(max(p, q, r, s) - min(p, q, r, s))

print(min(griefs))
Problem p03323 (python)

Fixed submission:
# -*- coding: utf-8 -*-
a, b = map(int, input().split())

if a > 8 or b > 8:
    print(':(')
else:
    print('Yay!')

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a = int(input())
b = int(input())

if a > 8 or b > 8:
    print(':(')
else:
    print('Yay!')

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a = int(input())
b = int(input())

if a > 8 or b > 8:
    print(': (')
else:
    print('Yay!')
Problem p03330 (python)

Fixed submission:
# -*- coding: utf-8 -*-
N, C = map(int, input().split())

D = []
for c in range(C):
    D.append([int(d) for d in input().split()])

Gmod = [[0 for i in range(C)] for i in range(3)]
for n in range(N):
    for m, g in enumerate(input().split()):
        Gmod[(n + m) % 3][int(g) - 1] += 1

K = []
for c0 in range(C):
    d0 = sum([Gmod[0][c] * D[c][c0] for c in range(C)])
    for c1 in [i for i in range(C) if not i == c0]:
        d1 = sum([Gmod[1][c] * D[c][c1] for c in range(C)])
        for c2 in [i for i in range(C) if (not i == c0) and (not i == c1)]:
            d2 = sum([Gmod[2][c] * D[c][c2] for c in range(C)])
            K.append(d0 + d1 + d2)

print(min(K))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# import functools

# @functools.lru_cache(maxsize=None)
# def paint(i, c):  # i = 0, 1, 2
#     cost = 0
#     for row in range(N):
#         for col in range(N):
#             if (row + col) % 3 == i:
#                 cost += D[G[row][col] - 1][c - 1]

#     return cost

# def cost(comb):
#     cost = 0
#     for i, c in enumerate(comb):
#         cost += paint(i, c)

#     return cost


def cost(comb):
    cost = 0
    for r in range(N):
        for c in range(N):
            if (r + c) % 3 == 0:
                cost += D[G[r][c] - 1][comb[0]]
            elif (r + c) % 3 == 1:
                cost += D[G[r][c] - 1][comb[1]]
            else:
                cost += D[G[r][c] - 1][comb[2]]


if __name__ == '__main__':
    from itertools import permutations
    N, C = map(int, input().split())
    D = [[int(_) for _ in input().split()] for i in range(C)]
    G = [[int(_) for _ in input().split()] for i in range(N)]
    combs = permutations(range(1, C + 1), 3)
    min_cost = min([cost(comb) for comb in combs])
    print(min_cost)
Problem p02582 (python)

Fixed submission:
s=input()
temp=0
if(s=="RRR"):print(3)
elif(s=="RRS" or s=="SRR"):print(2)
elif(s=="SSS"):print(0)
else:print(1)

Buggy submission (verdict: Runtime Error):
s=input()
temp=0
if(s=="RRR"):print(3)
elif(s=="RRS" or s="SRR"):print(2)
elif(s=="SSS"):print(0)
else:print(1)
Problem p02608 (python)

Fixed submission:
import itertools
import collections



N = int(input())
count = [0]*N*100
m = int(N**0.5)
for x, y, z in itertools.combinations_with_replacement(range(1, m+1), 3):
  n = x**2+y**2+z**2+x*y+y*z+z*x
  k = len(set({x, y, z}))
  if k == 1:
    count[n] += 1
  elif k == 2:
    count[n] += 3
  else:
    count[n] += 6

for n in range(1, N+1):
  print(count[n])

Buggy submission (verdict: Runtime Error):
import itertools
import collections



N = int(input())
count = [0]*N*5
m = int(N**0.5)
for x, y, z in itertools.combinations_with_replacement(range(1, m+1), 3):
  n = x**2+y**2+z**2+x*y+y*z+z*x
  k = len(set({x, y, z}))
  if k == 1:
    count[n] += 1
  elif k == 2:
    count[n] += 3
  else:
    count[n] += 6

for n in range(1, N+1):
  print(count[n])
Problem p02683 (python)

Fixed submission:
import itertools
import numpy as np

N, M, X = map(int, input().split())

items = np.array([list(map(int, input().split())) for _ in range(N)])

min_v = 10**18
for n in range(1, N+1):
  for c in itertools.combinations(range(N), n):
    tmp = np.sum(items[[c]], axis=0)
    c = tmp[0]
    a = tmp[1:]
    if M == np.count_nonzero(a >= X):
      min_v = min(min_v, c)
if min_v == 10**18:
  print(-1)
else:
  print(min_v)

Buggy submission (verdict: Runtime Error):
import itertools
import numpy as np

N, M, X = map(int, input().split())
items = np.array([list(map(int, input().split())) for _ in range(N)], dtype=np.int32)

out = 10**18
for c in itertools.product([False, True], repeat=M):
    tmp = np.sum(items[np.where(c)], axis=0)
    if np.any(tmp):
      if M == np.count_nonzero(tmp[1:] >= X):
        out = min(out, tmp[0])
if out == 10**18:
  print(-1)
else:
  print(out)

Buggy submission (verdict: Runtime Error):
import itertools
import numpy as np

N, M, X = map(int, input().split())
items = np.array([list(map(int, input().split())) for _ in range(N)], dtype=np.int32)

out = 10**18
for c in itertools.product([False, True], repeat=M):
    tmp = np.sum(items[[np.where(c)]], axis=0)
    if np.any(tmp):
      if M == np.count_nonzero(tmp[1:] >= X):
        out = min(out, tmp[0])
if out == 10**18:
  print(-1)
else:
  print(out)

Buggy submission (verdict: Runtime Error):
import itertools
import numpy as np

N, M, X = map(int, input().split())
items = np.array([list(map(int, input().split())) for _ in range(N)], dtype=np.int32)

out = 10**18
for c in itertools.product([False, True], repeat=M):
    tmp = np.sum(items[[np.where(c)]], axis=0)
    if np.any(tmp):
      if M == np.count_nonzero(tmp[1:] >= X):
        out = min(out, tmp[0])
if out == 10**18:
  print(-1)
else:
  print(out)
Problem p02684 (python)

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

t_zero = [-1] * N

t = 0
a = 1

while t_zero[a-1] == -1:
  if t == K:
    break
  t_zero[a-1] = t
  t += 1
  a = A[a-1]
else:
  k = (K - t_zero[a-1]) % (t - t_zero[a-1])
  for _ in range(k):
    a = A[a-1]
print(a)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split()))

t_zero = [-1] * N

t = 0
a = 1

while t_zero[a-1] == -1:
  if t == K:
    break
  t_zero[a-1] = t
  t += 1
  a = A[a-1]
else:
  k = (K - t_zero[a-1]) % (t - t_zero[a-1])
  a = t_zero.index(t_zero[a] + k)
print(a)
Problem p02697 (python)

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

halfPos = -(-N//2)

qPos = halfPos // 2

q3Pos = qPos + halfPos

for m in range(1, M+1):
  if m % 2:
    print(qPos-m//2, qPos+m//2+1)
  else:
    print(q3Pos-m//2, q3Pos+m//2)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())

empty = [True]*N

for m in range(M, 0, -1):
  i = 0
  while not(empty[i] and empty[i + m]):
    i += 1
  empty[i] = False
  empty[i+m] = False
  print(i+1, i+m+1)
Problem p02703 (python)

Fixed submission:
from heapq import *

N, M, S = tuple(map(int, input().split()))

T = [[10**18 for _ in range(2451)] for _ in range(N)]

act = [[] for _ in range(N)]

for i in range(M):
  U, V, A, B = tuple(map(int, input().split()))
  U -= 1
  V -= 1
  act[U] += [(V, A, B)]
  act[V] += [(U, A, B)]

for i in range(N):
  C, D = tuple(map(int, input().split()))
  act[i] += [(i, -C, D)]

que = [(0, 0, S)]

while que:
  (currentT, n, coins) = heappop(que)
  for m, cost, t in act[n]:
    # もし「払える金額で」「最小時間T[移動先][所持金]を更新できるとき」に値を更新、キューに状態を追加。
    if coins >= cost and currentT + t < T[m][min(2450, coins - cost)]:
      T[m][min(2450, coins - cost)] = currentT + t
      heappush(que, (currentT + t, m, min(2450, coins - cost)))

for i in range(1, N):
  print(min(T[i]))

Buggy submission (verdict: Runtime Error):
from heapq import *

T = [[10**18 for _ in range(2451)] for _ in range(N)]

act = [[] for _ in range(N)]

N, M, S = tuple(map(int, input().split()))

for i in range(M):
  U, V, A, B = tuple(map(int, input().split()))
  U -= 1
  V -= 1
  act[U] += [(V, A, B)]
  act[V] += [(U, A, B)]

for i in range(N):
  C, D = tuple(map(int, input().split()))
  act[i] += [(i, -C, D)]

que = [(0, 0, S)]

while que:
  (currentT, n, coins) = heappop(que)
  for m, cost, t in act[n]:
    # もし「払える金額で」「最小時間T[移動先][所持金]を更新できるとき」に値を更新、キューに状態を追加。
    if coins >= cost and currentT + t < T[m][min(2450, coins - cost)]:
      T[m][min(2450, coins - cost)] = currentT + t
      heappush(que, (currentT + t, m, min(2450, coins - cost)))

for i in range(1, N):
  print(min(T[i]))

Buggy submission (verdict: Runtime Error):
from heapq import *

T = [[10**18 for _ in range(2451)] for _ in range(N)]

act = [[] for _ in range(N)]

N, M, S = tuple(map(int, input().split()))

for i in range(M):
  U, V, A, B = tuple(map(int, input().split()))
  maxV = max(maxV, A)
  U -= 1
  V -= 1
  act[U] += [(V, A, B)]
  act[V] += [(U, A, B)]

for i in range(N):
  C, D = tuple(map(int, input().split()))
  act[i] += [(i, -C, D)]

que = [(0, 0, S)]

while que:
  (currentT, n, coins) = heappop(que)
  for m, cost, t in act[n]:
    # もし「払える金額で」「最小時間T[移動先][所持金]を更新できるとき」に値を更新、キューに状態を追加。
    if coins >= cost and currentT + t < T[m][min(2450, coins - cost)]:
      T[m][min(2450, coins - cost)] = currentT + t
      heappush(que, (currentT + t, m, min(2450, coins - cost)))

for i in range(1, N):
  print(min(T[i]))
Problem p02714 (python)

Fixed submission:
import itertools

N = int(input())
S = input()

R = []
G = []
B = []

RGBs = list(itertools.permutations(['R', 'G', 'B'], 3))
for i, s in enumerate(S):
  if s == 'R': R.append(i)
  if s == 'G': G.append(i)
  if s == 'B': B.append(i)
out = len(R) * len(G) * len(B)
for i in range(1, N):
  for j in range(N-i*2):
    if (S[j], S[j+i], S[j+i*2]) in RGBs:
      out -= 1
print(out)

Buggy submission (verdict: Runtime Error):
import itertools

N = int(input())
S = input()
out = S.count('R') * S.count('G') * S.count('B')
for i in range(1, N):
  for j in range(N-i*2):
    if (S[j], S[j+i], S[j+i*2]) in RGBs:
      out -= 1
print(out)
Problem p02717 (python)

Fixed submission:
x, y, z = map(int, input().split())
print("{} {} {}".format(z, x, y))

Buggy submission (verdict: Runtime Error):
x, y, z = map(int, input().split())
print(f"{z} {x} {y}")
Problem p02743 (python)

Fixed submission:
a, b, c = map(int, input().split())
if 0 < c - a - b and 4 * a * b < (c - a - b)**2:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import numpy
a, b, c = map(int, input().split())
if a + 2 * numpy.sqrt(a*b) + b < c:
    print("Yes")
else:
    print("No")
Problem p02747 (python)

Fixed submission:
hitachi = True
s = input()
if(len(s) % 2 != 0):
    hitachi = False
for i in range(0, len(s), 2):
    if(hitachi == False):
        break
    if(s[i] != 'h' or s[i + 1] != 'i'):
        hitachi = False
if(hitachi):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
hitachi = True
s = input()
for i in range(0, len(s), 2):
    if(s[i] != 'h' or s[i + 1] != 'i'):
        hitachi = False
        break
if(hitachi):
    print('Yes')
else:
    print('No')
Problem p02760 (python)

Fixed submission:
import numpy as np
S = np.array([list(map(int, input().split())) for _ in range(3)])
n = int(input())
for _ in range(n):
    S = np.where(S==int(input()), 0, S)
if min(np.sum(S, axis=0))==0 or min(np.sum(S, axis=1))==0:
    print('Yes')
    exit()
if (S[0][0] == 0 and S[1][1] == 0 and S[2][2] == 0) or (S[2][0] == 0 and S[1][1] == 0 and S[0][2] == 0):
    print('Yes')
    exit()
print('No')

Buggy submission (verdict: Runtime Error):
import numpy as np
S = np.array([list(map(int, input().split())) for _ in range(3)])
n = int(input())
for _ in range(n):
    S = np.where(S==int(input()), 0, S)
    HBingo = min(np.sum(S, axis=0)) == 0
    WBingo = min(np.sum(S, axis=1)) == 0
    SBingo = S[2][0] == 0 and S[1][1] == 0 and S[0][2] == 0
    BSBingo = S[0][0] == 0 and S[1][1] == 0 and S[2][2] == 0
if HBingo or WBingo or SBingo or BSBingo:
    print('Yes')
    exit()
print('No')

Buggy submission (verdict: Runtime Error):
import numpy as np
S = np.array([list(map(int, input().split())) for _ in range(3)])
n = int(input())
for _ in range(n):
    S = np.where(S==int(input()), 0, S)
if min(np.sum(S, axis=0))==0 or min(np.sum(S, axis=1))==0:
    print('Yes')
    exit()
if (S[0][0] == 0 and S[1][1] == 0 and S[2][2]) or (S[2][0] == 0 and S[1][1] == 0 and S[0][2]):
    print('Yes')
    exit()
print('No')
Problem p02761 (python)

Fixed submission:
N, M = map(int, input().split())
ans = [-1] * N
for _ in range(M):
    i, n = map(int, input().split())
    if (ans[i-1] == -1 or ans[i-1] == n) and not(N > 1 and i == 1 and n == 0):
        ans[i-1] = n
    else:
        print(-1)
        exit()
ans = [n if n != -1 else 0 for n in ans]
if ans[0] == 0 and N > 1:
    ans[0] = 1

print(*ans, sep='')

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
ans = [-1] * N
for _ in range(M):
    i, n = map(int, input().split())
    if ans[i-1] == -1 or ans[i-1] == n:
        ans[i-1] = n
    else:
        print(-1)
        exit()
ans = [n if n != -1 else 0 for n in ans]
if ans[0] == 0 and len(ans > 1):
    ans[0] = 1
print(*ans, sep='')