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:
#!/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()))

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

Submission status: Accepted

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

    return divisors

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:
n = int(input())
res = 0
for a in range(1, n + 1)[::2]:
  i = 1
  s = set()
  while i * i <= a:
    if a%i == 0:
      s.add(i)
      s.add(a//i)
    i += 1
  if len(s) == 8:
    res += 1
print(res)

Submission status: Accepted

Solution code:
import sys

def resolve():
    N = int(input())
    cnt = 0
    for i in range(1, N+1, 2):
        if is_8_factors(i):
            cnt += 1
    print(cnt)

def is_8_factors(n):
    nfactors = 2
    upper = n
    div = 3
    while True:
        if upper <= div:
            break
        if n % div == 0:
            nfactors += 2
            upper = n // div
        div += 2

    return True if nfactors == 8 else False

if '__main__' == __name__:
    resolve()

Submission status: Accepted

Solution code:
#Divisor
N=int(input())
ans=0
# 105からNまでの奇数の数
for i in range(105,N+1,2):
    cnt = 0
    # 1からNまでの約数をみつける
    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(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(1, N + 1, 2):
    count = 0
    n = 1
    while n * n <= i:
        if not i % n:
            if n * n == i:
                count += 1
            else:
                count += 2
        n += 2
    if count == 8:
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
def yakusuu(a):
  x=[]
  b=math.ceil(math.sqrt(a))
  for i in  range(1,b+1):
    if a%i==0:
      x.append((i,int(a/i)))
  return(x)
N=int(input())
oddlist=[i for i in range(1,N+1,2)]
ans=[]
for i in oddlist:
  x=yakusuu(i)
  if len(x)==4:
    ans.append(i)
print(len(ans))

Submission status: Accepted

Solution code:
from math import sqrt

N = int(input())

def div_count(n):
    count = 0
    for i in range(1,int(sqrt(n))+1):
        if n % i == 0:
            count += 2
    if n == int(sqrt(n))**2:
        count -= 1
    return count

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

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

        temp+=1
print(temp)

Submission status: Accepted

Solution code:
n = int(input())

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

print(len(total))

Submission status: Accepted

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

def cnt_divisors(n):
    divisor=[]
    for i in range(1,int(n**0.5)+1):
        if n%i ==0:
            divisor.append(i)
            if i != n//i:
                divisor.append(n//i)
    return len(divisor)
    
for i in range(1,n+1,2):
    if cnt_divisors(i)==8:
        ans+=1
        
print(ans)

Submission status: Accepted

Solution code:
N=int(input())

answer=0

for n in range(1,N+1,2):
    count=0
    for i in range(1,int(pow(n,1/2))+1):
        if n%i==0:
            if n//i!=i:
                count+=2
            else:
                count+=1
    if count==8:
        answer+=1

print(answer)

Submission status: Accepted

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


def solve(N: int):
    cnt = 0
    for i in range(1, N+1, 2):
        if len(make_divisors(i)) == 8:
            cnt += 1
    print(cnt)
    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)

    # divisors.sort()
    return divisors


# Generated by 1.1.6 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())
yakusuu8 = [135,189,105,165,195]
ans = 0

for i in range(1,n+1):
    if i in yakusuu8:
        ans += 1
        
print(ans)

Submission status: Accepted

Solution code:
n=int(input())

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

print(ans)

Submission status: Accepted

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

while i <= n:
    yakusuu = 0

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

    if yakusuu == 8:
        ans = ans + 1

    i = i + 2

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:
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:
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 31 09:15:46 2020

@author: black
"""
def check(x):
    div = [1]
    for j in range(1, x):
        if (x)%(j+1) == 0:
            div.extend([j+1])
    return len(div)




N = int(input())
ans = []

for x in range(1, N+1):
    if x%2 == 1:
        if check(x) == 8:
            ans.extend([x])


print(len(ans))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 31 02:12:27 2020

@author: liang
"""

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

Submission status: Accepted

Solution code:
def solve():
    n = int(input())
    ans = 0
    for i in range(1,n+1):
        if i%2==0:
            continue
        d = 0
        for j in range(1,i+1):
            if i%j==0:
                d+=1
        if d==8:
            ans+=1
    print(ans)
if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
def make_divisors(n):
    ans=0
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            ans+=1
            if i != n // i:
                ans+=1
    return ans

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

Submission status: Accepted

Solution code:
def num_factors(n):
    res = 1
    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
            res *= (cnt + 1)    
    if temp != 1:
        res *= 2
    if res == 1:
        res = 2    
    return res


N = int(input())
ans = 0
for n in range(3, N+1, 2):
  if num_factors(n) == 8:
    ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

cnt = 0
cnt2 = 0
for i in range(1, N+1, 2):
    cnt = 0
    for j in range(1, N+1):
        if j > i:
            break
        if i % j == 0:
            cnt += 1

    if cnt == 8:
        cnt2 += 1


print(cnt2)

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//2+1):
        if i % j == 0:
            count += 1
    if count == 7:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
n=int(input())

cnt=0

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

Submission status: Accepted

Solution code:
import math
n = int(input())
ans = 0
if n > 104:
    for i in range(105,n+1)[::2]:
        cnt = 0
        for j in range(1,math.ceil(i**0.5)):
            if i%j == 0:
                cnt += 2
            if j**2 == i:
                cnt -= 1
        if cnt == 8:
            ans += 1
print(ans)

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip() 

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

if __name__ == '__main__':
    resolve()

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 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:
import math
import copy
from copy import deepcopy
import sys
import fractions
# import numpy as np
from functools import reduce
# import statistics
import decimal
import heapq
import collections
import itertools
from operator import mul

sys.setrecursionlimit(100001)


# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

n = int(input())

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

    if tmp == 8:
        ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env/ python3
#S = input()
N = int(input())
#A, B, C = input().split()
#N, M = map(int, input().split())

#N = int(input())
#A = [int(x) for x in input().split()]

#H, W = map(int, input().split())
#S = [input() for _ in range(H)]
#print(S[0][1])

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):
    yakusu = 0
    for j in range(1, i+1):
        if i % j == 0:
            yakusu += 1

    if yakusu == 8:
        ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

# dict = {i:0 for i in range(N)}
dict = {}
for i in range(N+1):
    if i % 2 == 1:
        dict[i] = 0
        for j in range(1, N+1):
            if i % j == 0:
                dict[i] += 1
            else:
                continue
    else:
        continue
# print(dict)
count = 0
for i in dict.values():
    if i == 8:
        count += 1
    else:
        continue

print(count)

Submission status: Accepted

Solution code:
def make_divisors(n):
    divisors = []
    for i in range(1, int(pow(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):
    if i % 2 != 0:
        res = make_divisors(i)
        if res == 8:
            cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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


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

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc106/tasks/abc106_b


def solve(N):
    result = 0
    for x in range(1, N+1, 2):
        divisor_cnt = 0
        # print('x: {}'.format(x))
        for i in range(1, x+1, 2):
            # print('i: {}'.format(i))
            if x % i == 0:
                divisor_cnt += 1
        if divisor_cnt == 8:
            result += 1

    return result


if __name__ == "__main__":
    N = int(input())
    print(solve(N))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# p**7 は3**7がminでなし
# p1**3 * p2　は3**3 * 5,7=135,189のみ
# p1*p2*p3 は105,165,195
num_8 = [105,135,165,189,195]
n = int(input())
cnt = 0
for i in num_8:
  if i <= n:
    cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
cnt = 0
g = 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:
      g += 1
print(g)

Submission status: Accepted

Solution code:
n = int(input())

div8 = []
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:
        div8.append(i)

print(len(div8))

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc106/tasks/abc106_b

N = int(input())

import math
primes = []
p = [ x for x in range(2, math.floor(math.sqrt(N))+1) ]
while len(p) > 0:
    pi = p.pop(0)
    primes.append(pi)
    for pj in p:
        if pj % pi == 0:
            p.remove(pj)

primes.remove(2)

count = 0
# n = a^7
for a in primes:
    n = pow(a, 7)
    if n <= N:
        count += 1
# n = a^3 * b^1
for a in primes:
    for b in primes:
        if a == b:
            continue
        n = pow(a, 3) * pow(b, 1)
        if n <= N:
            count += 1
# n = a^1 * b^1 * c^1
for a in primes:
    for b in primes:
        for c in primes:
            if a >= b or b >= c:
                continue
            n = a * b * c
            if n <= N:
                count += 1

print(count)

Submission status: Accepted

Solution code:
#!python3

# input
N = int(input())


def prime_factor(x):
    m = {}
    i = 2
    while i ** 2 <= x:
        while x % i == 0:
            if i in m:
                m[i] += 1
            else:
                m[i] = 1
            x //= i
        i += 1
    if x != 1:
        m[x] = 1
    return m


def len_divisor(x):
    m = prime_factor(x)
    ans = 1
    for n in m.values():
        ans *= n + 1
    return ans        


def main():
    ans = 0
    for i in range(1, N + 1, 2):
        if len_divisor(i) == 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):
    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())

ans=0

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

Submission status: Accepted

Solution code:

n = int(input())
ans = 0

def count_div(i):
    ret = 0
    for j in range(1, i + 1):
        if i % j == 0:
            ret += 1
    
    return ret

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

Submission status: Accepted

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

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

print(cc)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

a = [3,5,7,11,13]
b = []
c = list(itertools.combinations([0, 1, 2, 3 , 4], 3))
for j in range(len(c)):
    b.append(a[c[j][0]] * a[c[j][1]] * a[c[j][2]])
c = list(itertools.combinations([0, 1, 2, 3 , 4], 2))
for j in range(len(c)):
    b.append(a[c[j][0]]**3 * a[c[j][1]])

ans = 0
for i in b:
    if n >= i:
        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 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:
def yaku(n):
	a=1
	p=[3,5,7,11,13]
	for i in p:
		j=0
		while n%i==0:
			n//=i
			j+=1
		a*=j+1
	return a
print(sum([1 for i in range(int(input())+1) if i%2==1 and yaku(i)==8]))

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:
def inpl():
    return list(map(int, input().split()))


def count(n):
    ret = 0
    for i in range(1, int(n**0.5) + 1):
        if n % i == 0:
            ret += 2
    return ret


N = int(input())

print(len([i for i in range(1, N + 1, 2) if count(i) == 8]))

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
N=int(input())
ans=0
for n in range(3,N+1)[::2]:
    count=0
    cor=int(n**0.5//1)
    for i in range(1,cor+1):
        if n/i==n//i:
            count+=2
    if cor==n/cor:
        count-=1
    if count==8:
        ans+=1
    #print(n,count)
print(ans)

Submission status: Accepted

Solution code:
def fn(a):
  alist =[]
  for i in range(1,a+1):
    if a%i == 0:
      alist.append(i)
  return len(alist)
n = int(input())
anslist =[]
for i in range(1,n+1):
  if fn(i) == 8 and i%2 == 1:
    anslist.append(i)
print(len(anslist))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import collections
import itertools as it
import math
import numpy as np

def yakusu(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 = input()
A = int(input())
# A = map(int, input().split())
# A = list(map(int, input().split()))
# A = [int(input()) for i in range(N)]
#
# c = collections.Counter()

c = 0
for n in range(1, A+1):
    if n % 2 == 1 and len(yakusu(n)) == 8:
        c += 1

print(c)

Submission status: Accepted

Solution code:
N = int(input())

count = 0
for i in range(1, N+1):
    yakusu_count = 0

    if i % 2 == 0:
        continue

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

    if yakusu_count == 8:
        count += 1

print(count)

Submission status: Accepted

Solution code:
from math import sqrt
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines


def prime_enumeration(n):
    div = 0
    for i in range(1, int(sqrt(n))+1):
        if n % i == 0:
            div += 1
            if n // i != i:
                div += 1

    return div == 8


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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())

L = []
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:
        L.append(i)
print(len(L))

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

Submission status: Accepted

Solution code:
N = int(input())

def calc_divisors(n):
  divisors = []
  for i in range(1, n//2+1):
    if n % i == 0:
      divisors.append(i)
  divisors.append(n)
  return divisors

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.buffer.readline
#input = sys.stdin.readline

def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))

# mod=10**9+7
# rstrip().decode('utf-8')
# map(int,input().split())

def main():
	n=II()
	li=[105,135,165,189,195]
	ans=0
	for i in range(n+1):
		if i in li:
			ans+=1
	print(ans)















if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
n = int(input())
ans = []
for i in range(1, n+1):
    cnt = 0
    if i%2==1:
        for j in range(1, i+1):
            if i%j==0:
                cnt += 1
    if cnt==8:
        ans.append(i)

print(len(ans))

Submission status: Accepted

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

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())

