Buggy python submission (verdict: Runtime Error):
import numpy as np
import math

a, b, c, d = [int(i) for i in input().split()]
#
#num = np.arange(b - a + 1) + a
#
#if b < c and b < d:
#    print('0')
#    exit(0)
#
#m = min(c, d)
#div = max(c, d)
#tmp = []
#div = num[0] // div + div
#index = 0
#while True:
#    if n[index] % div != 0:
#        if index + div >
#        tmp += range(n[index], n[index])
#        index += 1
#    else:
#        index += div
#
#tmp = np.array(tmp)
#print(tmp[tmp % m == 0].shape[0])


size = b - a + 1
cd = int(c * d // math.gcd(c, d))
c_num_a = a // c
d_num_a = a // d
cd_num_a = a // cd
c_num_b = b // c
d_num_b = b // d
cd_num_b = b // cd

c_num = c_num_b - c_num_a
d_num = d_num_b - d_num_a
cd_num = cd_num_b - cd_num_a

if a % c == 0:
    c_num += 1
if a % d == 0:
    d_num += 1

print(size - c_num - d_num + cd_num)

Fixed submission:
import numpy as np
import math

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

a, b, c, d = [int(i) for i in input().split()]
#
#num = np.arange(b - a + 1) + a
#
#if b < c and b < d:
#    print('0')
#    exit(0)
#
#m = min(c, d)
#div = max(c, d)
#tmp = []
#div = num[0] // div + div
#index = 0
#while True:
#    if n[index] % div != 0:
#        if index + div >
#        tmp += range(n[index], n[index])
#        index += 1
#    else:
#        index += div
#
#tmp = np.array(tmp)
#print(tmp[tmp % m == 0].shape[0])


size = b - a + 1
cd = int(c * d // gcd(c, d))
c_num_a = a // c
d_num_a = a // d
cd_num_a = a // cd
c_num_b = b // c
d_num_b = b // d
cd_num_b = b // cd

c_num = c_num_b - c_num_a
d_num = d_num_b - d_num_a
cd_num = cd_num_b - cd_num_a

if a % c == 0:
    c_num += 1
if a % d == 0:
    d_num += 1
if a % cd == 0:
    cd_num += 1

print(size - c_num - d_num + cd_num)

Buggy python submission (verdict: Runtime Error):
import numpy as np

a, b, c, d = [int(i) for i in input().split()]

num = np.arange(b - a + 1) + a
print(num[num % (c * d) != 0].shape[0])

Fixed submission:
import numpy as np
import math

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

a, b, c, d = [int(i) for i in input().split()]
#
#num = np.arange(b - a + 1) + a
#
#if b < c and b < d:
#    print('0')
#    exit(0)
#
#m = min(c, d)
#div = max(c, d)
#tmp = []
#div = num[0] // div + div
#index = 0
#while True:
#    if n[index] % div != 0:
#        if index + div >
#        tmp += range(n[index], n[index])
#        index += 1
#    else:
#        index += div
#
#tmp = np.array(tmp)
#print(tmp[tmp % m == 0].shape[0])


size = b - a + 1
cd = int(c * d // gcd(c, d))
c_num_a = a // c
d_num_a = a // d
cd_num_a = a // cd
c_num_b = b // c
d_num_b = b // d
cd_num_b = b // cd

c_num = c_num_b - c_num_a
d_num = d_num_b - d_num_a
cd_num = cd_num_b - cd_num_a

if a % c == 0:
    c_num += 1
if a % d == 0:
    d_num += 1
if a % cd == 0:
    cd_num += 1

print(size - c_num - d_num + cd_num)

Buggy python submission (verdict: Runtime Error):
import numpy as np

a, b, c, d = [int(i) for i in input().split()]

num = np.arange(b - a + 1) + a
print(num[np.logical_and(num % c != 0, num % d != 0)].shape[0])

Fixed submission:
import numpy as np
import math

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

a, b, c, d = [int(i) for i in input().split()]
#
#num = np.arange(b - a + 1) + a
#
#if b < c and b < d:
#    print('0')
#    exit(0)
#
#m = min(c, d)
#div = max(c, d)
#tmp = []
#div = num[0] // div + div
#index = 0
#while True:
#    if n[index] % div != 0:
#        if index + div >
#        tmp += range(n[index], n[index])
#        index += 1
#    else:
#        index += div
#
#tmp = np.array(tmp)
#print(tmp[tmp % m == 0].shape[0])


size = b - a + 1
cd = int(c * d // gcd(c, d))
c_num_a = a // c
d_num_a = a // d
cd_num_a = a // cd
c_num_b = b // c
d_num_b = b // d
cd_num_b = b // cd

c_num = c_num_b - c_num_a
d_num = d_num_b - d_num_a
cd_num = cd_num_b - cd_num_a

if a % c == 0:
    c_num += 1
if a % d == 0:
    d_num += 1
if a % cd == 0:
    cd_num += 1

print(size - c_num - d_num + cd_num)