Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N,X = map(int,input().split())
L = list(map(int,input().split()))
C = 1
M = 0

for i in range(N + 1):
    M = M + L[i]
    if M >= X:
        print(C)
        exit(0)
    
    C = C + 1

print(C)

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

for i in range(N):
    M = M + L[i]
    if M > X:
        print(C)
        exit(0)
    
    C = C + 1

print(C)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = list(int(input()) for i in range(m))
dp = [0] * (n+1)
b = 0
for i in range(1,n+1):
    if a[b] == i:
        b += 1
        if b == m:
            b = 0
    else:
        if i != 1 and i != 2:
            dp[i] = dp[i-1] + dp[i-2]
        else:
            if i == 1:
                dp[1] = 1
            elif i == 2 and a[0] == 1:
                dp[2] = 1
            else:
                dp[1] = 1
                dp[2] = 2
print(dp[-1] % (10 ** 9 + 7))

Fixed submission:
n,m = map(int,input().split())
a = list(int(input()) for i in range(m))
a.append(0)
dp = [0] * (n+1)
b = 0
for i in range(1,n+1):
    if a[b] == i:
        b += 1
    else:
        if i != 1 and i != 2:
            dp[i] = dp[i-1] + dp[i-2]
        else:
            if i == 1:
                dp[1] = 1
            elif i == 2 and a[0] == 1:
                dp[2] = 1
            else:
                dp[1] = 1
                dp[2] = 2
print(dp[-1] % (10 ** 9 + 7))
Buggy python submission (verdict: Runtime Error):
n,a,b,c,d = map(int,input().split())
s = list(input())
s.insert(0,0)
for i in range(a,max(c,d)+1):
    if '#' == s[i] and '#' == s[i+1]:
        print('No')
        exit(0)
if c < d:
    print('Yes')
else:
    for i in range(b,d+1):
        if '.' == s[i] and '.' == s[i+1] and '.' == s[i+2]:
            print('Yes')
            exit(0)
    print('No')

Fixed submission:
n,a,b,c,d = map(int,input().split())
s = list(input())
s.insert(0,0)
for i in range(a,max(c,d)):
    if '#' == s[i] and '#' == s[i+1]:
        print('No')
        exit(0)
if c < d:
    print('Yes')
else:
    for i in range(b-1,d):
        if '.' == s[i] and '.' == s[i+1] and '.' == s[i+2]:
            print('Yes')
            exit(0)
    print('No')
Buggy python submission (verdict: Runtime Error):
s = list(input())
i = len(s)
o = s.count('o')

if o >= 8:
    print('YES')
else:
    s = 15 - s
    if 8 - o <= s:
        print('YES')
    else:
        print('NO')

Fixed submission:
s = list(input())
i = len(s)
o = s.count('o')

if o >= 8:
    print('YES')
else:
    i = 15 - i
    if 8 - o <= i:
        print('YES')
    else:
        print('NO')
Buggy python submission (verdict: Runtime Error):
r,d,x = map(int,input().split())
p = []
for i in range(10):
    x = r * x - d
    p[i] = x

for i in range(10):
    print(p[i])

Fixed submission:
r,d,x = map(int,input().split())
p = []
for i in range(10):
    x = r * x - d
    p.append(x)

for i in range(10):
    print(p[i])
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
s = input()
s[k-1] = s[k-1].lower()
print(s)

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

s[k-1] = s[k-1].lower()
print(''.join(s))

Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
s = input()
s[k-1] = s.lower(s[k-1])
print(s)

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

s[k-1] = s[k-1].lower()
print(''.join(s))
Buggy python submission (verdict: Runtime Error):
t = []
for i in range(5):
    t.append(int(input()))

s = []
for i in range(5):
    s.append(t[i] % 10)

p = 10
for i in range(5):
    if s[i] > 0:
        if p > s[i]:
            o = i
            p = s[i]

m = 0
for i in range(5):
    if i != o:
        if s[i] == 0:
            m += t[i]
        else:
            m += t[i] - t[i] % 10 + 10

m += t[o]
print(m)

Fixed submission:
t = []
for i in range(5):
    t.append(int(input()))

s = []
for i in range(5):
    s.append(t[i] % 10)

