Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N=int(input())
cnt = [0]*100000
for i in range(N):
  l, r = map(int, input().split())
  for j in range(l, r+1):
    cnt[j]=1
print(sum(cnt))

Fixed submission:
N=int(input())
cnt = [0]*100002
for i in range(N):
  l, r = map(int, input().split())
  for j in range(l, r+1):
    cnt[j]=1
print(sum(cnt))

Buggy python submission (verdict: Runtime Error):
N=int(input())
cnt = [0]*100000
for i in range(N):
  l, r = map(int, input().split())
  for j in range(l, r+1):
    cnt[j]+=1
print(sum(cnt))

Fixed submission:
N=int(input())
cnt = [0]*100002
for i in range(N):
  l, r = map(int, input().split())
  for j in range(l, r+1):
    cnt[j]=1
print(sum(cnt))
Buggy python submission (verdict: Runtime Error):
n=int(input())
ans=[0]*1000000002
for i in range(n):
  num=int(input())
  if ans[num] == 0:
    ans[num]+=1
  else:
    ans[num]=0
print(sum(ans))

Fixed submission:
n = int(input())
d = set()
for i in range(n):
    a = int(input())
    if a in d:
        d.remove(a)
    else:
        d.add(a)
print(len(d))

Buggy python submission (verdict: Runtime Error):
n=int(input())
ans=[0]*100002
for i in range(n):
  num=int(input())
  if ans[num] == 0:
    ans[num]+=1
  else:
    ans[num]=0
print(sum(ans))

Fixed submission:
n = int(input())
d = set()
for i in range(n):
    a = int(input())
    if a in d:
        d.remove(a)
    else:
        d.add(a)
print(len(d))
Buggy python submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
cnt = [0]*100002
for a in A:
  cnt[a-1]+=1
  cnt[a]+=1
  cnt[a+1]+=1
