Problem:


Score: 200 points

Problem Statement

The number 105 is quite special - it is odd but still it has eight divisors.
Now, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusive)?

Constraints

N is an integer between 1 and 200 (inclusive).

Input

Input is given from Standard Input in the following format:

N

Output

Print the count.

Sample Input 1

105

Sample Output 1

1

Among the numbers between 1 and 105, the only number that is odd and has exactly eight divisors is 105.

Sample Input 2

7

Sample Output 2

0

1 has one divisor. 3, 5 and 7 are all prime and have two divisors. Thus, there is no number that satisfies the condition.



Sample input:
105


Sample output:
1

Submission status: Accepted

Solution code:
n = int(input())

count = 0
for i in range(1, n+1, 2):
    n_divisor = 1
    for j in range(2, n+1):
        if i%j == 0:
            n_divisor += 1
    if n_divisor == 8:
        count += 1

print(count)

Submission status: Accepted

Solution code:
N = int(input())
nice_yaku = []
for i in range(1,N+1) :
	if i % 2 == 0 :
		# 偶数は除外する
		continue

	yaku = []
	for j in range(1,i+1) :
		if i % j == 0 :
			yaku.append(j)

	if len(yaku) == 8 :
		nice_yaku.append(i)

print(len(nice_yaku))

Submission status: Accepted

Solution code:
N = int(input())
yakusuu8 = [3**3 * 5, 3**3 * 7, 3*5*7, 3*5*11, 3*5*13]
cnt = 0
for i in yakusuu8:
    if(i<= N):
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
N=int(input())
res=0
if(N>=105):
    pass
else:
    print(0)
    exit(0)

for i in range(105,N+1):
    #print('for in ')
    counter=0
    if(i%2==0):
        pass
    else:
        for s in range(1,i+1):
            if(i%s==0):
                counter=counter+1

    if(counter==8):
        res=res+1
    #print(f'{i} is {counter}')
print(res)

Submission status: Accepted

Solution code:
N = int(input())
L = []

for j in range(1,201) :
    counter = 0
    if j % 2 != 0 :
        for i in range(1,N+1) :
            if j % i == 0 :
                counter += 1
        if counter == 8 :
            L.append(j)

p = 0
for i in L :
    if i <= N :
        p += 1
    else :
        break
print(p)

Submission status: Accepted

Solution code:
n = int(input())
cnt = 0
for i in range(1,n+1,2):
    tmp = 0
    for j in range(1,i+1):
        if i%j==0:
            tmp += 1
    if tmp == 8 :
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())

ans = 0
for i in range(1, n+1, 2):
    count = 0
    for j in range(1, n+1):
        if i % j == 0:
            count += 1
    if count == 8:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

def count_d(n):
    ret = 0
    for d in range(1,n+1):
        if n%d == 0:
            ret += 1
    return ret

ans = 0
for i in range(1,N+1,2):
    if count_d(i) == 8:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin

sys.setrecursionlimit(10**5)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()

ans = 0
for i in range(1,n+1,2):
    temp = 0
    for j in range(1,i+1):
        if i%j == 0:
            temp += 1
            
    if temp == 8:
        ans += 1
        
print(ans)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    
    count = 0
    for i in range(1, n+1):
        d = 0
        if i % 2 == 0:
            continue;
        for j in range(1, int(i**(1/2))+1):
            if i % j == 0:
                d += 2
                if d > 8:
                    break
        if d == 8:
            count += 1
    print(count)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
ret = 0
for x in range(1, int(input()) + 1, 2):
    tmp = 1
    for y in range(1, x):
        if x % y == 0:
            tmp += 1
    if tmp == 8:
        ret += 1
print(ret)

Submission status: Accepted

Solution code:
n = int(input())

num = 0
for i in range (1, n+1, 2):
  #print(n+1)
  ans = 0
  for j in range (1, i+1):
    if i%j == 0:
      ans += 1
      #print(i, j)
  if ans == 8: #more than 8? less than 8?
    num += 1
    ans = 0
