Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
a, b, c, k = map(int, input().split())
s = 0
while(0 < a and 0 < k):
    s += 1
    k -= 1
    a -= 1
while(0 < b and 0 < k):
    k -= 1
    b -= 1
while(0 < c and 0 < k):
    s -= 1
    k -= 1
    c -= 1
print(s)


Fixed submission:
a, b, c, k = map(int, input().split())
s = 0
if a >= k:
    s = k
elif  a + b >= k:
    s = a
else:
    s = a - (k - a - b) 
print(s)

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
k = int(input())
s = 0
if  a + b >= k:
    s = a
else:
    s = a - (c - b) 
print(s)

Fixed submission:
a, b, c, k = map(int, input().split())
s = 0
if a >= k:
    s = k
elif  a + b >= k:
    s = a
else:
    s = a - (k - a - b) 
print(s)

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
k = int(input())
s = 0
if  a + b >= k:
    s = a
else:
    s = a - c 
print(s)

Fixed submission:
a, b, c, k = map(int, input().split())
s = 0
if a >= k:
    s = k
elif  a + b >= k:
    s = a
else:
    s = a - (k - a - b) 
print(s)

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
k = int(input())
s = 0
if 0 < a and 0 < k:
    s += a
    k -= a
elif 0 < b and 0 < k:
    k -= b
elif 0 < c and 0 < k:
    s -= c
    k -= c
print(s)

Fixed submission:
a, b, c, k = map(int, input().split())
s = 0
if a >= k:
    s = k
elif  a + b >= k:
    s = a
else:
    s = a - (k - a - b) 
print(s)

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
k = int(input())
s = 0
while(0 < a and 0 < k):
    s += 1
    k -= 1
    a -= 1
while(0 < b and 0 < k):
    k -= 1
    b -= 1
while(0 < c and 0 < k):
    s -= 1
    k -= 1
    c -= 1
print(s)

Fixed submission:
a, b, c, k = map(int, input().split())
s = 0
if a >= k:
    s = k
elif  a + b >= k:
    s = a
else:
    s = a - (k - a - b) 
print(s)
Buggy python submission (verdict: Runtime Error):
S = input()
if s == 'ABC':
    print("ARC")
elif s == 'ARC':
    print('ABC')

Fixed submission:
S = input()
if S == 'ABC':
    print("ARC")
elif S == 'ARC':
    print('ABC')

Buggy python submission (verdict: Runtime Error):
x,y = map(int, input().split())
count = 0

if y >= 2*x and y <= 4*x and y % 2 == 0:
    print('Yes')
else:
    print('No') 


Fixed submission:
S = input()
if S == 'ABC':
    print("ARC")
elif S == 'ARC':
    print('ABC')
Buggy python submission (verdict: Runtime Error):
import math
x = int(input())
n = 100
y = 0

while x > n:
    # 小数点以下切り捨て
    n += n // 100
    y += 1

print(y)

Fixed submission:
# ABC166 B
n,k = map(int, input().split())
# お菓子を持っているすぬけ君かを判断する配列d 1ならもってる 0はもってない
d = [0] * n
# お菓子iを持っているのはどのすぬけ君か？
for i in range(k):
    # お菓子iを持っている人数m人
    m = int(input())
    # お菓子iを持っているすぬけ君のリスト
    a = list(map(int, input().split()))
    for j in range(m):
        # すぬけ君a[j]は少なくとも一つ以上のお菓子を持っている
        d[a[j]-1] = 1 
        
#いたずらされる人数ans人
ans = 0
for i in range(n):
    if d[i] == 0:
        ans += 1

print(ans)

Buggy python submission (verdict: Runtime Error):
n,k = map(int, input().split())
# お菓子を持っているすぬけ君かを判断する配列d 1ならもってる 0はもってない
d = [0] * n
# お菓子iを持っているのはどのすぬけ君か？
for i in range(k):
    # お菓子iを持っている人数m人
    m = int(input())
    # お菓子iを持っているすぬけ君のリスト
    a = list(map(int, input().split()))
    for j in a:
        # すぬけ君a[j]は少なくとも一つ以上のお菓子を持っている
        d[a[j]-1] = 1 
        
#いたずらされる人数ans人
ans = 0
for i in range(n):
    if d[i] == 0:
        ans += 1

