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
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b = LI()
    print((a-1)*(b-1))
    return

#B
def B():
    def est(n):
        res = 0
        for i in range(1, int(n ** 0.5) + 1):
            if not n % i:
                res += 2
        res -= float.is_integer(n ** 0.5)
        return res == 8
    n = II()
    ans = 0
    for i in range(1, n + 1, 2):
        ans += est(i)
    print(ans)
    return

#C
def C():
    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    B()

Submission status: Accepted

Solution code:
def yakusu(x):
    ans=0
    for i in range(x+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)

yakusu(int(input()))

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

Submission status: Accepted

Solution code:
import sys

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

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

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

        if dcount == 8:
            count += 1

    print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())

res=0

if n>=105:
	for i in range(105,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())

ans = int(n >= 105)
for i in range(107, n + 1, 2):
    dc = 0
    for j in range(1, i // 2):
        if i % j == 0:
            dc += 1
    if dc == 7:
        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:
        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:
def yakusu(x):
    ans=0

    for i in range(1,x+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
    return(ans)

s=int(input())
print(yakusu(s))

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:
def divisor_num(x):
    num = 0
    for i in range(1,int(x**0.5)+1):
        num += (x%i == 0)*2
    num -= (x**0.5).is_integer()
    return num

n=int(input())
c = 0
for i in range(1,n+1,2):
    c += (divisor_num(i) == 8)
print(c)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
import itertools
n=int(input())
ans=0
l=[3,5,7,11,13]
c=list(itertools.combinations(l,3))
for i in c:
    if i[0]*i[1]*i[2]<=n:ans+=1
p=list(itertools.permutations(l,2))
for i in p:
    if i[0]**3*i[1]<=n: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())
modList = []
count = 0

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

Submission status: Accepted

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

n = int(input())

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

Submission status: Accepted

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

for i in range(1,a+1,2):
  c = 0
  for j in range(1,a+1,2):
    if i%j==0:
      c+=1
  else:
    if c==8:
      b+=1
else:
  print(b)

Submission status: Accepted

Solution code:
N = int(input())

from collections import Counter

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

div = [len(make_divisors(i)) for i in range(N+1)][1:N+1:2]
d = Counter(div)

print(d[8])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import bisect

N = int(input())

lst = [105, 135, 165, 189, 195]
ans = bisect.bisect_right(lst, N)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
count1 = 0
for i in range(1,N+1):
  if i % 2 != 0: #Odd Number
    count2 = 0  
    for j in range(1,i+1):
      if i % j == 0:
        count2 += 1
      if count2 == 8:
        count1 += 1
print(count1)

Submission status: Accepted

Solution code:
def compute_divisors(x):
    # https://atcoder.jp/contests/abc106/submissions/3028544
    divisors = set()
    for i in range(1, int(x ** 0.5) + 1):
        if x % i == 0:
            divisors.add(i)
            divisors.add(x // i)
    return divisors

N = int(input())
c = 0

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

Submission status: Accepted

Solution code:
n = int(input())
#h, w = map(int,input().split())
#ls = list(map(int,input().split()))
#ls = [list(map(int,input().split())) for i in range(n)]
#ls = [input() for i in range(h)]

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

Submission status: Accepted

Solution code:
N = int(input())

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

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

Submission status: Accepted

Solution code:
n = int(input())

def x(n):
    c = 0
    for i in range(1, n+1):
        if n % i == 0:
            c += 1

    return c

ans = 0

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

print(ans)

Submission status: Accepted

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

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

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

    if m == 8:
        ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

#Ｎまでの範囲で奇数のみ回す
for i in range(1,N+1,2):
	# print(i)
	count=0	 
	#奇数のみを考えるので、1-200の間の奇数だけで考える
	for j in range(1,200,2):
		if j <= i and i % j ==0:
			# print('j:',j)
			count += 1
		else:
			continue
	if count == 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

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

Submission status: Accepted

Solution code:
def make_division(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_cnt = 0
for num in range(n+1):
    cnt = 0
    if num%2==0:
        pass
    else:
        cnt = make_division(num)
        if cnt == 8:
            ans_cnt += 1
print(ans_cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())


def yakusuu(num):
    res = 0
    for i in range(num):
        if num%(i+1) == 0:
            res += 1
    return res

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

Submission status: Accepted

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

    if cnt==8:
        cnt_i+=1
        
    cnt = 0

print(cnt_i)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
def get_divisor(x):
  divisor = set()
  for i in range(1, int(x**(1/2))+1):
    if x%i==0:
      divisor.add(i)
      divisor.add(x//i)
  return divisor
ans = 0
for i in range(1, n+1, 2):
  if len(get_divisor(i))==8:
    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)

    # divisors.sort()
    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 divc(num):
    count = 0
    for i in range(1, num+1):
        if num % i == 0:
            count += 1
    
    return count

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

print(ans)

Submission status: Accepted

Solution code:
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

N = n()

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

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

print(total)

Submission status: Accepted

Solution code:
n = int(input())
odd = [i for i in range(1, n + 1) if i % 2 == 1]
cnt = 0
for o in odd:
    divisor = [i for i in range(1, n + 1) if o % i == 0]
    if len(divisor) == 8:
        cnt += 1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def divisor(n):
    div = set()
    for i in range(1, n // 2 + 1):
        d, m = n // i, n % i
        if m == 0:
            div.add(i)
            div.add(d)
        if d < i:
            break
    return sorted(list(div))  

n = int(input())
if n < 105:
  print(0)
else:
  count = 0
  for n in range(105, n + 1, 2):
    if len(divisor(n)) == 8:
      count += 1
  print(count)

Submission status: Accepted

Solution code:
def abc():
    n = int(input())
    odd = [x for x in range(1, n + 1) if x % 2]
    cnt = 0
    for o in odd:
        divisor = [x for x in range(1, o + 1) if o % x == 0]
        if len(divisor) == 8:
            cnt += 1
    print(cnt)


abc()

Submission status: Accepted

Solution code:

N = int(input())

ans = 0

for i in range(N):

    i += 1
    Npn = 0
    
    for j in range(i):

        j += 1

        if i % j == 0:

            Npn += 1

    if Npn == 8 and i % 2 == 1:
        #print (i ,"の役数は8ko")
        ans += 1


print (ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = 0
for i in range(1 , int(input()) + 1):
    if i == 105 or i == 135 or i == 165 or i == 189 or i == 195:
        x += 1
print(x)

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(n+1):
  if len(make_divisors(i)) == 8 and i%2 == 1:
    cnt = cnt + 1
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


cnt = 0
for i in range(10, N+1):
    if i % 2 == 0:
        continue
    if len(make_divisors(i)) == 8:
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
x = 0
for i in range(1, N + 1):
    y = 0
    over = False
    m = False
    if i % 2 != 0:


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


                if (y == 8) & (over == False):
                    x = x + 1
                    over = True

                elif (y < 8) & (over == True) & (m == False):
                    x = x -1

print(x)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
A = 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 = C + 1
    if C == 8 :
        A = A + 1



print(A)

Submission status: Accepted

Solution code:
n = int(input())
a = []
count = 0
for i in range(1,n+1):
     if i%2 != 0:
          for j in range(1,i+1):
               if i%j == 0:
                    a.append(j)
     if len(a) == 8:
          count += 1
     a.clear()
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

N, = map(int, input().split())

def f(n):
    a = set()
    
    for i in range(1, n + 1):
        if n % i == 0:
            a.add(n // i)
            a.add(i)
            
    return len(a)
    
print(len([v for v in range(1, N + 1) if v % 2 == 1 and f(v) == 8]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
list=list()
cnt=0
for i in range(105,N+1,2):
    list=[j for j in range(1,200)if i%j<1]
    if len(list) >=8:
        cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
# INPUT
n = int(input())

# PROCESS

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

answer = 0
for i in range(1, n+1):
  if (i % 2 == 0):
    continue
  else:
    yakusu = make_divisors(i)
    if (len(yakusu) == 8):
      answer += 1

# OUTPUT
print(answer)

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

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

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

print(ans)

Submission status: Accepted

Solution code:
a = int(input())

if a == 105:
    cnt = 1
elif a <= 104:
    cnt = 0
else:
    cnt = 0
    divs = 0
    for i in range(1,a+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:
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):
    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):
    c=0
    for j in range(1,i+1):
        if i%j==0:
            c+=1
    ans+=1 if c==8 else 0
print(ans)

Submission status: Accepted

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

print(c)

Submission status: Accepted

Solution code:
N = int(input())

l = [0]*201
for i in range(1, N+1, 2):
    l[i] = len([i for x in range(1, i+1) if i%x==0])
print(l.count(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)
    divisors.sort()
    return divisors

N = int(input())

cnt = 0
for i in range(N+1):
    divisors = make_divisors(i)
    if len(divisors) == 8 and i % 2:
        cnt += 1

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

cnt=0
for j in range(1,N+1,2):
    n=int(math.sqrt(j))
    yaku=0
    for i in range(n):
        if j%(i+1)==0:
            yaku+=1
    #print(j,yaku)
    if yaku*2==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:
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
divisor = []
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())
cnt = 0
divisor = []
for i in range(1,n+1,2) :
        for j in range(1,i+1) :
                if i % j == 0 :
                        cnt += 1
        divisor.append(cnt)
        cnt = 0
ans = 0
for i in divisor :
        if i == 8 :
                ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
nm_of_odd = 0
for n in range(1, N+1, 2):
  nm_of_divisor = 0
  for d in range(1, n+1, 2):
    if n % d == 0:
      nm_of_divisor += 1
  if nm_of_divisor == 8:
    nm_of_odd += 1
print(nm_of_odd)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

result = 0


for i in range(1, N+1):
    cnt = 0
    if i % 2 ==0:
        continue
    for x in range(1, N+1):
        if i % x == 0:
            cnt += 1
    #print(i)
    #print(cnt)
    if cnt == 8:
        result += 1
print(result)

Submission status: Accepted

Solution code:
def f(n):
    if n == 1:
        return 1
    divs = {}
    div = 3
    while n > 1:
        if n % div == 0:
            n //= div
            if div in divs:
                divs[div] += 1
            else:
                divs[div] = 1
        else:
            div += 2
    ans = 1
    for div in divs.values():
        ans *= div + 1
    return ans


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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n=int(input())
 
if n<105:
    print(0)
elif n>104 and n<135:
    print(1)
elif n>134 and n<165:
    print(2)
elif n>164 and n<189:
    print(3)
elif n>188 and 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):
  divisor=[]
  for j in range(1,int(i**(1/2))+1):
    if i%j==0:
      divisor.append(j)
      if j!=i//j:
        divisor.append(i//j)
  if len(divisor)==8:
    ans+=1
print(ans)

Submission status: Accepted

Solution code:
s = int(input())

ans = 0
for i in range(1, s+1, 2):
  cnt = 0
  for num in range(1, i+1):
    if i % num == 0:
      cnt = cnt + 1
  if cnt == 8:
    ans = 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
  l = []
  for j in range(1,i+1):
    if i % j == 0:
      l.append(i)
  if len(l) == 8:
    cnt += 1
print(cnt)

Submission status: Accepted

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

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

print(count2)

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

print(ans)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

n = int(input())
count = 0
if n < 105 :
	pass
else :
	for i in range(105,n+1) :
		if i%2 != 0 :
			if len(get_divisor(i)) == 8:
				count += 1

print(count)

Submission status: Accepted

Solution code:
n = int(input())

def fact(x):
  prime = {}
  if x == 1: prime[1] = 1
  for i in range(2,x+1):
    while True:
      if x % i == 0:
        if i in prime:
          prime[i] += 1
        else: prime[i] = 1
        x //= i
      else: break
  return prime

ans = 0

for i in range(n):
  prime = fact(i+1)
  a = 1
  for j in prime:
    a *= (prime[j]+1)
  if a == 8 and (i+1) % 2 == 1:
    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):
    cnt=0
    for j in range(1,i+1,2):
      if i % j==0:
        cnt +=1
    else:
      if cnt == 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 == 1:
    cnt = 0
    for j in range(1, i+1):
      if i % j == 0:
#        print(i, j)
        cnt += 1
    if cnt == 8:
      ans += 1
print(ans)