Buggy python submission (verdict: Runtime Error):
# coding: utf-8
import re
import bisect
from datetime import datetime as dt
import bisect
import math

def gcd(a, b):
    return int(math.gcd(a, b))

def lcm(a, b):
    return a / gcd(a, b) * b

class slist(list):
    def __init__(self, *args, **kw):
        list.__init__(self, *args, **kw)
        self.sort()

    def append(self, value):
        bisect.insort(self,value)

    def index_left(self, value):
        return bisect.bisect_left(self, value)

def calc(n, a, b):
    aa = (int(n/a))
    bb = (int(n/b))
    ab = (int(n/lcm(a,b)))
    return aa + bb - ab

if __name__ == '__main__':
    a, b, c, d = map(int, input().split())
    ans = calc(b, c, d) - calc(a - 1, c, d)
    print(b - a + 1 - ans)


Fixed submission:
# coding: utf-8
import re
import bisect
from datetime import datetime as dt
import bisect
import fractions

def gcd(a, b):
    return fractions.gcd(a, b)

def lcm(a, b):
    return a * b // gcd(a, b)

def calc(n, a, b):
    return n//a + n//b - n//lcm(a,b)

if __name__ == '__main__':
    a, b, c, d = map(int, input().split())
    ## これで通った
    # num1 = b - calc(b,c,d)
    # num2 = (a-1) - calc(a-1, c,d)
    # print(num1-num2)

    ## これはとおらない
    ans = calc(b, c, d) - calc(a - 1, c, d)
    print(b - a + 1 - ans)

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

def gcd(a, b):
    return math.gcd(a, b)

def lcm(a, b):
    return a / gcd(a, b) * b

def calc(n, a, b):
    aa = (int(n/a))
    bb = (int(n/b))
    ab = (int(n/lcm(a,b)))
    return aa + bb - ab

if __name__ == '__main__':
    a, b, c, d = map(int, input().split())
    ans = calc(b, c, d) - calc(a - 1, c, d)
    print(b - a + 1 - ans + 1)


Fixed submission:
# coding: utf-8
import re
import bisect
from datetime import datetime as dt
import bisect
import fractions

def gcd(a, b):
    return fractions.gcd(a, b)

def lcm(a, b):
    return a * b // gcd(a, b)

def calc(n, a, b):
    return n//a + n//b - n//lcm(a,b)

if __name__ == '__main__':
    a, b, c, d = map(int, input().split())
    ## これで通った
    # num1 = b - calc(b,c,d)
    # num2 = (a-1) - calc(a-1, c,d)
    # print(num1-num2)

    ## これはとおらない
    ans = calc(b, c, d) - calc(a - 1, c, d)
    print(b - a + 1 - ans)

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

def gcd(a, b):
    return math.gcd(a, b)

def lcm(a, b):
    return a / gcd(a, b) * b

def calc(n, a, b):
    aa = (int(n/a))
    bb = (int(n/b))
    ab = (int(n/lcm(a,b)))
    return aa + bb - ab

if __name__ == '__main__':
    a, b, c, d = map(int, input().split())
    ans = calc(b, c, d) - calc(a - 1, c, d)
    print(b - a + 1 - ans + 1)


Fixed submission:
# coding: utf-8
import re
import bisect
from datetime import datetime as dt
import bisect
import fractions

def gcd(a, b):
    return fractions.gcd(a, b)

def lcm(a, b):
    return a * b // gcd(a, b)

def calc(n, a, b):
    return n//a + n//b - n//lcm(a,b)

if __name__ == '__main__':
    a, b, c, d = map(int, input().split())
    ## これで通った
    # num1 = b - calc(b,c,d)
    # num2 = (a-1) - calc(a-1, c,d)
    # print(num1-num2)

    ## これはとおらない
    ans = calc(b, c, d) - calc(a - 1, c, d)
    print(b - a + 1 - ans)