Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import math
a, b, x = map(int, input().split())
h = x / (a * a)
if x < a*a*b / 2:
    print(90-math.degrees(math.atan(2*x/(a*b*b))))
else:
    if x == a*a*b:
        print(0)
    print(90-math.degrees(math.atan(a/(2*(b-x/(a*a))))))




Fixed submission:
import math
a, b, x = map(int, input().split())
h = x / (a * a)
if x < a*a*b / 2:
    print(90-math.degrees(math.atan(2*x/(a*b*b))))
else:
    print(math.degrees(math.atan((2*(b-x/(a*a)))/a)))

Buggy python submission (verdict: Runtime Error):
import math
a, b, x = map(int, input().split())
h = x / (a * a)
if x < a*a*b / 2:
    print(90-math.degrees(math.atan(2*x/(a*b*b))))
else:
    print(90-math.degrees(math.atan(a/(2*(b-x/(a*a))))))




Fixed submission:
import math
a, b, x = map(int, input().split())
h = x / (a * a)
if x < a*a*b / 2:
    print(90-math.degrees(math.atan(2*x/(a*b*b))))
else:
    print(math.degrees(math.atan((2*(b-x/(a*a)))/a)))

Buggy python submission (verdict: Runtime Error):
import math
a, b, x = map(int, input().split())
h = x / (a * a)
if x < b / 2:
    print(90-math.degrees(math.atan(2*x/(a*b*b))))
else:
    print(90-math.degrees(math.atan(a/(2*(b-x/(a*a))))))




Fixed submission:
import math
a, b, x = map(int, input().split())
h = x / (a * a)
if x < a*a*b / 2:
    print(90-math.degrees(math.atan(2*x/(a*b*b))))
else:
    print(math.degrees(math.atan((2*(b-x/(a*a)))/a)))

Buggy python submission (verdict: Runtime Error):
from math import atan,degrees
a, b, x = map(int, input().split())
h = x / (a * a)
if x < b / 2:
    print(90-degrees(atan(2*x/(a*b*b))))
else:
    print(90-degrees(atan(a/(2*(b-x/(a*a))))))




Fixed submission:
import math
a, b, x = map(int, input().split())
h = x / (a * a)
if x < a*a*b / 2:
    print(90-math.degrees(math.atan(2*x/(a*b*b))))
else:
    print(math.degrees(math.atan((2*(b-x/(a*a)))/a)))
Buggy python submission (verdict: Time Limit Exceeded):
from sys import setrecursionlimit as SRL, stdin

SRL(10 ** 7)
rd = stdin.readline
rrd = lambda: map(int, rd().strip().split())

n, m, l = rrd()
dis = [[10 ** 10] * 305 for _i in range(305)]
need = [[10 ** 10] * 305 for _i in range(305)]
for i in range(n):
    dis[i][i] = 0
for i in range(m):
    a, b, c = rrd()
    dis[a][b] = c
    dis[b][a] = c

for k in range(1, n + 1):
    for i in range(1, n + 1):
        for j in range(1, n + 1):
            if k in [i, j] or i in [k, j] or j in [i, k]:
                continue
            dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j])

for i in range(1, n + 1):
    for j in range(1, n + 1):
        if i == j:
            need[i][j] = 0
        elif dis[i][j] <= l:
            need[i][j] = 1

for k in range(1, n + 1):
    for i in range(1, n + 1):
        for j in range(1, n + 1):
            if k in [i, j] or i in [k, j] or j in [i, k]:
                continue
            need[i][j] = min(need[i][j], need[i][k] + need[k][j])
q = int(input())

while q:
    s, t = rrd()
    if need[s][t] < 10 ** 10:
        print(need[s][t]-1)
    else:
        print(-1)
    q -= 1










Fixed submission:
from sys import setrecursionlimit as SRL, stdin
inf = 10**15
SRL(10 ** 7)
rd = stdin.readline
rrd = lambda: map(int, rd().strip().split())

