Buggy python submission (verdict: Runtime Error):
import math
A,B,C,D = map(int, input().split())


t = math.gcd(C, D)

m = math.floor(B / C) + math.floor(B / D) - math.floor(B / t)
 
n = math.floor((A-1) / C) + math.floor((A-1) / D ) - math.floor((A-1) / t)

print(B-A+1-m+n)
 

Fixed submission:
from fractions import gcd
 
A, B, C, D = map(int, input().split())
t = C * D // gcd(C, D)
print((B - (A - 1)) - (B//C + B//D - B//t) + ((A-1)//C + (A-1)//D - (A-1)//t))

Buggy python submission (verdict: Runtime Error):
import math
A,B,C,D = map(int, input().split())
d = math.gcd(C, D)
t = C * D / d

m = math.floor(B / C) + math.floor(B / D) - math.floor(B / t)
 
n = math.floor((A-1) / C) + math.floor((A-1) / D ) - math.floor((A-1) / t)

print(B-A+1-m+n)

Fixed submission:
from fractions import gcd
 
A, B, C, D = map(int, input().split())
t = C * D // gcd(C, D)
print((B - (A - 1)) - (B//C + B//D - B//t) + ((A-1)//C + (A-1)//D - (A-1)//t))

Buggy python submission (verdict: Runtime Error):
import math
A,B,C,D = map(int, input().split())

t = (C * D) / math.gcd(C, D)

m = math.floor(B / C) + math.floor(B / D) - math.floor(B / t)
 
n = math.floor((A-1) / C) + math.floor((A-1) / D ) - math.floor((A-1) / t)

print(B-A+1-m+n)

Fixed submission:
from fractions import gcd
 
A, B, C, D = map(int, input().split())
t = C * D // gcd(C, D)
print((B - (A - 1)) - (B//C + B//D - B//t) + ((A-1)//C + (A-1)//D - (A-1)//t))

Buggy python submission (verdict: Runtime Error):
import math
A,B,C,D = map(int, input().split())

t = (C * D) / math.gcd(C, D)

m = B - (math.floor(B / C) + math.floor(B / D) - math.floor(B / (t)))
 
n = A - 1 - (math.floor((A-1) / C) + math.floor((A-1) / D ) - math.floor((A-1) / (t)))

print(m-n)

Fixed submission:
from fractions import gcd
 
A, B, C, D = map(int, input().split())
t = C * D // gcd(C, D)
print((B - (A - 1)) - (B//C + B//D - B//t) + ((A-1)//C + (A-1)//D - (A-1)//t))

Buggy python submission (verdict: Runtime Error):
import math
A,B,C,D = map(int, input().split())


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

t = lcm(C, D)

m = B - (math.floor(B / C) + math.floor(B / D) - math.floor(B / (t)))
 
n = A - 1 - (math.floor((A-1) / C) + math.floor((A-1) / D ) - math.floor((A-1) / (t)))

print(m-n)

Fixed submission:
from fractions import gcd
 
A, B, C, D = map(int, input().split())
t = C * D // gcd(C, D)
print((B - (A - 1)) - (B//C + B//D - B//t) + ((A-1)//C + (A-1)//D - (A-1)//t))

Buggy python submission (verdict: Runtime Error):
import math
A,B,C,D = map(int, input().split())


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

t = lcm(C, D)


# C = 2
# D = 2

m = B - (math.floor(B / C) + math.floor(B / D) - math.floor(B / (t)))
 
n = A-1 - (math.floor((A-1) / C) + math.floor((A-1) / D ) - math.floor((A-1) / (t)))

print(m-n)

Fixed submission:
from fractions import gcd
 
A, B, C, D = map(int, input().split())
t = C * D // gcd(C, D)
print((B - (A - 1)) - (B//C + B//D - B//t) + ((A-1)//C + (A-1)//D - (A-1)//t))

Buggy python submission (verdict: Runtime Error):
import math
A,B,C,D = map(int, input().split())


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

t = lcm(C, D)

m = B - (math.floor(B / C) + math.floor(B / D) - math.floor(B / (t)))
 
n = A-1 - (math.floor((A-1) / C) + math.floor((A-1) / D ) - math.floor((A-1) / (t)))

print(m-n)

Fixed submission:
from fractions import gcd
 
A, B, C, D = map(int, input().split())
t = C * D // gcd(C, D)
print((B - (A - 1)) - (B//C + B//D - B//t) + ((A-1)//C + (A-1)//D - (A-1)//t))