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
M = (N//2 if N%2 == 0 else (N+1)//2)

for i in range(M):
    Num = 2*i + 1
    Div = 0
    for j in range(1, Num + 1):
        if Num % j == 0:
            Div += 1
    if Div == 8:
        count += 1
print(count)

Submission status: Accepted

Solution code:
n = int(input())


def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct


def divisorize(fct):
    b, e = fct.pop()  # base, exponent
    pre_div = divisorize(fct) if fct else [[]]
    suf_div = [[(b, k)] for k in range(e + 1)]
    return [pre + suf for pre in pre_div for suf in suf_div]

def num(fct):
    a = 1
    for base, exponent in fct:
        a = a * base**exponent
    return a


ans = 0
for i in range(105, n+1):
    fct = factorize(i)
    if i % 2 == 0:
        continue
    if len(divisorize(fct)) == 8:
       ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
for i in range(1,N+1):
  cnt = 0
  # 偶数ならスキップ
  if i % 2 == 0:
    continue
  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 math
N = int(input())

def make_prime_list(num):
    if num < 2:
        return []

    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0 # 1は素数ではない
    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 search_divisor_num(num):
    if num < 0:
        return None
    elif num == 1:
        return 1
    else:
        num_sqrt = math.floor(math.sqrt(num))
        prime_list = make_prime_list(num_sqrt)

        divisor_num = 1
        for prime in prime_list:
            count = 1
            while num % prime == 0:
                num //= prime
                count += 1
            divisor_num *= count

        if num != 1:
            divisor_num *= 2

        return divisor_num

re = 0
for i in range(1, N+1, 2):
    num = search_divisor_num(i)
    if num == 8:
        re += 1
        
print(re)

Submission status: Accepted

Solution code:
# your code goes here
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(int(-(-N//2))):
    dev = 1
    for i in range(n):
        if (2*n+1)%(2*i+1) == 0:
            dev += 1
    if dev == 8:
        ans += 1
print(ans)

Submission status: Accepted

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

def yaku(k):
    small = 0
    for j in range(1,k+1):
        if k % j == 0:
            small += 1
    if small == 8:
        return 1
    else:
        return 0

for i in range(N + 1):
    if i % 2 == 1:
        count += yaku(i)

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()

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

Submission status: Accepted

Solution code:
num = int(input())

ans = 0

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

Submission status: Accepted

Solution code:
# coding=utf-8
import math

if __name__ == '__main__':
    N = int(input())
    answer = 0

    for i in range(1, N+1, 2):
        counter = 0
        for j in range(1, 1+math.floor(math.sqrt(i))):
            if i % j == 0:
                if j**2 == i:
                    counter += 1
                else:
                    counter += 2
        if counter == 8:
            answer += 1

    print(answer)

Submission status: Accepted

Solution code:
n = int(input())

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

print(res)

Submission status: Accepted

Solution code:
n = int(input())
print(len([_ for _ in [105, 135, 165, 189, 195] if _ <= 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:
n = int(input())

a = [135, 189, 105, 165, 195]
count = 0
for i in range(5):
	if a[i] <= n:
		count += 1

print(count)

Submission status: Accepted

Solution code:
def solve(n):
    c = 0
    for a in range(1, n+1):
        if n % a == 0:
            c += 1
    return c == 8


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

    c = 0
    for a in range(1, n + 1, 2):
        if solve(a):
            c += 1
    print(c)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# coding:utf-8

N = int(input())

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

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


    if divNum == 8:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
n = input()
k = (int(n) - 1) // 2
def check(x):
    count = 0
    for i in range(1,x+1):
        if x % i == 0:
            count += 1
    return count
ncount = 0
for i in range(1,k+1):
    if check(2*i+1) == 8:
        ncount += 1
print(ncount)

Submission status: Accepted

Solution code:
n=int(input())
c=0
if(n<105):print(0)
if(n==105):print(1)
if(n>105):
    for i in range(105,n+1,2):
        d=0
        for j in range(1,i+1):
            if(i%j==0):d+=1
        if(d==8):c+=1

    print(c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

odds = [i for i in range(1, N+1) if i % 2 != 0]

result = []
for odd in odds:
    z = []
    for i in range(1, odd+1):
        if odd % i == 0:
            z.append(i)

    if len(z) == 8:
        result.append(z)
print(len(result))

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:
def count(n):
    c=0
    for i in range(1,int(n**(0.5))+1):
        if n%i==0:    
            if (n/i)==i:
                c+=1
            else:
                c+=2
    return c 
n=int(input())
cou=0
for i in range(n+1):
    if i%2!=0 :
        if count(i)==8:
            cou+=1
print(cou)

Submission status: Accepted

Solution code:
N=int(input())

warucount=0
count=0

for i in range(1,N+1):
    warucount=0
    for k in range(1,N+1):
        if i%2!=0:
            
            
            if i%k==0:
                warucount+=1
    if warucount==8:
        count+=1
        
    
print(count)

Submission status: Accepted

Solution code:
n=int(input())

a=[105,135,165,189,195]
ans=0

for i in a:
    if i<=n:
        ans+=1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

ans=0

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

print(ans)

Submission status: Accepted

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

X = int(input())

count = 0
for i in range(1, X + 1, 2):
  if countFactors(i) == 8:
    count += 1

print(count)

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())
if N < 105:
    print(0)
else:
    ans = 0
    for i in range(N, 104, -1):
        tmp = sum((i%j==0)*1 for j in range(1, i+1))
        if tmp == 8 and i % 2:
            ans += 1
    print(ans)

Submission status: Accepted

Solution code:
import math

def n_divisors(n):
    counter = 0
    for i in range(1, int(math.sqrt(n) + 1e-9) + 1):
        if n % i == 0:
            counter += 1
            if n != i**2:
                counter += 1

    return counter

N = int(input())

counter = 0

for n in range(1, N+1):
    if n_divisors(n) == 8 and n%2 == 1:
        counter += 1

print(counter)

Submission status: Accepted

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

n = int(input())

res = 0

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

print(res)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for i in range(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:
n=int(input())
ass = 0

if n >= 135:
    ass += 1
if n >= 189:
    ass += 1

if n >= 3*5*7:
    ass += 1
if n >= 3*5*11:
    ass += 1
if n >= 3*5*13:
    ass += 1

print(ass)

Submission status: Accepted

Solution code:
n = int(input())

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

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

Submission status: Accepted

Solution code:

N=int(input())

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

Submission status: Accepted

Solution code:
N = int(input())
a = 0
for x in range(1, N+1,2):
    b = 0
    for i in range(1, x+1):
        if x%i == 0:
            b += 1
        else:
            pass
    if b == 8:
        a += 1
    else:
        pass
print(a)

Submission status: Accepted

Solution code:
N = int(input())

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

print(cnt)

Submission status: Accepted

Solution code:
from sys import stdin


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


def main():
    N = int(stdin.readline().rstrip())
    count = 0
    for i in range(1, N + 1, + 2):
        if spam(i) == 8:
            count += 1
    print(count)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import numpy as np
import math

# primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163 ,167, 173, 179, 181, 191, 193, 197, 199]

N = int(input())

def num_divisors_trial_division(n):
    num = 0
    for i in range(1, int(math.sqrt(n) + 1e-9) + 1):
        if n % i == 0:
            num += 1
            if n != i**2:
                num += 1
        if num > 8:
            return 100
    return num

total = 0
for n in range(1, N+1):
    if n % 2 == 0:
        continue
    if num_divisors_trial_division(n) == 8:
        total +=1

print(total)

Submission status: Accepted

Solution code:
n = int(input())

ans = 0
i = 105

while i <= n:
    j = 1
    cnt = 0
    while j <= i:
        if i % j == 0:
            cnt += 1
        j += 1
    if cnt == 8:
        ans += 1
    i += 2

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
L = []
for i in range(1,N+1) :
    if i % 2 != 0 :
        l = 0
        for j in range(1,201) :
            if i % j == 0 :
                l += 1
        L.append(l)
print(L.count(8))

Submission status: Accepted

Solution code:
def count_divisor(num):
    result = 2
    for i in range(2, num):
        if num % i == 0:
            result += 1

    return result


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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

def check(n):
    if n % 2 == 0:
        return 0
    cnt = 0
    for i in range(1, n+1):
        if n % i == 0:
            cnt = cnt + 1
    return 1 if cnt == 8 else 0

ans = 0
for i in range(1, N+1):
    ans = ans + check(i)
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:
def getDivNum(num):
    divN = 0
    for i in range(1, num+1):
        if num%i == 0:
            divN += 1
    return divN

n = int(input())
cnt = 0
for x in range(1, n+1, 2):
    if ( getDivNum(x) == 8 ):
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
n=int(input())

ans=0

odd_list=[]
for i in range(1,n+1,2):
    odd_list.append(i)

for k in range(1,n+1,2):
    num=[]
    for i in odd_list:
        if k%i==0:
            num.append(i)
    if len(num)==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 == 1:
        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:
N = int(input())

ans = 0
for i in range(1, N + 1, 2):
    count = 0
    for k in range(1, 200):
        if i % k == 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):
	if i %2 == 0 :
		continue
	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 main():
    N = int(input())

    ans = f(N)
    print(ans)


def f(N):
    ans = 0
    for i in range(1, N+1, 2):
        x = 0
        for j in range(1, i+1, 2):
            if i % j == 0:
                x += 1

        if x == 8:
            ans += 1

    return ans


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

ans = 0
for i in range(105,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:
n=int(input())

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

print(co0)

Submission status: Accepted

Solution code:
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect

def read():
  return int(input())

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

def test(x):
  return x % 2 == 1 and sum(x % y == 0 for y in range(1, x+1)) == 8

N = read()
print(sum(test(x) for x in range(1, N+1)))

Submission status: Accepted

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

def main():
    N = int(input())
    output = 0
    for i in range(1, N+1, 2):
        if count(i) == 8:
            output += 1
    return output

if __name__ == '__main__':
    print(main())

Submission status: Accepted

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

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

print(r)

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):
    tmp = 0
    for d in range(1,n+1):
        if n%d == 0:
            tmp += 1
    if tmp == 8:
        ans += 1
print(ans)

Submission status: Accepted

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


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

    ans = 0
    for i in range(1, n+1):
        if i % 2 == 0:
            continue
        div = []
        j = 1
        while j * j <= i:
            if i % j == 0:
                if i // j != j:
                    div.append(j)
                    div.append(i//j)
                else:
                    div.append(j)
            j += 1

        if len(div) == 8:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 
import math
import sys
import itertools
import numpy as np

# いっこ入力
n =int(input())

answer =0

for i in range(1,n+1):
    yakusuu = 0
    if i % 2 ==0:
        continue
    for j in range(1,n+1):
        if i % j == 0:
            yakusuu += 1
    if yakusuu == 8:
        answer += 1

print(answer)

Submission status: Accepted

Solution code:
n=int(input())

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

print(sum([1 for x  in table if x <= n]))

Submission status: Accepted

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

def main():
    n = int(input())
    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)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from math import sqrt

n = int(input())
# 平方数はパス
sq = [i*i for i in range(15)]

ans = 0
for num in range(2,n+1):
    cnt = 0
    if num in sq:
        pass
    else:
        for div in range(1,int(sqrt(num))+1):
            if num % div == 0:
                cnt += 1
                
        if cnt == 4 and num%2 == 1:
            ans += 1
            
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
cnt = 0
for i in range(1, n+1):
    tmp = 0
    if i % 2 == 1:
        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:
import math
def make_prime_list_2(num):
    if num < 2:
        return []

    # 0のものは素数じゃないとする
    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0 # 1は素数ではない
    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_2(num):
    if num <= 1:
        return False
    else:
        num_sqrt = math.floor(math.sqrt(num))
        prime_list = make_prime_list_2(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_1(num):
    if num < 0:
        return None
    elif num == 1:
        return 1
    else:
        num_sqrt = math.floor(math.sqrt(num))
        prime_list = make_prime_list_2(num_sqrt)

        divisor_num = 1
        for prime in prime_list:
            count = 1
            while num % prime == 0:
                num //= prime
                count += 1
            divisor_num *= count

        if num != 1:
            divisor_num *= 2

        return divisor_num

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

Submission status: Accepted

Solution code:
n=[int(k) for k in raw_input().split(" ")][0]
  
def gen_primes(n):
    """ Generate prime numbers until n
    """
    # Maps composites to primes witnessing their compositeness.
    # This is memory efficient, as the sieve is not "run forward"
    # indefinitely, but only as long as required by the current
    # number being tested.
    #
    D = {}
    Dr={}
    
    # The running integer that's checked for primeness
    q = 2
    while q<=n:
        if q not in D:
            # q is a new prime.
            # Yield it and mark its first multiple that isn't
            # already marked in previous iterations
            #
            Dr[q]=None
            D[q * q] = [q]
        else:
            # q is composite. D[q] is the list of primes that
            # divide it. Since we've reached q, we no longer
            # need it in the map, but we'll mark the next 
            # multiples of its witnesses to prepare for larger
            # numbers
            # 
            for p in D[q]:
                D.setdefault(p + q, []).append(p)
            del D[q]
        q += 1
    return Dr.keys()


def decompprime(n,primesorted):
    r={}
    j=0
    i=0
    while n>1 and i*i<n:
        i=primesorted[j]
        ri=0
        while n%i==0:
            n/=i
            ri+=1
        if ri>0:
            r[i]=ri
        j+=1
    if n>1:
        r[n]=1
    return r


def isqrt(x):
    if x < 0:
        raise ValueError('square root not defined for negative numbers')
    n = int(x)
    if n == 0:
        return 0
    a, b = divmod(n.bit_length(), 2)
    x = 2**(a+b)
    while True:
        y = (x + n//x)//2
        if y >= x:
            return x
        x = y
        
def divisors(dcp):
    nn=len(dcp)
    init={1:[0]*nn}
    dxs=sorted(dcp.keys())
    for kk in range(nn):
        k=dxs[kk]
        ninit={}
        kj=1
        for j in range(dcp[k]+1):
            for jj in init.keys():
                ninit[jj*kj]=init[jj][:]
                ninit[jj*kj][kk]+=j
            kj*=k
        init=ninit
     #   print init
    return init

ps=sorted(gen_primes(201))
res=0
for i in range(1,n+1,2):
    divs=divisors(decompprime(i,ps))
    if len(divs)==8:
       # print i
        res+=1
print res

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N):
    ans = 0

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

    return ans


def main():
    N = read_int()
    print(slv(N))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

ans = 0
for i in range(1, 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:
# B
N = int(input())
res = 0

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

Submission status: Accepted

Solution code:
n = int(input())
res  = 0
for i in range(5, n+1, 2):
    ge = set([])
    for j in range(1, i+1):
        if i % j == 0:
            ge.add(i)
            ge.add(j)
    if len(ge) == 8:
        res += 1
print(res)

Submission status: Accepted

Solution code:
def yakusuu(n):
    ANS=0
    for i in range(1,n//2+1):
        if n%i==0:
            ANS+=1

    if ANS==7:
        return 1
    else:
        return 0

N=int(input())

ANS=0

for i in range(1,N+1,2):
    if yakusuu(i)==1:
        ANS+=1

print(ANS)

Submission status: Accepted

Solution code:
n = int(input())
def factorization(n):
    def factor_sub(n, m):
        c = 0
        while n % m == 0:
            c += 1
            n /= m
        return c, n
    #
    buff = []
    c, m = factor_sub(n, 2)
    if c > 0: buff.append((2, c))
    c, m = factor_sub(m, 3)
    if c > 0: buff.append((3, c))
    x = 5
    while m >= x * x:
        c, m = factor_sub(m, x)
        if c > 0: buff.append((x, c))
        if x % 6 == 5:
            x += 2
        else:
            x += 4
    if m > 1: buff.append((m, 1))
    return buff
def divisor_num(n):
    a = 1
    for _, x in factorization(n):
        a *= x + 1
    return a
ans = 0
for i in range(1,n+1,2):
  d = divisor_num(i)
  if d == 8:
    ans +=1
print(ans)

Submission status: Accepted

Solution code:
# input
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())
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
    else:
        if cnt == 8:
            ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

N = int(input())

yaku = 0

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

print(yaku)

Submission status: Accepted

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

print(Cnt)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

#x,y = list(map(int,input().split()))	

n=int(input())

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

c=0
for i in A:
    if n<i:
        break
    else:
        c+=1
print(c)

#if :
#    print("Yes")
#else:
#    print("No")

Submission status: Accepted

Solution code:
count=0
n=int(input())
for i in range(1,n+1,2):
    k=1
    num=1
    while(k*k<=i):
        if(i%k==0):
            num+=1
        if(i//k!=i and i%(i//k)==0):
            num+=1
        k+=1
    if(num==8):
        count+=1
print(count)

Submission status: Accepted

Solution code:
n = int(input())

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

count = 0
for eight in eight_list:
    if n >= eight:
        count += 1

print(count)

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(1, N + 1, 2):
    p = make_divisor_list(i)
    if len(p) == 8:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
from math import ceil
N = int(input())

Ans = 0
for i in range(1,N+1):
    d = []
    limit = ceil(N**.5)
    for j in range(1,limit):
        if i//j == i/j:
            if j not in d:
                d.append(j)
            if i//j not in d:
                d.append(i//j)
    if len(d)==8 and i%2==1:
        Ans += 1

print(Ans)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
def f(a):
    r = 0
    for i in range(1,a+1):
        if a % i == 0:
            r += 1
    return r
for i in range(1, N+1):
    if i % 2 == 1 and f(i) == 8:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

    return count


print(abc106_b())

Submission status: Accepted

Solution code:
N = int(input())

ans = 0
for n in range(1, N+1):
    cnt = 0
    for d in range(1, n+1):
        if n % d == 0:
            cnt += 1
    if cnt == 8 and n % 2 != 0:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
ans = []
for i in range(9,201):
    if i%2 == 1:
        counter = 0
        for k in range(1,i+1):
            if i%k == 0:
                counter += 1
        if counter == 8:
            ans.append(i)

n = int(input())

answer = 0
for i in range(len(ans)):
    if n >= ans[i]:
        answer += 1
print(answer)