Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
x,y = map(int, input().split())

from operator import mul
from functools import reduce

def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**4
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )



move = (x+y) / 3
if int(move) != move or x < move or y < move:
    print(0)
else:
    move = int(move)
    diff = max(x,y) - min(x,y)
    res = cmb(move, move//2 - diff//2, mod)
    print(res)

Fixed submission:

x,y = map(int, input().split())

from operator import mul
from functools import reduce

def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )



move = (x+y) / 3
if int(move) != move or x < move or y < move:
    print(0)
else:
    move = int(move)
    diff = max(x,y) - min(x,y)
    res = cmb(move, move//2 - diff//2, mod)
    print(res)

Buggy python submission (verdict: Time Limit Exceeded):

x,y = map(int, input().split())

from operator import mul
from functools import reduce

def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom

move = (x+y) / 3
if int(move) != move or x < move or y < move:
    print(0)
else:
    move = int(move)
    diff = max(x,y) - min(x,y)
    res = combinations_count(move, move//2 - diff//2) % (10**9 + 7)
    print(res)

Fixed submission:

x,y = map(int, input().split())

from operator import mul
from functools import reduce

def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )



move = (x+y) / 3
if int(move) != move or x < move or y < move:
    print(0)
else:
    move = int(move)
    diff = max(x,y) - min(x,y)
    res = cmb(move, move//2 - diff//2, mod)
    print(res)
Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_left
n = int(input())
llist = list(map(int, input().split()))

llist.sort()
res = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        num = llist[i] + llist[j] 
        idx = bisect_left(llist, num, lo=j+1, hi=n)
        res += idx - j - 1

print(res)

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

llist.sort()
res = 0
for i in range(n-2):
    prev = n-1
    for j in range(n-2,i,-1):
        for k in range(prev, j, -1):
            if llist[k] < llist[i] + llist[j]:
                res += k - j
                prev = k
                break            
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_left
n = int(input())
llist = list(map(int, input().split()))

llist.sort()
res = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        rest = llist[j+1:]
        num = llist[i] + llist[j] 
        idx = bisect_left(rest, num)
        res += idx

print(res)

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

llist.sort()
res = 0
for i in range(n-2):
    prev = n-1
    for j in range(n-2,i,-1):
        for k in range(prev, j, -1):
            if llist[k] < llist[i] + llist[j]:
                res += k - j
                prev = k
                break            
print(res)
Buggy python submission (verdict: Time Limit Exceeded):
import math
import bisect
n, ticket = map(int, input().split())
L = list(map(int, input().split()))


if len(L) == 1:
    print(math.floor(L[0] / (2**ticket)))
else:
    L.sort()
    for _ in range(ticket):
        top = L.pop()
        top /= 2
        bisect.insort_left(L,top)
    print(sum(map(math.floor, L)))

Fixed submission:
import math
import heapq
n, ticket = map(int, input().split())
L = list(map(int, input().split()))
h = []
for num in L:
    heapq.heappush(h, -num)
for _ in range(ticket):
    top = heapq.heappop(h)
    top /= 2
    heapq.heappush(h, top)
print(sum(map(lambda x: math.floor(-x), h)))

Buggy python submission (verdict: Runtime Error):
import math
import bisect
from collections import deque
n, ticket = map(int, input().split())
L = list(map(int, input().split()))


if len(L) == 1:
    print(math.floor(L[0] / (2**ticket)))
else:
    L.sort()
    L = deque(L)
    for _ in range(ticket):
        top = L.pop()
        top /= 2
        bisect.insort_left(L,top)
    print(sum(map(math.floor, L)))

Fixed submission:
import math
import heapq
n, ticket = map(int, input().split())
L = list(map(int, input().split()))
h = []
for num in L:
    heapq.heappush(h, -num)
for _ in range(ticket):
    top = heapq.heappop(h)
    top /= 2
    heapq.heappush(h, top)
print(sum(map(lambda x: math.floor(-x), h)))
Buggy python submission (verdict: Time Limit Exceeded):
import collections
s = input()
t = input()
if not set(t).issubset(set(s)): print(-1)
else:
    d = collections.defaultdict(list)
    for i, letter in enumerate(s):
        d[letter].append(i+1)
    prev = 0
    cnt = 0
    for target in t:
        for num in d[target]:
            if num > prev:
                prev = num
                break
        else:
            cnt += 1
            prev = d[target][0]
    print(cnt * len(s) + prev)

Fixed submission:
import collections
import bisect
s = input()
t = input()
if not set(t).issubset(set(s)): print(-1)
else:
    d = collections.defaultdict(list)
    for i, letter in enumerate(s):
        d[letter].append(i+1)
    prev = 0
    cnt = 0
    for target in t:
        li = d[target]
        idx = bisect.bisect_left(li, prev+1)
        if idx == len(li):
            cnt += 1
            prev = li[0]
        else:
            prev = li[idx]
    print(cnt * len(s) + prev)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().strip())

print(max(a+b, a-b, a * b))

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

print(max(a+b,a-b,a*b))
Buggy python submission (verdict: Runtime Error):
import math
a,b,c,d = map(int, input().split())
res = 0
lcm = c*d // math.gcd(c,d)
divisible = (b//c) - ((a-1)//c) + (b//d) - ((a-1)//d) - (b//lcm) - ((a-1)//lcm)
res = b-a+1 - divisible
print(res)

Fixed submission:
def gcd(a,b):
    if a < b:
        a, b = b, a
    while  a % b != 0:
        a, b = b, a % b
    return b

a,b,c,d = map(int, input().split())
res = 0
lcm = c*d // gcd(c,d)
divisible = (b//c) - ((a-1)//c) + (b//d) - ((a-1)//d) - (b//lcm) + ((a-1)//lcm)
res = b-a+1 - divisible
print(res)
Buggy python submission (verdict: Runtime Error):
from math import abs
def main():
	n = int(input())
	costs = list(map(int, input().split()))
	
	# each cur represents minimum cost needed to reach the step
	two_before = 0
	one_before = costs[1] - costs[0]
	for step in range(2, n):
		two_before, one_before = one_before, min(one_before + abs(costs[step] - costs[step-1]), two_before + abs(costs[step] - costs[step - 2]))
	return one_before
main()

Fixed submission:
def main():
	n = int(input())
	costs = list(map(int, input().split()))
	
	if n==1: return 0
	# each cur represents minimum cost needed to reach the step
	two_before = 0
	one_before = abs(costs[1] - costs[0])
	for step in range(2, n):
		two_before, one_before = one_before, min(one_before + abs(costs[step] - costs[step-1]), two_before + abs(costs[step] - costs[step - 2]))
	return one_before


print(main())
Buggy python submission (verdict: Time Limit Exceeded):
def main():
	n, k = map(int, input().split())
	costs = list(map(int, input().split()))
	before = [0 for i in range(k)]
	for step in range(1, n):
		nex_val = float("inf")
		for j in range(1,k+1):
			if j <= step: 
				nex_val = min( abs(costs[step] - costs[step-j]) + before[k-j], nex_val)
		before = before[1:] + [nex_val]
	return before[-1]
print(main())


Fixed submission:
def main():
	n, k = map(int, input().split())
	costs = list(map(int, input().split()))
	v= [0] * n
	for step in range(1, n):
		v[step] = min([v[j] + abs(costs[step]-costs[j]) for j in range(max(0,step-k), step)])
	return v[-1]
print(main())

Buggy python submission (verdict: Time Limit Exceeded):
def main():
	n, k = map(int, input().split())
	costs = list(map(int, input().split()))
	before = [0 for i in range(k)]
	for step in range(1, n):
		nex_vals = []
		for j in range(1,k+1):
			if j <= step: nex_vals.append(abs(costs[step] - costs[step-j]) + before[k-j])
		nex_val = min(nex_vals)
		before = before[1:] + [nex_val]
	return before[-1]
print(main())


Fixed submission:
def main():
	n, k = map(int, input().split())
	costs = list(map(int, input().split()))
	v= [0] * n
	for step in range(1, n):
		v[step] = min([v[j] + abs(costs[step]-costs[j]) for j in range(max(0,step-k), step)])
	return v[-1]
print(main())
Buggy python submission (verdict: Time Limit Exceeded):
def get_unique_list(seq):
    seen = []
    return [x for x in seq if x not in seen and not seen.append(x)]
n,m=map(int,input().split())
ans_list=[]
for _ in range(n):
    ans_list.append(0)
h_list=list(map(int,input().split()))
#print(h_list)
road_list=[]
for i in range(m):
  road_list.append(list(map(int,input().split())))
#print(road_list)
roadset=get_unique_list(road_list)
#print(roadset)
roadnum=len(roadset)
#print(roadnum)

for i in range(roadnum):
  templist=roadset[i]
  a=templist[0]
  b=templist[1]
  #print([a,b])
  if h_list[a-1]>h_list[b-1]:
    ans_list[b-1]+=1
  elif h_list[a-1]==h_list[b-1]:
    ans_list[a-1]+=1
    ans_list[b-1]+=1
  else:
    ans_list[a-1]+=1
print(ans_list.count(0))

Fixed submission:
n,m=map(int,input().split())
ans_list=[]
for _ in range(n):
    ans_list.append(0)
h_list=list(map(int,input().split()))
#print(h_list)
road_list=[]
for i in range(m):
  road_list.append(list(map(int,input().split())))
#print(road_list)
#roadset=get_unique_list(road_list)
#print(roadset)
roadnum=len(road_list)
#print(roadnum)

for i in range(roadnum):
  templist=road_list[i]
  a=templist[0]
  b=templist[1]
  #print([a,b])
  if h_list[a-1]>h_list[b-1]:
    ans_list[b-1]+=1
  elif h_list[a-1]==h_list[b-1]:
    ans_list[a-1]+=1
    ans_list[b-1]+=1
  else:
    ans_list[a-1]+=1
print(ans_list.count(0))
Buggy python submission (verdict: Runtime Error):
n=int(input())
set={}
for n in range(n):
  set.append(input())
print(len(set))

Fixed submission:
n=int(input())
set_=set()
#print(set_)
for n in range(n):
  set_.add(input())
  #print(set_)
print(len(set_))
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
hw_days=0
for i in range(m):
  hw_days+=int(input())
print(n-hw_days if (n-hw_days)>0 else -1)

Fixed submission:
n,m=map(int,input().split())
list1=list(map(int,input().split()))
ans=n-sum(list1)
print(ans if ans>=0 else -1)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
list1=list(map(int,input().split()))
for i in range(n):
    print(list1.count(i+1))

Fixed submission:
N=int(input())
A=list(map(int, input().split()))
ans=[0]*N
#print(ans)
for a in A:
    ans[a-1] += 1
    #print(ans)
for i in ans:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
list1=list(map(int,input().split()))
for i in range(n):
    print(list1.count(i+1))

Fixed submission:
N=int(input())
A=list(map(int, input().split()))
ans=[0]*N
#print(ans)
for a in A:
    ans[a-1] += 1
    #print(ans)
for i in ans:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
list1=list(input().split())
for i in range(n):
  print(list1.count(str(i+1)))



Fixed submission:
N=int(input())
A=list(map(int, input().split()))
ans=[0]*N
#print(ans)
for a in A:
    ans[a-1] += 1
    #print(ans)
for i in ans:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
list1=list(map(int,input().split()))
for i in range(n):
  print(list1.count(i+1))



Fixed submission:
N=int(input())
A=list(map(int, input().split()))
ans=[0]*N
#print(ans)
for a in A:
    ans[a-1] += 1
    #print(ans)
for i in ans:
    print(i)

Buggy python submission (verdict: Runtime Error):
n=int(input())
list1=list(map(int,input().split()))
for i in range(n):
  print(count.list1(i))

Fixed submission:
N=int(input())
A=list(map(int, input().split()))
ans=[0]*N
#print(ans)
for a in A:
    ans[a-1] += 1
    #print(ans)
for i in ans:
    print(i)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(a*b if 1<=a,b<=9 else -1)

Fixed submission:
a,b=map(int,input().split())
if 1<=a<=9 and 1<=b<=9:
  print(a*b)
else:
  print(-1)
Buggy python submission (verdict: Runtime Error):
n=int(input())
ans=1
for i in range 3:
  ans*=n
print(ans)

Fixed submission:
n=int(input())
ans=1
for i in range(3):
  ans*=n
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
ans=0
answer=[]
for i in range(n-1):
  if h[i]>=h[i+1]:
    ans+=1
  if h[i]<h[i+1]:
    answer.append(ans)
    ans=0
  if i == n-2:
    answer.append(ans)
  else:
    pass
print(max(answer))


Fixed submission:
s=input()
t=input()
ans=0
for i in range(3):
  if s[i]==t[i]:
    ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
ans=0
answer=[]
for i in range(n-1):
  if h[i]>=h[i+1]:
    ans+=1
  if h[i]<h[i+1]:
    answer.append(ans)
    ans=0
  if i == n-2:
    answer.append(ans)
  else:
    continue
print(max(answer))


Fixed submission:
N = int(input())
H = list(map(int,input().split()))
x = 0
lis = []
for i in range(0,len(H)-1) :
    if H[i] - H[i+1] >=0:
        x += 1
    else:
        lis.append(x)
        x =0
lis.append(x)
print(max(lis))

Buggy python submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
ans=0
answer=[]
for i in range(n-1):
  if h[i]>=h[i+1]:
    ans+=1
  if h[i]<h[i+1]:
    answer.append(ans)
    ans=0
  if i == n-1:
    answer.append(ans)
print(max(answer))

Fixed submission:
N = int(input())
H = list(map(int,input().split()))
x = 0
lis = []
for i in range(0,len(H)-1) :
    if H[i] - H[i+1] >=0:
        x += 1
    else:
        lis.append(x)
        x =0
lis.append(x)
print(max(lis))

Buggy python submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
ans=0
answer=[]
for i in range(n-1):
  if h[i]>=h[i+1]:
    ans+=1
  if h[i]<h[i+1]:
    answer.append(ans)
    ans=0
  if i == n-2:
    answer.append(ans)
print(max(answer))

Fixed submission:
N = int(input())
H = list(map(int,input().split()))
x = 0
lis = []
for i in range(0,len(H)-1) :
    if H[i] - H[i+1] >=0:
        x += 1
    else:
        lis.append(x)
        x =0
lis.append(x)
print(max(lis))

Buggy python submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
answer=[]
for i in range(n-1):
  ans=0
  for j in range(n-i-1):
    #print(str(h[i+j])+'と'+str(h[i+j+1])+'を比較')
    if h[i+j]>=h[i+j+1]:
      ans+=1
    if h[i+j]<h[i+j+1]:
      answer.append(ans)
      #print('第'+str(i+1)+'ループ終わり')
      break
    if i+j+1==n-1:
      answer.append(ans)
      #print('第'+str(i+1)+'ループ終わり')
      break
  ans=0
print(max(answer))

Fixed submission:
N = int(input())
H = list(map(int,input().split()))
x = 0
lis = []
for i in range(0,len(H)-1) :
    if H[i] - H[i+1] >=0:
        x += 1
    else:
        lis.append(x)
        x =0
lis.append(x)
print(max(lis))
Buggy python submission (verdict: Runtime Error):
N = int((input()))
S = input().split()
s=[]
b=[]
#print(S)
for i in range (N):
  s.append(int(S[i]))
#print(s)
for i in range(N):
  if s[i]==i+1:
    pass
  else:
    b.append(i)
#print(b)
if len(b)<3:
  print("YES")
else:
  print("NO")

Fixed submission:
A,B = map(int,input().split())
if (A+B)%2==0:
  print(int((A+B)/2))
else:
  print("IMPOSSIBLE")
Buggy python submission (verdict: Runtime Error):
n,d=map(int,input().split())
if n%(2*d+1)==0:
  print(int(n/(2*d+1)))
else:
  print(int(n/(2*d+1))+1)

Fixed submission:
r = int(input())

print(3*r*r)

Buggy python submission (verdict: Runtime Error):
r=input()
print(r*r*3)

Fixed submission:
r = int(input())

print(3*r*r)

Buggy python submission (verdict: Runtime Error):
r=int(inout())
print(3*r*r)

Fixed submission:
r = int(input())

print(3*r*r)

Buggy python submission (verdict: Runtime Error):
r=input()
print(3*r**2)

Fixed submission:
r = int(input())

print(3*r*r)
Buggy python submission (verdict: Runtime Error):
S = input().sprit()
N = int(S[0])
A = int(S[1])
B = int(S[2])
if B > A*N:
  print(A*N)
else:
  print(B)

Fixed submission:
S = list(map(int, input().split()))
N = int(S[0])
A = int(S[1])
B = int(S[2])
if B > A*N:
  print(A*N)
else:
  print(B)
Buggy python submission (verdict: Runtime Error):
n=int(input())
p=list(map(int,input().split()))
#print(n)
#print(p)
i=1
l=[]
while i<n-1:
  if p[i-1]<p[i]<p[i+1] or p[i-1]>p[i]>p[i+1]:
    l.append(i)
  else:
    pass
  i+=1
print(len(l))


Fixed submission:
s=input()
a=s[0]
b=s[1]
c=s[2]
d=s[3]
if a==b and c==d and a!=c:
  print("Yes")
elif a==c and b==d and a!=b:
  print("Yes")
elif a==d and b==c and a!=b:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n,x=map(int,input().split())
L=list(map(int,input().split()))
#print(L)
D=0
B=[0]
C=[]
for i in range(len(L)):
  D=D+L[i]
  B.append(D)
#print(B)
for i in range(len(L)):
  if B[i]<=x:
    C.append(i)
  else:
    pass
#print(C)
print(min(n+1,len(C)))


Fixed submission:
X,A = list(map(int, input().split()))
if X<A:
  print(0)
else:
  print(10)
Buggy python submission (verdict: Runtime Error):
n,k= map(int,input().split())
s=input()
s[k-1]=s[k-1].lower
print(s)

Fixed submission:
n,k= map(int,input().split())
s=input()
a=""

#print(s)
#print(s[0])
#print(s[2])
for i in range(k-1):
  a=a+s[i]
#print(a)
a=a+s[k-1].lower()
#print(a)
for i in range(n-k):
  a=a+s[i+k]
print(a)
Buggy python submission (verdict: Runtime Error):
s = [input() for i in range(6)]
if s[4]-s[0]>s[5]:
  print(":(")
else:
  print("Yay!")
  

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
if e-a>k:
  print(":(")
else:
  print("Yay!")
Buggy python submission (verdict: Runtime Error):
b=input()
if b="A":
  print("T")
elif b="T":
  print("A")
elif b="G":
  print("C")
else:
  print("G")
       

Fixed submission:
b=input()
if b=="A":
  print("T")
elif b=="T":
  print("A")
elif b=="G":
  print("C")
else:
  print("G")
Buggy python submission (verdict: Runtime Error):
H,W=map(int,input(),split())
h,w=map(int,input(),split())
print((H-h)*(W-w))

Fixed submission:
H,W=map(int,input().split())
h,w=map(int,input().split())
print((H-h)*(W-w))
Buggy python submission (verdict: Runtime Error):
X=int(input())
if X=1:
  print("Hello World")
else:
  a=int(input())
  b=int(input())
  print(a+b)

Fixed submission:
X=int(input())
if X==1:
  print("Hello World")
else:
  a=int(input())
  b=int(input())
  print(a+b)
Buggy python submission (verdict: Runtime Error):
n,a=map(int,input().split())
print("Yes" if (n%500) <= a else "No")



Fixed submission:
n=int(input())
a=int(input())
print("Yes" if (n%500) <= a else "No")

Buggy python submission (verdict: Runtime Error):
n,a=map(int,input().split())
print("Yes" if n/500 <= a else "No")

Fixed submission:
n=int(input())
a=int(input())
print("Yes" if (n%500) <= a else "No")

Buggy python submission (verdict: Runtime Error):
n,a=map(int,input().split())
print("Yes" if ((n/500) <= a) else "No")


Fixed submission:
n=int(input())
a=int(input())
print("Yes" if (n%500) <= a else "No")

Buggy python submission (verdict: Runtime Error):
n,a=map(int,input().split())
print("Yes" if n/500 <= a else "No")

Fixed submission:
n=int(input())
a=int(input())
print("Yes" if (n%500) <= a else "No")
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
x=int(input())
ans=0
for i in range(a+1):
  A=i*500
  for j in　range(b+1):
    B=j*100
    for k in range(c+1):
      C=k*50
      
      if A+B+C=x:
        ans+=1
print(ans)


Fixed submission:
a=int(input())
b=int(input())
c=int(input())
x=int(input())
ans=0
for i in range(a+1):
  A=i*500
  for j in range(b+1):
    B=j*100
    for k in range(c+1):
      C=k*50
      
      if A+B+C==x:
        ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
y,m,d=map(input().split("/"))
print(str(y+1)+"/"+str(m)+"/"+str(d))

Fixed submission:
print(input().replace('2017', '2018'))
Buggy python submission (verdict: Runtime Error):
N, W = list(map(int, input().split()))

weight = []
value = []

for i in range(N):
    w, v = list(map(int, input().split()))
    weight.append(w)
    value.append(v)

dp = [0] * (W+1)

for i in range(N+1):
    dp.append([])
    for j in range(W+1):
        dp[i].append(0)


# max value = dp[何個まで見たか][現在の重さ]
for i in range(N):
    for j in range(W+1):
        if (j+weight[i]) <= W:
            dp[i+1][j+weight[i]] = max(dp[i][j+weight[i]], dp[i][j] + value[i])

        dp[i+1][j] = max(dp[i][j],dp[i+1][j])

print(dp[N][W])


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

weight = []
value = []

for i in range(N):
    w, v = list(map(int, input().split()))
    weight.append(w)
    value.append(v)


dp = []

for i in range(N+1):
    dp.append([])
    for j in range(W+1):
        dp[i].append(0)


# max value = dp[何個まで見たか][現在の重さ]
for i in range(N):
    for j in range(W+1):
        if (j+weight[i]) <= W:
            dp[i+1][j+weight[i]] = max(dp[i][j+weight[i]], dp[i][j] + value[i])

        dp[i+1][j] = max(dp[i][j],dp[i+1][j])

print(dp[N][W])

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

weight = []
value = []

for i in range(N):
    w, v = list(map(int, input().split()))
    weight.append(w)
    value.append(v)

dp = []

for i in range(N+1):
    dp.append([])
    for j in range(W+1):
        dp[i].append(0)


# max value = dp[何個まで見たか][現在の重さ]
for i in range(N):
    for j in range(W+1):
        if (j+weight[i]) <= W:
            dp[i+1][j+weight[i]] = max(dp[i][j+weight[i]], dp[i][j] + value[i])

        dp[i+1][j] = max(dp[i][j],dp[i+1][j])

print(dp[N][W])


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

weight = []
value = []

for i in range(N):
    w, v = list(map(int, input().split()))
    weight.append(w)
    value.append(v)


dp = []

for i in range(N+1):
    dp.append([])
    for j in range(W+1):
        dp[i].append(0)


# max value = dp[何個まで見たか][現在の重さ]
for i in range(N):
    for j in range(W+1):
        if (j+weight[i]) <= W:
            dp[i+1][j+weight[i]] = max(dp[i][j+weight[i]], dp[i][j] + value[i])

        dp[i+1][j] = max(dp[i][j],dp[i+1][j])

print(dp[N][W])
Buggy python submission (verdict: Runtime Error):
s = int(input())
w = int(input())
 
if w>=s :
  print("unsafe")
else : 
  print("safe")

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

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

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

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