Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
def nC2(n):
    return n * (n - 1) // 2


n = int(input())
a = list(map(int, input().split()))
arr = [0] * (2 * 10 ** 5 + 1)

for i in a:
    arr[i] += 1


for i in a:
    arr[i] -= 1
    ans = 0
    for j in arr:
        if j > 1:
            ans += nC2(j)
    arr[i] += 1

    print(ans)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
l = (2 * 10 ** 5) + 1
b = [0] * l


def nC2(n):
    return n * (n - 1) // 2


for i in range(n):
    b[a[i]] += 1

ttl = 0
for j in range(l):
    ttl += b[j] * (b[j] - 1) // 2

for k in range(n):
    print(ttl - nC2(b[a[k]]) + nC2(b[a[k]] - 1))

Buggy python submission (verdict: Time Limit Exceeded):
from operator import mul
from functools import reduce


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


n = int(input())
a = list(map(int, input().split()))
arr = [0] * (2 * 10 ** 5 + 1)

for i in a:
    arr[i] += 1

for i in a:
    arr[i] -= 1
    ans = 0
    for j in arr:
        if j > 1:
            ans += combinations_count(j, 2)
    arr[i] += 1

    print(ans)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
l = (2 * 10 ** 5) + 1
b = [0] * l


def nC2(n):
    return n * (n - 1) // 2


for i in range(n):
    b[a[i]] += 1

ttl = 0
for j in range(l):
    ttl += b[j] * (b[j] - 1) // 2

for k in range(n):
    print(ttl - nC2(b[a[k]]) + nC2(b[a[k]] - 1))
Buggy python submission (verdict: Runtime Error):
A, B, M = map(int, input().split())
x, y, c = [0] * M, [0] * M, [0] * M
a = list(map(int, input().split()))
b = list(map(int, input().split()))
for i in range(M):
    x[i], y[i], c[i] = map(int, input().split())
ans = 0
sav = 0
maxc = max(c)
ci = c.index(maxc)
disc = a[ci - 1] + b[ci - 1] - maxc
print(min(disc, min(a) + min(b)))


Fixed submission:
A, B, M = map(int, input().split())
x, y, c = [0] * M, [0] * M, [0] * M
a = list(map(int, input().split()))
b = list(map(int, input().split()))
for i in range(M):
    x[i], y[i], c[i] = map(int, input().split())
ans, sav = float("inf"), 0
for j in range(M):
    sav = a[x[j] - 1] + b[y[j] - 1] - c[j]
    if ans > sav:
        ans = sav

print(min(ans, min(a) + min(b)))
Buggy python submission (verdict: Runtime Error):
n, b, r = map(int, input().split())
bl = ["b"]*b
rl = ["r"]*r
br = bl + rl
ball = []
sav = n
while n>0:
  ball += br
  n -= (b+r)
print(ball[:sav].count("b"))


Fixed submission:
n, b, r = map(int, input().split())
div = n//(b+r)
base = b*div
zan = n%(b+r)
ama = min(zan, b)
print(base+ama)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

s = deque(list(input()))
n = int(input())
q = [list(input().split()) for _ in range(n)]
for tfc in q:
    if tfc[0] == "1":
        s.reverse()
    else:
        if tfc[1] == "1":
            s.appendleft(tfc[2])
        else:
            s.append(tfc[2])

print("".join(s))


Fixed submission:
from collections import deque

s = deque(list(input()))
n = int(input())
q = [list(input().split()) for _ in range(n)]
rev = False

for tfc in q:
    if tfc[0] == "1" and rev is False:
        rev = True
    elif tfc[0] == "1" and rev is True:
        rev = False
    elif rev is False:
        if tfc[1] == "1":
            s.appendleft(tfc[2])
        else:
            s.append(tfc[2])
    elif rev is True:
        if tfc[1] == "1":
            s.append(tfc[2])
        else:
            s.appendleft(tfc[2])

if rev:
    s.reverse()
print("".join(s))
Buggy python submission (verdict: Time Limit Exceeded):
n, k = list(map(int, input().split()))
p = list(map(int, input().split()))

