Buggy python submission (verdict: Runtime Error):
from sys import stdin
import math


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()]

    C_D_lcm = lcm(C, D)

    z = B//C_D_lcm - A//C_D_lcm

    if A % C == 0:
        x = (B//C)+1 - (A//C)
    else:
        x = (B//C) - A//C

    y = B//D - A//D

    print((B-A+1)-(x+y-z))


if __name__ == "__main__":
    main()


Fixed submission:
from sys import stdin
import fractions


def main():
    A, B, C, D = [int(x) for x in stdin.readline().rstrip().split()]

    C_D = (C * D) // fractions.gcd(C, D)

    z = B//C_D - A//C_D

    if A % C == 0:
        x = (B//C) - (A//C) + 1
    else:
        x = (B//C) - (A//C)

    y = B//D - A//D

    print((B-A+1)-(x+y-z))


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
from sys import stdin
import math


def main():
    A, B, C, D = [int(x) for x in stdin.readline().rstrip().split()]

    C_D = (C * D) // math.gcd(C, D)

    z = B//C_D - A//C_D

    # if A % C == 0:
    #     x = (B//C) - (A//C) + 1
    # else:
    #     x = (B//C) - (A//C)

    # y = B//D - A//D

    # print((B-A+1)-(x+y-z))

    print(A, B, C, D)


if __name__ == "__main__":
    main()


Fixed submission:
from sys import stdin
import fractions


def main():
    A, B, C, D = [int(x) for x in stdin.readline().rstrip().split()]

    C_D = (C * D) // fractions.gcd(C, D)

    z = B//C_D - A//C_D

    if A % C == 0:
        x = (B//C) - (A//C) + 1
    else:
        x = (B//C) - (A//C)

    y = B//D - A//D

    print((B-A+1)-(x+y-z))


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
from sys import stdin
import math


def main():
    A, B, C, D = [int(x) for x in stdin.readline().rstrip().split()]

    C_D = (C * D) // math.gcd(C, D)

    z = B//C_D - A//C_D

    if A % C == 0:
        x = (B//C) - (A//C) + 1
    else:
        x = (B//C) - (A//C)

    y = B//D - A//D

    print((B-A+1)-(x+y-z))


if __name__ == "__main__":
    main()


Fixed submission:
from sys import stdin
import fractions


def main():
    A, B, C, D = [int(x) for x in stdin.readline().rstrip().split()]

    C_D = (C * D) // fractions.gcd(C, D)

    z = B//C_D - A//C_D

    if A % C == 0:
        x = (B//C) - (A//C) + 1
    else:
        x = (B//C) - (A//C)

    y = B//D - A//D

    print((B-A+1)-(x+y-z))


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
from sys import stdin
import math


def main():
    A, B, C, D = [int(x) for x in stdin.readline().rstrip().split()]

    C_D = (C * D) // math.gcd(C, D)

    z = B//C_D - A//C_D

    if A % C == 0:
        x = (B//C)+1 - (A//C)
    else:
        x = (B//C) - A//C

    y = B//D - A//D

    # print(x, y, z)

    print((B-A+1)-(x+y-z))


if __name__ == "__main__":
    main()


Fixed submission:
from sys import stdin
import fractions


def main():
    A, B, C, D = [int(x) for x in stdin.readline().rstrip().split()]

    C_D = (C * D) // fractions.gcd(C, D)

    z = B//C_D - A//C_D

    if A % C == 0:
        x = (B//C) - (A//C) + 1
    else:
        x = (B//C) - (A//C)

    y = B//D - A//D

    print((B-A+1)-(x+y-z))


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
from sys import stdin
import math


def main():
    A, B, C, D = [int(x) for x in stdin.readline().rstrip().split()]

    C_D_gcd = (C * D) // math.gcd(C, D)

    z = B//C_D_gcd - A//C_D_gcd

    if A % C == 0:
        x = (B//C)+1 - (A//C)
    else:
        x = (B//C) - A//C

    y = B//D - A//D

    # print(x, y, z)

    print((B-A+1)-(x+y-z))


if __name__ == "__main__":
    main()


Fixed submission:
from sys import stdin
import fractions


def main():
    A, B, C, D = [int(x) for x in stdin.readline().rstrip().split()]

    C_D = (C * D) // fractions.gcd(C, D)

    z = B//C_D - A//C_D

    if A % C == 0:
        x = (B//C) - (A//C) + 1
    else:
        x = (B//C) - (A//C)

    y = B//D - A//D

    print((B-A+1)-(x+y-z))


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
from sys import stdin
import math


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()]

    C_D_gcd = lcm(C, D)

    z = B//C_D_gcd - A//C_D_gcd

    if A % C == 0:
        x = (B//C)+1 - (A//C)
    else:
        x = (B//C) - A//C

    y = B//D - A//D

    # print(x, y, z)

    print((B-A+1)-(x+y-z))


if __name__ == "__main__":
    main()


Fixed submission:
from sys import stdin
import fractions


def main():
    A, B, C, D = [int(x) for x in stdin.readline().rstrip().split()]

    C_D = (C * D) // fractions.gcd(C, D)

    z = B//C_D - A//C_D

    if A % C == 0:
        x = (B//C) - (A//C) + 1
    else:
        x = (B//C) - (A//C)

    y = B//D - A//D

    print((B-A+1)-(x+y-z))


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
from sys import stdin
import math


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()]

    C_D_gcd = lcm(C, D)

    z = B//C_D_gcd - A//C_D_gcd

    if A % C == 0:
        x = (B//C)+1 - (A//C)
    else:
        x = (B//C) - A//C

    y = B//D - A//D

    # print(x, y, z)

    print((B-A+1)-(x+y-z))


if __name__ == "__main__":
    main()


Fixed submission:
from sys import stdin
import fractions


def main():
    A, B, C, D = [int(x) for x in stdin.readline().rstrip().split()]

    C_D = (C * D) // fractions.gcd(C, D)

    z = B//C_D - A//C_D

    if A % C == 0:
        x = (B//C) - (A//C) + 1
    else:
        x = (B//C) - (A//C)

    y = B//D - A//D

    print((B-A+1)-(x+y-z))


if __name__ == "__main__":
    main()