Buggy python submission (verdict: Runtime Error):
import math
def acinput():
    return list(map(int, input().split(" ")))
def lcm(x, y):
    return x*y // math.gcd(x, y)
    
a, b, c, d = acinput()
l = lcm(c, d)
CD = b//l-(a-1)//l
nC = b//c-(a-1)//c
nD = b//d-(a-1)//d

res = b-a+1-(nC+nD-CD)
print(int(res))


Fixed submission:
def gcd(a,b):
    while b > 0:
        a, b = b, a % b
    return a


def acinput():
    return list(map(int, input().split(" ")))
def lcm(x, y):
    return x*y //gcd(x, y)

a, b, c, d = acinput()
l = lcm(c, d)
CD = b//l-(a-1)//l
nC = b//c-(a-1)//c
nD = b//d-(a-1)//d

res = b-a+1-(nC+nD-CD)
print(int(res))

Buggy python submission (verdict: Runtime Error):
import numpy as np
def acinput():
    return list(map(int, input().split(" ")))




def lcm(x, y):
    return x*y // np.gcd(x, y)


a, b, c, d = acinput()
l = lcm(c, d)
CD = b//l-(a-1)//l
nC = b//c-(a-1)//c
nD = b//d-(a-1)//d

res = b-a+1-(nC+nD-CD)
print(int(res))


Fixed submission:
def gcd(a,b):
    while b > 0:
        a, b = b, a % b
    return a


def acinput():
    return list(map(int, input().split(" ")))
def lcm(x, y):
    return x*y //gcd(x, y)

a, b, c, d = acinput()
l = lcm(c, d)
CD = b//l-(a-1)//l
nC = b//c-(a-1)//c
nD = b//d-(a-1)//d

res = b-a+1-(nC+nD-CD)
print(int(res))

Buggy python submission (verdict: Runtime Error):
def acinput():
    return list(map(int,input().split(" ")))


def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)
 

a,b,c,d=acinput()


l=lcm(c,d)
CD=int(b/l)-int((a-1)/l)
nC=int(b/c)-int((a-1)/c)
nD=int(b/d)-int((a-1)/d)

print(int(b-a+1-(nC+nD-CD)))


Fixed submission:
def gcd(a,b):
    while b > 0:
        a, b = b, a % b
    return a


def acinput():
    return list(map(int, input().split(" ")))
def lcm(x, y):
    return x*y //gcd(x, y)

a, b, c, d = acinput()
l = lcm(c, d)
CD = b//l-(a-1)//l
nC = b//c-(a-1)//c
nD = b//d-(a-1)//d

res = b-a+1-(nC+nD-CD)
print(int(res))

Buggy python submission (verdict: Runtime Error):
def acinput():
    return list(map(int,input().split(" ")))


def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)
 

def lcm(x,y):
    return math.floor(x*y /gcd(x, y))

a,b,c,d=acinput()


l=lcm(c,d)
n_CandD=int(b/l)-int((a-1)/l)
n_C=int(b/c)-int((a-1)/c)
n_D=int(b/d)-int((a-1)/d)

print(int(b-a+1-(n_C+n_D-n_CandD)))


Fixed submission:
def gcd(a,b):
    while b > 0:
        a, b = b, a % b
    return a


def acinput():
    return list(map(int, input().split(" ")))
def lcm(x, y):
    return x*y //gcd(x, y)

a, b, c, d = acinput()
l = lcm(c, d)
CD = b//l-(a-1)//l
nC = b//c-(a-1)//c
nD = b//d-(a-1)//d

res = b-a+1-(nC+nD-CD)
print(int(res))

Buggy python submission (verdict: Runtime Error):
import math
def acinput():
    return list(map(int,input().split(" ")))

def lcm(x,y):
    return math.floor(x*y /math.gcd(x, y))

a,b,c,d=acinput()


l=lcm(c,d)
n_CandD=int(b/l)-int((a-1)/l)
n_C=int(b/c)-int((a-1)/c)
n_D=int(b/d)-int((a-1)/d)

print(int(b-a+1-(n_C+n_D-n_CandD)))


Fixed submission:
def gcd(a,b):
    while b > 0:
        a, b = b, a % b
    return a


def acinput():
    return list(map(int, input().split(" ")))
def lcm(x, y):
    return x*y //gcd(x, y)

a, b, c, d = acinput()
l = lcm(c, d)
CD = b//l-(a-1)//l
nC = b//c-(a-1)//c
nD = b//d-(a-1)//d

res = b-a+1-(nC+nD-CD)
print(int(res))

Buggy python submission (verdict: Runtime Error):

import math
def acinput():
    return list(map(int,input().split(" ")))

def lcm(x, y):
    return (x * y) //math.gcd(x, y)

a,b,c,d=acinput()


l=lcm(c,d)
n_CandD=int(b/l)-int((a-1)/l)
n_C=int(b/c)-int((a-1)/c)
n_D=int(b/d)-int((a-1)/d)

print(int(b-a+1-(n_C+n_D-n_CandD)))


Fixed submission:
def gcd(a,b):
    while b > 0:
        a, b = b, a % b
    return a


def acinput():
    return list(map(int, input().split(" ")))
def lcm(x, y):
    return x*y //gcd(x, y)

a, b, c, d = acinput()
l = lcm(c, d)
CD = b//l-(a-1)//l
nC = b//c-(a-1)//c
nD = b//d-(a-1)//d

res = b-a+1-(nC+nD-CD)
print(int(res))

Buggy python submission (verdict: Runtime Error):
import numpy as np

def acinput():
    return list(map(int,input().split(" ")))

def lcm(x, y):
    return (x * y) // np.gcd(x, y)

a,b,c,d=acinput()


l=lcm(c,d)
n_CandD=int(b/l)-int((a-1)/l)
n_C=int(b/c)-int((a-1)/c)
n_D=int(b/d)-int((a-1)/d)

print(int(b-a+1-(n_C+n_D-n_CandD)))



Fixed submission:
def gcd(a,b):
    while b > 0:
        a, b = b, a % b
    return a


def acinput():
    return list(map(int, input().split(" ")))
def lcm(x, y):
    return x*y //gcd(x, y)

a, b, c, d = acinput()
l = lcm(c, d)
CD = b//l-(a-1)//l
nC = b//c-(a-1)//c
nD = b//d-(a-1)//d

res = b-a+1-(nC+nD-CD)
print(int(res))