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:
## coding: UTF-8
from decimal import *
from itertools import permutations, combinations,combinations_with_replacement,product
import math


#input
#N
#A1 A2 ... AN
N = int(input())


#約数を表示　計算量sqrt(n)
#IFの判断をサボることで余計な計算量を入れないような作りになっています。
def yakusuu(n):
    #約数全列挙
    l = []
    border = int(math.sqrt(n))
    #print(border) #ここまでしか考えなくて良い
    for i in range(1, border+1):
        #print(i)
        if(n % i == 0):
            l.append(i)
            l.append(int(n/i))
    if(l[-1] == l[-2]):
        del l[-1]
    return l

counter = 0
for i in range(1, N+1, 2):
    #print(i)
    if(len(yakusuu(i)) == 8):
        counter += 1

print(counter)

Submission status: Accepted

Solution code:
n = int(input())
dp = [1]*(n + 1)
ans = 0
# エラストテネスの箒
for i in range(2, n + 1):
    div = 1
    while i * div <= n:
        dp[i * div] += 1
        div += 1
# dp[1]から１個飛ばしで表示
print(dp[1::2].count(8))

Submission status: Accepted

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

def f(x):
    res = 0
    for i in range(1,x+1):
        if x % i == 0:
            res += 1
    return res
 
n = I()
ans = 0
for i in range(1,n+1):
    if i % 2:
        if f(i) == 8:
            ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())


def check(n):
    ans=0
    for i in range(1,n+1):
        if n%i==0:
            ans+=1
    if ans==8:
        return True
    return False

ans=0
for i in range(1,n+1,2):
    if check(i):
        ans+=1
print(ans)

Submission status: Accepted

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

for j in range(a+1):
    count = 0
    for i in range(j+1):
        if i>=1:
            if j % i==0:
                count += 1
                
    if count == 8:
        
        if (j+1)%2==0:
            ans+=1

print(ans)

Submission status: Accepted

Solution code:
def has_eight_elements(n):
    if n%2 == 1 and sum([int(n%i==0) for i in range(1,n+1)]) == 8:
        return 1
    else:
        return 0
    
print(sum([has_eight_elements(x) for x in range(1,int(input())+1,2)]))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())

def cnt_yakusu(s):
    cnt = 0
    for i in range(1, s+1):
        if s % i == 0:
            cnt += 1
    return cnt
    
ans = 0
for i in range(1,n+1):
    if cnt_yakusu(i) == 8 and i % 2 == 1:
        ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

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

    if cnt==8:
        ans+=1

print(ans)

Submission status: Accepted

Solution code:
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(10 ** 9)


def main():
    N = int(input())
    if N < 105:
        print(0)
        return

    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

    cnt = 1
    for n in range(106, N + 1):
        if n % 2 == 1:
            d = make_divisors(n)
            if len(d) == 8:
                cnt += 1
    print(cnt)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr

if n >= 105:
  for i in range(105,n+1,2):
    chk = factorization(i)
    t = 1
    for j in chk:
      t *= (j[1]+1)
    if t == 8:
      ans += 1

print(ans)

Submission status: Accepted

Solution code:
mod = 10 ** 9 + 7
mod2 = 2 ** 61 + 1
from collections import deque
import heapq
import time
from bisect import bisect_left, insort_left, bisect_right
import sys
import random
import itertools

input = sys.stdin.readline
_NUMINT_ALL = list(range(10))
_START_TIME = time.time()


def main():
    ans = solve()

    if ans is True or ans is False:
        YesNo(ans)
    elif ans is not None:
        print(ans)


def solve():

    N = iip()[0]

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

        if ny == 8:
            #print(j)
            ans += 1

    print(ans)




#####################################################ライブラリ集ここから




