Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
H, N = [int(i) for i in input().split()]
An = []
Bn = []
#Rn = []
for n in range(N):
  a, b = [int(i) for i in input().split()]
  An.append(a)
  Bn.append(b)
#  Rn.append(b/a)

maxA = max(An)
dp = [[1000000000 for _ in range(H+1 )] for _ in range(N+1)]
dp[0][0] = 0
for n in range(N):
  dp[n][0] = 0
  a, b = An[n], Bn[n]
  for h in range(1, H+1):
    if h == H:
      dp[n+1][h] = min(min(dp[n][h-a:]) + b, dp[n][h], 
                       min(dp[n+1][h-a:]) + b)
    elif h >= a:
      dp[n+1][h] = min(dp[n][h-a] + b, dp[n][h], dp[n+1][h-a] + b)
    else:
      dp[n+1][h] = dp[n][h]
print(dp[N][H])
    


Fixed submission:
import numpy as np

H, N = map(int, input().split())
AB = np.array([list(map(int, input().split())) for i in range(N)])
A = AB[:, 0]
B = AB[:, 1]

dp = np.array([0]*(H+1))

for i in range(1, H+1):
    dp[i] = min(dp[np.maximum(i - A, 0)] + B)

print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
H, N = [int(i) for i in input().split()]
An = []
Bn = []
#Rn = []
for n in range(N):
  a, b = [int(i) for i in input().split()]
  An.append(a)
  Bn.append(b)
#  Rn.append(b/a)

maxA = max(An)
dp = [[1000000000 for _ in range(H+1 + maxA)] for _ in range(N+1)]
dp[0][0] = 0
for n in range(N):
  dp[n][0] = 0
  a, b = An[n], Bn[n]
  for h in range(1, H+1+maxA):
    if h >= a:
      dp[n+1][h] = min(dp[n][h-a] + b, dp[n][h], dp[n+1][h-a] + b)
    else:
      dp[n+1][h] = dp[n][h]
print(min(dp[N][H:]))
    


Fixed submission:
import numpy as np

H, N = map(int, input().split())
AB = np.array([list(map(int, input().split())) for i in range(N)])
A = AB[:, 0]
B = AB[:, 1]

dp = np.array([0]*(H+1))

for i in range(1, H+1):
    dp[i] = min(dp[np.maximum(i - A, 0)] + B)

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

N = int(input())
strN = str(N)
order = len(strN)
Ns = int(strN[0])
Ne = int(strN[-1])
count = 0
for e in range(1, 10):
  e = str(e)
  for s in range(1, 10):
    s = str(s)
    ces = 0
    cse = 0
    for n in range(1, N + 1):
      sn = str(n)
      if sn[0] == s and sn[-1] == e:
        ces += 1
      if sn[0] == e and sn[-1] == s:
        cse += 1
    count += ces * cse
    
print(count)

Fixed submission:
N = int(input())
strN = str(N)
order = len(strN)
Ns = int(strN[0])
Ne = int(strN[-1])

ces = [[0  for i in range(10) ] for j in range(10)]
cse = [[0  for i in range(10) ] for j in range(10)]
for n in range(1, N + 1):
  n_last = n % 10
  n_first = n
  while n_first >= 10:
    n_first = n_first // 10
  ces[n_last][n_first] += 1
  cse[n_first][n_last] += 1

count = 0
for e in range(1, 10):
  for s in range(1, 10):
    count += ces[e][s] * cse[e][s]
    
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = [int(i) for i in input().split()]
corrects = []
wrongs = [0 for _ in range(N)]
for m in range(M):
  p, s = input().split()
  p = int(p)
  if p not in corrects:
    if s == "WA":
      wrongs[p-1] += 1
    elif s == "AC":
      corrects.append(p)
  
total_wrongs = 0
for p in corrects:
  total_wrongs += wrongs[p-1]
      
print(len(corrects), total_wrongs)

Fixed submission:
N, M = [int(i) for i in input().split()]
corrects = [0 for _ in range(N)]
wrongs = [0 for _ in range(N)]
for m in range(M):
  p, s = input().split()
  p = int(p)
  if corrects[p-1] == 0:
    if s == "WA":
      wrongs[p-1] += 1
    elif s == "AC":
      corrects[p-1] = 1
      corrects.append(p)
  
