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

Fixed submission:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    a,b=map(int, input().split())
    if a>0:
        print('Positive')
    elif a==0 or b==0:
        print('Zero')
    elif a<0 and b>0:
        print('Zero')
    elif b<0 and (b-a)%2==0:
        print('Negative')
    else:
        print('Positive')
resolve()

Buggy submission (verdict: Runtime Error):
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    a,b=map(int, input().split())
    l=list(range(a,b+1))
    seki=1
    for i in l:
        seki=seki*i
    if seki>0:
        print('Positive')
    elif seki==0:
        print('Zero')
    else:
        print('Negative')
resolve()

Buggy submission (verdict: Runtime Error):
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    a,b=map(int, input().split())
    l=list(range(a,b+1))
    seki=1
    for i in l:
        seki*=i
    if seki>0:
        print('Positive')
    elif seki==0:
        print('Zero')
    else:
        print('Negative')
resolve()

Buggy submission (verdict: Runtime Error):
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    a,b=map(int, input().split())
    l=list(range(a,b+1))
    seki=1
    for i in l:
        seki*=i
    if seki>0:
        print('Positive')
    elif seki==0:
        print('Zero')
    else:
        print('Negative')
resolve()
Problem p02621 (python)

Fixed submission:
a=int(input())

a=a+(a*a)+(a*a*a)

print(a)

Buggy submission (verdict: Runtime Error):
a=input()

x=a+(a*a)+(a*a*a)

print(x)
Problem p03671 (python)

Fixed submission:

def main():
    arg = input()
    arg = arg.split()
    a = int(arg[0])
    b = int(arg[1])
    c = int(arg[2])
    bells = [a, b, c]
    bells.sort()
    print(bells[0] + bells[1])


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys


def main():
    a = int(sys.argv[1])
    b = int(sys.argv[2])
    c = int(sys.argv[3])
    bells = [a, b, c]
    bells.sort()
    print(bells[0] + bells[1])


if __name__ == '__main__':
    main()
Problem p03433 (python)

Fixed submission:
n = input()
a = input()
x = int(n)%500
if x<=int(a):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = input()
a = input()
x = n%500
if x<=a:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
n = input()
a = input()
x = N%500
if x<=a:
  print("YES")
else:
  print("NO")
Problem p03455 (python)

Fixed submission:
a,b = input().split()
c = int(a) * int(b)
d = c % 2
 
if d == 1:
    print("Odd")
else:
    print("Even")

Buggy submission (verdict: Runtime Error):
a,b = input().split()
c = a * b
d = c % 2

if d == 1:
    print("Odd")
else:
    print("Even")

Buggy submission (verdict: Runtime Error):
a,b = input().split()
c = a * b
d = c % 2

if d == 1:
Problem p02621 (python)

Fixed submission:
a = int(input())
print(a+(a*a)+(a*a*a))

Buggy submission (verdict: Runtime Error):
a = int(input())
print(a+a*a)(a*a*a)

Buggy submission (verdict: Runtime Error):
a = int(input())
print(a+a*a)+(a*a*a)

Buggy submission (verdict: Runtime Error):
a=int(input())
print(a+a*a)+(a*a*a)

Buggy submission (verdict: Runtime Error):
a=int(input())
print(a+a*a)(a*a*a)
Problem p02628 (python)

Fixed submission:
n, k = map(int, input().split())
plist = list(map(int, input().split()))

plist.sort()
ans = 0
for i in range(k):
    ans += plist[i]

print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
plist = list(map(int, input().split()))

plist.sort()
ans = 0
for i in rangr(k):
    ans += plist[i]

print(ans)
Problem p02621 (python)

Fixed submission:
k = int(input())
print(int(k+k**2+k**3))

Buggy submission (verdict: Runtime Error):
d = int(input())
print(int(d+d**2+d***3))
Problem p02658 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
mult = 1
 
if 0 in A:
  mult = 0
  
for i in range(N):
  mult *= A[i]
  if mult > 1e18:
    print(-1)
    break