def kiriage_warizan(a, b):
    return -(-a//b)


def iip(listed=True):  # 数字のinputをlistで受け取る
    d = input().rstrip("\n").split()
    try:
        ret = [int(i) for i in d]
    except:
        ret = [int(i) if i in _NUMINT_ALL else i for i in d]
        if len(ret) == 1 and listed is False:
            return ret[0]

    if len(ret) == 1 and not listed:
        return ret[0]
    return ret

def iipt(l, listed=True, num_only=True):  # 縦向きに並んでいるデータをリストに落とし込む(iip利用)
    ret = []
    for i in range(l):
        ret.append(iip(listed=listed))
    return ret


def saidai_kouyakusuu(A):  # 最大公約数
    l = len(A)
    while True:
        m = min(A)
        mx = max(A)
        if m == mx:
            return m

        for i in range(l):
            if A[i] % m == 0:
                A[i] = m
            else:
                A[i] %= m

def time_debug_10percent():
    a = random.randint(0, 9)
    if a == 9:
        sys.exit()

def time_debug(t):
    time.sleep(_START_TIME + t - time.time())
    sys.exit()


def make_graph_edge_flat(N):  # グラフ作成のための辺をリストで返す
    ret = []
    for i in range(N-1):
        a, b, c = iip()
        a -= 1
        b -= 1
        ret[a].append((b, c))
        ret[b].append((a, c))
    return ret


def sort_tuples(l, index):  # タプルのリストを特定のインデックスでソートする
    if isinstance(l, list):
        l.sort(key=lambda x: x[index])
        return l
    else:
        l = list(l)
        return sorted(l, key=lambda x: x[index])


def count_elements(l):  # リストの中身の個数を種類分けして辞書で返す
    d = {}
    for i in l:
        if i in d:
            d[i] += 1
        else:
            d[i] = 1
    return d


def safeget(l, index, default="exception"):  # listの中身を取り出す時、listからはみ出たり
    if index >= len(l):                      # マイナスインデックスになったりするのを防ぐ
        if default == "exception":
            raise Exception("".join(["safegetに不正な値 ", index, "が渡されました。配列の長さは", len(l), "です"]))
        else:
            return default
    elif index < 0:
        if default == "exception":
            raise Exception("".join(["safegetに不正な値 ", index, "が渡されました。負の値は許可されていません"]))
        else:
            return default
    else:
        return l[index]


def sortstr(s):  # 文字列をソートする
    return "".join(sorted(s))


def iip_ord(startcode="a"):  # 文字列を数字の列に変換する(数字と文字は1:1対応)
    if isinstance(startcode, str):
        startcode = ord(startcode)
    return [ord(i) - startcode for i in input()]


def YesNo(s):  # TrueFalseや1, 0をYesNoに変換する
    if s:
        print("Yes")
    else:
        print("No")


def fprint(s):  # リストを平たくしてprintする(二次元リストを見やすくしたりとか)
    for i in s:
        print(i)


def bitall(N):  # ビット全探索用のインデックスを出力
    ret = []
    for i in range(2 ** N):
        a = []
        for j in range(N):
            a.append(i % 2)
            i //= 2
        ret.append(a)
    return ret

def split_print_space(s):  # リストの中身をスペース区切りで出力する
    print(" ".join([str(i) for i in s]))


def split_print_enter(s):  # リストの中身を改行区切りで出力する
    print("\n".join([str(i) for i in s]))


def soinsuu_bunkai(n):  # 素因数分解
    ret = []
    for i in range(2, int(n ** 0.5) + 1):
        while n % i == 0:
            n //= i
            ret.append(i)
        if i > n:
            break
    if n != 1:
        ret.append(n)
    return ret


def conbination(n, r, mod, test=False):  # nCrをmodを使って計算する
    if n <= 0:
        return 0
    if r == 0:
        return 1
    if r < 0:
        return 0
    if r == 1:
        return n
    ret = 1
    for i in range(n - r + 1, n + 1):
        ret *= i
        ret = ret % mod

    bunbo = 1
    for i in range(1, r + 1):
        bunbo *= i
        bunbo = bunbo % mod

    ret = (ret * inv(bunbo, mod)) % mod
    if test:
        # print(f"{n}C{r} = {ret}")
        pass
    return ret


def inv(n, mod):  #  modnにおける逆元を計算
    return power(n, mod - 2)


def power(n, p, mod_=mod):  # 繰り返し二乗法でn**p % modを計算
    if p == 0:
        return 1
    if p % 2 == 0:
        return (power(n, p // 2, mod_) ** 2) % mod_
    if p % 2 == 1:
        return (n * power(n, p - 1, mod_)) % mod_


def nibutan_func(func, target, left, right, side="left"): # 関数を二分探索
    l = left
    r = right
    x = (l + r) // 2
    while r-l > 1:
        x = (l+r)//2
        if func(x) == target:
            return x
        elif func(x) > target:
            r = x
        else:
            l = x

    if side == "left" or func(x) == target:
        return l
    else:
        return r


def nibutan_list(list_, target, side="left"):  # リストを二分探索
    if not isinstance(list_, list):
        list_ = list(list_)

    l = 0
    r = len(list_)
    x = (l + r) // 2
    while r-l > 1:
        x = (l+r)//2
        if list_[x] == target:
            return x
        elif list_[x] > target:
            r = x
        else:
            l = x

    if side == "left" or list_[x] == target:
        return l
    else:
        return r


class UfTree():
    def __init__(self, maxnum):
        self.parent = list(range(maxnum))
        self._size = [1] * maxnum
        self.rank = [0] * maxnum

    def size(self, a):
        return self._size[self.root(a)]

    def root(self, a):
        rank = 0
        cur = a
        while True:
            if self.parent[cur] == cur:
                #for i in path: # 経路圧縮
                #    self.parent[i] = cur
                return cur
            else:
                self.parent[cur] = self.parent[self.parent[cur]]
                cur = self.parent[cur]
                rank += 1

    def unite(self, a, b):
        ra = self.root(a)
        rb = self.root(b)
        if ra == rb:
            return self

        self._size[ra] += self._size[rb]
        self.parent[rb] = ra
        return self

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
count=0 #個数
for i in range(1,n+1):
    count_yakusu=0 #約数の個数
    for j in range(1,i+1):
        if i%j==0:
            count_yakusu+=1
    if count_yakusu == 8 and i%2==1:
        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

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

        if div_count == 8:
            answer += 1

print(answer)

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

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

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

Submission status: Accepted

Solution code:


import collections


def solve():

    N = int(input())

    def GetDivider(num):
        cnt = 0
        for i in range(1, num+1):
            if num % i == 0:
                cnt += 1

        return cnt

    ans = 0

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

    print(ans)


if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
import math

def countPrimeNum(n):
  count = 0
  max = math.ceil(math.sqrt(n)) + 1
  for i in range(1, max):
    if n % i == 0:
      if n / i == i:
        count = count + 1
      else:
        count = count + 2
  return count

n = int(input())
count = 0
for i in range(1, n + 1):
  if i % 2 == 1:
    if countPrimeNum(i) == 8:
      count = count + 1

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
def prime(n,p):
  cnt = 0
  while n%p == 0:
    n //= p
    cnt += 1
  return cnt,n
ans = 0
for i in range(1,N+1,2):
  tmp = 1
  t = i
  for p in range(2,i):
    num,t = prime(t,p)
    tmp *= (num+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):
    cnt = 0
    for j in range(1, n + 1):
        if i % j == 0:
            cnt += 1
    
    if cnt == 8:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
def divisor(num):
    
    ret = 0
    for i in range(1, num+1):
        if(num%i == 0): ret += 1
    
    return ret

n = int(input())

if(n <= 105):
    if(n==105): print(1)
    else: print(0)
    exit()

res = 1
for i in range(106, n+1):
    if(divisor(i) == 8 and i%2==1): res += 1

print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
def ok(x):
    res = 0
    i = 1
    while i*i <= x:
        if x%i == 0:
            res+=1
            if i!=x//i:res+=1
        i+=1
        
    return res == 8
for i in range(1,n+1,2):
    ans+=ok(i)
print(ans)

Submission status: Accepted

Solution code:
t = 0

def div(n):
    c = 0
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            c += 2 if i != n // i else 1
    return c

for i in range(1, int(input()) + 1, 2):
    if div(i) == 8:
        t += 1

print(t)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

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

Submission status: Accepted

Solution code:
N = int(input())

def get_divisor_num(n):
    cnt = 0
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            cnt += 1
            if n // i != i:
                cnt += 1

    return cnt

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

print(cnt)

Submission status: Accepted

Solution code:
N = int(input())

def prime_factorization(n):
    originaln = n
    result = []
    f = 2
    while f*f <= originaln+10:
        a = 0
        while n%f ==0:
            n = n//f
            a = a+1
            # print(f,a,n)
        if a!=0:
            # result.append([f,a])
            result.append(a)
        f = f+1
    # print(result)
    ans = 1
    for i in result:
        ans *= (i+1)
    # print("ans is ",ans)
    if ans == 8:
        return True
    else:
        return False

finalans = 0
for i in range(2,N+1):
    if prime_factorization(i) == True and i%2 == 1:
        # print("bingo",i)
        finalans +=1
print(finalans)
# for i in range(N):
#     ans = 0
#     if prime_factorization(i) == True:
#         ans = ans + 1
    
# print(result)
# print(ans)

Submission status: Accepted

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

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
result = 0

for i in range(1,n+1,2):
    if i > 200:
        break
    #print(i)
    if len(make_divisors(i)) == 8:
        result += 1
    

print(result)

Submission status: Accepted

Solution code:
n = int(input())

def yak(n):
  lis = []
  for i in range(1,n+1):
    if n%i==0: lis.append(i)
  return lis

cnt = 0
for i in range(1, n+1):
  if i%2==1:
    l = len(yak(i))
    if l == 8:
      cnt += 1
      
print(cnt)

Submission status: Accepted

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

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

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
    num = 0
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

ans = 0

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

Submission status: Accepted

Solution code:
N = int(input())

def yaku(n):
    c = 0
    for i in range(1,n+1,2):
        if n % i == 0:
            c += 1
    if c == 8:
        return True
    else:
        return False

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

print(count)

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = False

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()
ans = 0
for i in range(1, n + 1, 2):
    arr = make_divisors(i)
    if len(arr) == 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
    j = 1
    while True:
        if j**2 == i:
            cnt += 1
            break
        if j**2 > i:
            break
        if i % j == 0:
            cnt += 2
        j += 1
    if cnt == 8:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

def factorize(x):
    results = []
    for i in range(1, x+1):
        if i*i == x:
            results.append(i)
            break
        if i*i > x:
            break
        else:
            if x % i == 0:
                results.append(i)
                results.append(x // i)
    return results

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

Submission status: Accepted

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

solution()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
count = 0
for z in range(1,n+1):
	if not z%2 or z <= 104:
		continue
	y = 0
	for i in range(1,z+1):
		if z%i == 0:
			y += 1	
	if y == 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 len(divisors)
  
ans = 0

for i in range(1,N+1):
  a = make_divisors(i)
  if a ==8 and i%2 == 1 :
    ans += 1
    
print(int(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 len(divisors)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools
import math
import sys
import heapq
from collections import Counter
from collections import deque
from fractions import gcd
INF = 1 << 60
sys.setrecursionlimit(10 ** 6)

#ここから書き始める
n = int(input())
ans = 0
for i in range(1, n + 1, 2):
    cnt = 0
    d = 1
    while d <= i:
        if i % d == 0:
            cnt += 1
        d += 1
    if cnt == 8:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque
from decimal import *


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


if __name__ == '__main__':
    s = int(input())
    ans =0

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
for i in range(1,N+1,2):
  a = 0
  for j in range(1,i+1):
    if i % j == 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):
    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:
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
 
def main():
  n = int(input())
  ans = 0
  cnt = 0
  
  for i in range(1,n+1,2):
    ans = 0
    for j in range(1,i+1):
      if i%j == 0:
        ans+=1
    if ans == 8:
      cnt += 1
  print(cnt)
if __name__ == '__main__':
  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 len(divisors)

def Yakusu(n):

    ans = 0

    for i in range(1 , n + 1 , 2):
        if make_divisors(i) == 8:
            ans += 1

    return ans

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

for i in range(1,N+1):
    li= []
    for j in range(1,i+1):
        if i % j == 0 and(i%2 != 0):
            li.append(i)
        else:pass
    if len(li) == 8:ans+=1
print(ans)

Submission status: Accepted

Solution code:
def getyakusu(V):
    if V%2==0:
        return 0
    c=0
    for i in range(1,V+1):
        if V % i ==0:
            c+=1
    return 1 if c==8 else 0


def resolve():
    N=int(input())
    print(sum(map(getyakusu,range(1,N+1))))


if __name__ == "__main__":
    resolve()

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())


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


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

Submission status: Accepted

Solution code:
N = int(input())

answer=0
count=0
 
for i in range(1,N+1,2):
    for j in range(1,int(i**0.5)+1):
        if i%j==0:
            count+=1
    if count==4:
        answer+=1
    count=0
 
print(answer)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
l=list(range(1,n+1))
k=[105,135,165,189,195]
lk=set(l) & set(ｋ)
print(len(lk))

Submission status: Accepted

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

    # divisors.sort()
    return divisors

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

Submission status: Accepted

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