print(max(cnt)

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
cnt = [0]*100002
for a in A:
  cnt[a-1]+=1
  cnt[a]+=1
  cnt[a+1]+=1
print(max(cnt))
Buggy python submission (verdict: Runtime Error):
n=int(input())
p=list(map(int,input().split()))
cnt=0
for i in range(n):
  if i+1 == p[i]:
    p[i+1]=p[i]
    cnt+=1
print(cnt)


Fixed submission:
n=int(input())
p=list(map(int,input().split()))
cnt=0
for i in range(n-1):
  if i+1 == p[i]:
    p[i+1]=p[i]
    cnt+=1
if p[n-1] == n:
  cnt+=1
print(cnt)
Buggy python submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
c=[0]*(n+1)
for i in A:
  c[i] += 1
cnt=0
ans=0
for j in reversed(range(n)):
  if c[j]>=2 and cnt==0:
    ans=j
    cnt+=1
  elif c[j]>= 2 and cnt==1:
    ans*=j
    break
print(ans)

Fixed submission:
c={}
input()
for i in list(map(int,input().split())):
    if i in c:
        c[i]+=1
    else:
        c[i]=1
d=[i for i in c.items() if i[1]>1]
c=sorted(d)
if len(d)==0 or (len(d)==1 and c[-1][1]<4):
    print(0)
else:
    if c[-1][1]>3:
        print(c[-1][0]**2)
    else:
        print(c[-1][0]*c[-2][0])

Buggy python submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
C=[0]*(n+1)
for i in A:
  C[i] += 1
cnt=0
ans=0
for j in reversed(range(n)):
  if C[j]>=2 and cnt==0:
    ans=j
    cnt+=1
  elif C[j]>= 2 and cnt==1:
    ans*=j
    break
print(ans)

Fixed submission:
c={}
input()
for i in list(map(int,input().split())):
    if i in c:
        c[i]+=1
    else:
        c[i]=1
d=[i for i in c.items() if i[1]>1]
c=sorted(d)
if len(d)==0 or (len(d)==1 and c[-1][1]<4):
    print(0)
else:
    if c[-1][1]>3:
        print(c[-1][0]**2)
    else:
        print(c[-1][0]*c[-2][0])

Buggy python submission (verdict: Runtime Error):
n=int(input())
A=[0]*(n+1)
for i in list(map(int, input().split())):
  A[i] += 1
cnt=0
ans=0
for j in reversed(range(n)):
  if A[j]>=2 and cnt==0:
    ans=j
    cnt+=1
  elif A[j]>= 2 and cnt==1:
    ans*=j
    break
print(ans)

Fixed submission:
c={}
input()
for i in list(map(int,input().split())):
    if i in c:
        c[i]+=1
    else:
        c[i]=1
d=[i for i in c.items() if i[1]>1]
c=sorted(d)
if len(d)==0 or (len(d)==1 and c[-1][1]<4):
    print(0)
else:
    if c[-1][1]>3:
        print(c[-1][0]**2)
    else:
        print(c[-1][0]*c[-2][0])

Buggy python submission (verdict: Runtime Error):
n=int(input())
A=[0]*(n+1)
for i in list(map(int, input().split())):
  A[i] += 1
cnt=0
ans=0
for j in reversed(range(n)):
  if A[j]>=2 and cnt==0:
    ans=j
    cnt+=1
  elif A[j]>= 2 and cnt==1:
    ans*=j
    break
print(ans)

Fixed submission:
c={}
input()
for i in list(map(int,input().split())):
    if i in c:
        c[i]+=1
    else:
        c[i]=1
d=[i for i in c.items() if i[1]>1]
c=sorted(d)
if len(d)==0 or (len(d)==1 and c[-1][1]<4):
    print(0)
else:
    if c[-1][1]>3:
        print(c[-1][0]**2)
    else:
        print(c[-1][0]*c[-2][0])
Buggy python submission (verdict: Runtime Error):
import math
n=int(input())
def lcm(a, b):
  return (a * b) // math.gcd(a, b)
num = 1
for i in range(n):
  num = lcm(num, int(input()))

print(num)

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

def lcm(a, b):
  return (a * b) // gcd(a, b)
num = 1
for i in range(n):
  num = lcm(num, int(input()))

print(num)

Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce
n=int(input())
T=[int(input())for _ in range(n)]
def lcm(a, b):
  return (a * b) // math.gcd(a, b)

def lcm_list(num):
  return reduce(lcm, num, 1)

print(lcm_list(T))

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

def lcm(a, b):
  return (a * b) // gcd(a, b)
num = 1
for i in range(n):
  num = lcm(num, int(input()))

print(num)
Buggy python submission (verdict: Runtime Error):
from math import gcd
n,k=map(int,input().split())
A=list(map(int,input().split()))
ans=""
if max(A)<k:
  ans="IMPOSSIBLE"
elif k in A:
  ans="POSSIBLE"
else:
  g=gcd(A[0], A[1])
  for i in range(2,n):
    g=gcd(g,A[i])
  if g!=0 and k%g==0:
    ans="POSSIBLE"
  else:
    ans="IMPOSSIBLE"
print(ans)

Fixed submission:
from fractions import gcd
n,k=map(int,input().split())
A=list(map(int,input().split()))
ans=""
if max(A)<k:
  ans="IMPOSSIBLE"
elif k in A:
  ans="POSSIBLE"
else:
  g=gcd(A[0], A[1])
  for i in range(2,n):
    g=gcd(g,A[i])
  if g!=0 and k%g==0:
    ans="POSSIBLE"
  else:
    ans="IMPOSSIBLE"
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
ans = abs(A[0] - sum(A[1:]))
for i in range(1, N-1):
  ans = min(abs(sum(A[:i]) - sum(A[i:])), ans)
print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
X = sum(A)
xi = A[0]
ans = abs(X - 2 * A[N-1])
for i in range(1, N-1):
  xi += A[i]
  ans = min(abs(X - 2 * xi), ans)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
b=[]
for i in range(n):
  if i%2==0:
    b.append(str(a[i]))
  else:
    b.insert(0, str(a[i]))
if n%2==0:
  print(" ".join(b))
else:
  print(" ".join(list(reversed(b))))

Fixed submission:
import collections
N = int(input())
A = [i for i in input().split()]
 
ans = collections.deque()
for i in range(N):
    if (i+1)%2==N%2:
        ans.appendleft(A[i])
    else:
        ans.append(A[i])
print(*ans)
Buggy python submission (verdict: Runtime Error):
from math import factorial
n,m=map(int,input().split())
mod=10**9+7
f=factorial(n)
if abs(n-m)>1:
  print(0)
elif abs(n-m)==1:
  print((f**2)%mod)
else :
  print((2*f**2%mod)


Fixed submission:
from math import factorial
n,m=map(int,input().split())
MOD=10**9+7
if abs(n-m)>1:
  print(0)
elif abs(n-m)==1:
  print(factorial(n)*factorial(m)%MOD)
else:
  print(2*factorial(n)*factorial(m)%MOD)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
c = 0
s = set()

for a in A:
  if a >= 3200:
    c += 1
  else:
    s.add(a//400
print(max(1, len(s)), len(s) + c)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
c = 0
s = set()

for a in A:
  if a >= 3200:
    c += 1
  else:
    s.add(a//400)
print(max(1, len(s)), len(s) + c)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = [int(input()) for _ in range(N)]
S.sort(reverse=True)
ans = sum(S)
while (ans % 10) == 0:
  ans -= S.pop(0)
print(ans)

Fixed submission:
N = int(input())
S = [int(input()) for _ in range(N)]
total = sum(S)
if total % 10 != 0:
  print(total)
else:
  num = [n for n in S if n % 10 != 0]
  if len(num) == 0:
    print(0)
  else:
    print(total - min(num))

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = [int(input()) for _ in range(N)]
S.sort()
ans = sum(S)
while (ans % 10) == 0:
  ans -= S.pop(0) 
print(ans)

Fixed submission:
N = int(input())
S = [int(input()) for _ in range(N)]
total = sum(S)
if total % 10 != 0:
  print(total)
else:
  num = [n for n in S if n % 10 != 0]
  if len(num) == 0:
    print(0)
  else:
    print(total - min(num))

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = [int(input()) for _ in range(N)]
sorted(S, reverse=True)
ans = sum(S)
while (ans % 10) == 0:
  ans -= S.pop(0)
print(ans)

Fixed submission:
N = int(input())
S = [int(input()) for _ in range(N)]
total = sum(S)
if total % 10 != 0:
  print(total)
else:
  num = [n for n in S if n % 10 != 0]
  if len(num) == 0:
    print(0)
  else:
    print(total - min(num))
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int, input().split()))
m=[]
m.append([A[0]])
j=0
f=True
if A[0] > A[1]:
  f=False
for i in range(1,N):
  if A[i-1] <= A[i] and f:
    m[j].append(A[i])
  elif A[i-1] >= A[i] and not f:
    m[j].append(A[i])
  else:
    j+=1
    m.append([])
    m[j].append(A[i])
    if i != N-1:
      f=True if A[i] < A[i+1] else False
print(len(m))


Fixed submission:
N=int(input())
A=list(map(int, input().split()))
ans=1
for i, a in enumerate(A):
  if i==0:
    flag=0
  elif flag==0 and a==A[i-1]:
    pass
  elif a>=A[i-1] and flag>=0:
    flag=1
  elif a<=A[i-1] and flag<=0:
    flag=-1
  else:
    flag=0
    ans+=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
MOD = 10 ** 9 + 7
ans = 1
for i in range(1, N + 1):
  ans *= i

print(ans % MOD)

Fixed submission:
N = int(input())
MOD = 10 ** 9 + 7
ans = 1
for i in range(1, N + 1):
  ans *= i
  ans %= MOD

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

if A == 1:
  A = 14

if B == 1:
  B = 14

if A < B:
  print("Bob")
elif B < A:
  print("Alice")
elif B == A:
  pritn("Draw")

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

if A == 1:
  A = 14

if B == 1:
  B = 14

if A < B:
  print("Bob")
elif B < A:
  print("Alice")
elif B == A:
  print("Draw")
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

for i in range(N - M + 1):
  for j in range(N - M + 1):
    ok = True
    if A[i + j][j:j + M] != B[k]:
      ok = False
      break
    if ok:
      print("Yes")
      exit()
print("No")

Fixed submission:
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]
ans = "No"

for i in range(N - M + 1):
  for j in range(N - M + 1):
    if [a[j:j+M] for a in A[i:i+M]] == B:
      ans = "Yes"
print(ans)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

for i in range(N - M + 1):
  for j in range(N - M + 1):
    ok = True
    if A[i + k][j:j + M] != B[k]:
      ok = False
      break
    if ok:
      print("Yes")
      exit()
print("No")

Fixed submission:
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]
ans = "No"