if mult <= 1e18:
  print(mult)

Buggy submission (verdict: Runtime Error):
N = input()
A = list(map(int,input().split()))
mult = 1
for i in range(N):
  mult *= A[i]
  if mult > 1e18:
    break

if mult > 1e18:
  print(mult)
else:
  print(-1)
Problem p02677 (python)

Fixed submission:
import math

A,B,H,M = map(int,input().split())

radH = 2*math.pi*H/12 + 30/180*math.pi*M/60
radM = 2*math.pi*M/60

L = math.sqrt(A**2+B**2-2*A*B*math.cos(radH-radM))

print(L)

Buggy submission (verdict: Runtime Error):
import math

A,B,H,M = map(int,input().split())

radH = 2*math.pi*H/12 + 30/180*math.pi*M/60
radM = 2*math.pi*M/60

L = math.sqrt(A^2+B^2-2*A*B*math.cos(radH-radM))

print(L)
Problem p02748 (python)

Fixed submission:
a, b, m = map(int, input().split())
arr = list(map(int, input().split()))
brr = list(map(int, input().split()))
xycs = [tuple(map(int, input().split())) for _ in range(m)]
ans = min(arr) + min(brr)

for elem in xycs:
    x = elem[0]
    y = elem[1]
    c = elem[2]
    ans = min((arr[x - 1] + brr[y - 1] - c), ans)

print(ans)

Buggy submission (verdict: Runtime Error):
a, b, m = map(int, input().split())
arr = list(map(int, input().split()))
brr = list(map(int, input().split()))
crr = [[0] * b for _ in range(a)]
xycs = [tuple(map(int, input().split())) for _ in range(m)]
ans = min(arr) + min(brr)

for elem in xycs:
    x = elem[0]
    y = elem[1]
    c = elem[2]
    ans = min(arr[x - 1] + arr[y - 1] - c, ans)

print(ans)
Problem p02778 (python)

Fixed submission:
print("".join(map(lambda x: "x", list(input().strip()))))

