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

Fixed submission:
S = input()

if S == "Sunny":
    result = "Cloudy"
elif S == "Cloudy":
    result = "Rainy"
else:
    result = "Sunny"

print(result)

Buggy submission (verdict: Runtime Error):
n,k,q = map(int,input().split(" "))
point = [k-q] * n
for i in range(0,q):
    point[int(input())-1] += 1
for j in range(0,n):
    if point[j] > 0:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
n,k,q = map(int,input().split(" "))
point = [k-q] * n
for i in range(0,q):
    point[int(input())-1] += 1
for j in range(0,n):
    if point[j] > 0:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
n,k,q = map(int,input().split(" "))
point = [k-q] * n
for i in range(0,q):
    point[int(input())-1] += 1
for j in range(0,n):
    if point[j] > 0:
        print("Yes")
    else:
        print("No")
Problem p03493 (python)

Fixed submission:
s = input()
print(s.count("1"))

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

count = 0
flag = 0
 
#loop
while(1):
  for i in range(N):
    
    if A[i] %2 == 1:
      flag = 1
    else:
      temp = A[i]/2
      A[i] = temp;
  
  #judge
  if flag == 1:
    break
  else:
    count +=1
 
print(count)
Problem p02717 (python)

Fixed submission:
# -*- coding: utf-8 -*-
X,Y,Z = map(int,input().split())
print("{} {} {}".format(Z,X,Y))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
#標準入力の取得
N,M = map(int,input().split())
A = list(map(int,input().split()))

cutoff = sum(A)/(4*M)
count_pop = sum(i >= cutoff for i in A)


if count_pop<M :
    print("No")
else:
    print("Yes")
Problem p02717 (python)

Fixed submission:
n = list(map(int,input().split()))
print(str(n[2])+' ' +str(n[0])+' '+str(n[1]))

Buggy submission (verdict: Runtime Error):
l = list(map(int,input().split()))
print(l[2]+' 'l[0]+' 'l[1])
Problem p02718 (python)

Fixed submission:
nm=input().split()
vote=[int(i) for i in input().split()]
n=int(nm[0])
m=int(nm[1])
selectable=0
all=sum(vote)
for v in vote:
	if v < all/(4*m):
		continue
	else:
		selectable+=1
if selectable>=m:
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
nm=input().split()
vote=[int(i) in input().split()]
n=int(nm[0])
m=int(nm[1])
selectable=0
for v in vote:
	if v < 4*m:
		continue
	else:
		selectable+=1
if selectable>=m:
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
nm=input().split()
vote=[int(i) in input().split()]
n=int(nm[0])
m=int(nm[1])
selectable=0
for v in vote:
  if v < 4*m:
    continue
  else:
    selectable+=1
if selectable>=m:
  print("Yes")
else:
  print("No")
Problem p02841 (python)

Fixed submission:
in1=input().split()
in2=input().split()
if int(in1[0])==int(in2[0]):
  print(0)
else:
  print(1)

Buggy submission (verdict: Runtime Error):
in1=input().split()
in2=input().split()
if int(in1[0])==int(in2[0]):
  return 0
else:
  return 1
Problem p02789 (python)

Fixed submission:
a, b = map(int,input().split())
if a == b:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a, b = map(input().split())
if a == b:
  print("Yes")
else:
  print("No")
Problem p02885 (python)

Fixed submission:
a, b = map(int, input().split())
if a - b * 2 > 0:
  print(a-b*2)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
a, b = map(int(), input().split())
if a - b * 2 > 0:
  print(a-b*2)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
a, b = map(int(), input())
if a - b * 2 > 0:
  print(a-b*2)
else:
  print(0)
Problem p03035 (python)

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

if a > 12:
  print(b)
elif a > 5:
  print(round(b/2))
else:
  print(0)

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

if a > 12:
  print(b)
  break
elif a > 5:
  print(b/2)
  break
else:
  print(0)
Problem p03076 (python)

Fixed submission:
a = list(map(int,[input() for i in range(5)]))
b = 10
c = 0
for i in a:
	if i % 10 > 0:
		c += i + 10 - i % 10
		if b > i % 10:
			b = i % 10
	else:
		c += i
print(c-10+b)

