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())

#入力に対して約数の個数を返す関数
def divisors(N):
  sum = 0
  for i in range(1,int(N**0.5+1)):
    if N % i == 0:
      if i **2 == N:
        sum += 1
      else:
        sum +=2
  return sum
# 問題の条件を満たすものの個数
SUM = 0 
# 1からNまでの奇数に関して関数を実行
for x in range(1,N+1,2):
  div = divisors(x)
  if div == 8:
    SUM += 1
print(SUM)

Submission status: Accepted

Solution code:
def yakusu(n):
  a=[]
  for i in range(1,n+1):
    if n%i==0:a.append(i)
  return a
a=0;n=int(input())
for i in range(1,n+1):a+=(1if len(yakusu(i))==8and i%2==1else 0)
print(a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

list_yakusuu = []

cnt = 0
for i in range(1,N+1):
  list_yakusuu = []
  if i % 2 == 0:
    continue
    
  for j in range(1,i+1):
    if i % j == 0:
      list_yakusuu.append(j)
  
  if len(list_yakusuu) == 8:
    cnt += 1

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18

N=ri()
ans = 0
for n in range(1,N+1,2):
    res = 0
    for i in range(1,n+1):
        if n%i==0:
            res += 1
    if res == 8:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
#106
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())
a = 0
c = 0
for j in range(1, n+1, 2):
    c = 0
    for i in range(1, j+1, 2):
        if j % i == 0:
            c += 1
    if c == 8:
        a += 1
print(a)

Submission status: Accepted

Solution code:
n = int(input())

divisor_num = [0] * 201

def get_divisor_num(a):
  count = 0
  for i in range(1,(a+1)//2):
    if a%i == 0:
      count+=1
  return count+1
    
for i in range(1,200):
  divisor_num[i] = get_divisor_num(i)
  
ans = 0
for i in range(n+1):
  if divisor_num[i] == 8 and i % 2 == 1:
    ans += 1
    
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
count = 0
divisor_count = 0
for num in range(1, n+1):
    if num % 2 != 0:
        divisor_list = []
        for divisor in range(1, num+1):
            if num % divisor == 0:
                divisor_list.append(divisor)
        if len(divisor_list) == 8:
            count += 1
print(count)

Submission status: Accepted

Solution code:
from sys import stdin
n = int(stdin.readline().rstrip())
l = [i for i in range(1,n+1)][0::2]
ans=0
for i in l:
    count=0
    for j in l:
        if i%j==0:
            count+=1
    if count==8:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:

N=input()
N=int(N)

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 % 2 ==1:
    n = n+1
a = n // 2
b = []
for i in range(1, a):
    x = 2*i+1
    c = []
    for j in range(1, x+1):
        if x % j == 0:
            c.append(j)
    if len(c) == 8:
        b.append(x)
print(len(b))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())

n=0
m=0
for i in range(N):

    n = 0
    for j in range(N):
        if (i+1)%(j+1)==0:
            #print("i: ", i+1, "j: ", j+1)
            n+=1
   # print("\tn: ", n, "m:", m)
    if n==8 and (i+1)%2!=0:
     m+=1
    # n=0
    
print(m)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = [0]*210
for i in range(n+1) :
  if(i%2 == 0) : continue
  res = 1
  for j in range(1, int(i/2)+1) :
    if(i%j == 0) : res += 1
  a[i] = res
print(a.count(8))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
count=0
def calc(n):
    x=int(n**0.5)+10
    for i in range(2,x):
        count=0
        while n%i==0:
            n=n//i
            count+=1
        if count!=0:
            ans.append([i,count])
for i in range(1,N+1):
    ans=[]
    sum=1
    if i%2==1:
        calc(i)
        for j in range(len(ans)):
            sum*=(ans[j][1]+1)
        if sum==8:
            count+=1
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

count = 0

for i in range(101,n+1,2):

    cc = 0

    for j in range(1,i+1):
        if i%j == 0:
            cc += 1

    if cc == 8:
        count += 1
        cc = 0

print(count)

Submission status: Accepted

Solution code:
n = int(input())
totalCount = 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:
        totalCount += 1
print(totalCount)

Submission status: Accepted

Solution code:
n=int(input())
a=[]
b=[]
for i in range(1,n+1):
    if i%2==1:
        for j in range(1,i+1):
            if i%j==0:
                a.append(j)
        if len(a)==8:
            b.append(i)
            a.clear()
        else:
            a.clear()
print(len(b))

Submission status: Accepted