c = [None]*(n-k+1)
t = [0]*(n-k+1)
ttl = 0
for i in range(0, n-k+1):
    c[i] = p[i:k+i]
    cs = sum(c[i])
    if ttl < cs:
        ttl = cs
        t[i] = i
ans = 0
for j in c[max(t)]:
    ans += (j*(j+1)/2)/j

print(ans)

Fixed submission:
n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
r = [0]*(n + 1)
for i in range(1,n + 1):
    r[i] += r[i - 1] + (p[i - 1] + 1) / 2
ans = 0
for j in range(n - k + 1):
    ans = max(ans, r[j+k] - r[j])
print(ans)
Buggy python submission (verdict: Runtime Error):
import sympy as sym

a, b = map(int, input().split())
print(len(set(sym.primefactors(a)) & set(sym.primefactors(b))) + 1)

Fixed submission:
def primeFact(n):
    i = 2
    pl = []
    while i * i <= n:
        while n % i == 0:
            n /= i
            pl.append(i)
        i += 1
    if n > 1:
        pl.append(int(n))
    return pl


a, b = map(int, input().split())
print(len(set(primeFact(a)) & set(primeFact(b))) + 1)
Buggy python submission (verdict: Time Limit Exceeded):
import collections
n = int(input())
d = []
s = [input() for _ in range(n)]
ans = 0
for x in s:
    d.append(collections.Counter(list(x)))

for i in range(0, n):
    for j in range(i+1,n):
        if d[i] == d[j]:
            ans += 1
print(ans)

Fixed submission:
from collections import Counter

n = int(input())
w = [""] * n
for i in range(n):
    w[i] = list(input())
    w[i].sort()
    w[i] = "".join(w[i])

w = Counter(w)
ans = 0
for i in w.values():
    ans += i * (i - 1) // 2
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import numpy as np

input = sys.stdin.readline
n = int(input())
s = list(int(input()) for _ in range(n))
i = 0
maxn = 0
s2 = []
for i in range(n):
    s2 = s.copy()
    del s2[i]
    print(np.max(np.array(s2)))
    i += 1


Fixed submission:
n = int(input())
s = list(int(input()) for _ in range(n))
i = 0
sort_s = sorted(s)

for i in s:
    if i == sort_s[-1]:
        print(sort_s[-2])
    else:
        print(sort_s[-1])

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import numpy as np

input = sys.stdin.readline
n = int(input())
s = list(int(input()) for _ in range(n))
i = 0
maxn = 0
s2 = []
while i < n:
    s2 = s.copy()
    del s2[i]
    print(np.max(np.array(s2)))
    i += 1


Fixed submission:
n = int(input())
s = list(int(input()) for _ in range(n))
i = 0
sort_s = sorted(s)

for i in s:
    if i == sort_s[-1]:
        print(sort_s[-2])
    else:
        print(sort_s[-1])

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

input = sys.stdin.readline
n = int(input())
s = list(int(input()) for _ in range(n))
i = 0
maxn = 0
s2 = []
while i < n:
    s2 = s.copy()
    del s2[i]
    print(np.max(np.array(s2)))
    i += 1


Fixed submission:
n = int(input())
s = list(int(input()) for _ in range(n))
i = 0
sort_s = sorted(s)

for i in s:
    if i == sort_s[-1]:
        print(sort_s[-2])
    else:
        print(sort_s[-1])

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

input = sys.stdin.readline
n = int(input())
s = list(int(input()) for _ in range(n))
i = 0
maxn = 0
s2 = []
while i < n:
    s2 = s.copy()
    del s2[i]
    print(np.max(np.array(s2)))
    i += 1


Fixed submission:
n = int(input())
s = list(int(input()) for _ in range(n))
i = 0
sort_s = sorted(s)

for i in s:
    if i == sort_s[-1]:
        print(sort_s[-2])
    else:
        print(sort_s[-1])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(int(input()) for _ in range(n))
i = 0
s2 = []
while i < n:
    s2 = s.copy()
    s2.pop(i)
    print(max(s2))
    i += 1


Fixed submission:
n = int(input())
s = list(int(input()) for _ in range(n))
i = 0
sort_s = sorted(s)

for i in s:
    if i == sort_s[-1]:
        print(sort_s[-2])
    else:
        print(sort_s[-1])
