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

Submission status: Accepted

Solution code:
from collections import Counter
import sys

sys.setrecursionlimit(10 ** 6)

mod = 1000000007
inf = int(1e18)

dx = [0, 1, 0, -1]
dy = [1, 0, -1, 0]


def inverse(a):
    return pow(a, mod - 2, mod)


def usearch(x, a):
    lft = 0
    rgt = len(a) + 1
    while rgt - lft > 1:
        mid = (rgt + lft) // 2
        if a[mid] <= x:
            lft = mid
        else:
            rgt = mid
    return lft

def isOk(n):
    a = 0
    for i in range(1, n+1):
        if n % i == 0:
            a += 1
    return a == 8

def main():
    n = int(input())
    ans = 0
    for i in range(1, n+1):
        if i % 2 == 0:
            continue
        if isOk(i):
            ans += 1

    print(ans)



main()

Submission status: Accepted

Solution code:
n=int(input())
odd_list=list(range(1,n+1,2))
#print(odd_list)
cnt=0
for i in odd_list:
    ind=0
    temp=0
    while True:
        if ind>=len(odd_list):break
        if i<odd_list[ind]:break
        if i%odd_list[ind]==0:temp+=1
        ind+=1
    if temp==8:
        cnt+=1
#print(odd_list)
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())

def divisors(n):
    re = 0
    for i in range(1,int(n**0.5)+1):
        if n % i == 0:
            if n == i**2:
                re += 1
            else:
                re += 2
    return re
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())

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

cnt = 0
cnt_cnt = 0


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

Submission status: Accepted

Solution code:
n=int(input())
ans = 0
for i in range(1,n+1):
    y = 0
    if i %2 == 1:
        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())
ans = 0
for j in range(1,n+1):
  if j %2 ==0:
    continue
  div = []
  for i in range(2,j+1):
    if j % i ==0:
      count = 0
      while j%i==0:
        j = j//i
        count += 1
      div.append(count)
    if j == 1:
      break
  if div == [1,1,1] or div == [1,3] or div ==[3,1]:
    ans += 1
    
print(ans)

Submission status: Accepted

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

def divs(n:int):
    divs = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divs.append(i)
            if i != n // i:
                divs.append(n//i)
    # divs.sort()
    return divs

for i in range(1,n+1,2):
    if len(divs(i)) == 8:
        count += 1
print (count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n = ii()

cnt = 0
for i in range(n,16,-1):
    if(i % 2 == 0):
        continue

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

print(cnt)

Submission status: Accepted

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

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

ans=0
for i in range(3,n+1,2):
    if judge(i)==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())
if n<105:
    print(0)
    exit()
ans=1
for i in range(106,n+1):
    if i%2==0:
        continue
    l=make_divisors(i)
    if len(l)==8:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

ans = 0
for x in range(1, N + 1, 2):
    d = 0
    for y in range(1, int(x ** 0.5 + 0.5) + 1):
        if x % y == 0:
            d += 1
            if y * y != x:
                d += 1
    if d == 8:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
import sys
from math import *
from collections import deque, Counter, defaultdict
from fractions import gcd
input = lambda: sys.stdin.readline().rstrip()

def eprint(s):
    sys.stderr.write('DEBUG: {}'.format(s))
    return

"""
約数を全列挙する
"""
# 参考: https://qiita.com/LorseKudos/items/9eb560494862c8b4eb56
def divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    
    return divisors

def main():
    n = int(input())
    cnt = 0

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

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 x in range(1,i+1):
        if i%x==0:
            cnt+=1
    if(cnt==8):
        ans+=1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

import numpy as np
import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
from bisect import bisect_left, bisect_right, insort_left, insort_right
from operator import itemgetter as ig
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
INF = float("INF")
mod = 10 ** 9 + 7
"""dd = [(-1, 0), (0, 1), (1, 0), (0, -1)];
ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)];
ddn9 = ddn + [(0, 0)]
for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:"""

def wi(): return list(map(int, sys.stdin.readline().split()))
def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]  # WideIntPoint
def ws(): return sys.stdin.readline().split()
def si(): return int(sys.stdin.readline())  # SingleInt
def ss(): return input()
def hi(n): return [si() for _ in range(n)]
def hs(n): return [ss() for _ in range(n)]  # HeightString
def s_list(): return list(input())
def mi(n): return [wi() for _ in range(n)]  # MatrixInt
def mip(n): return [wip() for _ in range(n)]
def ms(n): return [ws() for _ in range(n)]
def num_grid(n): return [[int(i) for i in sys.stdin.readline().split()[0]] for _ in range(n)]  # NumberGrid
def grid(n): return [s_list() for _ in range(n)]


def main():
    n = int(input())
    count = 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:
                count += 1
        else:
            continue

    print(count)
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,N+1):
        if i%j==0:
            cnt += 1
    if cnt==8:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

a =[]

for i in range(1,n+1):
  if i % 2 == 1:
    a.append(i)
    
ans = 0
for j in a:
  x=0
  for k in range(1,j+1):
    if j % k == 0:
      x += 1
    if x ==8:
      ans += 1
    else:
      continue
      
      
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