for i in range(N - M + 1):
  for j in range(N - M + 1):
    if [a[j:j+M] for a in A[i:i+M]] == B:
      ans = "Yes"
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
MOD = 10 ** 9 + 7
x = 1
for i in range(2, N + 1):
  x *= i

count = 1
for i in range(2, N + 1):
  if x % i != 0:
    continue
  count = 1
  while x % i == 0:
    x //= i
    count += 1
  ans *= count
print(ans % MOD)

Fixed submission:
N = int(input())
MOD = 10 ** 9 + 7
x = 1
for i in range(2, N + 1):
  x *= i

count = 1
ans = 1
for i in range(2, N + 1):
  if x % i != 0:
    continue
  count = 1
  while x % i == 0:
    x //= i
    count += 1
  ans *= count
print(ans % MOD)
Buggy python submission (verdict: Runtime Error):
s = input().split(",")
print(" ".join(s))⏎

Fixed submission:
s = input().split(",")
print(" ".join(s))
Buggy python submission (verdict: Time Limit Exceeded):
N, x = map(int, input().split())
a = list(map(int, input().split()))
ans = 0

for i in range(0, N - 1):
  while (a[i] + a[i + 1]) > x:
    a[i + 1] -= 1
    ans += 1
print(ans)

Fixed submission:
N, x = map(int, input().split())
a = list(map(int, input().split()))
ans = 0

