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:
#B
import math
N = int(input())
def make_prime_list_2(num):
    if num < 2:
        return []

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

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

        for non_prime in range(2 * prime, num, prime):
            prime_list[non_prime] = 0

    return [prime for prime in prime_list if prime != 0]
def 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
res = 0
for i in range(N+1):
    if search_divisor_num_1(i) == 8 and i % 2 == 1:
        res+=1
print(res)

Submission status: Accepted

Solution code:
# encoding: utf-8
N = int(input())

cnt = 0
primes = (3, 5, 7, 11, 13, 17) # if N_i-1 * N_i > 200: break

# a = 8
for prime in primes: cnt += int((prime ** 7 <= N))
               
# a = 4, b = 2
for prime_a in primes:
    M_a = prime_a ** 3
    if M_a > N: break
    for prime_b in filter(lambda x: x != prime_a, primes):
        M_b = M_a * (prime_b ** 1)
        if M_b > N: break
        else: cnt += 1
        
# a = b = c = 2
for prime_a in primes:
    M_a = prime_a ** 1
    if M_a > N: break
    for prime_b in filter(lambda x: x > prime_a, primes):
        M_b = M_a * (prime_b ** 1)
        if M_b > N: break
        for prime_c in filter(lambda x: x > prime_b, primes):
            M_c = M_b * (prime_c ** 1)
            if M_c > N: break
            else: cnt += 1

print(cnt)

Submission status: Accepted

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

N = int(input())

ans = 0
for i in range(N, -1, -1):
    if i % 2 != 0:
        # 約数の個数
        res = 0
        for j in range(1, i+1):
            if i % j == 0:
                res += 1
        if res == 8:
            ans += 1
print(ans)

Submission status: Accepted

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

N = int(input())

# 約数の個数
def divisor_num(n):
    res = 0
    for i in range(1, n+1):
        if n % i == 0:
            res += 1
    return res

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
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:
n=int(input())
b=[3*5*7, 3*5*9, 3*5*11, 27*7, 3*5*13]
a=0
for i in range(len(b)):
    if b[i]<=n:
        a+=1
print(a)

Submission status: Accepted

Solution code:
n = 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())
r = 0

for i in range(3, n + 1, 2):
    c = 1

    for j in range(3, i + 1, 2):
        if i % j == 0:
            c += 1

    if c == 8:
        r += 1

print(r)

Submission status: Accepted

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

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

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

    if c == 8:
        r += 1

print(r)

Submission status: Accepted

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

for i in range(0, n, 2):
    c = 0

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

    if c == 8:
        r += 1

print(r)

Submission status: Accepted

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

for i in range(n):
    c = 0

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

    if (i + 1) % 2 != 0 and c == 8:
        r += 1

print(r)

Submission status: Accepted

Solution code:
# coding: utf-8
    
def solve(N):
    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
    return ans
            
        
if __name__ == "__main__":
    N = int(input())
    print(solve(N))

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n = I()
    r = 0
    for i in range(1,n+1,2):
        t = 0
        for j in range(1,i+1,2):
            if i % j == 0:
                t += 1
        if t == 8:
            r += 1
    return r



print(main())

Submission status: Accepted

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


def main():
    n = int(input())
    odds = [i for i in range(1, 201) if i % 2 == 1]
    ans = 0

    for j in range(1, n + 1):
        count = 0

        for odd in odds:
            if j % odd == 0:
                count += 1

        if count == 8:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from itertools import product

N = int(input())

A = [n for n in range(1, N + 1) if n % 2 == 1]

cntOuter = 0
for n1 in A:
    cntInner = 0
    for n2 in [n for n in A if n <= n1]:
        if n1 % n2 == 0:
            cntInner += 1
    if cntInner == 8:
        cntOuter += 1

print(cntOuter)

Submission status: Accepted

Solution code:
N=int(input())
ans=0
for i in range(3,N+1,2):
    count=1
    for p in range(1,i,2):
        if i % p ==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:
a,c=int(input()),0
for b in [105,135,165,189,195]:
  if a>=b:c+=1

