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:
#!/usr/bin/env python3
import sys
from math import *
from itertools import *
from collections import *
from functools import *
try:
    from math import gcd
except Exception:
    from fractions import gcd


def solve(N: int):
    ret = 0
    for i in range(1, N + 1 , 2):
        c = 0
        for j in range(1, i + 1):
            c += int((i % j) == 0)

        if c == 8:
            ret += 1
    return ret


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    result = solve(N)
    print(result)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import numpy as np

a = np.zeros(201)
for d in range(1,201,2):
  a[d::2*d] += 1

a = (a == 8).cumsum()

N = int(input())
print(a[N])

Submission status: Accepted

Solution code:
N=int(input())
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 len(divisors)
ans=0
for i in range(1,N+1):
        if i%2==0:
                continue
        else:
                u=make_divisors(i)
                if u==8:
                        ans+=1
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for i in range(1,n+1) :
    if i % 2 == 0 :
        continue
    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:
import sys
input = sys.stdin.readline

n = int(input())

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


cnt = 0

for i in range(1, n+1, 2):
    if len(make_divisors(i)) == 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:
def calc_divisor(x):
  res = 0
  for i in range(1,x+1):
    if x % i == 0:
      res += 1
  return res

N = int(input())
ans = 0
for i in range(1,N+1):
  if i % 2 == 1 and calc_divisor(i) == 8:
    ans += 1
print(ans)

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)
    return divisors
ans=[]
for ii in range(1,int(input())+1):
	if len(make_divisors(ii))==8 and ii%2==1:
		ans.append(ii)
print(len(ans))

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())
ans = 0
tmp = 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:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:

def main():
    a = int(input())
    ans = 0
    for now_num_kari in range(105, a + 1)[::2]:
        data = []
        now_num = now_num_kari
        for i in range(2, 50):
            count = 0
            while now_num % i == 0:
                count += 1
                now_num //= i
            if count > 0:
                data.append(count)

        if now_num > 1:
            data.append(1)

        yakusuu = 1
        for ele in data:
            yakusuu *= (ele + 1)

        if yakusuu == 8:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

def solve(N: int):
    ret = 0
    for i in range(1, N + 1):
        if i % 2 == 1 and count_f(i) == 8:
            ret += 1
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()

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:
            cnt += 1
    if cnt == 8 and i % 2 == 1:
        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:
def f(n):
    a = []
    for i in range(1,n+1):
        if n%i == 0:
            a.append(i)
    return a

n = int(input())
count = 0
for i in range(1,n+1,2):
    ff = f(i)
    #print(ff)
    if len(ff) == 8:
        count+=1
print(count)

Submission status: Accepted

Solution code:
N = int(input())
"""200以下の奇数で約数8個→3*5*7,3^3*5=135,3^3*7=189,3*5*11=165,3*5*13=195"""
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:
# ABC106B - 105
n = int(input())
odd = []
odd_divs = []

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

Submission status: Accepted

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

if N < 105:
    print(0)
    exit()

else:
    for i in range(105, N+1, 2):
        for j in range(1, N+1):
            if i % j == 0:
                temp += 1

        if temp == 8:
            ans += 1
            temp = 0
        else:
            temp = 0

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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())
ans=0
for i in range(1,n+2,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:
def divide(h):
    counter = 0
    counter1 = 0
    for i in range(1, h, 2):
        for j in range(1, i+1):
            if i % j == 0:
                counter += 1
        if counter == 8:
            counter1 += 1
        counter = 0
    return counter1

                         
if __name__ == '__main__':
    n = int(input())
    if n % 2 != 0:
        print(divide(n+1))
    else:
        print(divide(n))

Submission status: Accepted

Solution code:
N = int(input())

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)
    return divisors

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

Submission status: Accepted

Solution code:
def divide(n):
    counter = 0
    counter1 = 0
    if n % 2 != 0:
        for i in range(1, n+1, 2):
            for j in range(1, i+1):
                if i % j == 0:
                    counter += 1
            if counter == 8:
                counter1 += 1
            counter = 0
    else:
        for i in range(1, n, 2):
            for j in range(1, i+1):
                if i % j == 0:
                    counter += 1
            if counter == 8:
                counter1 += 1
            counter = 0
    return counter1

                         
if __name__ == '__main__':
    n = int(input())
    print(divide(n))

Submission status: Accepted

Solution code:
N = int(input())
oddprime = []
for i in range(3, N + 1, 2):
  com = False
  for p in oddprime:
    if p > i ** 0.5:
      break
    if i % p == 0:
      com = True
      break
  if not com:
    oddprime.append(i)

