Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
K,S=map(int,input().split())
cnt=0
for X in range(K+1):
  for Y in range(K+1):
    if 0<=S-X-Y and S-X-Y <= k:
      cnt+=1
print(cnt)

Fixed submission:
K,S=map(int,input().split())
cnt=0
for X in range(K+1):
  for Y in range(K+1):
    if 0<=S-X-Y and S-X-Y<=K:
      cnt+=1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
K,S=map(int,input().split())
cnt=0
for X in range(K+1):
  for Y in range(K+1):
    Z=S-X-Y
    if Z in range(K+1):
      cnt+=1
print(cnt)

Fixed submission:
K,S=map(int,input().split())
cnt=0
for X in range(K+1):
  for Y in range(K+1):
    if 0<=S-X-Y and S-X-Y<=K:
      cnt+=1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
a=input().split()
K=int(a[0])
S=int(a[1])
cnt=0
for X in range(0,K+1):
    for Y in range(X,K+1):
        for Z in range(Y,K+1):
            if X+Y+Z==S and X==Y and Y==Z:
                cnt+=1
            elif X+Y+Z==S and (X==Y or Y==Z or Z==X):
                cnt+=3
            elif X+Y+Z==S:
                cnt+=6
print(cnt)

Fixed submission:
K,S=map(int,input().split())
cnt=0
for X in range(K+1):
  for Y in range(K+1):
    if 0<=S-X-Y and S-X-Y<=K:
      cnt+=1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
a=input().split()
K=int(a[0])
S=int(a[1])
cnt=0
for X in range(0,K+1):
    for Y in range(0,K+1):
        for Z in range(0,K+1):
            if X+Y+Z==S:
                cnt+=1
print(cnt)

Fixed submission:
K,S=map(int,input().split())
cnt=0
for X in range(K+1):
  for Y in range(K+1):
    if 0<=S-X-Y and S-X-Y<=K:
      cnt+=1
print(cnt)
Buggy python submission (verdict: Runtime Error):
N = int(input())

