Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
if __name__ == '__main__':
    # AB = [int(i) for i in input().split()]
    S = str(input())
    K = int(input())
    for i, n in enumerate(S):
        if n+1 == K:
            print(i)
            break
        if i != '1':
            print(i)
            break


Fixed submission:
if __name__ == '__main__':
    # AB = [int(i) for i in input().split()]
    S = str(input())
    K = int(input())
    for n, i in enumerate(S):
        if n+1 == K:
            print(i)
            break
        if i != '1':
            print(i)
            break

Buggy python submission (verdict: Runtime Error):
if __name__ == '__main__':
    #AB = [int(i) for i in input().split()]
    S = input()
    K = int(input())
    for i in S:
        if i == K:
            print(n)
            break
        if i != '1':
	    print(n)
	    break

Fixed submission:
if __name__ == '__main__':
    # AB = [int(i) for i in input().split()]
    S = str(input())
    K = int(input())
    for n, i in enumerate(S):
        if n+1 == K:
            print(i)
            break
        if i != '1':
            print(i)
            break
Buggy python submission (verdict: Time Limit Exceeded):
print(sum(range(int(input()))))

Fixed submission:
n = int(input())

print(n*(n-1)//2)
Buggy python submission (verdict: Time Limit Exceeded):
l, r = [int(x) for x in input().split(' ')]
if (r-l) > 2019:
  print(0)
else:
  a = sorted([x for x in range(l, r+1)])
  res = sorted([i*j%2019 for i in a for j in a if i!=j])
  print(res[0])
 

Fixed submission:
l, r = [int(x) for x in input().split(' ')]

if (r-l) > 2019:
  print(0)
else:
  a = [x for x in range(l, r+1)]
  res = [i*j%2019 for i in a for j in a if i!=j]
  print(min(res))
Buggy python submission (verdict: Runtime Error):
n, m = [int(x) for x in input().split(' ')]
a = set(int(input()) for x in range(m))

m = [0] * n
m[0] = 1 if 1 not in a else 0
m[1] = 2 if 2 not in a else 0

if m[0] == 0 and m[1] == 2:
    m[1] = 1

for i in range(2, n):
    if i+1 not in a:
        m[i] = m[i-1] + m[i-2]

print(m[-1] % 1000000007)


Fixed submission:
n, m = [int(x) for x in input().split(' ')]
a = set(int(input()) for x in range(m))

m = [0] * n
m[0] = 1 if 1 not in a else 0

if n == 1:
    print(m[0])
    exit()

m[1] = 2 if 2 not in a else 0

if m[0] == 0 and m[1] == 2:
    m[1] = 1

for i in range(2, n):
    if i+1 not in a:
        m[i] = m[i-1] + m[i-2]

print(m[-1] % 1000000007)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = [int(x) for x in input().split(' ')]
l, r = [int(x) for x in input().split(' ')]
res = set(range(l, r+1))

for i in range(int(m-1)):
    l, r = [int(x) for x in input().split(' ')]
    res &= set(range(l, r+1))

print(len(res))


Fixed submission:
n, m = [int(x) for x in input().split(' ')]
lr = [(int(l), int(r)) for l, r in [input().split(' ') for _ in range(m)]]

l = max([x[0] for x in lr])
r = min([x[1] for x in lr])

print(r-l+1 if l <= r else 0)
Buggy python submission (verdict: Runtime Error):
from math import ceil
minutes = [int(input()) for _ in range(5)]

x = min([(x, x%10) for x in minutes if x%10 != 0], key=lambda x: x[1])

minutes.remove(x[0])
print(sum([ceil(x/10)*10 for x in minutes])+x[0])


Fixed submission:
from math import ceil
minutes = [int(input()) for _ in range(5)]

arr = [(x, x%10) for x in minutes if x%10 != 0]
if arr:
    x = min(arr, key=lambda x: x[1])
    minutes.remove(x[0])
    print(sum([ceil(x/10)*10 for x in minutes])+x[0])
else:
    print(sum(minutes))
Buggy python submission (verdict: Runtime Error):
n, q = [int(x) for x in input().split(' ')]
s = input()
lr = [[int(x) for x in input().split(' ')] for _ in range(q)]

indexes = []
for i in range(1, len(s)):
    if s[i-1] == 'A' and s[i] == 'C':
        indexes.append([i-1, i])

print('\n'.join([len([x for x in indexes if l-1 <= x[0] and x[1] <= r-1]) for l, r in lr]))


Fixed submission:
n, q = [int(x) for x in input().split(' ')]
s = input()
lr = [[int(x) for x in input().split(' ')] for _ in range(q)]


indexes = [0] * n

for i in range(1, len(s)):
    if s[i-1] == 'A' and s[i] == 'C':
        indexes[i] = indexes[i-1]+1
    else:
        indexes[i] = indexes[i-1]

for l, r in lr:
    print(indexes[r-1]-indexes[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
n, q = [int(x) for x in input().split(' ')]
s = input()
lr = [[int(x) for x in input().split(' ')] for _ in range(q)]

indexes = []
for i in range(1, len(s)):
    if s[i-1] == 'A' and s[i] == 'C':
        indexes.append([i-1, i])

for l, r in lr:
    print(len([x for x in indexes if l-1 <= x[0] and x[1] <= r-1]))



Fixed submission:
n, q = [int(x) for x in input().split(' ')]
s = input()
lr = [[int(x) for x in input().split(' ')] for _ in range(q)]


indexes = [0] * n

for i in range(1, len(s)):
    if s[i-1] == 'A' and s[i] == 'C':
        indexes[i] = indexes[i-1]+1
    else:
        indexes[i] = indexes[i-1]

for l, r in lr:
    print(indexes[r-1]-indexes[l-1])
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
res = 0
opes = [True]
while any(opes):
	opes = []
	for x in ['01', '10']:
		r = s.split(x)
		res += len(r) - 1
		opes.append(len(r)!=1)
		s = ''.join(r)

print(res * 2)

Fixed submission:
from collections import Counter

s = input()
res = Counter(s)
print(min(res['0'], res['1']) * 2)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(x) for x in input().split(' ')]
b = [int(x) for x in input().split(' ')]
 
if sum(a) < sum(b):
    print('-1')
    exit()
 
count = 0
sabun = [(i, a[i]-b[i]) for i, _ in enumerate(a) if a[i]<b[i]]
husoku = sum([x[1] for x in sabun])
a_sorted = sorted(a)
while husoku < 0:
    ma = a_sorted[-1]
    a_sorted = a_sorted[:-1]
    mai = a.index(ma)
    husoku += ma - b[mai]
    a[mai] = b[mai]
    count += 1
 
print(len(sabun) + count)   

Fixed submission:
n = int(input())
a = [int(x) for x in input().split(' ')]
b = [int(x) for x in input().split(' ')]
 
if sum(a) < sum(b):
    print('-1')
    exit()
 
count = 0
sabun = [a[i]-b[i] for i, _ in enumerate(a)]
husoku = sum([x for x in sabun if x<0])
sabun.sort(reverse=True)

for i in sabun:
    if husoku >= 0:
        break
    husoku += i
    count += 1
 
print(len([x for x in sabun if x<0]) + count)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(x) for x in input().split(' ')]
b = [int(x) for x in input().split(' ')]

if sum(a) < sum(b):
    print('-1')
    exit()

count = 0
sabun = [(i, a[i]-b[i]) for i, _ in enumerate(a) if a[i]<b[i]]
husoku = sum([x[1] for x in sabun])

while husoku < 0:
    husoku += max(a) - b[a.index(max(a))]
    a[a.index(max(a))] = b[a.index(max(a))]
    count += 1

print(len(sabun) + count)

Fixed submission:
n = int(input())
a = [int(x) for x in input().split(' ')]
b = [int(x) for x in input().split(' ')]
 
if sum(a) < sum(b):
    print('-1')
    exit()
 
count = 0
sabun = [a[i]-b[i] for i, _ in enumerate(a)]
husoku = sum([x for x in sabun if x<0])
sabun.sort(reverse=True)

for i in sabun:
    if husoku >= 0:
        break
    husoku += i
    count += 1
 
print(len([x for x in sabun if x<0]) + count)
Buggy python submission (verdict: Runtime Error):
n = int(input())
f = [input().split(' ') for _ in range(n)]
p = [input().split(' ') for _ in range(n)]
res = -10**8
for num in range(1, 1024):
  tmp = 0
  for index in range(0, n):
    tmp += int(p[index][len([True for x in range(0, 10) if f[index][x]==f'{num:010b}'[x]=='1'])])
  res = max(tmp, res)

print(res)


Fixed submission:
n = int(input())
f = [input().split(' ') for _ in range(n)]
p = [input().split(' ') for _ in range(n)]
res = -10 ** 7 * n
for num in range(1, 1024):
  tmp = 0
  for index in range(0, n):
    tmp += int(p[index][len([True for x in range(0, 10) if f[index][x]=='{:010b}'.format(num)[x]=='1'])])
  res = max(tmp, res)
print(res)
Buggy python submission (verdict: Runtime Error):
 s = input()
 print(s[0]+str(len(s[1:-1]))+s[-1])

Fixed submission:
s = input()
print(s[0]+str(len(s[1:-1]))+s[-1])
Buggy python submission (verdict: Runtime Error):
n, k = [int(x) for x in input().split(' ')]
ab = [(input().split(' ')) for _ in range(n)]
index = 0

for a, b  in ab:
    index += int(b)
    if index >= k:
        print(a)
        breaka

Fixed submission:
n, k = [int(x) for x in input().split(' ')]
ab = sorted([[int(x) for x in input().split(' ')]  for _ in range(n)])
index = 0

for a in ab:
    index += int(a[1])
    if index >= k:
        print(a[0])
        break
Buggy python submission (verdict: Runtime Error):
n, m = [int(x) for x in input().split(' ')]

edges = set([tuple(input().split(' ')) for _ in range(n)])
edges.update([(x[1], x[0]) for x in list(edges)])


def dfs(node, history):
    ans = 0
    if len(history) == n - 1:
        return 1

    nextnodes = [
        x[1] for x in edges if x[1] not in history and x[0] == node and x[1] != node
    ]
    history.add(node)
    for next in nextnodes:
        ans += dfs(next, history)
    history.remove(node)
    return ans


print(dfs('1', set()))


Fixed submission:
n, m = [int(x) for x in input().split(' ')]
 
edges = set([tuple(input().split(' ')) for _ in range(m)])
edges.update([(x[1], x[0]) for x in list(edges)])
 
 
def dfs(node, history):
    ans = 0
    if len(history) == n - 1:
        return 1
 
    nextnodes = [
        x[1] for x in edges if x[1] not in history and x[0] == node and x[1] != node
    ]
    history.add(node)
    for next in nextnodes:
        ans += dfs(next, history)
    history.remove(node)
    return ans
 
 
print(dfs('1', set()))

Buggy python submission (verdict: Runtime Error):
n, m = [int(x) for x in input().split(' ')]

edges = set([tuple(input().split(' ')) for _ in range(n)])
edges.update([(x[1], x[0]) for x in list(edges)])


def dfs(node, history):
    ans = 0
    if len(history) == n - 1:
        print(history)
        return 1

    nextnodes = [
        x[1] for x in edges if x[1] not in history and x[0] == node and x[1] != node
    ]
    history.add(node)
    for next in nextnodes:
        ans += dfs(next, history)
    history.remove(node)
    return ans


print(dfs('1', set()))


Fixed submission:
n, m = [int(x) for x in input().split(' ')]
 
edges = set([tuple(input().split(' ')) for _ in range(m)])
edges.update([(x[1], x[0]) for x in list(edges)])
 
 
def dfs(node, history):
    ans = 0
    if len(history) == n - 1:
        return 1
 
    nextnodes = [
        x[1] for x in edges if x[1] not in history and x[0] == node and x[1] != node
    ]
    history.add(node)
    for next in nextnodes:
        ans += dfs(next, history)
    history.remove(node)
    return ans
 
 
print(dfs('1', set()))

Buggy python submission (verdict: Runtime Error):
n, m = [int(x) for x in input().split(' ')]

edges = set([tuple(input().split(' ')) for _ in range(n)])
edges.update([(x[1], x[0]) for x in list(edges)])


def dfs(node, history):
    ans = 0
    if len(history) == n:
        return 1

    nextnodes = [
        x[1] for x in edges if x[1] not in history and x[0] == node and x[1] != node
    ]
    for next in nextnodes:
        ans += dfs(next, history | set(next))
    return ans


print(dfs('1', set(['1'])))

Fixed submission:
n, m = [int(x) for x in input().split(' ')]
 
edges = set([tuple(input().split(' ')) for _ in range(m)])
edges.update([(x[1], x[0]) for x in list(edges)])
 
 
def dfs(node, history):
    ans = 0
    if len(history) == n - 1:
        return 1
 
    nextnodes = [
        x[1] for x in edges if x[1] not in history and x[0] == node and x[1] != node
    ]
    history.add(node)
    for next in nextnodes:
        ans += dfs(next, history)
    history.remove(node)
    return ans
 
 
print(dfs('1', set()))
Buggy python submission (verdict: Time Limit Exceeded):
import re
S = input()
N = len(S)
r = re.compile(r"01|10")
T = ""
while S != T:
    T = S
    S = r.sub("", S)
print(N - len(S))
r.sub("", S)


Fixed submission:
S = input()
s = abs(S.count("0") - S.count("1"))
print(len(S) - s)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import OrderedDict
N, M = map(int, input().split())
L = [list(map(int, input().split())) for _ in range(M)]
IDs = OrderedDict()
result = [None] * M
for i, (p, y) in enumerate(L):
    if p not in IDs:
        IDs[p] = OrderedDict()
    IDs[p][y] = i
P = sorted(IDs.keys())
for p in P:
    Y = sorted(IDs[p].keys())
    for i, y in enumerate(Y):
        result[IDs[p][y]] = "{:06}{:06}".format(p, i + 1)
for r in result:
    print(r)


Fixed submission:
N, M = map(int, input().split())
L = [list(map(int, input().split())) for _ in range(M)]
Y = sorted([(i, (p, y)) for i, (p, y) in enumerate(L)], key=lambda x: x[1])
result = [""] * M
x = 0
before_p = 0
for i, (p, y) in Y:
    if before_p != p:
        x = 0
        before_p = p
    x += 1
    result[i] = "{:06}{:06}".format(p, x)
for r in result:
    print(r)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
T = input()
n = len(S)
for i in range(n):
    s = S[i]
    t = T[i]
    S = S.translate(str.maketrans({s: t, t: s}))
if S == T:
    print("Yes")
else:
    print("No")


Fixed submission:
S = input()
T = input()
st = {}
ts = {}
for s, t in zip(S, T):
    if s in st and st[s] != t:
        print("No")
        exit()
    if t in ts and ts[t] != s:
        print("No")
        exit()
    st[s] = t
    ts[t] = s
print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(input()) for _ in range(N)]
result = []
for a in A:
    if a in result:
        result.remove(a)
    else:
        result.append(a)