print(ans)

Fixed submission:
# ABC166 B
n,k = map(int, input().split())
# お菓子を持っているすぬけ君かを判断する配列d 1ならもってる 0はもってない
d = [0] * n
# お菓子iを持っているのはどのすぬけ君か？
for i in range(k):
    # お菓子iを持っている人数m人
    m = int(input())
    # お菓子iを持っているすぬけ君のリスト
    a = list(map(int, input().split()))
    for j in range(m):
        # すぬけ君a[j]は少なくとも一つ以上のお菓子を持っている
        d[a[j]-1] = 1 
        
#いたずらされる人数ans人
ans = 0
for i in range(n):
    if d[i] == 0:
        ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
N,R = map(int,input().split)
if N < 10:
  R = R - 100 * (10 - N)
  print(R)
else:
  print(R)

Fixed submission:
N,R = map(int,input().split())
if N < 10:
  R = R + 100 * (10 - N)
  print(R)
else:
  print(R)

Buggy python submission (verdict: Runtime Error):
N,R = map(int,input().split)
if N < 10:
  R = 100 * (10 - N)
  print(R)
else:
  print(R)

Fixed submission:
N,R = map(int,input().split())
if N < 10:
  R = R + 100 * (10 - N)
  print(R)
else:
  print(R)

Buggy python submission (verdict: Runtime Error):
N,R = map(int,input())
if N < 10:
  R = 100 * (10 - N)
  print(R)
else:
  print(R)

Fixed submission:
N,R = map(int,input().split())
if N < 10:
  R = R + 100 * (10 - N)
  print(R)
else:
  print(R)
Buggy python submission (verdict: Runtime Error):
N = int(input())
for i in range(1, 10):
    if N % i == 0 and N / i <= 9:
        print('Yes')
        exit(1)
print('No')


Fixed submission:
N = int(input())
flag = False
for i in range(1, 10):
    if N % i == 0 and int(N / i) <= 9:
        flag = True
        break

if flag:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N = int(input())
l = [105, 135, 165, 189, 195]
for i in range(5):
    if N < l[i]:
        print(i)
        exit(1)
print(5)


Fixed submission:
N = int(input())
l = [105, 135, 165, 189, 195]
for i in range(5):
    if N < l[i]:
        print(i)
        exit()
print(5)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = [int(i) for i in input().split()]
islands = list(range(0, -(n+1), -1))
island_group = 1
bridges = []
for _ in range(m):
    bridges.append([int(i) for i in input().split()])

connection = []
for i, j in bridges[::-1]:
    if islands[i] == islands[j]:
        connection.append(0)
    else:
        connection.append(islands.count(islands[i]) * islands.count(islands[j]))
        group1, group2 = islands[i], islands[j]
        for k, v in enumerate(islands[:]):
            if v == group1 or v == group2:
                islands[k] = island_group
        island_group += 1

sum_ = 0
for i in connection[::-1]:
    sum_ += i
    print(sum_)


Fixed submission:
class UnionFind:
    def __init__(self, n):
        self._par = [i for i in range(n + 1)]
        self._size = [1] * (n + 1)

    def find(self, x):
        if self._par[x] == x:
            return x
        else:
            self._par[x] = self.find(self._par[x])
            return self._par[x]

    def is_same_root(self, x, y):
        x = self.find(x)
        y = self.find(y)
        return x == y

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self._size[x] < self._size[y]:
            self._par[x] = y
            self._size[y] += self._size[x]
        else:
            self._par[y] = x
            self._size[x] += self._size[y]

    def size(self, x):
        return self._size[self.find(x)]


def main():
    n, m = [int(i) for i in input().split()]
    bridges = [[int(i) for i in input().split()] for _ in range(m)]

    union_find = UnionFind(n)
    connection = []
    for i, j in bridges[::-1]:
        if union_find.is_same_root(i, j):
            connection.append(0)
        else:
            connection.append(union_find.size(i) * union_find.size(j))
            union_find.unite(i, j)

    sum_ = 0
    for i in connection[::-1]:
        sum_ += i
        print(sum_)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
h = list(map(int, input().split()))

dp = [float('inf') for _ in range(len(h))]
dp[0] = 0

for i in range(len(dp)):
    for j in range(max(i - K, 0), i):
        dp[i] = min(dp[i], dp[j] + abs(h[j] - h[i]))

