Problem:


Score : 300 points

Problem Statement

You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.

Constraints

1\leq A\leq B\leq 10^{18}

1\leq C,D\leq 10^9

All values in input are integers.

Input

Input is given from Standard Input in the following format:

A B C D

Output

Print the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.

Sample Input 1

4 9 2 3

Sample Output 1

2

5 and 7 satisfy the condition.

Sample Input 2

10 40 6 8

Sample Output 2

23

Sample Input 3

314159265358979323 846264338327950288 419716939 937510582

Sample Output 3

532105071133627368



Sample input:
4 9 2 3


Sample output:
2

Submission status: Time Limit Exceeded

Solution code:
a , b , c , d = map(int,input().split())
cnt = 0

for i in range(a , b+1):
    if i % c != 0 and i % d != 0:
        cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
number =str(input())
numbers = number.split(" ")
A = int(numbers[0])
B = int(numbers[1])
C = int(numbers[2])
D = int(numbers[3])
list_1 = []
list_2 = []

for i in range(A, B+1):
    if i % C != 0:
        list_1.append(i)
for j in list_1:
    if j % D != 0:
        list_2.append(j)
        
print(len(list_2))

Submission status: Time Limit Exceeded

Solution code:
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

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

CD = C*D//gcd(C, D)

Cs = A - (A%C)
Ds = A - (A%D)
CDs = A - (A%CD)

count1 = 0
count2 = 0
count3 = 0

while(True):
    if A <= Cs <= B:
        count1 += 1
    elif Cs > B:
        break
    Cs += C

while(True):
    if A <= Ds <= B:
        count2 += 1
    elif Ds > B:
        break
    Ds += D

while(True):
    if A <= CDs <= B:
        count3 += 1
    elif CDs > B:
        break
    CDs += CD

print(B - A + 1 - ((count1 + count2) - count3))

Submission status: Time Limit Exceeded

Solution code:
A, B, C, D = map(int, input().split())
result = 0
size = B - A + 1
for i in range(size):
    if((A + i)%C != 0 and (A + i)%D != 0):
      result += 1
print(result)

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
import sys


def solve(A: int, B: int, C: int, D: int):
    i = 0

    ls = [x for x in range(A, B + 1)
          if x % C != 0 and x % D != 0]

    print(len(ls))

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    D = int(next(tokens))  # type: int
    solve(A, B, C, D)


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

count=0
i=1
X=C
while (X<=B):
  X=C*i
  if(X>=A):
    if(X<=B):
      count+=1
  i+=1
  
#print(B-A-count+1)
X=D
i=1
while (X<=B):  
  X=D*i
  if(X>=A):
    if(X<=B):
    	count+=1
  i+=1
        
#print(B-A-count+1)
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

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

double=0
i=1
X=lcm(C, D)
while (X<=B):
  X=lcm(C, D)*i
  if(X>=A):
    if(X<=B):
    	double+=1
  i+=1
    

    
print(B-A-count+double+1)

Submission status: Time Limit Exceeded

Solution code:
l,m, s,t= map(int,input().split())
p=0
for i in range(l,m+1):
  if  i%s!=0 and i%t!=0:
    p+=1
print(p)

Submission status: Time Limit Exceeded

Solution code:
a,b,c,d = map(int,input().split())

ans = 0

if c % d == 0:
    for i in range(a, b+1):
        if i % c !=0:
            ans += 1
elif d % c == 0:
    for i in range(a, b+1):
        if i % d !=0:
            ans += 1
else:
    for i in range(a, b+1):
        if (i % d !=0) and (i % c !=0):
            ans += 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
a,b,c,d = input().split()
a_int = int(a)
b_int = int(b)
c_int = int(c)
d_int = int(d)
 
num = list()
i = 1
while True:
  target_c = c_int * i
  target_d = d_int * i
  if target_c <= b_int and target_c >= a_int:
    num.append(target_c)
  if target_d <= b_int and target_d >= a_int:
    num.append(target_d)
  if target_c >= b_int and target_d >= b_int:
    break
  i += 1

print(b_int - a_int + 1 - len(set(num)))