Buggy submission (verdict: Runtime Error):
a = list(map(int,[input() for i in range(5)]))
b = []
c = []
d = False
for i in a:
	b.append(10-i % 10)
for i,j in zip(b,a):
	if max(b) != i:
		c.append(i+j)
	elif not d:
		c.append(j)
    else:
        c.append(i+j)
print(sum(c))

Buggy submission (verdict: Runtime Error):
b = []
c = []
for i in a:
	b.append(10-i % 10)
for i,j in zip(b,a):
	if max(b) != i:
		c.append(i+j)
	else:
		c.append(j)
print(sum(c))

Buggy submission (verdict: Runtime Error):
a = list(map(int,[input() for i in range(5)]))
b = []
c =[]
for i in a:
	b.append(10 - i % 10)
for i,j in zip(b,a):
	if max(b) != i:
		c.append(i+j)
    else:
        c.append(j)
print(sum(c))

Buggy submission (verdict: Runtime Error):
a = list(map(int,[input() for i in range(5)]))
b = []
c =[]
for i in a:
	b.append(10-i % 10)
for i,j in zip(b,a):
	if max[b] != i:
		c.append(i+j)
print(sum(c))
Problem p03085 (python)

Fixed submission:
a = str(input())
b = {"A":"T","G":"C","T":"A","C":"G"}
print(b[a])

Buggy submission (verdict: Runtime Error):
a = str(input())
b = {"A":"T","G":"C"}
print(b[a])
Problem p03087 (python)

Fixed submission:
n,q = 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 = map(int,input().split())
  print(t[r-1] - t[l-1])

Buggy submission (verdict: Runtime Error):
n,q = map(int,input().split())
s = input()
t = [0] * (n + 1)
for i in range(q):
  t[i+1] = t[i] + (1 if s[i:i+2] == "AC" else 0)
for i in range(q):
  l,r = map(int,input().split())
  print(t[r+1] - t[l-1])

Buggy submission (verdict: Runtime Error):
n,q = map(int,input().split())
s = input()
t = [0] * (n + 1)
for i in range(q):
  t[i+1] = t[i] + (1 if s[i:i+2] == "AC" else 0)
for i in range(q):
  l,r = map(int,input().split())
  print(t[r-1] - t[l-1])

