Buggy python submission (verdict: Runtime Error):
# coding: utf-8
from sys import stdin
import sys, math
import numpy as np

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


a,b,c,d = [int(x) for x in stdin.readline().rstrip().split()]
#print(a, b, c, d)
#bまでで3で割り切れる数
three_all = b // c
#a-1までで3で割り切れる数
three_less = (a-1) // c
three_range = three_all - three_less
    
two_all = b // d
two_less = (a-1) // d
two_range = two_all - two_less
    
z = lcm(c,d)
six_all = b // z
six_less = (a-1) // z
six_range = six_all - six_less
    
num = three_range + two_range - six_range
    
ans = b-a+1-num
print(ans)
    


    




Fixed submission:
# coding: utf-8
from sys import stdin
import sys, fractions
import numpy as np

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


a,b,c,d = [int(x) for x in stdin.readline().rstrip().split()]
#print(a, b, c, d)
#bまでで3で割り切れる数
three_all = b // c
#a-1までで3で割り切れる数
three_less = (a-1) // c
three_range = three_all - three_less
    
two_all = b // d
two_less = (a-1) // d
two_range = two_all - two_less
    
z = lcm(c,d)
six_all = b // z
six_less = (a-1) // z
six_range = six_all - six_less
    
num = three_range + two_range - six_range
    
ans = b-a+1-num
print(ans)

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
from sys import stdin
import sys, math
import numpy as np

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

def main():
    a,b,c,d = [int(x) for x in stdin.readline().rstrip().split()]
    #print(a, b, c, d)
    #bまでで3で割り切れる数
    three_all = b // c
    #a-1までで3で割り切れる数
    three_less = (a-1) // c
    three_range = three_all - three_less
    
    two_all = b // d
    two_less = (a-1) // d
    two_range = two_all - two_less
    
    z = lcm(c,d)
    six_all = b // z
    six_less = (a-1) // z
    six_range = six_all - six_less
    
    num = three_range + two_range - six_range
    
    ans = b-a+1-num
    print(ans)
    
    return(ans)

if __name__ == '__main__':
    _ = main()

    




Fixed submission:
# coding: utf-8
from sys import stdin
import sys, fractions
import numpy as np

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


a,b,c,d = [int(x) for x in stdin.readline().rstrip().split()]
#print(a, b, c, d)
#bまでで3で割り切れる数
three_all = b // c
#a-1までで3で割り切れる数
three_less = (a-1) // c
three_range = three_all - three_less
    
two_all = b // d
two_less = (a-1) // d
two_range = two_all - two_less
    
z = lcm(c,d)
six_all = b // z
six_less = (a-1) // z
six_range = six_all - six_less
    
num = three_range + two_range - six_range
    
ans = b-a+1-num
print(ans)

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
from sys import stdin
import sys, math
import numpy as np

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

def main():
    a,b,c,d = [int(x) for x in stdin.readline().rstrip().split()]
    #print(a, b, c, d)
    #bまでで3で割り切れる数
    three_all = b // c
    #a-1までで3で割り切れる数
    three_less = (a-1) // c
    three_range = three_all - three_less
    
    two_all = b // d
    two_less = (a-1) // d
    two_range = two_all - two_less
    
    z = lcm(c,d)
    six_all = b // z
    six_less = (a-1) // z
    six_range = six_all - six_less
    
    num = three_range + two_range - six_range
    
    ans = b-a+1-num
    print(ans)

if __name__ == '__main__':
    main()

    




Fixed submission:
# coding: utf-8
from sys import stdin
import sys, fractions
import numpy as np

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


a,b,c,d = [int(x) for x in stdin.readline().rstrip().split()]
#print(a, b, c, d)
#bまでで3で割り切れる数
three_all = b // c
#a-1までで3で割り切れる数
three_less = (a-1) // c
three_range = three_all - three_less
    
two_all = b // d
two_less = (a-1) // d
two_range = two_all - two_less
    
z = lcm(c,d)
six_all = b // z
six_less = (a-1) // z
six_range = six_all - six_less
    
num = three_range + two_range - six_range
    
ans = b-a+1-num
print(ans)