n, m, l = rrd()
dis = [[inf] * 305 for _i in range(305)]
need = [[inf] * 305 for _i in range(305)]
for i in range(n):
    dis[i][i] = 0
for i in range(m):
    a, b, c = rrd()
    dis[a][b] = c
    dis[b][a] = c

for k in range(1, n + 1):
    for i in range(1, n + 1):
        for j in range(1, n + 1):
            dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j])

for i in range(1, n + 1):
    for j in range(1, n + 1):
        if i == j:
            need[i][j] = 0
        elif dis[i][j] <= l:
            need[i][j] = 1

for k in range(1, n + 1):
    for i in range(1, n + 1):
        for j in range(1, n + 1):
            need[i][j] = min(need[i][j], need[i][k] + need[k][j])
q = int(input())

while q:
    s, t = rrd()
    if need[s][t] < inf:
        print(need[s][t]-1)
    else:
        print(-1)
    q -= 1
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = input()
inva = ''.join(map(lambda x: str(int(x) ^ 1), a))

mod = 998244353
ans = 0
p = 1
num = [0] * -~n
for i in range(n):
    if i:
        num[i] += (num[i - 1] * 2) % mod
    if a[i] == '1':
        num[i] += 1


def get_div(x):
    y = []
    for i in range(1, n):
        if x % i == 0 and (x // i) % 2:
            y.append(i)
    return y


div = get_div(n)
d = [0] * -~n
tot = 0
for i in div:
    now = n // i
    tt = num[i - 1]
    for j in get_div(i):
        tt -= d[j]
    k = (a[:i] + inva[:i]) * (n // (2 * i)) + a[:i]
    d[i] = tt + (int(a, 2) >= int(k, 2))
    tot += d[i]
d[n] = int(a, 2) + 1 - tot

for i in range(n + 1):
    ans = (ans + d[i] * i * 2) % mod

print(ans % mod)


Fixed submission:
n = int(input())
a = input()
inva = ''.join(map(lambda x: str(int(x) ^ 1), a))

mod = 998244353
ans = 0
p = 1
num = [0] * -~n
for i in range(n):
    if i:
        num[i] += (num[i - 1] * 2) % mod
    if a[i] == '1':
        num[i] += 1


def get_div(x):
    y = []
    for i in range(1, n):
        if x % i == 0 and (x // i) % 2:
            y.append(i)
    return y


div = get_div(n)
d = [0] * -~n
tot = 0
for i in div:
    now = n // i
    tt = num[i - 1]
    for j in get_div(i):
        tt -= d[j]
    k = (a[:i] + inva[:i]) * (n // (2 * i)) + a[:i]
    d[i] = tt + (a >= k)
    tot += d[i]
d[n] = int(a, 2) + 1 - tot

for i in range(n + 1):
    ans = (ans + d[i] * i * 2) % mod

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

gcd = math.gcd(a, b)
i, cnt = 2, 1
while i * i <= gcd:
    flag = 0
    while gcd % i == 0:
        flag = 1
        gcd //= i
    if flag:
        cnt += 1
    i += 1
if gcd != 1:
    cnt += 1
print(cnt)


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


def _gcd(x, y):
    if y == 0:
        return x
    return _gcd(y, x % y)


gcd = _gcd(a, b)
i, cnt = 2, 1
while i * i <= gcd:
    flag = 0
    while gcd % i == 0:
        flag = 1
        gcd //= i
    if flag:
        cnt += 1
    i += 1
if gcd != 1:
    cnt += 1
print(cnt)

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

gcd = math.gcd(a, b)
i, cnt = 2, 1
while i * i <= gcd:
    flag = 0
    while gcd % i == 0:
        flag = 1
        gcd //= i
    if flag:
        cnt += 1
    i += 1
if gcd != 1:
    cnt += 1
print(cnt)


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


def _gcd(x, y):
    if y == 0:
        return x
    return _gcd(y, x % y)


gcd = _gcd(a, b)
i, cnt = 2, 1
while i * i <= gcd:
    flag = 0
    while gcd % i == 0:
        flag = 1
        gcd //= i
    if flag:
        cnt += 1
    i += 1
if gcd != 1:
    cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
from sys import setrecursionlimit as SRL, stdin

SRL(10 ** 7)
rd = stdin.readline
rrd = lambda: map(int, rd().strip().split())
n, m = rrd()

e = [[] for _i in range(1 << 13)]

p = []
for i in range(m):
    a, b = rrd()
    lst = list(rrd())
    g = 0
    for j in lst:
        g |= 1 << (j - 1)
    p.append((a, g))

for i in range(1 << n):
    for j in p:
        e[i].append((i | j[1], j[0]))
from math import inf

dis = [inf] * (1 << 13)
vis = [0] * (1 << 13)
dis[0] = 0

from heapq import *

q = [(0, 0)]
while len(q):
    ds, now = heappop(q)
    if vis[now]:
        continue
    vis[now] = 1
    for next, cost in e[now]:
        if dis[next] > dis[now] + cost:
            dis[next] = dis[now] + cost
            heappush(q, (dis[next], next))

if dis[(1 << n) - 1] == inf:
    print(-1)
else:
    print(dis[(1 << n) - 1])


Fixed submission:
from sys import setrecursionlimit as SRL, stdin

SRL(10 ** 7)
rd = stdin.readline
rrd = lambda: map(int, rd().strip().split())
n, m = rrd()

e = [[] for _i in range(1 << 13)]

p = []
for i in range(m):
    a, b = rrd()
    lst = list(rrd())
    g = 0
    for j in lst:
        g |= 1 << (j - 1)
    p.append((a, g))

for i in range(1 << n):
    for j in p:
        e[i].append((i | j[1], j[0]))
inf = 10**10

dis = [inf] * (1 << 13)
vis = [0] * (1 << 13)
dis[0] = 0

from heapq import *

q = [(0, 0)]
while len(q):
    ds, now = heappop(q)
    if vis[now]:
        continue
    vis[now] = 1
    for next, cost in e[now]:
        if dis[next] > dis[now] + cost:
            dis[next] = dis[now] + cost
            heappush(q, (dis[next], next))

if dis[(1 << n) - 1] == inf:
    print(-1)
else:
    print(dis[(1 << n) - 1])
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())

g = [[] for _ in range(1005)]

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

vis = [0] * 1005


def dfs(x, p):
    if vis[x]:
        return []
    p.append(x)
    vis[x] = 1
    for v in g[x]:
        if v in p:
            return p
        t = dfs(v, p)
        if len(t):
            return t
    p.pop()
    return []


tmp = 0
ans = 10 ** 10
tmpp = []
p = []
vs = [0] * 1005


def dfs2(x):
    global ans, p, tmp, tmpp
    if len(p) >= ans:
        return
    p.append(x)
    for v in g[x]:
        if v == tmp:
            ans = len(p)
            tmpp = p[:]
            continue
        if not vs[v]:
            vs[v] = 1
            dfs2(v)
            vs[v] = 0
    p.pop()


a = []
for i in range(1, 1 + n):
    tmp = i
    p = []
    dfs2(i)
    if len(tmpp) == ans:
        a = tmpp[:]

if not len(a):
    print(-1)
    exit(0)

print(len(a))
for i in a:
    print(i)

#
# pre = t[0]
# next = [0] * 1005
# for i in range(1, len(t)):
#     now = t[i]
#     next[pre] = now
#     pre = now
# next[t[-1]] = t[0]
# s = set()
# for i in t:
#     s.add(i)
#
# cnt = 0
# now = t[0]
# while cnt < len(s):
#     cnt += 1
#     for i in g[now]:
#         if i == next[now]:
#             continue
#         if i in s:
#             cnt = 0
#             k = next[now]
#             while k != i:
#                 s.remove(k)
#                 k = next[k]
#             next[now] = i
#     now = next[now]
#
# print(len(s))
# for i in s:
#     print(i)


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

g = [[] for _ in range(1005)]

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

vis = [0] * 1005


def dfs(x, p):
    if vis[x]:
        return []
    p.append(x)
    vis[x] = 1
    for v in g[x]:
        if v in p:
            return p
        t = dfs(v, p)
        if len(t):
            return t
    p.pop()
    return []


t = []
for i in range(1, 1 + n):
    t = dfs(i, [])
    if len(t):
        print(0)
        exit(0)

print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding:utf-8 -*-
n = int(input())
a = [int(i) for i in input().split()]
dp = [[x, 0] for x in range(0, len(a))]


def ins(x, i):
    if x in dp[i]:
        return
    if dp[i][0] != x and a[dp[i][0]] < a[x]:
        dp[i][1] = dp[i][0]
        dp[i][0] = x
    elif dp[i][1] != x and a[dp[i][1]] < a[x]:
        dp[i][1] = x


def mix(i, j):
    ins(dp[i][0], j)
    ins(dp[i][1], j)


for i in range(0, len(a)):
    for j in range(0, n):
        if i & (1 << j) == 0:
            mix(i, i | (1 << j))


ans = 0
for i in range(1, len(a)):
    u = a[dp[i][0]]+a[dp[i][1]]
    ans = max(ans, u)
    print(ans)


Fixed submission:
# -*- coding:utf-8 -*-
n = int(input())
a = [int(i) for i in input().split()]
dp = [[x, 0] for x in range(0, len(a))]
 
 
def ins(x, i):
    if x in dp[i]:
        return
    if dp[i][0] != x and a[dp[i][0]] < a[x]:
        dp[i][1] = dp[i][0]
        dp[i][0] = x
    elif dp[i][1] != x and a[dp[i][1]] < a[x]:
        dp[i][1] = x
 
 
def mix(i, j):
    ins(dp[i][0], j)
    ins(dp[i][1], j)
 
 
for i in range(0, len(a)):
    for j in range(0, n):
        if i & (1 << j) == 0:
            mix(i, i | (1 << j))
 
 
ans = 0
for i in range(1, len(a)):
    u = a[dp[i][0]]+a[dp[i][1]]
    ans = max(ans, u)
    print(ans)
Buggy python submission (verdict: Runtime Error):
from sys import exit, stderr, stdin, setrecursionlimit
input = stdin.readline
# setrecursionlimit(10**7)

def debug(var, name="hoge"):
    print(name +":" + str(type(var)) + " = " + repr(var), file=stderr)
    return



def main():
    # まず可能かどうか
    S = str(input().rstrip())*2
    T = str(input().rstrip())
    LS = len(S)//2
    LT = len(T)
    S *= 3
    # はじめて出る位置
    char_p = dict()
    for i in range(LS):
        if not S[i] in char_p:
            char_p[S[i]] = i
    print(char_p)

    # char_pの文字が２つめのはじめて出る位置までに
    char_d = dict(zip(char_p.keys(),[[0 for __ in range(LS+char_p[c])] for c in char_p]))
    for c in char_p:
        dis = 1
        for i in range(LS+char_p[c]-1,-1,-1):
            if S[i] == c:
                char_d[c][i] = dis
                dis = 1
            else:
                char_d[c][i] = dis
                dis += 1
    # 答えの計算
    debug(char_d)
    cur = char_p[T[0]]
    for t in T[1:]:
        if t not in char_p:
            print(-1)
            exit()
        else:
            debug(t,'string')
            #それ以外なら区切りで相対的な位置を出して足す
            rel_cur = cur%LS
            debug(rel_cur,"relative_cursol")
            cur += char_d[t][rel_cur]
        debug(cur,"cur")
        # print()
    print(cur+1)






if __name__ == "__main__":
    main()


Fixed submission:
from sys import exit, stderr, stdin, setrecursionlimit
input = stdin.readline
# setrecursionlimit(10**7)

def debug(var, name="hoge"):
    print(name +":" + str(type(var)) + " = " + repr(var), file=stderr)
    return



def main():
    # まず可能かどうか
    S = str(input().rstrip())*2
    T = str(input().rstrip())
    LS = len(S)//2
    LT = len(T)
    S *= 3
    # はじめて出る位置
    char_p = dict()
    for i in range(LS):
        if not S[i] in char_p:
            char_p[S[i]] = i

    # char_pの文字が２つめのはじめて出る位置までに
    char_d = dict(zip(char_p.keys(),[[0 for __ in range(LS+char_p[c])] for c in char_p]))
    for c in char_p:
        dis = 1
        for i in range(LS+char_p[c]-1,-1,-1):
            if S[i] == c:
                char_d[c][i] = dis
                dis = 1
            else:
                char_d[c][i] = dis
                dis += 1
    # 答えの計算
    debug(char_d)
    init = True
    for t in T:
        if t not in char_p:
            print(-1)
            exit()
        else:
            debug(t,'string')
            if init:
                cur = char_p[t]
                init = False
            #それ以外なら区切りで相対的な位置を出して足す
            else:
                rel_cur = cur%LS
                debug(rel_cur,"relative_cursol")
                cur += char_d[t][rel_cur]
        debug(cur,"cur")
        # print()
    print(cur+1)






if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
from sys import exit, stderr, stdin
input = stdin.readline
# setrecursionlimit(10**7)

def debug(var, name="hoge"):
    print(str(type(var)) + name +":" + " = " + repr(var), file=stderr)
    return


def main():
    N, K = list(map(int,input().split()))
    K = bin(K)[2:].zfill(51)
    a = list(map(int,input().split()))
    for i in range(len(a)):
        a[i] = bin(a[i])[2:].zfill(51)
    # memo[決めた桁目(上位から)][K未満 == 1 not == 0] = そのときの最大値
    memo = [0 for __ in range(51)]
    LT = False
    for i in range(51):
        val = 0
        br = 0
        # 1と0の場合,ただしKのi桁目と超えたかにもよって0だけ
        for b in range(2 if LT or K[i] == '1' else 1):
            valtmp = 0
            for n in a:
                valtmp += b ^ int(n[i])
                debug(n[i],str(int(n,2)) + ' ' +str(i))
            if val < valtmp :
                br = b
                val = valtmp
        memo[i] = val
        debug(LT, 'Less than')
        debug(br, 'bin applied')
        LT = br < int(K[i]) or LT


    p = 1
    ans = 0
    for i in range(50,-1,-1):
        ans += p*memo[i]
        p *= 2
    print(ans)


if __name__ == "__main__":
    main()


Fixed submission:
from sys import exit, stderr, stdin
input = stdin.readline
# setrecursionlimit(10**7)

def debug(var, name="hoge"):
    print(str(type(var)) + name +":" + " = " + repr(var), file=stderr)
    return


def main():
    N, K = list(map(int,input().split()))
    K = bin(K)[2:].zfill(51)
    a = list(map(int,input().split()))
    for i in range(len(a)):
        a[i] = bin(a[i])[2:].zfill(51)
    # memo[決めた桁目(上位から)][K未満 == 1 not == 0] = そのときの最大値
    memo = [0 for __ in range(51)]
    LT = False
    for i in range(51):
        val = 0
        br = 0
        # 1と0の場合,ただしKのi桁目と超えたかにもよって0だけ
        for b in range(2 if LT or K[i] == '1' else 1):
            valtmp = 0
            for n in a:
                valtmp += b ^ int(n[i])
            if val < valtmp :
                br = b
                val = valtmp
        memo[i] = val
        LT = br < int(K[i]) or LT


    p = 1
    ans = 0
    for i in range(50,-1,-1):
        ans += p*memo[i]
        p *= 2
    print(ans)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
inp = lambda cast=int: list(map(cast, input().split()))
printf = lambda s='', *args, **kwargs: print(str(s).format(*args), flush=True, **kwargs)
n, = inp()
A = [0.0] + inp(float)
dp = [[0.0 for _ in range(n + 1)] for _ in range(n + 1)]
res = 0.0
for i in range(n + 1):
    for j in range(n + 1):
        if i == 0:
            dp[i][j] = 1 if j == 0 else 0
        elif j == 0:
            dp[i][j] = dp[i-1][j] * (1 - A[i])
        else:
            dp[i][j] = dp[i-1][j] * (1 - A[i]) \
                       + dp[i-1][j-1] * A[i]
        if i == n and j > n/2:
            res += dp[i][j]
printf(res)

Fixed submission:
inp = lambda cast=int: list(map(cast, input().split()))
# printf = lambda s='', *args, **kwargs: print(str(s).format(*args), flush=True, **kwargs)
n, = inp()
A = [0.0] + inp(float)
dp = [[0.0 for _ in range(n + 1)] for _ in range(n + 1)]
res = 0.0
for i in range(n + 1):
    for j in range(n + 1):
        if i == 0:
            dp[i][j] = 1 if j == 0 else 0
        elif j == 0:
            dp[i][j] = dp[i-1][j] * (1 - A[i])
        else:
            dp[i][j] = dp[i-1][j] * (1 - A[i]) \
                       + dp[i-1][j-1] * A[i]
        if i == n and j > n/2:
            res += dp[i][j]
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
inp = lambda cast=int: list(map(cast, input().split()))
printf = lambda s='', *args, **kwargs: print(str(s).format(*args), flush=True, **kwargs)
n, = inp()
A = [0.0] + inp(float)
dp = [[0.0 for _ in range(n + 1)] for _ in range(n + 1)]
res = 0.0
for i in range(n + 1):
    for j in range(n + 1):
        if i == 0:
            dp[i][j] = 1 if j == 0 else 0
        elif j == 0:
            dp[i][j] = dp[i-1][j] * (1 - A[i])
        else:
            dp[i][j] = dp[i-1][j] * (1 - A[i]) \
                       + dp[i-1][j-1] * A[i]
        if i == n and j > n/2:
            res += dp[i][j]
printf(res)

Fixed submission:
inp = lambda cast=int: list(map(cast, input().split()))
# printf = lambda s='', *args, **kwargs: print(str(s).format(*args), flush=True, **kwargs)
n, = inp()
A = [0.0] + inp(float)
dp = [[0.0 for _ in range(n + 1)] for _ in range(n + 1)]
res = 0.0
for i in range(n + 1):
    for j in range(n + 1):
        if i == 0:
            dp[i][j] = 1 if j == 0 else 0
        elif j == 0:
            dp[i][j] = dp[i-1][j] * (1 - A[i])
        else:
            dp[i][j] = dp[i-1][j] * (1 - A[i]) \
                       + dp[i-1][j-1] * A[i]
        if i == n and j > n/2:
            res += dp[i][j]
print(res)
Buggy python submission (verdict: Runtime Error):
x=int(input())
y=int(input())
prize=0
if x==1:
  prize+=300000
if x==2:
  prize+=200000
if x==3:
  prize+=100000
if y==1:
  prize+=300000
if y==2:
  prize+=200000
if y==3:
  prize+=100000
if x==1 and y==1:
  prize+=400000
print(prize)
  

Fixed submission:
x,y=(int(x) for x in input().split())
prize=0
if x==1:
  prize+=300000
if x==2:
  prize+=200000
if x==3:
  prize+=100000
if y==1:
  prize+=300000
if y==2:
  prize+=200000
if y==3:
  prize+=100000
if x==1 and y==1:
  prize+=400000
print(prize)
Buggy python submission (verdict: Runtime Error):
m1, d1 = map(int, input().split())
m2, d2 = map(int, input().split())

if (m1/=m2):
  print(1)
else:
  print(0)

Fixed submission:
m1, d1 = map(int, input().split())
m2, d2 = map(int, input().split())

if (m1!=m2):
    print(1)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
N, L = map(int, input().split())
flavors = [x + L - 1 for x in range(1, N + 1)]
flavors.remove(min(flavors, key=abs))
print(sum(flavors))

Fixed submission:
n = input()
print(["Good" if n[0] != n[1] != n[2] != n[3] else "Bad"][0])
Buggy python submission (verdict: Runtime Error):
N, L = int(input()), int(input())

flavors = [x + L - 1 for x in range(1, N + 1)]
planned_pie = sum(flavors)
eat = min(flavors)
eat_abs = -min([abs(x) for x in flavors])
print([planned_pie - max(eat, eat_abs) if planned_pie <
       0 else planned_pie - max(eat, eat_abs)][0])

Fixed submission:
N, L = map(int, input().split())
flavors = [x + L - 1 for x in range(1, N + 1)]
flavors.remove(min(flavors, key=abs))
# flavors.pop(flavors.index(min(flavors, key=abs)))
print(sum(flavors))
Buggy python submission (verdict: Runtime Error):
import copy

class Item:
	def __init__(self):
		self.weight = 0
		self.value = 0

	def __repr__(self):
		return "(" + str(self.weight) + ", " + str(self.value) + ")"

items = []


def main():
	N, W = [int(x) for x in input().split()]
	global items
	
	for _ in range(0, N):
		x = Item()
		x.weight, x.value = [int(y) for y in input().split()]
		items.append(x)


	dp = [[]] * (N + 1)
	for _ in range(0, N + 1):
		dp[_] = [0] * (W + 1)
	

	dp[0][0] = 0
	for i in range(1, N + 1):
		for j in range(0, W + 1):
			if items[i - 1].weight > j:
				dp[i][j] = dp[i - 1][j]
			else:
				dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - items[i - 1].weight] + items[i - 1].value)

	print(dp[N][W])

if __name__ == "__main__":
	main()

Fixed submission:
import copy

def main():
	n = int(input())
	a = []
	for _ in range(0, n):
		x = [int(x) for x in input().split()]
		a.append(x)
	
	cur = a[0]
	nxt = [0] * 3

	for i in range(1, len(a)):
		nxt[0] = max(a[i][0] + cur[1], a[i][0] + cur[2])
		nxt[1] = max(a[i][1] + cur[0], a[i][1] + cur[2])
		nxt[2] = max(a[i][2] + cur[1], a[i][2] + cur[0])

		cur = copy.deepcopy(nxt)

	print(max(cur[0], cur[1], cur[2]))

if __name__ == "__main__":
	main()
Buggy python submission (verdict: Runtime Error):
n,a,b=map(int,input().split())if(b-a)%2==0:print((b-a)//2)else:print(min(a-1,n-b)+1+(b-a-1)//2)

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

if (b - a) % 2 == 0:
    print((b - a) // 2)
else:
    print(min(a, n - b + 1) + (b - a - 1) // 2)

Buggy python submission (verdict: Runtime Error):

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

if (b - a)% == 0:
    print((b - a)//2)
else:
    print(min(a - 1, n - b) + 1 +(b - a - 1)//2)

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

if (b - a) % 2 == 0:
    print((b - a) // 2)
else:
    print(min(a, n - b + 1) + (b - a - 1) // 2)
Buggy python submission (verdict: Runtime Error):
num = []
A = 0
B = 0
for i in range(int(input())):
    num.append(int(input()))
num = sorted(num)
while num != []:
    A += pop(num[0])
    if num != []:
        B += pop(num[0])

print(A - B)


Fixed submission:
num = []
A = 0
B = 0
count = int(input())
list = input().split()
for i in range(count):
    num.append(int(list[i]))
num = sorted(num, reverse = True)

while num != []:
    A += num.pop(0)
    if num != []:
        B += num.pop(0)

print(A - B)
Buggy python submission (verdict: Time Limit Exceeded):

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

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

m = list(set(n))



c = 0
if len(m) <= b:
    print(0)
else:
    dic = {}
    for i in range(len(m)):
        dic[str(m[i])] = n.count(m[i])

    dic = sorted(dic.items(), key = lambda x:x[1])
    for i in range(len(m) - b):
        c += dic[i][1]
    print(c)


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

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

l = {}
for a in n:
    l[a] = l.get(a, 0) + 1
print(sum(sorted(l.values())[:-b]))