Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
S=[list(map(int,input().split())) for i in range(N)]
T=[list(map(int,input().split())) for i in range(M)]
for i in range(N):
    x1=S[i][0]
    y1=S[i][1]
    x2=T[0][0]
    y2=T[0][1]
    min=abs(x1-x2)+abs(y1-y2)
    x1=S[i][0]
    y1=S[i][1]
    for j in range(M-1,-1,-1):
        x2=T[j][0]
        y2=T[j][1]
        if min>=abs(x1-x2)+abs(y1-y2):
            min=abs(x1-x2)+abs(y1-y2)
            R[i]=j+1
for i in range(len(R)):
    print(R[i])

Fixed submission:
N,M=map(int,input().split())
a=[list(map(int,input().split())) for i in range(N)]
b=[list(map(int,input().split())) for i in range(M)]
for i in range(N):
    dmin=abs(a[i][0]-b[0][0])+abs(a[i][1]-b[0][1])
    num=1
    for j in range(M):
        dist=abs(a[i][0]-b[j][0])+abs(a[i][1]-b[j][1])
        if dmin>dist:
            dmin=dist
            num=j+1
    print(num)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
num=1
for i in range(1,N+1):
    num*=i
print(num%(10**9+7))

Fixed submission:
import math
print(math.factorial(int(input()))%(10**9+7))
Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
A=[ list(input()) for i in range(N)]
B=[ list(input()) for i in range(M)]
ans='Yes'
for i in range(N-M+1):
    for j in range(N-M+1):
        
        for k in range(i,i+M):
            for l in range(j,j+M):
                if A[k][l]!=B[k-i][l-j]:
                    ans='No'
print(ans)


Fixed submission:
A,B=input().split()
poker=['2','3','4','5','6','7','8','9','10','11','12','13','1']
if poker.index(A)<poker.index(B):
    print('Bob')
elif poker.index(A)>poker.index(B):
    print('Alice')
else:
    print('Draw')

Buggy python submission (verdict: Runtime Error):
A,B=input().split()
poker=['2','3','4','5','6','7','8','9','10','11','12','1']
if poker.index(A)<poker.index(B):
    print('Bob')
elif  poker.index(A)>poker.index(B):
    print('Alice')
else:
    print('Draw')

Fixed submission:
A,B=input().split()
poker=['2','3','4','5','6','7','8','9','10','11','12','13','1']
if poker.index(A)<poker.index(B):
    print('Bob')
elif poker.index(A)>poker.index(B):
    print('Alice')
else:
    print('Draw')
