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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for _ in range(j)] for _ in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from itertools import accumulate #list(accumulate(A))

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

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):
    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:
import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def printlist(lst, k='\n'): print(k.join(list(map(str, lst))))
INF = float('inf')

def solve():
    n = II()

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



if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
n = int(input())
cnt = 0
for i in range(1, n + 1,2):
    temp = 0
    j = 1
    while j * j <= i:
        if i % j == 0:
            temp += 1
            if j != i // j:
                temp += 1
        j += 1
    if temp == 8:
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())

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

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def divisor_counter(n):
    cnt = 0
    if n % 2 == 0:
        return 0
    for i in range(1,n+1):
        if n % i == 0:
            cnt += 1
    if cnt == 8:
        return 1
    else:
        return 0
    

n = int(input())
cnt = 0
for i in range(1,n+1):
    cnt += divisor_counter(i)
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())


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

    # divisors.sort()
    return divisors


count = 0

for x in range(N + 1):
    num_len = len(make_divisors(x))
    if x % 2 == 1 and num_len == 8:
        count += 1
print(count)

Submission status: Accepted

Solution code:
N = int(input())

nums = range(1, N+1, 2)

res = 0
for n in nums:
    i = 1
    for x in range(1,n):
        if (n // (x)) * (x) == n:
            i = i + 1
    if i == 8:
        res += 1

print(res)

Submission status: Accepted

Solution code:
N = int(input())
result = 0
for i in range(1, N + 1, 2):
    counter = 0
    for j in range(1, int(i ** 0.5) + 1):
        if i % j == 0:
            counter += 1
            if j != i // j:
                counter += 1
    if counter == 8:
        result += 1
print(result)

Submission status: Accepted

Solution code:
n = int(input())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return(divisors)
ans = 0
for i in range(1,n+1,2):
  if len(make_divisors(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)
    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 = []
cnt = 0

for i1 in range(1,N+1,2):
  for i2 in range(1,i1+1):
    if (i1/i2)-(i1//i2) == 0:
      cnt=cnt+1
  ans.append(cnt)
  cnt = 0
print(ans.count(8))

Submission status: Accepted

Solution code:
from sys import stdin
input = stdin.readline

# map(int, input().rstrip().split())

def VI(N, init=0):
  return [init for _ in range(N)]
def VVI(N, M, init=0):
  return [[init for _ in range(M)] for _ in range(N)]

def VD(N, init=0.0):
  return [init for _ in range(N)]
def VVD(N, M, init=0.0):
  return [[init for _ in range(M)] for _ in range(N)]

def Divisor(n):
  ret = []
  for i in range(1, n+1):
    if i*i > n:
      break
    else:
      if n % i == 0:
        ret.append(i)
        if i*i != n:
          ret.append(n//i)
  ret.sort()
  return ret

N = int(input().rstrip())
ans = 0
for i in range(1, N+1):
  divs = Divisor(i)
  if (len(divs) == 8) and (i&1) :
    ans += 1

print(ans)

Submission status: Accepted

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

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())
l=[]
b=0
for j in range(1,200):
    for i in range(1,j+1):
        if j%i==0:
            b+=1
    if b==8:
        l.append(j)
    b=0
L=[]
for k in range(len(l)):
    if l[k]%2==1 and l[k]<=n:
        L.append(l[k])
print(len(L))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def check(k):
    cnt = 0
    for i in range(1, k + 1):
        if k % i == 0:
            cnt += 1
    if cnt == 8:return 1
    else:return 0

n = int(input())
pre = [0] * n

for i in range(n):
    if i % 2 == 1:
        pre[i] = pre[i - 1]
    else:
        temp = check(i + 1)
        pre[i] = pre[i - 1] + temp
print(pre[n - 1])

Submission status: Accepted

Solution code:
def divisor(x):
  ret=[]
  for i in range(1,x+1):
    if x%i==0:
      ret.append(i)
  return len(ret)

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

Submission status: Accepted

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

    if eight == 8:
        ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

print(res)

Submission status: Accepted

Solution code:
import itertools
sosuu = [3,5,7,11,13]
n=(int)(input())
count = 0
for i in itertools.combinations(sosuu, 3):
  if i[0] * i[1] * i[2] <= n:
    #print(i)
    count += 1
add = 2 if n >= 189 else (1 if n >= 135 else 0)
print(count + add)

Submission status: Accepted

Solution code:
def yakusu(num):
  ret =0 
  for i in range(1,num+1):
    if(num%i==0): ret+=1
      
  return ret
N = int(input())
if(N<105):
  print(0)
  exit()
elif(N==105):
  print(1)
  exit()
else:
  ans=1
  for i in range(106,N+1):
    if(yakusu(i)==8 and i%2==1):
      ans +=1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(1,n+1):
    if i%2==0:
        continue
    else:
        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:
import math
import itertools
# from collections import deque
# from collections import defaultdict
# import heapq
# import sys
# import bisect
# import numpy as np
# from scipy.special import comb


def count(n):

    if n % 2 == 0 or n < 3:
        return False

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

    if count == 8:
        return True
    else:
        return False


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

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

    print(ans)


list(itertools.combinations([1, 2, 3, 4], 2))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

if N < 105:
    print(0)
else:
    c = 0
    for n in range(105, N+1, 2):
        nf = 0
        for i in range(1, n+1):
            if n%i == 0:
                nf += 1
        if nf == 8:
            c += 1
    print(c)

Submission status: Accepted

Solution code:
N=int(input())

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

print(s)

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 i%2==1 and cnt==8:
    ans+=1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

def yaku(n):
  ans = []
  x = int(N ** (1/2))
  for i in range(1, x + 1):
    if n % i == 0:
      if i != n // i:
        if i not in ans:
          ans.append(i)
        if n // i not in ans:  
          ans.append(n // i)
  return len(ans)

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

Submission status: Accepted

Solution code:
import math
n = int(input())
def divisor(x):
    div_list = []
    for div in range(1, int(math.sqrt(x)) + 1):
        if x % div == 0:
            if  x // div != div:
                div_list.append(div)
                div_list.append(int(x // div))
            else:
                div_list.append(div)
    return sorted(div_list)

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
cnt1 = 0 # 正の約数を数える
cnt2 = 0 # ちょうど8個のものを数える
for i in range(1, N+1, 2):
  for j in range(1, i+1, 2):
    if i % j == 0:
      cnt1 += 1
    else:
      pass
  if cnt1 == 8:
    cnt2 += 1
  else:
    pass
  cnt1 = 0
print(cnt2)

Submission status: Accepted

Solution code:
N = int(input())

ans = []
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.append(1)

print(sum(ans))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def is_odd(n):
    if n % 2 == 1:
        return True
    else:
        return False
    
def p105(n):
    count = 0
    for s in range(n,0,-1):
        if is_odd(s):

            divisors = [s]

            for i in range(1,s):
                if s % i == 0:
                    divisors.append(i)
            if len(divisors) == 8:
                #print(divisors)
                count += 1
    return count

if __name__ == "__main__":
    n = int(input())
    print(p105(n))

Submission status: Accepted

Solution code:
N = int(input())
count = 0
target = 0

for i in range(1, N + 1):
    if i % 2 == 0:
        continue
    for k in range(1, round(i ** (1/2))):
        if i % k == 0:
            count += 1
    if count == 4:
        target += 1
    count = 0

print(target)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def Yes(): print("Yes"); return
def No(): print("No"); return

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
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

#####MakeDivisors######
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

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def Base_10_to_n(X, n):
  if (int(X/n)):
    return Base_10_to_n(int(X/n), n)+[X%n]
  return [X%n]


#############
# Main Code #
#############
N = inputI()

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
def yakusu(x):
    cnt=0
    for i in range(1,x+1):
        if x%i==0:
            cnt+=1
#    print('x=',x,'cnt=',cnt)
    return cnt

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

ok_count = 0
for i in range(1, N + 1, 2):
    # 約数を8個もつものの数
    count = 0
    for j in range(1, i + 1):
        # print("{}".format(j))
        if i % j == 0:
            count += 1
    if count == 8:
        ok_count += 1
print(ok_count)

Submission status: Accepted

Solution code:
n=int(input())

def divisore(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):
  l=divisore(i)
  if len(l)==8:
    cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
if n<3*5*7:
    ans=0
elif n<3**3*5:
    ans=1
elif n<3*5*11:
    ans=2
elif n<3**3*7:
    ans=3
elif n<3*5*13:
    ans=4
else:
    ans=5
print(ans)

Submission status: Accepted

Solution code:
def count_dividers(n):
    dividers = {i for i in range(1, int(n ** 0.5) + 1) if n % i == 0}
    dividers = dividers | {n // d for d in dividers}
    return len(dividers)


N = int(input())

print(len([0 for n in range(105, N + 1, 2) if count_dividers(n) == 8]))

Submission status: Accepted

Solution code:
import numpy as np

n = int(input())
l = [0 for i in range(0, 201)]

for i in range(1, 201):
    for j in range(i, 201):
        if j/i == int(j/ i):
            l[j] += 1

l = np.array(l[1:n+1:2])>=8
print(sum(l))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num = int(input())

def countOfDivisors(num: int) -> bool:
    result = []
    for i in range(1, int(num ** 0.5) + 1):
        if num % i == 0:
            result.append(i)
            if i != num // i:
                result.append(num // i)

    return True if len(result) == 8 else False

result = 0
for tmp in range(1, num + 1):
    if tmp % 2 == 0: continue
    if countOfDivisors(tmp): result += 1

print(result)

Submission status: Accepted

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

for i in range(1, N+1, 2):
    count = 1
    for j in range(1, int(i/2)+2, 2):
        if (i/j).is_integer():
            count += 1

    if count == 8:
        ans += 1

print(ans)

Submission status: Accepted

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

def resolve():
    n=int(input())
    if 1<=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)
resolve()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
lis = [x for x in range(1, n+1, 2)]
ans = 0

for a in lis:
  lis2 = []
  for b in range(1, a+1):
    if a % b == 0:
      lis2.append(b)
  if len(lis2) == 8:
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
import math
import copy
from queue import Queue
import heapq
import numpy as np

MOD = 5000000007

n = int(input())
#b = int(input())
#n, m = [int(i) for i in input().split()]
#table = [[int(i)  for i in input().split()] for j in range(m)]
#table = [list(input()) for n in range(r)] #table[h][w]
#p = [int(i) for i in input().split()]
#s = [int(i) for i in range(n)]
#p = [int(input()) for i in range(m)]
#s = input()

#list = list(s)
#dp = [MOD for _ in range(m)]
#dp = [[0 for _ in range(n+1)] for _ in range(n+1)]
#dp = [[[0 for _ in range(11)] for _ in range(2)] for _ in range(11)]

#Combination = [[0 for _ in range(n+1)] for _ in range(n+1)]
#b = [[0 for _ in range(n+1)] for _ in range(n+1)]

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

print(sum)

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
from fractions import gcd
import sys
def input(): return sys.stdin.readline().rstrip()
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = 10**18
# ----------------------------------------------------------- #

n = I()
prime = [3, 5, 7, 11, 13, 17, 19]
A = {a**7 for a in prime if a**7<200}
B = {a*b**3 for a, b in permutations(prime, 2) if a*b**3<200}
C = {a*b*c for a, b, c in permutations(prime, 3) if a*b*c<200}
D = A | B | C
ans = 0
for i in range(n+1):
    if i % 2 == 1 and i in D:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
A = np.zeros(N+1)
for i in range(1, N+1):
    A[i::i] += 1

A = A[1::2]
answer = (A==8).sum()
print(answer)

Submission status: Accepted

Solution code:
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()

def make_divisors(n):  # 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

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

print(answer)

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

Submission status: Accepted

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

def resolve():
    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() # sort必要なかったらコメントアウト
             return len(divisors)
    ans=0
    for i in range(1,n+1,2):
        if make_divisors(i)==8:
            ans+=1
    print(ans)

resolve()

Submission status: Accepted

Solution code:
import collections

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

count=0
n=int(input())
for i in range(1, n+1, 2):
  ans=1
  c=collections.Counter(prime_factorize(i))
  clist = c.values()
  for j in clist:
    ans *= (j+1)
  if ans == 8:
    count += 1
    
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import sys
n = int(sys.stdin.readline())
ans = 0
for i in range(3, n + 1, 2):
    # print(f'{i=}', end=' ')
    count = 0
    for j in range(1, int(math.sqrt(i)) + 1):
        if i % j == 0:
            # print(f'{i} % {j} is 0.')
            count += 2
    if count == 8:
        # print(f'{i} have just 8 divisors.')
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
import numpy as np
n=int(input())

ans=0

for k in range(n+1):
    if k%2==1:
        count=0
        m=int(np.sqrt(k)+1)
        for i in range(m):
            a=i+1
            if(k%a==0):
                count+=1
        if count==4:
            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
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:
# coding: utf-8
# Your code here!
import sys
import itertools

def main():
    n = int(sys.stdin.readline())
    
    ans_count = 0
    for i in range(1, n+1, 2):
        count = 1 # 自分自身を含む
        for j in range(1, i//2):
            count = count + 1 if i % j == 0 else count
        ans_count = ans_count + 1 if count==8 else ans_count
    print(ans_count)
            
                
    
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n=int(input())
c=0
ans=0
for i in range(1,n+1):
    if i%2==1:
        for j in range(1,n+1):
            if i%j==0:
                c+=1
        if c==8:
            ans+=1
        c=0
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):
    fact = factorization(i)
    sum = 1
    for j in fact:
        sum *= j[1]+1
    if sum == 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, int(i ** 0.5) + 1):
        if i % j == 0:
            count += 2
    if int(i ** 0.5) ** 2 == i:
        count -= 1
    if count == 8:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
ans=0 #this is the answer
for i in range (1,n+1,2): #think about the number from 1 to n
  cnt=0 #this counts the divisors
  for j in range (1,n+1): #check all the numbers and find divisors
    if i%j==0 : #the condition whether it is a divisor of n or not
      cnt+=1
  if cnt==8 and i%2==1:
    ans+=1
print(ans)

Submission status: Accepted

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

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

print(ans)