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

Fixed submission:
from functools import reduce

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

left = 0
right = 2
p = a[0]
q = a[1]
r = a[2]
s = reduce(lambda x, y: x + y, a[3:])
temp = right + 1
res_right = abs(s - r)
x = r
y = s
while temp < n - 1:
    x += a[temp]
    y -= a[temp]
    if abs(x - y) < res_right:
        right = temp
        r = x
        s = y
        res_right = abs(x - y)
    if x >= y:
        break
    temp += 1
result = max(p,q,r,s) - min(p,q,r,s)

for i in range(2, n - 2):
    q += a[i]
    r -= a[i]
    if i == right:
        right += 1
        r += a[i + 1]
        s -= a[i + 1]
    res_left = abs(p - q)
    res_right = abs(r - s)
    temp = left + 1
    x = p
    y = q
    while temp < i:
        x += a[temp]
        y -= a[temp]
        if abs(x - y) < res_left:
            left = temp
            p = x
            q = y
            res_left = abs(x - y)
        if x >= y:
            break
        temp += 1
    temp = right + 1
    x = r
    y = s
    while temp < n - 1:
        x += a[temp]
        y -= a[temp]
        if abs(x - y) < res_right:
            right = temp
            r = x
            s = y
            res_right = abs(x - y)
        if x >= y:
            break
        temp += 1
    temp_res = max(p, q, r, s) - min(p, q, r, s)
    if temp_res < result:
        result = temp_res

print(result)

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

left = 0
right = 2
p = a[0]
q = a[1]
res_left = abs(p - q)
r = a[2]
s: int = sum(a[3:])
res_right = abs(r - s)
result = max(p,q,r,s) - min(p,q,r,s)

for i in range(2, n - 2):
    q += a[i]
    r -= a[i]
    if i == right:
        right += 1
        r += a[i + 1]
        s -= a[i + 1]
    res_left = abs(p - q)
    res_right = abs(r - s)
    temp = left + 1
    x = p
    y = q
    while temp < i:
        x += a[temp]
        y -= a[temp]
        if abs(x - y) < res_left:
            left = temp
            p = x
            q = y
            res_left = abs(x - y)
        if x >= y:
            break
        temp += 1
    temp = right + 1
    x = r
    y = s
    while temp < n - 1:
        x += a[temp]
        y -= a[temp]
        if abs(x - y) < res_right:
            right = temp
            r = x
            s = y
            res_right = abs(x - y)
        if x >= y:
            break
        temp += 1
    temp_res = max(p, q, r, s) - min(p, q, r, s)
    if temp_res < result:
        result = temp_res

print(result)
Problem p03369 (python)

Fixed submission:
s = list(input())

print(700 + s.count('o') * 100)

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

x = [0 for _ in range(n + 2)]
v = [0 for _ in range(n + 1)]
for i in range(n):
    x[i + 1], v[i + 1] = map(int, input().split())

x[n + 1] = c

left = [0 for _ in range(n + 1)]
right = [0 for _ in range(n + 1)]
left_rev = [0 for _ in range(n + 1)]
right_rev = [0 for _ in range(n + 1)]

for i in range(1, n + 1):
    left[i] = left[i - 1] + v[i] - (x[i] - x[i - 1])
    left_rev[i] = left[i] - x[i]
    right[i] = right[i - 1] + v[n - i + 1] - (x[n - i + 2] - x[n - i + 1])
    right_rev[i] = right[i] - (c - x[n - i + 1])

result = 0
for i in range(1, n + 1):
    temp = max( (left[i] + max(right_rev[:n - i + 1])) , (right[i] + max(left_rev[:n - i + 1])) )
    if temp > result:
        result = temp

print(result)
Problem p03407 (python)

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

if a + b >= c:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
from bisect import bisect_left

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

k = 1
ans = 0
for _ in range(32):
    t = k * 2
    temp_b = sorted([x % t for x in b])
    check = 0
    for temp_a in a:
        x = temp_a % t
        check += bisect_left(temp_b, 2 * k - x) - bisect_left(temp_b, k - x) + bisect_left(temp_b, 4 * k - x) - bisect_left(temp_b, 3 * k - x)
    ans += k * (check % 2)
    k = t