count = 0
for i in range(1, N + 1, 2):
  yaku_num = 1
  for j in oddprime:
    div_num = i
    div_count = 0
    while div_num % j == 0:
      div_count += 1
      div_num //= j
    yaku_num *= (div_count + 1)
  if yaku_num == 8:
    count += 1
print(count)

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:
ans=0
for i in range(105,int(input())+1,2):
    x=1
    for j in range(3,int(i**0.5)+1,2):
        if j**2==i:break
        elif i%j==0:
            x+=1
    else:
        if x==4:ans+=1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
if 1 <= n < 105:
    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:
N = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())
num = 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:
        num += 1

print(num)

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

Submission status: Accepted

Solution code:
import math


def get_divisors(n):
    """
    n の約数をリストで返す
    :param int n:
    :rtype: list of int
    """
    ret = []
    for i in range(1, int(math.sqrt(n)) + 1):
        if n % i == 0:
            ret.append(i)
            if n // i != i:
                ret.append(n // i)
    return ret


N = int(input())
print(len([i for i in range(1, N + 1) if i % 2 == 1 and len(get_divisors(i)) == 8]))

Submission status: Accepted

Solution code:
N = int(input())

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)
    return divisors

c = 0
for i in range(N):
  n = i + 1
  if n % 2 == 0:
    continue
  if len(make_divisors(n)) == 8:
    c += 1

print(c)

Submission status: Accepted

Solution code:
n = int(input())
def cntdiv(x):
  cnt = 0
  for i in range(1,x+1,1):
    if (x % i == 0) and (x % 2 == 1): cnt += 1
  return cnt
def cntans(x):
  if x <= 1:
    return 0
  if cntdiv(x) == 8:
    return 1 + cntans(x-1)
  else:
    return cntans(x-1)
print(cntans(n))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
count_ans = 0
for i in range(n//2 + 1 if n%2 ==1 else n//2):
  count_y = 0
  for j in range(2*i+2):
    if j > 0:
      if (2 * i + 1)%j == 0:
        count_y += 1
  if count_y == 8:
    count_ans += 1
print(count_ans)

Submission status: Accepted

Solution code:
N = int(input())
T = 0
for i in range(N):
	c = 0
	if ((i+1)%2)==1:
		for j in range(N):
			if ((i+1)%(j+1)) == 0:
				c += 1
		if c >= 8:
			T += 1
                
print (int(T))

Submission status: Accepted

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

N = int(input())
count = 0

for i in range(1, N + 1):
    a = []
    if i % 2 == 0:
        continue

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

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

print(count)

Submission status: Accepted

Solution code:
n = int(input())

c = 0
for i in range(1, n+1, 2):
  if sum([i % j == 0 for j in range(1, i+1)]) == 8:
    c += 1
print(c)

Submission status: Accepted

Solution code:
#106 B
N=int(input())
ans=[]
for i in range(1,N+1,2):
    tmp=0
    for j in range(1,i+1):
        if i%j==0 and j%2!=0:
            tmp+=1
        if tmp==8:
            ans.append(i)
print(len(ans))

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for i in range(1, n+1):
    count = 0
    if i % 2 != 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())
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())
 
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

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


print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
if N<105:
  ans = 0
else:
  for i in range(105,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())
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())
ans=0
for n in range(1, N+1, 2):
	cnt=0
	for z in range(1, n+1):
		if n%z==0:
			cnt+=1
	if cnt==8:
		ans+=1
print(ans)

Submission status: Accepted

Solution code:
def main():
	N = int(input())
	dp = [1]*(N+1)
	ans = 0
	for i in range(2, N+1):
		div = 1
		while i * div <= N:
			dp[i*div] += 1
			div += 1
		if dp[i] == 8 and i%2==1:
			ans += 1
	print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
for a in range(1,N+1):
  if a%2==0:
    continue
  c = 0
  for b in range(1,a+1):
    if a % b == 0:
      c += 1
  if c == 8:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
