Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import itertools
import numpy as np
import copy


ansl = []
N, A, B, C = list(map(int, input().split()))

a = []
for i in range(N):
    a.append(int(input()))

def get_ptn(la):
    ptn = []
    for i in range(1, len(la) + 1):
        ptn.append(list(itertools.combinations(la, i)))
    return ptn

takes = list(itertools.permutations([A, B, C]))


for take in takes:
    # print(take)
    # print(a)
    ta = copy.deepcopy(a)
    ans = 0
    for k in range(3):

        # print(a)
        ptn = get_ptn(ta)

        # print(ptn)
        cost = []
        tmp = []

        for i in range(len(ptn)):
            tmp.append([abs(take[k] - sum(j)) for j in ptn[i]])
            cost.append(min(tmp[i]) + 10 * i)
        # print(cost)
        ans += min(cost)
        ac = np.argmin(cost)
        # print(np.argmin(cost))
        # print(ptn[ac])
        # print(tmp[ac])
        at = np.argmin(tmp[ac])
        # print(ptn[ac][at])

        for _ in ptn[ac][at]:
            ta.remove(_)

    ansl.append(ans)

print(min(ansl))


Fixed submission:
import itertools
import numpy as np
import copy


ansl = []
N, A, B, C = list(map(int, input().split()))

a = []
for i in range(N):
    a.append(int(input()))

def get_ptn(la):
    ptn = []
    for i in range(1, len(la) + 1):
        ptn.append(list(itertools.combinations(la, i)))
    return ptn

takes = list(itertools.permutations([A, B, C]))

for take in takes:
    # print(take)
    # print(a)
    try:
        ta = copy.deepcopy(a)
        ans = 0
        for k in range(3):
            # print(a)
            ptn = get_ptn(ta)

            # print(ptn)
            cost = []
            tmp = []
            for i in range(len(ptn)):
                tmp.append([abs(take[k] - sum(j)) for j in ptn[i]])
                cost.append(min(tmp[i]) + 10 * i)
            ans += min(cost)
            ac = np.argmin(cost)
            # print(np.argmin(cost))
            # print(ptn[ac])
            # print(tmp[ac])
            at = np.argmin(tmp[ac])
            # print(ptn[ac][at])

            for _ in ptn[ac][at]:
                ta.remove(_)

        ansl.append(ans)
    except:
        pass

print(min(ansl))
Buggy python submission (verdict: Runtime Error):
N, M = list(map(int, input().split()))
X = list(map(int, input().split()))

if N == 1:
    ans = max(X) - min(X)
    print(ans)
    exit()

if M == 1:
    ans = 0
    print(ans)
    exit()

Xs = sorted(X)

diff = []
for i in range(M - 1):
    tmp = Xs[i + 1] - Xs[i]
    diff.append(tmp)

rest = N - 2
for _ in range(rest):
    if diff[0] > diff[len(diff) - 1]:
        diff.pop(0)
    else:
        diff.pop()

ans = 0

for _ in range(len(diff) - 1):
    if diff[0] > diff[len(diff) - 1]:
        ans += diff[len(diff) - 1]
        diff.pop()
    else:
        ans += diff[0]
        diff.pop(0)

print(ans)


Fixed submission:
N, M = list(map(int, input().split()))
X = list(map(int, input().split()))

if N == 1:
    ans = max(X) - min(X)
    print(ans)
    exit()

if ((M == 1) or (N >= M)):
    ans = 0
    print(ans)
    exit()

Xs = sorted(X)

diff = []
for i in range(M - 1):
    tmp = Xs[i + 1] - Xs[i]
    diff.append(tmp)

diffs = sorted(diff)
print(sum(diffs[:(M - 1) - (N - 1)]))

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

if M == 1:
    ans = max(X) - min(X)
    print(ans)
    exit()

Xs = sorted(X)

diff = []
for i in range(M - 1):
    tmp = Xs[i + 1] - Xs[i]
    diff.append(tmp)