if N < 105:
    print(0)
    exit()
elif N == 105:
    print(1)
    exit()

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

print(ans)

Submission status: Accepted

Solution code:
import itertools
import math

N = int(input())
cnt = 0
listA = []
for i in range(3, int(math.sqrt(N)+1), 2):
    listA.append(i)
#print(listA)
listB = list(itertools.combinations(listA, 3))
#print(listB)
for listC in listB:
    seki = 1
    for x in listC:
        seki = seki * x
    if seki <= N:
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
A = [105, 135, 165, 189, 195]
print(sum([1 for a in A if a <= N]))

Submission status: Accepted

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

Submission status: Accepted

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

def divisor(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 odd in [i for i in range(1, n + 1, 2)]:
    # print('odd: {} divs: {}'.format(odd, divisor(odd)))
    if len(divisor(odd)) == 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, i+1):
        if i % j == 0:
            cnt += 1

    if cnt == 8 and i % 2 == 1:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())


def divisor_count(n):
    i = 1
    count = 0

    while(i * i <= n):
        if n % i == 0:
            count += 1
            if n != i * i:
                count += 1
        i += 1

    return count

result = 0
for i in range(1, n + 1):
    if i % 2 == 1 and divisor_count(i) == 8:
        result += 1

print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/python3
import sys
import re
from decimal import *

