Buggy python submission (verdict: Runtime Error):


A,B,C,D=[int(x) for x in input().rstrip().split()]
cnt=0

import math

def lcm(x, y):
  if x!=0 and y!=0:
    return (x * y) // math.gcd(x, y)
  else:
    return 0

    
baisuu=lcm(C,D)

u_A=(A-1)-(A-1)//C-(A-1)//D+(A-1)//baisuu

u_B=B-B//C-B//D+B//baisuu

print(u_B-u_A)

Fixed submission:
import fractions
from functools import reduce

A,B,C,D=[int(x) for x in input().rstrip().split()]
cnt=0

import math

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

    
baisuu=lcm(C,D)

u_A=(A-1)-(A-1)//C-(A-1)//D+(A-1)//baisuu

u_B=B-B//C-B//D+B//baisuu

print(u_B-u_A)

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

A,B,C,D=[int(x) for x in input().rstrip().split()]
cnt=0


def lcm(x, y):
  if x!=0 and y!=0:
    return (x * y) // math.gcd(x, y)
  else:
    return 0

    
baisuu=lcm(C,D)

u_A=(A-1)-(A-1)//C-(A-1)//D+(A-1)//baisuu

u_B=B-B//C-B//D+B//baisuu

print(u_B-u_A)

Fixed submission:
import fractions
from functools import reduce

A,B,C,D=[int(x) for x in input().rstrip().split()]
cnt=0

import math

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

    
baisuu=lcm(C,D)

u_A=(A-1)-(A-1)//C-(A-1)//D+(A-1)//baisuu

u_B=B-B//C-B//D+B//baisuu

print(u_B-u_A)

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

A,B,C,D=[int(x) for x in input().rstrip().split()]
cnt=0


def lcm(x, y):
  if x!=0 and y!=0:
    return (x * y) // math.gcd(x, y)
  else:
    return 0

    
baisuu=lcm(C,D)
yakusuu=math.gcd(C,D)

u_A=(A-1)-(A-1)//C-(A-1)//D+(A-1)//baisuu

u_B=B-B//C-B//D+B//baisuu

print(u_B-u_A)

Fixed submission:
import fractions
from functools import reduce

A,B,C,D=[int(x) for x in input().rstrip().split()]
cnt=0

import math

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

    
baisuu=lcm(C,D)

u_A=(A-1)-(A-1)//C-(A-1)//D+(A-1)//baisuu

u_B=B-B//C-B//D+B//baisuu

print(u_B-u_A)

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

A,B,C,D=[int(x) for x in input().rstrip().split()]
cnt=0


def lcm(x, y):
    return (x * y) // math.gcd(x, y)

    
baisuu=lcm(C,D)
yakusuu=math.gcd(C,D)

u_A=(A-1)-(A-1)//C-(A-1)//D+(A-1)//baisuu

u_B=B-B//C-B//D+B//baisuu

print(u_B-u_A)

Fixed submission:
import fractions
from functools import reduce

A,B,C,D=[int(x) for x in input().rstrip().split()]
cnt=0

import math

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

    
baisuu=lcm(C,D)

u_A=(A-1)-(A-1)//C-(A-1)//D+(A-1)//baisuu

u_B=B-B//C-B//D+B//baisuu

print(u_B-u_A)

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

A,B,C,D=[int(x) for x in input().rstrip().split()]
cnt=0
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
baisuu=lcm(C,D)
yakusuu=math.gcd(C,D)

u_A=(A-1)-(A-1)//C-(A-1)//D+(A-1)//baisuu


u_B=B-B//C-B//D+B//baisuu
# for i in range(A,baisuu):
#   if i%C!=0 and i%D!=0:
#     cnt+=1

print(u_B-u_A)

Fixed submission:
import fractions
from functools import reduce

A,B,C,D=[int(x) for x in input().rstrip().split()]
cnt=0

import math

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

    
baisuu=lcm(C,D)

u_A=(A-1)-(A-1)//C-(A-1)//D+(A-1)//baisuu

u_B=B-B//C-B//D+B//baisuu

print(u_B-u_A)

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

A,B,C,D=[int(x) for x in input().rstrip().split()]
cnt=0
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
baisuu=lcm(C,D)
yakusuu=math.gcd(C,D)

u_A=(A-1)-(A-1)//C-(A-1)//D+(A-1)//baisuu


u_B=B-B//C-B//D+B//baisuu
# for i in range(A,baisuu):
#   if i%C!=0 and i%D!=0:
#     cnt+=1

print(u_B-u_A)


Fixed submission:
import fractions
from functools import reduce

A,B,C,D=[int(x) for x in input().rstrip().split()]
cnt=0

import math

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

    
baisuu=lcm(C,D)

u_A=(A-1)-(A-1)//C-(A-1)//D+(A-1)//baisuu

u_B=B-B//C-B//D+B//baisuu

print(u_B-u_A)

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

A,B,C,D=[int(x) for x in input().rstrip().split()]
cnt=0
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
baisuu=lcm(C,D)
yakusuu=math.gcd(C,D)

u_A=(A-1)-(A-1)//C-(A-1)//D+(A-1)//baisuu


u_B=B-B//C-B//D+B//baisuu
# for i in range(A,baisuu):
#   if i%C!=0 and i%D!=0:
#     cnt+=1

print(u_B-u_A)


Fixed submission:
import fractions
from functools import reduce

A,B,C,D=[int(x) for x in input().rstrip().split()]
cnt=0

import math

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

    
baisuu=lcm(C,D)

u_A=(A-1)-(A-1)//C-(A-1)//D+(A-1)//baisuu

u_B=B-B//C-B//D+B//baisuu

print(u_B-u_A)