total_wrongs = 0
total_correct = 0
for i in range(N):
  if corrects[i] > 0:
      total_wrongs += wrongs[i]
      total_correct += 1
  
print(total_correct, total_wrongs)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = [int(i) for i in input().split()]
corrects = []
wrongs = {}
for m in range(M):
  p, s = input().split()
  if p not in corrects:
    if s == "WA":
      if p not in wrongs:
        wrongs[p] = 0        
      wrongs[p] += 1
    elif s == "AC":
      corrects.append(p)
  
total_wrongs = 0
for p in corrects:
  if p in wrongs:
	  total_wrongs += wrongs[p]
      
print(len(corrects), total_wrongs)

Fixed submission:
N, M = [int(i) for i in input().split()]
corrects = [0 for _ in range(N)]
wrongs = [0 for _ in range(N)]
for m in range(M):
  p, s = input().split()
  p = int(p)
  if corrects[p-1] == 0:
    if s == "WA":
      wrongs[p-1] += 1
    elif s == "AC":
      corrects[p-1] = 1
      corrects.append(p)
  
total_wrongs = 0
total_correct = 0
for i in range(N):
  if corrects[i] > 0:
      total_wrongs += wrongs[i]
      total_correct += 1
  
print(total_correct, total_wrongs)
Buggy python submission (verdict: Time Limit Exceeded):
N, A, B = [int(i) for i in input().split()]
Hn = [int(input()) for _ in range(N)]
dAB = A - B