print(num)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for i in range(1, n+1, 2):
    cnt = 0
    for j in range(1, i+1):
        if i % j == 0:
            cnt += 1
            if cnt == 8:
                ans += 1
                break
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

def yakusuu(num):
	count = 0
	for i in range(1,num+1):
		if num%i==0:
			count+=1
	return count


ans=0
ns = [x for x in range(1,n+1) if x%2==1]
for j in ns:
	if yakusuu(j)==8:
		ans+=1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
cnt = [0 for _ in range(n+1)]
for i in range(1, n+1):
  for j in range(i, n+1, i):
    cnt[j] += 1
print(len([i for i in range(1,n+1, 2) if cnt[i]==8]))

Submission status: Accepted

Solution code:
N = int(input())
ans = 0

if N >= 105:
    for i in range(105, N+1, 2):
        num = 0
        for j in range(1, i+1):
            if i % j == 0:
                num += 1
                if num == 8:
                    ans += 1

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
answer = 0
for i in range(1, N+1, 2):
    n = 0
    for j in range(1, i+1):
        if i % j == 0:
            n += 1
    if n == 8:
        answer += 1
print(answer)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for i in range(n):
    if (i + 1) % 2 != 0:
        d_count = 1
        for j in range(1, (i + 1) // 2 + 1):
            if (i + 1) % j == 0:
                d_count += 1
        if d_count == 8:
            ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

ans = 0
for i in range(1, N + 1, 2):
    count = 0
    for j in range(1, i + 1):
        if i % j == 0:
            count += 1
    if count == 8:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
num = 0

for i in range(1,n+1,2):
    count = 0
    for j in range(1,n+1,2):
        
        if i % j == 0:
            count += 1
            if count == 8:
                num +=1

print(num)

Submission status: Accepted

Solution code:
N = input()
if N < 105:
    print 0
elif N < 135:
    print 1
elif N < 165:
    print 2
elif N < 189:
    print 3
elif N < 195:
    print 4
else:
    print 5

Submission status: Accepted

Solution code:
n=int(input())
l=list([105,135,165,189,195])
a=l.count(n)
l.append(n)
l.sort()
print(l.index(n)+a)

Submission status: Accepted

Solution code:
N=int(input())

y=0
for i in range(1,N+1):
    if i%2!=0:
        x=0
        for j in range (1,i+1):
        
            if i%j==0:
                x+=1
        if x==8:
            y+=1
            
        
print(y)

Submission status: Accepted

Solution code:
N = int(input())

cnt = 0
for i in range(1, N + 1):
    if i % 2 != 0:
        divisor = 0
        for j in range(1, i + 1):
            if i % j == 0:
                divisor += 1
        if divisor == 8:
            cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
import sys
import string
input=sys.stdin.readline

n=int(input())
if n<105:
    print(0)
elif n<135:
    print(1)
elif n<165:
    print(2)
elif n<189:
    print(3)
elif n<195:
    print(4)
else:
    print(5)

Submission status: Accepted

Solution code:
n=int(input())
if(n<=104):
  print(0)
elif(105<=n<135):
  print(1)
elif(135<=n<165):
  print(2)
elif(165<=n<189):
  print(3)
elif(189<=n<195):
  print(4)
else:
  print(5)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    s = 0

    for i in range(1, n + 1, 2):
        if num_factor(i) == 8:
            s += 1
    print(s)


def num_factor(n):
    if n == 1:
        return 1

    s = 2
    i = 2

    while i * i <= n:
        if n % i == 0:
            if i * i != n:
                s += 2
            else:
                s += 1
        i += 1
    return s

main()

Submission status: Accepted

Solution code:
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def main():
    N = int(input())
    ans = 0
    for i in range(1, N + 1, 2):
        num = 0
        for j in range(1, i + 1):
            num += (i % j == 0)
        ans += num == 8
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

count = 0
c = 0

for i in range(1,n + 1):
  if i % 2 != 0:
    for j in range(1,i + 1):
      if i % j == 0:
        count += 1
    if count == 8:
      c += 1
    count = 0

print(c)

Submission status: Accepted

Solution code:
def _105(n):
    b = 0
    for i in range(105, n + 1, 2):
        ii = i
        l = []
        for j in range(2, i + 1):
            while True:
                if ii % j == 0:
                    l += [j]
                    ii /= j
                else:
                    break
        if len(l) == 3:
            if len(set(l)) == 3:
                b += 1
        if len(l) == 4:
            if len(set(l)) == 2:
                l.remove(set(l).pop())
                if len(l) == 3 or len(l) == 1:
                    b += 1
    return b

print(_105(int(input())))

Submission status: Accepted

Solution code:
d=[105,3*5*9,3*5*11,3*5*5*5,27*7,15*13]
n=int(input())
ans=0
for i in range(len(d)):
  if d[i]<=n:
    ans+=1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
if N<105:
    print(0)
elif N<107:
    print(1)
else:
    ans = 1
    for i in range(107,N+1,2):
        div = 0
        if i%2==0:
            continue
        for j in range(1,i+1):
            if i%j==0:
                div += 1
        if div==8:
            ans += 1
    print(ans)

Submission status: Accepted

Solution code:
def factorize(n):
  factors=[1]
  i=2
  while n>1:
    if n%i==0:
      factors.append(i)
    if i==n:
      break
    else:
      i+=1
  return factors
      
n=int(input())
nums=[]
for i in range(1,n+1):
  if i%2==1:
    if len(factorize(i))==8:
      nums.append(i)
print(len(nums))

Submission status: Accepted

Solution code:
N = int(input())


def getDiv(n):
    count = 0
    for i in range(2, n // 2 + 1):
        if n % i == 0:
            count += 1
            # print("{}:{}, count:{}".format(n, i, count))
    return count


count = 0
for i in range(1, N + 1):
    if (i % 2 != 0) and (getDiv(i) == 8-2):
        count += 1

print(count)

Submission status: Accepted

Solution code:
n=int(input())

result=0 

for i in range (1,n+1):
    cnt=0 
    for j in range(1,i+1):
        if i%j==0:
            cnt=cnt+1
    if cnt==8 and i%2==1:
        result=result+1
        
 
print(result)

Submission status: Accepted

Solution code:
N = int(input())
result = 0

for i in range(1, N + 1, 2):
    count = 0
    for divider in range(1, i + 1):
        if i % divider == 0:
            count = count + 1
    if count == 8:
        result = result + 1

print(result)

Submission status: Accepted

Solution code:
N = int(input())
x = [i for i in range(1,N+1) if i%2!=0]
z = []
for i in x:
  y = 0
  for j in range(1,N+1):
    if i % j == 0:
      y += 1
  if y == 8:
    z.append(i)
print(len(z))

Submission status: Accepted

Solution code:
N = int(input())
countK = 0
for i in range(1,N+1):
    countY = 0
    if i%2 == 1:
        for j in range(1,i+1):
            if i%j == 0:
                countY += 1
        if countY==8:
            countK += 1        
    else:
        continue
print(countK)

Submission status: Accepted

Solution code:
# 105
n = int(input())
a = 0
for i in range(1, n+1)[0::2]:
    c = 0
    for j in range(1, i+1):
        if i % j == 0:
            c += 1
    if c == 8:
        a += 1
print(a)

Submission status: Accepted

Solution code:
import collections

N = int(input())
count = 0

for k in range(1,N+1):
    # 初期化
    num = []
    n = k
    if(n % 2 == 0):
        continue

    for i in range(2,k+1):
        if n % i == 0:
            n = int(n // i)
            num.append(i)


    num_counter = collections.Counter(num)
    ans = 1
    for value in num_counter.values():
        ans *= value+1

    if(ans == 8):
        count += 1



print(count)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for i in range(1, n + 1, 2):
    k = 0
    for j in range(1, int(i**0.5 + 1)):
        if i % j == 0:
            k += 1
    if k == 4:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
if N < 105:
	print(0)
else:
	if N < 135:
		print(1)
	else:
		if N < 165:
			print(2)
		else:
			if N < 189:
				print(3)
			else:
				if N < 195:
					print(4)
				else:
					print(5)

Submission status: Accepted

Solution code:
n=int(input())
if n<105:print(0)
elif n<3*5*9:print(1)
elif n<3*5*11:print(2)
elif n<3*7*9:print(3)
elif n<3*5*13:print(4)
else:print(5)

Submission status: Accepted

Solution code:
import math
from collections import deque

# -----------------
# 素数列挙
def make_prime_list(num):
    if num < 2:
        return []

    prime_list = [i for i in range(num+1)]
    prime_list[1] = 0
    num_sqrt = math.sqrt(num)

    for prime in prime_list:
        if prime == 0 :
            continue
        if prime > num_sqrt:
            break

    for non_prime in range(2*prime, num, prime):
        prime_list[non_prime] = 0
    
    return [prime for prime in prime_list if prime != 0]
# -----------------

# -----------------
# 素因数分解
def prime_factorization(num):
    if num <= 1:
        return False
    else:
        num_sqrt = math.floor(math.sqrt(num))
        prime_list = make_prime_list(num_sqrt)

        dict_counter = {}
        for prime in prime_list:
            while num % prime == 0:
                if prime in dict_counter:
                    dict_counter[prime] += 1
                else:
                    dict_counter[prime] = 1
                num //= prime
        
        if num != 1:
            if num in dict_counter:
                dict_counter[num] += 1
            else:
                dict_counter[num] = 1

        return dict_counter
# -----------------

# -----------------
# 約数の個数
def search_divisor_num(num):
    if num < 0:
        return None
    elif num == 1:
        return 1
    else:
        divisor_num = 1
        dict_fact = prime_factorization(num)
        for value in dict_fact.values():
            divisor_num *= (value + 1)
        return divisor_num
# -----------------

n = int(input())
res = [num for num in range(1,n+1,2) if search_divisor_num(num) == 8]
print(len(res))

Submission status: Accepted

Solution code:
n = int(input())

def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= int(i)
      table.append(int(i))
    i += 1
  if n > 1:
    table.append(n)
  return table

a = [1]*(n+1)
for i in range(3,n+1,2):
    il = prime_decomposition(i)
    il_unique = list(set(il))
    ans = 1
    for j in il_unique:
        ans *= (il.count(j)+1)
    a[i] = max(a[i],ans)


print(a.count(8))

Submission status: Accepted

Solution code:
n = int(input())

divisor = 0

for i in range(1,n+1):
  count = 0
  if i % 2 != 0:
    for j in range(1,i+1):
      if i % j ==0:
        count += 1
    if count == 8:
      divisor += 1

print(divisor)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
n  = int(input())

def pcheck(num):
  # 1, num is divisor
  nd=1
  if num>1:
    nd=2
  for i in range(2,num):
    if num%i==0:
      nd=nd+1
  return nd==8

res=0
for i in range(1,n+1):
  if i%2==0:
    continue
  if pcheck(i):
    res=res+1
print(res)

Submission status: Accepted

Solution code:
n=int(input())
a=[135,189,105,165,195]
ans=0
for i in a:
  if i<=n:
    ans+=1
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
l=0
for i in range(1,n+1):
  if i%2==1:    
    p=0
    for k in range(1,i+1):
      if i%k==0:
        p+=1
    if p==8:
      l+=1
print(l)

Submission status: Accepted

Solution code:
n=int(input())
l=[]
for i in range(1,n+1):
  if i%2==1:    
    p=0
    for k in range(1,i+1):
      if i%k==0:
        p+=1
    if p==8:
      l.append(i)
print(len(l))

Submission status: Accepted

Solution code:
n=int(input())
ans=0
for i in range(1,n+1,2):
    cnt=0
    for j in range(1,n+1):
        if i%j==0:
            cnt+=1
    if cnt==8:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
if not n%2:
    n -= 1

result = 0

for i in range(1,n+2,2):
    cnt = 0

    for ii in range(1,i+2,2):
        if i%ii == 0:
            cnt += 1

    if cnt >= 8:
        result += 1

print(result)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
def cou(n):
  d = 0
  for i in range(1,n+1):
    if n % i == 0:
      d += 1
  return(d)
for j in range(1,n+1,2):
  if cou(j) == 8:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
odd = list(range(1, N+1, 2))
ans = 0

for ki in odd:
    count = 0
    for waru in range(1,ki+1):
        if ki % waru == 0:
            count += 1
    if count == 8:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for i in range(1,n+1,2):
    co = 0
    for f in range(1,i+1):
        if i % f == 0:
            co += 1
    if co == 8:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for i in range(1,n//2-2):
  a = i * 2 + 1
  for j in range(i+1,n//2-1):
    b = j * 2 + 1
    for k in range(j+1,n//2):
      c = k * 2 + 1
      if a*b*c <= n : ans += 1
      else: break
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
ans=0
def cou(n):
  tmp=2
  for i in range(2,n):
    if n%i==0:
      tmp+=1
  return tmp
for i in range(1,n+1,2):
  if cou(i)==8:
    ans+=1
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
num=0
for i in range(N+1)[1::2]:
	able=1
	for j in range((N//2)+1)[1:]:
		if i%j==0:
			able+=1
	if able==8:
		num+=1
print(num)

Submission status: Accepted

Solution code:
N = int(input())
count = 0
for num in range(1, N+1):
    result = []
    if num % 2 != 0:
        for n in range(1, num+1):
            if num % n == 0:
                result.append(n)

    if len(result) == 8:
        count += 1

print(count)

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
c = 0

for i in range(1, N+1, 2):
  for j in range(1, i+1):
    if i % j == 0:
       c += 1
      
  if c == 8:
    ans += 1
  c = 0
    
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

def cnt_divisor(n):
    cnt = 0
    for i in range(1, n+1):
        if n % i == 0:
            cnt += 1
    return cnt

cnt = 0
for j in range(1, n+1):
    if j % 2 == 0:
        continue
    if cnt_divisor(j) == 8:
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
N = int(input())

ans = 0
for i in range(1, N+1, 2):
    cnt = 0
    for j in range(1, i+1):
        if i % j == 0:
            cnt += 1
    if cnt == 8:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
if n<105:
	print(0)
elif n<135:
	print(1)
elif n<165:
	print(2)
elif n<189:
	print(3)
elif n<195:
	print(4)
else:
	print(5)

Submission status: Accepted

Solution code:
N = int(input())
#print(N)

num = 0
for i in range(1, N+1, 2):
    rec = 0
    for j in range(1, i+1):
        #print(i,j, "i,j")
        if i % j == 0:
            rec += 1
    #print(rec,"rec")
    if rec == 8:
        num += 1
        
print(num)

Submission status: Accepted

Solution code:
n=int(input())
c=0
for i in range(1,n+1):
    if not i%2:continue
    t=0
    for j in range(1,i+1):
        if not i%j:t+=1
    if t==8:c+=1
print(c)

Submission status: Accepted

Solution code:
n = int(input())


def make_divisor_list(num):
    if num < 1:
        return []
    elif num == 1:
        return [1]
    else:
        divisor_list = []
        divisor_list.append(1)
        for i in range(2, num // 2 + 1):
            if num % i == 0:
                divisor_list.append(i)
        divisor_list.append(num)

        return divisor_list


ans = 0
for i in range(105, n+1, 2):
    if len(set(make_divisor_list(i))) == 8:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
num = 0
for i in range(1, N + 1, 2):
    rec = 0
    for j in range(1, i + 1):
        if i % j == 0:
            rec += 1
    if rec == 8:
        num += 1

print(num)

Submission status: Accepted

Solution code:
# coding: utf-8

N = int(input())

if N <= 104:
  print("0")
elif N <= 134:
  print("1")
elif N <= 164:
  print("2")
elif N <= 188:
  print("3")
elif N <= 194:
  print("4")
else:
  print("5")

Submission status: Accepted

Solution code:
import numpy as np
N=int(input())

arr=np.array([0 for _ in range((N+1)//2)])
num=np.array([2*i+1 for i in range((N+1)//2)])
for i in range(1,N+1):
    arr[num%i==0]+=1
print(len(arr[arr==8]))

Submission status: Accepted

Solution code:
N = int(input())
x = 1
count = 0

while x <= N:
  a = 0
  k = 1
  while k <= x:
    if x%k == 0:
      a += 1
    k += 2
  if a == 8:
    count += 1
  x += 2

print(count)

Submission status: Accepted

Solution code:
n = int(input())

ans = []
for odd in range(1, n+1):
    if odd % 2 == 0: continue
    cnt = 0
    for j in range(1, odd+1):
        if odd % j == 0:
            cnt += 1
    if cnt == 8:
        ans.append(odd)
print(len(ans))

Submission status: Accepted

Solution code:
#!/usr/bin/env python
N = int(input())


def check(n):
    v = list(filter(lambda x: n % x == 0, range(1, n + 1)))
    return len(v) == 8


print(len(list(filter(check, range(1, N + 1, 2)))))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n = int(input())
ans = 0
for x in range(1, n + 1, 2):
    k = 0
    for y in range(1, x + 1):
        k += (x % y == 0)
    ans += (k == 8)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
prime = [2,3,5,7,11,13]
dist_list = list((0,0,0,0,0,0))
ans_count = 0
count_origin = 1
prime_count = 0
while count_origin<= n:
  if count_origin % 2 == 0:
    count_origin += 1
    continue
  count = count_origin 
  while prime_count < 6:
    while count % prime[prime_count] == 0:
      count /= prime[prime_count]
      dist_list[prime_count] += 1
    prime_count += 1
  prime_count = 0
  result = 1
  for number in dist_list:
    result *= (number+1)
  if result == 8:
    ans_count += 1
  dist_list = list((0,0,0,0,0,0))
  count_origin += 1
print(ans_count)

Submission status: Accepted

Solution code:
n = int(input())

if n < 105:
    a = 0
elif n < 135:
    a = 1
elif n < 165:
    a = 2
elif n < 189:
    a = 3
elif n < 195:
    a = 4
else:
    a = 5
    
print(a)

Submission status: Accepted

Solution code:
N=int(input())
count=1
if N<105:
    print(0)
else:
    for i in range(107,N+1,2):
        if i%2==1:
            c=0
            for j in range(1,i+1,2):
                if i%j==0:
                    c+=1
            if c==8:
                count+=1
    print(count)

Submission status: Accepted

Solution code:
N = int(input())
count = 0

for i in range(1, N+1):
    cnt = 0
    if i % 2 != 0:
        for j in range(1, i+1):
            if i % j == 0:
                cnt += 1

        if cnt == 8:
            count += 1

print(count)

Submission status: Accepted

Solution code:
n = int(input())
answer = 0
for i in range(1, n+1, 2):
    num_of_divisor = 0
    for j in range(1, i+1):
        if i % j == 0:
            num_of_divisor += 1
    if num_of_divisor == 8:
        answer += 1
print(answer)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0

for i in range(1, n+1):
  if not i % 2 == 0:
    count = 0
    for j in range(1, i+1):
      if i % j == 0:
        count += 1
    
    if count == 8:
      ans += 1

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
ans=0
for i in range(n+1):
    if i%2==0:continue
    count=0
    for j in range(1,i+1):
        if i%j==0:count+=1
    if count==8:ans+=1
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
if n<105:print(0)
elif n<135:print(1)
elif n<165:print(2)
elif n<189:print(3)
elif n<195:print(4)
else:print(5)

Submission status: Accepted

Solution code:
N = int(input())
ret = 0

for n in range(1,N+1):
    a=1
    b=1
    c=1
    d=1
    e=1
    f=1
    z=1
    while n % 2 == 0:
        z=0
        n /= 2

    while n % 3 ==0:
        n /= 3
        a +=1
        
    while n % 5 ==0:
        n /= 5
        b +=1
        
    while n % 7 ==0:
        n /= 7
        c +=1
        
    while n % 11 ==0:
        n /= 11
        d +=1
        
    while n % 13 ==0:
        n /= 13
        e +=1
        
    if n > 1:
        f=2
        
    if z*a*b*c*d*e*f == 8:
        ret +=1

    # print ("{0} {1} {2} {3} {4}\n".format(n, z, a, b, c))
print (ret)

Submission status: Accepted

Solution code:
n = int(input())
lines = [i for i in range(24, n+1) if i % 2 != 0]

ans = 0
for i in lines:
    cnt = 0
    for j in range(1, i+1):
        if i % j == 0:
            cnt += 1
        if cnt == 8:
            ans += 1
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
i=1

yakusu=0
while i<=N:
	j=1
	k=0
	
	while j<=i:
		if i%j==0:
			k=k+1
		j=j+1	
		if k==8:
			yakusu=yakusu+1
	i=i+2
print(yakusu)

Submission status: Accepted

Solution code:
"""
B - 105
1 以上 N 以下の奇数のうち, 正の約数を ちょうど 8 個持つようなものの個数を求めよ. 
"""
N = int(input())

cnt = 0
for n in range(1, N+1, 2):
    yaku = 2
    for test in range(3, int(n ** 0.5) + 1, 2):
        #print("test", test)
        # 与えられた数をとりあえず割って、あまりを調べる
        if (n % test) == 0:
            yaku += 2

    #print("yaku", yaku)
    if yaku == 8:
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
#coding:utf-8
n = int(input())
ls_odd = [i for i in range(1,n+1,2)]
cnt = 0
for odd in ls_odd:
    ls_div = [odd % (i+1) == 0 for i in range(odd)]
    if sum(ls_div) == 8:
        cnt += 1
print (cnt)

Submission status: Accepted

Solution code:
N = int(input())
L = [105,135,165,189,195]
ans = 0
for k in range(5):
  if (L[k] <= N):
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
divisors_8 = [105]

for i in range(107, 200, 2):
    divisors = []
    for j in range(1, 201):
        if i%j == 0:
            divisors.append(j)
    if len(divisors) == 8:
        divisors_8.append(i)

n = int(input())

divisors_8.append(n)
divisors_8.sort()
result = divisors_8.index(n)
divisors_8.remove(n)

if n not in divisors_8:
    print(result)
else:
    print(result+1)

Submission status: Accepted

Solution code:
def main():
	n = int(input())

	if n <= 104:
		print(0)
	elif n <= 134:
		print(1)
	elif n <= 164:
		print(2)
	elif n <= 188:
		print(3)
	elif n <= 194:
		print(4)
	else:
		print(5)


if __name__ == '__main__':
	main()

Submission status: Accepted

Solution code:
n = int(input())

l = [3, 5, 7, 11, 13]
ans = []
for i in range(len(l)):
    for j in range(len(l)):
        if j <= i:
            continue
        ans.append(l[i]**3 * l[j])
        ans.append(l[j]**3 * l[i])
        for k in range(len(l)):   
            if k <= j:
                continue 
            ans.append(l[i]*l[j]*l[k])
a = sum([1 if tmp <= n else 0 for tmp in ans])
print(a)

Submission status: Accepted

Solution code:
import sys

# 関数 solve は，もちろん，問題に応じて書き換える
def solve(n):
    listc = []
    for i in range(1,201):
        lista = []
        for j in range(1,201):
            if i%j == 0:
                lista.append(j)
        if len(lista) >= 8 and lista[-1] %2 != 0:
            listc.append(lista[-1])
    #print(listc)#デバッグ用
    for i in range(len(listc)):
        if n < listc[0]:
            return 0
        elif n >= listc[-(i+1)]:
            return len(listc)-i

# ここから下は，入力・出力形式が同じであれば，変えなくて良い．
def readQuestion():
    line = sys.stdin.readline().rstrip()
    return int(line)

def main():
    n = readQuestion()
    answer = solve(n)
    print(answer)
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
index=1
count=0
while index<n+1:
    count2=0
    index2=1
    while index2<index+1:
        if index%index2==0:
            count2+=1
        index2+=1
    if count2==8:
        count+=1
    index+=2

print(count)

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    #AB = [int(i) for i in input().split()]
    N = int(input())
    n = 0
    for i in range(3,N+1,2):
        k = 1
        for j in range(2,i+1):
            if i % j == 0:
                k += 1
            if k > 8:
                break
        if k == 8:
            n += 1
    print(n)

Submission status: Accepted

Solution code:
n = int(input())
count = 0
ans = 0
for i in range(0,n,2):
    for j in range(0,n,2):
        if (i+1) % (j+1) == 0:
            count += 1
    if count == 8:
        ans += 1
    count = 0

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
if n<105:
    print(0)
elif n<135:
    print(1)
elif n<165:
    print(2)
elif n<189:
    print(3)
elif n<195:
    print(4)
else:
    print(5)

Submission status: Accepted

Solution code:
n=int(input())
cnt=0
ans=0
for i in range(0,n,2):
	for j in range(0,n,2):
			if (i+1)%(j+1)==0:
				cnt +=1
	if cnt == 8:
		ans +=1
	cnt=0
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
if n<105:
	print('0')
else:
	if n<135:
		print('1')
	else:
		if n<165:
			print('2')
		else:
			if n<189:
				print('3')
			else:
				if n<195:
					print('4')
				else:
					print('5')

Submission status: Accepted

Solution code:
import bisect
ans = [105, 135, 165, 189, 195]
n = int(input())
print(bisect.bisect_right(ans,n))

Submission status: Accepted

Solution code:
n = int(input())
if n < 105:
  print(0)
elif n < 135:
  print(1)
elif n < 165:
  print(2)
elif n <189:
  print(3)
elif n < 195:
  print(4)
else:
  print(5)

Submission status: Accepted

Solution code:
# coding: utf-8

n = int(input())

x = 0
for i in range(1, n + 1, 2):
    m = 0
    for j in range(1, n + 1, 2):
        if i % j == 0:
            m = m + 1
    if m == 8:
        x = x + 1
print(x)

Submission status: Accepted

Solution code:
N = int(input())
ans = 0

for i in range(1, N+1):
	div_num = 0
	if i % 2:
		for j in range(1, i+1):
			if not i % j:
				div_num += 1
		if div_num == 8:
			ans += 1

print(ans)

Submission status: Accepted

Solution code:
# 105 135 165 189 195
n = int(input())
if n < 105: print(0)
elif n < 135: print(1)
elif n < 165: print(2)
elif n < 189: print(3)
elif n < 195: print(4)
else: print(5)

Submission status: Accepted

Solution code:
N = int(input())
l = [105,135,165,189,195]
l.append(N+1)
l.sort()
print(l.index(N+1))

Submission status: Accepted

Solution code:
def countYakusu(N):
    count = 1
    for i in range(2, N + 1):
        count += [0,1][N % i == 0]
    return count

def NumOfYaku(num):
    ret_count = 0
    for j in range(1, num + 1, 2):
        if countYakusu(j) == 8:
            ret_count += 1
    return ret_count


if __name__ == '__main__':
    N = int(input())
    print(NumOfYaku(N))