Solution code:
N = int(input())
odd_count = (N + 1) // 2
odds = [2*i+1 for i in range(odd_count)]
#print(odds, end=" ")
count = 0
for n in odds:
    divisor_count = 0
    for i in range(1, n + 1):
        if n % i == 0:
            divisor_count += 1
    if divisor_count == 8:
        count += 1
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for m in range(1, n+1):
	if m%2 != 1:
		continue
	cnt = 0
	for k in range(1,m+1):
		if m%k == 0:
			cnt += 1
		if cnt>8:
			break
	if cnt == 8:
		# print(m)
		ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

if(N < 105):
  print(0)
else: 
  for i in range(105,N+1):
   count = 0
   if(i%2 == 1):
    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())
c8=0
for i in range(1,N+1,2):
    c=0
    for j in range(1,i+1,2):
        if i%j==0:
            c+=1
    if c==8:
        c8+=1
print(c8)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

if n <= 104:
    print(0)
    exit()


count = 1
for i in range(106, n+1):
    if i % 2 == 0:
        continue
    arr = []
    for j in range(1,i+1):
        if i % j == 0:
            arr.append(j)
    if len(arr) == 8:
        count+=1

print(count)

Submission status: Accepted

Solution code:
N = int(input())

count = 0
for n in range(105, N+1, 2):
    divi_count = 0
    for divi in range(1, n+1, 2):
        if n%divi == 0:
            divi_count += 1
    if divi_count == 8:
        count += 1
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
if N < 105:
    print(ans)
    exit()
