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

A,B,C,D = map(int, input().split())

c1 = int((B - B%C)/C) - int(((A-1) - (A-1)%C)/C)
d1 = int((B - B%D)/D) - int(((A-1) - (A-1)%D)/D)

CD = int((C * D - C * D % math.gcd(C, D)) / math.gcd(C, D))
cd1 = int((B - B%CD)/CD) - int(((A-1) - (A-1)%CD)/CD)

ans = B - (A-1) - (c1 + d1 - cd1)
print(ans)

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

A,B,C,D = map(int, input().split())

c = B//C - (A-1)//C
d = B//D - (A-1)//D

CD = C * D // gcd(C, D)
cd = B//CD - (A-1)//CD

ans = B - (A-1) - (c + d - cd)
print(ans)

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

A,B,C,D = map(int, input().split())

c = int((B - B%C)/C) - int(((A-1) - (A-1)%C)/C)
d = int((B - B%D)/D) - int(((A-1) - (A-1)%D)/D)

CD = int((C * D - C * D % math.gcd(C, D)) / math.gcd(C, D))
cd = int((B - B%CD)/CD) - int(((A-1) - (A-1)%CD)/CD)

ans = B - (A-1) - (c + d - cd)
print(ans)

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

A,B,C,D = map(int, input().split())

c = B//C - (A-1)//C
d = B//D - (A-1)//D

CD = C * D // gcd(C, D)
cd = B//CD - (A-1)//CD

ans = B - (A-1) - (c + d - cd)
print(ans)

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

A,B,C,D = map(int, input().split())

c = int(B/C) - int((A-1)/C)
d = int(B/D) - int((A-1)/D)

CD = int(C * D / math.gcd(C, D))
cd = int(B/CD) - int((A-1)/CD)

ans = B - (A-1) - (c + d - cd)
print(ans)

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

A,B,C,D = map(int, input().split())

c = B//C - (A-1)//C
d = B//D - (A-1)//D

CD = C * D // gcd(C, D)
cd = B//CD - (A-1)//CD

ans = B - (A-1) - (c + d - cd)
print(ans)

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

A,B,C,D = map(int, input().split())

c = int(B/C) - int((A-1)/C)
d = int(B/D) - int((A-1)/D)

CD = C * D / math.gcd(C, D)
cd = int(B/CD) - int((A-1)/CD)

ans = B - (A-1) - (c + d - cd)
print(ans)

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

A,B,C,D = map(int, input().split())

c = B//C - (A-1)//C
d = B//D - (A-1)//D

CD = C * D // gcd(C, D)
cd = B//CD - (A-1)//CD

ans = B - (A-1) - (c + d - cd)
print(ans)

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

A,B,C,D = map(int, input().split())

c = int(B/C) - int((A-1)/C)
d = int(B/D) - int((A-1)/D)

CD = C * D / math.gcd(C, D)
cd = int(B/CD) - int((A-1)/CD)

ans = B - (A-1) - (c + d - cd)

print(ans)

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

A,B,C,D = map(int, input().split())

c = B//C - (A-1)//C
d = B//D - (A-1)//D

CD = C * D // gcd(C, D)
cd = B//CD - (A-1)//CD

ans = B - (A-1) - (c + d - cd)
print(ans)

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

A,B,C,D = map(int, input().split())

c = int(B/C) - int((A-1)/C)
d = int(B/D) - int((A-1)/D)

CD = C * D / math.gcd(C, D)
cd = int(B/CD) - int((A-1)/CD)

ans = B - (A-1) - (c + d - cd)
ans = int(ans)

print(ans)

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

A,B,C,D = map(int, input().split())

c = B//C - (A-1)//C
d = B//D - (A-1)//D

CD = C * D // gcd(C, D)
cd = B//CD - (A-1)//CD

ans = B - (A-1) - (c + d - cd)
print(ans)

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

A,B,C,D = map(int, input().split())

c = (B  - B%C) / C - ((A-1)  - (A-1)%C)/C
d = (B  - B%D) / D - ((A-1)  - (A-1)%D)/D

CD = (C * D  - (C * D % math.gcd(C, D))) / math.gcd(C, D)
cd = (B  - B%CD) / CD - ((A-1)  - (A-1)%CD)/CD

ans = B - (A-1) - (c + d - cd)
ans = int(ans)

print(ans)

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

A,B,C,D = map(int, input().split())

c = B//C - (A-1)//C
d = B//D - (A-1)//D

CD = C * D // gcd(C, D)
cd = B//CD - (A-1)//CD

ans = B - (A-1) - (c + d - cd)
print(ans)

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

A,B,C,D = map(int, input().split())

c = (B  - B%C) / B - ((A-1)  - (A-1)%C)/C
d = (B  - B%D) / B - ((A-1)  - (A-1)%D)/D

CD = (C * D  - (C * D % math.gcd(C, D))) / math.gcd(C, D)
cd = (B  - B%CD) / B - ((A-1)  - (A-1)%CD)/CD

ans = B - (A-1) - (c + d - cd)
ans = int(ans)

print(ans)

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

A,B,C,D = map(int, input().split())

c = B//C - (A-1)//C
d = B//D - (A-1)//D

CD = C * D // gcd(C, D)
cd = B//CD - (A-1)//CD

ans = B - (A-1) - (c + d - cd)
print(ans)

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

A,B,C,D = map(int, input().split())

c = B//C - (A-1)//C
d = B//D - (A-1)//D

CD = C * D // math.gcd(C, D)
cd = B//CD - (A-1)//CD

ans = B - (A-1) - (c + d - cd)
ans = int(ans)

print(ans)

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

A,B,C,D = map(int, input().split())

c = B//C - (A-1)//C
d = B//D - (A-1)//D

CD = C * D // gcd(C, D)
cd = B//CD - (A-1)//CD

ans = B - (A-1) - (c + d - cd)
print(ans)