for i in range(0,N//4+1):
    if (N - 4*i)%7 == 0:
        print('Yes')
        sys.exit()
print('No')

Fixed submission:
N = int(input())
for i in range(N//4+1):
    if (N - 4*i)%7 == 0:
        print('Yes')
        exit()
print('No')

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

for i in range(0,N//4):
    if (N - 4*i)%7 == 0:
        print('Yes')
        sys.exit()
print('No')

Fixed submission:
N = int(input())
for i in range(N//4+1):
    if (N - 4*i)%7 == 0:
        print('Yes')
        exit()
print('No')
Buggy python submission (verdict: Time Limit Exceeded):
def cal(n,s):
	val = [-1]*n
	for i in range(n):
		val[i] = sum(s[:i] == 'W') + sum(s[i+1:] == 'E')
	return min(val)

import numpy as np
n = int(input())
s = np.array(list(input()))
print(cal(n,s))

Fixed submission:
def cal(n,s):
	cum = np.cumsum(s == 'W')
	val = [-1]*n
	for i in range(n):
		W = cum[i-1]  if i-1 >= 0 else 0 #i <- W
		H = (n-i-1) - (cum[-1] - cum[i])	 #i -> H 
		val[i] = W+H
	return min(val)

import numpy as np

n = int(input())
s = np.array(list(input()))
print(cal(n,s))
Buggy python submission (verdict: Runtime Error):
s = list(input())
t = list(input())
s.sort()
t.sort()
s = ''.join(s)
t = ''.join(t)

[print('Yes') if s < t else print('No')]

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

x = (a+b)/2

if x != int(x):
	print(int(x) + 1)
else:
	print(int(x))
Buggy python submission (verdict: Runtime Error):
s = list(input())
t = list(input())
s.sort()
t.sort()

for s_, t_ in zip(s,t):
	if s_ < t_ :
		print('Yes')
		sys.exit()

if len(s) < len(t):
	print('Yes')
else:
	print('No')

Fixed submission:
s = list(input())
t = list(input())
s.sort()
t.sort(reverse = True)
s = ''.join(s)
t = ''.join(t)

[print('Yes') if s < t else print('No')]
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = [int(input()) for i in range(N)]

counter = 0
for i in set(a):
	if a.count(i)%2 == 1:
		counter += 1
print(counter)


Fixed submission:
#ソートして左から数えるver
N = int(input())
a = sorted([int(input()) for i in range(N)])

count_list = [1]*len(set(a))
j = 0

for i in range(len(a)-1):
	if a[i] == a[i+1]:
		count_list[j] += 1
	else:
		j += 1

print(sum([ i%2 == 1  for i in count_list]))
Buggy python submission (verdict: Runtime Error):
a,b,c =  list(map(int, input().split()))

for i in range(b):
	if (i+1)*a%(b) == c:
		print('YES')
		sys.exit()

print('NO')

Fixed submission:
import sys
a,b,c =  list(map(int, input().split()))

for i in range(b):
	if (i+1)*a%b == c:
		print('YES')
		sys.exit()

print('NO')

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

for i in range(b):
	if (i+1)*a%(b) == c:
		print('YES')
		sys.exit()

print('NO')

Fixed submission:
import sys
a,b,c =  list(map(int, input().split()))

for i in range(b):
	if (i+1)*a%b == c:
		print('YES')
		sys.exit()

print('NO')

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

for i in range(b):
	if i*a%(b+1) == c:
		print('YES')
		sys.exit()

print('NO')

Fixed submission:
import sys
a,b,c =  list(map(int, input().split()))

for i in range(b):
	if (i+1)*a%b == c:
		print('YES')
		sys.exit()

print('NO')

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

for i in range(b):
	if i*a%b == c:
		print('YES')
		sys.exit()

print('NO')

Fixed submission:
import sys
a,b,c =  list(map(int, input().split()))

for i in range(b):
	if (i+1)*a%b == c:
		print('YES')
		sys.exit()

print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
def cal(n):
	ans = 1
	for i in range(1,n+1):
		ans *= i
	rm = ans%(10**9 + 7)
	return rm

N = int(input().strip())
print(cal(N))


Fixed submission:
def cal(n):
	ans = 1
	for i in range(n):
		ans = ((i+1) * ans) % (1000000007)
	return ans

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

k,s = map(int,input().strip().split())

count = 0
for i in range(k+1):
    for j in range(k+1):
        for l in range(k+1):
            if i+l+j == s:
                count += 1
            else:
                continue

print(count)



Fixed submission:
k,s = map(int,input().strip().split())
count= 0
for x in range(k+1):
    for y in range(k+1):
        if s-x-y >= 0 and s-x-y <= k:
            count += 1
        
        
print(count)
Buggy python submission (verdict: Runtime Error):
a = input()
b = 700
for x in a:
	if x == "o":
    	b += 100
	else:
    	pass
print(b)
   

Fixed submission:
a = input()
b = 700
for x in a:
    if x == "o":
       b += 100
    else:
        pass
print(b)
Buggy python submission (verdict: Runtime Error):
import math
 
a = list(map(int,input().split()))
 
c = reduce((lambda x,y: (x+y)/2 ,a)
 
print(math.ceil(c))



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

Buggy python submission (verdict: Runtime Error):
import math
 
a = list(map(int,input().split()))
 
c = reduce((lambda x,y: (x+y)/2 ,a)
 
print(math.cell(c))

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

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

a = int(input())
b = int(input())

c = (a + b)/2 

print(math.cell(c))

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

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

a = int(input())
b = int(input())

c = a * b / 2
print(math.cell(c))

Fixed submission:
import math
a,b = map(int,input().split())
print(math.ceil((a+b)/2))
Buggy python submission (verdict: Runtime Error):
a = input()
d = 0
for x in range(a):
    b ,c = map(int,input().split())
    d = c-b+1
print(d)

Fixed submission:
a =int( input())
d = 0

for x in range(a):
    b ,c = map(int,input().split())
    d += c-b+1
print(d)
Buggy python submission (verdict: Runtime Error):
a = input()
print(a[0]+len(a)-2+a[-1])

Fixed submission:
a = input()
print(a[0]+str(len(a)-2)+a[-1])
Buggy python submission (verdict: Runtime Error):
c = list(map(int,input().split()))
a = reduce((lambda x , y: x * y),c)
if a%4 == 0:
    print("YES")
else:
    print("NO")


Fixed submission:
a = int(input().replace(' ' ,''))
if a%4 == 0:
    print("YES")
else:
    print("NO")

Buggy python submission (verdict: Runtime Error):
c = list(map(int,input().split()))
a = reduce(lambda x , y: x * y),c)
if a%4 == 0:
    print("YES")
else:
    print("NO")

Fixed submission:
a = int(input().replace(' ' ,''))
if a%4 == 0:
    print("YES")
else:
    print("NO")

Buggy python submission (verdict: Runtime Error):
c = list(map(int,input().split()))
print(reduce(lambda x , y: x * y),c)

Fixed submission:
a = int(input().replace(' ' ,''))
if a%4 == 0:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
N=int(input().rstrip().split())
An=list(map(int, input().rstrip().split()))
cnt=0
while True:
    if len(list(filter(lambda a:(a+1)%2, An))) < len(An):
        break
    An=list(map(lambda a:int(a/2), An))
    cnt+=1
print(cnt)


Fixed submission:
N=int(input())
An=list(map(int, input().rstrip().split()))
cnt=0
while True:
    if len(list(filter(lambda a:(a+1)%2, An))) < len(An):
        break
    An=list(map(lambda a:int(a/2), An))
    cnt+=1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
K,S=map(int,input().split())
print(len([1 for i in range(K+1) for j in range(K+1) for k in range(K+1) if i+j+k==S]))


Fixed submission:
K,S=map(int,input().split()) 
print(len([True for x in range(K+1) for y in range(K+1) if (S-x-y>=0) and (S-x-y<=K)]))
Buggy python submission (verdict: Runtime Error):
n = input()
t, a = map(int, input().split())
h_list = list(map(int, input().split()))

temp = abs(a - (t - h[0] * 0.006))
result = 1
i=1
for h in h_list:
    if abs(a - (t - h * 0.006)) < temp:
        temp = abs(a - (t - h * 0.006))
        result = i
    i += 1
print(i)

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

temp = abs(a - (t - h_list[0] * 0.006))
result = 1
i=1
for h in h_list:
    if abs(a - (t - h * 0.006)) < temp:
        temp = abs(a - (t - h * 0.006))
        result = i
    i += 1
print(result)
Buggy python submission (verdict: Runtime Error):
n, x = map(int, input().split())


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

total=0
ans=0
for i in range(n):
  total += a[i]
 
  if total > x:
    ans = i
    break
  else if total ==x:
    ans = i+1
    break
  else:
    ans=i
  
print(ans)

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


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

total=0
ans=0
for i in range(n):
  total += a[i]
 
  if total > x:
    ans = i
    break
  elif total ==x:
    ans = i+1
    break
  else:
    ans=i
  
print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
a = list(s)
result = 700
for i in a:
  if i == o:
    result += 100
print(result)


Fixed submission:
s = input()
a = list(s)
result = 700
for i in a:
  if i == "o":
    result += 100
print(result)

Buggy python submission (verdict: Runtime Error):
s = input()
a = list(s)
result = 700
for i in a:
  if a[i] == o:
    result += 100
print(result)

Fixed submission:
s = input()
a = list(s)
result = 700
for i in a:
  if i == "o":
    result += 100
print(result)
Buggy python submission (verdict: Runtime Error):
n, x = map(int, input().split())
list_m = [1]*n
for i in n:
    list_m[i] = int(input())
    
min = min(list_m)
sum = sum(list_m)

x -= sum

result = int(x/min) + n
print(result)

Fixed submission:
n, x = map(int, input().split())
list_m = [1]*n
for i in range(0, n):
    list_m[i] = int(input())
    
min = min(list_m)
sum = sum(list_m)

x -= sum

result = int(x/min) + n
print(result)

Buggy python submission (verdict: Runtime Error):
n, x = map(int, index().split())
list_n = [0]*x
for i in range(0, x-1)
    list_n[i] = input()
    
min = min(list_n)
sum = sum(list_n)

x -= sum
result = int(x/min) + n
print(result)

Fixed submission:
n, x = map(int, input().split())
list_m = [1]*n
for i in range(0, n):
    list_m[i] = int(input())
    
min = min(list_m)
sum = sum(list_m)

x -= sum

result = int(x/min) + n
print(result)
Buggy python submission (verdict: Runtime Error):
n = int(input())
flag = [0] * 101

for i in n:
    d = input()
    flag[d] = 1

for i in 101:
    result += flag[i]

print(result)

Fixed submission:
n = int(input())
flag = [0] * 101

for i in range(n):
    d = int(input())
    flag[d] = 1

result = 0
for i in range(101):
    result += flag[i]

print(result)
Buggy python submission (verdict: Runtime Error):
n = int(input())
List=list(map(int,input().split()))
result = 0


while true:
	for j in range(n):
		if List[j]%2 != 0:
			break
		List[j] /= 2

	else:
		result += 1
		continue
	break
  
print(result)

Fixed submission:
n = int(input())
List=list(map(int,input().split()))
result = 0


for i in range(200):
	for j in range(n):
		if List[j]%2 != 0:
			break
		List[j] /= 2

	else:
		result += 1
		continue
	break
  
print(result)

Buggy python submission (verdict: Runtime Error):
n = int(input())
List=list(map(int,input().split()))
result = 0


for i in 200:
	for j in range(n):
		if List[j]%2 != 0:
			break
		List[j] /= 2

	else:
		result += 1
		continue
	break
  
print(result)

Fixed submission:
n = int(input())
List=list(map(int,input().split()))
result = 0


for i in range(200):
	for j in range(n):
		if List[j]%2 != 0:
			break
		List[j] /= 2

	else:
		result += 1
		continue
	break
  
print(result)
Buggy python submission (verdict: Runtime Error):
s = input()
print(s[0] + len(s)-2 + s[-1]) 


Fixed submission:
s = input()
print(s[0] + str(len(s)-2) + s[-1])

Buggy python submission (verdict: Runtime Error):
s = input()
print(s[0] + s.length-2 + s[-1]) 

Fixed submission:
s = input()
print(s[0] + str(len(s)-2) + s[-1])
Buggy python submission (verdict: Runtime Error):
n=int(input())
result = 0
for i in range(n):
  a = n-i
  while True:
    if a % 2 == 1:
      break
    else:
      if a == 2:
        print(n-i)
        sys.exit()
      else:
        a /= 2


Fixed submission:
import sys

n=int(input())
if n==1:
  print(1)
  sys.exit()
result = 0
for i in range(n):
  a = n-i
  while True:
    if a % 2 == 1:
      break
    else:
      if a == 2:
        print(n-i)
        sys.exit()
      else:
        a /= 2
Buggy python submission (verdict: Time Limit Exceeded):
try:
    K, S = map(int, input().split())
    cnt = 0
    for x in range(K+1):
        for y in range(K+1):
            for z in range(K+1):
                if x+y+z==S:
                    cnt += 1
    print(cnt)
except EOFError:
    pass

Fixed submission:
try:
    K, S = map(int, input().split())
    cnt = 0
    for x in range(K+1):
        for y in range(K+1):
            z = S-x-y
            if 0<=z<=K:
                cnt += 1
    print(cnt)
except EOFError:
    pass

Buggy python submission (verdict: Time Limit Exceeded):
try:
    K, S = map(int, input().split())
    cnt = 0
    for x in range(K+1):
        for y in range(K+1):
            for z in range(K+1):
                if x+y+z==S:
                    cnt += 1
                    break
    print(cnt)
except EOFError:
    pass

Fixed submission:
try:
    K, S = map(int, input().split())
    cnt = 0
    for x in range(K+1):
        for y in range(K+1):
            z = S-x-y
            if 0<=z<=K:
                cnt += 1
    print(cnt)
except EOFError:
    pass

Buggy python submission (verdict: Time Limit Exceeded):
try:
    K, S = map(int, input().split())
    cnt = 0
    for x in range(K+1):
        for y in range(K+1):
            for z in range(K+1):
                if x+y+z==S:
                    cnt += 1
    print(cnt)
except EOFError:
    pass

Fixed submission:
try:
    K, S = map(int, input().split())
    cnt = 0
    for x in range(K+1):
        for y in range(K+1):
            z = S-x-y
            if 0<=z<=K:
                cnt += 1
    print(cnt)
except EOFError:
    pass
Buggy python submission (verdict: Runtime Error):
n = input()
a = input()
j = n % 500
if (j <= a):
  print("YES")
else:
  print("NO")

Fixed submission:
n = int(input())
a = int(input())
j = n % 500
if (j <= a):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
a,b = map(int, input().split())
c = mod(a*b, 2)
if (c == 0) :
	print("Odd")
else:
	print("Even")

Fixed submission:
a,b = map(int, input().split())
c = a*b % 2
if (c == 1):
	print("Odd")
else:
	print("Even")

Buggy python submission (verdict: Runtime Error):
a,b = map(int, input().split())
c = mod(a*b, 2)
if (c == 0)
	print("Odd")
else if
	print("Even")

Fixed submission:
a,b = map(int, input().split())
c = a*b % 2
if (c == 1):
	print("Odd")
else:
	print("Even")
Buggy python submission (verdict: Runtime Error):
 import math
import sys
import numpy as np

#n, a, b= map(int, input().split())
w, h, n  = map(int, input().split())
#s = list(str(input()))
#n = int(input())
#a = list(map(int, input().split()))

x = [0]*n
y = [0]*n
a = [0]*n
for i in range(n):
  x[i], y[i], a[i] = map(int, input().split())
area = np.ones([w,h])

for i in range(n):
  if(a[i] == 1):
    area[:x[i],:] = 0
  if(a[i] == 2):
    area[w-x[i]-1:w,:] = 0
  if(a[i] == 3):
    area[:,:y[i]] = 0
  if(a[i] == 4):
    area[:,h-y[i]-1] = 0

print(np.count_nonzero(area == 1))

Fixed submission:
import math
import sys
import numpy as np

#n, a, b= map(int, input().split())
w, h, n  = map(int, input().split())
#s = list(str(input()))
#n = int(input())
#a = list(map(int, input().split()))

x = [0]*n
y = [0]*n
a = [0]*n
for i in range(n):
  x[i], y[i], a[i] = map(int, input().split())
area = np.ones([w,h])

for i in range(n):
  if(a[i] == 1):
    area[:x[i],:] = 0
  if(a[i] == 2):
    area[x[i]:,:] = 0
  if(a[i] == 3):
    area[:,:y[i]] = 0
  if(a[i] == 4):
    area[:,y[i]:] = 0

print(np.count_nonzero(area == 1))
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=map(int, input().split())
maxnum=max(A)
minnum=min(A)
print(maxnum-minnum)

Fixed submission:
N=int(input())
A=list(map(int, input().split()))
print(max(A)-min(A))

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=map(int, input().split())
maxnum=max(A)
minnum=min(A)
print(maxnum-minnum)


Fixed submission:
N=int(input())
A=list(map(int, input().split()))
print(max(A)-min(A))
Buggy python submission (verdict: Runtime Error):
a,b = map(int, input().split())
c = a*b
mod = c % 2
if mod==0
   print("Even")
else print("Odd")


Fixed submission:
a,b = map(int, input().split())
c = a*b
mod = c % 2
if mod==0:
   print("Even")
else:
   print("Odd")
Buggy python submission (verdict: Runtime Error):
s=input()
N=len(s)
print(s[0]+ str(N-2)+s[N])

Fixed submission:
S=str(input())
L=len(S)
print(S[0]+str(L-2)+S[L-1])
Buggy python submission (verdict: Runtime Error):
N, x = map(int, input().split())
an = list(map(int, input().split()))
an.sort()
flag = [0]*N
count = 0
i = 0
xs = x
while(1):
  if x >= an[i]:
    x -= an[i]
    if flag[i] == 0:
      flag[i] += 1
      count += 1
    elif flag[i] == 1:
      flag[i] += 1
      count -= 1
      i = 0
    else:
      i = 0
  if x == 0:
    break
  i += 1
  if i >= N:
    i = 0
    if xs == x:
      break
print(count)v

Fixed submission:
N, x = map(int, input().split())
an = list(map(int, input().split()))
an.sort()
count = 0
for i in range(N):
  x -= an[i]
  if x >= 0:
    count += 1
  else:
    break
if x > 0:
  count -= 1
print(count)
Buggy python submission (verdict: Runtime Error):
N, X = map(int, input().split())

mn = [0]*N
for i in range(N):
  mn[i] = int(input())
  
ans = N
x = X - sum(mn)

while(x >= min(mn)):
  if x // min(mn) == 0:
    mn[mn.index(min(mn))] = 1000000
  else:
    if x >= min(mn):
      x -= min(mn)
      ans += 1
      
print(ans)

Fixed submission:
print(700 + 100*(input().count('o')))
Buggy python submission (verdict: Runtime Error):
print('Yes'*(sorted(input())<sorted(input())[::-1])or'No')

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

print(int((a+b)/2)+(a+b)%2)

Buggy python submission (verdict: Runtime Error):
s1 = input()
t1 = input()

s = list(s1)
t = list(t1)

s.sort()
t.sort(reverse=1)

i = 0
while(1):
  if ord(s[i]) < ord(t[i]):
    print('YES')
    break
  else :
    if i+1 == min(len(s1),len(t1)):
    	print('NO')
    	break
    else : i+=1

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

print(int((a+b)/2)+(a+b)%2)

Buggy python submission (verdict: Runtime Error):
print(-~sum(map(int, imput().split()))//2)

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

print(int((a+b)/2)+(a+b)%2)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))

ct = 0
while(1) :
  count = 0
  for i in range(n):
    if a[i]%2 != 0:
      count+=1
  if count != 0:
    break
  else:
    a1 = [j/2 for j in a]
    a = a1
    ct += 1
  
print(ct)

Fixed submission:
s = input()
c = 0

for si in s:
  if si == '1': c+=1
    
print(c)
Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int, input().split())
ct = 0
for X in range(K+1):
  if S - X > 0:
    for Y in range(K+1):
      if S - (X + Y) > 0:
        for Z in range(K+1):
          ct += (1 if X + Y + Z == S else 0)
      else:
        ct += (1 if X + Y == S else 0)
  else:
    ct += (1 if X == S else 0)
print(ct)

Fixed submission:
K, S = map(int, input().split())
ct = 0
for X in range(K+1):
  for Y in range(K+1):
    if S - (X + Y) >= 0 and S - (X + Y) <= K :
        ct += 1 

print(ct)

Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int, input().split())
ct = 0
for X in range(K+1):
  for Y in range(K+1):
    for Z in range(K+1):
      ct += (1 if X + Y + Z == S else 0)
print(ct)

Fixed submission:
K, S = map(int, input().split())
ct = 0
for X in range(K+1):
  for Y in range(K+1):
    if S - (X + Y) >= 0 and S - (X + Y) <= K :
        ct += 1 

print(ct)
Buggy python submission (verdict: Runtime Error):
import math
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input())
before=math.fabs(t-h[0]*0.006-a)
print(before)
mi=0
for i in range(n-1):
    diff=before-math.fabs(t-h[i+1]*0.006-a)
    if diff>0:
       before=math.fabs(t-h[i+1]*0.006-a)
       mi=i+1
print(mi)

Fixed submission:
import math
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
before=math.fabs(t-h[0]*0.006-a)
num=1
for i in range(n-1):
  diff=before-math.fabs(t-h[i+1]*0.006-a)
  if diff>0:
    before=math.fabs(t-h[i+1]*0.006-a)
    num=i+2
print(num)

Buggy python submission (verdict: Runtime Error):
import math
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input())
before=math.fabs(t-h[0]*0.006-a)
mi=0
for i in range(n-1):
    diff=before-math.fabs(t-h[i+1]*0.006-a)
    if diff>0:
       before=math.fabs(t-h[i+1]*0.006-a)
       mi=i+1