rest = N - 2
for _ in range(rest):
    if diff[0] > diff[len(diff) - 1]:
        diff.pop(0)
    else:
        diff.pop()

ans = 0

for _ in range(len(diff) - 1):
    if diff[0] > diff[len(diff) - 1]:
        ans += diff[len(diff) - 1]
        diff.pop()
    else:
        ans += diff[0]
        diff.pop(0)

print(ans)



Fixed submission:
N, M = list(map(int, input().split()))
X = list(map(int, input().split()))

if N == 1:
    ans = max(X) - min(X)
    print(ans)
    exit()

if ((M == 1) or (N >= M)):
    ans = 0
    print(ans)
    exit()

Xs = sorted(X)

diff = []
for i in range(M - 1):
    tmp = Xs[i + 1] - Xs[i]
    diff.append(tmp)

diffs = sorted(diff)
print(sum(diffs[:(M - 1) - (N - 1)]))
Buggy python submission (verdict: Time Limit Exceeded):
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))

def xor(n):
    c = 0
    for a in A:
        c += (n^a)
    return c

ans = []

for i in range(K + 1):
    ans.append(xor(i))

print(max(ans))


Fixed submission:
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))

"""
方針　各桁を0にするか1にするかは独立に考えてよい
 
K = 10101 の時
0か1か好きに選べる桁をfとして
* X = 10101
* X = 10100
* X = 100ff
* X = 0ffff
を試し、最大になるものを選ぶ
 
2**39 < 10**12 < 2**40　なので40桁について考え
fのときどっちを選ぶとよいかを前計算しておく
""" 
 
L = [0]*40  # (i桁目が1である数)
for i in range(N):
    for j in range(40):
        L[j] += (A[i] >> j)&1
 
default = [(N - L[i]) * (2**i) if (K>>i)&1 == 1 else L[i] * (2**i) for i in range(40)]
free = [max(L[i] * (2**i), (N-L[i])*(2**i)) for i in range(40)]
 
ans = sum([K^A[i] for i in range(N)])
for i in range(40):
    if (K >> i)&1 == 1:
        ans = max(ans,
                  sum(free[:i]) + L[i]*(2**i) + sum(default[i+1:]))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()

cnt = 0

for i in range(len(S)):
    if (i != 0):
        if S[i] == 'W':
            for _ in range(i):
                if S[_] == 'B':
                    cnt += 1

print(cnt)

Fixed submission:
S = input()

cnt = 0
cnt_B = 0

for i in range(len(S)):
    if S[i] == 'W':
        cnt += cnt_B
    else:
        cnt_B += 1

print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = list(map(int, input().split()))
 
h = []
for i in range(N):
    h.append(int(input()))
 
h_sort = sorted(h)

aa = h_sort[1:]
bb = h_sort[:-1]
diff = [a - b for a, b in zip(aa, bb)]

ans = []
for i in range(len(diff) - (K - 2)):
    tmp = 0
    for j in range(K - 1):
        tmp += diff[i + j]
    ans.append(tmp)
 
print(min(ans))


Fixed submission:
N,K = map(int,input().split())

h = []
for _ in range(N):
    h.append(int(input()))

h.sort()
minimum = h[N - 1]- h[0]

for i in range(N - K + 1):
    minimum = min(minimum, h[i + K - 1] - h[i])
print(minimum)

Buggy python submission (verdict: Runtime Error):
import pandas as pd
N, K = list(map(int, input().split()))
 
h = []
for i in range(N):
    h.append(int(input()))

h_sort = sorted(h)
df = pd.DataFrame(h_sort)
df2 = df.diff()
df3 = df2.rolling(K - 1).sum()
df4 = df3.dropna(how='all')

print(int(min(df4[0])))

Fixed submission:
N,K = map(int,input().split())

h = []
for _ in range(N):
    h.append(int(input()))

h.sort()
minimum = h[N - 1]- h[0]

for i in range(N - K + 1):
    minimum = min(minimum, h[i + K - 1] - h[i])
print(minimum)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = list(map(int, input().split()))