Buggy python submission (verdict: Runtime Error):
k, n = list(map(int, input().split()))
x = list(map(int, input().split()))
x.sort()
df = [0] * (n - 1)
for i in range(n - 1):
    df[i] = abs(x[i + 1] - x[i])

df = sorted(df, reverse=True)
print(sum(df[k - 1 :]))


Fixed submission:
import math

n = int(input())
t = [0] * 5
for i in range(5):
    t[i] = int(input())
print(math.ceil(n / min(t)) + 4)
Buggy python submission (verdict: Runtime Error):
n, q = list(map(int, input().split()))
s = list(input())
lr = [list(map(int, input().split())) for i in range(q)]
ac = [0] * 10 ** 5
for i in range(n):
    if i < n:
        if s[i] == "A" and s[i + 1] == "C":
            ac[i + 1] = 1
for i in range(q):
    print(ac[lr[i][0] : lr[i][1]].count(1))



Fixed submission:
n, q = list(map(int, input().split()))
s = input()
t = [0] * (n + 1)
for i in range(n):
    t[i + 1] = t[i] + (1 if s[i : i + 2] == "AC" else 0)

for i in range(q):
    l, r = list(map(int, input().split()))
    print(t[r - 1] - t[l - 1])
Buggy python submission (verdict: Runtime Error):
N, M = list(map(int, input().split()))
K, A = [0] * N, [0] * N
for i in range(N):
    K[i], *A[i] = list(map(int, input().split()))
k = set(i for i in range(1, M + 1))
ki = k.intersection(*A)
print(len(ki))

Fixed submission:
n, m, c = list(map(int, input().split()))
B = list(map(int, input().split()))
A = (list(map(int, input().split())) for _ in range(n))
ans = 0
cnt = 0
for i, u in enumerate(A):
    for j, v in enumerate(u):
        ans += v * B[j]

    ans += c
    if ans > 0:
        cnt += 1
    ans = 0
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
b = list(map(int, input()))
cnt = 0
while len(b) > 1:

    if len(list(set(b))) == 1:
        break
    if b[0] != b[1]:
        b = b[2:]
        cnt += 1
        continue
    temp = b[:1]
    b = b[1:]
    b.append(*temp)
print(cnt * 2)


Fixed submission:
s = input()
zom = min(s.count("1"),s.count("0"))
if len(set(list(s))) == 1:
    zom = 0
print(zom*2)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

b = deque(map(int, input()))
cnt = 0
while len(b) > 1:

    if len(list(set(b))) == 1:
        break
    if b[0] != b[1]:
        b.popleft()
        b.popleft()
        cnt += 1
        continue
    b.append(b.popleft())

print(cnt * 2)


Fixed submission:
s = input()
zom = min(s.count("1"),s.count("0"))
if len(set(list(s))) == 1:
    zom = 0
print(zom*2)

Buggy python submission (verdict: Runtime Error):
from collections import deque
import sys

input = sys.stdin.readline
b = deque(map(int, input()))
cnt = 0
i = 0
while len(b) > 1:

    if len(list(set(b))) == 1:
        break
    if b[i] != b[i + 1]:
        b.pop(i)
        b.pop(i)
        cnt += 1
        i = 0
        continue
    i += 1
print(cnt * 2)


Fixed submission:
s = input()
zom = min(s.count("1"),s.count("0"))
if len(set(list(s))) == 1:
    zom = 0
print(zom*2)

Buggy python submission (verdict: Time Limit Exceeded):
b = list(map(int, input()))
cnt = 0
i = 0
while len(b) > 1:
    
    if len(list(set(b))) == 1:
        break
    if b[i] != b[i + 1]:
        b.pop(i)
        b.pop(i)
        cnt += 1
        i = 0
        continue
    i += 1
    
print(cnt*2)


Fixed submission:
s = input()
zom = min(s.count("1"),s.count("0"))
if len(set(list(s))) == 1:
    zom = 0
print(zom*2)

Buggy python submission (verdict: Time Limit Exceeded):
import re
cnt = 0
n = input()
while True:
    cnt += len(re.findall(r"(01|10)", n))
    n = re.sub(r"(01|10)", "", n)
    m = re.search(r"(01|10)", n)
    if m is None:
        break