l = sys.stdin.readline()
#l = l.split(' ')
#l = [int(str) for str in l]
n = int(l)

tcount = 0
for i in range(3,n+1,2):
  count = 2
  for j in range(2,int(i+1/2)):
    if(i%j == 0):
      count += 1
  if(count == 8):
    tcount += 1

print(tcount)

sys.stdout.flush()

Submission status: Accepted

Solution code:
n = int(input())

cnt = [0] * n
for i in range(1, n+1):
  if i % 2 != 0:
    for j in range(1, i+1):
    	if i % j == 0:
          cnt[i-1] += 1

res = 0
for elem in cnt:
  if elem == 8:
    res += 1
print(res)

Submission status: Accepted

Solution code:
n=int(input())
def make_divisor_list(num):
    if num < 1:
        return []
    elif num == 1:
        return [1]
    else:
        divisor_list = []
        divisor_list.append(1)
        for i in range(2, num // 2 + 1):
            if num % i == 0:
                divisor_list.append(i)
        divisor_list.append(num)

        return divisor_list
cnt=0
for i in range(1,n+1,2):
    if len(make_divisor_list(i))==8:
        cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
def divi(x):
    d = []
    for i in range(1, int(x**0.5)+1):
        if x%i == 0:
            d.append(i)
            if i!=(x//i):
                d.append(x//i)
    return d
n = int(input())
ans = 0
for j in range(1, n+1, 2):
    if len(divi(j)) == 8:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
def divisor_all(n): # 約数全列挙
    l = [1,n]
    for i in range(2,int(pow(n,1/2))+1):
        if n % i == 0:
            if i == n//i:
                l.append(i)
            else:
                l.append(i)
                l.append(n//i)
    l.sort()
    return l # list
N = int(input())
ans = 0
for i in range(1,N+1,2):
    if len(divisor_all(i))==8:
        ans += 1
print(ans)

Submission status: Accepted

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


def main():
    n = int(input())
    ans = 0
    for i in range(1, n+1):
        if i % 2 != 0 and len(divisor(i)) == 8:
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()