Submission status: Time Limit Exceeded

Solution code:
a,b,c,d = map(int, input().split())
count = 0
for i in range(a , b+1):
  e = i % c
  f = i % d
  if e != 0 and f != 0 :
    count += 1
    
print(count)

Submission status: Time Limit Exceeded

Solution code:
# C 
A, B, C, D = map(int, input().split())

lst = []
for i in range(A, B+1):
    if (i % C != 0) and (i % D != 0):
        lst.append(i)
print(len(lst))

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
a,b,c,d  = map(int, input().split())
count = 0
for i in range(a, b+1):
    if (i%c != 0) & (i%d !=0):
        count+=1
    else:
        pass
print(count)

Submission status: Time Limit Exceeded

Solution code:
def main():
    a, b, c, d = map(int, input().split())
    l = []
    for i in range(a,b+1):
        if i%c != 0 and i%d != 0:
            l.append(i)

    print(len(l))

main()

Submission status: Time Limit Exceeded

Solution code:
A,B,C,D=map(int, input().split())
List=[0 if (i%C==0 or i%D==0) else 1 for i in range(A,B+1)]
print(sum(List))

Submission status: Time Limit Exceeded

Solution code:
A, B, C, D = map(int, input().split())
ans = 0
for i in range(A, B+1):
  if (i%C == 0) or (i%D==0):
    continue
  else:
    ans += 1
    
print(ans)

Submission status: Time Limit Exceeded

Solution code:
# coding=utf-8

###
### for atcorder program
###

import sys
import math
import array

# math class
class mymath:
    ### pi
    pi = 3.14159265358979323846264338

    ### Prime Number
    def pnum_eratosthenes(self, n):
        ptable = [0 for i in range(n+1)]
        plist = []

        for i in range(2, n+1):
            if ptable[i]==0:
                plist.append(i)
                for j in range(i+i, n+1, i):
                    ptable[j] = 1
        return plist

    ### GCD
    def gcd(self, a, b):
        if b == 0:
            return a
        return self.gcd(b, a%b)

    ### LCM
    def lcm(self, a, b):
        return (a*b)//self.gcd(a,b)

    ### Mat Multiplication
    def mul(self, A, B):
        ans = []
        for a in A:
            c = 0
            for j, row in enumerate(a):
                c += row*B[j]
            ans.append(c)
        return ans

mymath = mymath()

### output class
class output:
    ### list
    def list(self, l):
        l = list(l)
        #print(" ", end="")
        for i, num in enumerate(l):
            print(num, end="")
            if i != len(l)-1:
                print(" ", end="")
        print()

output = output()

### input sample
#i = input()
#N = int(input())
#A, B, C = [x for x in input().split()]
#N, K = [int(x) for x in input().split()]
#inlist = [int(w) for w in input().split()]
#R = float(input())
#A = [int(x) for x in input().split()]
#for line in sys.stdin.readlines():
#    x, y = [int(temp) for temp in line.split()]

### output sample
#print("{0} {1} {2:.5f}".format(A//B, A%B, A/B))
#print("{0:.6f} {1:.6f}".format(R*R*math.pi,R*2*math.pi))
#print(" {}".format(i), end="")

