Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
from math import gcd, floor

A, B, C, D = map(int, input().split())

a = (B-A+1)
b = -(floor(B/C) + floor(B/D) - floor(B/(floor(C*D/gcd(C,D)))))
c = (floor((A-1)/C) + floor((A-1)/D) - floor((A-1)/(floor(C*D/gcd(C,D)))))

print(a+b+c)

Fixed submission:
from fractions import gcd

A, B, C, D = map(int, input().split())

a = (B-A+1)
b = -(B//C + B//D - B//(C*D//gcd(C,D)))
c = ((A-1)//C + (A-1)//D - (A-1)//(C*D//gcd(C,D)))

print(a+b+c)

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

A, B, C, D = map(int, input().split())

a = (B-A+1)
b = -(B//C + B//D - B//(C*D//gcd(C,D)))
c = ((A-1)//C + (A-1)//D - (A-1)//(C*D//gcd(C,D)))

print(a+b+c)

Fixed submission:
from fractions import gcd

A, B, C, D = map(int, input().split())

a = (B-A+1)
b = -(B//C + B//D - B//(C*D//gcd(C,D)))
c = ((A-1)//C + (A-1)//D - (A-1)//(C*D//gcd(C,D)))

print(a+b+c)

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

A, B, C, D = map(int, input().split())


print((B-A+1) - (B//C + B//D - B//(C*D//gcd(C,D))) + ((A-1)//C + (A-1)//D - (A-1)//(C*D//gcd(C,D))))

Fixed submission:
from fractions import gcd

A, B, C, D = map(int, input().split())

a = (B-A+1)
b = -(B//C + B//D - B//(C*D//gcd(C,D)))
c = ((A-1)//C + (A-1)//D - (A-1)//(C*D//gcd(C,D)))

print(a+b+c)
Buggy python submission (verdict: Runtime Error):
W, H, x, y = map(int, input().split())
ans = 0
if W/x == H/y == 0:
  ans = 1
print(W*H/2, ans)

Fixed submission:
W, H, x, y = map(int, input().split())
ans = 0
if (2*x == W) and (2*y == H):
  ans = 1
print(W*H/2, ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]

l = [0]*(N+1)
l[0] = 1
for i in range(1, N+1):
  if i in a:
    l[i] = 0
  else:
    if i == 1:
      l[1] = 1
    else:
      l[i] = (l[i-1] + l[i-2]) % (10**9+7)

print(l[N])

Fixed submission:
N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]

l = [0]*(N+1)
l[0] = 1
j = 0
for i in range(1, N+1):
  if j < M and i == a[j]:
    j += 1
  else:
    if i == 1:
      l[1] = 1
    else:
      l[i] = (l[i-1] + l[i-2]) % (10**9+7)

print(l[N])
Buggy python submission (verdict: Runtime Error):
S = input()
if 15 - len(S) + S.count(o) >= 8:
  print('YES')
else:
  print('NO')

Fixed submission:
S = input()
if 15 - len(S) + S.count('o') >= 8:
  print('YES')
else:
  print('NO')
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())

for i in range(N):
    if 2**i > N:
        a = i-1
        b = N - 2**a
        break
for j in range(K):
    if 2**j > K:
        c = j-1
        d = K - 2**c
        break

if N <= K:
    print((2**(2*a-c+1)+2**(-c)+3*2**(a-c+1)*b)/3*N)
else:
    print((2**(c+1)+2**(-c)+3*2*b)/*3N + (N-K+1)/N)

Fixed submission:
N, K = map(int, input().split())
S = input()

if K == 1:
    S = S[0].lower() + S[1:]
elif K == N:
    S = S[:-1] + S[N-1].lower()
else:
    S = S[:K-1] + S[K-1].lower() + S[K:]
print(S)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())

for i in range(N):
    if 2**i > N:
        a = i-1
        b = N - 2**a
        break
for j in range(K):
    if 2**j > K:
        c = j-1
        d = K - 2**c
        break

if N <= K:
    print((2**(2*a-c+1)+2**(-c)+3*2**(a-c+1)*b)/3N)
else:
    print((2**(c+1)+2**(-c)+3*2*b)/3N + (N-K+1)/N)

Fixed submission:
from math import ceil, log2
N, K = map(int, input().split())

M = min(N, K)
p = max((N-K)/N, 0)
for n in range(1, M+1):
    p += 2**(-ceil(log2(K/n))) / N
print(p)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
S = input()

S += '2'
l = []
cnt = 1
for i in range(N):
  if S[i] == S[i+1]:
  	cnt += 1
  else:
    l.append(cnt)
    cnt = 1

if S[0] == '0':
  ans = sum(l[:2*K])
  for j in range(1, len(l), 2):
    ans = max(ans, sum(l[j: j+2*K+1]))
else:
  ans = 0
  for j in range(0, len(l), 2):
    ans = max(ans, sum(l[j: j+2*K+1]))
print(ans)

Fixed submission:
N, K = map(int, input().split())
S = input()

S += '2'
l = []
cnt = 1
for i in range(N):
  if S[i] == S[i+1]:
  	cnt += 1
  else:
    l.append(cnt)
    cnt = 1

if S[0] == '0':
  cur = sum(l[:2*K])
  ans = cur
  for j in range(1, len(l), 2):
    cur += -sum(l[max(0, j-2): j]) + sum(l[j+2*K-1:j+2*K+1])
    ans = max(ans, cur)
else:
  cur = sum(l[:2*K+1])
  ans = cur
  for j in range(2, len(l), 2):
    cur += -sum(l[max(0, j-2): j]) + sum(l[j+2*K-1:j+2*K+1])
    ans = max(ans, cur)
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
p = list(map(int, input().split()))

count = 0
for i in range(N-1):
  if p[i] == i+1:
    p[i], p[i+1] = p[i+1], p[i]
    count += 1
if p[N-1] == N:
  p[N-2], p[N-1] = p[N-1], p[N-2]
  count += 1
  
print(count)

Fixed submission:
X, t = map(int, input().split())
print(max(X - t,0))
Buggy python submission (verdict: Runtime Error):
N = int(input())
p = list(map(int, input().split()))

count = 0
for i in range(N):
  if p[i] == i+1:
    p[i], p[i+1] = p[i+1], p[i]
    count += 1
if p[N-1] == N:
  p[N-2], p[N-1] = p[N-1], p[N-2]
  count += 1
  
print(count)

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

count = 0
for i in range(N-1):
  if p[i] == i+1:
    p[i], p[i+1] = p[i+1], p[i]
    count += 1
if p[N-1] == N:
  p[N-2], p[N-1] = p[N-1], p[N-2]
  count += 1
  
print(count)
Buggy python submission (verdict: Runtime Error):
X, N = map(int,input().split())
P = list(map(int,input().split()))
if N==0:
    print(X)
else:
    Q = [i+1 for i in range(100)]
    for pi in P:
        Q.remove(pi)
    Q1 = [abs(qi - X) for qi in Q]
    print(Q[Q1.index(min(Q1))])

Fixed submission:
X, N = map(int,input().split())
if N==0:
    print(X)
else:
    P = list(map(int,input().split()))
    P.sort()
    Q = [i-1 for i in range(-10,111)]
    for a in P:
        Q.remove(a)
    Q1 = [abs(b - X) for b in Q]
    print(Q[Q1.index(min(Q1))])

Buggy python submission (verdict: Runtime Error):
X, N = map(int,input().split())
P = list(map(int,input().split()))
Q = [i+1 for i in range(100)]
for pi in P:
    Q.remove(pi)
Q1 = [abs(qi - X) for qi in Q]
print(Q[Q1.index(min(Q1))])

Fixed submission:
X, N = map(int,input().split())
if N==0:
    print(X)
else:
    P = list(map(int,input().split()))
    P.sort()
    Q = [i-1 for i in range(-10,111)]
    for a in P:
        Q.remove(a)
    Q1 = [abs(b - X) for b in Q]
    print(Q[Q1.index(min(Q1))])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A_list = list(input().split())

answer = 1
for a in A_list:
    answer *= int(a)

if len(str(answer-1))>18:
    print(-1)
else:
    print(answer)


Fixed submission:
N = int(input())
A_list = list(map(int,input().split()))
A_list.sort()
#print(A_list)
if A_list[0]==0:
    answer = 0
else:      
    answer = 1
    for a in A_list:
        answer *= a
        if len(str(answer-1)) > 18:
            answer = -1
            break
print(answer)

Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
A_list = list(map(int,input().split()))
answer = 1.
for a in A_list:
    answer*=a

if math.log10(answer) > 18:
    print("-1")
else:
    print(answer)


Fixed submission:
N = int(input())
A_list = list(map(int,input().split()))
A_list.sort()
#print(A_list)
if A_list[0]==0:
    answer = 0
else:      
    answer = 1
    for a in A_list:
        answer *= a
        if len(str(answer-1)) > 18:
            answer = -1
            break
print(answer)
Buggy python submission (verdict: Runtime Error):
A,B = input().split()
B2 = float(B)*100
print(int(A*B2))

Fixed submission:
import math

A,B = input().split()
C = int(A)*int(float(B)*1000)
print(math.floor(C//1000))
Buggy python submission (verdict: Time Limit Exceeded):
N , M = map(int,input().split())
Height = [h_i for h_i in map(int,input().split())]
Roots = []
for j in range(M):
    root = [c_i for c_i in map(int,input().split())]
    #if root[0] > root[1]:
    #    root.reverse()
    Roots +=[root]
#print(Height,"\n",Roots)

connections=[]
for i in range(1,N+1):
    site = []
    for root in Roots:
        if root[0]==i:
            site+=[root[1]]
        elif root[1]==i:
            site+=[root[0]]
    connections+=[site]
#print(connections)

counter = 0
for i in range(N):
    counter2 = 0
    for site in connections[i]:
        if Height[i] <= Height[site-1]:
            counter2 += 1
    if counter2 == 0:
        counter+=1
#        print(i+1,counter2)
print(counter)

Fixed submission:
N , M = map(int,input().split())
Height = [h_i for h_i in map(int,input().split())]
Roots = []
counter = [0 for i in range(N)]
for j in range(M):
    root = [c_i -1 for c_i in map(int,input().split())]
    #print(root)
    if Height[root[0]]<Height[root[1]]:
        counter[root[0]] += 1
    elif Height[root[0]]==Height[root[1]]:
        counter[root[0]] += 1
        counter[root[1]] += 1
    else:
        counter[root[1]] += 1

counter2 = 0
for i in range(N):
    if counter[i]==0:
        counter2+=1
print(counter2)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split)
if a%2==0 or b%2==0:
  print("Even")
else:
  print("Odd")

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

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

Fixed submission:
a,b=map(int,input().split())
if a%2==0 or b%2==0:
  print("Even")
else:
  print("Odd")
Buggy python submission (verdict: Runtime Error):
a,b=map(str,input().split())
ab=int(a+b)
if (ab**.5).is_integer() = "True":
  print("Yes")
else:
  print("No")

Fixed submission:
a,b=map(str,input().split())
ab=int(a+b)
if (ab**.5).is_integer():
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
n=sqrt(a*(10**len(b))+b)
 
if isinstance(n,int)=="True":
  print("Yes")
else:
  print("No")

Fixed submission:
a,b=map(str,input().split())
ab=int(a+b)
if (ab**.5).is_integer():
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
import numpy as np
a,b = map(int,input().split())
n=np.sqrt(a*np.power(10,len(b)+1)+b)

if isinstance(n,int)=="True":
  print("Yes")
else:
  print("No")

Fixed submission:
a,b=map(str,input().split())
ab=int(a+b)
if (ab**.5).is_integer():
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
H = list(map(int, input().split()))
J = [list(map(int, input().split())) for _ in range(M)]

res = []
for n in range(1, N+1):
    res.append(n)

for j in J:
    n1 = j[0]
    n2 = j[1]
    h1 = H[n1-1]
    h2 = H[n2-1]
    if h1 < h2:
        if n1 in res:
            res.remove(n1)
    elif h2 < h1:
        if n2 in res:
            res.remove(n2)
    else:
        if n1 in res:
            res.remove(n1)
        if n2 in res:
            res.remove(n2)

print(len(res))


Fixed submission:
N, M = map(int, input().split())
H = list(map(int, input().split()))
J = [list(map(int, input().split())) for _ in range(M)]

res = {}
for n in range(1, N+1):
    res[n] = True

for j in J:
    n1 = j[0]
    n2 = j[1]
    h1 = H[n1-1]
    h2 = H[n2-1]
    if h1 < h2:
        if res[n1]:
            res[n1] = False
    elif h2 < h1:
        if res[n2]:
            res[n2] = False
    else:
        if res[n1]:
            res[n1] = False
        if res[n2]:
            res[n2] = False

l = 0
for v in res.values():
    if v:
        l+=1
print(l)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
H = list(map(int, input().split()))
J = [list(map(int, input().split())) for _ in range(M)]

res = []
for n in range(1, N+1):
    res.append(n)

for j in J:
    n1 = j[0]
    n2 = j[1]
    h1 = H[n1-1]
    h2 = H[n2-1]
    if h1 < h2:
        if n1 in res:
            res.remove(n1)
    elif h2 < h1:
        if n2 in res:
            res.remove(n2)
    else:
        if n1 in res:
            res.remove(n1)
        if n2 in res:
            res.remove(n2)

print(len(res))


Fixed submission:
N, M = map(int, input().split())
H = list(map(int, input().split()))
J = [list(map(int, input().split())) for _ in range(M)]

res = {}
for n in range(1, N+1):
    res[n] = True

for j in J:
    n1 = j[0]
    n2 = j[1]
    h1 = H[n1-1]
    h2 = H[n2-1]
    if h1 < h2:
        if res[n1]:
            res[n1] = False
    elif h2 < h1:
        if res[n2]:
            res[n2] = False
    else:
        if res[n1]:
            res[n1] = False
        if res[n2]:
            res[n2] = False

l = 0
for v in res.values():
    if v:
        l+=1
print(l)
Buggy python submission (verdict: Time Limit Exceeded):
import fractions
from functools import reduce
K = int(input())

def gcd(*nums):
    return reduce(fractions.gcd, nums)

s = 0
for a in range(1,K+1):
    for b in range(1,a+1):
        for c in range(1,b+1):
            if a == b and b == c:
                s += gcd(a,b,c)
            elif a == b or a == c or b == c:
                s += gcd(a,b,c) * 3
            else:
                s += gcd(a,b,c) * 6
print(s)


Fixed submission:
import math
from functools import reduce
K = int(input())

def gcd(*nums):
    return reduce(math.gcd, nums)

s = 0
for a in range(1,K+1):
    for b in range(1,a+1):
        for c in range(1,b+1):
            if a == b and b == c:
                s += gcd(a,b,c)
            elif a == b or a == c or b == c:
                s += gcd(a,b,c) * 3
            else:
                s += gcd(a,b,c) * 6
print(s)

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
from functools import reduce
K = int(input())

def gcd(*nums):
    return reduce(fractions.gcd, nums)

s = 0
for a in range(1,K+1):
    for b in range(1,a+1):
        for c in range(1,b+1):
            if a == b and b == c:
                s += gcd(a,b,c)
            elif a == b or a == c or b == c:
                s += gcd(a,b,c) * 3
            else:
                s += gcd(a,b,c) * 6
print(s)


Fixed submission:
import math
from functools import reduce
K = int(input())

def gcd(*nums):
    return reduce(math.gcd, nums)

s = 0
for a in range(1,K+1):
    for b in range(1,a+1):
        for c in range(1,b+1):
            if a == b and b == c:
                s += gcd(a,b,c)
            elif a == b or a == c or b == c:
                s += gcd(a,b,c) * 3
            else:
                s += gcd(a,b,c) * 6
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
Q = int(input())
QL = [input().split() for _ in range(Q)]

h = ''
t = ''
reverse = False

for q in QL:
    if q[0] == '1':
        reverse = not reverse
    else:
        if q[1] == '1':
            if reverse:
                t = '{}{}'.format(t, q[2])
            else:
                h = '{}{}'.format(q[2], h)
        else:
            if reverse:
                h = '{}{}'.format(q[2], h)
            else:
                t = '{}{}'.format(t, q[2])

s = '{}{}{}'.format(h, S, t)
if reverse:
    print(s[::-1])
else:
    print(s)


Fixed submission:
S = input()
Q = int(input())
QL = [input().split() for _ in range(Q)]

h = ''
t = ''
reverse = False

for q in QL:
    if q[0] == '1':
        reverse = not reverse
    else:
        if q[1] == '1':
            if reverse:
                t = '{}{}'.format(t, q[2])
            else:
                h = '{}{}'.format(q[2], h)
        else:
            if reverse:
                h = '{}{}'.format(q[2], h)
            else:
                t = '{}{}'.format(t, q[2])

s = '{}{}{}'.format(h, S, t)
if reverse:
    print(s[::-1])
else:
    print(s)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
Q = int(input())
QL = [input().split() for _ in range(Q)]

h = ''
t = ''
reverse = False

for q in QL:
    if q[0] == '1':
        reverse = not reverse
    else:
        if q[1] == '1':
            if reverse:
                t = t+q[2]
            else:
                h = q[2]+h
        else:
            if reverse:
                h = q[2]+h
            else:
                t = t+q[2]

s = h + S + t
if reverse:
    print(s[::-1])
else:
    print(s)


Fixed submission:
S = input()
Q = int(input())
QL = [input().split() for _ in range(Q)]

h = ''
t = ''
reverse = False

for q in QL:
    if q[0] == '1':
        reverse = not reverse
    else:
        if q[1] == '1':
            if reverse:
                t = '{}{}'.format(t, q[2])
            else:
                h = '{}{}'.format(q[2], h)
        else:
            if reverse:
                h = '{}{}'.format(q[2], h)
            else:
                t = '{}{}'.format(t, q[2])

s = '{}{}{}'.format(h, S, t)
if reverse:
    print(s[::-1])
else:
    print(s)
Buggy python submission (verdict: Runtime Error):
N = input()
rN = N[::-1]

res = 0
add = False

for i, n in enumerate(rN):
    p = int(n)
    if add:
        p += 1
    if p == 10:
        continue
    elif p == 5:
        if len(N) >= i+1 and int(rN[i+1]) >= 5:
            add = True
            res += p
        else:
            add = False
            res += p
    elif p < 5:
        add = False
        res += p
    else:
        add = True
        res += 10-p

if add:
    res += 1

print(res)


Fixed submission:
N = input()
rN = N[::-1]

res = 0
add = False

for i, n in enumerate(rN):
    p = int(n)
    if add:
        p += 1
    if p == 10:
        continue
    elif p == 5:
        if len(N) > i+1 and int(rN[i+1]) >= 5:
            add = True
            res += p
        else:
            add = False
            res += p
    elif p < 5:
        add = False
        res += p
    else:
        add = True
        res += 10-p

if add:
    res += 1

print(res)

Buggy python submission (verdict: Runtime Error):
N = input()
rN = N[::-1]

res = 0
add = False

for i, n in enumerate(rN):
    p = int(n)
    if add:
        p += 1
        
    if i > 100:
        res += (i-100)*p
        add = False
        continue

    if p == 10:
        continue
    elif p == 5:
        if len(N) >= i+1 and int(rN[i+1]) >= 5:
            add = True
            res += p
        else:
            add = False
            res += p
    elif p < 5:
        add = False
        res += p
    else:
        add = True
        res += 10-p

if add:
    res += 1

print(res)


Fixed submission:
N = input()
rN = N[::-1]

res = 0
add = False

for i, n in enumerate(rN):
    p = int(n)
    if add:
        p += 1
    if p == 10:
        continue
    elif p == 5:
        if len(N) > i+1 and int(rN[i+1]) >= 5:
            add = True
            res += p
        else:
            add = False
            res += p
    elif p < 5:
        add = False
        res += p
    else:
        add = True
        res += 10-p

if add:
    res += 1

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

if N % 2 === 1:
    print('No')
elif S[:N/2] == S[N/2:]:
    print('Yes')
else:
    print('No')
    


Fixed submission:
N = int(input())
S = input()

if N % 2 == 1:
    print('No')
else:
    half = int(N/2)
    if S[:half] == S[half:]:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Runtime Error):
mod = 10**9+7
fac = [1, 1]
finv = [1, 1]
inv = [0, 1]


def init(n):
    for i in range(2, n):
        fac.append(fac[-1] * i % mod)
        inv.append(-inv[mod % i] * (mod // i) % mod)
        finv.append(finv[-1] * inv[-1] % mod)


def com(n, k, mod):
    if n < 0 or k < 0 or n < k:
        return 0
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod


X, Y = map(int, input().split())

if not (X+Y) % 3 == 0:
    print(0)
else:
    n = (Y - 2 * X) // -3
    m = X - (2 * n)
    if n < 0 or m < 0:
        print(0)
    else:
        init(n + m)
        print(com(n + m, n, mod))


Fixed submission:
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 )



X, Y = map(int, input().split())

if not (X+Y) % 3 == 0:
    print(0)
else:
    # 2n + m = X
    # n + 2m = Y
    n = (Y - 2*X) // -3
    m = X - (2 * n)
    if n < 0 or m < 0:
        print(0)
    else:
        print(cmb(n+m, n, mod))

Buggy python submission (verdict: Time Limit Exceeded):
mod = 10**9+7

def cmb(n, r, mod):
    a, b = 1, 1
    for i in range(n, n - r, -1):
        a = a * i
    for i in range(r, 1, -1):
        b = b * i
    return a // b % mod
        


X, Y = map(int, input().split())

if not (X+Y) % 3 == 0:
    print(0)
else:
    n = (Y - 2*X) // -3
    m = X - (2 * n)
    if n < 0 or m < 0:
        print(0)
    else:
        print(cmb(n+m, n, mod))


Fixed submission:
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 )



X, Y = map(int, input().split())

if not (X+Y) % 3 == 0:
    print(0)
else:
    # 2n + m = X
    # n + 2m = Y
    n = (Y - 2*X) // -3
    m = X - (2 * n)
    if n < 0 or m < 0:
        print(0)
    else:
        print(cmb(n+m, n, mod))
Buggy python submission (verdict: Runtime Error):
def main():
    A, B, C, K = map(int, input().split())
    li = [1] * A
    li += ([0] * B)
    li += ([-1] * C)
    print(sum(li[:K]))


if __name__ == "__main__":
    main()


Fixed submission:
def main():
    A, B, _, K = map(int, input().split())
    if A > K:
        print(K)
        quit()
    print(A - max([0, K - A - B]))


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
def main():
    A, B, C, K = map(int, input().split())
    li = ([1] * A) + ([0] * B) + ([-1] * C)
    print(sum(li[:K]))


if __name__ == "__main__":
    main()


Fixed submission:
def main():
    A, B, _, K = map(int, input().split())
    if A > K:
        print(K)
        quit()
    print(A - max([0, K - A - B]))


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys


def main():
    readline = sys.stdin.readline
    N = int(readline())
    li = []
    for _ in range(N):
        S = readline()
        if S not in li:
            li.append(S)
    print(len(li))


if __name__ == "__main__":
    main()


Fixed submission:
import sys


def main():
    readline = sys.stdin.readline
    N = int(readline())
    se = set([readline() for _ in range(N)])
    print(len(se))


if __name__ == "__main__":
    main()