Buggy python submission (verdict: Runtime Error):
# a から bで　cでもdでも割り切れないものの数を調べる
import math
#from fractions import gcd
Input = input()
a, b, c, d = Input.split()
a, b, c, d = int(a), int(b), int(c), int(d)
delta_c = b//c - a//c
delta_d = b//d - a//d
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
#    return (x * y) // gcd(x, y)
cd = lcm(c, d)
delta_cd = b//cd - a//cd
num_cd = delta_c + delta_d - delta_cd
print( b-a+1 - num_cd, end='')

Fixed submission:
from fractions import gcd
Input = input()
a, b, c, d = Input.split()
a, b, c, d = int(a), int(b), int(c), int(d)
delta_c = b//c - (a-1)//c
delta_d = b//d - (a-1)//d
def lcm(x, y):
    return (x * y) // gcd(x, y)
cd = lcm(c, d)
delta_cd = b//cd - (a-1)//cd
num_cd = delta_c + delta_d - delta_cd
print( b-a+1 - num_cd, end='')

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

Input = input()
a, b, c, d = Input.split()
a, b, c, d = int(a), int(b), int(c), int(d)

c_min = int(a/c) if a % c == 0 else int(a/c) + 1
c_max = int(b/c)
delta_c = c_max - c_min + 1

d_min = int(a/d) if a % c == 0 else int(a/d) + 1
d_max = int(b/d)
delta_d = d_max - d_min + 1

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

cd = lcm(c, d)
cd_min = int(a/cd) if a % c == 0 else int(a/cd) + 1
cd_max = int(b/cd)
delta_cd = cd_max -cd_min + 1

num_cd = delta_c + delta_d - delta_cd
print( b-a+1 - num_cd, end='')

Fixed submission:
from fractions import gcd
Input = input()
a, b, c, d = Input.split()
a, b, c, d = int(a), int(b), int(c), int(d)
delta_c = b//c - (a-1)//c
delta_d = b//d - (a-1)//d
def lcm(x, y):
    return (x * y) // gcd(x, y)
cd = lcm(c, d)
delta_cd = b//cd - (a-1)//cd
num_cd = delta_c + delta_d - delta_cd
print( b-a+1 - num_cd, end='')

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

Input = input()
a, b, c, d = Input.split()
a, b, c, d = int(a), int(b), int(c), int(d)

c_min = int(a/c) if a % c == 0 else int(a/c) + 1
c_max = int(b/c)
delta_c = c_max - c_min + 1

d_min = int(a/d) if a % c == 0 else int(a/d) + 1
d_max = int(b/d)
delta_d = d_max - d_min + 1

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

cd = lcm(c, d)
cd_min = int(a/cd) if a % c == 0 else int(a/cd) + 1
cd_max = int(b/cd)
delta_cd = cd_max -cd_min + 1

num_cd = delta_c + delta_d - delta_cd
print( b-a+1 - num_cd, end='')

Fixed submission:
from fractions import gcd
Input = input()
a, b, c, d = Input.split()
a, b, c, d = int(a), int(b), int(c), int(d)
delta_c = b//c - (a-1)//c
delta_d = b//d - (a-1)//d
def lcm(x, y):
    return (x * y) // gcd(x, y)
cd = lcm(c, d)
delta_cd = b//cd - (a-1)//cd
num_cd = delta_c + delta_d - delta_cd
print( b-a+1 - num_cd, end='')

Buggy python submission (verdict: Runtime Error):
# a から bで　cでもdでも割り切れないものの数を調べる
import math

Input = input()
a, b, c, d = Input.split()
a, b, c, d = int(a), int(b), int(c), int(d)

c_min = int(a/c) if a % c == 0 else int(a/c) + 1
c_max = int(b/c)
delta_c = c_max - c_min + 1

d_min = int(a/d) if a % c == 0 else int(a/d) + 1
d_max = int(b/d)
delta_d = d_max - d_min + 1

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

cd = lcm(c, d)
cd_min = int(a/cd) if a % c == 0 else int(a/cd) + 1
cd_max = int(b/cd)
delta_cd = cd_max -cd_min + 1

# cとdで割り切れる数
num_cd = delta_c + delta_d - delta_cd
print( b-a+1 - num_cd, end='')

Fixed submission:
from fractions import gcd
Input = input()
a, b, c, d = Input.split()
a, b, c, d = int(a), int(b), int(c), int(d)
delta_c = b//c - (a-1)//c
delta_d = b//d - (a-1)//d
def lcm(x, y):
    return (x * y) // gcd(x, y)
cd = lcm(c, d)
delta_cd = b//cd - (a-1)//cd
num_cd = delta_c + delta_d - delta_cd
print( b-a+1 - num_cd, end='')

Buggy python submission (verdict: Runtime Error):
# a から bで　cでもdでも割り切れないものの数を調べる
import math

Input = input()
a, b, c, d = Input.split()
a, b, c, d = int(a), int(b), int(c), int(d)

c_min = int(a/c) if a % c == 0 else int(a/c) + 1
c_max = int(b/c)
delta_c = c_max - c_min + 1

d_min = int(a/d) if a % c == 0 else int(a/d) + 1
d_max = int(b/d)
delta_d = d_max - d_min + 1

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

cd = lcm(c, d)
cd_min = int(a/cd) if a % c == 0 else int(a/cd) + 1
cd_max = int(b/cd)
delta_cd = cd_max -cd_min + 1

# cとdで割り切れる数
num_cd = delta_c + delta_d - delta_cd
print( b-a+1 - num_cd)

Fixed submission:
from fractions import gcd
Input = input()
a, b, c, d = Input.split()
a, b, c, d = int(a), int(b), int(c), int(d)
delta_c = b//c - (a-1)//c
delta_d = b//d - (a-1)//d
def lcm(x, y):
    return (x * y) // gcd(x, y)
cd = lcm(c, d)
delta_cd = b//cd - (a-1)//cd
num_cd = delta_c + delta_d - delta_cd
print( b-a+1 - num_cd, end='')