h = []
for i in range(N):
    h.append(int(input()))

h_sort = sorted(h)

h_sort_diff = []

for i in range(len(h_sort) - 1):
    tmp = h_sort[i + 1] - h_sort[i]
    h_sort_diff.append(tmp)

ans = []
for i in range(len(h_sort_diff) - (K - 2)):
    tmp = 0
    for j in range(K - 1):
        tmp += h_sort_diff[i + j]
    ans.append(tmp)

print(min(ans))

Fixed submission:
N,K = map(int,input().split())

h = []
for _ in range(N):
    h.append(int(input()))

h.sort()
minimum = h[N - 1]- h[0]

for i in range(N - K + 1):
    minimum = min(minimum, h[i + K - 1] - h[i])
print(minimum)

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

h = []
for i in range(N):
    h.append(int(input()))

h_sort = sorted(h)

h_sort_diff = []

for i in range(len(h_sort) - 1):
    tmp = h_sort[i + 1] - h_sort[i]
    h_sort_diff.append(tmp)

ans = []
for i in range(len(h_sort_diff) - 1):
    tmp = 0
    for j in range(K - 1):
        tmp += h_sort_diff[i + j]
    ans.append(tmp)

print(min(ans))

Fixed submission:
N,K = map(int,input().split())

h = []
for _ in range(N):
    h.append(int(input()))

h.sort()
minimum = h[N - 1]- h[0]

for i in range(N - K + 1):
    minimum = min(minimum, h[i + K - 1] - h[i])
print(minimum)
Buggy python submission (verdict: Time Limit Exceeded):
import fractions

N, M = list(map(int, input().split()))
S = input()
T = input()

def lcm(a, b):
	return a * b // fractions.gcd (a, b)

ans = lcm(N, M)

i = 0
res = [0 for i in range(ans)]

for i in range(N):
    tmp_s = int(ans/N) * i
    res[tmp_s] = S[i]

for j in range(M):
    tmp_t = int(ans/M) * j
    if res[tmp_t] != 0:
        if T[j] != res[tmp_t]:
            ans = -1

print(ans)


Fixed submission:
import fractions


