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

Fixed submission:
N = int(input())
end = False
for h in range(1, 3501):
    if end:
        break
    for n in range(1, 3501):
        if (4 * h * n - N * n - N * h):
            if (N * h * n) % (4 * h * n - N * n - N * h) == 0:
                w = (N * h * n) // (4 * h * n - N * n - N * h)
                if w > 0:
                    print(h, n, w)
                    end = True
                    break

Buggy submission (verdict: Runtime Error):
N = int(input())
for h in range(1, 3501):
    for n in range(1, 3501):
        if (N * h * n) % (4 * h * n - N * n - N * h) == 0:
            w = (N * h * n) // (4 * h * n - N * n - N * h)
            print(h, n, w)
            break
Problem p03633 (python)

Fixed submission:
def gcd(a,b):
    if b > a:
        return gcd(b,a)
    if b == 0:
        return a
    c = a % b
    return gcd(b,c)

N = int(input())
T = [int(input()) for i in range(N)]
ans = T[0]
for i in T:
    ans = ans * i // gcd(ans,i)
print(int(ans))

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
    if b > a:
        return gcd(b,a)
    if b == 0:
        return a
    c = a % b
    return gcd(b,c)

N = int(input())
ans = int(input())
for i in range(N - 1):
    a = int(input())
    ans = ans * a / gcd(ans,a)
print(int(ans))

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
    if b > a:
        return gcd(b,a)
    if b == 0:
        return a
    c = a % b
    return gcd(b,c)

N = int(input())
ans = int(input())
for i in range(N - 1):
    a = int(input())
    ans = ans * a / gcd(ans,a)
print(int(ans))
Problem p03860 (python)

Fixed submission:
S = input()
print("A" + S[8] + "C")

Buggy submission (verdict: Runtime Error):
S = input()
print("A" + a[8] + "C")
Problem p03943 (python)

Fixed submission:
a, b, c = map(int,input().split())
ans = False
if a == b + c or b == a + c or c == a + b:
    ans = True
if ans:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a, b, c = map(int,input().split())
ans = False
if a == b + c or b = a + c or c = a + b:
    ans = True
if ans:
    print("Yes")
else:
    print("No")
Problem p03965 (python)

Fixed submission:
s = input()
g = 0
p = 0
for i in s:
    if i == "g":
        g += 1
    if i == "p":
        p += 1
