Buggy python submission (verdict: Runtime Error):
def main():
	import math
	a,b,c,d = map(int,input().split())
	ans = 0
	
	e = int((c*d) / math.gcd(c,d))

	i = int(b/c)
	t = int(b/d)
	l = int(b/e)

	while a <= i * c <= b:
		ans += 1
		i -= 1

	while a <= t * d <= b:
		ans += 1
		t -= 1
	
	while a <= l * e <= b:
		ans -= 1
		l -= 1

	print(int(len(range(a,b+1)))-ans)

if __name__ == "__main__":
	main()

Fixed submission:
def main():
	a,b,c,d = map(int,input().split())

	#about c
	ans_c_a = (a-1)//c
	ans_c_b = b//c
	# print(ans_c_b)
	ans_c = ans_c_b - ans_c_a
	# print("ans_c = {}".format(ans_c))

	#about d
	ans_d_a = (a-1)//d
	ans_d_b = b//d
	ans_d = ans_d_b - ans_d_a
	# print("ans_d = {}".format(ans_d))

	#aboud c*d
	import fractions
	saisyou = (c * d) // fractions.gcd(c,d)
	# print(saisyou)
	ans_saisyou_a = (a-1)//saisyou
	ans_saisyou_b = b//saisyou
	ans_saisyou = ans_saisyou_b - ans_saisyou_a
	# print("ans_saisyou = {}".format(ans_saisyou))

	print(int( b-a+1 - (ans_c + ans_d - ans_saisyou) ))


if __name__ == '__main__':
	main()

Buggy python submission (verdict: Runtime Error):
def main():
	import math
	a,b,c,d = map(int,input().split())
	ans = 0
	
	e = (c*d) / math.gcd(c,d)

	i = int(b/c)
	t = int(b/d)
	l = int(b/e)

	while a <= i * c <= b:
		ans += 1
		i -= 1

	while a <= t * d <= b:
		ans += 1
		t -= 1
	
	while a <= l * e <= b:
		ans -= 1
		l -= 1

	print(int(len(range(a,b+1)))-ans)

if __name__ == "__main__":
	main()

Fixed submission:
def main():
	a,b,c,d = map(int,input().split())

	#about c
	ans_c_a = (a-1)//c
	ans_c_b = b//c
	# print(ans_c_b)
	ans_c = ans_c_b - ans_c_a
	# print("ans_c = {}".format(ans_c))

	#about d
	ans_d_a = (a-1)//d
	ans_d_b = b//d
	ans_d = ans_d_b - ans_d_a
	# print("ans_d = {}".format(ans_d))

	#aboud c*d
	import fractions
	saisyou = (c * d) // fractions.gcd(c,d)
	# print(saisyou)
	ans_saisyou_a = (a-1)//saisyou
	ans_saisyou_b = b//saisyou
	ans_saisyou = ans_saisyou_b - ans_saisyou_a
	# print("ans_saisyou = {}".format(ans_saisyou))

	print(int( b-a+1 - (ans_c + ans_d - ans_saisyou) ))


if __name__ == '__main__':
	main()

Buggy python submission (verdict: Runtime Error):
def main():
	import math
	a,b,c,d = map(int,input().split())
	ans = 0
	
	e = (c*d) /math.gcd(c,d)
	# print(e)

	i = int(b/c)
	t = int(b/d)
	l = int(b/e)
	# print(i,t)
	# ans_set = set()

	while a <= i * c <= b:
		# print("i*c= {}".format(i*c))
		# ans_set.add(i*c)
		ans += 1
		i -= 1

	while a <= t * d <= b:
		# print("i*d= {}".format(t*d))
		# ans_set.add(t*d)
		ans += 1
		t -= 1
	# print(ans_set)
	
	while a <= l * e <= b:
		# print("l*c*d= {}".format(l*c*d))
		# ans_set.add(l*c*d)
		ans -= 1
		l -= 1

	print(int(len(range(a,b+1)))-ans)
	# print(int(len(range(a,b+1)))-len(ans_set))

if __name__ == "__main__":
	main()

Fixed submission:
def main():
	a,b,c,d = map(int,input().split())

	#about c
	ans_c_a = (a-1)//c
	ans_c_b = b//c
	# print(ans_c_b)
	ans_c = ans_c_b - ans_c_a
	# print("ans_c = {}".format(ans_c))

	#about d
	ans_d_a = (a-1)//d
	ans_d_b = b//d
	ans_d = ans_d_b - ans_d_a
	# print("ans_d = {}".format(ans_d))

	#aboud c*d
	import fractions
	saisyou = (c * d) // fractions.gcd(c,d)
	# print(saisyou)
	ans_saisyou_a = (a-1)//saisyou
	ans_saisyou_b = b//saisyou
	ans_saisyou = ans_saisyou_b - ans_saisyou_a
	# print("ans_saisyou = {}".format(ans_saisyou))

	print(int( b-a+1 - (ans_c + ans_d - ans_saisyou) ))


if __name__ == '__main__':
	main()

