Problem:


Score: 200 points

Problem Statement

The number 105 is quite special - it is odd but still it has eight divisors.
Now, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusive)?

Constraints

N is an integer between 1 and 200 (inclusive).

Input

Input is given from Standard Input in the following format:

N

Output

Print the count.

Sample Input 1

105

Sample Output 1

1

Among the numbers between 1 and 105, the only number that is odd and has exactly eight divisors is 105.

Sample Input 2

7

Sample Output 2

0

1 has one divisor. 3, 5 and 7 are all prime and have two divisors. Thus, there is no number that satisfies the condition.



Sample input:
105


Sample output:
1

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def check(n):
    count = 0
    for i in range(1, n + 1):
        if(n % i == 0):
            count += 1
    if(count == 8 and n % 2 != 0):
        return True
    else:
        return False


n = int(input())
count = 0
for i in range(1, n + 1):
    if(check(i)):
        count += 1
print(count)

Submission status: Accepted

Solution code:
def make_divisors(n):
    a,b =[],[]
    i = 1
    while i*i<=n:
        if n%i == 0:
            a.append(i)
            if i != n//i:
                b.append(n//i)
        i+= 1
    return a+b[::-1]

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

Submission status: Accepted

Solution code:
import math
def prime(x):
  p = {}
  last = math.floor(x ** 0.5)
  if x % 2 == 0:
    cnt = 1
    x //= 2
    while x & 1 == 0:
      x //= 2
      cnt += 1
    p[2] = cnt
  for i in range(3, last + 1, 2):
    if x % i == 0:
      x //= i
      cnt = 1
      while x % i == 0:
        cnt += 1
        x //= i
      p[i] = cnt
  if x != 1:
    p[x] = 1
  return p


N = int(input())

ans = 0
for i in range(1, N + 1, 2):
  p = prime(i)
  t = 1
  for v in p.values():
    t *= v + 1
  if t == 8:
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
tmp = []
Cnt = []

for i in range(1, N+1):
    cnt = 0
    for j in range(1, i+1):
        if i % 2 != 0 and i % j == 0:
            cnt += 1
    tmp.append(cnt)
    if cnt == 8:
        Cnt.append(cnt)

print(len(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)
    return len(divisors)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N = int(readline())

    def enum_divisors(n):
        # 約数列挙

        divisors = []

        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                divisors.append(i)
                if i != n // i:
                    divisors.append(n // i)

        return divisors

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

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()

n=I()
if n<105:
    ans=0
elif n<135:
    ans=1
elif n<165:
    ans=2
elif n<189:
    ans=3
elif n<195:
    ans=4
else:
    ans=5
print(ans)

Submission status: Accepted

Solution code:
ans=0
n=int(input())
if n<105:
  print('0')
  exit()
else:
  for i in range(105,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:
def abc106b_105():
    n = int(input())
    cnt = 0
    for i in range(1, n + 1):
        if i % 2 == 0: continue
        yaku_cnt = 0
        for j in range(1, i + 1):
            if i % j == 0:
                yaku_cnt += 1
        if yaku_cnt == 8:
            cnt += 1

    print(cnt)


abc106b_105()

Submission status: Accepted

Solution code:
def make_divisors(n):
    lower, upper = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower.append(i)
            if i != n // i:
                upper.append(n//i)
        i += 1
    return lower + upper[::-1]

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

Submission status: Accepted

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

for i in range(1, n + 1, 2):
    j = 1
    cnt = 0
    
    while j*j <= i :
        if i % j == 0 :
            if j*j == i :
                cnt += 1
                
            else:
                cnt += 2
                
        j += 1
        
    if cnt == 8 :
        eight_cnt += 1
        
print(eight_cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
def input():
    return sys.stdin.readline()[:-1]

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

    ans = 0
    for i in range(1, 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)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def factors(n):
    d, res = 1, 0
    while d*d <= n:
        if n % d == 0:
            if d*d == n:
                res += 1
            else:
                res += 2
        d += 1
    return res


N = int(input())

ans = 0
for i in range(1,N+1,2):
    if factors(i) == 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:
N = int(input())
ans = 0
for i in range(1, N+1):
  if i % 2 == 0:
    continue
  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:
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1 
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())


ans_num = 0
for i in range(1, n+1):

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

print(ans_num)

Submission status: Accepted

Solution code:
N = int(input())

def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i * i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n // i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

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

Submission status: Accepted

Solution code:
N = int(input())
num=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
for i in range(1,N+1):
    ans=1
    if i%2==1:
        a=factorization(i)
        #print(a)
        for u in a:
            ans*=u[1]+1
        if ans==8:
            num+=1
print(num)

Submission status: Accepted

Solution code:
def is_target(num):
    count = 0
    for i in range(1, num+1):
        if num % i == 0:
            count += 1
    if count == 8:
        return True
    else:
        return False

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

    print(count)

Submission status: Accepted

Solution code:
def pr(x):
    cnt = 0
    for i in range(1, int(x**0.5)+1):
        if i**2 == x:
            cnt += 1
        elif x % i == 0:
            cnt += 2
    return cnt

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
def main():
    N = int(input())

    ans = 0
    for n in range(1, N + 1, 2):
        cnt = 0
        for divisor in range(1, N + 1):
            cnt += 0 if n % divisor else 1
        ans += 1 if cnt == 8 else 0
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())


def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


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())
cnts = 0

for i in range(1,n+1):
    cnt = 0

    for j in range(1,n + 1):
        if i % j == 0:
            cnt += 1
    if (cnt == 8)&(i%2 != 0):
        cnts += 1

print(cnts)

Submission status: Accepted

Solution code:
import math
from collections import Counter
n=int(input())



def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)

    return a
ans=0
for i in range(1,n+1):
  if i%2==0:
    continue
  s=Counter(prime_factorize(i))
  cnt=1
  for j in s.values():
    cnt*=j+1
    
    
  if cnt==8:
    ans+=1
    #print(s)
  else:
    continue
    
print(ans)

Submission status: Accepted

Solution code:
def make_table(N=200):
    import math
    import itertools
    table = [False for _ in range(N + 1)]
    A = list(range(3, math.ceil(math.sqrt(N)), 2))
    # x^1, y^1, z^1
    for x, y, z in itertools.combinations(A, 3):
        if x * y * z <= N:
            table[x * y * z] = True
    # x^3, y^1
    for x, y in itertools.combinations(A, 2):
        if x * x * x * y <= N:
            table[x * x * x * y] = True
    return table


def resolve():
    table = make_table()
    N = int(input())
    print(sum(table[:N + 1]))


resolve()

Submission status: Accepted

Solution code:
class PrimeFactor():

    def __init__(self, n):
        """
        エラトステネス　O(N loglog N)
        """
        self.n = n
        self.table = list(range(n+1))       # 最小素因数のリスト
        self.table[2::2] = [2]*(n//2)
        for p in range(3, int(n**0.5) + 2, 2):
            if self.table[p] == p:
                for q in range(p * p, n + 1, 2 * p):
                    if self.table[q] == q:
                        self.table[q] = p

    def prime_counter(self, x):
        """
        素因数分解（個数のリスト） O(logN)
        {素因数: 個数}　の形で返す
        """
        res = dict()
        if x < 2:
            return res
        while self.table[x] != 1:
            res[self.table[x]] = res.get(self.table[x], 0) + 1
            x //= self.table[x]
        return res

    def divisors_counter(self, x):
        """ 約数の個数　O((logN)^2) """
        res = 1
        for value in self.prime_counter(x).values():
            res *= (value+1)
        return res

N = int(input())
P = PrimeFactor(N)
res = 0
for i in range(1,N+1,2):
    if P.divisors_counter(i)==8:
        res += 1
print(res)

Submission status: Accepted

Solution code:
from math import ceil, sqrt

def prime_factorize_tuple(n):
    ret = []
    tmp = n
    for i in range(2, ceil(sqrt(n))):
        if tmp % i == 0:
            count = 0
            while tmp % i == 0:
                count += 1
                tmp //= i
            ret.append((i, count))

    if tmp != 1:
        ret.append((tmp, 1))

    if not ret:
        ret.append([n, 1])  # n = 1

    return ret

n = int(input())
ans = 0
for i in range(1, n + 1, 2):
    tmp = 1
    for prime, count in prime_factorize_tuple(i):
        tmp *= (count + 1)
    if tmp == 8:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
def make_divisors(n: int) -> list:
    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())
# print(f"{n}")

ans = 0
for i in range(1, n + 1, 2):
    divisors = make_divisors(i)
    if len(divisors) == 8:
        # print(f"{i} : {divisors}")
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n = inp()
ans = 0
for i in range(1,n+1,2):
    cnt = 0
    for div in range(1,i+1):
        if i % div == 0:
            cnt += 1
    if cnt == 8:
        ans +=1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
count = 0
#1の約数の数は絶対1、面倒なので2~Nのカウントにした。+1忘れないように
for i in range(2, N+1):
   for j in range(1, i+1):
      if i % j == 0:
         count += 1
   if count == 8 and i % 2 == 1:
      ans += 1
   count = 0

print(ans)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

p = [2*i+1 for i in range((n+1)//2)]
ans = 0
for i in p:
    j = 1
    cnt = 0
    while j <= i:
        if i%j == 0:
            cnt += 1
        j += 2
    if cnt == 8:
        ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys


def yakusu(i):

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

    return cnt


def main():
    N = int(sys.stdin.readline().rstrip())

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

    print(cnt)


main()

Submission status: Accepted

Solution code:
N = int(input())


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


ans = 0


for i in range(1, 1 + N, 2):
    temp = factorization(i)
    num = 1
    # print(i, temp)
    for x in temp:
        num = num * (x[1] + 1)

        if num == 8:
            ans += 1


print(ans)

Submission status: Accepted

Solution code:
n = int(input())

divs = [0] * (n + 1)
for i in range(1, (n + 1)):
    for j in range(i, (n + 1), i):
        divs[j] += 1

ans = 0

for idx, div in enumerate(divs):
    if div == 8 and idx % 2 == 1:
        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

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

print(ans)

Submission status: Accepted

Solution code:
N=int(input())

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
from sys import stdin
ans=0
c=0
N = int(input().rstrip())
for i in range(N):
  c=0
  i+=1
  if i%2==1:
    for j in range(i):
      j+=1
      if i%j==0:
        c+=1
  if c==8:
    ans+=1

print(ans)

Submission status: Accepted

Solution code:
#from functools import lru_cache
import sys
from itertools import product,combinations
from functools import reduce,lru_cache
import heapq

def vfunc(f): return lambda *lst, **kwargs: list(map(lambda *x:f(*x,**kwargs),*lst))

def list_t(l): return vfunc(lambda *args:args)(*l)

def rvfunc(f): return lambda *lst, **kwargs: list(map(lambda *x:rvfunc(f)(*x,**kwargs) if all(vfunc(lambda y:isinstance(y,list))(x)) else f(*x,**kwargs),*lst))

def reader():return vfunc(lambda l:l.split())(sys.stdin.readlines())

def factorization(n):
    out={}
    for i in range(2,int(n**0.5)+1):
        if n%i==0:
            out.update({i:0})
            while n%i==0:
                out[i]+=1
                n=int(n/i)
    if n != 1: out.update({n:1})
    return out

n=int(reader()[0][0])

dl = vfunc(lambda i:factorization(i))(range(1,n+1,2))
f = lambda d:reduce(lambda a,b:a*b,vfunc(lambda n:d[n]+1)(d)) if len(d)>1 else vfunc(lambda n:d[n]+1)(d)[0] if len(d)==1 else 0
s = vfunc(f)(dl)
#print(s)
print(len(list(filter(lambda a:a==8,s))))

Submission status: Accepted

Solution code:
import numpy as np
from sys import stdin
ans=0
c=0
N = int(input().rstrip())
for i in range(N):
  c=0
  i+=1
  if i%2==1:
    for j in range(i):
      j+=1
      if i%j==0:
        c+=1
  if c==8:
    ans+=1

print(ans)

Submission status: Accepted

Solution code:
# coding = SJIS

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:
#
# abc106 b
#
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """105"""
        output = """1"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """7"""
        output = """0"""
        self.assertIO(input, output)


def resolve():
    N = int(input())

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


if __name__ == "__main__":
    # unittest.main()
    resolve()

Submission status: Accepted

Solution code:
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

N = int(input())

ans = 0
for i in range(1, N+1):
    if i % 2 == 0:
        continue
    factor = factorization(i)
    c = 1
    for j in range(len(factor)):
        c *= (factor[j][1] + 1)
    if c == 8:
        ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

if n <= 104:
    print(0)
    exit()
else:
    res = 0
    for i in range(105,n+1,2):
        temp = 0
        for j in range(1,i+1):
            if i %j ==0:
                temp+=1
        if temp==8:
            res+=1
print(res)

Submission status: Accepted

Solution code:
n = int(input())
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]
cnt = 0
for i in range(1, n+1, 2):
    if len(make_divisors(i)) == 8:
        cnt +=1
print(cnt)

Submission status: Accepted

Solution code:
mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    N = int(input())
    ans = 0
    for i in range(1, N+1):
        if i&1:
            cnt = 0
            for d in range(1, i+1):
                if i%d==0:
                    cnt += 1
            if cnt == 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
        else:
            continue
    if cnt == 8:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
import sys
N = int(input())
L = [i for i in range(1, N+1) if i % 2 != 0]
ans = 0
if N < 105:
    print(0)
    sys.exit(0)
for num in L:
    counter = 1
    for i in range(1, num//2):
        if num % i == 0:
            counter += 1
    if counter == 8:
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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())
res = 0

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

Submission status: Accepted

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

print(res)

Submission status: Accepted

Solution code:
n = int(input())

def make_divisors(n):
    x = 0
    i = 1
    while i*i <= n:
        if n % i == 0:
            x += 1
            if i != n // i:
                x += 1
        i += 1
    return x

s = 0

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

print(s)

Submission status: Accepted

Solution code:
N = int(input())
ret = 0
if N <= 105:
    if N == 105:
        print(1)
    else:
        print(0)
    exit()

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

Submission status: Accepted

Solution code:
N = int(input())
ls = [i+1 for i in range(N)]

def divisor(n): 
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table
ii = 0
for i in ls:
    if i % 2== 0:
        continue
    else:
        if len(divisor(i)) == 8:
            ii += 1
print(ii)

Submission status: Accepted

Solution code:
n = int(input())

li = [3,5,7,11,13]
ans = 0
for i in range(1,n+1):
    cnt = 0
    for j in range(5):
        if i%li[j]==0:
            cnt += 1
    if cnt ==3:
        ans +=1

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

odds = [i for i in range(1, n+1, 1) if i%2 != 0]
cnt_lists = []
for j in odds:
    cnt = 0
    for k in range(1, j+1, 1):
        if j%k == 0:
            cnt += 1
    cnt_lists.append(cnt)

ans = cnt_lists.count(8)
print(ans)

Submission status: Accepted

Solution code:
import math
n=int(input())
t=0

for i in range(n):
    if (i+1)%2==0:
        continue
    else :
        s=0
        for j in range(i+1):
            if (i+1)%(j+1)==0:
                s+=1
        if s==8:
            t+=1
print(t)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import sqrt
N=int(input())
ans=0
for i in range(1,N+1,2):
  d=[]
  for j in range(1,int(sqrt(i))+1):
    if i%j==0:
      d.append(j)
      d.append(N//j)
  d=list(set(d))
  if len(d)==8:
    ans+=1
print(ans)

Submission status: Accepted

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


N = int(input())
ans = 0

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

Submission status: Accepted

Solution code:
N = int(input())

total = 0
for i in range(N-1):
    cnt = 0
    for j in range(N-i):
        if (N-i) % (N-i-j) == 0:
            cnt += 1 
    if cnt == 8 and (N-i) % 2 != 0:
        total += 1
print(total)

Submission status: Accepted

Solution code:
N = int(input())
p=0
if N < 105:
    print(0)
else:
    for n in range(1,  N+1, 2):
        ans = []
        for i in range(2, int(n**0.5)+1):
            while n % i == 0:
                ans.append(i)
                n //= i
        if n!=1:ans.append(n)

        A = 1
        sp = list(set(ans))
        for s in sp:
            A *= ans.count(s)+1
        if A == 8:
            p+=1

    print(p)

Submission status: Accepted

Solution code:
N = int(input())
count_all = 0
def count_yakusuu(N):
    count = 0
    for i in range(3, int(N/3)+1):
        if N % i == 0:
            count += 1
    if count == 6:
        return True
    else:
        return False
for k in range(N+1):
    if k % 2 == 1:
        if count_yakusuu(k):
            count_all += 1
print(count_all)

Submission status: Accepted

Solution code:
def yakusu(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]
N=int(input())
ans=0
for i in range(1,N+1,2):
  if len(yakusu(i))==8:
    ans+=1
print(ans)

Submission status: Accepted

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

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

    print(ans)


if __name__ == "__main__":
    main()