print(ans)
Problem p03415 (python)

Fixed submission:
a = list(input())
b = list(input())
c = list(input())

print(a[0] + b[1] + c[2])

Buggy submission (verdict: Runtime Error):
a = list(input())
b = list(input())
c = list(input())

print(a[0] + b[1] + c[2]
Problem p03447 (python)

Fixed submission:
x = int(input())
a = int(input())
b = int(input())

x -= a

print(x % b)

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

MAX = 999999

p = [[] for _ in range(n)]
for i in range(m):
    l, r, d = map(int, input().split())
    lrd.append([l-1, r-1, d, 0])
    p[l-1].append(i)
    p[r-1].append(i)

if m <= 1:
    print('Yes')
    exit()

a = [MAX for _ in range(n)]

a[lrd[0][0]] = 0
temp = [lrd[0][0]]
next = []
t = 0
s = 0
max_a = 0
min_a = 0
while 1:
    next = []
    for x in temp:
        for y in p[x]:
            if lrd[y][0] == x:
                t = lrd[y][1]
                s = a[x] + lrd[y][2]
            else:
                t = lrd[y][0]
                s = a[x] - lrd[y][2]

            lrd[y][3] = 1
            if a[t] == MAX:
                a[t] = s
                next.append(t)
            elif a[t] != s:
                print('No')
                exit()

    if len(next) == 0:
        target = 0
        i = 0
        check = 0
        for i in range(m):
            if lrd[i][3] == 0:
                target = lrd[i][0]
                check = 1
        if check == 0:
            break
        a[target] = 0
        next = [target]

    temp = [] + list(set(next))

print('Yes')
Problem p03573 (python)

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

a = sorted(a)

if a[0] == a[1]:
    print(a[2])
else:
    print(a[0])

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

x = [0 for _ in range(n)]
y = [0 for _ in range(n)]
for i in range(n):
    x[i], y[i] = map(int, input().split())

min_x = min(x)
min_y = min(y)
for i in range(n):
    x[i] -= min_x
    y[i] -= min_y

sx = sorted(x)
sy = sorted(y)

if n == k:
    print(sx[n - 1] * sy[n - 1])
    exit()

d = [[0 for _ in range(n + 1)] for _ in range(n + 1)]
for i in range(n):
    d[sx.index(x[i]) + 1][sy.index(y[i]) + 1] = 1

#for p in d: print(p)

for i in range(n + 1):
    for j in range(1, n + 1):
        d[i][j] += d[i][j - 1]

for i in range(n + 1):
    for j in range(1, n + 1):
        d[j][i] += d[j - 1][i]

sx = [0] + sx
sy = [0] + sy

a = 0
b = 1
ans = sx[n] * sy[n]
temp = 0
for p in range(n):
    for q in range(p + 1, n + 1):
        for a in range(n):
            for b in range(a + 1, n + 1):
                temp = d[q][b] - d[q][a] - d[p][b] + d[p][a]
                if temp >= k:
                    break
            if temp >= k:
                ans = min(ans, max(1, (sx[b] - sx[a + 1])) * max(1, (sy[q] - sy[p + 1])))

print(ans)
Problem p03611 (python)

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

d = {}
for x in a:
    if x in d:
        d[x] += 1
    else:
        d[x] = 1

d = sorted(d.items())

m = len(d)

if m == 1:
    print(d[0][1])
    exit()
elif m == 2:
    if d[1][0] - d[0][0] <= 2:
        print(d[0][1] + d[1][1])
    else:
        print(max(d[0][1], d[1][1]))
    exit()

ans = d[0][1]
if d[1][0] == d[0][0] + 1:
    ans += d[1][1]
r = d[m-1][1]
if d[m-2][0] == d[m-1][0] - 1:
    r += d[m-2][1]
ans = max(r, ans)

for i in range(1, m-1):
    r = d[i][1]
    if d[i-1][0] + 1 == d[i][0]:
        r += d[i-1][1]
    if d[i+1][0] - 1 == d[i][0]:
        r += d[i+1][1]
    ans = max(ans, r)


print(ans)

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

if n == 1:
    print(1)
    exit()
elif n == 2:
    if abs(a[0] - a[1]) <= 2:
        print(2)
    else:
        print(1)
    exit()

d = {}
for x in a:
    if x in d:
        d[x] += 1
    else:
        d[x] = 1

d = sorted(d.items())

m = len(d)
ans = d[0][1]
if d[1][0] == d[0][0] + 1:
    ans += d[1][1]
r = d[m-1][1]
if d[m-2][0] == d[m-1][0] - 1:
    r += d[m-2][1]
ans = max(r, ans)

for i in range(1, m-1):
    r = d[i][1]
    if d[i-1][0] + 1 == d[i][0]:
        r += d[i-1][1]
    if d[i+1][0] - 1 == d[i][0]:
        r += d[i+1][1]
    ans = max(ans, r)


print(ans)
Problem p03623 (python)

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

if abs(x-a) > abs(x-b):
    print('B')
else:
    print('A')

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

if min(abs(x-a) > abs(x-b)):
    print('B')
else:
    print('A')
Problem p03638 (python)

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

h = 0
w = 0

ans = [[0 for _ in range(W)] for _ in range(H)]
for i in range(n):
    for j in range(a[i]):
        ans[h][w] = i + 1
        if h % 2 == 0:
            if w == W - 1:
                h += 1
            else:
                w += 1
        else:
            if w == 0:
                h += 1
            else:
                w -= 1

for p in ans: print(' '.join(map(str, p)))

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

f = 0
d = 0
for x in a:
    if x % 4 == 0:
        f += 1
    elif x % 2 == 0:
        d += 1

if 0 < d < n:
    d -= 1

if n > f * 2 + 1 + d:
    print('No')
else:
    print('Yes')
Problem p03660 (python)

Fixed submission:
n = int(input())

p = [[] for _ in range(n)]
for i in range(n - 1):
    x, y = map(int, input().split())
    p[x - 1].append(y - 1)
    p[y - 1].append(x - 1)

f = [n for _ in range(n)]
s = [n for _ in range(n)]

f[0] = 0
after = [] + p[0]
before = set()
dist = 0
while 1:
    dist += 1
    check = 0
    temp = []
    for x in after:
        if f[x] == n:
            f[x] = dist
            temp += p[x]
            check = 1
    if check == 0:
        break
    t2 = set(temp) - before
    before = set(after)
    after = list(t2)

s[n - 1] = 0
after = [] + p[n - 1]
before = set()
dist = 0
while 1:
    dist += 1
    check = 0
    temp = []
    for x in after:
        if s[x] == n:
            s[x] = dist
            temp += p[x]
            check = 1
    if check == 0:
        break
    t2 = set(temp) - before
    before = set(after)
    after = list(t2)

score_f = 0
for i in range(n):
    if f[i] <= s[i]:
        score_f += 1

if score_f > n - score_f:
    print('Fennec')
else:
    print('Snuke')

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

p = [ [] for _ in range(n) ]
for i in range(n - 1):
    a, b = map(int, input().split())
    p[a - 1].append(b - 1)
    p[b - 1].append(a - 1)

f = [[0], []]
f[1] = [] + p[0]
if n - 1 in f[1]:
    f[1].remove(n - 1)
    if len(f[1]) == 0:
        print("Snuke")
    else:
        print("Fennec")
    exit()

s = [[n - 1], []]
s[1] = [] + p[n - 1]

d = 1
check = 0
check_f = 0
check_s = 0

while 1:
    if check_f == 0:
        temp_f = []
        for i in f[d]:
            temp_f = temp_f + p[i]
        temp_f = list(set(temp_f))
        if n - 1 in temp_f:
            temp_f.remove(n - 1)
        for i in f[d - 1]:
            if i in temp_f:
                temp_f.remove(i)
        if len(temp_f) > 0:
            f.append([])
            f[d + 1] = [] + temp_f
        else:
            check_f = 1
    else:
        if check_s != 0:
            break

    if check_s == 0:
        temp_s = []
        for i in s[d]:
            temp_s = temp_s + p[i]
        temp_s = list(set(temp_s))
        if 0 in temp_s:
            temp_s.remove(0)
        for i in s[d - 1]:
            if i in temp_s:
                temp_s.remove(i)
        if len(temp_s) > 0:
            s.append([])
            s[d + 1] = [] + temp_s
        else:
            check_s = 1

    if check == 0:
        for i in temp_f:
            if i in temp_s:
                temp_s.remove[i]
                check = 1

    d += 1

fe = sum(len(v) for v in f)

sn = sum(len(v) for v in s)

if fe > sn:
    print("Fennec")
else:
    print("Snuke")
Problem p03671 (python)

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

print(a + b + c - max(a, b, c))

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

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

MOD = 10 ** 9 + 7

b = sorted(a)

for i in range(n):
    if b[i] == b[i + 1]:
        d = b[i]
        break

p = []
for i in range(n):
    if a[i] == d:
        p.append(i)

w = p[0] + n - p[1]

c = [0 for _ in range(n + 2)]

temp = 1
for i in range(1, n + 2):
    temp *= i
    c[i] = temp

def cmb(x, y):
    if y < 0 or y > x:
        return 0
    elif x == y:
        return 1
    else:
        return c[x] // c[y] // c[x - y] % MOD


print(n)
for k in range(2, n + 2):
    ans = cmb(n + 1, k) - cmb(w, k - 1)
    print(ans % MOD)
Problem p03795 (python)

Fixed submission:
n = int(input())

x = n * 800
y = (n // 15) * 200

print(x - y)

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

if m // 2 <= n:
    print(m // 2)
else:
    m -= n * 2
    print(n + m // 4)
Problem p03837 (python)

Fixed submission:
import heapq

n, m = map(int, input().split())
abc = [tuple(int(x) - 1 for x in input().split()) for _ in range(m)]

dist = [[9999999 for _ in range(n)] for _ in range(n)]

e = [dict() for _ in range(n)]

for i in range(m):
    a, b, c = abc[i][0], abc[i][1], abc[i][2]
    e[a][b] = c + 1
    e[b][a] = c + 1

for i in range(n):
    h = []
    heapq.heappush(h, [0, i])
    temp = set()
    #temp.add(i)
    while len(temp) < n:
        d, p = heapq.heappop(h)
        while p in temp:
            d, p = heapq.heappop(h)
        dist[i][p] = d
        temp.add(p)
        for x in e[p].keys():
            heapq.heappush(h, [d + e[p][x], x])

#for i in range(n): print(dist[i])

ans = m
for a, b, c in abc:
    for i in range(n):
        if c + 1 == dist[a][i] - dist[b][i]:
            ans -= 1
            break
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10000)

n, m = map(int, input().split())
abc = [tuple(int(x) - 1 for x in input().split()) for _ in range(m)]

#res = [[9999999 for _ in range(n)] for _ in range(n)]

e = [dict() for _ in range(n)]

for i in range(m):
    a, b, c = abc[i][0], abc[i][1], abc[i][2]
    e[a][b] = [c, i]
    e[b][a] = [c, i]

ans = set()

for i in range(n-1):
    for j in range(i + 1, n):
        temp = [[0, i]]
        res = []
        for k in range(n):
            next = []
            for x in temp:
                if x[1] == j:
                    res.append(x)
                    continue
                for z in e[x[1]].keys():
                    if len(x) == 2:
                        next.append([ x[0] + e[x[1]][z][0], z ] + [ e[x[1]][z][1] ])
                    else:
                        next.append([ x[0] + e[x[1]][z][0], z ] + x[2:] + [ e[x[1]][z][1] ])
            temp = [] + next
        mr = 99999999
        p = 0
        for i in range(len(res)):
            if res[i][0] < mr:
                mr = res[i][0]
                p = i
        #print(set(res[p][2:]))
        ans = ans | set(res[p][2:])

print(m - len(ans))
Problem p04047 (python)

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

a.sort()

ans = 0
for i in range(n):
    ans += a[i*2]

print(ans)

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

a.sort()

ans = 0
for i in range(n):
    ans += a[i*2]

print(ans)
Problem p02803 (python)

Fixed submission:

def get_next_str():
    return input().rstrip("\n")
def get_next_ints(delim=" "):
    return tuple([int(float(x)) for x in input().split(delim)])
def solve(maze, start_r, start_c):
    
    distances = {}
    offsets = [(-1,0),(1,0),(0,-1),(0,1)]
    
    distances[start_r, start_c] = 0
    candidates = [(start_r, start_c)]
    
    while candidates:
        r, c= candidates.pop(0)
        
        for offset_r, offset_c in offsets:
            move_r, move_c = r + offset_r, c + offset_c
            if not (move_r, move_c) in distances and maze[move_r, move_c] == ".":
                distances[move_r, move_c] = distances[r, c] + 1
                candidates.append((move_r, move_c))
    
    return max(distances.values())
    

def main():
    h, w = get_next_ints()
    from collections import defaultdict
    maze = defaultdict(str)
    for r in range(h):
        line = get_next_str()
        for c in range(w):
            maze[r,c] = line[c]
    
    results = []
    for r in range(h):
        for c in range(w):
            if maze[r,c] != "#":
                result = solve(maze, r, c)
                results.append(result)
    
    print(max(results))
    
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
buffer = ""

def set_buffer(text):
    global buffer
    import io
    buffer = io.StringIO(text)
    
def get_next_ints(delim=" "):
    return tuple([int(float(x)) for x in input().split(delim)])
def solve(maze, start_r, start_c):
    
    distances = {}
    offsets = [(-1,0),(1,0),(0,-1),(0,1)]
    
    distances[start_r, start_c] = 0
    candidates = [(start_r, start_c)]
    
    while candidates:
        r, c= candidates.pop(0)
        
        for offset_r, offset_c in offsets:
            move_r, move_c = r + offset_r, c + offset_c
            if not (move_r, move_c) in distances and maze[move_r, move_c] == ".":
                distances[move_r, move_c] = distances[r, c] + 1
                candidates.append((move_r, move_c))
    
    return max(distances.values())
    

def main(input_text=""):
    if input_text:
        set_buffer(input_text)
    h, w = get_next_ints()
    from collections import defaultdict
    maze = defaultdict(str)
    for r in range(h):
        line = get_next_str()
        for c in range(w):
            maze[r,c] = line[c]
    
    results = []
    for r in range(h):
        for c in range(w):
            result = solve(maze, r, c)
            results.append(result)
    
    print(max(results))
    
if __name__ == '__main__':
    main()
if __name__ == '__jupyter__':
    import doctest
    print(doctest.testmod())
Problem p02813 (python)

Fixed submission:
def get_order(numbers, originals):
    
    from math import factorial
    from copy import copy
    numbers = copy(numbers)
    originals = copy(originals)
    
    total = 0
    while numbers:
        number = numbers.pop(0)
        number_index = originals.index(number)
        originals.pop(number_index)
        count = (number_index ) * factorial(len(originals))
        total += count
    return total
        
def get_next_int():
    return int(float(input()))
def get_next_ints(delim=" "):
    return tuple([int(float(x)) for x in input().split(delim)])

def main(print=__builtins__.print):
    n = get_next_int()
    
    a = list(get_next_ints())
    b = list(get_next_ints())
    originals = list(map(int, range(1, n+1)))
    print(abs(get_order(a, originals) - get_order(b, originals)))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def get_order(numbers, originals):
    
    from math import factorial
    from copy import copy
    numbers = copy(numbers)
    originals = copy(originals)
    
    total = 0
    while numbers:
        number = numbers.pop(0)
        number_index = originals.index(number)
        originals.pop(number_index)
        count = (number_index ) * factorial(len(originals))
        total += count
    return total
        
def get_next_int():
    return int(float(input()))
def get_next_ints(delim=" "):
    return tuple([int(float(x)) for x in input().split(delim)])

def main(print=__builtins__.print):
    n = get_next_int()
    
    a = get_next_ints()
    b = get_next_ints()
    originals = list(map(int, range(n)))
    print(get_order(a, originals) - get_order(b, originals))

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

Fixed submission:
a, b = [int(x) for x in input().rstrip().split(" ")]
if a >= 13:
  print(b)
elif a < 6:
  print(0)
else:
  print(b // 2)

Buggy submission (verdict: Runtime Error):
a, b = [int(x) for x in input().rstrip().split(" ")]
if a >= 13:
  print(b)
elsif a < 6:
  print(0)
else:
  print(b // 2)
Problem p03050 (python)

Fixed submission:
from math import sqrt
def main():
    n = int(input().rstrip())
    sqrt_n = int(sqrt(n))

    total = 0
    for number in range(1,sqrt_n + 1):
        if n % number > 0:
            continue
        remain = n - number
        x, y = divmod(remain, number)
        #print(x, y, remain, number)
        if y == 0 and x > number:
            #print("○",number)
            total += x
        #elif y == 0:
        #    print("×",number)

    print(total)

if __name__ == "__main__":
  main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input().rstrip())
    sqrt_n = int(sqrt(n))

    total = 0
    for number in range(1,sqrt_n + 1):
        if n % number > 0:
            continue
        remain = n - number
        x, y = divmod(remain, number)
        #print(x, y, remain, number)
        if y == 0 and x > number:
            #print("○",number)
            total += x
        #elif y == 0:
        #    print("×",number)

    print(total)

if __name__ == "__main__":
  main()

Buggy submission (verdict: Runtime Error):
from copy import copy
def main():
    n = int(input().rstrip())
    sqrt_n = int(sqrt(n))
    primes = get_primes(sqrt_n)
    
    candidates = [1]
    for prime in primes:
        count = 0
        remain = n
        while remain % prime == 0:
            count += 1
            remain = remain // prime
        if count > 0:
        
            next_candidates = copy(candidates)
            for candidate in candidates:
                temp_candidate = candidate
                for i in range(count):
                    temp_candidate *= prime
                    #if temp_candidate > sqrt_n:
                    #    break
                    next_candidates.append(temp_candidate)
            candidates = next_candidates
    
    total = 0
    for number in candidates:

        remain = n - number
        x, y = divmod(remain, number)
        #print(x, y, remain, number)
        if y == 0 and x > number:
            #print("○",number)
            total += x
        #elif y == 0:
        #    print("×",number)

    print(total)

if __name__ == "__main__":
  main()
Problem p03059 (python)

Fixed submission:

def get_next_ints(delim=" "):
    return tuple([int(float(x)) for x in input().split(delim)])

def main():
    a, b, t = get_next_ints()
    
    n = t // a
    print(n * b)
    
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    a, b, t = get_next_ints()
    
    n = t // a
    print(n * b)
    
if __name__ == '__main__':
    main()
Problem p03060 (python)

Fixed submission:
def get_next_int():
    return int(float(input()))
def get_next_ints(delim=" "):
    return tuple([int(float(x)) for x in input().split(delim)])

def main():
    n = get_next_int()
    values = get_next_ints()
    costs = get_next_ints()
    
    total = 0
    for value, cost in zip(values, costs):
        if value > cost:
            total += (value - cost)
    
    print(total)
    
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n = get_next_int()
    values = get_next_ints()
    costs = get_next_ints()
    
    total = 0
    for value, cost in zip(values, costs):
        if value > cost:
            total += (value - cost)
    
    print(total)
    
if __name__ == '__main__':
    main()
Problem p03125 (python)

Fixed submission:
a, b = [int(x) for x in input().rstrip("\n").split(" ")]
 
if b % a == 0:
  print(b + a)
else:
  print(b - a)

Buggy submission (verdict: Runtime Error):
a, b = [int(x) for x in input().rstrip("\n").split(" ")]
 
if b % a == 0:
  print(b + a)
else:
  print(b -ab)