def main():
    A,B,C,D = [int(x) for x in input().split()]

    Clist = set(x*C for x in range(A//C, B//C+1))
    Dlist = set(x*D for x in range(A//D, B//D+1))
    ABlist = set(x for x in range(A,B+1))
    
    #print(Clist)
    #print(Dlist)
    #print(Clist | Dlist)
    #print(ABlist)

    anslist = ABlist - (Clist | Dlist)
    print(len(anslist))

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
A, B, C, D = map(int, input().split())
result = 0
for i in range(B - A + 1):
    if((A + i)%C != 0 and (A + i)%D != 0):
      result += 1
print(result)

Submission status: Time Limit Exceeded

Solution code:
a,b,c,d = map(int,input().split())
cdm = [_ for _ in range(a, b+1) if _%c == 0 or _%d == 0]

print(b-a-len(cdm)+1)

Submission status: Time Limit Exceeded

Solution code:
import fractions
def C():
  
    def counter (target):
        flg = False
        for i in range(A, B + 1):
            if i % target == 0:
                leg = B - i
                count = (leg // target) + 1
                flg = True
                break
        if flg == False:
            count = 0
        return count
    A, B, C, D = map(int, input().split())
    lcm = (C * D) // fractions.gcd(C, D)
    print(B - A + 1 - (counter(C) + counter(D) - counter(lcm)))

C()

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
# coding: utf-8


import sys
import math
from pprint import pprint
import numpy as np


text =input()
kokokara=int(text.split()[0])
kokomade=int(text.split()[1])
C=int(text.split()[2])
D=int(text.split()[3])

goukei=0
for target in range(kokokara, kokomade+1) :
    if target%C!=0 and target%D!=0:
        goukei+=1
print(goukei)

Submission status: Time Limit Exceeded

Solution code:
A, B, C, D = (int(i) for i in input().split())
S = 0

for i in range(A, B+1):
	if i%C != 0:
		if i%D != 0:
			S += 1
print(S)

Submission status: Time Limit Exceeded

Solution code:
A, B, C, D = map(int, input().split())
cnt = 0
s = 0
for i in range(A, B+1):
    if i % C != 0:
        if i % D != 0:
            cnt += 1
      
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
a,b,c,d=map(int, input().split()) #spaceno

count=0
for i in range(a,b+1):
    if (i%c!=0):
        if(i%d!=0):
            #print(i)
            count=count+1
print(count)

Submission status: Time Limit Exceeded

Solution code:
# 190622_sat_C

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

n = 0

for i in range(A, B+1):
    if i % C != 0 and i % D != 0:
        n = n+1
print(n)

Submission status: Time Limit Exceeded

Solution code:
a,b,c,d=map(int, input().split()) 
count =0

for i in range(a,b+1):
    if i%c==0 or i%d==0:
            count = count +1

print(b-a+1-count)

Submission status: Time Limit Exceeded

Solution code:
a,b,c,d=map(int,input().split())

s=0
for i in range(a,b+1):
    if i%c==0 or i%d==0:
        s+=1
print(b-a+1-s)

Submission status: Time Limit Exceeded

Solution code:

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

CN = C
DN = D
while CN != DN:
    if CN < DN:
        CN += C
    else:
        DN += D

CD = CN

#print(CD)

C_count = B//C - (A-1)//C 
D_count = B//D - (A-1)//D
CD_count = B//CD - (A-1)//CD 



#print(C_count, D_count, CD_count)

print(B - A + 1 - C_count - D_count + CD_count)

Submission status: Time Limit Exceeded

Solution code:
a,b,c,d = map(int, input().split())

ans = 0
for i in range(a, b + 1):
    if (i % c != 0) and (i % d != 0):
        ans += 1

print(ans)

Submission status: Time Limit Exceeded

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

count = B - A
counter = 0
for i in range (count+1):
    if (B+i) % C != 0:
        if (B+i) % D != 0:
            counter = counter + 1

print (counter)

Submission status: Time Limit Exceeded

Solution code:
def main():
    a, b, c, d = map(int, input().split())
    cnt = 0
    for i in range(a,b+1):
        if i%c != 0 and i%d != 0:
            cnt += 1

    print(cnt)

main()

Submission status: Time Limit Exceeded

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

count = 0
for i in range(A, B+1):
    if(i % C != 0 and i % D != 0):
        count += 1

print(count)

Submission status: Time Limit Exceeded

Solution code:
a,b,c,d = map(int,input().split())
a_b = [_ for _ in range(a, b+1)]

cdm = list(filter(lambda x: x%c == 0 or x%d == 0, a_b))

print(len(a_b)-len(cdm))

Submission status: Time Limit Exceeded

Solution code:

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

CN = C
DN = D
while True:
    if CN % D == 0:
        break
    CN += C

CD = CN

#print(CD)

C_count = B//C - (A-1)//C 
D_count = B//D - (A-1)//D
CD_count = B//CD - (A-1)//CD 



#print(C_count, D_count, CD_count)

print(B - A + 1 - C_count - D_count + CD_count)

Submission status: Time Limit Exceeded

Solution code:
a,b,c,d=map(int,input().split())
m=0

for i in range(a,b+1):
    if i%c==0 or i%d==0:
        continue
    else:
        m=m+1

print(m)

Submission status: Time Limit Exceeded

Solution code:
A,B,C,D=input().split()
x=0
count=0
for i in range(int(B)-int(A)+1):
    x=int(A)+i
    if x%int(C)!=0 and x%int(D)!=0:
        count+=1
print(count)

Submission status: Time Limit Exceeded

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

count = 0
for i in range(A,B+1):
  #print("///////////")
  #print(i)
  if(i % C == 0 and i % D != 0): # 3で割り切れるが５で割り切れない
    #print("2で割り切れるが3で割り切れない")
    pass
  elif(i % D == 0 and i % C != 0): # 5で割り切れるが3で割り切れない
    #print("2で割り切れるが3で割り切れない")
    pass
  elif(i % C == 0 and i % D == 0): # 3で割り切れ、かつ5で割り切れる
    #print("2で割り切れるが3で割り切れる")
    pass
  else:
    #print("どれにもあてはまらない",i)
    count = count + 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8

a, b, c, d = map(int, input().split())

count = 0

for i in range(a, b+1):
    if i % c == 0 or i % d == 0:
        continue
    count += 1

print(count)

Submission status: Time Limit Exceeded

Solution code:
a,b,c,d = map(int, input().split())

result = 0
for i in range(a, b+1):
  if i%c != 0 and i%d != 0:
    result += 1
  
print(result)

Submission status: Time Limit Exceeded

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

count = 0
for i in range(A, B+1):
    if i % C != 0 and i % D != 0:
        count += 1

print(count)

Submission status: Time Limit Exceeded

Solution code:
A, B, C, D = map(int,input().split())
cou = 0
for i in range(A,B+1):
  if not(i % C == 0 or i % D == 0):
    cou += 1

print(cou)

Submission status: Time Limit Exceeded

Solution code:

import math

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

CN = C
DN = D
while CN != DN:
    if CN < DN:
        CN += C
    else:
        DN += D

CD = CN

#print(CD)

C_count = B//C - (A-1)//C 
D_count = B//D - (A-1)//D
CD_count = B//CD - (A-1)//CD 



#print(C_count, D_count, CD_count)

print(B - A + 1 - C_count - D_count + CD_count)

Submission status: Time Limit Exceeded

Solution code:
a, b, c, d = list(map(int, input().split()))
s = 0

for k in range(a, b+1):
    if k % c == 0 or k % d == 0:
        x = 0
    else:
        s += 1

print(s)

Submission status: Time Limit Exceeded

Solution code:
a,b,c,d = map(int,input().split())
a_b = [_ for _ in range(a, b+1)]

cm = list(filter(lambda x: x%c == 0, a_b))
dm = list(filter(lambda x: x%d == 0, a_b))
cdm = list(filter(lambda x: x%c == 0 and x%d == 0, a_b))

print(len(a_b)-(len(cm)+len(dm))+len(cdm))

Submission status: Time Limit Exceeded

Solution code:
a,b,c,d=map(int,input().split())
m=0

for i in range(a,b+1):
    if i%c==0:
        continue
    elif i%d==0:
        continue
    else:
        m=m+1

print(m)

Submission status: Time Limit Exceeded

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

count=0
for i in range(A,B+1):
    if(i%C!=0):
        if(i%D!=0):
            count+=1

print(count)

Submission status: Time Limit Exceeded

Solution code:
a,b,c,d = map(int,input().split())
ans = 0
for i in range(a,b+1):
    if i%c ==0 or i%d==0:
        ans += 1
    else:
        ans += 0

print((b-a+1)-ans)

Submission status: Time Limit Exceeded

Solution code:
A,B,C,D=map(int,input().split())
X=0
Y=A-1
for i in range(B-A+1):
    Y=Y+1
    
    if Y%C==0 or Y%D==0:
        continue
    else:
        X=X+1
print(X)

Submission status: Time Limit Exceeded

Solution code:
a=list(map(int,input().split()))
k=0
for i in range(a[0],a[1]+1):
  if i/a[2]!=i//a[2]:
    if i/a[3]!=i//a[3]:
      k+=1
  else:
    k+=0
print(k)

Submission status: Time Limit Exceeded

Solution code:
a,b,c,d=input().split()
a=int(a)
b=int(b)
c=int(c)
d=int(d)
f=0
for i in range(a,b+1):
    if((i%c!=0)and(i%d!=0)):
        f+=1
print(f)

Submission status: Time Limit Exceeded

Solution code:
A,B,C,D=input().split()
x=[]
count=0
for i in range(int(B)-int(A)+1):
    x.append(int(A)+i)
    if x[i]%int(C)!=0 and x[i]%int(D)!=0:
        count+=1
print(count)

Submission status: Time Limit Exceeded

Solution code:
a,b,c,d = input().split()
c_int = int(c)
d_int = int(d)
 
num = 0
for i in range(int(a),int(b)+1):
  if i % c_int != 0:
    if i % d_int != 0:
      num += 1
print(num)

Submission status: Time Limit Exceeded

Solution code:
A,B,C,D = list(map(int,input().split()))
integer = (i for i in range(A, B+1))
cnt = 0
for x in integer:
    if x % C != 0:
        if x % D != 0:
            cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
a,b,c,d=map(int,input().split())
m=0

for i in range(a,b+1):
    if i%c==0:
        s=1
    elif i%d==0:
        s=1
    else:
        m=m+1

print(m)

Submission status: Time Limit Exceeded

Solution code:
numbers = input().split(' ')

a = int(numbers[0])	
b = int(numbers[1])
c = int(numbers[2])
d = int(numbers[3])

count = 0
for i in range(a, b+1):
	if 	i % c != 0:
		if i % d != 0:
			count += 1
		else:
			continue
	else:
		continue

print(count)

Submission status: Time Limit Exceeded

Solution code:
A, B, C, D = map(int, input().split())
count = 0
for i in range(A, B+1):
    if i%C ==0 or i%D==0:
        continue
    else:
        count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
A,B,C,D=map(int,input().split())
sum=0
for i in range(A,B+1):
    #if(i%C!=0 and i%D!=0):
    if(i%C!=0):
        if(i%D!=0):
            sum+=1

print(sum)

Submission status: Time Limit Exceeded

Solution code:
a,b,c,d = map(int,input().split())

lists = []
for i in range(b-a+1):
    lists.append(a)
    a += 1
an = 0

for j in lists:
    if j % (c*d) == 0:
        an += 1
    elif j % c == 0:
        an += 1
    elif j % d == 0:
        an += 1
print(len(lists)-an)

Submission status: Time Limit Exceeded

Solution code:
import math
A,B,C,D=map(int,input().split())
sum=0

cx=math.ceil(A/C)
cy=math.floor(B/C)
dx=math.ceil(A/D)
dy=math.floor(B/D)

s_list=[]
for i in range(cx,cy+1):
    s_list.append(C*i)
for i in range(dx,dy+1):
    s_list.append(D*i)
s_list=set(s_list)
print("{}".format(B-A+1-len(s_list)))

Submission status: Time Limit Exceeded

Solution code:
A,B,C,D = list(map(int,input().split()))
integer = (i for i in range(A, B+1))
cnt = 0
for x in integer:
    if x % C != 0 and x % D != 0:
        cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
A,B,C,D = map(int,input().split())
result = [i for i in range(A,B+1) if i%C!=0 and i%D!=0]
ans = len(result)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
A, B, C, D = map(int, input().split())
a = []
b = []

tmp = C
while tmp <= B:
    if tmp >= A:
        a.append(tmp)
    tmp += C
    
tmp = D
while tmp <= B:
    if tmp >= A:
        b.append(tmp)
    tmp += D

ab = set(a) | set(b)

print(B - A + 1 - len(ab))

Submission status: Time Limit Exceeded

Solution code:
a, b, c, d = map(int, input().split())

ans = 0
for x in range(a, b+1):
    if x % c !=0:
        if x % d !=0:
            ans += 1
    else:
        pass

print(ans)

Submission status: Time Limit Exceeded

Solution code:
A,B,C,D = [int(i) for i in input().split()]
list=[]
s=0
for i in range(A,B+1):
    if not i % C ==0 and not i % D ==0:
        s += 1
print(s)

Submission status: Time Limit Exceeded

Solution code:
e = list(map(int,input().split()))
a = e[0]
b = e[1]
c = e[2]
d = e[3]
cnt = 0
t = [j for j in range(a,b+1) if j%c != 0 and j%d != 0]

for i in t:
    if (int(i/c)-i/c != 0) and (int(i/d)-i/d != 0):
        cnt += 1
    else:
        pass
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
parents = list(map(int,input().split(' ')))
l_index=[]
sum=0
if parents[2]<parents[3]:
    for i in range(parents[0],parents[1]+1):
        if not i%parents[2]==0:
            l_index.append(i)
    for i in l_index:
        if not i%parents[3]==0:
            sum+=1

else:
    for i in range(parents[0],parents[1]+1):
        if not i%parents[3]==0:
            l_index.append(i)
    for i in l_index:
        if not i%parents[2]==0:
            sum+=1

print(sum)

Submission status: Time Limit Exceeded

Solution code:
a, b, c, d = list(map(int, input().split()))

not_need = []

res = 0
for x in range(a, b+1):
    if x%c:
        if x%d:
            res += 1
    else:
        continue

print(res)

Submission status: Time Limit Exceeded

Solution code:
A, B, C, D = map(int,input().split())
count = 0
for i in range(B-A+1) :
    if (A+i)%C != 0 :
        if (A+i)%D != 0 :
            count+=1
print(count)

Submission status: Time Limit Exceeded

Solution code:
a, b, c, d = list(map(int, input().split()))
print(len([i for i in range(a, b+1) if i%c != 0 and i%d != 0]))

Submission status: Time Limit Exceeded

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

ccount = []
for i in range((A-1)//C*C +C, B+1, C):
    ccount.append(i)
    
dcount = []
for j in range((A-1)//D*D +D, B+1, D):
    dcount.append(j)

cdcount = len(set(ccount) & set(dcount))

count = B-A+1-len(ccount) - len(dcount) +cdcount
print(count)

Submission status: Time Limit Exceeded

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

count = 0
for i in range(A,B+1):
  if i % C != 0 and i % D != 0:
    count += 1
    
print(count)

Submission status: Time Limit Exceeded

Solution code:
A,B,C,D=map(int,input().split())
sum=0

for i in range(A,B+1):
    if(i%C!=0 and i%D!=0):
        sum+=1

print(sum)

Submission status: Time Limit Exceeded

Solution code:
A,B,C,D=map(int,input().split())
SCORE=0


for i in range(A,B+1,1):
  
  if i%C!=0 and i%D!=0:
    SCORE=SCORE+1
    
  #print (i,SCORE)
  
print(SCORE)

Submission status: Time Limit Exceeded

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

a = [0 if i % C == 0 or i % D == 0 else 1 for i in range(A, B+1)]

print(sum(a))

Submission status: Time Limit Exceeded

Solution code:
e = list(map(int,input().split()))
a = e[0]
b = e[1]
c = e[2]
d = e[3]
cnt = 0

for i in range(a,b+1):
    if (int(i/c)-i/c != 0) and (int(i/d)-i/d != 0):
        cnt += 1
    else:
        pass
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
a, b, c, d = list(map(int, input().split()))

not_need = []

res = 0
for x in range(a, b+1):
    if x%c:
        if x%d:
            res += 1
        else:
            continue

print(res)

Submission status: Time Limit Exceeded

Solution code:
A,B,C,D=map(int,input().split())
ans=0
for i in range(A,B+1):
  if i%C!=0 and i%D!=0:
    ans+=1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
A,B,C,D = map(int,input().split(' '))
lis = range(A,B+1)
count = 0
for x in lis:
    if x % C !=0 and x%D !=0:
        count +=1
print(count)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-

a,b,c,d = map(int,input().split())

num = 0
for i in range(a,b+1):
    if i%c != 0 and i%d != 0:
        num += 1

print(str(num))

Submission status: Time Limit Exceeded

Solution code:
A,B,C,D = map(int,input().split())
cnt = 0
for num in range(A,B+1):
    if num%C != 0 and num%D != 0:
        cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
A, B, C, D = map(int, input().split())

sum = 0
count = B-A+1
for n in range(count):
    if (n+A) % C == 0:
        rr = 0
    elif (n+A) % D == 0:
        rr = 0
    else:
        sum += 1
print(sum)

Submission status: Time Limit Exceeded

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

counter = 0
for i in range(A, B + 1):
    if i % C != 0 and i % D != 0:
        counter += 1

print(counter)

Submission status: Time Limit Exceeded

Solution code:
a, b, c, d = map(int, input().split())
count = []

count = [1 for i in range(a, b+1) if (i %c != 0) and (i %d != 0)]

print(len(count))

Submission status: Time Limit Exceeded

Solution code:
A,B,C,D = list(map(int, input().split()))

n_list=[i for i in range(A,B+1) if  i%C!=0 and i%D!=0]
print(len(n_list))

Submission status: Time Limit Exceeded

Solution code:
a,b,c,d = map(int, input().split())
count = 0
for i in range(a,b+1):
    if i % c != 0:
        if i % d != 0:
            count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
def main():

    A,B,C,D = (int(i) for i in input().split())

    count = 0
    for i in range(A,B+1):
        if i%C != 0 and i%D !=0:
            count += 1
        else:
            continue
    print(count)
    


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
a, b, c, d = map(int, input().split())

ans = 0
for x in range(a, b+1):
    if x % c !=0 and x % d !=0:
        ans += 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
a,b,c,d = input().split(' ')
a = int(a)
b = int(b)
c = int(c)
d = int(d)

counter = 0

for i in range(a, b + 1):
    if i % c == 0 or i % d == 0:
        counter += 1

print(b + 1 - a - counter)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
A, B, C, D = map(int, input().split())

"""
def get_num_divisor(x, a, b):
    ret = 0
    for i in range(a, b + 1):
        if x % i == 0:
            ret += 1
            if i != x // i:
                ret += 1
    return ret

num_div_C = get_num_divisor(C, a, b)
"""

num_div_C = 0
num_div_D = 0
num_div_CD = 0
for n in range(A, B + 1):
    if n % C == 0:
        num_div_C += 1
        if n % D == 0:
            num_div_D += 1
            num_div_CD += 1
    else:
        if n % D == 0:
            num_div_D += 1
print(B - A + 1 - (num_div_C + num_div_D - num_div_CD))

Submission status: Time Limit Exceeded

Solution code:
e = list(map(int,input().split()))
a = e[0]
b = e[1]
c = e[2]
d = e[3]

def div(x,y):
    cnt = 0
    for i in range(a,b+1):
        if (int(i/x)-i/x != 0) and (int(i/y)-i/y != 0):
            cnt += 1
    return cnt

print(div(c,d))

Submission status: Time Limit Exceeded

Solution code:
A , B , C ,D = map(int, input().split())
count = 0
for i in range(A,B + 1):
    flag = 0
    if i % C != 0 and i % D != 0:
        count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd


def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    a, b, c, d = MAP()

    ct = 0
    for i in range(a, b + 1):
        if i % c!= 0 and i%d!=0:
            ct += 1
    print(ct)
    
if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
a,b,c,d = map(int, input().split())
count = 0
for i in range(a,b+1):
    if i % c != 0 and i % d != 0:
        count += 1
print(count)

Submission status: Time Limit Exceeded

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

list=[]

# print(list)

count=0

for i in range(A,B+1):
  if(i%C==0 or i%D==0):
    continue
  else:
    list.append(i)

print(len(list))

Submission status: Time Limit Exceeded

Solution code:
e = list(map(int,input().split()))
a = int(e[0])
b = int(e[1])
c = int(e[2])
d = int(e[3])

def div(x,y):
    cnt = 0
    for i in range(a,b+1):
        if (int(i/x)-i/x != 0) and (int(i/y)-i/y != 0):
            cnt += 1
    return cnt

print(div(c,d))

Submission status: Time Limit Exceeded

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd


def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    a, b, c, d = MAP()
    l = gcd(c, d) * c * d
    ct = 0
    for i in range(a, b + 1):
        if i % c!= 0 and i%d!=0:
            ct += 1
    print(ct)
    
if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:

ABCD = list(map(int, input().split()))

A = ABCD[0]
B = ABCD[1]
C = ABCD[2]
D = ABCD[3]

AB = B-A
count = 0

for i in range(AB+1):
    point = i+A

    if point % C == 0 or point % D == 0:
        continue
    else:
        count += 1


print(count)

Submission status: Time Limit Exceeded

Solution code:
A,B,C,D = map(int,input().split())
result_num = 0
for i in range(A,B+1,1):
    if (i % C) == 0 or (i % D) == 0:
        pass
    else:
        result_num += 1
print(result_num)

Submission status: Time Limit Exceeded

Solution code:
A,B,C,D=input().split()
x=[]
count=0
s=int(C)*int(D)
for i in range(int(B)-int(A)+1):
    x.append(int(A)+i)
    if x[i]%int(C)!=0 and x[i]%int(D)!=0:
        count=count+1
print(count)

Submission status: Time Limit Exceeded

Solution code:
A,B,C,D = map(int,input().split())
result = []
for i in range(A,B+1,1):
    result.append(i)
result_num = 0
for i in range(len(result)):
    if (result[i] % C) == 0 or (result[i] % D) == 0:
        pass
    else:
        result_num += 1
print(result_num)

Submission status: Time Limit Exceeded

Solution code:
numbers = input().split(' ')

a = int(numbers[0])	
b = int(numbers[1])
c = int(numbers[2])
d = int(numbers[3])

count = 0
for i in range(a, b+1):
	if 	i % c != 0 and i % d != 0:
		count += 1
print(count)

Submission status: Time Limit Exceeded

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

list= [i for i in range(A,B+1)]

# print(list)

count=0

for i in list:
  if(i%C==0):
    count+=1
  elif(i%D==0):
    count+=1
  else:
    continue

print(len(list)-count)

Submission status: Time Limit Exceeded

Solution code:
A,B,C,D = map(int,input().split())
result = []
for i in range(A,B+1,1):
    result.append(i)
result_num = []
for i in range(len(result)):
    if (result[i] % C) == 0 or (result[i] % D) == 0:
        pass
    else:
        result_num.append(result[i])
print(len(result_num))

Submission status: Time Limit Exceeded

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

Sum = 0

for i in range(A,B+1):
  if (i%C)!=0 and (i%D)!=0:
  	Sum += 1    

print(Sum)

Submission status: Time Limit Exceeded

Solution code:
a, b, c, d = [int(x) for x in input().split()]

count = 0
for i in [x for x in range(a, b+1)]:
    if i % c != 0 and i % d != 0:
        count += 1

print(count)

Submission status: Time Limit Exceeded

Solution code:
a, b, c, d = map(int, input().split())

cnt = 0
for i in range(a, b + 1):
    if i % c != 0 and i % d != 0:
        cnt = cnt + 1

print(cnt)

Submission status: Time Limit Exceeded

Solution code:
count = 0
a,b,c,d = input().split()
a = int(a)
b = int(b)
c = int(c)
d = int(d)
for i in range(a,b + 1) :
  if((i % c) != 0 and (i % d)!= 0):
    count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
A, B, C, D = list(map(int, input().split()))
counter = 0
for n in range(A, B + 1, 1):
    if n % C == 0 or n % D == 0:
        counter += 0
    else:
        counter += 1
print(counter)

Submission status: Time Limit Exceeded

Solution code:
A, B, C, D = map(int, input().split())
cnt = 0
for i in range(A, B+1):
    if i%C!=0 and i%D!=0:
        cnt += 1
        
print(cnt)

Submission status: Time Limit Exceeded

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

counter = 0

for n in range(B-A+1):
  if (A + n) %C !=0 and (A+n)% D != 0:
    counter += 1

print(counter)