Buggy submission (verdict: Runtime Error):
n,q = map(int,input().split())
s = str(input())
for _ in range(q):
  l,r = map(int,input().split())
  print(s[l-1:r].count("AC")
Problem p03110 (python)

Fixed submission:
n = int(input())
sum = 0
for _ in range(n):
    x,u = input().split()
    if str(u) == "BTC":
        sum += float(x) * 380000.0
    else:
        sum += float(x)
print(sum)

Buggy submission (verdict: Runtime Error):
n = int(input())
sum = 0
for _ in range(n):
  x,u = input().split()
  if str(u) = "BTC":
    sum += int(x) * 380000.0
  else:
    sum += int(x)
print(sum)
Problem p04043 (python)

Fixed submission:
A= [int(x) for x in input().split()]
 
A.sort()

if A == [5,5,7]:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
A= [int(x) for x in input().split()]

sort(A)

if A == [5,5,7]:
  print("YES")
else:
  print("NO")
Problem p02717 (python)

Fixed submission:
x, y, z = map(int, input().split())

x, y = y, x
x, z = z, x

print(x, y ,z)

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

count = 0
allpoint = sum(A)
X = allpoint // (4 * M)

for i in A:
    if i > X:
        count += 1

if  count >= M:
    print('Yes')
else:
    print('No')

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

count = 0
allpoint = sum(A)

for i in A:
    if i > float(allpoint // (4 * M)):
        count += 1

if  count >= M:
    print('Yes')
else:
    print('No')
Problem p02717 (python)

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

Buggy submission (verdict: Runtime Error):
import fractions

n, k = map(int, input().split())
if (n > abs(n - k)):
    n = fractions.gcd(n, k)
while n > abs(n - k):
    n = abs(n - k)
if n == k:
    print('0')
else:
    print(n)
Problem p02761 (python)

Fixed submission:
N, M = map(int, input().split())
s = [list(map(int, list(input().split()))) for i in range(M)]

ans = [-1] * N

for i in s:
    if ans[i[0] - 1] != -1 and ans[i[0] - 1] != i[1]:
        print(-1)
        exit()
    ans[i[0] - 1] = i[1]

if M == 0 and N != 1:
    ans[0] = 1
tmp = int(''.join((map(str, [int(str(a).replace('-1', '0')) for a in ans]))))
if N >= 2 and ans[0] == -1:
    ans[0] = 1

ans = [int(str(a).replace('-1', '0')) for a in ans]

res = ''.join((map(str, ans)))
if int(res) >= 0 and len(str(int(res))) == N:
    print(int(res))
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
s = [list(map(int, list(input().split()))) for i in range(M)]

ans = [-1] * M
for i in s:
    if ans[i[0] - 1] != -1 and ans[i[0] - 1] != i[1]:
        print(-1)
        exit()
    ans[i[0] - 1] = i[1]

ans = [int(str(a).replace('-1', '0')) for a in ans]
res = ''.join((map(str, ans)))
if int(res) > 0 and len(str(int(res))) == N:
    print(int(res))
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
s = [list(map(int, list(input().split()))) for i in range(M)]

ans = [-1] * M
for i in s:
    if ans[i[0] - 1] != -1 and ans[i[0] - 1] != i[1]:
        print(-1)
        exit()
    ans[i[0] - 1] = i[1]

ans = [int(str(a).replace('-1', '0')) for a in ans]
res = ''.join((map(str, ans)))
if int(res) > 0 and len(res) == N:
    print(int(res))
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
s = [list(map(int, list(input().split()))) for i in range(M)]

ans = [-1] * M
for i in s:
    if ans[i[0] - 1] != -1 and ans[i[0] - 1] != i[1]:
        print(-1)
        exit()
    ans[i[0] - 1] = i[1]

ans = [int(str(a).replace('-1', '0')) for a in ans]
res = ''.join((map(str, ans)))
if int(res) != 0 and len(res) == N:
    print(int(res))
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
s = [list(map(int, list(input().split()))) for i in range(M)]

ans = [-1] * M
for i in s:
    if ans[i[0] - 1] != -1 and ans[i[0] - 1] != i[1]:
        print(-1)
        return 
    ans[i[0] - 1] = i[1]

ans = [int(str(a).replace('-1', '0')) for a in ans]
res = ''.join((map(str, ans)))
if int(res) != 0:
    print(int(res))
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
s = [list(map(int, list(input().split()))) for i in range(M)]

ans = [-1] * M
for i in s:
    if ans[i[0] - 1] != -1 and ans[i[0] - 1] != i[1]:
        print(-1)
        exit()
    ans[i[0] - 1] = i[1]

ans = [int(str(a).replace('-1', '0')) for a in ans]
res = ''.join((map(str, ans)))
if int(res) != 0:
    print(int(res))
else:
    print(-1)
Problem p03470 (python)

Fixed submission:
N = int(input())
s = [input() for i in range(N)]
print(len(set(s)))

Buggy submission (verdict: Runtime Error):
A, B, C, X = [int(input()) for i in range(4)]
res = 0
for a in range(A + 1):
    for b in range(B + 1):
        for c in range(C + 1):
            if a * 500 + b * 100 + c * 50 == X:
                res += 1
print(res)

Buggy submission (verdict: Runtime Error):
A, B, C, X = [int(input()) for i in range(4)]
res = 0
for a in range(A + 1):
    for b in range(B + 1):
        for c in range(C + 1):
            if a * 500 + b * 100 + c * 50 == X:
                res += 1
print(res)
Problem p03854 (python)

Fixed submission:
def hantei(s, h):
    try:
        slen = len(s)
        hlen = len(h)
        res = s.index(h, slen - hlen, slen + 1)
        return res
    except ValueError as e:
        return -1


def resolve():
    s = input()
    a = 'dream'
    b = 'dreamer'
    c = 'erase'
    d = 'eraser'
    while True:
        # 後ろから文字列検索
        # 合ったらその文字を削除
        D = hantei(s, d)
        if D > -1:
            s = s[:-len(d)]
            continue
        B = hantei(s, b)
        if B > -1:
            s = s[:-len(b)]
            continue
        C = hantei(s, c)
        if C > -1:
            s = s[:-len(c)]
            continue
        A = hantei(s, a)
        if A > -1:
            s = s[:-len(a)]
            continue
        if len(s) == 0:
            print('YES')
        else:
            print('NO')
        break
        
resolve()

Buggy submission (verdict: Runtime Error):
s = input()
a = 'dream'
b = 'dreamer'
c = 'erase'
d = 'eraser'
while True:
    # 後ろから文字列検索
    # 合ったらその文字を削除
    D = hantei(s, d)
    if D > -1:
        s = s[:-len(d)]
        continue
    B = hantei(s, b)
    if B > -1:
        s = s[:-len(b)]
        continue
    C = hantei(s, c)
    if C > -1:
        s = s[:-len(c)]
        continue
    A = hantei(s, a)
    if A > -1:
        s = s[:-len(a)]
        continue
    if len(s) == 0:
        print('YES')
    else:
        print('NO')
    break


def hantei(s, h):
    try:
        slen = len(s)
        hlen = len(h)
        res = s.index(h, slen - hlen, slen + 1)
        return res
    except ValueError as e:
        return -1

Buggy submission (verdict: Runtime Error):
    s = input()
    a = 'dream'
    b = 'dreamer'
    c = 'erase'
    d = 'eraser'
    while True:
        # 後ろから文字列検索
        # 合ったらその文字を削除
        D = hantei(s, d)
        if D > -1:
            s = s[:-len(d)]
            continue
        B = hantei(s, b)
        if B > -1:
            s = s[:-len(b)]
            continue
        C = hantei(s, c)
        if C > -1:
            s = s[:-len(c)]
            continue
        A = hantei(s, a)
        if A > -1:
            s = s[:-len(a)]
            continue
        if len(s) == 0:
            print('YES')
        else:
            print('NO')
        break
Problem p02717 (python)

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

Buggy submission (verdict: Runtime Error):
x,y,z = map(int, input().split())
x,y,z >= 1 && <= 100 
print(z,y,x)

Buggy submission (verdict: Runtime Error):
a,b,c = map(int, input().split())
x,y,z = map(int, input().split())
print(c,a,b)
print(z,y,x)

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().splite())
x,y,z = map(int,input().split())
print(c,a,b)
print(z,y,x)

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().splite())
print(c,a,b)

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
print(c,a,b)
x,y,z = map(int,input().split())
print(z,y,x)

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input(),split())
x,y,z = map(int,input(),split())
print(c,a,b)
print(z,y,x)