num = int(input())
count = 1
div_8_list = []
while count < num + 1:
    if count % 2 != 0:
        div = []
        for i in range(1, int(count**0.5)+1):
            if count % i == 0:
                div.append(i)
                if i != count // i:
                    div.append(count//i)
        if len(div) == 8:
            div_8_list.append(div)
    count += 1
print(len(div_8_list))

Submission status: Accepted

Solution code:
N = int(input())

if N%2 == 0:
    M = N+1
else:
    M = N+2


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

print(ans)

Submission status: Accepted

Solution code:
def yakusu(m):
  cnt=1
  for i in range(1,(m//2)+1):
    if m%i==0:
      cnt+=1
  return cnt
ans=0
n=int(input())
for j in range(1,n+1):
  if yakusu(j)==8 and j%2!=0:
    ans+=1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
odds = [i for i in range(1, N + 1) if i % 2 != 0]
ans = 0
for odd in odds:
    cnt = 0
    for bunbo in odds:
        if odd % bunbo == 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 = 1
    for i in range(107, N+1, 1):
        count = 0
        if i % 2 ==0:
            continue
        for j in range(3, i, 2):
            if i % j == 0:
                count += 1
            if count > 6:
                break
        if count == 6:
            ans += 1
    print(ans)

Submission status: Accepted

Solution code:
N=int(input())

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

Submission status: Accepted

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

N = int(input())
count = 0

for i in range(1, N + 1):
    a = []
    if i % 2 == 0:
        continue

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

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

print(count)

Submission status: Accepted

Solution code:
def calculate_num_of_divisor(N):
    yakusuu = []
    for i in range(1, N+1):
        if N % i == 0:
            yakusuu.append(i)
    return len(yakusuu)

N = int(input())
count = []
for i in range(N+1):
    if i % 2 == 1 and calculate_num_of_divisor(i) == 8:
        count.append(i)
print(len(count))

Submission status: Accepted

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

N = int(input())
count = 0

for i in range(1, N + 1):
    a = []
    all_odd = 0
    for j in range(1, i + 1):
        if i % j == 0:
            a.append(j)
    for k in a:
        if k % 2 == 0:
            all_odd += 1
    if all_odd == 0 and len(a) == 8:
        count += 1

print(count)

Submission status: Accepted

Solution code:
N = int(input())

count = [0] * 201
count[105] = 1
for i in range(105, 201):
    if i % 2 == 1:
        num = 0
        for n in range(1, i+1):
            if i % n == 0:
                num += 1
        if num == 8:
            count[i] = count[i-1]+1
        else:
            count[i] = count[i-1]
    else:
        count[i] = count[i-1]

print(count[N])

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:
      cnt += 1

  if cnt == 8 and i % 2 != 0:
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
def get_factors(n):
    f = set()
    for i in range(1,int((n**0.5))+1):
        if n % i == 0:
            f.add(i)
            f.add(n//i)
    return len(f)
ans = 0
for i in range(1,n+1):
    if get_factors(i) == 8 and i % 2 == 1:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
from collections import Counter
from functools import reduce
import fractions
import math
import statistics
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]  # LIST INT
def LF(): return [float(x) for x in sys.stdin.readline().split()]  # LIST FLOAT
def LS(): return sys.stdin.readline().split()  # LIST STRING
def MI(): return map(int, sys.stdin.readline().split())  # MAP INT
def II(): return int(sys.stdin.readline())  # INPUT INT
def IS(): return input()  # INPUT STRING
def P(x): return print(x)
def C(x): return Counter(x)
def GCD_LIST(numbers):  # greatest common divisor
    return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers):  # least common multiple
    return reduce(LCM, numbers)
def LCM(m, n):
    return (m * n // fractions.gcd(m, n))


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

Submission status: Accepted

Solution code:
N = int(input())

anscnt = 0
for n in range(1, N+1, 2):
  cnt = 0
  for k in range(1, n+1):
    if n % k == 0:
      cnt += 1
  if cnt == 8:
    anscnt += 1
    
print(anscnt)

Submission status: Accepted

Solution code:
N = int(input())

yakusuu8ko = [3*5*7, 3*5*11, 3*5*13, 3**3*5, 3**3*7]
print(len([n for n in yakusuu8ko if n<=N]))

Submission status: Accepted

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

print(ans)

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

Submission status: Accepted

Solution code:
import math
n = int(raw_input())
count = 0
for i in range(101,n+1,2):
	cuenta = 0
	for j in range(1,int(math.floor(i**0.5)+1),2):
		if i == j ** 2:
			cuenta += 1
		elif i % j == 0:
			cuenta += 2

	if cuenta == 8:
		count += 1

print count

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
import itertools
import collections
import functools
import math
from queue import Queue
# import numpy as np
INF = float("inf")


def trial_division_sqrt(n):
    prime_count = collections.Counter()

    for i in range(2, int(math.sqrt(n)) + 2):
        while n % i == 0:
            n /= i
            prime_count[i] += 1
    if n > 1:
        prime_count[int(n)] += 1

    return prime_count


def num_divisors(prime_count):
    num = 1

    for prime, count in prime_count.items():
        num *= (count + 1)

    return num


def solve(N: int):

    count = 0
    for i in range(1, N+1, 2):
        prime_count = trial_division_sqrt(i)
        if num_divisors(prime_count) == 8:
            count += 1
    print(count)
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
# 2019/04/07
# AtCoder Beginner Contest 106 - B

# Input
n = int(input())

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

# Output
print(ans)

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

Submission status: Accepted

Solution code:
n = int(input())
sum = []
for i in range(1, n + 1):
  s = 0
  if (i % 2 == 0):
    continue
  for j in range(1, i + 1):
    if (i % j == 0):
      s += 1
  sum.append(s)

print(sum.count(8))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def get_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)
    return divisors

def main():
    N = int(input())
    result = 0
    for n in range(1, N+1, 2):
        div = get_divisors(n)
        if len(div) == 8:
            result += 1

    print(result)


main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
for n in range(1, N + 1, 2):
    j = 1
    tmp = []
    while j < n / 2:
        if n / j == n // j:
            tmp.append(j)
            tmp.append(n // j)
        j += 1
    if len(set(tmp)) == 8:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
li = [0]*(N+1)
for i in range(1,N+1):
    a = 1
    while(a*i <= N):
        #print(i,a)
        li[a*i] += 1
        a += 1
cnt = 0
for index,i in enumerate(li):
    if(i == 8 and index%2==1):
        cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
kisu_list = [i for i in range(1,n+1) if i%2==1]
count = 0
for kisu in kisu_list:
    yakusu = [i for i in range(1,kisu+1) if kisu%i==0]
    if len(yakusu)==8:
        count += 1
print(count)

Submission status: Accepted

Solution code:
N = int(input())

def get_soinsu(n,d = None):
    if d == None:
        d = {}
    if n == 1 :
        return d
    for i in (3,5,7,11,13):
        if n%i == 0:
            d[i] = d.get(i,0) + 1
            break
    else:
        return {n:1}
    return get_soinsu(n//i,d)

out = 0
for i in range(105,N+1,2):
    tmp = get_soinsu(i)
    p = 1
    for j in tmp.values():
        p *= (j+1)
    if p == 8:
        out += 1
print(out)

Submission status: Accepted

Solution code:
import bisect;print(bisect.bisect([6,36,66,90,96],int(input())-99))

Submission status: Accepted

Solution code:
N = int(input())
res = 0
for i in range(1,N+1):
    if(i% 2 == 0):
        continue
    tmp = i
    g = 1
    for j in range(2,i+1):
        fac = 0
        while tmp%j == 0:
            tmp = tmp//j
            fac = fac + 1
        g = g*(fac+1)
    if(g == 8):
        res = res + 1
print(res)

Submission status: Accepted

Solution code:
n = int(input())
def div(k):
    divider = []
    for i in range(1,int(k**0.5) + 1):
        if k % i == 0:
            divider.append(i)
            if k//i != i:
                divider.append(k//i)
    return len(divider)
sum = 0
for i in range(int(n/2 + 1/2)):
    if div(2*i + 1) == 8:
        sum += 1
print(sum)

Submission status: Accepted

Solution code:
n = int(input())
ans = 1
k = 107
i = 1
count = 0
if n < 105:
    print(0)
else:
    while k <= n:
        while i <= k:
            if k % i == 0 :
                count += 1
            if count == 8:
                ans += 1
                break   
            i += 2
        count = 0
        i = 1
        k += 2
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

if n < 105:
    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:
N = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
from sys import stdin
N=int(stdin.readline().rstrip())
ans=0
for i in range(1,N+1):
    cnt=0
    for j in range(1,i+1):
        if i % j == 0:
            cnt+=1
    if cnt == 8 and i % 2 != 0:
        ans+=1
print(ans)

Submission status: Accepted

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

n = int(input())

def yakusuu(num):
    yakusuu_array = []
    for i in range(1,num):
        if num % i == 0:
            yakusuu_array.append(i)
    return(len(yakusuu_array)+1)

ans = 0

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

Submission status: Accepted

Solution code:
N = int(input())

def aaa(N):
    ans = 0
    if N < 105:
        print(ans)
        return

    odd_list = [i for i in range(1, N+1) if i % 2 ==  1]
    odd_list2 = [i for i in range(105, N+1) if i % 2 ==  1]

    for j in odd_list2:
        c = 0
        for i in odd_list:
            if j % i == 0:
                c += 1
                if c == 8:
                    ans += 1
                    break
    print(ans)
aaa(N)

Submission status: Accepted

Solution code:
#coding: utf-8
N = int(input())
ans = 0
for num in range(1, N+1):
    cnt = 0
    for i in range(1, num+1):
        if num % i == 0 and num % 2 == 1:
            cnt += 1
    if cnt == 8:
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

ans = 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:
        ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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