print(dp[-1])


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

dp = [float('inf') for _ in range(len(h))]
dp[0] = 0

for i in range(len(dp)):
    for j in range(max(i - K, 0), i):
        dp[i] = min(dp[i], dp[j] + abs(h[j] - h[i]))

print(dp[-1])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

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

ans = 1
a_in = [s for s in a if 0 in a]
if a_in:
    print('0')
    exit()
else:
    for i in a:
        ans = ans * i

        if ans > 10 ** 18:
            print('-1')
            exit()

print(ans)


Fixed submission:
n = int(input())

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

ans = 1
if min(a) == 0:
    print('0')
    exit()
else:
    for i in a:
        ans = ans * i

        if ans > 10 ** 18:
            print('-1')
            exit()

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, a, b = map(int, input().split())

ans = 0
test = 0
while n > test:
    test += a + b
    if n >= test:
        ans += a
    else:
        x = test - n
        if x > b:
            ans += a - (x - b)
        else:
            ans += a

print(ans)

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

q = n // (a + b)

x = a * q

w = n % (a + b)
if w >= a:
    y = a
else:
    y = w

ans = x + y

print(ans)
Buggy python submission (verdict: Runtime Error):
import math

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

ans = a * b // math.gcd(a, b)

print(ans)

Fixed submission:
import fractions

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

ans = a * b // fractions.gcd(a, b)

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

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)
a = divisors[-1]
b = divisors[-2]
print(a + b - 2)

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

if 1 <= a <= 9:
    if 1 <= b <= 9:
        print(a * b)
        exit()
print("-1")
Buggy python submission (verdict: Runtime Error):
N,T = map(int, input().split())
ans = 1005
for i in range(N):
    c,t = map(int, input().split())
    if t <= T:
        ans = min(ans, c)
print("TLE" if m == 1005 else ans)


Fixed submission:
N,T = map(int, input().split())
ans = 1005
for i in range(N):
    c,t = map(int, input().split())
    if t <= T:
        ans = min(ans, c)
print("TLE" if ans == 1005 else ans)
Buggy python submission (verdict: Runtime Error):
a,b = input().split()
t = int(a+b)
print("Yes" if t == int(c**0.5)**2 else "No")


Fixed submission:
a,b = input().split()
t = int(a+b)
flag = False
for i in range(t//2 + 1):
    if i**2 == t:
        flag = True
        break
if flag: print("Yes")
else: print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
Q = int(input())
for _ in range(Q):
    B,C = map(int, input().split())
A.sort()
ans = 0
for a in range(Q) :
    x=C if A=B else 0
    ans = sum(A)
print(ans)
        

Fixed submission:
a = input()
if a.isupper()== True :
    print('A')
else :
    print('a')
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input())
A = list(map(int,input().split()))
B = len(A)
ans = 1
a = 0
for a in range(B) :
    ans = ans*A[a]
    if ans > 10**18 :
        ans = -1
    else :
        a += 1
print(ans)

Fixed submission:
import numpy as np
N = int(input())
A = list(map(int,input().split()))
B = len(A)
ans = 1
a = 0
for a in range(B) :
    ans = ans*A[a] 
    if ans > 10**18 :
        if 0 in A :
            ans = 0
        else :
            ans = -1 
        break
    else :
        a += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input())
A = list(map(int,input().split()))
B = len(A)
ans = 1
a = 0
for a in range(B) :
    ans = ans*A[a]
    a += 1
if ans > 10**18 :
    ans = -1
print(ans)

Fixed submission:
import numpy as np
N = int(input())
A = list(map(int,input().split()))
B = len(A)
ans = 1
a = 0
for a in range(B) :
    ans = ans*A[a] 
    if ans > 10**18 :
        if 0 in A :
            ans = 0
        else :
            ans = -1 
        break
    else :
        a += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
import math

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

tan=h*30+0.5*m
cho=6*m

kakudo=float(100)

if math.sqrt((tan-cho)*(tan-cho))>180:
	kakudo=360-math.sqrt((tan-cho)*(tan-cho))
	print(math.sqrt(a*a+b*b-2*a*b*(math.cos(math.radians(kakudo)))))

if math.sqrt((tan-cho)*(tan-cho))==180:
	print(a+b)