def lcm(x, y):
    return int((x * y) // fractions.gcd(x, y))

n, m = [int(i) for i in input().split()]
s = input()
t = input()

span = fractions.gcd(n, m)
for i in range(span):
    if s[int(n/span)*i] != t[int(m/span)*i]:
        print("-1")
        exit()
print(lcm(n, m))

Buggy python submission (verdict: Time Limit Exceeded):
N, M = list(map(int, input().split()))
S = input()
T = input()

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

def lcm(a, b):
	return a * b // gcd (a, b)

ans = lcm(N, M)

i = 0
res = [0 for i in range(ans)]

for i in range(N):
    tmp_s = int(ans/N) * i
    res[tmp_s] = S[i]

for j in range(M):
    tmp_t = int(ans/M) * j
    if res[tmp_t] != 0:
        if T[j] != res[tmp_t]:
            ans = -1

print(ans)


Fixed submission:
import fractions


def lcm(x, y):
    return int((x * y) // fractions.gcd(x, y))

n, m = [int(i) for i in input().split()]
s = input()
t = input()

span = fractions.gcd(n, m)
for i in range(span):
    if s[int(n/span)*i] != t[int(m/span)*i]:
        print("-1")
        exit()
print(lcm(n, m))

Buggy python submission (verdict: Time Limit Exceeded):
N, M = list(map(int, input().split()))
S = input()
T = input()

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def lcm(a, b):
	return a * b // gcd (a, b)

ans = lcm(N, M)

i = 0
res = [0 for i in range(ans)]

for i in range(N):
    tmp_s = int(ans/N) * i
    res[tmp_s] = S[i]

for j in range(M):
    tmp_t = int(ans/M) * j
    if res[tmp_t] != 0:
        if T[j] != res[tmp_t]:
            ans = -1

print(ans)

Fixed submission:
import fractions


def lcm(x, y):
    return int((x * y) // fractions.gcd(x, y))

n, m = [int(i) for i in input().split()]
s = input()
t = input()

span = fractions.gcd(n, m)
for i in range(span):
    if s[int(n/span)*i] != t[int(m/span)*i]:
        print("-1")
        exit()
print(lcm(n, m))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

cnt = 0

for i in range(0, N):
    for j in range(i + 1, N + 1):
        if sum(A[i:j]) == 0:
            cnt += 1

print(cnt)


Fixed submission:
from collections import Counter

N = int(input())
A = list(map(int, input().split()))

S = [0]

for i, a in enumerate(A):
    S.append(S[i] + a)

S = sorted(S)
a = Counter(S).most_common()
cnt = 0

for i in range(len(a)):
    cnt += ((a[i][1]-1)*a[i][1])//2

print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
A, B, K = list(map(int, input().split()))

for i in range(A, B + 1):
    if (i < A + K) or (i > B - K):
        print(i)

Fixed submission:
A, B, K = list(map(int, input().split()))

x = []

for i in range(A, A + K):
    if (i <= B):
        x.append(i)

for i in range(B - K + 1, B + 1):
    if (i >= A):
        x.append(i)

y = set(x)

for i in range(len(y)):
    print(sorted(list(y))[i])
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()

s_dash = ''.join(sorted(s))
t_dash = ''.join(sorted(t)[::-1])

test = [s_dash, t_dash]

if s_dash == t_dash:
    print("No")
else:
    if sorted(test)[0] != s_dash:
        print("No")
    else:
        print("Yes")


Fixed submission:
import math

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

ans =math.ceil(((a + b) / 2))

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

def Lucas(n):
    if n == 0:
        return 2
    elif n == 1:
        return 1
    else:
        return Lucas(n - 2) + Lucas(n - 1)

print(Lucas(N))

Fixed submission:
N = int(input())

Lucas = []
Lucas.append(2)
Lucas.append(1)

for i in range(2, 90):
    Lucas.append(Lucas[i - 2] + Lucas[i - 1])

print(Lucas[N])
Buggy python submission (verdict: Runtime Error):
A, B = list(map(int, input().split()))

if A < B:
    print("<")
elif A > B:
    print(">")
else:
    print("=")

Fixed submission:
A, B = input().split()

if A < B:
    print("<")
elif A > B:
    print(">")
else:
    print("=")
Buggy python submission (verdict: Runtime Error):
A, B, C = list(map(int, input().split()))

if A == B:
    print(C)
elif A == C
    print(B)
else:
    print(A)

Fixed submission:
A, B, C = list(map(int, input().split()))

if A == B:
    print(C)
elif A == C:
    print(B)
else:
    print(A)
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))

X = sum(a)
b = [a[0]]
for i in range(1, N):
    b.append(b[i-1] + a[i])

ans = []
for i in range(1, N):
    ans.append(abs(X - 2*b[i]))

print(min(ans))


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

if A*B*(A+B) %3 == 0:
    print('Possible')
else:
    print('Impossible')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int, input().split()))

X = sum(a)

ans = []
for i in range(1, N):
    ans.append(abs(X - 2*sum(a[:i])))

print(min(ans))


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

X = sum(a)
b = [a[0]]
for i in range(1, N - 1):
    b.append(b[i-1] + a[i])

ans = []
for i in range(0, N - 1):
    ans.append(abs(X - 2*b[i]))

print(min(ans))

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

a = sorted(a)
X = sum(a)

ans = []
for i in range(1, N - 1):
    ans.append(X - 2*sum(a[:i]))

print(min(ans))


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

X = sum(a)
b = [a[0]]
for i in range(1, N - 1):
    b.append(b[i-1] + a[i])

ans = []
for i in range(0, N - 1):
    ans.append(abs(X - 2*b[i]))

print(min(ans))
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(input()) for i in range(N)]
print(max(A) - min(A))


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
print(max(A) - min(A))
Buggy python submission (verdict: Runtime Error):
a, b, c = input().split()