ans = 0

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

    else:
        cnt=0
        continue
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
N = int(input())
def div(n):
    cnt = 0
    N = n
    for i in range(1,N+1):
        if n % i == 0:
            cnt += 1
    if cnt == 8:
        return True
    else:
        return False

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

print(count)

Submission status: Accepted

Solution code:
n=int(input())

def div(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

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

Submission status: Accepted

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

    def sieve(n):
        prime=[]
        limit=n**0.5
        data=[i+1 for i in range(1,n)]
        while True:
            p=data[0]
            if limit<=p:
                return prime+data
            prime.append(p)
            data=[e for e in data if e%p!=0]
    
    primes=sieve(n+1)
    cnt=0
    for num in range(1,n+1,2):
        cnt_factor=1
        for p in primes:
            c=0
            while num%p==0:
                num//=p
                c+=1
            if c!=0:
                cnt_factor*=(c+1)
        if cnt_factor==8:
            cnt+=1
    print(cnt)
    
if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

counter = 0  

for i in range(1, n+1):
  if i%2!=0 and len([j for j in range(1,i+1) if i%j==0])==8:
    counter += 1
    
print(counter)

Submission status: Accepted

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

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, n+1, 2):
    arr = factorization(i)
    tmp = 1
    for j, cnt in arr:
        tmp *= (cnt + 1)
    if tmp == 8:
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#import math
#import bisect
#import numpy as np
import sys
input = sys.stdin.readline
MOD = 10**9 + 7
INF = float('INF')

def main():
    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__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

def factors(i):
    ans = []
    for j in range(1, i + 1):
        if i % j == 0:
            ans.append(j)
    return ans

count = 0
for i in range(3, N + 1, 2):
    fi = factors(i)
    # print(i, fi)
    if len(fi) == 8:
        count += 1
print(count)

Submission status: Accepted

Solution code:
# https://qiita.com/LorseKudos/items/9eb560494862c8b4eb56
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) :
    if i % 2 == 1 and make_divisors(i) == 8 :
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
l=[105,135,165,189,195]
for i in range(len(l)):
  if n<l[i]:
    print(i)
    exit()
print(len(l))

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

def divisor(n):
    div = set()
    i = 1
    while i ** 2 <= n:
        if n % i == 0:
            div.add(i)
            div.add(n // i)
        i += 1
    return len(div)

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

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

Submission status: Accepted

Solution code:
import sys

def divisor(i):
    count = 0
    for j in range(1, i + 1):
        if j ** 2 > i: break
        if i % j == 0:
            if j ** 2 == i: count += 1
            else: count += 2
    return count


def solve():
    N = int(input())
    ans = 0
    for i in range(1, N+1):
        if i % 2 > 0:
            if divisor(i) == 8: ans += 1
    print(ans)
    return 0

if __name__ == "__main__":
    solve()

Submission status: Accepted

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

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:
#python3
from math import floor, sqrt

def f(x):
    p = set()
    for i in range(1, floor(sqrt(x))+1):
        if x%i == 0:
            p.add(i)
            p.add(x//i)
    return len(p)
def main():
    n = int(input())
    cnt = 0
    for i in range(1, n+1):
        if i%2 != 0:
            if f(i) == 8:
                cnt += 1
    print(cnt)
main()

Submission status: Accepted

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

if (N >= 105):
    
    for num in range(105, N + 1, 2):

        divisor = []
        
        for i in range(1, num + 1):
            if (num % i == 0):
                divisor.append(i)
        
        if (len(divisor) == 8):
            cnt += 1

print(cnt)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N=int(input())
# candidate_prime_num = [3,5,7,11,13]
# cnt = 0
# LENGTH_CANDIDADE= len(candidate_prime_num)
# for idx1, x in enumerate(candidate_prime_num):
#
#     if idx1+1 > LENGTH_CANDIDADE:
#         continue
#
#     idx2 = idx1+1
#     for y in candidate_prime_num[idx2:]:
#
#         if idx2 + 1 > LENGTH_CANDIDADE:
#             continue
#         idx3 = idx2 +1
#         for z in candidate_prime_num[idx3:]:
#             if x* y * z <= N:
#                 cnt +=1
# print(cnt)
NUM_YAKUSU = 8
cnt_8_yakusu=0
for n in range(1,N+1,2):

    cnt_yakusu = 0
    for x in range(1,n+1,2):
        if n % x == 0:
            # print(n,x)
            cnt_yakusu+=1
    if cnt_yakusu == NUM_YAKUSU:
        cnt_8_yakusu +=1
print(cnt_8_yakusu)

Submission status: Accepted

Solution code:


import math
def solve():
  n = int(input())
  ans = 0
  for i in range(1,n+1):
    if i % 2 == 1:
      count = 0
      for j in range(1,i+1):
        if i % j == 0:
          count += 1
      if count == 8:
        ans += 1
  print(ans)
solve()

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))
    table.sort()
    return table

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

  if cnt == 8:
    res += 1

print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
#奇数
ki=[i for i in range(1,N+1,2)]
yakusuu=[]
ans=[]