for i in range(N - 1):
  total = a[i] + a[i + 1]
  if total > x:
    a[i + 1] = max(0, a[i + 1] - (total - x))
    ans += (total - x)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a,b=map(int,input().split())
ans=a
for i in range(a+1, b+1):
  ans *= i
if ans > 0:
  print("Positive")
elif ans == 0:
  print("Zero") 
else:
  print("Negative")


Fixed submission:
a,b=map(int,input().split())
if a>0:
  print("Positive")
elif a*b<=0:
  print("Zero")
else:
  if abs(b-a)%2==0:
    print("Negative")
  else:
    print("Positive")

Buggy python submission (verdict: Time Limit Exceeded):
a,b=map(int,input().split())
ans=a
for i in range(a+1, b+1):
  ans *= i
if ans > 0:
  print("Positive")
elif ans == 0:
  print("Zero") 
else:
  print("Negative")


Fixed submission:
a,b=map(int,input().split())
if a>0:
  print("Positive")
elif a*b<=0:
  print("Zero")
else:
  if abs(b-a)%2==0:
    print("Negative")
  else:
    print("Positive")

Buggy python submission (verdict: Time Limit Exceeded):
a,b=map(int,input().split())
ans=a
for i in range(a+1, b+1):
  ans *= i
if ans > 0:
  print("Positive")
elif ans == 0:
  print("Zero") 
else:
  print("Negative")


Fixed submission:
a,b=map(int,input().split())
if a>0:
  print("Positive")
elif a*b<=0:
  print("Zero")
else:
  if abs(b-a)%2==0:
    print("Negative")
  else:
    print("Positive")
Buggy python submission (verdict: Runtime Error):
# run on python 3.4.3
from sys import stdin


def main():
    digits = map(int, stdin.readline())
    dict = {}
    for digit in digits:
        dict[digit] = 1 + dict.get(digit, 0)
    ans = 3 <= max(dict.values())
    print(['No', 'Yes'][ans])


main()


Fixed submission:
# run on python 3.4.3
from sys import stdin