if (a[-1] == B[0]) and (B[-1] == C[0]):
    print("YES")
else:
    print("NO")


Fixed submission:
a, b, c = input().split()
 
if (a[-1] == b[0]) and (b[-1] == c[0]):
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
S = input()
N = len(S)
for s, i in enumerate(S):
    if s == 'A':
        a_index = i
        break
for s, i in enumerate(S[::-1]):
    if s == 'A':
        z_index = i
        break

print(N - z_index - a_index)


Fixed submission:
S = input()
N = len(S)
for i, s in enumerate(S):
    if s == 'A':
        a_index = i
        break
for i, s in enumerate(S[::-1]):
    if s == 'Z':
        z_index = i
        break

print(N - z_index - a_index)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
N = len(S)
for i in range(N):
    if S[i] == 'A':
        a_index = i
        break
for i in range(N):
    if S[::-1][i] == 'Z':
        z_index = i
        break

print(N - z_index - a_index)


Fixed submission:
S = input()
N = len(S)
for i, s in enumerate(S):
    if s == 'A':
        a_index = i
        break
for i, s in enumerate(S[::-1]):
    if s == 'Z':
        z_index = i
        break

print(N - z_index - a_index)
Buggy python submission (verdict: Runtime Error):
a, b, c = list(map(float, input().split()))
if (b == '+'):
    print(a + c)
else:
    print(a - c)


Fixed submission:
a, b, c = input().split()
if (b == '+'):
    print(int(a) + int(c))
else:
    print(int(a) - int(c))

Buggy python submission (verdict: Runtime Error):
a, b, c = input().split()
if (b == '+'):
    print(a + c)
else:
    print(a - c)


Fixed submission:
a, b, c = input().split()
if (b == '+'):
    print(int(a) + int(c))
else:
    print(int(a) - int(c))
Buggy python submission (verdict: Runtime Error):
A, B, M = [int(num) for num in input().split()]
a = [int(num) for num in input().split()]
b =  [int(num) for num in input().split()]
minimum = -1
for i in range(M):
    xi, yi, ci =  [int(num) for num in input().split()]
    ai = a[xi]
    bi = b[yi]
    sum = ai + bi - ci
    if minimum == -1 or sum < minimum:
        minimum = sum
print(minimum)

Fixed submission:
A, B, M = [int(num) for num in input().split()]
a = [int(num) for num in input().split()]
b =  [int(num) for num in input().split()]
minimum = -1
for i in range(M):
    xi, yi, ci =  [int(num) for num in input().split()]
    ai = a[xi-1]
    bi = b[yi-1]
    sum = ai + bi - ci
    if minimum == -1 or sum < minimum:
        minimum = sum
a.sort()
b.sort()
sum = a[0]+b[0]
if minimum < sum:
    print(minimum)
else:
    print(sum)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = {}
for i in range(N):
    s = input()
    if s in S:
        S[s] += 1
    else:
        S[s] = 1
sorted_S = sorted(S.items(), key=lambda x: x[1], reverse=True)
a = []
count = -1
for s in sorted_S:
    if count == -1:
        a.append(s)
        count = sorted_S[s]
    elif count == sorted_S[s]:
        a.append(s)
    else:
        break
sorted_a = sorted(a)
for s in sorted_a:
    print(s)

Fixed submission:
N = int(input())
S = {}
for i in range(N):
    s = input()
    if s in S:
        S[s] += 1
    else:
        S[s] = 1
sorted_S = sorted(S.items(), key=lambda x: x[1], reverse=True)
a = []
count = -1
for s in sorted_S:
    if count == -1:
        a.append(s[0])
        count = s[1]
    elif count == s[1]:
        a.append(s[0])
    else:
        break
sorted_a = sorted(a)
for s in sorted_a:
    print(s)
Buggy python submission (verdict: Runtime Error):
H , A = input().split()
H , A = int(H), int(A)
answer = H // A
if H % A == 0:
    print(answer)
else:
    print(anser + 1)

