Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
r, g, b, n = map(int, input().split())

count = 0
r, g, b = sorted([r, g, b])


for i in range(n // r + 1):
    total = r * i
    if total > n:
        continue
    for j in range((n - total) // g + 1):
        total = r * i + g * j
        if total > n:
            continue
        for k in range((n - total) // b + 1):
            total = r * i + g * j + b * k
            if total == n:
                count += 1

print(count)


Fixed submission:
r, g, b, n = map(int, input().split())

count = 0
r, g, b = sorted([r, g, b], reverse=True)


for i in range(n // r + 1):
    rc = r * i
    for j in range((n - rc) // g + 1):
        gc = g * j
        if (n - rc - gc) % b == 0:
            count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
r,g,b,n = map(int, input().split())

count = 0
r,g,b = sorted([r, g, b], reverse=True)

for i in range(n // r + 1):
    total = r * i
    for j in range((n - total)//g + 1):
        total = r * i + g * j
        for k in range((n - total)//b + 1):
            total = r * i + g * j + b * k
            if total == n:
                count += 1

print(count)

Fixed submission:
r, g, b, n = map(int, input().split())

count = 0
r, g, b = sorted([r, g, b], reverse=True)


for i in range(n // r + 1):
    rc = r * i
    for j in range((n - rc) // g + 1):
        gc = g * j
        if (n - rc - gc) % b == 0:
            count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
r,g,b,n = map(int, input().split())

count = 0
r,g,b = sorted([r, g, b], reverse=True)

for i in range(n // r + 1):
    total = r * i
    if total > n:
        continue
    for j in range((n - total)//g + 1):
        total = r * i + g * j
        if total > n:
            continue
        for k in range((n - total)//b + 1):
            total = r * i + g * j + b * k
            if total == n:
                count += 1

print(count)

Fixed submission:
r, g, b, n = map(int, input().split())

count = 0
r, g, b = sorted([r, g, b], reverse=True)


for i in range(n // r + 1):
    rc = r * i
    for j in range((n - rc) // g + 1):
        gc = g * j
        if (n - rc - gc) % b == 0:
            count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
r,g,b,n = map(int, input().split())

count = 0
r,g,b = sorted([r, g, b], reverse=True)

for i in range(n // r + 1):
    total = r * i
    if total > n:
        continue
    for j in range((n - total)//g + 1):
        total = r * i + g * j
        if total > n:
            continue
        for k in range((n - total)//b + 1):
            total = r * i + g * j + b * k
            if total == n:
                count += 1

print(count)

Fixed submission:
r, g, b, n = map(int, input().split())

count = 0
r, g, b = sorted([r, g, b], reverse=True)


for i in range(n // r + 1):
    rc = r * i
    for j in range((n - rc) // g + 1):
        gc = g * j
        if (n - rc - gc) % b == 0:
            count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
from fractions import gcd
 
def main():
    n = int(input())
    a = list(map(int, input().split()))
    left = [0]
    right = [0]
    for l in a[:-1]:
        g = gcd(left[-1], l)
        left.append(g)
    for r in a[n:0:-1]:
        g = gcd(right[-1], r)
        right.append(g)
    right.reverse()
    m = 0
    for i in range(n):
        m = max(m, gcd(left[i], right[i]))
    print(m)
    
if __name__ == '__main__':
    main()

Fixed submission:
def main():
    a, b, t = map(int, input().split())
    c = int((t + 0.5) // a * b)
    print(c)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a


def main():
    n = int(input())
    a = list(map(int, input().split()))
    left = [0 for _ in range(n)]
    right = [0 for _ in range(n)]
    for i in range(1, n):
        l = math.gcd(a[i - 1], a[i])
        r = math.gcd(a[n - i - 1], a[n - i - 2])
        left[i] = l
        right[n - i - 2] = r

    m = max(left[0], right[n - 1])
    for i in range(n - 1):
        m = max(m, left[i - 1], right[i + 1])
    print(m)


if __name__ == '__main__':
    main()


Fixed submission:
from fractions import gcd

def main():
    n = int(input())
    a = list(map(int, input().split()))
    left = [0]
    right = [0]
    for i in range(1, n):
        g = gcd(left[-1], a[i - 1])
        left.append(g)
    for i in range(n - 2, -1, -1):
        g = gcd(right[-1], a[i + 1])
        right.append(g)
    right.reverse()
    m = 0
    for i in range(0, n):
        m = max(m, gcd(left[i], right[i]))
    print(m)
    
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
from fractions import gcd


def main():
    n = int(input())
    a = list(map(int, input().split()))
    left = [0 for _ in range(n)]
    right = [0 for _ in range(n)]
    for i in range(1, n):
        l = math.gcd(a[i - 1], a[i])
        r = math.gcd(a[n - i - 1], a[n - i - 2])
        left[i] = l
        right[n - i - 2] = r

    m = max(left[0], right[n - 1])
    for i in range(n - 1):
        m = max(m, left[i - 1], right[i + 1])
    print(m)


if __name__ == '__main__':
    main()


Fixed submission:
from fractions import gcd

def main():
    n = int(input())
    a = list(map(int, input().split()))
    left = [0]
    right = [0]
    for i in range(1, n):
        g = gcd(left[-1], a[i - 1])
        left.append(g)
    for i in range(n - 2, -1, -1):
        g = gcd(right[-1], a[i + 1])
        right.append(g)
    right.reverse()
    m = 0
    for i in range(0, n):
        m = max(m, gcd(left[i], right[i]))
    print(m)
    
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input().rstrip()
s = s.rstrip('#')
if len(s) == 0:
    print(0)
    exit()

start = s.find('#.')
if start == -1:
    print(0)
    exit()
print(s.count('.', start))

Fixed submission:
a, b, c = map(int, input().split())

if a > b:
    a, b = b, a
if a < c and c < b:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
s = input().rstrip()
ans = 1
i = 0
left = 0
right = 1
while i < n:
    if k > 0:
        pos = s.find('01', i)
        if pos == -1:
            i = n
            right = n - 1
        else:
            pos = s.find('10', pos + 1)
            if pos == -1:
                i = n
                right = n - 1
            else:
                right = pos
                i = pos + 1
        k = k - 1
        print(s[left:right+1])
        ans = max(ans, right - left + 1)
    else:
        pos = s.find('01', left)
        left = pos + 1
        k = k + 1

print(ans)

Fixed submission:
n, k = map(int, input().split())
s = input().rstrip()
ans = 1
i = 0
left = 0
right = 1
while i < n:
    if k > 0:
        pos = s.find('01', i)
        if pos == -1:
            i = n
            right = n - 1
        else:
            pos = s.find('10', pos + 1)
            if pos == -1:
                i = n
                right = n - 1
            else:
                right = pos
                i = pos + 1
        k = k - 1
        ans = max(ans, right - left + 1)
    else:
        pos = s.find('01', left)
        left = pos + 1
        k = k + 1

print(ans)

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


def count_maxone(binstr):
    return max([len(l) for l in binstr.split('0') if len(l)])


n, k = map(int, input().split())
s = input().rstrip()
ones = count_maxone(s)

pos = []
pre = '1'

for i in range(n):
    if s[i] == '0' and pre == '1':
        pos.append(i)
    pre = s[i]

for i in range(1, k + 1):
    combs = itertools.combinations(pos, i)
    for cmb in combs:
        slist = list(s)
        for c in cmb:
            zc = s.find('1', c)
            if zc == -1:
                zc = c + 1
            for t in range(c, zc):
                slist[t] = '1'
        ones = max(ones, count_maxone(''.join(slist)))

print(ones)


Fixed submission:
n, k = map(int, input().split())
s = input().rstrip()
ans = 1
i = 0
left = 0
right = 1
while i < n:
    if k > 0:
        pos = s.find('01', i)
        if pos == -1:
            i = n
            right = n - 1
        else:
            pos = s.find('10', pos + 1)
            if pos == -1:
                i = n
                right = n - 1
            else:
                right = pos
                i = pos + 1
        k = k - 1
        ans = max(ans, right - left + 1)
    else:
        pos = s.find('01', left)
        left = pos + 1
        k = k + 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math
a = [input().rstrip() for _ in range(5)]
a = sorted(a, key=lambda x: x[-1], reverse=True)

while True:
    m = a.pop()
    if m[-1] == '0':
        a.insert(0, m)
    else:
        break

s = sum([math.ceil(int(n) / 10) * 10 for n in a])
s += int(m)

print(s)



Fixed submission:
s = 0
mod = 0
for _ in range(5):
    i = int(input())
    m = i % 10
    if m != 0:
        if mod == 0:
            mod = m
        else:
            mod = min(mod, m)
        s += (i // 10 + 1) * 10
    else:
        s += i
if mod != 0:
    s = s - 10 + mod

print(s)
Buggy python submission (verdict: Runtime Error):
n = int(input())
 
c = [int(input()) for _ in range(n)]
b = min(c)

if b >= n:
  print(5)
else:
  t = (n - b) // b
  if t % b != 0:
    t += 1
  print(t + 5)

Fixed submission:
n = int(input())
l = [int(input()) for _ in range(5)]

b = min(l)
if b >= n:
    print(5)
else:
    t = (n - b) // b
    if (n -b) % b != 0:
        t += 1
    print(t + 5)

Buggy python submission (verdict: Runtime Error):
n = int(input())

c = [int(input()) for _ in range(n)]
b = min(c)

if b > n:
  print(5)
else:
  ans = (n - b) // b
  if ans % b != 0:
    ans += 1
  print(ans)


Fixed submission:
n = int(input())
l = [int(input()) for _ in range(5)]

b = min(l)
if b >= n:
    print(5)
else:
    t = (n - b) // b
    if (n -b) % b != 0:
        t += 1
    print(t + 5)
Buggy python submission (verdict: Runtime Error):
def gcd(a, b):
    while b > 0:
        a, b = b, a % b
    return a


def divisor(a):
    res = set()
    for i in range(1, int(a * 0.5 + 1)):
        if a % i == 0:
            res.add(i)
            res.add(a // i)
    return sorted(res)


a, b, k = map(int, input().split())
ans = divisor(gcd(a, b))[-k]
print(ans)

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


def divisor(a):
    res = set()
    for i in range(1, int(a * 0.5 + 1) + 1):
        if a % i == 0:
            res.add(i)
            res.add(a // i)
    return sorted(res)


a, b, k = map(int, input().split())
ans = divisor(gcd(a, b))[-k]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import chain


def f(s):
    l = s.split('01')
    for i in range(len(l)):
        l[i] = l[i].split('10')
    l = list(chain.from_iterable(l))
    return l


s = input().rstrip()

count = 0
while True:
    l = f(s)
    if len(l) == 1:
        break
    count += (len(l) - 1) * 2
    s = ''.join(l)

print(count)


Fixed submission:
s = input().rstrip()

print(2 * min(s.count('0'), s.count('1')))

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import chain


def f(s):
    l = s.split('01')
    for i in range(len(l)):
        l[i] = l[i].split('10')
    l = list(chain.from_iterable(l))
    return l


s = input().rstrip()

count = 0
while True:
    l = f(s)
    if len(l) == 1:
        break
    count += (len(l) - 1) * 2
    s = ''.join(l)

print(count)


Fixed submission:
s = input().rstrip()

print(2 * min(s.count('0'), s.count('1')))

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import chain
import sys
sys.setrecursionlimit(99999)

s = input().rstrip()

def f(s):
    l = s.split('01')
    for i in range(len(l)):
        l[i] = l[i].split('10')
    l = list(chain.from_iterable(l))
    if len(l) == 1:
        return 0
    else:
        r = (len(l) - 1) * 2
        return r + f(''.join(l))

print(f(s))


Fixed submission:
s = input().rstrip()

print(2 * min(s.count('0'), s.count('1')))

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import chain
import sys
sys.setrecursionlimit(99999)

s = input().rstrip()

def f(s):
    l = s.split('01')
    for i in range(len(l)):
        l[i] = l[i].split('10')
    l = list(chain.from_iterable(l))
    if len(l) == 1:
        return 0
    else:
        r = (len(l) - 1) * 2
        return r + f(''.join(l))

print(f(s))


Fixed submission:
s = input().rstrip()

print(2 * min(s.count('0'), s.count('1')))

Buggy python submission (verdict: Runtime Error):
from itertools import chain

s = input().rstrip()

def f(s):
    l = s.split('01')
    for i in range(len(l)):
        l[i] = l[i].split('10')
    l = list(chain.from_iterable(l))
    if len(l) == 1:
        return 0
    else:
        r = (len(l) - 1) * 2
        return r + f(''.join(l))

print(f(s))

Fixed submission:
s = input().rstrip()

print(2 * min(s.count('0'), s.count('1')))
Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = 0.0
for _ in range(n):
  x, u = input.split()
  if u == 'JPN':
    ans += int(x)
  else:
    ans += float(x) * 38000.0

print("{:.8f}".format(ans))


Fixed submission:
n = int(input())
ans = 0.0
for _ in range(n):
    x, u = input().split()
    if u == 'JPY':
        ans += int(x)
    else:
        ans += float(x) * 380000.0

print("{:.11f}".format(ans))
Buggy python submission (verdict: Runtime Error):
from functools import reduce

def gcd(a, b):
    if a < b:
        a, b = b, a
        while b != 0:
            a, b = b, b % a
        return a

n = int(input())
a = list(map(int, input().split()))

print(reduce(gcd, a))



Fixed submission:
from functools import reduce

def gcd(a, b):
    if a < b:
        a, b = b, a
    while b != 0:
        a, b = b, a % b
    return a

n = int(input())
a = list(map(int, input().split()))

print(reduce(gcd, a))
Buggy python submission (verdict: Runtime Error):
n = int(input())
e = list(map(int, input().split))
if max(e) < sum(e) - max(e):
  print('Yes')
else:
  print('No')


Fixed submission:
n = int(input())
e = list(map(int, input().split()))
if max(e) < sum(e) - max(e):
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
h = list(map(int, input().split()))

cost = [0 for _ in range(len(h))]

for i in range(len(h)):
    if i == 0:
        continue
    if i == 1:
        cost[i] = abs(h[i] - h[i - 1])
    else:
        cost[i] = min(cost[i - 1 - k] + abs(h[i] - h[i - 1 - k]) for k in range(min(i, k)))
print(cost[i])


Fixed submission:
n, k = map(int, input().split())
h = list(map(int, input().split()))
 
cost = [0 for _ in range(len(h))]
 
for i in range(len(h)):
    if i == 0:
        continue
    if i == 1:
        cost[i] = abs(h[i] - h[i - 1])
    else:
        cost[i] = min(cost[i - 1 - k] + abs(h[i] - h[i - 1 - k]) for k in range(min(i, k)))
print(cost[i])
Buggy python submission (verdict: Time Limit Exceeded):
n, w = map(int, input().split())
dp = [-1 for _ in range(w + 1)]
dp[0] = 0
ans = 0
for w, v in (map(int, input().split()) for _ in range(n)):
    for i in range(len(dp) - 1, w - 1, -1):
        if dp[i - w] >= 0:
            dp[i] = max(dp[i - w] + v, v, dp[i])
            ans = max(ans, dp[i])
print(ans)

Fixed submission:
n, w = map(int, input().split())
dp = [-1 for _ in range(w + 1)]
dp[0] = 0
ans = 0
for w, v in (map(int, input().split()) for _ in range(n)):
    for i in range(len(dp) - 1, w - 1, -1):
        if dp[i - w] >= 0:
            dp[i] = max(dp[i - w] + v, v, dp[i])
            ans = max(ans, dp[i])
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
sum = 0
discount = 0
for _ in range(n):
  p = int(input())
  sum += p
  discount = max(discount, p // 2)

print(max - discount)


Fixed submission:
n = int(input())
ans = 0
d = 0
for _ in range(n):
    p = int(input())
    ans += p
    d = max(d, p // 2)

print(ans - d)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())

pn_cn = []
pn_cn_dict = {}


for _ in range(m):
    pn, cn = map(int, input().split())
    cities = pn_cn_dict.get(pn)
    if cities is None:
        cities = [cn]
    else:
        cities.append(cn)
    pn_cn_dict[pn] = cities
    pn_cn.append((pn, cn))

for k in pn_cn_dict:
    c = pn_cn_dict[k]
    c = sorted(c)
    pn_cn_dict[k] = c

for pn, cn in pn_cn:
    ci = pn_cn_dict[pn].index(cn) + 1
    print("{:06}{:06}".format(pn, ci))




Fixed submission:
import bisect

n, m = map(int, input().split())

pn_cn = []
pn_cn_dict = {}


for _ in range(m):
    pn, cn = map(int, input().split())
    cities = pn_cn_dict.get(pn)
    if cities is None:
        cities = [cn]
    else:
        cities.append(cn)
    pn_cn_dict[pn] = cities
    pn_cn.append((pn, cn))

for k in pn_cn_dict:
    c = pn_cn_dict[k]
    c = sorted(c)
    pn_cn_dict[k] = c

for pn, cn in pn_cn:
    ci = bisect.bisect(pn_cn_dict[pn], cn)
    print("{:06}{:06}".format(pn, ci))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())

pn_cn = []
pn_cn_dict = {}


for _ in range(m):
    pn, cn = map(int, input().split())
    cities = pn_cn_dict.get(pn)
    if cities is None:
        cities = [cn]
    else:
        cities.append(cn)
    pn_cn_dict[pn] = cities
    pn_cn.append((pn, cn))

for k in pn_cn_dict:
    c = pn_cn_dict[k]
    c = sorted(c)
    pn_cn_dict[k] = c

for pn, cn in pn_cn:
    ci = pn_cn_dict[pn].index(cn) + 1
    print("{:06}{:06}".format(pn, ci))




Fixed submission:
import bisect

n, m = map(int, input().split())

pn_cn = []
pn_cn_dict = {}


for _ in range(m):
    pn, cn = map(int, input().split())
    cities = pn_cn_dict.get(pn)
    if cities is None:
        cities = [cn]
    else:
        cities.append(cn)
    pn_cn_dict[pn] = cities
    pn_cn.append((pn, cn))

for k in pn_cn_dict:
    c = pn_cn_dict[k]
    c = sorted(c)
    pn_cn_dict[k] = c

for pn, cn in pn_cn:
    ci = bisect.bisect(pn_cn_dict[pn], cn)
    print("{:06}{:06}".format(pn, ci))
Buggy python submission (verdict: Runtime Error):
def gcd(*args):
    a, *args = args
    if len(args) == 0:
        return a
    elif len(args) > 1:
        return gcd(a, gcd(*args))
    else:
        b = args[0]
        if a < b:
            a, b = b, a
        while b != 0:
            a, b = b, a % b
        return a


n, x = map(int, input().split())
c = [abs(x - xn) for xn in map(int, input().split())]
print(gcd(*c))


Fixed submission:
from functools import reduce

def gcd(a, b):
    if a < b:
        a, b = b, a
    while b != 0:
        a, b = b, a % b
    return a

def gcd_from_list(vals):
    return reduce(gcd, vals)

n, x = map(int, input().split())
c = [abs(x - xn) for xn in map(int, input().split())]
print(gcd_from_list(c))
Buggy python submission (verdict: Runtime Error):
k = int(input())
a, b = a // 2 + a % 2, a // 2
print(a * b)



Fixed submission:
k = int(input())
a, b = k // 2 + k % 2, k // 2
print(a * b)
Buggy python submission (verdict: Runtime Error):
from functools import reduce
from operators import mul
 
n = int(input())
a = list(map(int, input().strip()))
 
m = reduce(mul, a) - 1
ans = 0
for ai in a:
  ans += m % ai
 
print(ans)


Fixed submission:
from functools import reduce
from operator import mul
n = int(input())
a = list(map(int, input().split()))

m = reduce(mul, a) - 1
ans = 0
for ai in a:
    ans += m % ai
print(ans)

Buggy python submission (verdict: Runtime Error):
from functools import reduce
from operators import mul

n = int(input())
a = list(map(int, input().strip()))

m = reduce(mul, a) - 1
ans = 0
for ai in a:
  ans += mul % ai

print(ans)


Fixed submission:
from functools import reduce
from operator import mul
n = int(input())
a = list(map(int, input().split()))

m = reduce(mul, a) - 1
ans = 0
for ai in a:
    ans += m % ai
print(ans)
Buggy python submission (verdict: Runtime Error):
def gcd(a, b):
  if b > a:
    a, b = b, a
    while b != 0:
      a, b = b, a % b
    return a

n = int(input())
ans = n * 2 // gcd(n, 2)
print(ans)


Fixed submission:
def gcd(a, b):
  if b > a:
    a, b = b, a
  while b != 0:
    a, b = b, a % b
  return a
 
n = int(input())
ans = n * 2 // gcd(n, 2)
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if b < a:
  a, b = b, a
if if b <= 8 or 16 - b - 2 <= a:
  print('Yay!')
else:
  print(':(')

Fixed submission:
a, b = map(int, input().split())
if a <= 8 and b <= 8:
  print('Yay!')
else:
  print(':(')
Buggy python submission (verdict: Runtime Error):
def f(n):
  c = 0
  while n % 2 == 0:
    c += 1
    n = n // 2
  return c

n = int(input())
a = list(map, int, input().split())
print(sum((f(ai) for ai in a if ai % 2 == 0)))


Fixed submission:
def f(n):
  c = 0
  while n % 2 == 0:
    c += 1
    n = n // 2
  return c
 
n = int(input())
a = list(map(int, input().split()))
print(sum((f(ai) for ai in a if ai % 2 == 0)))

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [n // 2 for n in map(int, input().split() if n % 2 == 0)]
print(sum(a))


Fixed submission:
def f(n):
  c = 0
  while n % 2 == 0:
    c += 1
    n = n // 2
  return c
 
n = int(input())
a = list(map(int, input().split()))
print(sum((f(ai) for ai in a if ai % 2 == 0)))

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = (n // 2 in map(int, input().split() if n % 2 == 0))
print(sum(a))


Fixed submission:
def f(n):
  c = 0
  while n % 2 == 0:
    c += 1
    n = n // 2
  return c
 
n = int(input())
a = list(map(int, input().split()))
print(sum((f(ai) for ai in a if ai % 2 == 0)))
Buggy python submission (verdict: Runtime Error):
a, b = map(int, intput().split())
print(max(a + b, a - b, a * b))

Fixed submission:
a, b = map(int, input().split())
print(max(a + b, a - b, a * b))

Buggy python submission (verdict: Runtime Error):
a, b = map(int, intpu().split())
print(max(a + b, a - b, a * b))


Fixed submission:
a, b = map(int, input().split())
print(max(a + b, a - b, a * b))
Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())
if x < 4:
  print(1)
else:
  ans = 2
  for i in range(2, x):
    for j in range(2, x):
      if i ** j <= x:
        ans = max(ans, i ** j)
  print(ans)

Fixed submission:
x = int(input())
if x < 4:
  print(1)
else:
  ans = 2
  for i in range(2, x):
    for j in range(2, x):
      if i ** j <= x:
        ans = max(ans, i ** j)
      else:
        break
  print(ans)

Buggy python submission (verdict: Runtime Error):
x = int(input())
if x = 1:
  print(1)
else:
  ans = 2
  for i in range(2, x):
    for j in range(2, x):
      if i ** j <= x:
        ans = max(ans, i ** j)
  print(ans)


Fixed submission:
x = int(input())
if x < 4:
  print(1)
else:
  ans = 2
  for i in range(2, x):
    for j in range(2, x):
      if i ** j <= x:
        ans = max(ans, i ** j)
      else:
        break
  print(ans)
Buggy python submission (verdict: Runtime Error):
n, x = map(int, input().split())
costs = [int(input()) for _ in range(n)]
print(len(costs) + (x - sum(costs)) // min(consts))


Fixed submission:
n, x = map(int, input().split())
costs = [int(input()) for _ in range(n)]
print(len(costs) + (x - sum(costs)) // min(costs))
Buggy python submission (verdict: Runtime Error):
n, m, x = map(int, input().split())
c = [0] * (n + 1)
for i in (map(int, input().split())):
  c[i] = 1
print(min(sum(c[0:x], c[x:-1])))


Fixed submission:
n, m, x = map(int, input().split())
c = [0] * (n + 1)
for i in (map(int, input().split())):
  c[i] = 1
print(min(sum(c[0:x]), sum(c[x:-1])))
Buggy python submission (verdict: Runtime Error):
from math import ceil
a, b = map(int, input())
print(ceil((a + b) / 2))


Fixed submission:
from math import ceil
a, b = map(int, input().split())
print(ceil((a + b) / 2))
Buggy python submission (verdict: Time Limit Exceeded):
def f(n):
  ans = 0
  while n > 0:
    ans += n % 10
    n // 10
  return ans

n = int(input())
if n % f(n) == 0:
  print('Yes')
else:
  print('No')

Fixed submission:
n = input()
ni = int(n)
f = 0
for ns in n:
  f += int(ns)
if ni % f == 0:
  print('Yes')
else:
  print('No')