Buggy submission (verdict: Runtime Error):
user_input = input(" ")
user_input = "a","b","c" && user_input = "x,y,z"
"a","b","c" = [1,2,3]
"x","y","z" = [1,2,3]
print('The value of x after swapping: {}'.format(x))
print('The value of y after swapping: {}'.format(y))

Buggy submission (verdict: Runtime Error):
"x,y,z" = map(int,input(),split())
print(z,y,x)

Buggy submission (verdict: Runtime Error):
A,B,C = map(int,input(),split())
print(C,A,B)

Buggy submission (verdict: Runtime Error):
x,y,z = = map(int, input(),split())
print(X,Z,Y)
Problem p02719 (python)

Fixed submission:
n, k = map(int, input().split())
if n==0 or k==1:
    print(0)
    exit()
elif n<k:
    print(min(n, abs(n-k)))
    exit()
elif n % k == 0:
    print(0)
    exit()
else:
    mx = n%k
print(min(abs(mx-k), mx))

Buggy submission (verdict: Runtime Error):
ans = 1
    while True :
        if ans < 0 :
            print(abs(ans))
            break
        ans = N - K
        N = ans
Problem p02901 (python)

Fixed submission:
n, m = map(int, input().split())

INF = float('inf')
dp = [INF for j in range(2**n)]

dp[0] = 0

for i in range(m):
    a, b = map(int, input().split())
    c = map(int, input().split())

    k = 0
    for ci in c:
        ci -= 1
        k |= (1 << ci)
    for j in range(2**n):
        l = k | j
        dp[l] = min(dp[l], dp[j] + a)

if dp[2**n-1] == INF:
    print(-1)
else:
    print(dp[2**n-1])

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

box = []
for i in range(m):
    a, b = map(int, input().split())
    c = list(map(int, input().split()))
    box.append([a, c])

box.sort(key=lambda x: x[0])

memo = [0] * n
tmp = []

ans = 0