if math.sqrt((tan-cho)*(tan-cho))<180:
	kakudo=math.sqrt((tan-cho)*(tan-cho))
	print(math.sqrt(a*a+b*b-2*a*b*(math.cos(math.radians(kakudo)))))

Fixed submission:
n=input()

if int(n[-1])==2:
    print("hon")
elif int(n[-1])==4:
    print("hon")
elif int(n[-1])==5:
    print("hon")
elif int(n[-1])==7:
    print("hon")
elif int(n[-1])==9:
    print("hon")
elif int(n[-1])==0:
    print("pon")
elif int(n[-1])==1:
    print("pon")
elif int(n[-1])==6:
    print("pon")
elif int(n[-1])==8:
    print("pon")
else:
    print("bon")

Buggy python submission (verdict: Runtime Error):
k=int(input())
s=str(input())

if len(s)<=k:
    print(s)
elif len(s)>k:
    print(s[0:k]+'...')

Fixed submission:
n=input()

if int(n[-1])==2:
    print("hon")
elif int(n[-1])==4:
    print("hon")
elif int(n[-1])==5:
    print("hon")
elif int(n[-1])==7:
    print("hon")
elif int(n[-1])==9:
    print("hon")
elif int(n[-1])==0:
    print("pon")
elif int(n[-1])==1:
    print("pon")
elif int(n[-1])==6:
    print("pon")
elif int(n[-1])==8:
    print("pon")
else:
    print("bon")
Buggy python submission (verdict: Runtime Error):
a,b,c,k = map(int,input().split())

if k<=a:
	amount=k
	print(amount)
elif k<=a+b:
	amount=a
	print(amount)
else:
	amount=a+(-1)*(k-a-b)
	print(amount)

Fixed submission:
s=str(input())
t=str(input())
if len(s)-len(t)==-1:
	if s==t[0:len(s)]:
		print("Yes")
	else:
		print("No")
else:
	print("No")