def check(X):
  base = B * X
  counts = sum([max((h - base + dAB - 1)//dAB, 0) for h in Hn])
  return counts <= X
               
def min_binary_search(check, l=0, r=1000000000000000):
    while r - l > 1:
      mid = (l + r) // 2
      if check(mid):
        r = mid
      else:
        l = mid
    return r
print(min_binary_search(check))

Fixed submission:
N, A, B = [int(i) for i in input().split()]
Hn = [int(input()) for _ in range(N)]
dAB = A - B

def check(X):
  base = B * X
  counts = sum([max((h - base + dAB - 1)//dAB, 0) for h in Hn])
  return counts <= X
               
def min_binary_search(check, l=0, r=100000000000):
    while r - l > 1:
      mid = (l + r) // 2
      if check(mid):
        r = mid
      else:
        l = mid
    return r
print(min_binary_search(check))
Buggy python submission (verdict: Runtime Error):
s=input()
t=input()
n=0
for i in range(0,len(s)):
	if(s[i]==t[i]):
    	n=n+1
if(n==len(s)):
  print("Yes")
else:
  print("No")


Fixed submission:
s=input()
t=input()
n=0
for i in range(0,len(s)):
    if(s[i]==t[i]):
        n=n+1
if(n==len(s)):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n=int(input())
money=100
year=0
while(money<n){
  year=year+1
  money=money*1.01
}
print(year)

Fixed submission:
n=int(input())
money=100
year=0
while(money<n):
  year=year+1
  money=int(money*1.01)
print(year)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=[]
for i in range(0,n):
    a=input()
    if a not in s:
        s.append(a)
print(len(s))


Fixed submission:
n=int(input())
s=[]
for i in range(0,n):
  s.append(input())
a=set(s)
print(len(a))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=[]
for i in range(0,n):
    a=input()
    if a not in s:
        s.append(a)
print(len(s))

Fixed submission:
n=int(input())
s=[]
for i in range(0,n):
  s.append(input())
a=set(s)
print(len(a))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=[]
a=[]
for i in range(0,n):
    s.append(input())
for i in range(0,n):
    if s[i] not in a:
        a.append(s[i])
print(len(a))

Fixed submission:
n=int(input())
s=[]
for i in range(0,n):
  s.append(input())
a=set(s)
print(len(a))
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=list(map(int,input().split()))
if n-sum(a)<=0:
  print(-1)
else print(n-sum(a))

Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
if n-sum(a)<0:
    print(-1)
else:
    print(n-sum(a))
Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
k=int(input())
ans=0
for i in range(1,k+1):
  for j in range(1,k+1):
    for l in range(1,k+1):
        a=(i,j,l)
        if len(a)==1:
            ans=ans+i
        elif len(a)==2:
            ans=ans+gcd(a[0],a[1])
        else:
            ans=ans+gcd(a[0],gcd(a[1],a[2]))
print(ans)


Fixed submission:
from math import gcd
k=int(input())
ans=0
for i in range(1,k+1):
  for j in range(1,k+1):
    for l in range(1,k+1):
      ans=ans+gcd(gcd(i,j),l)
print(ans)

Buggy python submission (verdict: Runtime Error):
from fractions import gcd
k=int(input())
ans=0
for i in range(1,k+1):
  for j in range(1,k+1):
    for l in range(1,k+1):
        a=(i,j,l)
        if len(a)==1:
            ans=ans+i
        elif len(a)==2:
            ans=ans+fractions.gcd(a[0],a[1])
        else:
            ans=ans+fractions.gcd(a[0],fractions.gcd(a[1],a[2]))
print(ans)

Fixed submission:
from math import gcd
k=int(input())
ans=0
for i in range(1,k+1):
  for j in range(1,k+1):
    for l in range(1,k+1):
      ans=ans+gcd(gcd(i,j),l)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
k=int(input())
ans=0
for i in range(1,k+1):
  for j in range(1,k+1):
    for l in range(1,k+1):
      ans=ans+fractions.gcd(i,fractions.gcd(j,l))
print(ans)

Fixed submission:
from math import gcd
k=int(input())
ans=0
for i in range(1,k+1):
  for j in range(1,k+1):
    for l in range(1,k+1):
      ans=ans+gcd(gcd(i,j),l)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
k=int(input())
ans=0
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
for i in range(1,k+1):
  for j in range(1,k+1):
    for l in range(1,k+1):
      ans=ans+gcd(i,gcd(j,l))
print(ans)

Fixed submission:
from math import gcd
k=int(input())
ans=0
for i in range(1,k+1):
  for j in range(1,k+1):
    for l in range(1,k+1):
      ans=ans+gcd(gcd(i,j),l)
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
price=10*b
c=[]  
while(price<=10*b+10):
  if int(price*0.08)==a:
    c.append(a)
    price=price+1
  else:
    price=price+1
if c=[]:
  print(-1)
else:
  print(min(c))

Fixed submission:
a,b=map(int,input().split())
price=10*b
c=[]  
while(price<10*b+10):
  if int(price*0.08)==a:
    c.append(price)
    price=price+1
  else:
    price=price+1
if c==[]:
  print(-1)
else:
  print(min(c))

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
price=10*b
c=[]  
while(price<=10*b+10):
  if int(price*0.08)==a:
    c.append(a)
  else:
    price=price+1
if c=[]:
  print(-1)
else:
  print(min(c))

Fixed submission:
a,b=map(int,input().split())
price=10*b
c=[]  
while(price<10*b+10):
  if int(price*0.08)==a:
    c.append(price)
    price=price+1
  else:
    price=price+1
if c==[]:
  print(-1)
else:
  print(min(c))

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
price=10*b
c=[]  
while(price<=10*b+10):
  if int(price*0.08)==a:
    c.append(a)
  else:
    price=price+1
print(min(c))

Fixed submission:
a,b=map(int,input().split())
price=10*b
c=[]  
while(price<10*b+10):
  if int(price*0.08)==a:
    c.append(price)
    price=price+1
  else:
    price=price+1
if c==[]:
  print(-1)
else:
  print(min(c))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
ans=0
b=[]
for i in range(0,n):
  b.append(a[i])
  if min(b)==a[i]:
    ans=ans+1
print(ans)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=0
m=a[0]
for i in range(0,n):
  if a[i]<=m:
    m=a[i]
    ans=ans+1
print(ans)
Buggy python submission (verdict: Runtime Error):
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

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

n=int(input())
a=list(map(int,input().split()))
l=1
for i in range(0,n):
    l=lcm(l,a[i])
ans=0
for i in range(0,n):
    ans=ans+l/a[i]
print (int(ans%(10**9+7)))

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

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

n=int(input())
a=list(map(int,input().split()))
l=1
for i in range(0,n):
    l=lcm(l,a[i])
ans=0
for i in range(0,n):
    ans=ans+l//a[i]
print (ans%(10**9+7))
Buggy python submission (verdict: Runtime Error):
n=int(input())
if n%2==0:
  print(1/2)
else:
  print((n+1)/2)/n

Fixed submission:
n=int(input())
if n%2==0:
  print(1/2)
else:
  print(((n+1)/2)/n)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input())
if (a+b)%2==0:
  print (a+b)/2
else:
  print('IMPOSSIBLE')


Fixed submission:
a,b=map(int,input().split())
if (a+b)%2==0:
    print ((a+b)//2)
else:
    print('IMPOSSIBLE')

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input())
if (a+b)//2==0:
  print (a+b)/2
else:
  print('IMPOSSIBLE')

Fixed submission:
a,b=map(int,input().split())
if (a+b)%2==0:
    print ((a+b)//2)
else:
    print('IMPOSSIBLE')
Buggy python submission (verdict: Runtime Error):
n,l=map(int,input().split())
a=[]
for i in range(0,n):
  a.append(i+l)
if 0 in a:
  print(sum(a))
else:
  if a[0]>0:
    print(sum(a)-a[0])
  else:
    print(sum(a)-a[n])

Fixed submission:
n,l=map(int,input().split())
a=[]
for i in range(0,n):
  a.append(i+l)
if 0 in a:
  print(sum(a))
else:
  if a[0]>0:
    print(sum(a)-a[0])
  else:
    print(sum(a)-a[n-1])
Buggy python submission (verdict: Runtime Error):
a=input().split()
num=a[0]
del a[0]
for i in range(0,num//2+1):
    a[i]=int(a[i])
b=0
c=0
answer=sum(a)
for i in range(0,len(a)):
    b=b+a[i]
    c=sum(a)-b
    if (b-c>=0 and answer>b-c):
        answer=b-c
    elif (c-b>0 and answer>c-b):
        answer=c-b
print(answer)


Fixed submission:
b=input()
a=input().split()
for i in range(0,len(a)):
    a[i]=int(a[i])
b=0
c=0
answer=sum(a)
for i in range(0,len(a)):
    b=b+a[i]
    c=sum(a)-b
    if (b-c>=0 and answer>b-c):
        answer=b-c
    elif (c-b>0 and answer>c-b):
        answer=c-b
print(answer)

Buggy python submission (verdict: Runtime Error):
a=input().split()
num=a[0]
del a[0]
for i in range(0,a[0]//2+1):
    a[i]=int(a[i])
b=0
c=0
answer=sum(a)
for i in range(0,len(a)):
    b=b+a[i]
    c=sum(a)-b
    if (b-c>=0 and answer>b-c):
        answer=b-c
    elif (c-b>0 and answer>c-b):
        answer=c-b
print(answer)

Fixed submission:
b=input()
a=input().split()
for i in range(0,len(a)):
    a[i]=int(a[i])
b=0
c=0
answer=sum(a)
for i in range(0,len(a)):
    b=b+a[i]
    c=sum(a)-b
    if (b-c>=0 and answer>b-c):
        answer=b-c
    elif (c-b>0 and answer>c-b):
        answer=c-b
print(answer)

Buggy python submission (verdict: Runtime Error):
a=input().split()
del a[0]
for i in range(0,len(a)):
    a[i]=int(a[i])
c=sum(a)/2
d=0
e=0
for i in range(0,len(a)):
    if d<c:
        d=d+a[i]
        e=e+1
g=d*2-sum(a)
h=sum(a)-2*(d-a[e-1])
min(g,h)

Fixed submission:
b=input()
a=input().split()
for i in range(0,len(a)):
    a[i]=int(a[i])
b=0
c=0
answer=sum(a)
for i in range(0,len(a)):
    b=b+a[i]
    c=sum(a)-b
    if (b-c>=0 and answer>b-c):
        answer=b-c
    elif (c-b>0 and answer>c-b):
        answer=c-b
print(answer)

Buggy python submission (verdict: Runtime Error):
a=input().split()
del a[0]
for i in range(0,len(a)):
    a[i]=int(a[i])
c=sum(a)/2
d=0
e=0
for i in range(0,len(a)):
    if d<c:
        d=d+a[i]
        e=e+1
g=d*2-sum(a)
h=sum(a)-2*(d-a[e-1])
print(min(g,h))

Fixed submission:
b=input()
a=input().split()
for i in range(0,len(a)):
    a[i]=int(a[i])
b=0
c=0
answer=sum(a)
for i in range(0,len(a)):
    b=b+a[i]
    c=sum(a)-b
    if (b-c>=0 and answer>b-c):
        answer=b-c
    elif (c-b>0 and answer>c-b):
        answer=c-b
print(answer)

Buggy python submission (verdict: Runtime Error):
a=input().split()
del a[0]
for i in range(0,len(a)):
    a[i]=int(a[i])
c=sum(a)/2
d=0
e=0
for i in range(0,len(a)):
    while d<c:
        d=d+a[i]
        e=e+1
g=sum(a)-d*2
h=2*(d-a[e-1])-sum(a)
print(max(g,h))

Fixed submission:
b=input()
a=input().split()
for i in range(0,len(a)):
    a[i]=int(a[i])
b=0
c=0
answer=sum(a)
for i in range(0,len(a)):
    b=b+a[i]
    c=sum(a)-b
    if (b-c>=0 and answer>b-c):
        answer=b-c
    elif (c-b>0 and answer>c-b):
        answer=c-b
print(answer)
Buggy python submission (verdict: Runtime Error):
number=int(input())
book=[]
for i in range(0,number):
  book.append((input().split()).append(i+1))
book1=list.sort(book,key=lambda x: x[1],reverse=True)
book2=book2.sort()
for i in range(0,len(book2)):
  print(book[i][2],'\n')
  

Fixed submission:
number=int(input())
book=[]
for i in range(0,number):
  book.append(input().split())
for i in range(0,len(book)):
    book[i][1]=int(book[i][1])
    book[i].append(i+1)
book1=sorted(book,key=lambda x: -x[1])
book2=sorted(book1,key=lambda x: x[0])
for i in range(0,len(book2)):
  print(book2[i][2])
Buggy python submission (verdict: Runtime Error):
n,k=map(input().split())
print(n-k+1)

Fixed submission:
n,k=map(int,input().split())
print(n-k+1)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,n=map(int,input().split())
d=[a,b,c]
d.sort()
a=d[0]
b=d[1]
c=d[2]
e=0
for i in range(0,int(n/c)+1):
  f=n-c*i
  for k in range(0,int(f/b)+1):
    g=f-b*k
    if g/a-int(g/a)==0:
        e=e+1
print(e)

Fixed submission:
a,b,c,n=map(int,input().split())
d=[a,b,c]
d.sort()
a=d[0]
b=d[1]
c=d[2]
e=0
for i in range(0,n//c+1):
    for k in range(0,(n-c*i)//b+1):
        if ((n-c*i-b*k)%a)==0:
            e=e+1
print(e)
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=input()
b=0
r=0
for i in range(0,n):
  if s[0][i]==B:
    b=b+1
  else:
    r=r+1
if r>b:
  print('Yes')
else:
  print('No')


Fixed submission:
n=int(input())
s=input()
b=0
r=0
for i in range(0,n):
  if s[i]=='B':
    b=b+1
  else:
    r=r+1
if r>b:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
n=int(input())
s=input()
b=0
r=0
for i in range(0,n):
  if s[i]==B:
    b=b+1
  else:
    r=r+1
if r>b:
  print('Yes')
else:
  print('No')

Fixed submission:
n=int(input())
s=input()
b=0
r=0
for i in range(0,n):
  if s[i]=='B':
    b=b+1
  else:
    r=r+1
if r>b:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[]
for i in range(0,n):
    b,c=map(int,input().split())
    a.append([b,c])
a.sort()
number=0
for i in range(0,len(a)):
    while number<m:
        number=number+a[i][1]
        l=i
print(l)
answer=0
kosu=0
for k in range(0,l+1):
    answer=answer+a[k][0]*a[k][1]
    kosu=kosu+a[k][1]
print(answer)
answer=answer+a[l+1][0]*(m-kosu)
print(answer)

Fixed submission:
n,m=map(int,input().split())
a=[]
for i in range(0,n):
    b,c=map(int,input().split())
    a.append([b,c])
a.sort()
number=0
for i in range(0,len(a)):
    if number<m:
        number=number+a[i][1]
        l=i
answer=0
kosu=0
for k in range(0,l):
    answer=answer+a[k][0]*a[k][1]
    kosu=kosu+a[k][1]
answer=answer+a[l][0]*(m-kosu)
print(answer)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[]
for i in range(0,n):
  b,c=map(int.input().split())
  a.append[b,c]
a.sort()
number=0
for i in range(0,len(a)):
  while number<m:
    number=number+a[i][1]
    l=i
answer=0
kosu=0
for k in range(0,l-1):
  answer=answer+a[k][0]*a[k][1]
  kosu=kosu+a[k][1]
answer=answer+a[l][0]*(m-kosu)
print(answer)

Fixed submission:
n,m=map(int,input().split())
a=[]
for i in range(0,n):
    b,c=map(int,input().split())
    a.append([b,c])
a.sort()
number=0
for i in range(0,len(a)):
    if number<m:
        number=number+a[i][1]
        l=i
answer=0
kosu=0
for k in range(0,l):
    answer=answer+a[k][0]*a[k][1]
    kosu=kosu+a[k][1]
answer=answer+a[l][0]*(m-kosu)
print(answer)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[]
for i in range(0,n):
  a.append(input().split())
if 'Y' in a:
  print('Four')
else:
  print('Three')

Fixed submission:
n=int(input())
a=input().split()
if 'Y' in a:
  print('Four')
else:
  print('Three')
Buggy python submission (verdict: Runtime Error):
a,b=input(str,input().split())
if a=='H':
  print(b)
else:
  if b=='H':
    print('D')
  else:
    print('H')

Fixed submission:
a,b=map(str,input().split())
if a=='H':
  print(b)
else:
  if b=='H':
    print('D')
  else:
    print('H')
Buggy python submission (verdict: Time Limit Exceeded):
a, b, c, k = input().split()
a, b, c, k = int(a), int(b), int(c), int(k)
result = 0

if a == k:
    result = a
else:
    for i in range(k):
        if a != 0:
            result = result + 1
            a = a - 1
        elif a == 0 and b != 0:
            #result変わらず
            b = b - 1
        elif a == 0 and b == 0 and c != 0:
            result = result - 1
            c = c - 1
        else:
            break

print(result)


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

if a >= k:
    print(k)
    exit()

if k-a-b <= 0:
    print(a)
    exit()

print(a-(k-a-b))

Buggy python submission (verdict: Time Limit Exceeded):
a, b, c, k = input().split()
a, b, c, k = int(a), int(b), int(c), int(k)
result = 0

for i in range(k):
    if a != 0:
        result = result + 1
        a = a - 1
    elif a == 0 and b != 0:
        #result変わらず
        b = b - 1
    elif a == 0 and b == 0 and c != 0:
        result = result - 1
        c = c - 1
    else:
        break

print(result)


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

if a >= k:
    print(k)
    exit()

if k-a-b <= 0:
    print(a)
    exit()

print(a-(k-a-b))

Buggy python submission (verdict: Time Limit Exceeded):
a, b, c, k = input().split()
a, b, c, k = int(a), int(b), int(c), int(k)
result = 0

for i in range(k):
    if a != 0:
        result = result + 1
        a = a - 1
    elif a == 0 and b != 0:
        #result変わらず
        b = b - 1
    elif a == 0 and b == 0 and c != 0:
        result = result - 1
        c = c - 1
    else:
        break

print(result)


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

if a >= k:
    print(k)
    exit()

if k-a-b <= 0:
    print(a)
    exit()

print(a-(k-a-b))

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

result = 0

for i in k:
    if a != 0:
        result = result + 1
        a = a - 1
    elif a == 0 and b != 0:
        #result変わらず
        b = b - 1
    elif a == 0 and b == 0 and c != 0:
        result = result - 1
        c = c  - 1
    else:
        break

print(result)


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

if a >= k:
    print(k)
    exit()

if k-a-b <= 0:
    print(a)
    exit()

print(a-(k-a-b))

Buggy python submission (verdict: Runtime Error):
A = input()
B = input()
C = input()
K = input()

result = 0

for i in K:
    if A != 0:
        result = result - 1;
        A = A - 1;
    elif A == 0 and B != 0:
        #result変わらず
        B = B - 1;
    elif A == 0 and B == 0:
        result = result - 1;
        C = C - 1;
    else:
        break

print(result)


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

if a >= k:
    print(k)
    exit()

if k-a-b <= 0:
    print(a)
    exit()

print(a-(k-a-b))
Buggy python submission (verdict: Runtime Error):
S = input().split()

if S == "ABC":
    print("ARC")
if s == "ARC":
    print("ARC")


Fixed submission:
s = input()
if s[1] == "B":
    print("ARC")
else:
    print("ABC")
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
if (a == b and b != c) or (b == c and c != a) or (c == a and a != b):
    print('Yes')
else:
    print('No')


Fixed submission:
n, r = map(int, input().split())
if n >= 10:
    print(r)
else:
    print(r + 100 * (10 - n))