Buggy python submission (verdict: Runtime Error):
mport fractions
 
a,b,c,d = map(int,input().split())
 
ans = 0
 
if c % d == 0:
    print((b - a + 1) - ((b)//d - (a-1)//d))
elif d % c == 0:
    print((b - a + 1) - ((b)//c - (a-1)//c))
else:
    tot = c * d // fractions.gcd(c, d)
    tmp = ((b) // d - (a-1) // d) + ((b)//c - (a-1)//c) - ((b) // tot - (a-1) // tot)
    print(int((b - a + 1) - tmp))

Fixed submission:
import fractions

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

ans = 0

if c % d == 0:
    print((b - a + 1) - ((b)//d - (a-1)//d))
elif d % c == 0:
    print((b - a + 1) - ((b)//c - (a-1)//c))
else:
    tot = c * d // fractions.gcd(c, d)
    tmp = ((b) // d - (a-1) // d) + ((b)//c - (a-1)//c) - ((b) // tot - (a-1) // tot)
    print(int((b - a + 1) - tmp))

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

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

ans = 0

if c % d == 0:
    print((b - a + 1) - ((b)//d - (a-1)//d))
elif d % c == 0:
    print((b - a + 1) - ((b)//c - (a-1)//c))
else:
    tot = c * d // math.gcd(c, d)
    tmp = ((b) // d - (a-1) // d) + ((b)//c - (a-1)//c) - ((b) // tot - (a-1) // tot)
    print(int((b - a + 1) - tmp))

Fixed submission:
import fractions

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

ans = 0

if c % d == 0:
    print((b - a + 1) - ((b)//d - (a-1)//d))
elif d % c == 0:
    print((b - a + 1) - ((b)//c - (a-1)//c))
else:
    tot = c * d // fractions.gcd(c, d)
    tmp = ((b) // d - (a-1) // d) + ((b)//c - (a-1)//c) - ((b) // tot - (a-1) // tot)
    print(int((b - a + 1) - tmp))

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

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

ans = 0

if c % d == 0:
    print((b - a + 1) - (b//d - a//d))
elif d % c == 0:
    print((b - a + 1) - (b//c - a//c))
else:
    tot = c * d // math.gcd(c, d)
    tmp = (b // d - a // d) + (b//c - a//c) - (b // tot - a // tot)
    print(int((b - a + 1) - tmp))

Fixed submission:
import fractions

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

ans = 0

if c % d == 0:
    print((b - a + 1) - ((b)//d - (a-1)//d))
elif d % c == 0:
    print((b - a + 1) - ((b)//c - (a-1)//c))
else:
    tot = c * d // fractions.gcd(c, d)
    tmp = ((b) // d - (a-1) // d) + ((b)//c - (a-1)//c) - ((b) // tot - (a-1) // tot)
    print(int((b - a + 1) - tmp))

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

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

ans = 0

if c % d == 0:
    print((b - a + 1) - (b//d - a//d))
elif d % c == 0:
    print((b - a + 1) - (b//c - a//c))
else:
    tot = c * d // math.gcd(c, d)
    tmp = (b // d - a // d) + (b//c - a//c) - (b // tot - a // tot)
    print(int((b - a + 1) - tmp))

Fixed submission:
import fractions

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

ans = 0

if c % d == 0:
    print((b - a + 1) - ((b)//d - (a-1)//d))
elif d % c == 0:
    print((b - a + 1) - ((b)//c - (a-1)//c))
else:
    tot = c * d // fractions.gcd(c, d)
    tmp = ((b) // d - (a-1) // d) + ((b)//c - (a-1)//c) - ((b) // tot - (a-1) // tot)
    print(int((b - a + 1) - tmp))

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

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

ans = 0

if c % d == 0:
    print((b - a + 1) - (b//d - a//d))
elif d % c == 0:
    print((b - a + 1) - (b//c - a//c))
else:
    tot = c * d / math.gcd(c, d)
    tmp = (b // d - a // d) + (b//c - a//c) - (b // tot - a // tot)
    print(int((b - a + 1) - tmp))

Fixed submission:
import fractions

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

ans = 0

if c % d == 0:
    print((b - a + 1) - ((b)//d - (a-1)//d))
elif d % c == 0:
    print((b - a + 1) - ((b)//c - (a-1)//c))
else:
    tot = c * d // fractions.gcd(c, d)
    tmp = ((b) // d - (a-1) // d) + ((b)//c - (a-1)//c) - ((b) // tot - (a-1) // tot)
    print(int((b - a + 1) - tmp))

Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,d = map(int,input().split())

ans = 0

if c % d == 0:
    for i in range(a, b+1):
        if i % c !=0:
            ans += 1
elif d % c == 0:
    for i in range(a, b+1):
        if i % d !=0:
            ans += 1
else:
    for i in range(a, b+1):
        if (i % d !=0) and (i % c !=0):
            ans += 1

print(ans)

Fixed submission:
import fractions

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

ans = 0

if c % d == 0:
    print((b - a + 1) - ((b)//d - (a-1)//d))
elif d % c == 0:
    print((b - a + 1) - ((b)//c - (a-1)//c))
else:
    tot = c * d // fractions.gcd(c, d)
    tmp = ((b) // d - (a-1) // d) + ((b)//c - (a-1)//c) - ((b) // tot - (a-1) // tot)
    print(int((b - a + 1) - tmp))