for i in range(m):
    cost = box[i][0]
    target = box[i][1]

    for t in target:
        t -= 1
        memo[t] += 1
    ans += cost
    tmp.append(i)

    cost_max = 0
    bit_max = 0
    for bit in range(2**(i+1)):
        memo_sub = [0] * n
        cost_sub = 0
        for j in range(i+1):
            if (1 << j) & bit:
                co = box[j][0]
                ta = box[j][1]
                cost_sub += co
                for t in ta:
                    t -= 1
                    memo_sub[t] += 1
        flag = 1
        for k in range(n):
            if memo_sub[k] >= memo[k]:
                flag = 0
        if flag:
            if cost_sub > cost_max:
                cost_max = cost_sub
                bit_max = bit

    for j in range(i+1):
        if (1 << j) & bit_max:
            tmp.remove(j)
            for t in box[j][1]:
                t -= 1
                memo[t] -= 1
    ans -= cost_max

for mi in memo:
    if mi == 0:
        print(-1)
        exit()

print(ans)
Problem p03006 (python)

Fixed submission:
n = int(input())
point = []
for i in range(n):
    x_, y_ = map(int, input().split())
    point.append([x_, y_])

point.sort(key=lambda x: x[1])
point.sort(key=lambda x: x[0])
ans = 0
x = []
y = []
for i in range(n):
    x.append(point[i][0])
    y.append(point[i][1])

for i in range(n):
    for j in range(i+1, n):
        count = 0
        p = x[j] - x[i]
        q = y[j] - y[i]
        for k in range(n):
            for l in range(k+1, n):
                if (x[l] - x[k] == p) and (y[l] - y[k] == q):
                    count += 1
        ans = max(ans, count)