print(len(result))


Fixed submission:
from collections import Counter
N = int(input())
A = Counter([int(input()) for _ in range(N)])
num = 0
for a, n in A.items():
    if n % 2 == 1:
        num += 1
print(num)
Buggy python submission (verdict: Runtime Error):
N = int(intput())
if N == 1:
  print(1)
  exit()
X = [2, 4, 8, 16, 32, 64, 128]
for i, x in enumerate(X):
  if N < x:
    print(X[i - 1])


Fixed submission:
N = int(input())
if N == 1:
    print(1)
    exit()
X = [2, 4, 8, 16, 32, 64, 128]
for i, x in enumerate(X):
    if N < x:
        print(X[i - 1])
        exit()
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int, input().split()))
X = [str(A[0])]
append_ = True if n % 2 != 0 else False
for a in A[1:]:
    if append_:
        X.append(str(a))
    else:
        X.insert(0, str(a))
    append_ = not append_
print(" ".join(X))


Fixed submission:
from collections import deque
n = int(input())
A = list(map(int, input().split()))
X = deque([str(A[0])])
append_ = True if n % 2 != 0 else False
for a in A[1:]:
    if append_:
        X.append(str(a))
    else:
        X.appendleft(str(a))
    append_ = not append_
print(" ".join(X))
Buggy python submission (verdict: Runtime Error):
import math
a,b = list(map(int, input().split())
if a > b:
	print(1)
else:
	print(math.ceil(b/a))

Fixed submission:
a, b = list(map(int, input().split()))
ans, outlet = 0, 1
while outlet < b:
  outlet -= 1
  outlet += a
  ans+=1
print(ans)

Buggy python submission (verdict: Runtime Error):
m, n = input().split()
m, n = int(m), int(n)
 
tot = 0
a = 1
while a<n:
  a-=1
  a+=m
  tot+=1
 
print(c)

Fixed submission:
m, n = input().split()
m, n = int(m), int(n)
 
tot = 0
a = 1
while a<n:
  a-=1
  a+=m
  tot+=1
 
print(tot)
Buggy python submission (verdict: Runtime Error):
N, L= map(int,input().split())
alldata = sorted([input() for i in range(N)])
print("".join(data))


Fixed submission:
a = map(int,input().split())
if sorted(a) == [5,5,7]:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
N, L= map(int,input().split())
alldata = sorted([input() for i in range(N)])
print("".join(data))


Fixed submission:
N, L= map(int,input().split())
data = sorted([input() for i in range(N)])
print("".join(data))
Buggy python submission (verdict: Runtime Error):
A = int(input()) #ここで標準入力
B = int(input()) #ここで標準入力

C = A/B + 1

print(C)

Fixed submission:
import sys
def input():
    return sys.stdin.readline()[:-1]

# 整数複数個
A, B = map(int, input().split())

C = -((-B+1) // (A-1))
print(C)

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
min_ans = b // a
mod_ans = b % a

if ((min_ans - mod_ans) > 0) :
  print(min_ans)
else : 
  print(mins_ans + 1)

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

ans = (a + b - 3) // (a - 1)
print(ans)

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
ans = b // a

if(b % a == 0) :
  print(ans)
else :
  print(ans + 1)

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

ans = (a + b - 3) // (a - 1)
print(ans)

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
strip = b // a
emp = b % a
ans = strip + (strip // emp)
print(ans)

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

ans = (a + b - 3) // (a - 1)
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b=map(int, input().split())
print(max(a+b,a-b,a*b)

Fixed submission:
a,b=map(int, input().split())
print(max(a+b,a-b,a*b))

Buggy python submission (verdict: Runtime Error):
if A+B > A-B and A*B:
  print(A+B)
elif A-B > A+B and A*B :
  print(A-B)
else A*B > A+B and A-B :
  print(A*B)

Fixed submission:
a,b=map(int, input().split())
print(max(a+b,a-b,a*b))
Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int, input().split())
L = []
for i in range(1,M+1):
    if M % i == 0:
        L.append(i)
L1 = [i for i in L if M / i >= N]
print(max(L1))

Fixed submission:
import math
N,M = map(int, input().split())
L = []
 
for i in range(1,math.floor(math.sqrt(M))+1):
    if M % i == 0:
        L.append(i)
        L.append(int(M / i))
L1 = [i for i in L if M / i >= N]
print(max(L1))
Buggy python submission (verdict: Runtime Error):
A,B,C = map(int, input(),split())
L = sorted([A,B,C])
print(10*L[0]+L[1]+L[2])

Fixed submission:
A,B,C = map(int, input().split())
L = sorted([A,B,C])
print(10*L[2]+L[1]+L[0])

Buggy python submission (verdict: Runtime Error):
A,B,C = map(int,input().split())
L = sorted[A,B,C]
print(10*L[1]+L[2]+L[3])

Fixed submission:
A,B,C = map(int, input().split())
L = sorted([A,B,C])
print(10*L[2]+L[1]+L[0])
Buggy python submission (verdict: Runtime Error):
S = list(input().split())
T = list(input().split())

Sn = [ord(i)-ord("a") for i in S]
Tn = [ord(i)-ord("a") for i in T]
sub1 = [-1]*26
sub2 = [-1]*26

for i in range(len(S)):
    if sub1[Sn[i]] == -1 or sub2[Tn[i]] == -1:
        if sub1[Sn[i]] == -1:
            sub1[Sn[i]] = Tn[i]
        if sub2[Tn[i]] == -1:
            sub2[Tn[i]] = Sn[i]
    if sub1[Sn[i]] != Tn[i] or sub2[Tn[i]] != Sn[i]:
            print("No")
            break
else:
    print("Yes")

Fixed submission:
S = list(input())
T = list(input())
 
Sn = [ord(i)-ord("a") for i in S]
Tn = [ord(i)-ord("a") for i in T]
sub1 = [-1]*26
sub2 = [-1]*26
 
for i in range(len(S)):
    if sub1[Sn[i]] == -1 or sub2[Tn[i]] == -1:
        if sub1[Sn[i]] == -1:
            sub1[Sn[i]] = Tn[i]
        if sub2[Tn[i]] == -1:
            sub2[Tn[i]] = Sn[i]
    if sub1[Sn[i]] != Tn[i] or sub2[Tn[i]] != Sn[i]:
            print("No")
            break
else:
    print("Yes")
Buggy python submission (verdict: Runtime Error):
R = int(input())
if R < 1200:
    print("ABC")
elif 1200 <= R < 2800:
    print("ARC")
else print("AGC")

Fixed submission:
R = int(input())
if R < 1200:
    print("ABC")
elif 1200 <= R < 2800:
    print("ARC")
else :
    print("AGC")

Buggy python submission (verdict: Runtime Error):
R = input()
if R < 1200:
    print("ABC")
elif 1200 <= R < 2800:
    print("ARC")
else print("AGC")

Fixed submission:
R = int(input())
if R < 1200:
    print("ABC")
elif 1200 <= R < 2800:
    print("ARC")
else :
    print("AGC")
Buggy python submission (verdict: Runtime Error):
A = list(map(int(), input().split()))
print(max(A)-min(A))

Fixed submission:
A = list(map(int, input().split()))
print(max(A)-min(A))
Buggy python submission (verdict: Runtime Error):
N = input()
if N%2 == 1:
    print(2*N)
else:
    print(N)

Fixed submission:
N = int(input())
if N%2 == 1:
    print(2*N)
else:
    print(N)
Buggy python submission (verdict: Runtime Error):
N,Y = map(int,input().split())
A = list(range(0,N+1))
B = list(range(0,N-A+1))
a=-1
b=-1
c=-1
for i in A:
    for j in B:
        if 10000*i+5000*j+1000*(N-i-j) == Y:
            a=i
            b=j
            c=N-i-j
            break
print(a,b,c)

Fixed submission:
N,Y = map(int,input().split())
A = list(range(0,N+1))
a=-1
b=-1
c=-1
for i in A:
    for j in list(range(0,N-i+1)):
        if 10000*i+5000*j+1000*(N-i-j) == Y:
            a=i
            b=j
            c=N-i-j
            break
print(a,b,c)

Buggy python submission (verdict: Runtime Error):
N,Y = map(int,input().split())
A = list(range(0,N+1))
B = list(range(0,N-A+1))
a=-1
b=-1
c=-1
for i in A:
    for j in B:
        if 10000*i+5000*j+1000*(N-i-j) == Y:
            a=i
            b=j
            c=N-i-j
            break
a=str(a)
b=str(b)
c=str(c)
print(a+" "+b+" "+c)

Fixed submission:
N,Y = map(int,input().split())
A = list(range(0,N+1))
a=-1
b=-1
c=-1
for i in A:
    for j in list(range(0,N-i+1)):
        if 10000*i+5000*j+1000*(N-i-j) == Y:
            a=i
            b=j
            c=N-i-j
            break
print(a,b,c)

Buggy python submission (verdict: Runtime Error):
N,Y = map(int,input().split())
A = list(range(0,N+1))
B = list(range(0,N-A+1))
a=-1
b=-1
c=-1
for i in A:
    for j in B:
        if 10000*i+5000*j+1000*(N-i-j) == Y:
            a=i
            b=j
            c=N-i-j
            break
print([a,b,c])

Fixed submission:
N,Y = map(int,input().split())
A = list(range(0,N+1))
a=-1
b=-1
c=-1
for i in A:
    for j in list(range(0,N-i+1)):
        if 10000*i+5000*j+1000*(N-i-j) == Y:
            a=i
            b=j
            c=N-i-j
            break
print(a,b,c)
Buggy python submission (verdict: Runtime Error):
x = input()
def f(x):
    return sum(map(int, list(str(x))))
if x % f(x) == 0:
    print("Yes")
else:
    print("No")

Fixed submission:
x = int(input())
def f(x):
    return sum(map(int, list(str(x))))
if x % f(x) == 0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
K,S = map(int,input().split())
c=0
L=list(range(0,K+1))
for i in L:
    for j in L:
        for k in L:
            if i+j+k == S:
                c+=1
print(c)

Fixed submission:
K,S = map(int, input().split())
res = 0
for x in range(0,K+1):
    for y in range(0,K+1):
        if 0 <= S - x - y <= K:
            res += 1
print(res)

Buggy python submission (verdict: Runtime Error):
K,S = int(input())
c=0
L=list(range(0,K+1))
for i in L:
    for j in L:
        for k in L:
            if i+j+k == S:
                c+=1
print(c)

Fixed submission:
K,S = map(int, input().split())
res = 0
for x in range(0,K+1):
    for y in range(0,K+1):
        if 0 <= S - x - y <= K:
            res += 1
print(res)