Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)
    
a, b, c, d = map(int,input().split())
def cal(i, j, k):
    return i // j + i // k - i // lcm(j, k)

if a % c == 0 or a % d == 0:
    print(b - a - (cal(b, c, d) - cal(a, c, d)))
else:
    print(b - a - (cal(b, c, d) - cal(a, c, d)) + 1)

Fixed submission:
# coding: utf-8
# Your code here!
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
    
a, b, c, d = map(int,input().split())
def cal(i, j, k):
    return i // j + i // k - i // lcm(j, k)

if a % c == 0 or a % d == 0:
    print(b - a - (cal(b, c, d) - cal(a, c, d)))
else:
    print(b - a - (cal(b, c, d) - cal(a, c, d)) + 1)

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
import math

A, B, C, D = map(int, input().split())
subst = abs(A - B)
num1 = subst // C + 1
num2 = subst // D + 1
num3 = subst // (C * D // math.gcd(C, D)) + 1

print(subst - num1 - num2 + num3 + 1)

Fixed submission:
# coding: utf-8
# Your code here!
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
    
a, b, c, d = map(int,input().split())
def cal(i, j, k):
    return i // j + i // k - i // lcm(j, k)

if a % c == 0 or a % d == 0:
    print(b - a - (cal(b, c, d) - cal(a, c, d)))
else:
    print(b - a - (cal(b, c, d) - cal(a, c, d)) + 1)

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
import math

A, B, C, D = map(int, input().split())
subst = abs(A - B)
num1 , num2, num3 = (subst // C + 1), (subst // D + 1), (subst // (C * D // math.gcd(C, D))) + 1

print(subst - num1 - num2 + num3 + 1)

Fixed submission:
# coding: utf-8
# Your code here!
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
    
a, b, c, d = map(int,input().split())
def cal(i, j, k):
    return i // j + i // k - i // lcm(j, k)

if a % c == 0 or a % d == 0:
    print(b - a - (cal(b, c, d) - cal(a, c, d)))
else:
    print(b - a - (cal(b, c, d) - cal(a, c, d)) + 1)

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
import math
 
A, B, C, D = map(int, input().split())
sub = abs(A - B)
num1 , num2, num3 = (sub // C + 1), (sub // D + 1), (sub // (C * D // math.gcd(C, D))) + 1
        
print(sub - num1 - num2 + num3 + 1)

Fixed submission:
# coding: utf-8
# Your code here!
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
    
a, b, c, d = map(int,input().split())
def cal(i, j, k):
    return i // j + i // k - i // lcm(j, k)

if a % c == 0 or a % d == 0:
    print(b - a - (cal(b, c, d) - cal(a, c, d)))
else:
    print(b - a - (cal(b, c, d) - cal(a, c, d)) + 1)

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
import numpy as np
import math

A, B, C, D = map(int, input().split())
sub = abs(A - B)
num1 , num2, num3 = (sub // C + 1), (sub // D + 1), (sub // (C * D // math.gcd(C, D))) + 1
print(num1, num2, num3)
        
print(sub - num1 - num2 + num3 + 1)


Fixed submission:
# coding: utf-8
# Your code here!
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
    
a, b, c, d = map(int,input().split())
def cal(i, j, k):
    return i // j + i // k - i // lcm(j, k)

if a % c == 0 or a % d == 0:
    print(b - a - (cal(b, c, d) - cal(a, c, d)))
else:
    print(b - a - (cal(b, c, d) - cal(a, c, d)) + 1)