Problem p02995 (python)

Fixed submission:

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

 #最小公倍数


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


S = input().split()
A = int(S[0])
B = int(S[1])
C = int(S[2])
D = int(S[3])

E = lcm(C, D)

X = int(B//C)-int((A-1)//C)
Y = int(B//D)-int((A-1)//D)
Z = int(B//E)-int((A-1)//E)

print(B-A+1-X-Y+Z)

Buggy submission (verdict: Runtime Error):
S = input().split()
A = int(S[0])
B = int(S[1])
C = int(S[2])
D = int(S[3])

E = int((C * D) / math.gcd(C, D))

X = int(B/C)-int((A-1)/C)
Y = int(B/D)-int((A-1)/D)
Z = int(B/E)-int((A-1)/E)

print(B-A+1-X-Y+Z)

Buggy submission (verdict: Runtime Error):
S = input().split()
A = int(S[0])
B = int(S[1])
C = int(S[2])
D = int(S[3])

E = int((C * D) / math.gcd(C, D))

X = int(B/C)-int((A-1)/C)
Y = int(B/D)-int((A-1)/D)
Z = int(B/E)-int((A-1)/E)

print(B-A+1-X-Y+Z)

Buggy submission (verdict: Runtime Error):

import math

S = input().split()
A = int(S[0])
B = int(S[1])
C = int(S[2])
D = int(S[3])

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

X = (B//C)-((A-1)//C)
Y = (B//D)-((A-1)//D)
Z = (B//E)-((A-1)//E)

print(B-A+1-X-Y+Z)

Buggy submission (verdict: Runtime Error):

import math

S = input().split()
A = int(S[0])
B = int(S[1])
C = int(S[2])
D = int(S[3])

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

X = (B//C)-((A-1)//C)
Y = (B//D)-((A-1)//D)
Z = (B//E)-((A-1)//E)

print(B-A+1-X-Y+Z)

Buggy submission (verdict: Runtime Error):

import math

S = input().split()
A = int(S[0])
B = int(S[1])
C = int(S[2])
D = int(S[3])

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

X = (B//C)-((A-1)//C)
Y = (B//D)-((A-1)//D)
Z = (B//E)-((A-1)//E)

print(B-A+1-X-Y+Z)

Buggy submission (verdict: Runtime Error):

import math

S = input().split()
A = int(S[0])
B = int(S[1])
C = int(S[2])
D = int(S[3])

E = int((C * D) / math.gcd(C, D))

X = (B//C)-((A-1)//C)
Y = (B//D)-((A-1)//D)
Z = (B//E)-((A-1)//E)

print(int(B-A+1-X-Y+Z))

Buggy submission (verdict: Runtime Error):
import math

S = input().split()
A = int(S[0])
B = int(S[1])
C = int(S[2])
D = int(S[3])

E = int((C * D) / math.gcd(C, D))

X = (B//C)-(A-1//C)
Y = (B//D)-(A-1//D)
Z = (B//(E))-(A-1//(E))

print(int(B-A+1-X-Y+Z))

Buggy submission (verdict: Runtime Error):
import sys
import collections
import copy
import math

S = input().split()
A = float(S[0])
B = float(S[1])
C = float(S[2])
D = float(S[3])

E = (C * D) / math.gcd(C, D)
X = math.floor(B/C) - math.floor(A/C)
Y = math.floor(B/D) - math.floor(A/D)
Z = math.floor(B/E) - math.floor(A/E)

print(int(B-A-X-Y+Z))

Buggy submission (verdict: Runtime Error):
import math

S = input().split()
A = int(S[0])
B = int(S[1])
C = int(S[2])
D = int(S[3])

E = (C * D) / math.gcd(C, D)
X = math.floor(B/C) - math.floor(A/C)
Y = math.floor(B/D) - math.floor(A/D)
Z = math.floor(B/E) - math.floor(A/E)

print(int(B-A-X-Y+Z))

Buggy submission (verdict: Runtime Error):

import math

S = input().split()
A = int(S[0])
B = int(S[1])
C = int(S[2])
D = int(S[3])

E = int((C * D) / math.gcd(C, D))
X = math.floor(B/C) - math.floor(A/C)
Y = math.floor(B/D) - math.floor(A/D)
Z = math.floor(B/E) - math.floor(A/E)

print(int(B-A-X-Y+Z))

Buggy submission (verdict: Runtime Error):

import math

S = input().split()
A = int(S[0])
B = int(S[1])
C = int(S[2])
D = int(S[3])

E = int((C * D) / math.gcd(C, D))
X = (B//C)-(A//C)
Y = (B//D)-(A//D)
Z = (B//E)-(A//E)+1

print(int(B-A-X-Y+Z))

Buggy submission (verdict: Runtime Error):
import math

S = input().split()
A = int(S[0])
B = int(S[1])
C = int(S[2])
D = int(S[3])

E = int((C * D) / math.gcd(C, D))
X = (B//C)-(A//C)
Y = (B//D)-(A//D)
Z = (B//E)-(A//E)

print(int(B-A-X-Y+Z))

Buggy submission (verdict: Runtime Error):

import math

S = input().split()
A = int(S[0])
B = int(S[1])
C = int(S[2])
D = int(S[3])

E = C * D / math.gcd(C, D)
X = (B//C)-(A//C)
Y = (B//D)-(A//D)
Z = (B//(E))-(A//(E))+1

print(int(B-A-X-Y+Z))

Buggy submission (verdict: Runtime Error):
import math

S = input().split()
A = int(S[0])
B = int(S[1])
C = int(S[2])
D = int(S[3])

CD = C * D / math.gcd(C, D)
X = (B//C)-(A//C)
Y = (B//D)-(A//D)
Z = (B//(CD))-(A//(CD))+1

print(B-A-X-Y+Z)