print(c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

answer = 0

for m in range(1, n+1):
    if m % 2 == 0:
        continue

    d = [1, m]

    for i in range(2, m//2 + 1):
        if m % i == 0:
            d.append(i)

    if len(d) == 8:
        answer += 1

print(answer)

Submission status: Accepted

Solution code:
from collections import defaultdict as dd
from functools import reduce
d=[2,3,5,7,11,13,17,19,23,29,31]
cd=len(d)

def f(n):
  i=0
  pr=dd(int)
  while i<cd and n//d[i]!=0:
    while i<cd and n%d[i]==0:
      pr[d[i]]+=1
      n=n//d[i]
    i+=1
  
  if pr.values():
    return reduce(lambda x,y:x*y,map(lambda x:x+1,pr.values()))
  else:
    return 0

n=int(input())
print(sum([1 for i in range(1,n+1,2) if f(i)==8]))

Submission status: Accepted

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

if n >= 1 and n <= 104:
    print(0)

elif n >= 105 and n <= 134:
    print(1)

elif n <= 164:
    print(2)

elif n <= 188:
    print(3)

elif n <= 194:
    print(4)

else:
    print(5)

Submission status: Accepted

Solution code:
N = int(input())
# 200以下で正の約数をちょうど8個持つ数
have_8divisors = [105, 135, 165, 189, 195]
# リストの何番にNを挿入できるか。そのインデックスが解
for k, v in enumerate(have_8divisors):
    if N < v:
        ans = k
        break
else:
    ans = len(have_8divisors)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
sosuu = [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]
ans = 0
for i in range(1,n+1,2):
    r = []
    tmp = 0
    for j in sosuu:
        tmp = 0
        while i%j==0:
            tmp += 1
            i //= j
        r.append(tmp)
    rr = 1
    for i in r:
        rr *= i+1
    if rr==8:
        ans += 1
    #print(r)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
list = [0] * 99 #3~199
for i in range(99):
    for j in range(i, 99, i * 2 + 3):
        list[j] += 1
print(list[:(n - 1) // 2].count(7))

Submission status: Accepted

Solution code:

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

n = int(input())
cnt=0
for i in l:
    if i <= n:
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
N = int(input())

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

print(result)

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:
def solv(x):
    if x % 2 == 0:
        return -1
    count = 0
    for i in range(1, x+1):
        if x % i == 0:
            count += 1
    return count


N = int(input())
ans = 0
for i in range(1, N+1):
    if solv(i) == 8:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
def func(m):
    return sum([m%i==0 for i in range(1, m+1)])
N = int(input())
print(sum([func(i)==8 for i in range(1, N+1, 2)]))

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:
from sys import stdin
def cnt(n):
 if n%2==0:
  return 0
 ans = 0
 for i in xrange(1,n+1):
  if n%i==0:
   ans+=1
 return ans
n = int(stdin.readline())
res = 0
for i in xrange(1,n+1):
 if cnt(i)==8:
  res+=1
print res

Submission status: Accepted

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

# var
ans = 0

def judge(n):
	# var
	i = 1
	dic = set()

	while i ** 2 <= n:
		if n % i == 0:
			dic.add(i)
			dic.add(n // i)
		i += 1
	return len(dic) == 8

for i in range(1, N + 1, 2):
	ans += judge(i)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def d(K):
    res=0
    for i in range(1,K+1):
        if K%i==0:
            res+=1
    return res

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

Submission status: Accepted

Solution code:
N = int(input())

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

c = 0
for i in range(1, N+1):
    if cnter(i) == 8 and i % 2 != 0:
        c += 1

print(c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
yakusu = [0 for _ in range(201)]
for i in range(1, 200+1):
    for j in range(1, 200+1):
        if i*j>200:
            continue
        yakusu[i*j] += 1

N = int(input())
ans = 0
for i in range(1, N+1, 2):
    if yakusu[i] == 8:
        ans += 1
print(ans)

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

Submission status: Accepted

Solution code:
def d(K):
    res=0
    for i in range(1,K+1):
        if K%i==0:
            res+=1
    return res

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
N=int(input())
x=[105, 135, 165, 189, 195]

X=[N-x[i] for i in range(len(x))]
XX=np.where(np.array(X) < 0) 
if N<195:
  print(XX[0][0])
else:
  print(5)

Submission status: Accepted

Solution code:
N = int(input())
x = []
res = 0
for i in range(3, N+1, 2):
    if len(x) == 0:
        x.append(i)
    else:
        y = i
        z = {}
        flag = True
        while flag:
            flag = False
            for j in x:
                if y % j == 0:
                    y /= j
                    z.setdefault(j, 0)
                    z[j] += 1
                    flag = True
        if y == i:
            x.append(i)
        else:
            yakusu = 1
            for j in z.values():
                yakusu *= j + 1
            if yakusu == 8:
                res += 1
print(res)

Submission status: Accepted

Solution code:
from math import sqrt
from functools import reduce
from operator import mul

# 素因数分解
def factoring(n):
    f_list = [0 for _ in range(n + 1)]

    i = 2
    while n != 1:
        if n % i == 0:
            n /= i
            f_list[i] += 1

        else:
            i += 1

    return f_list

# 1 3 5 7 15 21 35 105
# 3 5 7
if __name__ == '__main__':
    n = int(input())
    targets = list(filter(lambda x: x % 2 != 0, range(1, n + 1)))

    count = 0
    for t in targets:
        s = reduce(mul, map(lambda x: x + 1, filter(lambda x: x != 0, factoring(t))), 1)
        if s == 8:
            count += 1

    print(count)

Submission status: Accepted

Solution code:
from collections import Counter

N = int(input())

if N <= 2:
    print(0)
else:
    count = 0
    for ii in range(3, N+1, 2):
        s = ii
        num = []
        for jj in range(3, s+1, 2):
            if s % jj == 0:
                s = s // jj
                num.append(jj)
                break
        if s == 1:
            continue
        for jj in range(num[-1]+2, s+1, 2):
            if s % jj == 0:
                s = s // jj
                num.append(jj)
                break
        if s == 1:
            continue
        for jj in range(num[-1]+2, s+1, 2):
            if s % jj == 0:
                count += 1
                break
    print(count)

Submission status: Accepted

Solution code:
import math

def divisorGenerator(n):
    large_divisors = []
    for i in range(1, int(math.sqrt(n) + 1)):
        if n % i == 0:
            yield i
            if i*i != n:
                large_divisors.append(n / i)
    for divisor in reversed(large_divisors):
        yield divisor

n = int(input())
output = 0
for i in range(1, n + 1):
	if(i % 2 != 0):
		if(len(list(divisorGenerator(i))) == 8):
			output += 1
		
print(output)

Submission status: Accepted

Solution code:
# vim: set fileencoding=utf-8 :

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

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

    ans = 0
    for i in range(1, n + 1)[::2]:
        a = cal_yakusuu(i)
        if a:
            ans += 1

        i += 1

    print(ans)


def cal_yakusuu(odd):
    ret = False
    ct = 0
    for i in range(1, odd + 1):
        if odd % i == 0:
            ct += 1
            if ct > 8:
                ret = False

    if ct == 8:
        ret = True

    return ret


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
if N <=104:
    print(0)
    
elif N <= 106:
    print(1)

else:
    if N%2 != 0:
        num = list(range(105, N+1))
        kotae = list(range(1, N+2, 2))
    else:
        num = list(range(105, N))
        kotae = list(range(1, N, 2))
        
    num = num[::2]
    ans = [0] * len(num)
    
    for index, i in enumerate(num):
        for t in kotae:
            if i%t ==0:
                ans[index] += 1
    print(len([1 for x in ans if x>=8]))

Submission status: Accepted

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

Submission status: Accepted

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

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

for i in range(1,n+1,2):
    if(count_divisor(i) == 8):
        result+=1
print(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:
n=int(input())
print(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)

Submission status: Accepted

Solution code:
from bisect import bisect_right

n = int(input())

print(bisect_right([105, 135, 165, 189, 195], n))

Submission status: Accepted

Solution code:
import math
import functools

def find_divisor(n):
    sqrt = math.ceil(math.sqrt(n))
    divisors = {}
    target = n
    for i in range(2, sqrt):
        while target % i == 0:
            target = target // i
            if i in divisors:
                divisors[i] += 1
            else:
                divisors[i] = 1
    return divisors


N = int(input())
counter = 0

for i in range(1, N + 1):
    if i % 2 == 0:
        continue
    divisors = find_divisor(i)
    values = divisors.values()
    if divisors and functools.reduce((lambda x, y: x * y), map(lambda x: x + 1, values)) == 8:
            counter += 1

print(counter)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def num_divisors(n):
    return sum(n%(i+1)==0 for i in range(n))
n=int(input())
print(sum(num_divisors(k)==8 for k in range(1,n+1,2)))

Submission status: Accepted

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

Submission status: Accepted

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

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())
count=0
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:
#!/usr/bin/env python

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

sys.setrecursionlimit(10000000)
N = input()

if N < 105:
    print 0
elif N < 135:
    print 1
elif N < 165:
    print 2
elif N < 189:
    print 3
elif N < 195:
    print 4
else:
    print 5

Submission status: Accepted

Solution code:
#107b
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)
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:
# -*- coding: utf-8 -*-

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

if N < 105:
    print(0)
else:
    ans = 0
    for i in range(N, 104, -1):
        if i % 2 != 0:
            tmp = divisor_num(i)
            if tmp == 8:
                ans += 1
    print(ans)

Submission status: Accepted

Solution code:
def divisors_num(x):
    foo = 0
    p = 1
    while p * p <= x:
        if x % p == 0:
            q = x / p
            if p != q:
                foo += 2
            else:
                foo += 1
        p += 1
    return foo

def main():
    n = int(raw_input().strip())
    foo = 0
    for k in xrange(1, n + 1, 2):
        if divisors_num(k) == 8:
            foo += 1
    print foo

if __name__ == '__main__':
    main()

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_2(num):
    if num < 0:
        return None
    elif num == 1:
        return 1
    else:
        divisor_num = 1
        dict_fact = prime_factorization_2(num)
        for value in dict_fact.values():
            divisor_num *= (value + 1)
        return divisor_num
 
eight_list = []
for i in range(100):
    ii = i * 2 + 1
    if search_divisor_num_2(ii) == 8:
        eight_list.append(ii)
 
n = int(input())
use_list = [1 for i in eight_list if i <= n]
print(sum(use_list))

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]

if __name__ == "__main__":
    N = int(input())
    if (N < 105):
        print(0)
    elif (N < 107):
        print(1)
    else:
        c = 1
        for j in range(107, N+1):
            num = j
            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

            if divisor_num == 8 and j % 2 == 1:
                c = c + 1

            if j == N:
                print(c)

Submission status: Accepted

Solution code:
N = int(input())

if N < 105:
  print(0)
else:
  print(len([i for i in range(105, N+1) if len([j for j in range(1, i+1, 2) if i%j == 0]) == 8]))

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
rr = [0 for _ in range(n)]
rrr = 0

for i in range(n):
    for k in reversed(range(i + 1)):
        if (i + 1) % (k + 1) == 0:
            rr[i] += 1

    if (i + 1) % 2 != 0 and rr[i] == 8:
        rrr += 1

print(rrr)

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 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 = count + 1
    if count == 8:
        ans = ans + 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=int(input())
if a<105:print(0)
else:
    print(sum([1 for i in range(105,a+1,2) if len([I for I in range(1,a+1,2) if i%I==0])==8]))

Submission status: Accepted

Solution code:
n=int(input())
count=0
if n>=105:
    count=count+1
if n>=135:
    count=count+1
if n>=165:
    count=count+1
if n>=189:
    count=count+1
if n>=195:
    count=count+1
print(count)

Submission status: Accepted

Solution code:
x=int(input())
if(x<105):
    print ("0")
elif(x==105):
    print ("1")
else:
    f=1
    for j in range(107,x+1):
        if(j % 2 != 0):
            c=0
            for i in range(1, j + 1):
                if j % i == 0:
                    c=c+1
            if(c==8):
                f=f+1
    print(f)

Submission status: Accepted

Solution code:
n = int(input())
a = 0
if n >= 105:
    a += 1
if n >= 135:
    a += 1
if n >= 165:
    a += 1
if n >= 189:
    a += 1
if n >= 195:
    a += 1
print(a)

Submission status: Accepted

Solution code:
def fac(num):
    count = 0
    for i in range(1, num+1):
        if num % i == 0:
            count += 1
    return count
N = int(input())

C = 0
for i in range(1, N+1, 2):
    if fac(i) == 8:
        C += 1

print(C)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

n = int(input())

def devisors(z):
    r = 0
    for i in range(1, z + 1):
        if z % i == 0:
            r += 1
    return r 

r = 0

for i in range(1, n+1):
    if i % 2 == 1 and devisors(i) == 8:
        r += 1

print(r)

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:
N=int(input())
co=0
a=0
for j in range(1,N+1):
	if j%2==1:
		for i in range(1,j+1):
			if j%i==0:
				co=co+1
	if co==8:
		a=a+1
	co=0
print(a)

Submission status: Accepted

Solution code:
N=int(input())
r=0
for Q in range(1,N+1):
    k=0
    for i in range(1,Q+1):
        if Q%i==0:
            k=k+1
 
    if k==8:
        if Q%2==1:
            r=r+1
print(r)

Submission status: Accepted

Solution code:
N = int(input())
c=[3*5*7, 3*3*3*5, 3*5*11,  3*3*3*7, 3*5*13]
a=0
for num in c:
    if num <= N:
        a=a+1
print(a)

Submission status: Accepted

Solution code:
N = int(input())
count = 0
result = 0
for i in range(1, N+1):
  if i % 2 != 0:
    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:
# -*- coding: utf-8 -*-
N = int(input())

if N < 105:
    ans = 0
else:
    ans = 1
    for i in range(107, 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)