Buggy python submission (verdict: Runtime Error):
def main():
	import math
	a,b,c,d = map(int,input().split())
	ans = 0
	
	e = (c*d) /math.gcd(c,d)
	# print(e)

	i = int(b/c)
	t = int(b/d)
	l = int(b/e)
	# print(i,t)
	# ans_set = set()

	while a <= i * c <= b:
		# print("i*c= {}".format(i*c))
		# ans_set.add(i*c)
		ans += 1
		i -= 1

	while a <= t * d <= b:
		# print("i*d= {}".format(t*d))
		# ans_set.add(t*d)
		ans += 1
		t -= 1
	# print(ans_set)
	
	while a <= l * e <= b:
		# print("l*c*d= {}".format(l*c*d))
		# ans_set.add(l*c*d)
		ans -= 1
		l -= 1

	print(int(len(range(a,b+1)))-ans)
	# print(int(len(range(a,b+1)))-len(ans_set))

if __name__ == "__main__":
	main()

Fixed submission:
def main():
	a,b,c,d = map(int,input().split())

	#about c
	ans_c_a = (a-1)//c
	ans_c_b = b//c
	# print(ans_c_b)
	ans_c = ans_c_b - ans_c_a
	# print("ans_c = {}".format(ans_c))

	#about d
	ans_d_a = (a-1)//d
	ans_d_b = b//d
	ans_d = ans_d_b - ans_d_a
	# print("ans_d = {}".format(ans_d))

	#aboud c*d
	import fractions
	saisyou = (c * d) // fractions.gcd(c,d)
	# print(saisyou)
	ans_saisyou_a = (a-1)//saisyou
	ans_saisyou_b = b//saisyou
	ans_saisyou = ans_saisyou_b - ans_saisyou_a
	# print("ans_saisyou = {}".format(ans_saisyou))

	print(int( b-a+1 - (ans_c + ans_d - ans_saisyou) ))


if __name__ == '__main__':
	main()

Buggy python submission (verdict: Runtime Error):
def main():
	import math
	a,b,c,d = map(int,input().split())
	ans = 0
	
	e = c*d//math.gcd(c,d)
	# print(e)

	i = int(b/c)
	t = int(b/d)
	l = int(b/e)
	# print(i,t)
	# ans_set = set()

	while a <= i * c <= b:
		# print("i*c= {}".format(i*c))
		# ans_set.add(i*c)
		ans += 1
		i -= 1

	while a <= t * d <= b:
		# print("i*d= {}".format(t*d))
		# ans_set.add(t*d)
		ans += 1
		t -= 1
	# print(ans_set)
	
	while a <= l * e <= b:
		# print("l*c*d= {}".format(l*c*d))
		# ans_set.add(l*c*d)
		ans -= 1
		l -= 1

	print(int(len(range(a,b+1)))-ans)
	# print(int(len(range(a,b+1)))-len(ans_set))

if __name__ == "__main__":
	main()

Fixed submission:
def main():
	a,b,c,d = map(int,input().split())

	#about c
	ans_c_a = (a-1)//c
	ans_c_b = b//c
	# print(ans_c_b)
	ans_c = ans_c_b - ans_c_a
	# print("ans_c = {}".format(ans_c))

	#about d
	ans_d_a = (a-1)//d
	ans_d_b = b//d
	ans_d = ans_d_b - ans_d_a
	# print("ans_d = {}".format(ans_d))

	#aboud c*d
	import fractions
	saisyou = (c * d) // fractions.gcd(c,d)
	# print(saisyou)
	ans_saisyou_a = (a-1)//saisyou
	ans_saisyou_b = b//saisyou
	ans_saisyou = ans_saisyou_b - ans_saisyou_a
	# print("ans_saisyou = {}".format(ans_saisyou))

	print(int( b-a+1 - (ans_c + ans_d - ans_saisyou) ))


if __name__ == '__main__':
	main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
	a,b,c,d = map(int,input().split())
	ans = 0
	i = int(a/c)
	t = int(a/d)
	while i*c < a:
		i += 1
	while t*d < a:
		t += 1
	ans_set = set()

	while a <= i * c <= b:
		ans_set.add(i*c)
		i += 1

	while a <= t * d <= b:
		ans_set.add(t*d)
		t += 1
	print(int(len(range(a,b+1)))-len(ans_set))

if __name__ == "__main__":
	main()

Fixed submission:
def main():
	a,b,c,d = map(int,input().split())

	#about c
	ans_c_a = (a-1)//c
	ans_c_b = b//c
	# print(ans_c_b)
	ans_c = ans_c_b - ans_c_a
	# print("ans_c = {}".format(ans_c))

	#about d
	ans_d_a = (a-1)//d
	ans_d_b = b//d
	ans_d = ans_d_b - ans_d_a
	# print("ans_d = {}".format(ans_d))

	#aboud c*d
	import fractions
	saisyou = (c * d) // fractions.gcd(c,d)
	# print(saisyou)
	ans_saisyou_a = (a-1)//saisyou
	ans_saisyou_b = b//saisyou
	ans_saisyou = ans_saisyou_b - ans_saisyou_a
	# print("ans_saisyou = {}".format(ans_saisyou))

	print(int( b-a+1 - (ans_c + ans_d - ans_saisyou) ))


if __name__ == '__main__':
	main()