Buggy python submission (verdict: Runtime Error):
import math
a,b,c,d = map(int,input().split())
dev = b- a +1
if dev % c==0:
    count = dev//c
else:
    if ((a%c)+(b%c)) < c:
        count = dev//c +1
    else:
        count = dev//c

if dev % d==0:
    count += dev//d
else:
    if ((a%d)+(b%d)) < d:
        count += dev//d +1
    else:
        count += dev//d

def lcm(c,d):
    return (c*d)//(math.gcd(c,d))
da = lcm(c,d)
if dev % (da)==0:
    count -= int(dev/(da))
else:
    if ((a%c)+(b%c)) < (da):
        count -= int(dev/(da)) 
    else:
        count -= int(dev/(da))
print(int(dev-count))

Fixed submission:
import fractions
a,b,c,d = map(int,input().split())
dev = b- a +1

def count_q(a,b,m):
    if a%m==0:
        q = b//m -a//m +1
    else:
        q = b//m - a//m
    return q


def lcm(c,d):
    return (c*d)//(fractions.gcd(c,d))

da = lcm(c,d)

qc = count_q(a,b,c)
qd = count_q(a,b,d)
qe = count_q(a,b,da)
ans = (b-a+1)-(qc+qd-qe)
print(ans)

Buggy python submission (verdict: Runtime Error):
import math
a,b,c,d = map(int,input().split())
dev = b- a +1
if dev % c==0:
    count = dev//c
else:
    if ((a%c)+(b%c)) < c:
        count = dev//c +1
    else:
        count = dev//c

if dev % d==0:
    count += dev//d
else:
    if ((a%d)+(b%d)) < d:
        count += dev//d +1
    else:
        count += dev//d

def lcm(c,d):
    return (c*d)//(math.gcd(c,d))
da = lcm(c,d)
if dev % (da)==0:
    count -= int(dev/(da))
else:
    if ((a%c)+(b%c)) < (da):
        count -= int(dev/(da)) 
    else:
        count -= int(dev/(da))
print(int(dev-count))

Fixed submission:
import fractions
a,b,c,d = map(int,input().split())
dev = b- a +1

def count_q(a,b,m):
    if a%m==0:
        q = b//m -a//m +1
    else:
        q = b//m - a//m
    return q


def lcm(c,d):
    return (c*d)//(fractions.gcd(c,d))

da = lcm(c,d)

qc = count_q(a,b,c)
qd = count_q(a,b,d)
qe = count_q(a,b,da)
ans = (b-a+1)-(qc+qd-qe)
print(ans)

Buggy python submission (verdict: Runtime Error):
import math
a,b,c,d = map(int,input().split())
dev = b- a +1
if dev % c==0:
    count = dev//c
else:
    if ((a%c)+(b%c)) < c:
        count = dev//c +1
    else:
        count = dev//c

if dev % d==0:
    count += dev//d
else:
    if ((a%d)+(b%d)) < d:
        count += dev//d +1
    else:
        count += dev//d
        
da = lcm(c,d)
if dev % (da)==0:
    count -= int(dev/(da))
else:
    if ((a%c)+(b%c)) < (da):
        count -= int(dev/(da)) 
    else:
        count -= int(dev/(da))
print(int(dev-count))

Fixed submission:
import fractions
a,b,c,d = map(int,input().split())
dev = b- a +1

def count_q(a,b,m):
    if a%m==0:
        q = b//m -a//m +1
    else:
        q = b//m - a//m
    return q


def lcm(c,d):
    return (c*d)//(fractions.gcd(c,d))

da = lcm(c,d)

qc = count_q(a,b,c)
qd = count_q(a,b,d)
qe = count_q(a,b,da)
ans = (b-a+1)-(qc+qd-qe)
print(ans)

Buggy python submission (verdict: Runtime Error):
import math
a,b,c,d = map(int,input().split())
dev = b- a +1
if dev % c==0:
    count = dev//c
else:
    if ((a%c)+(b%c)) < c:
        count = dev//c +1
    else:
        count = dev//c

if dev % d==0:
    count += dev//d
else:
    if ((a%d)+(b%d)) < d:
        count += dev//d +1
    else:
        count += dev//d
        
da = lcm(c,d)
if dev % (da)==0:
    count -= int(dev/(da))
else:
    if ((a%c)+(b%c)) < (da):
        count -= int(dev/(da)) 
    else:
        count -= int(dev/(da))
print(int(dev-count))

Fixed submission:
import fractions
a,b,c,d = map(int,input().split())
dev = b- a +1

def count_q(a,b,m):
    if a%m==0:
        q = b//m -a//m +1
    else:
        q = b//m - a//m
    return q


def lcm(c,d):
    return (c*d)//(fractions.gcd(c,d))

da = lcm(c,d)

qc = count_q(a,b,c)
qd = count_q(a,b,d)
qe = count_q(a,b,da)
ans = (b-a+1)-(qc+qd-qe)
print(ans)