print(n - ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
point = []
for i in range(n):
    x_, y_ = map(int, input().split())
    point.append([x_, y_])

point.sort()
ans = 0
x = point[:][0]
y = point[:][1]
for i in range(n):
    for j in range(i+1, n):
        count = 0
        p = x[j] - x[i]
        q = y[j] - y[i]
        for k in range(n):
            for l in range(k+1, n):
                if (x[l] - x[k] == p) and (y[l] - y[k] == q):
                    count += 1
        ans = max(ans, count)

print(n - ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
point = []
for i in range(n):
    x_, y_ = map(int, input().split())
    point.append((x_, y_))

point.sort(key=lambda x: x[0])
ans = 0
x = point[:][0]
y = point[:][1]
for i in range(n):
    for j in range(i+1, n):
        count = 0
        p = x[j] - x[i]
        q = y[j] - y[i]
        for k in range(n):
            for l in range(k+1, n):
                if (x[l] - x[k] == p) and (y[l] - y[k] == q):
                    count += 1
        ans = max(ans, count)

print(n - ans)
Problem p03007 (python)

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

a.sort()
if a[0] >= 0:
    m = sum(a[1:]) - a[0]
    print(m)
    tmp = a[0]
    for i in range(1, n-1):
        print(tmp, a[i])
        tmp -= a[i]
    print(a[n-1], tmp)
elif a[-1] <= 0:
    m = -sum(a[:-1]) + a[-1]
    print(m)
    tmp = a[n-1]
    for i in range(n-1):
        print(tmp, a[i])
        tmp -= a[i]
else:
    m = 0
    pos = []
    neg = []
    for ai in a:
        m += abs(ai)
        if ai >= 0:
            pos.append(ai)
        else:
            neg.append(ai)
    print(m)
    tmp = 0
    ni = 0
    pi = 0

    if len(pos) > 1:
        print(neg[ni], pos[pi])
        tmp = neg[ni] - pos[pi]
        ni += 1
        pi += 1

        while pi < len(pos) - 1:
            print(tmp, pos[pi])
            tmp = tmp - pos[pi]
            pi += 1
        print(pos[pi], tmp)
        tmp = pos[pi] - tmp
        while ni < len(neg):
            print(tmp, neg[ni])
            tmp -= neg[ni]
            ni += 1
    else:
        print(pos[pi], neg[ni])
        tmp = pos[pi] - neg[ni]
        ni += 1
        while ni < len(neg):
            print(tmp, neg[ni])
            tmp -= neg[ni]
            ni += 1

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

a.sort()
if a[0] > 0:
    m = sum(a[1:]) - a[0]
    print(m)
    tmp = a[0]
    for i in range(1, n-1):
        print(tmp, a[i])
        tmp -= a[i]
    print(a[n-1], tmp)
elif a[-1] < 0:
    m = -sum(a[:-1]) + a[-1]
    print(m)
    tmp = a[n-1]
    for i in range(0, n-1, -1):
        print(tmp, a[i])
        tmp -= a[i]
else:
    m = 0
    pos = []
    neg = []
    for ai in a:
        m += abs(ai)
        if ai >= 0:
            pos.append(ai)
        else:
            neg.append(ai)
    print(m)
    tmp = 0
    ni = 0
    pi = 0

    if len(pos) > 1:
        print(neg[ni], pos[pi])  # pos > 1
        tmp = neg[ni] - pos[pi]
        ni += 1
        pi += 1

        while pi < len(pos) - 1:
            print(tmp, pos[pi])
            tmp = tmp - pos[pi]
            pi += 1
        print(pos[pi], tmp)
        tmp = pos[pi] - tmp
        while ni < len(neg):
            print(tmp, neg[ni])
            tmp -= neg
            ni += 1
    else:
        print(pos[pi] - neg[ni])
        tmp = pos[pi] - neg[ni]
        ni += 1
        while ni < len(neg):
            print(tmp, neg[ni])
            tmp -= neg
            ni += 1
Problem p03050 (python)

Fixed submission:
n = int(input())

ans = 0


i = 1
while i * i < n:
    if n % i == 0:
        m = n // i - 1
        if m > i:
            ans += m
    i += 1

print(ans)

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

ans = 0


i = 1
while i * i <= n:
    if n % i == 0:
        if n // (i-1) == n % (i-1):
            ans += n // i - 1
    i += 1

print(ans)
Problem p03076 (python)

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

ans = 0
flag = 0
for i in num:
    if i % 10 == 0:
        ans += i
    else:
        ans += i // 10 * 10 + 10
        flag = 1

ma = 0
if flag:
    for i in num:
        if i % 10 == 0:
            continue
        ma = max(ma, 10 - i % 10)

print(ans - ma)

Buggy submission (verdict: Runtime Error):
num = [int(input()) for _ in range(5)]

ans = 0
flag = 0
for i in num:
    if i % 10 == 0:
        ans += i
    else:
        ans += i // 10 * 10 + 10
        flag = 1

if flag:
    ma = 0
    for i in num:
        if i % 10 == 0:
            continue
        ma = max(ma, 10 - i % 10)

print(ans - ma)
Problem p03078 (python)

Fixed submission:
x, y, z, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)

ab = []
for ai in a:
    for bi in b:
        ab.append(ai + bi)
ab.sort(reverse=True)
if k < len(ab):
    ab = ab[:k]

ans = []
for abi in ab:
    for ci in c:
        ans.append(abi + ci)
ans.sort(reverse=True)
for i in range(k):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
x, y, z, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

a.sort()
b.sort()
c.sort()

if x * y * z <= 3000:
    ans = []
    for ai in a:
        for bi in b:
            for ci in c:
                ans.append(ai + bi+ ci)
    ans.sort(reverse=True)
    for i in range(k):
        print(ans[i])
else:
    ia = 0
    ib = 0
    ic = 0
    len_a = len(a)
    len_b = len(b)
    len_c = len(c)

    while (ia+1) * (ib+1) * (ic+1) < 3000:
        if ia + 1 == len_a:
            diff_a = float('inf')
        else:
            diff_a = a[0] - a[ia+1]
        if ib + 1 == len_b:
            diff_b = float('inf')
        else:
            diff_b = b[0] - b[ib+1]
        if ic + 1 == len_c:
            diff_c = float('inf')
        else:
            diff_c = c[0] - c[ic+1]

        if diff_a <= diff_b and diff_a <= diff_c:
            ia += 1
        elif diff_b <= diff_a and diff_b <= diff_c:
            ib += 1
        elif diff_c <= diff_a and diff_c <= diff_b:
            ib += 1

    a = a[:ia+1]
    b = b[:ib+1]
    c = c[:ic+1]

    ans = []
    for ai in a:
        for bi in b:
            for ci in c:
                ans.append(ai + bi + ci)
    ans.sort(reverse=True)
    for i in range(k):
        print(ans[i])