print((g - p) // 2)

Buggy submission (verdict: Runtime Error):
s = input()
g = 0
p = 0
for i in s:
    if i = "g":
        g += 1
    if i = "p":
        p += 1
print((g - p) // 2)

Buggy submission (verdict: Runtime Error):
s = input()
g = 0
p = 0
for i in s:
    if i = "g":
        g += 1
    if i = "p":
        p += 1
print((g - p) // 2)
Problem p04012 (python)

Fixed submission:
w = input()
a = "abcdefghijklmnopqrstuvwxyz"
co = 0
ch = True
for i in a:
    for j in w:
        if i == j:
            co += 1
    if co % 2:
        ch = False
        break
    co = 0
    
    
if ch:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
w = input()
a = "abcdefghijklmnopqrstuvwxyz"
co = 0
ch = True
for i in a:
    for j in w:
        if i == j:
            co += 1:
    if co % 2:
        ch = False
        break
    co = 0
    
    
if ch:
    print("yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
w = input()
a = "abcdefghijklmnopqrstuvwxyz"
co = 0
ch = True
for i in a:
    for j in w:
        if i = j:
            co += 1:
    if co % 2:
        ch = False
        break
    co = 0
    
    
if ch:
    print("yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
w = input()
a = "abcdefghijklmnopqrstuvwxyz"
co = 0
ch = True
for i in a:
    for j in w:
        if i = j:
            co += 1:
    if co % 2:
        ch = False
        break
    co = 0
    
    
if ch:
    print("yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
w = input()
a = abcdefghijklmnopqrstuvwxyz
co = 0
ch = True
for i in a:
    for j in w:
        if i = j:
            co += 1:
    if co % 2:
        ch = False
        break
if ch:
    print("yes")
else:
    print("No")
Problem p03029 (python)

Fixed submission:
a,p=map(int,input().split())
print((a*3+p)//2)

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
print((a*3+b)/2)

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
print((a*3+b)/2)
Problem p02609 (python)

Fixed submission:
N = int(input())
X = input()
Xi = int(X, 2)

c0 = X.count('1')
Xp = Xi % (c0 + 1)

if c0 != 1:
    Xm = Xi % (c0 - 1)

for i, x in enumerate(X):
    if x == '1':
        if c0 == 1:
            print(0)
            continue
        y = (Xm - pow(2, N - 1 - i, c0 - 1)) % (c0 - 1)
    else:
        y = (Xp + pow(2, N - 1 - i, c0 + 1)) % (c0 + 1)

    ans = 1
    while y:
        y %= bin(y).count('1')
        ans += 1
    print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
X = input()
Xi = int(X, 2)

c0 = X.count('1')
Xp = Xi % (c0 + 1)
Xm = Xi % (c0 - 1)

for i, x in enumerate(X):
    if x == '1':
        if c0 == 1:
            print(0)
            continue
        y = (Xm - pow(2, N - 1 - i, c0 - 1)) % (c0 - 1)
    else:
        y = (Xp + pow(2, N - 1 - i, c0 + 1)) % (c0 + 1)

    ans = 1
    while y:
        y %= bin(y).count('1')
        ans += 1
    print(ans)
Problem p02616 (python)

Fixed submission:
N, K = map(int, input().split())
A = tuple(map(int, input().split()))
MOD = 10 ** 9 + 7

if K == N:
    ans = 1
    for x in A:
        ans = (ans * x) % MOD
    print(ans)
    exit()

plus, minus = [], []
for a in A:
    if a >= 0:
        plus.append(a)
    else:
        minus.append(a)

plus.sort(reverse=True)
minus.sort()

if not plus:
    ans = 1
    if K % 2:
        # 答えは負値になるので絶対値小さいのを取る
        for x in minus[-K:]:
            ans = (ans * x) % MOD
    else:
        # 答えは非負値になるので絶対値大きいのを取る
        for x in minus[:K]:
            ans = (ans * x) % MOD
    print(ans)
    exit()

idx = 0
for i in range(2, N, 2):
    if K - i < 0:
        break
    if not len(plus) >= K - i + 2:
        idx += 2
        continue
    if len(minus) >= i:
        if minus[i - 2] * minus[i - 1] < plus[K - i + 1] * plus[K - i]:
            break
        else:
            idx += 2

ans = 1
for x in minus[:idx] + plus[:K - idx]:
    ans = (ans * x) % MOD
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = tuple(map(int, input().split()))
MOD = 10 ** 9 + 7

if K == N:
    ans = 1
    for x in A:
        ans = (ans * x) % MOD
    print(ans)
    exit()

plus, minus = [], []
for a in A:
    if a >= 0:
        plus.append(a)
    else:
        minus.append(a)

plus.sort(reverse=True)
minus.sort()

if not plus:
    ans = 1
    if K % 2:
        # 答えは負値になるので絶対値小さいのを取る
        for x in minus[-K:]:
            ans = (ans * x) % MOD
    else:
        # 答えは非負値になるので絶対値大きいのを取る
        for x in minus[:K]:
            ans = (ans * x) % MOD
    print(ans)
    exit()

idx = 0
for i in range(2, N, 2):
    if not len(plus) >= K - i + 2:
        idx += 2
        continue
    if len(minus) >= i:
        if minus[i - 2] * minus[i - 1] < plus[K - i + 1] * plus[K - i]:
            break
        else:
            idx += 2

ans = 1
for x in minus[:idx] + plus[:K - idx]:
    ans = (ans * x) % MOD
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
plus, minus = [], []
MOD = 10 ** 9 + 7
for a in map(int, input().split()):
    if a >= 0:
        plus.append(a)
    else:
        minus.append(a)

plus.sort(reverse=True)
minus.sort()

if not plus:
    # 負値覚悟で取る
    ans = 1
    for x in minus[-K:]:
        ans = (ans * x) % MOD
    print(ans)
    exit()

idx = 0
for i in range(2, N, 2):
    if not len(plus) >= K - i + 2:
        idx += 2
        continue
    if len(minus) >= i:
        if minus[i - 2] * minus[i - 1] < plus[K - i + 1] * plus[K - i]:
            break
        else:
            idx += 2

ans = 1
for x in minus[:idx] + plus[:K - idx]:
    ans = (ans * x) % MOD
print(ans)
Problem p02675 (python)

Fixed submission:
N = int(input())
if N % 10 in {2, 4, 5, 7, 9}:
    print('hon')
elif N % 10 in {0, 1, 6, 8}:
    print('pon')
else:
    print('bon')

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
from fractions import Fraction

N = int(input())
X = [tuple(map(int, input().split())) for _ in range(N)]

MOD = 1000000007
d_plus = defaultdict(int)  # + or ∞
d_minus = defaultdict(int)  # - or 0
ans = 1

for i, (a, b) in enumerate(X):
    if a == 0 and b == 0:
        continue
    elif a == 0:
        d_minus[0] += 1
    elif b == 0:
        d_plus[float('inf')] += 1
    elif a * b > 0:
        d_plus[Fraction(a, b)] += 1
    else:
        d_minus[Fraction(a, b)] += 1


def pair(p):
    if p == 0:
        return float('inf')
    elif p == float('inf'):
        return 0
    else:
        return -1 / p


for m in d_minus:
    d_plus[pair(m)] += 0
for p in d_plus:
    ans = ans * (pow(2, d_plus[p], MOD) + pow(2, d_minus[pair(p)], MOD) - 1)
    ans %= MOD
print((ans - 1) % MOD)
Problem p02717 (python)

Fixed submission:
X, Y, Z = map(int, input().split())
print(Z, X, Y)

Buggy submission (verdict: Runtime Error):
N = int(input())


def make_divisors(n):
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            yield i
            if i != n // i:
                yield n // i


ans = len(tuple(make_divisors(N - 1))) - 1

it = make_divisors(N)
next(it)

for k in it:
    tmp = N
    while not tmp % k:
        tmp //= k
    if tmp % k == 1:
        ans += 1
print(ans)
Problem p02782 (python)

Fixed submission:
r1, c1, r2, c2 = map(int, input().split())

MOD = 10 ** 9 + 7
MAX = 2 * 10 ** 6 + 10
modinv = lambda a, mod=MOD: pow(a, mod - 2, mod)
fac, inv = [1] * MAX, [1] * MAX
for i in range(1, MAX):
    fac[i] = fac[i - 1] * i % MOD
    inv[i] = modinv(fac[i])


def comb(n, k, error=0):
    if not 0 <= k <= n:
        return error
    return fac[n] * inv[k] * inv[n - k] % MOD


ans = comb(r2 + c2 + 2, r2 + 1) + comb(r1 + c1, r1) - comb(r1 + c2 + 1, r1) - comb(r2 + c1 + 1, c1)
ans %= MOD
print(ans)

Buggy submission (verdict: Runtime Error):
r1, c1, r2, c2 = map(int, input().split())

MOD = 10 ** 9 + 7
MAX = 10 ** 6 + 5
modinv = lambda a, mod=MOD: pow(a, mod - 2, mod)
fac, inv = [1] * MAX, [1] * MAX
for i in range(1, MAX):
    fac[i] = fac[i - 1] * i % MOD
    inv[i] = modinv(fac[i])


def comb(n, k, error=0):
    if not 0 <= k <= n:
        return error
    return fac[n] * inv[k] * inv[n - k] % MOD


ans = comb(r2 + c2 + 2, r2 + 1) + comb(r1 + c1, r1) - comb(r1 + c2 + 1, r1) - comb(r2 + c1 + 1, c1)
ans %= MOD
print(ans)

Buggy submission (verdict: Runtime Error):
r1, c1, r2, c2 = map(int, input().split())

MOD = 10 ** 9 + 7
MAX = 10 ** 6 + 5
modinv = lambda a, mod=MOD: pow(a, -1, mod)
fac, inv = [1] * MAX, [1] * MAX
for i in range(1, MAX):
    fac[i] = fac[i - 1] * i % MOD
    inv[i] = modinv(fac[i])


def comb(n, k, error=0):
    if not 0 <= k <= n:
        return error
    return fac[n] * inv[k] * inv[n - k] % MOD


ans = comb(r2 + c2 + 2, r2 + 1) + comb(r1 + c1, r1) - comb(r1 + c2 + 1, r1) - comb(r2 + c1 + 1, c1)
ans %= MOD
print(ans)
Problem p02797 (python)

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

if S != 10 ** 9:
    print(' '.join(map(str, [S] * K)),' '.join(map(str, [10 ** 9] * (N - K))))
else:
    print(' '.join(map(str, [S] * K)), ' '.join(map(str, [1] * (N - K))))

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

if S != 10 ** 9:
    print(*[S] * K, *[10 ** 9] * (N - K))
else:
    print(*[10 ** 9] * K, *[1] * (N - K))
Problem p02839 (python)

Fixed submission:
import numpy as np
import itertools

H, W = map(int, input().split())
A = [tuple(map(int, input().split())) for _ in range(H)]
B = [tuple(map(int, input().split())) for _ in range(H)]

D = [[abs(A[h][w] - B[h][w]) for w in range(W)] for h in range(H)]
max_num = 80 * (H + W)
table = np.zeros((H, W, max_num), dtype='bool')
table[0][0][D[0][0]] = True

it = itertools.product(range(H), range(W))
next(it)  # h=w=0 捨てる
for h, w in it:
    d = D[h][w]
    table[h][w][d:] += table[h - 1][w][:max_num - d] + table[h][w - 1][:max_num - d]
    table[h][w][:max_num - d] += table[h - 1][w][d:] + table[h][w - 1][d:]
    table[h][w][d:0:-1] += table[h - 1][w][:d] + table[h][w - 1][:d]

print(np.amin(*np.where(table[H - 1][W - 1])))

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

H, W = map(int, input().split())
A = [tuple(map(int, input().split())) for _ in range(H)]
B = [tuple(map(int, input().split())) for _ in range(H)]

D = [[abs(A[h][w] - B[h][w]) for w in range(W)] for h in range(H)]
table = np.zeros((H, W, 80 * (H + W)), dtype='bool')
table[0][0][D[0][0]] = True

it = itertools.product(range(H), range(W))
next(it)  # h=w=0 捨てる
for h, w in it:
    d = D[h][w]
    table[h][w][d:] += table[h - 1][w][:-d] + table[h][w - 1][:-d]
    table[h][w][:-d] += table[h - 1][w][d:] + table[h][w - 1][d:]
    table[h][w][d:0:-1] += table[h - 1][w][:d] + table[h][w - 1][:d]

print(np.amin(*np.where(table[H-1][W-1])))
Problem p02868 (python)

Fixed submission:
import sys
from collections import defaultdict
import networkx as nx

input = sys.stdin.buffer.readline

N, M = map(int, input().split())
LR_dict = defaultdict(lambda: 10 ** 9)
for _ in range(M):
    l, r, c = map(int, input().split())
    LR_dict[(l, r)] = min(LR_dict[(l, r)], c)

G = nx.DiGraph()
G.add_nodes_from(range(1, N + 1))
G.add_weighted_edges_from([(x + 1, x, 0) for x in range(1, N)])
G.add_weighted_edges_from((l, r, c) for (l, r), c in LR_dict.items())

try:
    print(nx.dijkstra_path_length(G, 1, N))
except nx.NetworkXNoPath:
    print(-1)

Buggy submission (verdict: Runtime Error):
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import dijkstra

N, M = map(int, input().split())
edge_d = np.array([input().split() for _ in range(M)], dtype=np.int32)
edge_n = np.vstack([np.arange(2, N + 1, dtype=np.int16),
                   np.arange(1, N, dtype=np.int16),
                   np.ones(N - 1, dtype=np.int8)]).T
edge = np.concatenate([edge_d, edge_d[:, [1, 0, 2]], edge_n]).T

matr = csr_matrix((edge[2], (edge[:2] - 1)), (N, N))
ans = dijkstra(matr, indices=0)[-1]
if ans == np.inf:
    ans = 0
print(int(ans) - 1)

Buggy submission (verdict: Runtime Error):
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import shortest_path

N, M = map(int, input().split())
edge_d = np.array([input().split() for _ in range(M)], dtype=np.int32)
edge_n = np.stack([np.arange(2, N + 1, dtype=np.int16),
                   np.arange(1, N, dtype=np.int16),
                   np.ones(N - 1, dtype=np.int8)]).T
edge = np.concatenate([edge_d, edge_d[:, [1, 0, 2]], edge_n]).T

matr = csr_matrix((edge[2], (edge[:2] - 1)), (N, N))
ans = shortest_path(matr, indices=0)[-1]
if ans == np.inf:
    ans = 0
print(int(ans) - 1)
Problem p02973 (python)

Fixed submission:
import bisect

N = int(input())
H = []
for _ in range(N):
    a = int(input())
    ind = bisect.bisect_right(H, -a)
    if ind == len(H):
        H.append(-a)
    else:
        H[ind] = -a
print(len(H))

Buggy submission (verdict: Runtime Error):
import bisect

N = int(input())
H = []
min_lst = 10 ** 9
for _ in range(N):
    a = int(input())
    if min_lst >= a:
        min_lst = a
        H.append(-a)
    else:
        H[bisect.bisect_left(H, -a)] = -a
print(len(H))
Problem p02995 (python)

Fixed submission:
from fractions import gcd

A, B, C, D = map(int, input().split())


def division(x, p, q):
    return x - x // p - x // q + x // (p * q // gcd(p, q))


print(division(B, C, D) - division(A - 1, C, D))

Buggy submission (verdict: Runtime Error):
import math
A,B,C,D = map(int, input().split())

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

ac=int(A/C)
bc=int(B/C)
ad=int(A/D)
bd=int(B/D)
acd=int(A/lcm(C,D))
bcd=int(B/lcm(C,D))

if A%C==0:
    c_div=bc-ac+1
else:
    c_div = bc - ac
if B%C==0:
    d_div=bd-ad+1
else:
    d_div = bd - ad
if B%lcm(C,D)==0:
    cd_div=bcd-acd+1
else:
    cd_div = bcd - acd

print(B-A+1-c_div-d_div+cd_div)
Problem p03006 (python)

Fixed submission:
import itertools
from collections import defaultdict
from sys import exit

N = int(input())
balls = sorted([tuple(map(int, input().split())) for _ in range(N)])

if N == 1:
    print(1)
    exit()

d = defaultdict(int)
for i, j in itertools.combinations(range(N), 2):
    d[(balls[j][0] - balls[i][0], balls[j][1] - balls[i][1])] += 1
print(N - max(d.values()))

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

N = int(input())
balls = sorted([tuple(map(int, input().split())) for _ in range(N)])

d = defaultdict(int)
for i, j in itertools.combinations(range(N), 2):
    d[(balls[j][0] - balls[i][0], balls[j][1] - balls[i][1])] += 1
print(N - max(d.values()))
Problem p03111 (python)

Fixed submission:
import itertools

N, A, B, C = map(int, input().split())
L = [int(input()) for _ in range(N)]

ans = float('inf')
for Lp in itertools.permutations(L):
    Lac = tuple(itertools.accumulate(([0] + list(Lp))))
    for a in range(1, N - 1):
        for b in range(a + 1, N):
            for c in range(b + 1, N + 1):
                A_MP = 10 * (a - 1) + abs(Lac[a] - Lac[0] - A)
                B_MP = 10 * (b - a - 1) + abs(Lac[b] - Lac[a] - B)
                C_MP = 10 * (c - b - 1) + abs(Lac[c] - Lac[b] - C)
                ans = min(ans, A_MP + B_MP + C_MP)
print(ans)

Buggy submission (verdict: Runtime Error):
import itertools

N, A, B, C = map(int, input().split())
L = [int(input()) for _ in range(N)]

ans = float('inf')
for Lp in itertools.permutations(L):
    Lac = tuple(itertools.accumulate((0, *Lp)))
    for a in range(1, N - 1):
        for b in range(a + 1, N):
            for c in range(b + 1, N + 1):
                A_MP = 10 * (a - 1) + abs(Lac[a] - Lac[0] - A)
                B_MP = 10 * (b - a - 1) + abs(Lac[b] - Lac[a] - B)
                C_MP = 10 * (c - b - 1) + abs(Lac[c] - Lac[b] - C)
                ans = min(ans, A_MP + B_MP + C_MP)
print(ans)

Buggy submission (verdict: Runtime Error):
import itertools

N, A, B, C = map(int, input().split())
L = [int(input()) for _ in range(N)]

ans = float('inf')
for Lp in itertools.permutations(L):
    Lac = tuple(itertools.accumulate((0, *Lp)))
    for a in range(1, N - 1):
        for b in range(a + 1, N):
            for c in range(b + 1, N + 1):
                A_MP = 10 * (a - 1) + abs(Lac[a] - Lac[0] - A)
                B_MP = 10 * (b - a - 1) + abs(Lac[b] - Lac[a] - B)
                C_MP = 10 * (c - b - 1) + abs(Lac[c] - Lac[b] - C)
                ans = min(ans, A_MP + B_MP + C_MP)
print(ans)
Problem p03169 (python)

Fixed submission:
from collections import Counter

N = int(input())
A = Counter(map(int, input().split()))
S = [None, A[3] + A[2] + A[1], A[3] + A[2], A[3]]

dp = [[[0] * (S[3] + 1) for _ in range(S[2] + 1)] for __ in range(S[1] + 1)]

for l in range(1, S[1] + 1):
    for m in range(S[2] + 1):
        if l < m:
            break
        for k in range(S[3] + 1):
            if m < k:
                break
            dp[l][m][k] = (dp[l - 1][m][k] * (l - m) + dp[l][m - 1][k] * (m - k) + dp[l][m][k - 1] * k + N) / l
print(dp[S[1]][S[2]][S[3]])

Buggy submission (verdict: Runtime Error):
import numpy as np
from collections import Counter

N = int(input())
A = Counter(map(int, input().split()))
S = (None, A[3] + A[2] + A[1], A[3] + A[2], A[3])

dp = np.zeros((S[1] + 1, S[2] + 1, S[3] + 1), dtype=float)
for l in range(1, S[1] + 1):
    for m in range(S[2] + 1):
        if l < m:
            break
        mk = min(m + 1, S[3] + 1)
        dp[l][m][:mk] = (dp[l - 1][m][:mk] * (l - m) + dp[l][m - 1][:mk] * (m - np.arange(mk)) + N) / l

        matr = np.tile(np.arange(mk) / l, (mk, 1))
        matr[np.tri(mk, dtype=bool)] = 1
        matr = np.multiply.accumulate(matr, axis=1)
        matr[np.tri(mk, k=-1, dtype=bool)] = 0

        dp[l][m][:mk] = dp[l][m][:mk] @ matr
print(dp[S[1]][S[2]][S[3]])
Problem p03240 (python)

Fixed submission:
N = int(input())
data = [tuple(map(int, input().split())) for _ in range(N)]
data.sort(key=lambda x: -x[2])
for cx in range(101):
    for cy in range(101):
        h0 = None
        for x, y, h in data:
            if h:
                h_tmp = h + abs(cx - x) + abs(cy - y)
                if h_tmp != h0 and h0 is not None:
                    break
                h0 = h_tmp
            else:
                if abs(cx - x) + abs(cy - y) < h0:
                    break
        else:
            print(cx, cy, h0)
            exit()

Buggy submission (verdict: Runtime Error):
N = int(input())
data = [tuple(map(int, input().split())) for _ in range(N)]
data.sort(key=lambda x: x[2])
for cx in range(101):
    for cy in range(101):
        h0 = None
        for x, y, h in data:
            if h:
                h_tmp = h + abs(cx - x) + abs(cy - y)
                if h_tmp != h0 and h0 is not None:
                    break
                h0 = h_tmp
            else:
                if abs(cx - x) + abs(cy - y) < h0:
                    break
        else:
            print(cx, cy, h0)
            exit()

Buggy submission (verdict: Runtime Error):
N = int(input())
data = [tuple(map(int, input().split())) for _ in range(N)]
data.sort(key=lambda x: x[2])
for cx in range(101):
    for cy in range(101):
        h0 = None
        for x, y, h in data:
            if h:
                if (h_tmp := h + abs(cx - x) + abs(cy - y)) != h0 and h0 is not None:
                    break
                h0 = h_tmp
            else:
                if abs(cx - x) + abs(cy - y) < h0:
                    break
        else:
            print(cx, cy, h0)
            exit()
Problem p03646 (python)

Fixed submission:
K = int(input())

N = 50
ans = [K // N + N] * (K % N) + [K // N + N - K % N - 1] * (N - K % N)
print(N)
print(*ans)

Buggy submission (verdict: Runtime Error):
K = int(input())
N = 50
while not K % N:
    N -= 1
ans = [K // N + N] * (K % N) + [K // N + N - K % N - 1] * (N - K % N)
print(N)
print(*ans)
Problem p03243 (python)

Fixed submission:
# import math
# import statistics
a=input()
#b,c=int(input()),int(input())
# c=[]
# for i in a:
#     c.append(i)
#e1,e2 = map(int,input().split())
#f = list(map(int,input().split()))
#g = [input() for _ in range(a)]
# zoro = int(a[0]*len(a))
zyun= len(a)*9+int(a[0])
zoro=0
z = zyun//9
af= zyun%9
if af==0:
    if int(a)<=int(str(9)*(z-1)):
        print(int(str(9)*(z-1)))
    else:
            print(str(1)*(z))
else :
    if int(a)<=int(str(af)*(z)):
        print(int(str(af)*(z)))
    else:
        print(int(str(af+1)*(z)))

Buggy submission (verdict: Runtime Error):
import math
# import statistics
# a=input()
#b,c=int(input()),int(input())
# c=[]
# for i in a:
#    c.append(i)
e1,e2 = map(int,input().split())
#f = list(map(int,input().split()))
#g = [input() for _ in range(a)]
z = a//9
af= a%9
if af==0:
    print(str(9)*(z))
 
else :
    print(str(af)*(z+1))
Problem p03456 (python)

Fixed submission:
# import math
# import statistics
#a=input()
#b,c=int(input()),int(input())
# c=[]
# for i in a:
#    c.append(i)
e1,e2 = map(str,input().split())
#K = input()
# f = list(map(int,input().split()))
#g = [input() for _ in range(a)]
count=0
a=e1+e2
for i in range(1,int(a)):
	if int(a)/int(i)==int(i):
		count+=1
if count>0:
	print('Yes')
else:
	print('No')

Buggy submission (verdict: Runtime Error):
# import math
# import statistics
#a=input()
#b,c=int(input()),int(input())
# c=[]
# for i in a:
#    c.append(i)
e1,e2 = map(str,input().split())
#K = input()
# f = list(map(int,input().split()))
#g = [input() for _ in range(a)]
count=0
a=e1+e2
for i in range(int(a)):
	if a/i==i:
		count+=1
if count>0:
	print('Yes')
else:
	print('No')

Buggy submission (verdict: Runtime Error):
# import math
# import statistics
#a=input()
#b,c=int(input()),int(input())
# c=[]
# for i in a:
#    c.append(i)
e1,e2 = map(str,input().split())
#K = input()
# f = list(map(int,input().split()))
#g = [input() for _ in range(a)]
count=0
a=join(e1,e2)
for i in range(int(a)):
	if a/i==i:
		count+=1
if count>0:
	print('Yes')
else:
	print('No')