Problem p02995 (python)

Fixed submission:
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
A,B,C,D = input().split()
A = int(A)-1
s = lcm(int(C),int(D))
#s = int(C)*int(D)
#numac = int(A)//int(C)#10//6 = 1
#numad = int(A)//int(D)#10//8 = 1
#numacd = int(A)//s#10//24 = 0
numa = int(A)//int(C) + int(A)//int(D) - int(A)//s
#numa = 1
#numbc = int(B)//int(C)#40//6 = 6
#numbd = int(B)//int(D)#40//8 = 5
#numbcd = int(B)//s#40//24= 1
numb = int(B)//int(C) + int(B)//int(D) - int(B)//s
#numb = 1
print(int(B)-int(A)-(numb - numa))

Buggy submission (verdict: Runtime Error):
import fractions

def lcm(x, y):
    return (x * y) // math.gcd(x, y)
A,B,C,D = input().split()
A = int(A)-1
s = fractions.lcm(int(C),int(D))
#s = int(C)*int(D)
#numac = int(A)//int(C)#10//6 = 1
#numad = int(A)//int(D)#10//8 = 1
#numacd = int(A)//s#10//24 = 0
numa = int(A)//int(C) + int(A)//int(D) - int(A)//s
#numa = 1
#numbc = int(B)//int(C)#40//6 = 6
#numbd = int(B)//int(D)#40//8 = 5
#numbcd = int(B)//s#40//24= 1
numb = int(B)//int(C) + int(B)//int(D) - int(B)//s
#numb = 1
print(int(B)-int(A)-(numb - numa))

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

def lcm(x, y):
    return (x * y) // math.gcd(x, y)
A,B,C,D = input().split()
A = int(A)-1
s = lcm(int(C),int(D))
#s = int(C)*int(D)
#numac = int(A)//int(C)#10//6 = 1
#numad = int(A)//int(D)#10//8 = 1
#numacd = int(A)//s#10//24 = 0
numa = int(A)//int(C) + int(A)//int(D) - int(A)//s
#numa = 1
#numbc = int(B)//int(C)#40//6 = 6
#numbd = int(B)//int(D)#40//8 = 5
#numbcd = int(B)//s#40//24= 1
numb = int(B)//int(C) + int(B)//int(D) - int(B)//s
#numb = 1
print(int(B)-int(A)-(numb - numa))

Buggy submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
A,B,C,D = input().split()
A = int(A)-1
s = lcm(int(C),int(D))
numac = int(A)//int(C)#10//6 = 1
numad = int(A)//int(D)#10//8 = 1
numacd = int(A)//s#10//24 = 0
numbc = int(B)//int(C)#40//6 = 6
numbd = int(B)//int(D)#40//8 = 5
numbcd = int(B)//s#40//24= 1
print(int(B)-int(A)-(numbc+numbd-numbcd -(numac+numad-numacd)))

Buggy submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
A,B,C,D = input().split()
A = int(A)-1
numac = int(A)//int(C)#10//6 = 1
numad = int(A)//int(D)#10//8 = 1
numacd = int(A)//(lcm(int(C),int(D)))#10//24 = 0
numbc = int(B)//int(C)#40//6 = 6
numbd = int(B)//int(D)#40//8 = 5
numbcd = int(B)//lcm(int(C),int(D))#40//24= 1
#print(numbc+numbd-numbcd )
#print(numac+numad-numacd)
#print(numbc+numbd-numbcd -(numac+numad-numacd))
t = numbc+numbd-numbcd -(numac+numad-numacd)
print(int(B)-int(A)-(numbc+numbd-numbcd -(numac+numad-numacd)))

Buggy submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
A,B,C,D = input().split()
A = int(A)-1
numac = int(A)//int(C)#10//6 = 1
numad = int(A)//int(D)#10//8 = 1
numacd = int(A)//(lcm(int(C),int(D)))#10//24 = 0
numbc = int(B)//int(C)#40//6 = 6
numbd = int(B)//int(D)#40//8 = 5
numbcd = int(B)//lcm(int(C),int(D))#40//24= 1
#print(numbc+numbd-numbcd )
#print(numac+numad-numacd)
#print(numbc+numbd-numbcd -(numac+numad-numacd))
t = numbc+numbd-numbcd -(numac+numad-numacd)
print(int(B)-int(A)-(numbc+numbd-numbcd -(numac+numad-numacd)))

Buggy submission (verdict: Runtime Error):
A,B,C,D = input().split()
count = 0
start = int(A)
finish = int(B)
ite = 100
for i in range(ite):
  if i == ite-1:
    nums = list(range(start *i, finish ))
  else:
    nums = list(range(start *i, start*(i+1) ))
  tmp = [x for x in nums if not x%int(C) == 0 and not x%int(D) == 0]
  count += len(tmp)
print(count)

Buggy submission (verdict: Runtime Error):
A,B,C,D = input().split()
count = 0
start = int(A)
finish = int(B)
ite = finish//start
for i in range(ite):
  if i == ite-1:
    nums = list(range(start *i, finish ))
  else:
    nums = list(range(start *i, start*(i+1) ))
  tmp = [x for x in nums if not x%int(C) == 0 and not x%int(D) == 0]
  count += len(tmp)
print(count)

Buggy submission (verdict: Runtime Error):
A,B,C,D = input().split()
count = 0
start = int(A)
finish = int(B)
ite = finish//start
for i in range(ite):
  if i == ite-1:
    nums = list(range(start *i, finish ))
  else:
    nums = list(range(start *i, start*(i+1) ))
  tmp = [x for x in nums if not x%int(C) == 0 and not x%int(D) == 0]
  count += len(tmp)
print(count)

Buggy submission (verdict: Runtime Error):
A,B,C,D = input().split()
count = 0
start = int(A)
finish = int(B)
ite = 100
for i in range(ite):
  if i == ite-1:
    nums = list(range(start *i, finish ))
  else:
    nums = list(range(start *i, start*(i+1) ))
  tmp = [x for x in nums if not x%int(C) == 0 and not x%int(D) == 0]
  count += len(tmp)
print(count)

Buggy submission (verdict: Runtime Error):
A,B,C,D = input().split()
count = 0
start = int(A)
finish = int(B)
ite = 100
for i in range(ite):
  if i == ite-1:
    nums = list(range(start *i, finish ))
    else:
      nums = list(range(start *i, start*(i+1) ))
  tmp = [x for x in nums if not x%int(C) == 0 and not x%int(D) == 0]
  count += len(tmp)
print(count)

Buggy submission (verdict: Runtime Error):
A,B,C,D = input().split()
count = 0
start = int(A)
finish = int(B)
ite = 10000000000
for i in range(ite):
  if i == ite-1:
    nums = list(range(start *i, finish ))
    else:
      nums = list(range(start *i, start*(i+1) ))
  tmp = [x for x in nums if not x%int(C) == 0 and not x%int(D) == 0]
  count += len(tmp)
print(count)

Buggy submission (verdict: Runtime Error):
A,B,C,D = input().split()
count = 0
start = int(A)
finish = int(B)
ite = finish/start
for i in range(ite):
	if i == ite-1:
      nums = list(range(start *i, finish ))
    else:
	  nums = list(range(start *i, start*(i+1) ))
	tmp = [x for x in nums if not x%int(C) == 0 and not x%int(D) == 0]
    count += len(tmp)
print(count)

Buggy submission (verdict: Runtime Error):
A,B,C,D = input().split()
nums = list(range(int(A), int(B)+1))
tmp = [x for x in nums if not x%int(C) == 0 and not x%int(D) == 0]
print(len(tmp))