Fixed submission:
H , A = input().split()
H , A = int(H), int(A)
answer = H // A
if H % A == 0:
    print(answer)
else:
    print(answer + 1)
Buggy python submission (verdict: Runtime Error):
N = input()
S, T = input().split()
A = String()
for s, t in zip(S, T):
  A += s
  A += t
print(A)

Fixed submission:
N = input()
S, T = input().split()
A = ""
for s, t in zip(S, T):
    A += s
    A += t
print(A)
Buggy python submission (verdict: Runtime Error):
A, B = input().split
print(math.gcd(int(A), int(B)))

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

#a,bの最小公倍数
def lcm(a, b):
    return a * b // gcd (a, b)
A, B = input().split()
print(lcm(int(A), int(B)))

Buggy python submission (verdict: Runtime Error):
A, B = input().split()
print(math.gcd(A,B))

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

#a,bの最小公倍数
def lcm(a, b):
    return a * b // gcd (a, b)
A, B = input().split()
print(lcm(int(A), int(B)))
Buggy python submission (verdict: Runtime Error):
all = input()
all = [int(num) for num in all]
if sum(all) >= 22:
    print('bust')
else:
    print('win')

Fixed submission:
all = input()
all = all.split(' ')
all = [int(num) for num in all]
if sum(all) >= 22:
    print('bust')
else:
    print('win')

Buggy python submission (verdict: Runtime Error):
all = input()
all = all.split(' ')
all = [int(num) for num in all]
if sum(all) >= 22:
  return'bust'
else:
  return 'win'

Fixed submission:
all = input()
all = all.split(' ')
all = [int(num) for num in all]
if sum(all) >= 22:
    print('bust')
else:
    print('win')

Buggy python submission (verdict: Runtime Error):
all = input()
if sum(all) >=22:
  return 'bust'
else:
  return 'win'

Fixed submission:
all = input()
all = all.split(' ')
all = [int(num) for num in all]
if sum(all) >= 22:
    print('bust')
else:
    print('win')
Buggy python submission (verdict: Runtime Error):
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "13 7 2\n"
     ]
    }
   ],
   "source": [
    "all = input()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "all = input()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['13', '7', '2']"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "all"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "all = [int(num) for num in all]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[13, 7, 2]"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "all"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "ename": "AttributeError",
     "evalue": "'list' object has no attribute 'sum'",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mAttributeError\u001b[0m                            Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-19-1727d8e1239d>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mall\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msum\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[0;31mAttributeError\u001b[0m: 'list' object has no attribute 'sum'"
     ]
    }
   ],
   "source": [
    "all.sum"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "bust\n"
     ]
    }
   ],
   "source": [
    "if sum(all) >= 22:\n",
    "    print('bust')\n",
    "else:\n",
    "    print('win')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}


Fixed submission:
S = input()
count = 0
for i in range(len(S)//2):
    if S[i] is not S[len(S)-1-i]:
        count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
ans = ''
i = 0
prev = ''
while i < n - 1:
    if prev != s[i]:
        ans += s[i]
    prev = s[i]
    if s[i] == s[i+1]:
        i += 2
    else:
        i += 1
if prev != s[i]:
    ans += s[i] 
print(len(ans))

Fixed submission:
n = int(input())
s = input()
ans = ''
i = 0
prev = ''
while i < n - 1:
    if prev != s[i]:
        ans += s[i]
    prev = s[i]
    if s[i] == s[i+1]:
        i += 2
    else:
        i += 1
if not(i > n - 1):
    if prev != s[i]:
        ans += s[i] 
print(len(ans))
Buggy python submission (verdict: Runtime Error):
a, b = (int(_) for _ in input().split())
total = 1
ans = 0
if b == 1:
    print(1)
else:
    while total < b:
      	total -= 1
        total += a
        ans += 1
        
print(ans)

Fixed submission:
a, b = (int(_) for _ in input().split())
total = 1
ans = 0
while total < b:
  total -= 1
  total += a
  ans += 1    
print(ans)