Buggy python submission (verdict: Runtime Error):
print(6.28 * int(input())

Fixed submission:
print(6.28 * int(input()))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
ans = 0
for i in range(n):
    for j in range(i):
        for k in range(j):
            if s[i] != s[j] and s[i] != s[k] and s[j] != s[k] and j-i != k-j:
                ans += 1
print(ans)


Fixed submission:
n = int(input())
s = input()
ans = s.count('R') * s.count('G') * s.count('B')

for i in range(n):
    d = 1
    while i + 2*d < n:
        if s[i] != s[i+d] and s[i] != s[i+2*d] and s[i+d] != s[i+2*d]:
            ans -= 1
        d += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
n = input()
l = sorted[int(x) for x in raw_input().split()]
print l[n/2] - l[n/2-1]

Fixed submission:
n = input()
l = sorted([int(x) for x in raw_input().split()])
print l[n/2] - l[n/2-1]
Buggy python submission (verdict: Runtime Error):
l = [int(x) for x in raw_input().split()]
print "Even" if l[0]*l[i]%2 == 0 else "Odd"

Fixed submission:
l = [int(x) for x in raw_input().split()]
print "Even" if l[0]*l[1]%2 == 0 else "Odd"
Buggy python submission (verdict: Runtime Error):
a, b = (int(x) for x in raw_input().split)
print "error" if a + b > 9 else str(a+b)

Fixed submission:
a, b = (int(x) for x in raw_input().split())
print "error" if a + b > 9 else str(a+b)
Buggy python submission (verdict: Runtime Error):
a = "REMEMBER TO PUT AC/WA ONLY"
b = raw_input()
r = 0
for i in xrange(len(a)):
	if a[i] != b[i]:
		r += 1
print r

Fixed submission:
a = "CODEFESTIVAL2016"
b = raw_input()
r = 0
for i in xrange(len(a)):
	if a[i] != b[i]:
		r += 1
print r
Buggy python submission (verdict: Runtime Error):
Z = list(input(""))
N = int(Z[0])
D = int(Z[1])
count = 0
 
while(N--):
  Z1 = list(input(""))
  X = int(Z1[0])
  Y = int(Z1[1])
  
  d = (X**2 + Y**2)**0.5
  
  if d<=D:
    count += 1
    
print(count)

Fixed submission:
Z = input("").split()
N = int(Z[0])
D = int(Z[1])
count = 0
 
while(N):
    Z1 = input("").split()
    X = int(Z1[0])
    Y = int(Z1[1])
  
    d = (X**2 + Y**2)**0.5
  
    if d<=D:
        count += 1
    N = N -1
print(count)

Buggy python submission (verdict: Runtime Error):
Z = list(input(""))
N = int(Z[0])
D = int(Z[1])
count = 0

while(N--):
  Z1 = list(input(""))
  X = int(Z[0])
  Y = int(Z[1])
  
  d = (X**2 + Y**2)**0.5
  
  if d<=D:
    count += 1
    
print(count)    

Fixed submission:
Z = input("").split()
N = int(Z[0])
D = int(Z[1])
count = 0
 
while(N):
    Z1 = input("").split()
    X = int(Z1[0])
    Y = int(Z1[1])
  
    d = (X**2 + Y**2)**0.5
  
    if d<=D:
        count += 1
    N = N -1
print(count)
Buggy python submission (verdict: Runtime Error):
a, b = input().split()
A = int(a)
B - int(b)
print(A*B)

Fixed submission:
a, b = input().split()
A = int(a)
B = int(b)
print(A*B)
Buggy python submission (verdict: Runtime Error):
def recursion(length, ll, string, cc):
    if ll * 2 < length:
        for i in range(10):
            string1 = string + str(i)
            recursion(length, ll+1, string1, cc)
    else:
        number = str(int(string) + int(cc[-ll:]))
        ds = ""
        for i in range(length // 2):
            ds += number[-i-1]
        string = ds + string
        if str(int(string) + int(cc)) == string[::-1] and string[0] != "0":
            global answer
            answer += 1
            

d = input()
plus = 0
while True:
    if d[-1] == "0":
        d = d[:-1]
        plus += 1
    else:
        break
answer = 0
recursion(len(d), 0, "", d)
recursion(len(d)+1, 0, "", d)
while plus > 0:
    if plus == 1:
        plus -= 1
        answer = answer * 9
    else:
        plus -= 1
        answer *= 10
print(answer)


Fixed submission:
def result(letters, number, cant_zero):
    if letters <= 1:
        if number == 0:
            return 10 ** letters
        return 0
    diff = (10 - number%10) % 10
    variants = number % 10 - cant_zero
    if number % 10 == 0:
        variants = 10 - cant_zero
    number -= diff * (10**(letters-1) - 1)
    number = abs(number // 10)
    return variants * result(letters-2, number, 0)

d = int(input())
ans = 0
for i in range(20):
    ans += result(i, d, 1)
print(ans)
Buggy python submission (verdict: Runtime Error):
K = int(input())

res = [(0, 0)]
mm = 0
for i in range(1, 136):
  n = []
  x = i
  while x > 0:
    n.append(str(min(x, 9)))
    x -= 9
  n.reverse()
  x = int(''.join(n))
  
  while x / i < res[-1][0]:
    res = res[:-1]
  res.append((x / i, x))

for i in range(1, K + 1):
  print(res[i][1])


Fixed submission:
K = int(input())
 
res = [(0, 0)]
mm = 0
cands = []
for i in range(1, 1000):
  v = i
  for j in range(16):
    cands.append(v)
    v = 10 * v + 9

cands = list(sorted(set(cands)))

for x in cands:
  i = sum(ord(c) - ord('0') for c in str(x))
  while x / i < res[-1][0]:
    res = res[:-1]
  res.append((x / i, x))
 
for i in range(1, K + 1):
  print(res[i][1])
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
c4 = sum(1 for x in a if x % 4 == 0)
c1 = sum(1 for x in a if x % 2 == 1)
if c4 >= c1 or (c4 >= c1 - 1 and c4 + c1 == n):
  print("Yes")
else
  print("No")

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
c4 = sum(1 for x in a if x % 4 == 0)
c1 = sum(1 for x in a if x % 2 == 1)
if c4 >= c1 or (c4 >= c1 - 1 and c4 + c1 == n):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
h = [int(x) for x in input().split()]
dp = [None] * n
 
INF = float('inf')
 
dp[0] = 0
for x in range(1, n):
  for j in range(min(k, x) + 1):
    dp[x] = min(dp[x], dp[x - j] + abs(h[x] - h[x - j]) 
 
print(dp[n-1])

Fixed submission:
dp = {}

n = int(input())
h = [int(x) for x in input().split()]

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

for x in range(2, n):
  dp[x] = min(
    dp[x - 1] + abs(h[x] - h[x - 1]),
    dp[x - 2] + abs(h[x] - h[x - 2])
  )

print(dp[n-1])

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
h = [int(x) for x in input().split()]
dp = [None] * n
 
INF = float('inf')
 
dp[0] = 0
for x in range(1, n):
  dp[x] = min(dp.get(x - i, INF) + abs(h[x] - h[x - i]) for i in range(1, min(k,x) + 1))
 
print(dp[n-1])

Fixed submission:
dp = {}

n = int(input())
h = [int(x) for x in input().split()]

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

for x in range(2, n):
  dp[x] = min(
    dp[x - 1] + abs(h[x] - h[x - 1]),
    dp[x - 2] + abs(h[x] - h[x - 2])
  )

print(dp[n-1])
Buggy python submission (verdict: Runtime Error):
n=int(input())
if n%1000==0:
	print(0)
else:
	v = n//1000
    print((v+1)*1000-n)

Fixed submission:

n=int(input())
if n%1000==0:
	print(0)
else:
	v = n//1000
	print((v+1)*1000-n)
Buggy python submission (verdict: Runtime Error):
s=input()
t=input()
ans = 0
for i in range(len(s)):
  	if(s[i]!=t[i]):
      ans+=1
print(ans)

Fixed submission:
s=input()
t=input()
ans = 0
for i in range(len(s)):
	if(s[i]!=t[i]):
		ans+=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=input()
preb=[0 for i in range(n)]
preg=[0 for i in range(n)]
prer=[0 for i in range(n)]
b=0; g=0; r=0
for i in range(n-1,-1,-1):
	if(s[i]=='R'):
		r+=1
	elif(s[i]=='G'):
		g+=1
	else:
		b+=1
	preb[i]=b; prer[i]=r; preg[i]=g
# print(preb)
# print(preg)
# print(prer)
l=[prer,preg,preb]
s=s.replace('R','0')
s=s.replace('G','1')
s=s.replace('B','2')
ans=0
# print(s)
for i in range(n):
	for j in range(i+1,n):
		if(s[i]!=s[j]):
			if(j+1>=n):
				continue
			ct = l[(3-int(s[i])-int(s[j]))][j+1]
			diff = j-i
			if((j+diff)<n and s[j+diff]==str(3-int(s[i])-int(s[j]))):
				ct-=1
			ans+=ct
print(ans)



Fixed submission:
import sys
input = sys.stdin.readline
yo = input()
if(yo[-1]=='\n'):
	yo=yo[:-1]
n=int(yo)
s=input()
if(s[-1]=='\n'):
	s=s[:-1]
preb=[0 for i in range(n)]
preg=[0 for i in range(n)]
prer=[0 for i in range(n)]
b=0; g=0; r=0
for i in range(n-1,-1,-1):
	if(s[i]=='R'):
		r+=1
	elif(s[i]=='G'):
		g+=1
	else:
		b+=1
	preb[i]=b; prer[i]=r; preg[i]=g
# print(preb)
# print(preg)
# print(prer)
l=[prer,preg,preb]
s=s.replace('R','0')
s=s.replace('G','1')
s=s.replace('B','2')
ans=0
# print(s)
for i in range(n):
	for j in range(i+1,n):
		if(s[i]!=s[j]):
			if(j+1>=n):
				continue
			ct = l[(3-int(s[i])-int(s[j]))][j+1]
			diff = j-i
			if((j+diff)<n and s[j+diff]==str(3-int(s[i])-int(s[j]))):
				ct-=1
			ans+=ct
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
a,b = list(map(int,input().split()))
print(abs(a*b)//math.gcd(a,b))

Fixed submission:
def hcf(a,b):
	if(a==0):
		return b
	if(b==0):
		return a
	return hcf(b%a,a)
import math
a,b = list(map(int,input().split()))
print(abs(a*b)//hcf(a,b))

Buggy python submission (verdict: Runtime Error):
import math
a,b = list(map(int,input().split()))
print(int((a*b)/math.gcd(a,b)))

Fixed submission:
def hcf(a,b):
	if(a==0):
		return b
	if(b==0):
		return a
	return hcf(b%a,a)
import math
a,b = list(map(int,input().split()))
print(abs(a*b)//hcf(a,b))
Buggy python submission (verdict: Time Limit Exceeded):
rows,cols = list(map(int,input().split()))
grid=[]
up=[]
# down=[]
# left=[]
# right=[]
for i in range(rows):
	grid.append(input())
	up.append([0 for j in range(cols)])
	# down.append([-1 for j in range(cols)])
	# left.append([-1 for j in range(cols)])
	# right.append([-1 for j in range(cols)])
#up
for c in range(cols):
	count = 1
	for r in range(rows-1,-1,-1):
		if(grid[r][c]=='#'):
			count=1
		else:
			up[r][c]+=count
			count+=1

#down

for c in range(cols):
	count = 1
	for r in range(rows):
		if(grid[r][c]=='#'):
			count=1
		else:
			up[r][c]+=count
			count+=1

#left

for c in range(rows):
	count = 1
	for r in range(cols-1,-1,-1):
		if(grid[c][r]=='#'):
			count=1
		else:
			up[c][r]+=count
			count+=1

#right

for c in range(rows):
	count = 1
	for r in range(cols):
		if(grid[c][r]=='#'):
			count=1
		else:
			up[c][r]+=count
			count+=1
ans = 1
for x in range(rows):
	for y in range(cols):
		if(grid[x][y]=='.'):
			ans=max(ans,(up[x][y]-3))
print(ans)

Fixed submission:
import sys
input = sys.stdin.readline
rows,cols = list(map(int,raw_input().split()))
grid=[]
up=[]
# down=[]
# left=[]
# right=[]
for i in range(rows):
	grid.append(raw_input())
	up.append([0 for j in range(cols)])
	# down.append([-1 for j in range(cols)])
	# left.append([-1 for j in range(cols)])
	# right.append([-1 for j in range(cols)])
#up
for c in range(cols):
	count = 1
	for r in range(rows-1,-1,-1):
		if(grid[r][c]=='#'):
			count=1
		else:
			up[r][c]+=count
			count+=1

#down

for c in range(cols):
	count = 1
	for r in range(rows):
		if(grid[r][c]=='#'):
			count=1
		else:
			up[r][c]+=count
			count+=1

#left

for c in range(rows):
	count = 1
	for r in range(cols-1,-1,-1):
		if(grid[c][r]=='#'):
			count=1
		else:
			up[c][r]+=count
			count+=1

#right

for c in range(rows):
	count = 1
	for r in range(cols):
		if(grid[c][r]=='#'):
			count=1
		else:
			up[c][r]+=count
			count+=1
ans = 1
for x in range(rows):
	for y in range(cols):
		if(grid[x][y]=='.'):
			ans=max(ans,(up[x][y]-3))
print(ans)
Buggy python submission (verdict: Runtime Error):
arr = []
for i in range(3):
	te = list(map(int,input().split()))
	arr.append(te)
n = int(input())
check = []
for i in range(n):
	x = int(input())
	for j in range(3):
		for k in range(3):
			if arr[j][k]==x:
				arr[j][k] = 0
yes = False
for j in range(3):
	c = 0
	for k in range(3):
		if arr[j][k]==0:
			c+=1
	if c==3:
		yes = True
		break
	
if yes==False:
	for j in range(3):
		c = 0
		for k in range(3):
			if arr[k][j]==0:
				c+=1
		if c==3:
			yes = True
			break
if yes==False:
	c = 0
	for j in range(3):		
		if arr[j][j]==0:
			c+=1
	if c==3:
		yes = True
if yes==False:
	c = 0
	for j in range(3):		
		if arr[j][2-j]==0:
			c+=1
	if c==3:
		yes = True
if yes:
	print("YES")
else:
	print("NO")					

Fixed submission:
arr = []
for i in range(3):
	te = list(map(int,input().split()))
	arr.append(te)
n = int(input())
check = []
for i in range(n):
	x = int(input())
	for j in range(3):
		for k in range(3):
			if arr[j][k]==x:
				arr[j][k] = 0
yes = False
for j in range(3):
	c = 0
	for k in range(3):
		if arr[j][k]==0:
			c+=1
	if c==3:
		yes = True
		break
	
if yes==False:
	for j in range(3):
		c = 0
		for k in range(3):
			if arr[k][j]==0:
				c+=1
		if c==3:
			yes = True
			break
if yes==False:
	c = 0
	for j in range(3):		
		if arr[j][j]==0:
			c+=1
	if c==3:
		yes = True
if yes==False:
	c = 0
	for j in range(3):		
		if arr[j][2-j]==0:
			c+=1
	if c==3:
		yes = True
if yes:
	print("Yes")
else:
	print("No")
Buggy python submission (verdict: Runtime Error):
x = [int(input()) for _ in range(5)]
t = 0
for i in range(x):
  t = ((t + 9) // 10) * 10
  t += x[i]
print(t)

Fixed submission:
from itertools import permutations
def solve(perm):
  t = 0
  for i in perm:
    t = ((t + 9) // 10) * 10
    t += x[i]
  return t

x = [int(input()) for _ in range(5)]
ans = min([solve(perm) for perm in permutations([i for i in range(len(x))])])
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())

def get_val(a, b):
    for i in range(10):
        x = (a >> i) % 2
        y = (b >> i) % 2
        if x != y:
            return (i + 1)

for i in range(1, N):
    print(*[get_val(i,j) for j in range(i + 1, n + 1)])


Fixed submission:
n = int(input())

def get_val(a, b):
    for i in range(10):
        x = (a >> i) % 2
        y = (b >> i) % 2
        if x != y:
            return (i + 1)

for i in range(1, n):
    print(*[get_val(i,j) for j in range(i + 1, n + 1)])
Buggy python submission (verdict: Runtime Error):
for t in range(int(input())):
  a,b,c,d=map(int,input().split(' '));l,x,y,o=(a+b)//(min(a,b)+1),0,0,""
	if a*l<=b:y=a+b
	elif b*l<=a:x=a+b
	else:x,y=(a*l-b)//(l-1),(b*l-a)//(l-1)
	for i in range(c,d+1):o+="AB"[i%(l+1)==0] if i<=x else "BA"[(a+b-i+1)%(l+1)==0] if a+b-i+1<=y else "AB"[a-x+x//(l+1)-y//(l+1)==0]
	print(o)

Fixed submission:
T=int(input())
for TT in range(T):
	a,b,c,d=map(int,input().split(' '))
	l,x,y,out=(a+b)//(min(a,b)+1),0,0,""
	if a*l<=b:y=a+b
	elif b*l<=a:x=a+b
	else:x,y=(a*l-b)//(l-1),(b*l-a)//(l-1) 
	for i in range(c,d+1):out+=("AB"[i%(l+1)==0]) if i<=x else "BA"[(a+b-i+1)%(l+1)==0] if a+b-i+1<=y else "AB"[a-x+x//(l+1)-y//(l+1)==0]
	print(out)
Buggy python submission (verdict: Runtime Error):
import sys
s = sys.stdin.readline()
assert len(s) <= 4
ans = 0
for i in range(len(s)):
    if s[i] == '+':
        ans += 1
    else:
        ans -= 1
print(ans)

Fixed submission:
s = input()
ans = 0
for i in range(len(s)):
    if s[i] == '+':
        ans += 1
    else:
        ans -= 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8

if __name__ == '__main__':
    n = int(input())
    p = 1
    for i in range(n):  #range(10) は [0,1,2,3,4,5,6,7,8,9] を表す
        p = p * (i+1)
    print(p % int(1e9 + 7))


Fixed submission:
# coding: utf-8

if __name__ == '__main__':
    n = int(input())
    p = 1
    for i in range(n):  #range(10) は [0,1,2,3,4,5,6,7,8,9] を表す
        p *= (i+1)
        p %= int(1e9 + 7)
    print(p)
Buggy python submission (verdict: Runtime Error):
N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
 
a,b = [0],[0]
for i in range(N):
    a.append(a[i]+A[i]
for i in range(M):
    b.append(b[i]+B[i])
 
ans,j = 0,M
for i in range(N+1):
    if a[i]>K:
        break    
    while b[j]>K-a[i]:
        j -= 1    
   ans = max(ans,i+j)
print(ans)

Fixed submission:
N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
 
a,b = [0],[0]
for i in range(N):
    a.append(a[i]+A[i])
for i in range(M):
    b.append(b[i]+B[i])
 
ans,j = 0,M
for i in range(N+1):
    if a[i]>K:
        break    
    while b[j]>K-a[i]:
        j -= 1    
    ans = max(ans,i+j)
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
def g(n):
    return n * (n + 1) // 2
 
ans = 0
for i in range(1, n+1)
    ans += i * g(n // i)
print(ans)

Fixed submission:
n = int(input())
def g(n):
    return n * (n + 1) // 2
 
ans = 0
for i in range(1, n+1):
    ans += i * g(n // i)
print(ans)
Buggy python submission (verdict: Runtime Error):
m=input()

m=n[-1]
if m==0,1,6,8:
  print("pon")
elif m==3:
  print("bon")
  
else:
  print("hon")

Fixed submission:
n=input()
m=int(n[-1])
 
 
 
 
 
if (m)==3:
    print("bon")
elif m==6 or m==8 or m==0 or m==1:
    print("pon")
    
else:
    print("hon")

Buggy python submission (verdict: Runtime Error):
N=input("what`s the number?")
N= int(N)
N=999
if (num==2,4,5,7,9):
  print("hon")
 
elif(num==0,1,6,8):
  print("pon")
  
else:
  print("bon")


Fixed submission:
n=input()
m=int(n[-1])
 
 
 
 
 
if (m)==3:
    print("bon")
elif m==6 or m==8 or m==0 or m==1:
    print("pon")
    
else:
    print("hon")
Buggy python submission (verdict: Runtime Error):
    S=input()
    T=input()
    if S==T[0:len(S)]:
      print("Yes")
    else:
      print("No")

Fixed submission:
S=input()
T=input()
if S==T[0:len(S)]:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
    S=input()
    T=input()
    if S==T[0:len(S)]:
      print("Yes")
    else:
      print("No")

Fixed submission:
S=input()
T=input()
if S==T[0:len(S)]:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
A, B, C, K = list(map(int, input().split( )))
     
  if(K < A):
    score = K
    elif(K >= A and K <= A+B):
      score = A
    else:
      score = A - (K - A - B)
     
    print(score)

Fixed submission:
A, B, C, K = list(map(int, input().split( )))
     
if(K < A):
      score = K
elif(K >= A and K <= A+B):
      score = A
else:
     score = A - (K - A - B)
     
print(score)

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

Fixed submission:
A, B, C, K = list(map(int, input().split( )))
     
if(K < A):
      score = K
elif(K >= A and K <= A+B):
      score = A
else:
     score = A - (K - A - B)
     
print(score)
Buggy python submission (verdict: Runtime Error):
x = int(input())
 
a = x // 500
b = (x % 500) // 5
 
ans = a * 1000 + b * 5
 
 print(ans)

Fixed submission:
x = int(input())

a = x // 500

b = (x % 500) // 5
 
ans = a * 1000 + b * 5
 
print(ans)
Buggy python submission (verdict: Runtime Error):
from math import sqrt
 
N = int(input())
 
search_max = int(sqrt(N))
 
min_number = 10**12
for x in range(1, search_max + 1):
    if N % x == 0:
        y = N // x
        if x + y < min_number:
            min_number = x + y
  print(min_number-2)

Fixed submission:
N = int(input())
search_max = int(N**0.5)
 
min_number = 10**12
for x in range(1, search_max + 1):
    if N % x == 0:
        y = N // x
        if x + y < min_number:
         
            min_number = x + y
print(min_number-2)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
search_max = int(N)
 
min_number = 10**12
for x in range(1, search_max + 1):
    if N % x == 0:
        y = N // x
        if x + y < min_number:
         
            min_number = x + y
print(min_number-2)

Fixed submission:
N = int(input())
search_max = int(N**0.5)
 
min_number = 10**12
for x in range(1, search_max + 1):
    if N % x == 0:
        y = N // x
        if x + y < min_number:
         
            min_number = x + y
print(min_number-2)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
search_max = int(N*N)
 
min_number = 10**12
for x in range(1, search_max + 1):
    if N % x == 0:
        y = N // x
        if x + y < min_number:
         
            min_number = x + y
print(min_number-2)

Fixed submission:
N = int(input())
search_max = int(N**0.5)
 
min_number = 10**12
for x in range(1, search_max + 1):
    if N % x == 0:
        y = N // x
        if x + y < min_number:
         
            min_number = x + y
print(min_number-2)

Buggy python submission (verdict: Runtime Error):
N = int(input())
search_max = int(sqrt(N))
 
min_number = 10**12
for x in range(1, search_max + 1):
    if N % x == 0:
        y = N // x
        if x + y < min_number:
         
            min_number = x + y
print(min_number-2)

Fixed submission:
N = int(input())
search_max = int(N**0.5)
 
min_number = 10**12
for x in range(1, search_max + 1):
    if N % x == 0:
        y = N // x
        if x + y < min_number:
         
            min_number = x + y
print(min_number-2)

Buggy python submission (verdict: Runtime Error):
N = int(input())
search_max = int(sqrt(N))

min_number = 10**12
for x in range(1, search_max + 1):
    if N % x == 0:
        y = N // x
        if x + y < min_number:
         
            min_number = x + y
  print(min_number-2)

Fixed submission:
N = int(input())
search_max = int(N**0.5)
 
min_number = 10**12
for x in range(1, search_max + 1):
    if N % x == 0:
        y = N // x
        if x + y < min_number:
         
            min_number = x + y
print(min_number-2)

Buggy python submission (verdict: Runtime Error):

N = int(input())
 
search_max = int(sqrt(N))
 
min_number = 10**12
for x in range(1, search_max + 1):
    if N % x == 0:
        y = N // x
        if x + y < min_number:
            min_number = x + y
 print(min_number-2)

Fixed submission:
N = int(input())
search_max = int(N**0.5)
 
min_number = 10**12
for x in range(1, search_max + 1):
    if N % x == 0:
        y = N // x
        if x + y < min_number:
         
            min_number = x + y
print(min_number-2)