print(cnt*2)

Fixed submission:
s = input()
zom = min(s.count("1"),s.count("0"))
if len(set(list(s))) == 1:
    zom = 0
print(zom*2)

Buggy python submission (verdict: Time Limit Exceeded):
n = input()
cnt = 0
while True:
    xn = max(n.find("01"),n.find("10"))
    if xn != -1:
        cnt += 1
        n = list(n)
        n.pop(xn)
        n.pop(xn)
        n = "".join(n)
    else:
        break
print(cnt*2)

Fixed submission:
s = input()
zom = min(s.count("1"),s.count("0"))
if len(set(list(s))) == 1:
    zom = 0
print(zom*2)
Buggy python submission (verdict: Runtime Error):
import math

n, k = list(map(int, input().split()))
h = [int(input()) for _ in range(n)]
h.sort()
ans = math.inf
for i in range(n - k + 1):
    ans = min(ans, h[i + k - 1] - h[i])

print(ans)


Fixed submission:
D = int(input())
c = "Christmas"
e = " Eve"
print(c, end="")
if D != 25:
    for i in range(25 - D):
        print(e, end="")
print()
Buggy python submission (verdict: Runtime Error):
n = int(input())
sn = str(n)
minx = 0
temp = 754
sav = 0
for i in range(len(str(n//100))):
    minx = abs(753-int(sn[i:i+3]))
    if temp > minx:
        temp = minx
        sav = n3

print(sav)


Fixed submission:
n = int(input())
sn = str(n)
n3 = 0
minx = 0
temp = 754
for i in range(len(str(n // 100))):
    n3 = int(sn[i : i + 3])
    minx = abs(753 - n3)
    if temp > minx:
        temp = minx

print(temp)
Buggy python submission (verdict: Time Limit Exceeded):
import statistics
import copy

n = int(input())
a = list(map(int, input().split()))
ao = copy.copy(a)
for i in range(n):
    a.pop(i)
    print(statistics.median(a))
    a = copy.copy(ao)


Fixed submission:
import statistics

n = int(input())
x = list(map(int, input().split()))
xmd = statistics.median(x)
xs = sorted(x)
for i in x:
    if i < xmd:
        print(xs[n // 2])
    else:
        print(xs[n // 2 - 1])
Buggy python submission (verdict: Runtime Error):
a, b, k = list(map(int, input().split()))
al, bl = [], []
for i in range(min(b-a,k)):
    al.append(a+i)
    bl.append(b-i)
    ans = list(set(al) | set(bl))
ans.sort()
for i in ans:
    print(i)

Fixed submission:
a, b, k = list(map(int, input().split()))
al, bl = [], []
if a == b:
    print(a)
else:   
    for i in range(min(b-a,k)):
        al.append(a+i)
        bl.append(b-i)
        ans = list(set(al) | set(bl))
    ans.sort()
    for i in ans:
        print(i)
Buggy python submission (verdict: Time Limit Exceeded):
a = list(map(int, input().split()))
s, m, b = sorted(a)
cnt = 0
while not b == m == s:
    m_s = m - s
    b_m = b - m
    if m_s % 2 == 0 and m < b and m_s != 0:
        cnt += m_s // 2
        s += m_s
    elif m_s % 2 == 1 and m < b:
        cnt += 1
        s += 1
        b += 1
    elif m_s == 0 and m < b:
        cnt += b_m
        break
print(cnt)

Fixed submission:
a = list(map(int, input().split()))
s, m, b = sorted(a)
cnt = 0
m_s = m - s
cnt += b - m
cnt += m_s // 2

if m_s % 2 == 1:
    cnt += 2
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n = list(map(int, input().split()))
b, m, s = sorted(n)[::-1]
cnt = 0
while not b == m == s:
    m_s = m - s
    b_m = b - m
    if m_s % 2 == 0 and m < b and m_s != 0:
        cnt += m_s // 2
        s += m_s
    elif m_s % 2 == 1 and m < b:
        cnt += 1
        s += 1
        b += 1
    elif m_s == 0 and m < b:
        cnt += b_m
        m += b_m
        s += b_m
print(cnt)


Fixed submission:
a = list(map(int, input().split()))
s, m, b = sorted(a)
cnt = 0
m_s = m - s
cnt += b - m
cnt += m_s // 2

if m_s % 2 == 1:
    cnt += 2
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n = list(map(int, input().split()))
b, m, s = sorted(n)[::-1]
cnt = 0
while b != m or m != s or s != b:
    m_s = m - s
    b_m = b - m
    if m_s % 2 == 0 and m < b and m_s != 0:
        cnt += m_s // 2
        s += m_s
    elif m_s % 2 == 1 and m < b:
        cnt += 1
        s += 1
        b += 1
    elif m_s == 0 and m < b:
        cnt += b_m
        m += b_m
        s += b_m
print(cnt)

Fixed submission:
a = list(map(int, input().split()))
s, m, b = sorted(a)
cnt = 0
m_s = m - s
cnt += b - m
cnt += m_s // 2

if m_s % 2 == 1:
    cnt += 2
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
sa = sorted(a)
r, ans = 0, 0
for l in range(n):
    cnt = 1
    r = l + 1
    while r < n and abs(sa[r] - sa[l]) <= 2:
        cnt += 1
        r += 1

    ans = max(ans, cnt)
    if l == r:
        r += 1

print(ans)


Fixed submission:
n = int(input())
b = [0] * (10 ** 5 + 1)
a = list(map(int, input().split()))
for i in a:
    b[i] += 1
    if i < 10 ** 5:
        b[i + 1] += 1
    if i > 0:
        b[i - 1] += 1

print(max(b))
Buggy python submission (verdict: Runtime Error):
a = "abcdefghijklmnopqrstuvwxyz"
s = set(input())
for i in s:
    a = a.replace(i,"")
print(a[0])


Fixed submission:
a = "abcdefghijklmnopqrstuvwxyz"
s = set(input())
c = 0

for i in s:
    a = a.replace(i,"")
    c += 1
if c < 26:
    print(a[0])
else:
    print("None")
Buggy python submission (verdict: Time Limit Exceeded):
import math
ans = math.inf
n = int(input())
c = list(map(int, input().split()))
s, a = 0, 0
for i in range(n - 1):
    s = sum(c[:i+1])
    a = sum(c[i+1:])
    ans = min(ans, abs(s-a))
print(ans)


Fixed submission:
import math
ans = math.inf
n = int(input())
c = list(map(int, input().split()))
acm = [0]*(n+1)
for i, v in enumerate(c, 1):
    acm[i] += acm[i-1] + v

s, a = 0, acm[n]
for i in range(1, n):
    s = acm[i]
    ans = min(ans, abs((a-s)-s))

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
MOD = 10 ** 9 + 7
n = int(input())
ans = 1
a = (i for i in range(1, n + 1))
for i in a:
    ans *= i
print(ans % MOD)

Fixed submission:
n = int(input())
p = 1
for i in range(1, n + 1):
    p = p * i % 1000000007

print(p)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = [None]*(n+1)
p[0] = 1

for i in range(1,n+1):
    p[i] = p[i-1]*i

print(p[i]%1000000007)


Fixed submission:
n = int(input())
p = 1
for i in range(1, n + 1):
    p = p * i % 1000000007

print(p)
Buggy python submission (verdict: Time Limit Exceeded):
a, b, x = map(int, input().split())
cnt = 0
for i in range(a, b+1):
    if i%x == 0:
        cnt += 1

print(cnt)

Fixed submission:
a, b, x = map(int, input().split())
print(round(b // x) - round((a - 1) // x))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
pair = []
cp = [None]
for i, tgt in enumerate(a):
    cp.clear()
    if a.index(tgt) == i:
        cp = [str(a[i]), str(i + 1)]
        cp.sort()
        cpj = "".join(cp)
        pair.append(cpj)

pcnt = Counter(pair)
pcv = list(pcnt.values())
print(pcv.count(2))


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
cnt = 0
for i, tgt in enumerate(a, 1):
    if a[tgt - 1] == i:
        cnt += 1
print(cnt // 2)
Buggy python submission (verdict: Runtime Error):
K = int(input())
A, B = map(int, input().split())

A_bai = int(A/K)
B_bai = int(B/K)

if A_bai != B_bai:
  print("OK")
else if (A%K == 0) || (B%K == 0):
  print("OK")
else:
  print("NG")


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

A_bai = int(A/K)
B_bai = int(B/K)

if A_bai != B_bai:
  print("OK")
elif (A%K == 0) or (B%K == 0):
  print("OK")
else:
  print("NG")
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
a_data = input()
a = a_data.split(' ')

sum = 0
# sum = sum(a)
for item as a:
  sum += int(item)

if sum > N:
  print(-1)
else:
  print(N-sum)


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

sum = 0
# sum = sum(a)
for item in a:
  sum += int(item)

if sum > N:
  print(-1)
else:
  print(N-sum)

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

sum = sum(a)

if sum > N:
  print(-1)
else:
  print(N-sum)

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

sum = 0
# sum = sum(a)
for item in a:
  sum += int(item)

if sum > N:
  print(-1)
else:
  print(N-sum)
Buggy python submission (verdict: Runtime Error):
seq = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(seq[int(input())])

Fixed submission:
seq = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(seq[int(input()) - 1])
Buggy python submission (verdict: Runtime Error):
while True:
    S = input()
    N = len(S)
    MOD = 1000000007
    dp = [[0]*4 for i in range(N+1)]
    for i in range(N, -1, -1):
        for j in range(3, -1, -1):
            if i == N:
                dp[i][j] = 1 if j == 3 else 0
            else:
                dp[i][j] = dp[i+1][j] * (3 if S[i] == '?' else 1)
                if j < 3 and (S[i] == '?' or S[i] == "ABC"[j]):
                    dp[i][j] += dp[i+1][j+1]
                dp[i][j] %= MOD
    print(dp[0][0])


Fixed submission:
S = input()
N = len(S)
MOD = 1000000007
dp = [[0]*4 for i in range(N+1)]
for i in range(N, -1, -1):
    for j in range(3, -1, -1):
        if i == N:
            dp[i][j] = 1 if j == 3 else 0
        else:
            dp[i][j] = dp[i+1][j] * (3 if S[i] == '?' else 1)
            if j < 3 and (S[i] == '?' or S[i] == "ABC"[j]):
                dp[i][j] += dp[i+1][j+1]
            dp[i][j] %= MOD
print(dp[0][0])
Buggy python submission (verdict: Runtime Error):
def sum_digits(n):
    s = 0
    while n:
        s += n % 10
        n //= 10
    return s


while True:
    num = int(input())
    if num % sum_digits(num) == 0:
        print('Yes')
    else:
        print('No')


Fixed submission:
def sum_digits(n):
    s = 0
    while n:
        s += n % 10
        n //= 10
    return s


num = int(input())
if num % sum_digits(num) == 0:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
import math
 
a,b,c = map(int,input().split())
 
if( a*a + b*b + c*c > 2*(a*b + a*c + b*c) && c-(a+b) > 0 ):
  print('Yes')
else:
  print('No')

Fixed submission:
import math
 
a,b,c = map(int,input().split())
 
if( a*a + b*b + c*c > 2*(a*b + a*c + b*c) and c-(a+b) > 0 ):
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
import math
 
a,b,c = map(int,input().split())

if(a*a + b*b + c*c > 2*(a*b + a*c + b*c && c-(a+b) > 0)):
  print('Yes')
else:
  print('No')

print(a*a + b*b + c*c)
print(2*(a*b + a*c + b*c))

Fixed submission:
import math
 
a,b,c = map(int,input().split())
 
if( a*a + b*b + c*c > 2*(a*b + a*c + b*c) and c-(a+b) > 0 ):
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(input().split())
A = [int(i) for i in A]
ans = 1
for i in A:
    ans *= i
if ans > 10**18:
    print('-1')
else:
    print(ans)


Fixed submission:
N = int(input())
A = list(input().split())
A = [int(i) for i in A]
if 0 in A:
    print(0)
    exit(0)

ans = 1
for i in A:
    ans *= i
    if ans > 10**18:
        print('-1')
        exit(0)
print(ans)