def main():
    n = list(stdin.readline().strip())
    s0 = set()
    s1 = set()
    for i in range(3):
        s0.add(n[i])
    for i in range(1, 4):
        s1.add(n[i])
    ans = len(s0) == 1 or len(s1) == 1
    print(['No', 'Yes'][ans])


main()
Buggy python submission (verdict: Runtime Error):
K,X=map(int(),input().split())
print(*[x for x in range(X-K+1,X+K)])

Fixed submission:
K,X=map(int,input().split())
print(*[x for x in range(X-K+1,X+K)])

Buggy python submission (verdict: Runtime Error):
K,X=map(int,input().split())
print(*[x for x in range(X-K+1,X+K)]

Fixed submission:
K,X=map(int,input().split())
print(*[x for x in range(X-K+1,X+K)])
Buggy python submission (verdict: Runtime Error):
a=[int(input()) for i range(int(input()))]
print(len(set(a)))

Fixed submission:
a=[int(input()) for i in range(int(input()))]
print(len(set(a)))
Buggy python submission (verdict: Runtime Error):
a,b,c=int(input())
if a==c:
  print("Yes")
else:
  print("No")

Fixed submission:
a,b,c=input()
if a==c:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
s=input()
print(s[0]+int(len(s)-2)+s[-1])

Fixed submission:
s=input()
print(s[0]+str(len(s)-2)+s[-1])
Buggy python submission (verdict: Runtime Error):
a,b=input().split()
if a=H:
  print(b)
else:
  if b=H:
    print(D)
  else:
    print(H)
  
    

Fixed submission:
a,b=input().split()
if a=="H":
  print(b)
else:
  if b=="H":
    print("D")
  else:
    print("H")
Buggy python submission (verdict: Runtime Error):
n=int(input())
k=int(input())
x=int(input())
y=int(input())
if n>k:
  print(x*k+y*(n-k)
else:
  print(x*n)

Fixed submission:
n=int(input())
k=int(input())
x=int(input())
y=int(input())
if n>k:
  print(x*k+y*(n-k))
else:
  print(n*x)

Buggy python submission (verdict: Runtime Error):
n=int(input())
k=int(input())
x=int(input())
y=int(input())
if n>k:
  print(x*k+y*(n-k)
else:
        print(x*n)

Fixed submission:
n=int(input())
k=int(input())
x=int(input())
y=int(input())
if n>k:
  print(x*k+y*(n-k))
else:
  print(n*x)
Buggy python submission (verdict: Time Limit Exceeded):
import heapq
import sys
input = sys.stdin.readline

N, M = map(int, input().split())

A = [int(i) for i in input().split()]

for i in range(M):
	A.sort(reverse=True)
	max = A.pop(0)
	A.append(int(max/2))

print(sum(A))
	


Fixed submission:
import heapq
import sys
input = sys.stdin.readline

N, M = map(int, input().split())

A = [int(i)*(-1) for i in input().split()]



# print(A)
# for i in range(M):
# 	max_index = A.index(max(A))
# 	A[max_index] = int(A[max_index]/2)

# print(sum(A))
heapq.heapify(A)

for i in range(M):
	

	min = heapq.heappop(A)
	# 最小値を削除と値を渡す
	# print(A)
	# print(min)

	heapq.heappush(A,int(min/2))
	# print(A)


print(sum(A)*(-1))

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

N, M = map(int, input().split())

A = [int(i)*(-1) for i in input().split()]



# print(A)
# for i in range(M):
# 	max_index = A.index(max(A))
# 	A[max_index] = int(A[max_index]/2)

# print(sum(A))


for i in range(M):
	heapq.heapify(A)

	min = heapq.heappop(A)
	# 最小値を削除と値を渡す
	# print(A)
	# print(min)

	heapq.heappush(A,int(min/2))
	# print(A)


print(sum(A)*(-1))

Fixed submission:
import heapq
import sys
input = sys.stdin.readline

N, M = map(int, input().split())

A = [int(i)*(-1) for i in input().split()]



# print(A)
# for i in range(M):
# 	max_index = A.index(max(A))
# 	A[max_index] = int(A[max_index]/2)

# print(sum(A))
heapq.heapify(A)

for i in range(M):
	

	min = heapq.heappop(A)
	# 最小値を削除と値を渡す
	# print(A)
	# print(min)

	heapq.heappush(A,int(min/2))
	# print(A)


print(sum(A)*(-1))

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

A = [int(i) for i in input().split()]

for i in range(M):
	max_index = A.index(max(A))
	A[max_index] = int(A[max_index]/2)

print(sum(A))



Fixed submission:
import heapq
import sys
input = sys.stdin.readline

N, M = map(int, input().split())

A = [int(i)*(-1) for i in input().split()]



# print(A)
# for i in range(M):
# 	max_index = A.index(max(A))
# 	A[max_index] = int(A[max_index]/2)

# print(sum(A))
heapq.heapify(A)

for i in range(M):
	

	min = heapq.heappop(A)
	# 最小値を削除と値を渡す
	# print(A)
	# print(min)

	heapq.heappush(A,int(min/2))
	# print(A)


print(sum(A)*(-1))
Buggy python submission (verdict: Runtime Error):
a = input()
s = input()

if a >= 3200:
	print(s)

elif a < 3200:
	print("red")

	


Fixed submission:
a = int(input())
s = input()

if a >= 3200:
	print(s)

elif a < 3200:
	print("red")
Buggy python submission (verdict: Runtime Error):
import comb

A = int(input())*500//50
B = int(input())*100//50
C = int(input())*50//50
X = int(input())//50

#Aが最大何ユニット使えるかを調べる

if A == 0:
	Max_A = 0

else:
	Max_A = X // 10


counter = 0
# H = 0

for i in range(Max_A + 1):
	res_X = X - 10*i
	## B, Cだけで埋めていく
	if B == 0:
		Max_B = 0
	else:
		Max_B = res_X // 2
	for  j in range(min(Max_B + 1, B//2 + 1)):
		res_X = X - 10*i - 2*j

		# print(Max_A,Max_B,i,j,res_X,C, res_X <= C)
		# H += 1

		if res_X <= C:
			counter += 1
		# # if res_X > C:
		# # 	continue
		# # #二項係数の計算　Aのユニット数はA//10　Bのユニット数はB//10　Cはそのまま
		# # else:
		# 	counter += 1
		# 	# counter += comb.comb(A//10, i)*comb.comb(B//2, j)*comb.comb(C, res_X)
			# print(comb.comb(A//10, i)*comb.comb(B//2, j)*comb.comb(C, res_X), 
				# comb.comb(A//10, i), comb.comb(B//2, j), comb.comb(C, res_X))


print(int(counter))
# print(H)


Fixed submission:
A = int(input())
B = int(input())
C = int(input())
X = int(input())

counter = 0

N_maxA = min( int(X // 500), A )

for i in range(N_maxA + 1):
	Res = X - (i * 500)
	N_maxB = min( int(Res // 100) , B )
	
	for j in range(N_maxB + 1):
		Res1 = Res - j*100
		if int(Res1 // 50) <= C:
			
			counter += 1

print(counter)
Buggy python submission (verdict: Runtime Error):
n = int(input())
city_score = {}
for i in range(n):
	city, score = input.split()
    city_score[city] = city_score.get(city, []). + [(int(score), i)]

for city in sorted(city_score.keys()):
  for score in sorted(city_score[city]):
    print(score[1])

Fixed submission:
n = int(input())
city_score = {}
for i in range(n):
    city, score = input().split()
    city_score[city] = city_score.get(city, []) + [(int(score), i)]

for city in sorted(city_score.keys()):
  for score in sorted(city_score[city], reverse=True):
    print(score[1]+1)
Buggy python submission (verdict: Runtime Error):
ans = 0
used = False
mins = [int(input()) for _ in range(5)]
m = min(map(lambda x:(x%10, x), filter(lambda x:x%10, mins)))
for menu in mins:
  if used==False and menu==m[1]:
    continue
  ans += (menu//10)*10 + 10*(menu%10>0)
print(ans + m[1])

Fixed submission:
ans = 0
used = False
mins = [int(input()) for _ in range(5)]
maa = list(map(lambda x:(x%10, x), filter(lambda x:x%10, mins)))
m = (0,0) if len(maa) == 0 else sorted(maa)[0]
for menu in mins:
  if used==False and menu==m[1]:
    used=True
    continue
  ans += (menu//10)*10 + 10*(menu%10>0)
print(ans + m[1])
Buggy python submission (verdict: Runtime Error):
from math import gcd

N, X = map(int, input().split())
xs = list(map(int, input().split()))
xs.append(X)
xs = sorted(xs)
m = 999999999999999999
diffs = []
for idx,e in enumerate(xs):
  if idx==0:
    continue
  diff = abs(e - xs[idx-1])
  diffs.append(diff)
diffs = sorted(diffs)
for idx,dif in enumerate(diffs):
  if idx == 0:
    continue
  if gcd(diffs[idx], diffs[idx-1]) < m:
    m = gcd(diffs[idx], diffs[idx-1])
if len(diffs) == 1:
  m = diffs[0]
print(m)


Fixed submission:
from fractions import gcd

N, X = map(int, input().split())
xs = list(map(int, input().split()))
xs.append(X)
xs = sorted(xs)
m = 999999999999999999
diffs = []
for idx,e in enumerate(xs):
  if idx==0:
    continue
  diff = abs(e - xs[idx-1])
  diffs.append(diff)
diffs = sorted(diffs)
for idx,dif in enumerate(diffs):
  if idx == 0:
    continue
  if gcd(diffs[idx], diffs[idx-1]) < m:
    m = gcd(diffs[idx], diffs[idx-1])
if len(diffs) == 1:
  m = diffs[0]
print(m)

Buggy python submission (verdict: Runtime Error):
from fraction import gcd

N, X = map(int, input().split())
xs = list(map(int, input().split()))
xs.append(X)
xs = sorted(xs)
m = 999999999999999999
diffs = []
for idx,e in enumerate(xs):
  if idx==0:
    continue
  diff = abs(e - xs[idx-1])
  diffs.append(diff)
diffs = sorted(diffs)
for idx,dif in enumerate(diffs):
  if idx == 0:
    continue
  if gcd(diffs[idx], diffs[idx-1]) < m:
    m = gcd(diffs[idx], diffs[idx-1])
print(m)


Fixed submission:
from fractions import gcd

N, X = map(int, input().split())
xs = list(map(int, input().split()))
xs.append(X)
xs = sorted(xs)
m = 999999999999999999
diffs = []
for idx,e in enumerate(xs):
  if idx==0:
    continue
  diff = abs(e - xs[idx-1])
  diffs.append(diff)
diffs = sorted(diffs)
for idx,dif in enumerate(diffs):
  if idx == 0:
    continue
  if gcd(diffs[idx], diffs[idx-1]) < m:
    m = gcd(diffs[idx], diffs[idx-1])
if len(diffs) == 1:
  m = diffs[0]
print(m)

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

N, X = map(int, input().split())
xs = list(map(int, input().split()))
xs.append(X)
xs = sorted(xs)
m = 999999999999999999
diffs = []
for idx,e in enumerate(xs):
  if idx==0:
    continue
  diff = abs(e - xs[idx-1])
  diffs.append(diff)
diffs = sorted(diffs)
for idx,dif in enumerate(diffs):
  if idx == 0:
    continue
  if gcd(diffs[idx], diffs[idx-1]) < m:
    m = gcd(diffs[idx], diffs[idx-1])
print(m)


Fixed submission:
from fractions import gcd

N, X = map(int, input().split())
xs = list(map(int, input().split()))
xs.append(X)
xs = sorted(xs)
m = 999999999999999999
diffs = []
for idx,e in enumerate(xs):
  if idx==0:
    continue
  diff = abs(e - xs[idx-1])
  diffs.append(diff)
diffs = sorted(diffs)
for idx,dif in enumerate(diffs):
  if idx == 0:
    continue
  if gcd(diffs[idx], diffs[idx-1]) < m:
    m = gcd(diffs[idx], diffs[idx-1])
if len(diffs) == 1:
  m = diffs[0]
print(m)