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:
def solve(n,i,flg):
    if n%i != 0:
        return flg
    else:
        flg += 1
    return solve(int(n/i),i,flg)
if __name__ == '__main__':
    
    n = int(input())
    if n <= 104:
        print(0)
    
    else:
            
        so = [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]
        count = 0
        for k in range(104,n+1):
            if k%2 == 1:
                cnt_list = []
                for j in so:
                    cnt = solve(k,j,0)
                    cnt_list.append(cnt)
                cnt_list.sort(reverse=True)
                
                if (cnt_list[0:4] == [7,0,0,0]) or (cnt_list[:4] == [3,1,0,0]) or (cnt_list[:4] == [1,1,1,0]) :
                    count += 1
                
        
        print(count)

Submission status: Accepted

Solution code:
N = int(input())

num8 = 0
for i in range(1,N+1,2):
    dividend = i
    divisor = 2
    count = 0
    while dividend != 1 and divisor <= (i//2):
        if dividend % divisor == 0:
            dividend = dividend // divisor
            count += 1

        divisor += 1
    
    if count == 3:
        num8 += 1

print(num8)

Submission status: Accepted

Solution code:
# 入力
N=int(input())

# 集計用変数
ans=0

for i in range(1,N+1):
  # 約数の個数
  c=0

  # 奇数の場合のみ見る
  if i%2==1:
    for j in range(1,i+1):
      # 割り切れたら約数
      if i%j==0:
        c+=1

    # ちょうど8個の場合はカウント
    if c==8:
      ans+=1

# 出力
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
	
def main():
	N = int(input())
	
	ans = 0
	for i in range(1, N+1, 2):
		tmp = make_divisors(i)
		if len(tmp) == 8:
			ans += 1
	
	print(ans)
	
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
	
if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
def divisible_count(n):
    # 約数の個数
    divisors = 0
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors += 1
            if i != n // i:
                divisors += 1
    return divisors


n = int(input())
print(sum(divisible_count(x) == 8 for x in range(1, n+1, 2)))

Submission status: Accepted

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

for i in range(1,n+1):
  if i%2==1:
    d_list=make_divisors(i)
    if len(d_list)==8:
      count+=1

print(count)

Submission status: Accepted

Solution code:
def judge(n):
	lst = []
	for i in range(1, n+1):
		if n%i == 0: lst.append(i)
	if len(lst) == 8: return True
	return False

N = int(raw_input())
index = 1
cnt = 0
while index <= N:
	if judge(index): cnt += 1
	index += 2
print cnt

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# 素因数分解
N = int(input())
ans = 0
s = 0
for i in range(1,N+1,2):
    L = i
    divisors=[0]*(i+1)
    cnt = 1
    # 素因数分解
    for j in range(2,N+1):
        while True:
            if L % j == 0:
                divisors[j] += 1
                L //= j
                if L == 1:
                    s = 1 #1はこれ以上素因数を産まない
                    break
            else:
                break

    for div in divisors:
        cnt *= (div+1)
    if cnt == 8:
        ans += 1
    # print(i,cnt,ans,divisors)

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
s={3,5,7,11,13}
l=[]
for i in range((n+1)//2):
    x=2*i+1
    count=0
    for j in s:
        if x%j==0:
            count+=1
    if count==3:
        l.append(x)
    elif x==27*5 or x==27*7:
        l.append(x)
print(len(l))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def md(n):
    d=[]
    da=d.append
    for i in range(1,int(n**0.5)+1):
        if n%i==0:
            da(i)
            if i!=n//i:da(n//i)
    return len(d)

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

Submission status: Accepted

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

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




def solve(N: int):
    cnt = 0
    for i in range(1,N+1,2):
        if isSpecial(i):
            cnt += 1
    print(cnt)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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())
cnt2 = 0
for n in range(1,N+1,2):
    cnt = 0
    for i in range(1,N+1,2):
        if n % i == 0:
            cnt += 1
    if cnt == 8:
        cnt2 += 1
print(cnt2)

Submission status: Accepted

Solution code:
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    cnt = 0
    n = f()[0]
    for i in range(1,n+1):
        cnt_divisor = 0
        if i%2 == 0:
            continue
        for j in range(1, i+1):
            if i%j == 0:
                cnt_divisor += 1
        
        if cnt_divisor == 8:
            cnt += 1
    
    print(cnt)

solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
int_list = []
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:
        int_list.append(i)
print(len(int_list))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

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

Submission status: Accepted

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

    # divisors.sort()
    return divisors





n = int(input()) 


l = list(range(n + 1))[1::2]

num = 0
for i in l:
    if len(make_divisors(i)) == 8:
        num += 1

print(num)

Submission status: Accepted

Solution code:
N = int(input())

def 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

counter = 0
for n in range(1, N+1):
    if len(divisors(n)) == 8 and n % 2 == 1:
        counter += 1
print(counter)

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

N = int(stdin.readline().rstrip())

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
B - 105
https://atcoder.jp/contests/abc106/tasks/abc106_b

"""
import sys


def divisor(N):
    divisors = set()
    for i in range(1, int(N**0.5)+1):
        if N % i == 0:
            divisors.add(i)
            divisors.add(N // i)
    return divisors


def solve(N):
    ans = 0
    for i in range(1, N+1, 2):
        if len(divisor(i)) == 8:
            ans += 1
    return ans


def main(args):
    N = int(input())
    ans = solve(N)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Accepted

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

print(result)

Submission status: Accepted

Solution code:
def factor(x):
    ans = []
    for i in range(1, x+1):
        if x % i ==0:
            ans.append(i)
    return sorted(ans)
n = int(input())
count = 0
if n < 105:
    print(count)
else:
    for i in range(105, n+1,2):
        if len(factor(i))==8:
            count +=1
    print(count)

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 divisors

count = 0
for i in range(1, N+1, 2):
    ylist = make_divisors(i)
    if len(ylist) == 8:
        count += 1

print(count)

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:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

n = int(input())
count = 0
for i in range(n):
    if (i+1) % 2 != 0: 
        divisors = make_divisors(i+1)
        if len(divisors) == 8:
            count += 1

print(count)

Submission status: Accepted

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

    # divisors.sort()
    return divisors
n = int(input())
counter = 0
for i in range(1,n+1):
  if i %2 == 1 and len(make_divisors(i)) == 8:
    counter += 1
    
print(counter)

Submission status: Accepted

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

    # divisors.sort()
    return divisors

N = int(input())

if N < 105:
    print(0)
    exit()
cnt = 1
for i in range(107, N+1, 2):
    divisors = make_divisors(i)
    if len(divisors) == 8:
        cnt += 1
print(cnt)

Submission status: Accepted

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

    # divisors.sort()
    return divisors

a = int(input())
count = 0
for i in range(a+1):
    b = make_divisors(i)
    if len(b) == 8 and i % 2 != 0:
        count += 1
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
cd = [0] * N
for i in range(1, N+1):
    for j in range(i, N+1):
        if j % i == 0:
            cd[j-1] += 1
print(cd[::2].count(8))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
###############################################################################

from sys import stdout
from bisect import bisect_left as binl
from copy import copy, deepcopy
from collections import defaultdict


mod = 1


def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return tuple(map(int, input_tuple))


def intina():
    return [int(i) for i in input().split()]


def intinl(count):
    return [intin() for _ in range(count)]


def modadd(x, y):
    global mod
    return (x + y) % mod


def modmlt(x, y):
    global mod
    return (x * y) % mod


def lcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


def combination(x, y):
    assert(x >= y)

    if y > x // 2:
        y = x - y

    ret = 1

    for i in range(0, y):
        j = x - i
        i = i + 1

        ret = ret * j
        ret = ret // i

    return ret


def get_divisors(x):
    retlist = []
    for i in range(1, int(x**0.5) + 3):
        if x % i == 0:
            retlist.append(i)
            retlist.append(x // i)
    return retlist


def get_factors(x):
    retlist = []
    for i in range(2, int(x**0.5) + 3):
        while x % i == 0:
            retlist.append(i)
            x = x // i
    retlist.append(x)
    return retlist


def make_linklist(xylist):
    linklist = {}
    for a, b in xylist:
        linklist.setdefault(a, [])
        linklist.setdefault(b, [])
        linklist[a].append(b)
        linklist[b].append(a)
    return linklist


def calc_longest_distance(linklist, v=1):
    distance_list = {}
    distance_count = 0
    distance = 0
    vlist_previous = []
    vlist = [v]
    nodecount = len(linklist)

    while distance_count < nodecount:
        vlist_next = []
        for v in vlist:
            distance_list[v] = distance
            distance_count += 1
            vlist_next.extend(linklist[v])
        distance += 1
        vlist_to_del = vlist_previous
        vlist_previous = vlist
        vlist = list(set(vlist_next) - set(vlist_to_del))

    max_distance = -1
    max_v = None
    for v, distance in distance_list.items():
        if distance > max_distance:
            max_distance = distance
            max_v = v

    return (max_distance, max_v)


def calc_tree_diameter(linklist, v=1):
    _, u = calc_longest_distance(linklist, v)
    distance, _ = calc_longest_distance(linklist, u)
    return distance


###############################################################################


def main():
    n = intin()

    count = 0

    for i in range(1, n + 1):
        divs = get_divisors(i)
        divs = set(divs)
        if i % 2 and len(divs) == 8:
            count += 1

    print(count)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

ans = 0
for i in range(1,N+1):
    count = 0
    for j in range(1, N+1, 2):
        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)
else:
    if N < 135:
        print (1)
    else:
        if N < 165:
            print (2)
        else:
            if N < 189:
                print (3)
            else:
                if N < 195:
                    print (4)
                else:
                    print (5)

Submission status: Accepted

Solution code:
import math
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
    
    return num

N = int(input())
if N == 105:
    print("1")
    exit()
elif N < 105:
    print("0")
    exit()
lists = []
cnt = 1
for i in range(106,N+1):
    if i % 2 == 1:
        if num_divisors_trial_division(i) == 8:
            cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
if n<105:
  print(0)
  exit()

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


if __name__=='__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:

N=int(input())
if N<105:
  print(0)
elif 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:
#from itertools import combinations
# l = [3,5,7,9,11,13,15]
# ll = []
# for a,b,c in combinations(l, 3):
#     ll += [a*b*c]
#
# print(sorted(ll))

N = int(input())
nums = [105, 135, 165, 189, 195]

ans = 0
for i in nums:
    if i <= N:
        ans += 1
    else:
        break

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

count = 0
for n in range(1, N+1, 2):
    count_fact = 0
    for i in range(1, n+1):
        if n%i == 0:
            count_fact += 1
    else:
        if count_fact == 8:
            count += 1

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
A=[]
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:
        A.append(i)
print(len(A))

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
a =[]
for i in range(1,n+1):
  if i%2 == 1:
    a.append(i)
for i in a:
  cnt = 0
  for j in range(1,max(a)+1):
    if i%j == 0:
      cnt +=1
  if cnt == 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


N = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())
match = [105, 135, 165, 189, 195]
ans = 0

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

Submission status: Accepted

Solution code:
from math import sqrt,ceil
N=int(input())
if N<105:
    print("0")
    exit()
ans=0
for n in range(105,N+1):
    cnt=0
    if n%2==0:
        continue
    for i in range(1,ceil(sqrt(n))):
        if n%i==0:
            cnt+=1
    if cnt==4:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
from math import sqrt,ceil
N=int(input())
if N<105:
    print("0")
    exit()
ans=0
for n in range(105,N+1):
    cnt=0
    if n%2==0:
        continue
    for i in range(1,n+1):
        if n%i==0:
            cnt+=1
    if cnt==8:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
import math

N = int(input())

ans = 0
for n in range(1, N + 1):
    if n % 2 != 0:
        yaku = 0
        for m in range(1, n + 1):
            if n % m == 0:
                yaku += 1

        if yaku == 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
  
  if cnt == 8:
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
n = int ( input())
ans = 0
test = (3,5,7,11,13)
for i in range ( 105,n+1,2) :
  div = 0
  for d in test :
    if i % d == 0 :
      div += 1
  if div == 3 and i % 9 != 0:
    ans += 1
  elif i % 27 == 0:
    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 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())
a=[i for i in range(n+1) if i%2==1]
def cal(k):
  num=0
  for l in range(1,k+1):
    if k%l==0:
      num+=1
  return num
    
ans=0
for j in range(len(a)):
  if cal(a[j])==8:
    ans+=1
print(ans)

Submission status: Accepted

Solution code:
def divisors(x):
    c = 0
    for i in range(1, x+1):
        if x % i == 0:
            c += 1

    return c


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

    if divisors(m) == 8:
        count += 1

print(count)

Submission status: Accepted

Solution code:
def cnt_factor(n):
    if (n ** 0.5) % 1 == 0:
        return 0
    c = 0
    for d in range(1, int(n ** 0.5) + 1):
        if n % d == 0:
            c += 1
    return c * 2


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

Submission status: Accepted

Solution code:
N = int(input())

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

print(eight_number)

Submission status: Accepted

Solution code:
from functools import reduce


def prime_factor(n):
  if n == 1:
    return [(1, 1)]
  results = []
  for i in range(2, n + 1):
    if n % i == 0:
      c = 0
      while n % i == 0:
        n //= i
        c += 1
      results.append((i, c))
  return results


def count_divisors(n):
  pf = prime_factor(n)
  return reduce(lambda x, y: x * y, [x[1] + 1 for x in pf])


if __name__ == "__main__":
  N = int(input())
  count = 0
  for i in range(1, N + 1, 2):
    if count_divisors(i) == 8:
      count += 1

  print(count)

Submission status: Accepted

Solution code:
n = int(input())
if n < 105:
    print(0)
elif n == 105:
    print(1)
else:
    ans = 1
    for i in range(106,n+1):
        if i%2!=0:
            yaku = 0
            for j in range(1,i+1):
                if i%j==0:
                    yaku+=1
            if yaku == 8:
                ans+=1
    print(ans)

Submission status: Accepted

Solution code:
print(sum([sum([i % j == 0 for j in range(2, i)]) == 6 for i in range(105, int(input()) + 1, 2)]))

Submission status: Accepted

Solution code:
import sys
import math
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

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]
    
n = int(input())
count =0
for i in range(1,n+1,2):
    tmp = search_divisor_num_1(i)
    if tmp == 8:
        count+=1
print(count)

Submission status: Accepted

Solution code:
n=int(input())
ans=0
for j in range(1,n+1,2):
    l=[]
    for i in range(1,j+1):
        if j%i==0:
            l.append(j//i)
    if len(l)==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, N+1, 2):
        if(i%j == 0):
            cnt += 1
    if(cnt == 8):
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
def yakusu(a):
    c = 0
    for i in range(1,a+1):
        if a%i==0:
            c += 1
    return c
n=int(input())
m=0
for i in range(1,n+1):
    if i%2==1 and yakusu(i)==8:
        m += 1
print(m)

Submission status: Accepted

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

    # divisors.sort()
    return divisors


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

Submission status: Accepted

Solution code:
N = int(input().strip())

# 約数列挙
def divisor(n):
  result = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      result.append(i)
      if i != n // i:
        result.append(n//i)
  return result

count = 0
for j in range(1,N+1):
  if j % 2 == 0:
    continue
  if len(divisor(j)) == 8:
    count += 1
print(count)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
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 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 num(fct):
    a = 1
    for base, exponent in fct:
        a = a * base**exponent
    return a

n=int(input())
C=[]
cnt=0
for i in range(3,n+1,2):
    fct = factorize(i)
    for div in divisorize(fct):
        C.append(num(div))
    if len(C)==8:
        cnt+=1
    C=[]
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
if N >= 3*5*13:
    ans = 5
elif N >= 3*7*9:
    ans = 4
elif N >= 3*5*11 :
    ans = 3
elif N >= 3*5*9 :
    ans = 2
elif N >= 3*5*7 :
    ans = 1
else:
    ans = 0

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
l = []
cnt = 0

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

Submission status: Accepted

Solution code:
N = int(input())

O=[]
for i in range(1,N+1):
  if i%2 == 1:
    O.append(i)
  else:
    continue

c = 0
for i in O:
  a = 1
  b = 0
  while a <= i:
    if i%a == 0:
      b += 1
      a += 1
    else:
      a += 1
  if b == 8:
    c += 1
  else:
    continue
    
print(c)