for i in range(105,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:
# coding: utf-8
N = int(input())
ans = [105, 135, 165, 189, 195]
print(len([a for a in ans if a <= N]))

Submission status: Accepted

Solution code:
#ABC106 B
#まずnを素因数分解できないとならない
#1.エラトステネスのふるいで200以下の素数を全部列挙する
import math

def allprimes(N):
	primes = []
	for i in range(N):
		primes.append(i+1)
	i = 2
	while i <= math.sqrt(N):
		index = 0
		while True:
			index += 1
			if index == 1:
				continue
			else:
				if index * i <= N:
					#合成数をぜんぶ0に置換
					primes[index*i-1] = 0
				else:
					break
		i += 1
	return sorted(list(set(primes)))[2:]

#2.ある整数kが与えられたときにそれを素因数分解できるようになる

primes = allprimes(200)

def factor(k):
	#素数配列primeが存在することが前提
	nprimes = {}
	for prime in primes:
		nprimes[prime] = 0
	for prime in primes:
		if k < prime:
			break
		else:
			while True:
				if k % prime != 0:
					break
				else:
					k = int(k / prime)
					nprimes[prime] += 1
	return nprimes

#3.1以上N以下の整数を順次素因数分解して約数の個数をチェック
result = 0
for n in range(int(input())):
	if n+1 == 1 or (n+1) % 2 == 0:
		#nが1か偶数だったらスキップ
		continue
	#素数のべき乗の多い順番に列挙
	else:
		nps = sorted(factor(n+1).values())
		if nps[:-3:-1] == [7,0] or nps[:-4:-1] == [3,1,0] or nps[:-5:-1] == [1,1,1,0]:
			result += 1

print(result)

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:
import bisect
N=int(input())
l=[105,135,165,189,195]
print(bisect.bisect_right(l,N))

Submission status: Accepted

Solution code:
from collections import defaultdict
N = int(input())
ans = 0
for i in range(N + 1):
  if i % 2 == 0:
    continue
  t, j, dic, r = i, 2, defaultdict(int), 1
  while True:
    while t % j == 0:
      t /= j
      dic[j] += 1
    j += 1
    if j * j > i:
      break
  if t > 1:
    dic[t] += 1
  for key in dic:
    r *= dic[key] + 1
  if r == 8:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
ans = []

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

print(len(ans))

Submission status: Accepted

Solution code:
N = int(input())

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

print(cnt)

Submission status: Accepted

Solution code:
from math import sqrt


def divisors(n: int) -> list:
    sq = int(sqrt(n))
    l, m, r = [], [], []
    if sq * sq == n:
        m = [sq]
    else:
        sq += 1

    for i in range(1, sq):
        if n % i == 0:
            l.append(i)
            r = [n // i] + r

    return l + m + r


def one_hundred_and_five(N: int) -> int:
    count = 0
    for n in range(105, N + 1, 2):
        if len(divisors(n)) == 8:
            count += 1
    return count


if __name__ == "__main__":
    N = int(input())
    ans = one_hundred_and_five(N)
    print(ans)

Submission status: Accepted

Solution code:
#S=input()
N=int(input())
#H,W=map(int,input().split())
num=0
for i in range(1,N+1):
    kazu=0
    if i%2==0:
        continue
    for j in range(1,i+1):
        if i%j==0:
            kazu+=1
    if kazu==8 :
        num+=1
print(num)

Submission status: Accepted

Solution code:
# /user/bin/python
# -*- coding: utf-8 -*-
import sys 


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


n = int(input())
ans = 0
for i in range(1,n+1,2):
  if fact(i) == 8:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
import bisect
import math
N = int(input())

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

l = []
for i in range(1, 201):
    if i % 2 == 1:
        if diviser(i) == 8:
            l.append(i)
print(bisect.bisect_right(l, N))

Submission status: Accepted

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

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,2):
    if(i%j == 0):
      cnt += 1
  if(cnt == 8):
    ans += 1
print(ans)

Submission status: Accepted

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

for i in range(1, 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:
        result += 1

print(result)

Submission status: Accepted

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

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

print(result)

Submission status: Accepted

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

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

print(result)

Submission status: Accepted

Solution code:
N = int(input())
ans = list()
for j in range((N+1)//2):
  A = list()
  for i in range(2*j + 1):
    if (2*j + 1) % (i+1) ==0:
      A.append(i)
  if len(A) == 8:
    ans.append(j)
print(len(ans))

Submission status: Accepted

Solution code:
N=int(input())
ans = 0
for i in range(105,N+1,2):
  if len([j for j in range(1,i+1) if i % j == 0]) == 8:
    ans+=1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
def divisor_count(n):
    count = 0
    for i in range(1, n + 1):
        if n % i == 0:
            count += 1
    return count


N = int(input())
c = 0
if N >= 105:
    for i in range(105, N + 1, 2):
        if divisor_count(i) == 8:
            c += 1
print(c)

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, 2):
        if i % j == 0:
            count += 1
    if count == 8:
        ans += 1
print(ans)

Submission status: Accepted

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

for x in range(1,N+1,2):
    divlist = []
    for y in range(1,x+1):
        if x % y == 0:
            divlist.append(y)
    if len(divlist) == 8:
        answer += 1

print(answer)

Submission status: Accepted

Solution code:
def solve(string):
    n = int(string)
    return "0" if n < 105 else "1" if n < 135 else "2" if n < 165 else "3" if n < 189 else "4" if n < 195 else "5"


if __name__ == '__main__':
    print(solve(input()))

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc106/tasks/abc106_b
def yc(n):
    y = []
    for i in range(1, n + 1):
        if n % i == 0:
            y.append(i)
    return(len(y))


n = int(input())
c = 0
for i in range(1, n + 1, 2):
    if yc(i) == 8:
        c += 1
print(c)

Submission status: Accepted

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

print(s)

Submission status: Accepted

Solution code:
N=int(input())
# 105 = 3 * 5 * 7
# 135 = 3 * 3 * 3 * 5
# 165 = 3 * 5 * 11
# 189 = 3 * 3 * 3 * 7
# 195 = 3 * 5 * 13
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 < 105:
  print('0')
elif N >= 105 and N < 135:
  print('1')
elif N >= 135 and N < 165:
  print('2')
elif N >= 165 and N < 189:
  print('3')
elif N >= 189 and N < 195:
  print('4')
else:
  print('5')

Submission status: Accepted

Solution code:
N = int(input())

def func(n):
    """
    nの約数が８個だったらTrueを返す関数
    """
    yaku = []
    for i in range(1, n+1):
        if n % i == 0:
            yaku.append(i)
    
    return True if len(yaku) == 8 else False

count = 0
for n in range(1, N+1):
    if n % 2 == 0:
        continue
    else:
        if func(n):
            count += 1

print(count)

Submission status: Accepted

Solution code:
n=int(input())

def yakusu(num):
    list_a=[]
    for i in range(1,num//2+1):
        if num % i == 0:
            list_a.append(i)
    list_a.append(num)
    return list_a

ans=0
for i in range(1,n+1):
    if len(yakusu(i)) == 8 and i % 2 == 1:
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    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)


if __name__ == "__main__":
    main()

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,2):
    if not i%j:
      cnt+=1
  if cnt==8:
    ans+=1
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
L=[105,135,165,189,195]
print(len(list(filter(lambda x:x<=n,L))))

Submission status: Accepted

Solution code:
from bisect import bisect_right
print(bisect_right([105,135,165,189,195],int(input())))

Submission status: Accepted

Solution code:
N=int(input())
def dnum(n):
  ret=0
  for i in range(1,n+1):
    if n%i==0:
      ret+=1
  return ret

ans=0

for i in range(1,N+1):
  if i%2==1 and dnum(i)==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:
a=0
L=[]
N=int(input())
for i in range(1,N+1):
  if i%2==1: 
    a=0
    for j in range(1,i+1):
      if i%j==0:
        a+=1
    L.append(a)
    
  
print(L.count(8))

Submission status: Accepted

Solution code:
n = int(input())
li = []
c = 0
for i in range(1, n + 1):
    if i % 2 == 1:
        for j in range(1, i + 1):
            if i % j == 0:
                    li.append(j)
        if len(li) == 8:
            c += 1
            li = []
        else:
            li = []
print(c)

Submission status: Accepted

Solution code:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

N = int(input())
res = 0
for i in range(1,N+1,2):
    if len(make_divisors(i)) == 8:
        res += 1

print(res)

Submission status: Accepted

Solution code:
num=int(input())

con=0

for i in range(num):
    con_div=0
    i+=1
    for j in range(num):
        j+=1
        if i%j==0:
            con_div+=1  
    if con_div==8 and i%2!=0:
        con+=1        
print(con)

Submission status: Accepted

Solution code:
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(1000000)

INF = 10 ** 18

N = 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 % 2 == 0:
	n = n - 1
count = 0
for j in range(1, n + 1, 2):
	ans = 0
	for i in range(1, j + 1, 2):
		if j % i == 0:
			ans += 1
	if ans == 8:
		count += 1
print(count)

Submission status: Accepted

Solution code:
a=[s for s in range(int(input())+1)]
print(a.count(105)+a.count(165)+a.count(195)+a.count(189)+a.count(135))

Submission status: Accepted

Solution code:
def main():
    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)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