Buggy python submission (verdict: Runtime Error):
x=int(input()
for i in range(-200,200):
      for j in range(-200,200):
        if i**5-j**5==x:
          print(str(i)+" "+str(j)
          exit()

Fixed submission:
x=int(input())
for i in range(-200,200):
      for j in range(-200,200):
        if i**5-j**5==x:
          print(str(i)+" "+str(j))
          exit()
Buggy python submission (verdict: Runtime Error):
k=input()
a,b = map(int, input().split())
ans="NG"
while a <= b:
  if a%k=0:
    ans ="OK"
  else:
    a=a+1
print(ans)

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


ps = int(A / K)
pa = A % K
qs = int(B / K)
qa = B % K

if A==B:
	if pa==0:
		print("OK")
	else:
		print("NG")
else:
	if qs-ps>0:
		print("OK")
	else:
		if pa==0 or qa ==0:
			print("OK")
		else:
			print("NG")

Buggy python submission (verdict: Runtime Error):
a,b,n=map(int,(input().split())
x = min(b-1,n)
print(int(a*x/b)-a*int(x/b))

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


ps = int(A / K)
pa = A % K
qs = int(B / K)
qa = B % K

if A==B:
	if pa==0:
		print("OK")
	else:
		print("NG")
else:
	if qs-ps>0:
		print("OK")
	else:
		if pa==0 or qa ==0:
			print("OK")
		else:
			print("NG")

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


ps = int(A / K)
pa = A % K
qs = int(B / K)
qa = B % K

if A==B:
	if p==0:
		print("OK")
	else:
		print("NG")
else:
	if qs-ps>0:
		print("OK")
	else:
		if pa+qa >K:
			print("OK")
		else:
			print("NG")


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


ps = int(A / K)
pa = A % K
qs = int(B / K)
qa = B % K

if A==B:
	if pa==0:
		print("OK")
	else:
		print("NG")
else:
	if qs-ps>0:
		print("OK")
	else:
		if pa==0 or qa ==0:
			print("OK")
		else:
			print("NG")
Buggy python submission (verdict: Runtime Error):
a,b,n=map(int,(inpur().split())
x = min(b-1,n)
print(int(a*x/b)-a*int(x/b))

Fixed submission:
a,b,n=map(int,input().split())
x = min(b-1,n)
print(int(a*x/b)-a*int(x/b))
Buggy python submission (verdict: Runtime Error):
# a:高橋 体力
# b:高橋 攻撃力
# c:青木　体力
# d:青木　攻撃力

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

while c > 0:
  c = c-b　#青木体力
  if c <= 0:
    print("Yes")
  a = a-d
  if a <= 0:
    print("No")
  

Fixed submission:
s, w = map(int, input().split())
if s > w:
  print("safe")
else:
  print("unsafe")

Buggy python submission (verdict: Runtime Error):
s, w = map(int, input().strip())

if s > w:
  print("safe")
else:
  print("unsafe")


Fixed submission:
s, w = map(int, input().split())
if s > w:
  print("safe")
else:
  print("unsafe")

Buggy python submission (verdict: Runtime Error):
s, w = map(int, input().strip())
print(s)
print(w)
#if s > w:
#  print("safe")
#else:
#  print("unsafe")


Fixed submission:
s, w = map(int, input().split())
if s > w:
  print("safe")
else:
  print("unsafe")

Buggy python submission (verdict: Runtime Error):
s, w = map(int, input().strip())
print s
if s > w:
  print("safe")
else:
  print("unsafe")

Fixed submission:
s, w = map(int, input().split())
if s > w:
  print("safe")
else:
  print("unsafe")

Buggy python submission (verdict: Runtime Error):
s, w = map(int, input().strip())
if s > w:
  print("safe")
else:
  print("unsafe")
        


Fixed submission:
s, w = map(int, input().split())
if s > w:
  print("safe")
else:
  print("unsafe")

Buggy python submission (verdict: Runtime Error):
s, w = map(int, input().strip())
if s > w:
  print("safe")
else:
  print("unsafe)
        

Fixed submission:
s, w = map(int, input().split())
if s > w:
  print("safe")
else:
  print("unsafe")
Buggy python submission (verdict: Runtime Error):
# a:高橋 体力
# b:高橋 攻撃力
# c:青木　体力
# d:青木　攻撃力

a,b,c,d = int(input().split())

while c > 0:
  c = c-b　#青木体力
  if c <= 0:
    print("Yes")
  a = a-d
  if a <= 0:
    print("No")
  

Fixed submission:
def main():

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

    while c > 0:
        c = c - b
        if c <= 0:
            print("Yes")
            return
        a = a - d
        if a <= 0:
            print("No")
            return

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
# a:高橋 体力
# b:高橋 攻撃力
# c:青木　体力
# d:青木　攻撃力

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

while c > 0:
  c = c-b　#青木体力
  if c <= 0:
    print("Yes")
  a = a-d
  if a <= 0:
    print("No")
  

Fixed submission:
def main():

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

    while c > 0:
        c = c - b
        if c <= 0:
            print("Yes")
            return
        a = a - d
        if a <= 0:
            print("No")
            return

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
# a:高橋 体力
# b:高橋 攻撃力
# c:青木　体力
# d:青木　攻撃力

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

while c > 0:
	c = c-b　#青木体力
	if c <= 0:
		print("Yes")
    a = a-d
    if a <= 0:
      	print("No")
  

Fixed submission:
def main():

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

    while c > 0:
        c = c - b
        if c <= 0:
            print("Yes")
            return
        a = a - d
        if a <= 0:
            print("No")
            return

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import math

r = input()
pi_ = round(math.pi,4)
print(2*r*pi_)


Fixed submission:
import math

r = input()
p = int(r)
pi_ = round(math.pi,4)
print(2*p*pi_)

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

r = input()
print(2*r*math.pi)

Fixed submission:
import math

r = input()
p = int(r)
pi_ = round(math.pi,4)
print(2*p*pi_)
Buggy python submission (verdict: Time Limit Exceeded):
import collections

N = int(input())

Ninzu = []
for x in input().split():
	Ninzu.append(int(x))

for i in range(1,N):
	print(Ninzu.count(i))

print(0)

Fixed submission:
import collections

N = int(input())

Ninzu = []
for x in input().split():
	Ninzu.append(int(x))

l = collections.Counter(Ninzu)

for i in range(1,N):
	print(l[i])

print(0)

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

Ninzu = []
for x in input().split():
	Ninzu.append(int(x))

i = 1
for i in range(0,N):
	print(Ninzu.count(i+1))

Fixed submission:
import collections

N = int(input())

Ninzu = []
for x in input().split():
	Ninzu.append(int(x))

l = collections.Counter(Ninzu)

for i in range(1,N):
	print(l[i])

print(0)
Buggy python submission (verdict: Runtime Error):
a = int(input())
print(a*a**2*a***3)

Fixed submission:
a = int(input())
print(a+a**2+a**3)
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()
cnt = 0
for i, v in enumerate(zip(S,T)):
  if v[0] == v[1]:
    continue
  else:
    S[i] = v[1]
    cnt += 1
print(cnt)


Fixed submission:
S = input()
T = input()
cnt = 0
for i, v in enumerate(zip(S,T)):
  if v[0] == v[1]:
    continue
  else:
    cnt += 1
print(cnt)

Buggy python submission (verdict: Runtime Error):
S = input()
T = input()
cnt = 0
for i, v in zip(S,T):
  if v[0] == v[1]:
    continue
  else:
    S[i] = v[1]
    cnt += 1
print(cnt)

Fixed submission:
S = input()
T = input()
cnt = 0
for i, v in enumerate(zip(S,T)):
  if v[0] == v[1]:
    continue
  else:
    cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
prices = [int(i) for i in input().split()]
print(sum(prices.sort()[:K]))

Fixed submission:
N, K = map(int, input().split())
prices = [int(i) for i in input().split()]
prices.sort()
print(sum(prices[:K]))
Buggy python submission (verdict: Runtime Error):
X = [for int(i) in input().split()]
for c, x in enumerate(X):
  if x == 0:
  	print(c)


Fixed submission:
X = [int(i) for i in input().split()]
for c, x in enumerate(X):
  if x == 0:
  	print(c+1)

Buggy python submission (verdict: Runtime Error):
X = [for int(i) in input().split()]
for c, x in X:
  if x == 0:
  	print(c)

Fixed submission:
X = [int(i) for i in input().split()]
for c, x in enumerate(X):
  if x == 0:
  	print(c+1)
Buggy python submission (verdict: Runtime Error):
N = int(input().split())
hon = [2,4,5,7,9]
pon = [0,1,6,8]
bon = [3]
if N[-1] in hon:
  print('hon')
elif N[-1] in pon:
  print('pon')
else:
  print('bon')


Fixed submission:
N = input()
hon = [2,4,5,7,9]
pon = [0,1,6,8]
bon = [3]
n = int(N[-1])
if n in hon:
  print('hon')
elif n in pon:
  print('pon')
else:
  print('bon')
Buggy python submission (verdict: Time Limit Exceeded):
A, B, C, K = map(int, input().split(" "))
max_val = 0
for cnt in range(K):
    if A >= cnt+1:
        max_val += 1
        continue
    elif B >= cnt+1-A:
        continue
    else:
        max_val -= 1
print(max_val)

Fixed submission:
A, B, C, K = map(int, input().split(" "))
if K-A <= 0:
    print(K)
else:
    if K - (A + B) <= 0:
        print(A)
    elif K == A+B+C:
        print(A-C)
    else:
        print(A - (K-(A+B)))

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

A, B, C, K = map(int, input().split(" "))
data = [1 for _ in range(A)] + [0 for _ in range(B)] + [-1 for _ in range(C)]

sums = [sum(conb) for conb in itertools.combinations(data, K)]
print(max(sums))


Fixed submission:
A, B, C, K = map(int, input().split(" "))
if K-A <= 0:
    print(K)
else:
    if K - (A + B) <= 0:
        print(A)
    elif K == A+B+C:
        print(A-C)
    else:
        print(A - (K-(A+B)))

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

A, B, C, K = map(int, input().split(" "))
data = [1 for _ in range(A)] + [0 for _ in range(B)] + [-1 for _ in range(C)]

conbs = list(itertools.combinations(data, K))
max_val = 0
for conb in conbs:
    if sum(conb) > max_val:
        max_val = sum(conb)
print(max_val)


Fixed submission:
A, B, C, K = map(int, input().split(" "))
if K-A <= 0:
    print(K)
else:
    if K - (A + B) <= 0:
        print(A)
    elif K == A+B+C:
        print(A-C)
    else:
        print(A - (K-(A+B)))