o = 5
p = 10
for i in range(5):
    if s[i] > 0:
        if p > s[i]:
            o = i
            p = s[i]

m = 0
for i in range(5):
    if i != o:
        if s[i] == 0:
            m += t[i]
        else:
            m += t[i] - t[i] % 10 + 10

if o != 5:
    m += t[o]
print(m)
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = list(map(int,input().split()))
l.sort(reverse = True)

if l[0] < sum(l[1:n]):
    print('Yes')
else:
    print('No')

Fixed submission:
s = input()
a = ['A','C','G','T']
c = 0
j = 0

for i in range(len(s)):
    if s[i] in a:
        j += 1
    else:
        if j > c:
            c = j
            j = 0

if j > c:
    print(j)
else:
    print(c)
Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())
s = input()
z = [list(map(int,input().split())) for i in range(q)]
l,r = [list(i) for i in zip(*z)]
p = 0
for i in range(q):
    print(s[l[i]-1:r[i]].count('AC'))

Fixed submission:
n,q = map(int,input().split())
s = input()
s = s.replace('AC','ac')
t = [0] * n
r = 0
for i in range(n):
    if s[i] == 'c':
        r += 1
    t[i] = r
for i in range(q):
    l,r = map(int,input().split())
    print(t[r-1]-t[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())
s = input()
z = [list(map(int,input().split())) for i in range(q)]
l,r = [list(i) for i in zip(*z)]

for i in range(q):
    print(s[l[i]-1:r[i]].count('AC'))

Fixed submission:
n,q = map(int,input().split())
s = input()
s = s.replace('AC','ac')
t = [0] * n
r = 0
for i in range(n):
    if s[i] == 'c':
        r += 1
    t[i] = r
for i in range(q):
    l,r = map(int,input().split())
    print(t[r-1]-t[l-1])
Buggy python submission (verdict: Time Limit Exceeded):
s = list(input())
t = []
p = len(s)
flg = True

while flg:
    flg = False
    i = 0
    while i < len(s):
        if i < len(s)-1:
            if s[i] != s[i+1]:
                i += 2
                flg = True
            else:
                t.append(s[i])
                i += 1
        else:
            t.append(s[i])
            i += 1
    s = list(t)
    t.clear()

print(p - len(s))

Fixed submission:
s = list(input())
p = s.count('0')
q = s.count('1')
print(2 * min(p,q))

Buggy python submission (verdict: Runtime Error):
s = list(input())
t = []
p = 0
flg = True

while flg:
    flg = False
    j = 0
    for i in range(len(s)):
        if s[j] == s[j+1]:
            t.append(s[j])
            j += 1
        else:
            p += 2
            j += 2
        if j >= len(s) - 1:
            if j == len(s) - 1:
                t.append(s[j])
                break
            else:
                break
    if len(t) == len(s) or len(t) == 0:
        pass
    else:
        s = t
        t.clear()
        flg = True

print(p)

Fixed submission:
s = list(input())
p = s.count('0')
q = s.count('1')
print(2 * min(p,q))
Buggy python submission (verdict: Runtime Error):
n,a,b = map(int,input().split())
l = []

l.append(min(a,b))

if n >= a + b:
    l.append(0)
else:
    l.append(a + b - n)

print(''.join(l))


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

l.append(min(a,b))

if n >= a + b:
    l.append(0)
else:
    l.append(a + b - n)

print(l[0],l[1])
Buggy python submission (verdict: Runtime Error):
n = list(input().split())
print(n)

if n in ('1'):
    if n in ('9'):
        if n in ('7'):
            if n in ('4'):
                print('YES')
                exit(0)

print('NO')

Fixed submission:
n = list(input().split())

if '1' in n:
    if '9' in n:
        if '7' in n:
            if '4' in n:
                print('YES')
                exit(0)

print('NO')
Buggy python submission (verdict: Runtime Error):
n = int(input())
p = list(map(float,input().split()))
dp = [[0] * (n+1) for i in range(n+1)]
dp[0][0] = 1
for i in range(1,n+1):
    for j in range(i+1):
        if j > 0:
            dp[i][j] = dp[i-1][j]*(1-p[i-1])+dp[i-1][j-1]*p[i-1]
        else:
            dp[i][j] = dp[i-1][j]*(1-p[i-1])
ans = 0
for i in range(n//2+1,n+1):
    ans += dp[n][i]
print(ans)

Fixed submission:
n = int(input())
h = list(map(int,input().split()))
dp = [0] * n

dp[1] = abs(h[0] - h[1])

for i in range(2,n):
    p = abs(h[i] - h[i-2]) + dp[i-2]
    q = abs(h[i] - h[i-1]) + dp[i-1]
    if p <= q:
        dp[i] = p
    else:
        dp[i] = q

print(dp[-1])
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
h = list(map(int,input().split()))
dp = [0] * n
t = []
 
for i in range(1,n):
    for l in range(1,k+1):
        if i - l >= 0:
            t.append(abs(h[i] - h[i-l]) + dp[i-l])
        else:
            break
 
    dp[i] = min(t)
    t.clear()

print(dp[-1])

#実行制限時間2秒以内に間に合わない

Fixed submission:
n,k = map(int,input().split())
h = list(map(int,input().split()))
dp = [0] * n
t = []
 
for i in range(1,n):
    for l in range(1,k+1):
        if i - l >= 0:
            t.append(abs(h[i] - h[i-l]) + dp[i-l])
        else:
            break
    dp[i] = min(t)
    t.clear()
 
print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
h = list(map(int,input().split()))
dp = [0] * n
t = []

for i in range(1,n):
    for l in range(1,k+1):
        if not i - l < 0:
            t.append(abs(h[i] - h[i-l]) + dp[i-l])
        else:
            break

    dp[i] = min(t)
    t.clear()

print(dp[-1])

Fixed submission:
n,k = map(int,input().split())
h = list(map(int,input().split()))
dp = [0] * n
t = []
 
for i in range(1,n):
    for l in range(1,k+1):
        if i - l >= 0:
            t.append(abs(h[i] - h[i-l]) + dp[i-l])
        else:
            break
    dp[i] = min(t)
    t.clear()
 
print(dp[-1])
Buggy python submission (verdict: Time Limit Exceeded):
n, W = map(int, input().split())
l = [list(map(int, input().split())) for i in range(n)]
w, v = [list(i) for i in zip(*l)]
dp = [[0] * (W+1) for i in range(n+1)]
for i in range(1, n+1):
    for j in range(W+1):
        if j - w[i-1] >= 0:
            dp[i][j] = max(dp[i-1][j], dp[i-1][j-w[i-1]]+v[i-1])
        else:
            dp[i][j] = dp[i-1][j]
print(dp[n][W])


Fixed submission:
n, W = map(int, input().split())
l = [list(map(int, input().split())) for i in range(n)]
w, v = [list(i) for i in zip(*l)]
dp = [[0] * (W+1) for i in range(n+1)]
for i in range(1, n+1):
    for j in range(W+1):
        if j - w[i-1] >= 0:
            dp[i][j] = max(dp[i-1][j], dp[i-1][j-w[i-1]]+v[i-1])
        else:
            dp[i][j] = dp[i-1][j]
print(dp[n][W])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = list(map(float,input().split()))
dp = [[0] * (n+1) for i in range(n+1)]
dp[0][0] = 1
for i in range(1,n+1):
    for j in range(i+1):
        if j > 0:
            dp[i][j] = dp[i-1][j]*(1-p[i-1])+dp[i-1][j-1]*p[i-1]
        else:
            dp[i][j] = dp[i-1][j]*(1-p[i-1])
ans = 0
for i in range(n//2+1,n+1):
    ans += dp[n][i]
print(ans)

Fixed submission:
n = int(input())
p = list(map(float,input().split()))
dp = [[0] * (n+1) for i in range(n+1)]
dp[0][0] = 1
for i in range(1,n+1):
    for j in range(i+1):
        if j > 0:
            dp[i][j] = dp[i-1][j]*(1-p[i-1])+dp[i-1][j-1]*p[i-1]
        else:
            dp[i][j] = dp[i-1][j]*(1-p[i-1])
ans = 0
for i in range(n//2+1,n+1):
    ans += dp[n][i]
print(ans)
Buggy python submission (verdict: Runtime Error):
from math import sqrt
from math import floor
n,p = map(int,input().split())
l = [p]
for i in range(2,floor(sqrt(p))+1):
    if p % i == 0:
        l.append(i)
        l.append(p//i)
l.sort()
s = []
i = 0
while p > 1:
    if p % l[i] == 0:
        s.append(l[i])
        p = p // l[i]
    else:
        i += 1
print(s[0]*s[-1])

Fixed submission:
from math import sqrt
from math import floor
n,p = map(int,input().split())
l = [p]
for i in range(2,floor(sqrt(p))+1):
    if p % i == 0:
        l.append(i)
        l.append(p//i)
l.sort()
s = [1]
i = 0
while p > 1:
    if p % l[i] == 0:
        s.append(l[i])
        p = p // l[i]
    else:
        i += 1
ans = 1
x = s[0]
y = 1
for i in s[1:]:
    if x == i:
        y += 1
    else:
        while y >= n:
            ans *= x
            y -= n
        x = i
        y = 1
while y >= n:
    ans *= x
    y -= n
print(ans)

Buggy python submission (verdict: Runtime Error):
from math import gcd
n,p = map(int,input().split())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors
m = make_divisors(p)
x = []
i = 1
while p != 1:
    if p % m[i] == 0:
        x.append(m[i])
        p = p // m[i]
    else:
        i += 1
print(gcd(x[0],x[-1]))

Fixed submission:
from math import sqrt
from math import floor
n,p = map(int,input().split())
l = [p]
for i in range(2,floor(sqrt(p))+1):
    if p % i == 0:
        l.append(i)
        l.append(p//i)
l.sort()
s = [1]
i = 0
while p > 1:
    if p % l[i] == 0:
        s.append(l[i])
        p = p // l[i]
    else:
        i += 1
ans = 1
x = s[0]
y = 1
for i in s[1:]:
    if x == i:
        y += 1
    else:
        while y >= n:
            ans *= x
            y -= n
        x = i
        y = 1
while y >= n:
    ans *= x
    y -= n
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = list(input())
p = 0
flg = True
while flg:
    flg = False
    for i in range(len(s)-1):
        if s[i] == 'B' and s[i+1] == 'W':
            s[i] = 'W'
            s[i+1] = 'B'
            p += 1
            flg = True

print(p)

Fixed submission:
s = list(input())
n = len(s)
m = s.count('B')
p = 0
for i in range(n-1):
    if s[i] == 'B':
        p += (n-m) - (i)
        m -= 1

print(p)
Buggy python submission (verdict: Runtime Error):
#n = 候補の数
n = int(input())
#t - h[i] * 0.006
#a = 基準温度
t,a = map(int,input().split())
h = list(map(int,input().split()))
#o = 計算結果格納
o = []

for i in range(n):
    o.append(t - h[i] * 0.006)

#p = 基準温度に最も近い場所の差
p = abs(a - o[0])
#q = 基準地点の番号
q = 0
for i in range(n)[1:]:
    if abs(a - o[i]) < p:
        p = abs(a - o[i])
        q = i

print(q + 1)

Fixed submission:
x,y = map(int,input().split())
print(x + (y // 2))
Buggy python submission (verdict: Runtime Error):
n = input()
print(s.translate(str.maketrans({'1':'9','9':'1'})))

Fixed submission:
n = list(input())
i = 0

while i < 3:
    if n[i] == '1':
        n[i] = '9'
        i = i + 1
    else:
        n[i] = '1'
        i = i + 1

print(''.join(n))

Buggy python submission (verdict: Runtime Error):
n = input()
i = 0
for number in n:
    if number == '1':
        m[i] = '9'
        i = i + 1
    elif number == '9':
        m[i] = '1'
        i = i + 1
    else:
        m[i] = n[i]
        i = i + 1

print(n)

Fixed submission:
n = list(input())
i = 0

while i < 3:
    if n[i] == '1':
        n[i] = '9'
        i = i + 1
    else:
        n[i] = '1'
        i = i + 1

print(''.join(n))

Buggy python submission (verdict: Runtime Error):
n = input()
i = 0
for number in n:
    if number == '1':
        n[i] = '9'
        i = i + 1
    elif number == '9':
        n[i] = '1'
        i = i + 1
    else:
        i = i + 1

print(n)

Fixed submission:
n = list(input())
i = 0

while i < 3:
    if n[i] == '1':
        n[i] = '9'
        i = i + 1
    else:
        n[i] = '1'
        i = i + 1

print(''.join(n))
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = list(range(111,1000,111))

print(l[n // 111])

Fixed submission:
n = int(input())
l = list(range(111,1000,111))

if n % 111 == 0:
    print(n)
else:
    print(l[n // 111])
Buggy python submission (verdict: Time Limit Exceeded):
n,m,x,y = map(int,input().split())
xl = list(map(int,input().split()))
yl = list(map(int,input().split()))
xl.sort(reverse = True)
yl.sort()

if xl[0] < yl[0]:
    p = yl[0]
    while p > x:
        if x < p and p <= y:
            print('No War')
            exit(0)
    print('War')
else:
    print('War')

Fixed submission:
n,m,x,y = map(int,input().split())
xl = list(map(int,input().split()))
yl = list(map(int,input().split()))
xl.append(x)
yl.append(y)
xl.sort()
yl.sort()

if xl[-1] < yl[0]:
    print('No War')
else:
    print('War')

Buggy python submission (verdict: Runtime Error):
n,m,x,y = map(int,input().split())
xl = list(input().split())
yl = list(input().split())
xl.sort(reverse = True)
yl.sort()

if xl[0] < x and yl[0] >= y:
    print('No War')
else:
    print('War')

Fixed submission:
n,m,x,y = map(int,input().split())
xl = list(map(int,input().split()))
yl = list(map(int,input().split()))
xl.append(x)
yl.append(y)
xl.sort()
yl.sort()

if xl[-1] < yl[0]:
    print('No War')
else:
    print('War')
Buggy python submission (verdict: Runtime Error):
N = int(input())
cakeA = round(N / 4)
cakeB = round(N / 7)
count = 0

for a in round(cakeA):
    for b in round(cakeB):
        if (4 * a)+(7 * b) == N:
            count = count + 1
print(count)

Fixed submission:
n = int(input())

for i in range(n):
    for j in range(n):
        if 4 * i + 7 * j == n:
            print('Yes')
            exit(0)

print('No')
Buggy python submission (verdict: Runtime Error):
n = int(input())
i = n
m = 0
while i > 0
    m += i % 10
    i = i // 10

if n % m != 0:
    print('No')
else:
    print('Yes')

Fixed submission:
n = int(input())
i = n
m = 0
while i > 0:
    m += i % 10
    i = i // 10

if n % m != 0:
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
t = 0

while True:
    a.sort(reverse = True)
    x = True
    for i in range(n):
        if a[i] % 2 == 0:
            if x:
                a[i] = a[i] // 2
                x = False
    if x:
        print(t)
        exit(0)
    else:
        t += 1

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

for i in range(n):
    while a[i] % 2 == 0:
        a[i] = a[i] // 2
        t += 1
        
print(t)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
t = 0

while True:
    a.sort(reverse = True)
    x = True
    for i in range(n):
        if a[i] % 2 == 0:
            if x:
                a[i] = a[i] // 2
                x = False
            else:
                a[i] *= 3
        else:
            a[i] * 3
    if x:
        print(t)
        exit(0)
    else:
        t += 1

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

for i in range(n):
    while a[i] % 2 == 0:
        a[i] = a[i] // 2
        t += 1
        
print(t)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
flg = True
t = 0

while flg:
    p = -1
    for i in range(n):
        if a[i] % 2 == 0:
            if p == -1:
                p = i
            else:
                if a[p] < a[i]:
                    p = i

    for i in range(n):
        if i != p:
            a[i] *= 3
        else:
            a[i] = a[i] // 2
    
    if p == -1:
        flg = False
    else:
        t += 1

print(t)

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

for i in range(n):
    while a[i] % 2 == 0:
        a[i] = a[i] // 2
        t += 1
        
print(t)
Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())
ans = 0
for i in range(1,1000):
    for j in range(2,1000):
        if i ** j <= x:
            ans = max(ans,i ** j)
print(ans)

Fixed submission:
x = int(input())
k = 0

for i in range(1,1000):
    for j in range(2,1000):
        if i ** j <= x:
            k = max(k,i ** j)
        else:
            break
    if x // 2 < i:
        break

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

if x > y:
    l += (x - y) * a
    p = y
elif x < y:
    l += (y - x) * b
    p = x
else:
    pass
l += p * 2 * c
n = max(x,y) * 2 * c
m = x * a + y * b
print(min(l,n,m))

Fixed submission:
a,b,c,x,y = map(int,input().split())
l = 0
p = x

if x > y:
    l += (x - y) * a
    p = y
elif x < y:
    l += (y - x) * b
    p = x
else:
    pass
l += p * 2 * c
n = max(x,y) * 2 * c
m = x * a + y * b
print(min(l,n,m))
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
t = 0

for i in range(a,b+1):
    if i % 100 == i // 1000:
        t += 1
    if i % 100 * 10 == i // 1000:
        t += 1

print(t)

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

print(a[0] + b[1] + c[2])
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = list(input().split())
s = set(s)
print(s)
if len(s) == 3:
    print('Three')
else:
    print('Four')

Fixed submission:
n = int(input())
if n < 3:
    print(0)
else:
    print(n // 3)

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = [input().split]
if len(set(s)) == 3:
    print('Three')
else:
    print('Four')

Fixed submission:
n = int(input())
if n < 3:
    print(0)
else:
    print(n // 3)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = list(input().split)
if len(set(s)) == 3:
    print('Three')
else:
    print('Four')

Fixed submission:
n = int(input())
s = list(input().split())
s = set(s)
if len(s) == 3:
    print('Three')
else:
    print('Four')

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

print(len(set(s)))

Fixed submission:
n = int(input())
s = list(input().split())
s = set(s)
if len(s) == 3:
    print('Three')
else:
    print('Four')
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse = True)
Alice = sum(a[::2])
Bob = sum(a[1::2])
print(Alice - )

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
list.sort(a,reverse = True)
k = 0
l = 0

for i in range(n)[::2]:
    k += a[i]

for i in range(n)[1::2]:
    l += a[i]

print(k - l)
Buggy python submission (verdict: Runtime Error):
a,b,c = input().split(/)
a = '2018'
print(a + '/' + b + '/' + c)

Fixed submission:
a,b,c = input().split('/')
a = '2018'
print(a + '/' + b + '/' + c)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

n,y = map(int,input().split())
a = [10000,5000,1000]
l = list(itertools.combinations_with_replacement(a,n))

for i in range(len(l)):
    if sum(l[i]) == y:
        o = l[i].count(10000)
        p = l[i].count(5000)
        q = l[i].count(1000)
        print(o,p,q)
        exit(0)

print('-1 -1 -1')

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

for i in range(0,n+1):
    for j in range(0,n+1-i):
        k = max(0,n-i-j)
        if 10000*i + 5000*j + 1000*k == y:
            print(i,j,k)
            exit(0)

print(-1,-1,-1)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools

n,y = map(int,input().split())
a = [1000,5000,10000]
l = list(itertools.product(a,repeat = n))

for i in range(len(l)):
    if sum(l[i]) == y:
        o = l[i].count(10000)
        p = l[i].count(5000)
        q = l[i].count(1000)
        print(o,p,q)
        exit(0)

print('-1 -1 -1')

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

for i in range(0,n+1):
    for j in range(0,n+1-i):
        k = max(0,n-i-j)
        if 10000*i + 5000*j + 1000*k == y:
            print(i,j,k)
            exit(0)

print(-1,-1,-1)

Buggy python submission (verdict: Runtime Error):
import itertools

n,y = map(int,input().split())
a = [1000,5000,10000]
l = list(itertools.product(a,repeat = n))
print(l)

for i in range(len(l)):
    if sum(l[i]) == y:
        o = l[i].count(10000)
        p = l[i].count(5000)
        q = l[i].count(1000)
        print(o + ' ' + p + ' ' + q)
        exit(0)

print('-1 -1 -1')

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

for i in range(0,n+1):
    for j in range(0,n+1-i):
        k = max(0,n-i-j)
        if 10000*i + 5000*j + 1000*k == y:
            print(i,j,k)
            exit(0)

print(-1,-1,-1)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
ave = (a + b) / 2
print(math.cell(ave))

Fixed submission:
import math
a,b = map(int,input().split())
ave = (a + b) / 2
print(math.ceil(ave))