for i in ki:
  for j in range(1,i+1):
    if i%j==0:
      yakusuu.append(j)
  else:
    ans.append(str(len(yakusuu)))
    yakusuu=[]

print(ans.count("8"))

Submission status: Accepted

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


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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())
if N < 105:
    print(0)
else:
    ans = 1
    for a in range(107, N+1, 2):
        tmp = 2
        for b in range(2, a//2):
            if a % b == 0:
                tmp += 1
        if tmp == 8:
            ans += 1
    print(ans)

Submission status: Accepted

Solution code:
import math
import copy
from operator import mul
from functools import reduce
from collections import defaultdict
from collections import Counter
from collections import deque
# 直積 A={a, b, c}, B={d, e}:のとき，A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B)
from itertools import product
# 階乗 P!: permutations(seq), 順列 {}_len(seq) P_n: permutations(seq, n)
from itertools import permutations
# 組み合わせ {}_len(seq) C_n: combinations(seq, n)
from itertools import combinations
from bisect import bisect_left, bisect_right
# import numpy as np

def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W

# 四方向: 右, 下, 左, 上
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]

def i_inpl(): return int(input())
def l_inpl(): return list(map(int, input().split()))
INF = float("inf")

######
# URL: https://atcoder.jp/contests/abc106/tasks/abc106_b
######

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    lista=[105,135,165,189,195]
    n=INT()
    ct=0
    for i in range(1,n+1,2):
        if i in lista:
            ct+=1
    print(ct)
if __name__ == '__main__':
    do()

Submission status: Accepted

Solution code:
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
import queue
import copy


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

#X = str(input()).split()
#a = [int(x) for x in input().split()]


N = int(input())
ans = 0


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

print(ans)

Submission status: Accepted

Solution code:
#nの約数列挙
#-------------------------------------------------------------------------
def divisor(n):
    ass = []
    for i in range(1,int(n**0.5)+1):
        if n%i == 0:
            ass.append(i)
            ass.append(n//i)
    return ass #sortされていない
#-------------------------------------------------------------------------
# テスト
N = int(input())
cnt = 0

for i in range(N+1):
    if i%2 == 1 and len(divisor(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)

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

def divisors(n):
    m = 1
    divs = []
    while m * m <= n:
        if n % m == 0:
            divs.append(m)
            if n != m * m:
                divs.append(n // m)
        m += 1
    divs.sort()
    return divs
  
N = int(read())

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

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

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

Submission status: Accepted

Solution code:
n = int(input())

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

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

Submission status: Accepted

Solution code:
# Code for B - 105
# Use input() to fetch data from STDIN
n = int(input())

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#ABC105-B
n = int(input())
divisor_list = []
divisor_length = 0
ans = 0
for i in range(1,n+1):
    divisor_list = []
    divisor_length = 0
    #odd,even判定
    if(i % 2 != 0):
        #約数をdivisor_listに追加していく
        for j in range(1,i+1):
            if (i % j == 0):
                divisor_length += 1
    if(divisor_length == 8):
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
#ABC105-B
n = int(input())
divisor_list = []
ans = 0
for i in range(1,n+1):
    divisor_list = []
    #odd,even判定
    if(i % 2 != 0):
        #約数をdivisor_listに追加していく
        for j in range(1,i+1):
            if (i % j == 0):
                divisor_list.append(j)
            if(len(divisor_list) == 8):
                ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin

mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))

n = ni()
ans = 0
for m in range(1, n+1, 2):
    div = set()
    for i in range(1, int(m**0.5)+1):
        if m % i == 0:
            div.add(i)
            div.add(m//i)
    if len(div) == 8:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
def is_odd(num):
    return num % 2 == 1


def divisors_count(num):
    return sum(num % i == 0 for i in range(1, num+1))


n = int(input())
print(sum([1 for i in range(1, n+1) if is_odd(i) and divisors_count(i) == 8]))

Submission status: Accepted

Solution code:
import sys, math
def input():
    return sys.stdin.readline()[:-1]
from itertools import permutations, combinations
from collections import defaultdict, Counter
from math import factorial
from bisect import bisect_left # bisect_left(list, value)
#from fractions import gcd

sys.setrecursionlimit(10**7)
N = int(input())

if N < 105:
    print(0)
    exit()

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    n = int(input())
    ans = 0
    for i in range(105, n + 1, 2):
        c = 0
        for j in range(1, i + 1):
            if i % j == 0:
                c += 1
        if c == 8:
            ans += 1
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
count=0
ans=0
for j in range(1,n+1,2):
  count=0
  for i in range(1,int(j**0.5)+1):
    if j%i==0:
      if j//i!=i:
        count+=2
      else:
        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):
  if i%2==0:
    continue
  tmp=0
  for j in range(1,n+1):
    if i%j==0:
      tmp+=1
  if tmp==8:
    ans+=1
print(ans)

Submission status: Accepted

Solution code:
n=int(input())

def yakusu(n):
    L=[]
    for i in range(1,int(n**0.5)+1):
        if n%i==0:
            if i not in L:
                L.append(i)
            if n//i not in L:
                L.append(n//i)
    return len(L)

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

print(c)

Submission status: Accepted

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