cnt = 0
a = []
for i in range(1,n+1,2):
    for j in range(1,i+1):
        if i % j == 0:
            cnt += 1
        else:
            continue
    if cnt == 8:
        a.append(j)
        cnt = 0
    else:
        cnt = 0
print(len(a))

Submission status: Accepted

Solution code:
N = int(input())

num = 0
for k in range(1,N+1,2):
	div = 0
	for i in range(1,k+1):
		if k%i == 0:
			div = div + 1
	if div == 8:
		num = num + 1


print(num)

Submission status: Accepted

Solution code:
n = int(input())
num = [i for i in range(1,n+1)]
ans = 0
for m in num:
    if m==3*5*7 or m==3*5*11 or m==3*5*13 or m==27*5 or m==27*7:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
n=int(input());print(sum(x<n-99for x in[5,35,65,89,95]))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n=int(input())
result = 0
for i in range(1,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: result+=1
print(result)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 11 05:38:56 2019

@author: shinjisu
"""


# ABC 200点問題
import math


def getInt(): return int(input())


def getIntList(): return [int(x) for x in input().split()]


def zeros(n): return [0]*n


def dmp(x):
    global debug
    if debug:
        print(x)


debug = True


def getIntLines(n): return [int(input()) for i in range(n)]


def getIntMat(n):
    mat = []
    for i in range(n):
        mat.append(getIntList())
    return mat


def zeros2(n, m): return [zeros(m)]*n


def prob096():  # Maximum Sum
    X = getIntList()
    K = getInt()
    dmp((X, K))
    total = sum(X) - max(X) + max(X)*2**K
    return total


def prob097():  # Exponential
    X = getInt()
    dmp(X)
    if X == 1:
        return 1
    for n in range(X, 0, -1):
        dmp(n)
        for b in range(2, int(math.sqrt(X))+1):
            a = n
            exp = True
            while a > 1:
                if a % b != 0:
                    exp = False
                    break
                a //= b
            if exp:
                break
        if exp:
            break
    return n


def prob098():  # Cut and Count
    N = getInt()
    S = input()
    dmp((N, S))
    maxChCount = 0
    for i in range(1, N):
        before = S[:i]
        after = S[i:]
        dmp((before, after))
        chCount = 0
        for j in range(26):
            ch = chr(ord('a')+j)
            if ch in before and ch in after:
                chCount += 1
        maxChCount = max(maxChCount, chCount)
    return maxChCount


def prob099():  # Stone Momument
    a, b = getIntList()
    height = 0
    for i in range(b-a+1):
        height += i
    height -= b
    return height


def prob103():  # String Rotation
    S = input()
    T = input()
    for i in range(len(S)):
        S = S[1:] + S[0]
        dmp(S)
        if S == T:
            return 'Yes'
    else:
        return 'No'


def prob110():  # 1 Dimensional World's Tale
    N, M, X, Y = getIntList()
    cX = getIntList()
    cY = getIntList()
    dmp((N, M, X, Y))
    dmp(cX)
    dmp(cY)
    NW = 'No War'
    WA = 'War'
    if Y <= X:
        return WA
    cX.sort()
    cY.sort()
    dmp(cX)
    dmp(cY)
    if cX[-1] < cY[0] and \
            X < cY[0] and \
            cX[-1] < Y:
        return NW
    else:
        return WA


def prob109():  # Shiritori
    N = getInt()
    W = []
    for i in range(N):
        W.append(input())
    dmp(W)
    ALPHABET = [chr(i+ord('a')) for i in range(26)]
    NO = 'No'
    dmp(ALPHABET)
    used = set([W[0]])
    for i in range(1, N):
        dmp(used)
        if W[i] in used:
            return NO
        used.add(W[i])
        if W[i-1][-1] != W[i][0]:
            return NO
    return 'Yes'


def prob106():  # 105
    N = getInt()
    div8Count = 0
    for i in range(1, N+1):
        divCount = 0
        for j in range(1, i+1):
            #dmp(('i,j',i,j))
            if i % j == 0:
                divCount += 1
        dmp((i,divCount))
        if divCount == 8 and i % 2 ==1:
            div8Count += 1
    return div8Count


def prob100():  # 
    return 0


debug = False  # True False
print(prob106())

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc106/tasks/abc106_b


def count_div(n):
    return sum([n % i == 0 for i in range(1, n+1)])


N = int(input())
print(sum(count_div(i) == 8 for i in range(1, N + 1, 2)))

Submission status: Accepted

Solution code:
N=int(input())

eight=[105, 135, 165, 189, 195]

print(len(list(filter(lambda x:x<=N, eight))))

Submission status: Accepted

Solution code:
N = int(input())
ans = []
if N < 105:
    print(0)
    exit()
cnt = 0
for i in range(2, N+1):
    ans = []
    for j in range(1, i+1):
        if i % j == 0:
            ans.append(i)
        if len(ans) == 8 and i % 2 != 0:
            cnt += 1
            break
print(cnt)

Submission status: Accepted

Solution code:
n=int(input())
if n < 105:
  print(0)
elif n == 105:
  print(1)
else:
  k = range(106, n+1)
  l = [i for i in k if i%2 != 0]
  ans = [105]
  for m in l:
    l = [i for i in range(1,m//2+1) if m%i == 0]
    if len(l) == 7:
      ans.append(m)

  print(len(ans))

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
def main() -> None:
    N = int(input())
    l = [v for v in range(1, N + 1) if v % 2 == 1]

    c = t = 0

    for n in l:
        for i in range(1, n + 1):
            if n % i == 0:
                t = t + 1
        c = (c + 1) if t == 8 else c
        t = 0
    print(c)


if __name__ == '__main__':
    main()

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:
int_n = int(input())

counter = 0
for n in range(1, int_n + 1):

    if len([n // m for m in range(1, n + 1) if (n % 2 != 0) and (n % m == 0)]) == 8 :
        counter += 1

print(counter)

Submission status: Accepted

Solution code:
N = int(input())
count = 0
for n in range(1, N + 1, 2):
    divisor = [i for i in range(2, n // 2 + 1) if n % i == 0]
    if len(divisor) == 6:
        count += 1
print(count)

Submission status: Accepted

Solution code:
import itertools

n=int(input())

count=0

X=[3,5,7,11,13]

X=list(itertools.combinations(X,3))



for i in range(10):
    if X[i][0]*X[i][1]*X[i][2]<=n:
        count+=1

if n<135:
    count+=0
elif n<189:
    count+=1
else:
    count+=2
        
print(count)

Submission status: Accepted

Solution code:
def div(num):
    counter = 0
    for i in range(num):
        if num % (i+1) == 0:
            counter += 1
    return counter
N = int(input())
sumcount = 0
for i in range(N):
    if div(i+1)==8:
        if (i+1) % 2 != 0:
            sumcount += 1
print(sumcount)

Submission status: Accepted

Solution code:
def divisors(n):
	divs = {1:0,n:0}
	i = 2
	while i*i<=n:
		if n%i==0:
			divs[i] = 0
			divs[n/i] = 0
		i += 1
	return divs

N = raw_input()
N = int(N)

print(len([i for i in range(3,N+1,2) if len(divisors(i))==8]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

def divisor(n):
  c = 1
  for i in range(2, n+1):
    m = 1
    while n % i == 0:
      n //= i
      m += 1
    c *= m
  return c

def main():
  input = sys.stdin.readline
  N = int(input())
  ans = 0
  for i in range(1, N+1, 2):
    if divisor(i) == 8:
      ans += 1
    
  print(ans)


if __name__ == '__main__':
  main()