print(mi)

Fixed submission:
import math
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
before=math.fabs(t-h[0]*0.006-a)
num=1
for i in range(n-1):
  diff=before-math.fabs(t-h[i+1]*0.006-a)
  if diff>0:
    before=math.fabs(t-h[i+1]*0.006-a)
    num=i+2
print(num)

Buggy python submission (verdict: Runtime Error):
import math
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input())
before=math.fabs(t-h[0]*0.006-a)
mi=0
for i in range(n-1):
    diff=before-math.fabs(t-h[i+1]*0.006-a)
    if diff<0:
       mi=i+1
print(mi)

Fixed submission:
import math
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
before=math.fabs(t-h[0]*0.006-a)
num=1
for i in range(n-1):
  diff=before-math.fabs(t-h[i+1]*0.006-a)
  if diff>0:
    before=math.fabs(t-h[i+1]*0.006-a)
    num=i+2
print(num)

Buggy python submission (verdict: Runtime Error):
import math
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input())
t_list=[]
for i in range(n):
    math.fabs(t-h[i]*0.006-a)
print(min(t_list))

Fixed submission:
import math
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
before=math.fabs(t-h[0]*0.006-a)
num=1
for i in range(n-1):
  diff=before-math.fabs(t-h[i+1]*0.006-a)
  if diff>0:
    before=math.fabs(t-h[i+1]*0.006-a)
    num=i+2
print(num)