Buggy submission (verdict: Runtime Error):
print("".join(map(lambda x: "x", list(input().strip()))
Problem p02802 (python)

Fixed submission:
n, m = list(map(int, input().split()))
ps = []
for i in range(m):
    tmp = input().split()
    ps.append([int(tmp[0]), tmp[1]])

ac = [False] * (n + 1)
wa = [0] * (n + 1)
for i in range(m):
    if not ac[ps[i][0]]:
        if ps[i][1] == "WA":
            wa[ps[i][0]] += 1
        elif ps[i][1] == "AC":
            ac[ps[i][0]] = True
wa_sum = 0
for i in range(n + 1):
    if ac[i]:
        wa_sum += wa[i]
print(str(ac.count(True)) + " " + str(wa_sum))

Buggy submission (verdict: Runtime Error):
n, m = list(map(int, input().split()))
ps = []
for i in range(m):
    tmp = input().split()
    ps.append([int(tmp[0]), tmp[1]])

ac = [False] * n
wa = [0] * n
for i in range(m):
    if not ac[ps[i][0]]:
        if ps[i][1] == "WA":
            wa[ps[i][0]] += 1
        elif ps[i][1] == "AC":
            ac[ps[i][0]] = True

print(str(ac.count(True)) + " " + str(sum(wa)))
Problem p02909 (python)

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

if (s == 'Sunny'):
    print('Cloudy')
elif (s == 'Cloudy'):
    print('Rainy')
else:
    print('Sunny')

Buggy submission (verdict: Runtime Error):
import bisect as b
import math

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

for _ in range(m):
    half = a.pop(-1) / 2
    a.insert(b.bisect_left(a, half), half)

print(sum(list(map(lambda x: math.floor(x), a))))
Problem p02995 (python)

Fixed submission:
def gcd(a, b):
    if (a == 0):
        return b
    elif (b == 0):
        return a
    elif (a == b):
        return a
    elif (a < b):
        return gcd(a, (b % a))
    else:
        return gcd(b, (a % b))


a, b, c, d = list(map(int, input().split()))
lcm = (c * d) // gcd(c, d)

b_c_cnt = b // c
b_d_cnt = b // d
b_lcm_cnt = b // lcm

b_cnt = b - (b_c_cnt + b_d_cnt) + b_lcm_cnt

a_c_cnt = a // c
a_d_cnt = a // d
a_lcm_cnt = a // lcm

a_cnt = a - (a_c_cnt + a_d_cnt) + a_lcm_cnt

if (a % c != 0 and a % d != 0):
    print(b_cnt - a_cnt + 1)
else:
    print(b_cnt - a_cnt)

Buggy submission (verdict: Runtime Error):
import math

a, b, c, d = list(map(int, input().split()))
lcm = math.floor((c * d) / math.gcd(c, d))

b_c_cnt = math.floor(b / c)
b_d_cnt = math.floor(b / d)
b_lcm_cnt = math.floor(b / lcm)

b_cnt = b - (b_c_cnt + b_d_cnt) + b_lcm_cnt

a_c_cnt = math.floor(a / c)
a_d_cnt = math.floor(a / d)
a_lcm_cnt = math.floor(a / lcm)

a_cnt = a - (a_c_cnt + a_d_cnt) + a_lcm_cnt

if (a % c != 0 and a % d != 0):
    print(b_cnt - a_cnt + 1)
else:
    print(b_cnt - a_cnt)

Buggy submission (verdict: Runtime Error):
import math

a, b, c, d = list(map(int, input().split()))
lcm = (c * d) // math.gcd(c, d)

b_c_cnt = b // c
b_d_cnt = b // d
b_lcm_cnt = b // lcm

b_cnt = b - (b_c_cnt + b_d_cnt) + b_lcm_cnt

a_c_cnt = a // c
a_d_cnt = a // d
a_lcm_cnt = a // lcm

a_cnt = a - (a_c_cnt + a_d_cnt) + a_lcm_cnt

if (a % c != 0 and a % d != 0):
    print(b_cnt - a_cnt + 1)
else:
    print(b_cnt - a_cnt)

Buggy submission (verdict: Runtime Error):
import math

a, b, c, d = list(map(int, input().split()))
lcm = (c * d) // math.gcd(c, d)

b_c_cnt = b // c
b_d_cnt = b // d
b_lcm_cnt = b // lcm

b_cnt = b - (b_c_cnt + b_d_cnt) + b_lcm_cnt

a_c_cnt = a // c
a_d_cnt = a // d
a_lcm_cnt = a // lcm

a_cnt = a - (a_c_cnt + a_d_cnt) + a_lcm_cnt

if (a % c != 0 and a % d != 0):
    print(b_cnt - a_cnt + 1)
else:
    print(b_cnt - a_cnt)
Problem p03031 (python)

Fixed submission:
from itertools import product
 
n, m = map(int, input().split())
k = []
s = []
for i in range(m):
    tmp = list(map(int, input().split()))
    k.append(tmp[0])
    s.append(tmp[1:])
p = list(map(int, input().split()))
 
ans = 2 ** n
for prod in (product([0, 1], repeat=n)):
    for i in range(m):
        tmp = 0
        for j in s[i]:
            tmp += prod[j - 1]
        if (tmp % 2 != p[i]):
            ans -= 1
            break
print(ans)

Buggy submission (verdict: Runtime Error):
rom itertools import product
 
n, m = map(int, input().split())
k = []
s = []
for i in range(m):
    tmp = list(map(int, input().split()))
    k.append(tmp[0])
    s.append(tmp[1:])
p = list(map(int, input().split()))
 
ans = 2 ** n
for prod in (product([0, 1], repeat=n)):
    for i in range(m):
        tmp = 0
        for j in s[i]:
            tmp += prod[j - 1]
        if (tmp % 2 != p[i]):
            ans -= 1
            break
print(ans)
Problem p03059 (python)

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

Buggy submission (verdict: Runtime Error):
import copy
import fractions as f


n = int(input())
a = list(map(int, input().split()))
a = list(set(a))
b = copy.deepcopy(a)
ans = 1
min_a = min(a)

if (2 <= b.count(min_a):
    a.append(min_a)

for e in b:
    if (len(a) == 1):
        ans = a[0]
    elif (len(a) == 2):
        ans = max(a[0], a[1])
    else:
        a.remove(e)
        rep = a[0]

        for elem in a:
            rep = f.gcd(rep, elem)

        if (ans < rep):
            ans = rep

        a.append(e)

print(ans)
Problem p03061 (python)

Fixed submission:
from fractions import gcd

n = int(input())
a = list(map(int, input().split()))
left = [0] * (n + 1)
right = [0] * (n + 1)
middle = [0] * (n + 1)

for i in range(0, n - 1):
    left[i + 1] = gcd(left[i], a[i])

for i in range(n - 1, 0, -1):
    right[i] = gcd(right[i + 1], a[i])

for i in range(n):
    middle[i] = gcd(left[i], right[i + 1])

print(max(middle))

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
    if (a == b):
        return a
    elif (a == 0):
        return b
    elif (b == 0):
        return a
    elif (a < b):
        return gcd(a, b - a)
    elif (b < a):
        return gcd(b, a - b)


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

for e in a:
    if (len(a) <= 2):
        ans = a[0]
    else:
        a.remove(e)
        rep = a[0]

        for elem in a:
            rep = gcd(rep, elem)

        if (ans < rep):
            ans = rep

        a.append(e)

print(ans)

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
    if (a == b):
        return a
    elif (a == 0):
        return b
    elif (b == 0):
        return a
    elif (a < b):
        return gcd(a, b - a)
    elif (b < a):
        return gcd(b, a - b)


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

for e in a:
    if (len(a) <= 2):
        ans = a[0]
    else:
        rep = 0
        a.remove(e)

        for i in range((len(a) - 1)):
            rep = gcd(a[i + 1], a[i])
            if (rep <= ans):
                break
            else:
                ans = rep

        a.append(e)

print(ans)
Problem p03076 (python)

Fixed submission:
import math

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

li = [a, b, c, d, e]

idx = sorted(list(map(lambda x: [x, x[1] + 10] if x[1] == 0 else x, [[0, (a % 10)], [1, (b % 10)], [2, (c % 10)], [3, (d % 10)], [4, (e % 10)]])), key=lambda x: x[1])[0][0]
print(sum(map(lambda x: li[x] if x == idx else math.ceil(li[x] * 0.1) * 10, [0, 1, 2, 3, 4])))

Buggy submission (verdict: Runtime Error):
import math

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

li = [a, b, c, d, e]
idx = sorted([*map(lambda x: [x, x[1] + 10] if x[1] == 0 else x, [[0, (a % 10)], [1, (b % 10)], [2, (c % 10)], [3, (d % 10)], [4, (\
e % 10)]])], key=lambda x: x[1])[0][0]
print(sum(map(lambda x: li[x] if x == idx else math.ceil(li[x] * 0.1) * 10, [0, 1, 2, 3, 4])))
Problem p03309 (python)

Fixed submission:
n = int(input().strip())
a = list(map(int, input().split()))
b = [(a[i] - (i + 1)) for i in range(n)]
b.sort()
mid = b[n // 2]
ans = 0
for i in range(n):
    ans += abs(b[i] - mid)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input().strip())
a = list(map(int, input().split()))
b = [(a[i] - (i + 1)) for i in range(n)]
b.sort()
mid = 0
if n % 2 == 1:
    mid = b[(n - 1) // 2 + 1]
else:
    mid = (b[(n - 1) // 2] + b[(n - 1) // 2]) // 2

ans = 0
for i in range(n):
    ans += abs(b[i] - mid)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input().strip())
a = list(map(int, input().split()))
b = [a[i] - (i + 1) for i in range(n)]
b.sort()
mid = b[n // 2]
ans = 0
for i in range(n):
    ans += abs(b - mid)
print(ans)
Problem p03371 (python)

Fixed submission:
INF = 10 ** 9
a, b, c, x, y = map(int, input().split())

ans = INF
for i in range(10 ** 5 + 1):
    ans = min(ans, i * 2 * c + max((x - i), 0) * a + max((y - i), 0) * b)
print(ans)

Buggy submission (verdict: Runtime Error):
if boundary_value <= (min_value + max_value):
    if boundary_value <= min_value:
        print(boundary_value * max(x, y))
    elif (a == max_value and y <= x) or (b == max_value and x <= y):
        print(boundary_value * max(x, y))
    else:
        print(boundary_value * (max(x, y) - abs(x - y)) +
              min_value * abs(x - y))
elif (min_value + max_value) < boundary_value:
    print(a * x + b * y)

Buggy submission (verdict: Runtime Error):
a, b, c, x, y = map(int, input().split())
big = max(a, b)
small = min(a, b)
small_many = False
if (small == a and y <= x) or (small == b and x <= y):
    small_many = True
if big <= c:
    print(x * a + y * b)
elif small <= c < big:
    if ((big + small) <= 2 * c):
        print(x * a + y * b)
    else:
        if small_many:
            print(2 * c * min(x, y) + small * (max(x, y) - (min(x, y))))
        else:
            print(2 * c * max(x, y))
else:
    if small_many:
        print(2 * c * min(x, y) + small * (max(x, y) - (min(x, y))))
    else:
        print(min(2 * c * max(x, y)))
Problem p03608 (python)

Fixed submission:
from itertools import permutations as perm

n, m, r = map(int, input().split())
r = list(map(lambda x: int(x) - 1, input().split()))
d = [[10 ** 9] * n for _ in range(n)]
for i in range(m):
    abc = tuple(map(int, input().split()))
    a = abc[0] - 1
    b = abc[1] - 1
    c = abc[2]
    d[a][b] = c
    d[b][a] = c
for k in range(n):
    for i in range(n):
        for j in range(n):
            d[i][j] = min(d[i][j], d[i][k] + d[k][j])
            d[j][i] = d[i][j]

ans = 10 ** 9
for arr in perm(r):
    rep = 0
    for i in range(len(arr) - 1):
        rep += d[arr[i]][arr[i + 1]]
    ans = min(ans, rep)
print(ans)

Buggy submission (verdict: Runtime Error):
from itertools import permutations as perm

n, m, r = map(int, input().split())
r = list(map(lambda x: int(x) - 1, input().split()))
d = [[10 ** 5] * m for _ in range(m)]
for i in range(m):
    abc = tuple(map(int, input().split()))
    a = abc[0] - 1
    b = abc[1] - 1
    c = abc[2]
    d[a][b] = c
    d[b][a] = c
for k in range(m):
    for i in range(m):
        for j in range(m):
            d[i][j] = min(d[i][j], d[i][k] + d[k][j])
            d[j][i] = min(d[j][i], d[i][k] + d[k][j])

ans = 8 * (10 ** 5)
for arr in perm(r, len(r)):
    rep = 0
    for i in range(len(arr) - 1):
        rep += d[arr[i]][arr[i + 1]]
    ans = min(ans, rep)
print(ans)
Problem p03624 (python)

Fixed submission:
s = input().strip()
chars = list(set(s))
chars.sort()
dic = {"a": 0,
       "b": 1,
       "c": 2,
       "d": 3,
       "e": 4,
       "f": 5,
       "g": 6,
       "h": 7,
       "i": 8,
       "j": 9,
       "k": 10,
       "l": 11,
       "m": 12,
       "n": 13,
       "o": 14,
       "p": 15,
       "q": 16,
       "r": 17,
       "s": 18,
       "t": 19,
       "u": 20,
       "v": 21,
       "w": 22,
       "x": 23,
       "y": 24,
       "z": 25
       }
swap = {v: k for k, v in dic.items()}
ans = "None"
count = 0
for c in chars:
    if dic[c] != count:
        ans = swap[count]
        break
    count += 1
if count <= 25:
    print(swap[count])
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
s = input().strip()
chars = list(set(s))
chars.sort()
dic = {"a": 0,
       "b": 1,
       "c": 2,
       "d": 3,
       "e": 4,
       "f": 5,
       "g": 6,
       "h": 7,
       "i": 8,
       "j": 9,
       "k": 10,
       "l": 11,
       "m": 12,
       "n": 13,
       "o": 14,
       "p": 15,
       "q": 16,
       "r": 17,
       "s": 18,
       "t": 19,
       "u": 20,
       "v": 21,
       "w": 22,
       "x": 23,
       "y": 24,
       "z": 25
       }
swap = {v: k for k, v in dic.items()}
ans = "None"
count = 0
for c in chars:
    if dic[c] != count:
        ans = swap[count]
        break
    count += 1
if count != 25:
    print(swap[count])
else:
    print(ans)
Problem p03674 (python)

Fixed submission:
def mod_rep_pow(a, n, mod=(10 ** 9 + 7)):
    res = 1
    while 0 < n:
        if n & 1:
            res = (res * a) % mod
            n -= 1
        else:
            a = (a ** 2) % mod
            n //= 2
    return (res % mod)


def mod_inverse(a, mod=(10 ** 9 + 7)):
    return mod_rep_pow(a, (mod - 2))


def mod_comb(facts, facts_inverse, n, k, mod=(10 ** 9 + 7)):
    return (facts[n] * facts_inverse[k] * facts_inverse[n - k])


n = int(input().strip())
a = list(map(int, input().split()))
not_unique = sum(a) - sum([i for i in range(1, n + 1)])
b = []
for i in range(n + 1):
    if a[i] == not_unique:
        b.append(i)
x = n - (b[1] - b[0])
mod = 10 ** 9 + 7
facts = [1] * (n + 2)
for i in range(0, n + 1):
    facts[i + 1] = (facts[i] * (i + 1) % mod)

facts_inverse = [1] * (n + 2)
facts_inverse[n + 1] = mod_inverse(facts[n + 1])
for i in range(n + 1, 0, -1):
    facts_inverse[i - 1] = (facts_inverse[i] * (i)) % mod

for i in range(1, n + 2):
    if x < (i - 1):
        print(mod_comb(facts, facts_inverse, (n + 1), i) % mod)
    else:
        print((mod_comb(facts, facts_inverse, (n + 1), i) - (mod_comb(facts, facts_inverse, x, (i - 1)))) % mod)

Buggy submission (verdict: Runtime Error):
# 繰り返し二乗法 (mod 有り)
def mod_rep_pow(a, n, mod=(10 ** 9 + 7)):
    res = 1
    while n > 0:
        if n % 2 == 0:
            a = a ** 2 % mod
            n //= 2
        else:
            res = res * a % mod
            n -= 1
    return (res % mod)


# 繰り返し二乗法 (mod 有り) を利用して nCk を高速に返す
# mod が素数のときのみ利用可能 (フェルマーの小定理を利用しているため)
def mod_comb(n, k, mod=(10 ** 9 + 7)):
    res1 = 1
    for i in range(n, (n - k), -1):
        res1 *= i
        res1 %= mod
    res2 = 1
    for i in range(1, (k + 1)):
        res2 *= i
        res2 %= mod
    return ((res1 * mod_rep_pow(res2, (mod - 2), mod)) % mod)


n = int(input().strip())
a = list(map(int, input().split()))
not_unique = sum(a) - sum([i for i in range(1, n + 1)])
b = []
for i in range(n + 1):
    if a[i] == not_unique:
        b.append(i)
x = n - (b[1] - b[0])

for i in range(1, n + 2):
    print(mod_comb(n + 1, i)  # - mod_comb(x, (i - 1)))
Problem p03694 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 0
for i in range(n - 1):
    ans += a[i + 1] - a[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [*map(int, input().split())]
a.sort()
ans = 0
for i in range(n - 1):
    ans += a[i + 1] - a[i]
print(ans)
Problem p03699 (python)

Fixed submission:
n = int(input().strip())
s = [int(input()) for _ in range(n)]
s.sort()
su = sum(s)
if su % 10 == 0:
    for elem in s:
        if (su - elem) % 10 != 0:
            print(su - elem)
            exit()
    print(0)
else:
    print(su)

Buggy submission (verdict: Runtime Error):
from itertools import product as prod

n = int(input().strip())
s = [int(input()) for _ in range(n)]
ans = 0
for elem in (prod([0, 1], repeat=10)):
    rep = 0
    for i in range(n):
        if elem[i]:
            rep += s[i]
    if rep % 10 == 0:
        rep = 0
    ans = max(ans, rep)
print(ans)
Problem p02639 (python)

Fixed submission:
import numpy as np
x = list(map(int, input().split()))

sub=[]
for i in range(len(x)):
    if x[i]== 0:
        sub.append(i+1)
print(*sub)

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

for d in range(X + 1):
    if (X - d) not in p:
        print(X-d)
        exit()
    elif (X + d) not in p:
        print(X+d)
        exit()

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

for d in range(X + 1):
    if X - d not in p:
        print(X-d)
        exit()
    elif X + d not in p:
        print(X+d)
        exit()
Problem p02642 (python)

Fixed submission:
def main():
  n=int(input())
  a=sorted(map(int,input().split()))
  maxa=a[-1]+1
  tf=[False]*maxa
  r=0
  n-=1
  for i in range(n):
    a_i=a[i]
    if tf[a_i] ==False:
      for j in range(a_i,maxa,a_i):
        tf[j]=True
      if a_i  <a[i+1]:
        #print(a_i)
        r+=1
  if tf[-1] ==False:
    r+=1
  print(r)
main()

Buggy submission (verdict: Runtime Error):
def main():
  n=int(input())
  a=sorted(map(int,input().split()))
  maxa=a[-1]+1
  tf=[False]*maxa
  r=0
  n-=1
  for i in range(n):
    a_i=a[i]
    if tf[a_i] ==False:
      for j in range(a_i,maxa,a_i):
        tf[j]=True
      if a_i  <a[i+1]:
        #print(a_i)
        r+=1
  if tf[-1] ==False:
    #r+=1
  print(r)
main()
Problem p02646 (python)

Fixed submission:
A,V = list(map(int, input().split()))
B,W = list(map(int, input().split()))
T = int(input())
print("YES" if (V-W) * T >= abs(B-A) else "NO")

Buggy submission (verdict: Runtime Error):
A=input('A')
V=input('V')
B=input('B')
W=input('W')
T=input('T')

A = int(A)
V = int(V)
B = int(B)
W = int(W)
T = int(T)

if (V-W)*T >= A-B:
	print('Yes')
else
	print('No')

Buggy submission (verdict: Runtime Error):
A=int(input('A'))
B=int(input('B'))
V=int(input('V'))
W=int(input('W'))
T=int(input('T'))

if (V-W)*T >= A-B:
	print('Yes')
else
	print('No')

Buggy submission (verdict: Runtime Error):
if (V-W)*T >= A-B:
	print('Yes')
else
	print('No')
Problem p02641 (python)

Fixed submission:
x, n = map(int, input().split())
p = list(map(int, input().split()))
mem = []
mind = 100
for i in range(-100, 200):
    if i not in p:
        t = abs(x-i)
        if t < mind:
            mem.append([i, t])
            mind = t
mem = sorted(mem, key=lambda x: (x[1], x[0]))
print(mem[0][0])

Buggy submission (verdict: Runtime Error):
x, n = map(int, input().split())
p = list(map(int, input().split()))
mem = []
mind = 100
for i in range(1, 100+1):
    if i not in p:
        t = abs(x-i)
        if t < mind:
            mem.append([i, t])
            mind = t
mem = sorted(mem, key=lambda x: (x[1], x[0]))
print(mem[0][0])