Buggy python submission (verdict: Runtime Error):
import math
A,B,C,D = map(int, input().split())

A = A-1
c_and_d=C*D
#CとDの最小公倍数を求める
lcm = int(C*D/math.gcd(C,D))
# print('最小公倍数:',lcm)

count_C =0
count_D =0
count_C_and_D =0

count_C = int(B/C)-int(A/C)
count_D = int(B/D)-int(A/D)
count_C_and_D = int(B/lcm)-int(A/lcm)
A = A+1
print((B-A+1) -(count_C + count_D - count_C_and_D))

Fixed submission:
import fractions

A,B,C,D = map(int, input().split())


c_and_d=C*D
#CとDの最小公倍数を求める
lcm = int(C*D//fractions.gcd(C,D))


count_C =0
count_D =0
count_C_and_D =0

count_C = int(B//C)-int((A-1)//C)
count_D = int(B//D)-int((A-1)//D)
count_C_and_D = int(B//lcm)-int((A-1)//lcm)

print(int((B-A+1) -(count_C + count_D - count_C_and_D)))

Buggy python submission (verdict: Runtime Error):
import math
A,B,C,D = map(int, input().split())

A = A-1
c_and_d=C*D
#CとDの最小公倍数を求める
lcm = int(C*D/math.gcd(C,D))
# print('最小公倍数:',lcm)

count_C =0
count_D =0
count_C_and_D =0

count_C = int(B/C)-int(A/C)
count_D = int(B/D)-int(A/D)
count_C_and_D = int(B/lcm)-int(A/lcm)
A = A+1
# print(A,B,count_C , count_D , count_C_and_D)
print((B-A+1) -(count_C + count_D - count_C_and_D))

Fixed submission:
import fractions

A,B,C,D = map(int, input().split())


c_and_d=C*D
#CとDの最小公倍数を求める
lcm = int(C*D//fractions.gcd(C,D))


count_C =0
count_D =0
count_C_and_D =0

count_C = int(B//C)-int((A-1)//C)
count_D = int(B//D)-int((A-1)//D)
count_C_and_D = int(B//lcm)-int((A-1)//lcm)

print(int((B-A+1) -(count_C + count_D - count_C_and_D)))

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin


class C:
	def __init__(self,A,B,C,D):
		self.A = int(A)
		self.B = int(B)
		self.C = int(C)
		self.D = int(D)
		self.ans_list = list()
	def main(self):
		for i in range(self.A,self.B+1):
			if i % self.C != 0:
				if  i % self.D != 0:
					self.ans_list.append(i)

		print(len(self.ans_list))


Inp = stdin.readline()
Inp = Inp.replace('\n','')
Inp = Inp.split()

do = C(Inp[0],Inp[1],Inp[2],Inp[3])

do.main()


Fixed submission:
import fractions

A,B,C,D = map(int, input().split())


c_and_d=C*D
#CとDの最小公倍数を求める
lcm = int(C*D//fractions.gcd(C,D))


count_C =0
count_D =0
count_C_and_D =0

count_C = int(B//C)-int((A-1)//C)
count_D = int(B//D)-int((A-1)//D)
count_C_and_D = int(B//lcm)-int((A-1)//lcm)

print(int((B-A+1) -(count_C + count_D - count_C_and_D)))

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


class C:
	def __init__(self,A,B,C,D):
		self.A = int(A)
		self.B = int(B)
		self.C = int(C)
		self.D = int(D)
		self.list = list(range(self.A,self.B+1)) #リストの生成
		self.ans_list = list()
	def main(self):
		for i in range(self.A,self.B+1):
			if i % self.C != 0:
				if  i % self.D != 0:
					self.ans_list.append(i)

		print(len(self.ans_list))








Inp = stdin.readline()
Inp = Inp.replace('\n','')
Inp = Inp.split()

do = C(Inp[0],Inp[1],Inp[2],Inp[3])

do.main()


Fixed submission:
import fractions

A,B,C,D = map(int, input().split())


c_and_d=C*D
#CとDの最小公倍数を求める
lcm = int(C*D//fractions.gcd(C,D))


count_C =0
count_D =0
count_C_and_D =0

count_C = int(B//C)-int((A-1)//C)
count_D = int(B//D)-int((A-1)//D)
count_C_and_D = int(B//lcm)-int((A-1)//lcm)

print(int((B-A+1) -(count_C + count_D - count_C_and_D)))