qyliang/CodeNanoFix huggingface dataset:
Buggy 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)

Fixed 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)
Buggy code:
#106b
n = int(input())
ans=0
for i in range(1,n+1,2):
    c=0
    for j in range(1,i+1):
        print(i,j)
        if i%j==0:
            c+=1
            
    if c==8:
        a+=1
print(ans)

Fixed code:
#106b
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)
Buggy code:
n = int(input())
a = 0

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

print(a)


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

print(a)
Buggy code:
N = int(input())
ans = 0
for n in range(1, N+1):
  yakusuu = 0
  for i in range(1, n+1):
    if n%i==0:
      yakusuu+=1
  if yakusuu==8:
    ans += 1
print(ans)

Fixed code:
N = int(input())
ans = 0
for n in range(1, N+1, 2):
  yakusuu = 0
  for i in range(1, n+1):
    if n%i==0:
      yakusuu+=1
  if yakusuu==8:
    ans += 1
print(ans)
Buggy code:
N = int(input())
 
def check_divisor(number):
  divisors = 0
  for j in range(1, number+1, 2):
    if not (number%j):
      divisors += 1
      if divisors == 9: return False
    if divisors == 8: return True
    else: return False

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

Fixed code:
N = int(input())

def check_divisor(number):
	divisors = 0
	for j in range(1, number+1, 2):
		if not (number%j):
			divisors += 1
			if divisors == 9: return False
	if divisors == 8: return True
	else: return False

count = 0
for i in range(1, N+1, 2):
	if check_divisor(i):
		count += 1
print(count)
Buggy code:
def yakusu(x):
    A=[]
    for i in range(1,x+1):
        if x%i==0:
            A.append(i)
    return(len(A))
    
n=int(input())
ans=0

for j in range(1,n+1):
    if yakusu(n)==8:
        ans+=1
print(ans)

Fixed code:
def yakusu(x):
    A=[]
    for i in range(1,x+1):
        if x%i==0:
            A.append(i)
    return(len(A))
    
n=int(input())
ans=0

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

print(ans)
    

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

for i in range(1,N+1):
  tmp=0
  t=i**(1/2)
  for j in range(1,int(t)+1):
    if i%j==0:
      tmp+=1
      
  if t-int(t)<=1e-3:
    if tmp*2-1==8:
      ans+=1
      
  else:
    if tmp*2==8:
      ans+=1
      
print(ans)    

Fixed code:
N=int(input())

ans=0
for i in range(1,N+1,2):
  tmp=0
  t=i**(1/2)
  for j in range(1,int(t)+1):
    if i%j==0:
      tmp+=1
      
  tmp=tmp*2
  if t-int(t)<=1e-3:
    tmp-=1

  if tmp==8:
    ans+=1
      
print(ans)
Buggy code:
N=int(input())
ans=0
for n in range(1,N+1):
  _ans=0
  for x in range(1,n+1):
    if n%x==0:
      _ans+=1
  if _ans==8:
    ans+=1
print(ans)

Fixed code:
N=int(input())
ans=0
for n in range(1,N+1,2):
  _ans=0
  for x in range(1,n+1):
    if n%x==0:
      _ans+=1
  if _ans==8:
    ans+=1
print(ans)
Buggy code:

def solve():
    ans = 0
    n=int(input())
    for i in range(1,n+1):
        div_list = []
        for j in range(i,int(i**0.5)+1):
            if i%j!=0:
                continue
            if i//j==j:
                div_list.append(j)
            else:
                div_list.append(i//j)
                div_list.append(j)
    print(ans)

if __name__ == '__main__':
    solve()

Fixed code:

def solve():
    ans = 0
    n=int(input())
    for i in range(1,n+1,2):
        div_list = []
        for j in range(1,int(i**0.5)+1):
            if i%j!=0:
                continue
            if i//j==j:
                div_list.append(j)
            else:
                div_list.append(i//j)
                div_list.append(j)
        if len(div_list)==8:
            ans+=1
    print(ans)

if __name__ == '__main__':
    solve()
Buggy code:

def solve():
    ans = 0
    n=int(input())
    for i in range(1,n+1):
        div_list = []
        for j in range(1,int(i**0.5)+1):
            if i%j!=0:
                continue
            if i//j==j:
                div_list.append(j)
            else:
                div_list.append(i//j)
                div_list.append(j)
        if len(div_list)=8:
            ans=+=1
    print(ans)

if __name__ == '__main__':
    solve()

Fixed code:
ans = 0
def solve(n):
    global ans
    for i in range(1,n+1,2):
        div_list=[]
        for j in range(1,int((i+1)**0.5)+1):
            if i % j == 0:
                if (i//j)!=j:
                    div_list.append(i//j)
                    div_list.append(j)
                else:
                    div_list.append(j)
        if len(div_list) == 8:
            ans+=1

def main():
    n=int(input())
    solve(n)
    print(ans)

if __name__=='__main__':
    main()
Buggy code:
n=int(input())
b=[3*5*7, 3*5*9, 3*5*11, 27*7, 3*5*13]
print(b)
a=0
for i in range(len(b)):
    if b[i]<=n:
        a+=1
print(a)


Fixed code:
n=int(input())
b=[3*5*7, 3*5*9, 3*5*11, 27*7, 3*5*13]
a=0
for i in range(len(b)):
    if b[i]<=n:
        a+=1
print(a)
Buggy code:
n = int(input())


def count_divisors(target):
    _i = 1
    _count = 0
    while _i*_i <= target:
        if target % _i == 0:
            _count += 1
            if _i != target // _i:
                _count += 1
        _i += 1
    return _count


count = 0
for i in range(1, n+1):
    if count_divisors(i) == 8:
        count += 1

print(count)


Fixed code:
n = int(input())


def count_divisors(target):
    _i = 1
    _count = 0
    while _i*_i <= target:
        if target % _i == 0:
            _count += 1
            if _i != target // _i:
                _count += 1
        _i += 1
    return _count


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

print(count)
Buggy 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))


Fixed 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))
Buggy code:
n=int(input())
cnt = 0
cnt_i = 0
for i in range(1,n+1):
    for j in range(1,n+1):
        if n%j==0:
            cnt+=1
    if cnt==8:
        cnt_i+=1
    cnt = 0
print(cnt_i)

Fixed 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)
Buggy code:
from math import sqrt, ceil

N = int(input())
ans = 0
for n in range(1, N+1, 2):
    count = 0
    for i in range(1, ceil(sqrt(n))+1):
        if n%i == 0:
            count += 2
    if count == 8:
        print(n)
        ans += 1
print(ans)


Fixed code:
from math import sqrt, ceil

N = int(input())
ans = 0
for n in range(1, N+1, 2):
    count = 0
    for i in range(1, ceil(sqrt(n))+1):
        if n%i == 0:
            count += 2
    if count == 8:
        ans += 1
print(ans)
Buggy code:
def div(n):
  d=0
  for i in range(1, n+1):
    if n%i==0:
      d+=1
  return d

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

Fixed code:
def div(n):
  d=0
  for i in range(1, n+1):
    if n%i==0:
      d+=1
  return d

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

ans = 0
for n in range(1,int(N/2)+1):
    if 2*n+1 > N:
        break
    for i in range(1,int(N**(1/2)/2)+1):
        for j in range(i+1,int(N**(1/2)/2)+1):
            for k in range(j+1,int(N**(1/2)/2)+1):
                if 2*n+1 == (2*i+1)*(2*j+1)*(2*k+1):
                    print(i,j,k,n)
                    ans += 1

print(ans)


Fixed code:
N = int(input())

ans = 0
for n in range(1,int(N/2)+1):
    if 2*n+1 > N:
        break
    for i in range(1,int(N**(1/2)/2)+1):
        for j in range(i+1,int(N**(1/2)/2)+1):
            for k in range(j+1,int(N**(1/2)/2)+1):
                if 2*n+1 == (2*i+1)*(2*j+1)*(2*k+1):
                    ans += 1

print(ans)
Buggy code:
import sys

n = int(sys.stdin.readline().rstrip("\n"))
count = 0
for num in range(27, n+1, 2):
    divisor = 1
    for p in range(1, num, 2):
        if num % p == 0:
            print(f"num: {num}, p: {p}")
            divisor += 1
    if divisor == 8:
        count += 1
print(count)


Fixed code:
import sys

n = int(sys.stdin.readline().rstrip("\n"))
count = 0
for num in range(27, n+1, 2):
    divisor = 1
    for p in range(1, num, 2):
        if num % p == 0:
            divisor += 1
    if divisor == 8:
        count += 1
print(count)
Buggy code:
N = int(input())
ans = 0
for i in range(1, n+1):
    if i%2 !=0:
        for j in range(1, i+1):
            if i%j==0:
                count+=1
            if count ==8:
                ans += 1
print(ans)

Fixed code:
n = int(input())
ans = 0
for i in range(1,n+1):
  count=0
  if i%2!=0:
    for j in range(1, i+1):
      if i %j==0:
        count+=1
      if count==8:
        ans+=1
print(ans)
Buggy code:
n = int(input())

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

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

print(ans)

Fixed code:
n = int(input())

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

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

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


print(ans)


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

    counter = 0


print(ans)
Buggy 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:
        print(i)
        ans+=1
print(ans)

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

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

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

Fixed code:
N = int(input())
 
def divisor_num(n):
    ans = 0
    for i in range(1, n + 1):
        if n % i == 0:
            ans += 1
    return ans
 
ans = 0
for i in range(1, N + 1):
    if i % 2 != 0 and divisor_num(i) == 8:
        ans += 1
        
print(ans)
Buggy code:
n = int(input())

def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= int(i)
      table.append(int(i))
    i += 1
  if n > 1:
    table.append(n)
  return table

a = [1]*(n+1)
for i in range(3,n+1,2):
    il = mymath.prime_decomposition(i)
    il_unique = list(set(il))
    ans = 1
    for j in il_unique:
        ans *= (il.count(j)+1)
    a[i] = max(a[i],ans)


print(a.count(8))

Fixed code:
n = int(input())

def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= int(i)
      table.append(int(i))
    i += 1
  if n > 1:
    table.append(n)
  return table

a = [1]*(n+1)
for i in range(3,n+1,2):
    il = prime_decomposition(i)
    il_unique = list(set(il))
    ans = 1
    for j in il_unique:
        ans *= (il.count(j)+1)
    a[i] = max(a[i],ans)


print(a.count(8))
Buggy code:
n = int(input())
result = 0
for i in range(2,n+1):
  total = 0
  for j in range(i):
    if (i%j == 0):
      tatal += 1
  if(total == 8):
    result += 1
print(result)

Fixed code:
n = int(input())
result = 0
for i in range(1,n+1,2):
  total = 0
  for j in range(1,i+1):
    if (i%j == 0):
      total += 1
  if(total == 8):
    result += 1
    #print(i,j)
print(result)
Buggy code:
print([[i%j==0 for j in range(1,i)].count(0) for i in range(1,int(input())+1,2)].count(7))

Fixed code:
print([sum([i%j==0 for j in range(1,i)]) for i in range(1,int(input())+1,2)].count(7))
Buggy code:
n = int(input())

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

print(result)

Fixed code:
n = int(input())

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

print(result)
Buggy code:
n = int(input())

def divisor(n):
    res = 0
    for i in range(1,n+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)

Fixed 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)
Buggy code:

n = int(input())
count = 0
ans = 0

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

print(ans)

Fixed code:
n = int(input())
count = 0
ans = 0

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

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


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

Fixed 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)
Buggy code:
import sys

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

N = I()

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

ans = 0
for i in range(105,N+1):
    cnt = 0
    for q in range(1,int(N**0.5)+1):
        if i % q == 0:
            cnt += 1
    if cnt == 4:
        ans += 1
print(ans)



Fixed code:
import sys

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

N = I()

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

ans = 0
for i in range(105,N+1,2):
    cnt = 0
    for q in range(1,int(i**0.5)+1):
        if i % q == 0:
            cnt += 2
    if cnt == 8:
        ans += 1
print(ans)
Buggy code:
N = int(input())
cnt = 0
for i in range(1, N + 1):
  k = 0
  for j in range(1, N + 1):
   	if i % j == 0:
      k += 1
  if k == 8:
    cnt += 1

print(cnt)
  

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

Fixed 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)
Buggy 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:
        print(i)
        ans+=1
print(ans)


Fixed 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
        cnt = 0
    
print(ans)
Buggy code:
# -*- coding: utf-8 -*-

def main():

    N = int(input())

    ans = 0
    count = 0

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


if __name__ == "__main__":
    main()

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

def main():

    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)


if __name__ == "__main__":
    main()
Buggy 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
ans=0
N=int(input())
if N<105:
    print(0)
    exit(0)
for i in range(105,N)[::2]:
    if len(make_divisors(i))==8:
        ans+=1
print(ans)

Fixed 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
ans=0
N=int(input())
if N<105:
    print(0)
    exit(0)
for i in range(104,N+1):
    if i%2==1 and len(make_divisors(i))==8:
        ans+=1
print(ans)
Buggy code:
n=int(input())
if 104<n<135:
  print(1)
elif 134<n<165:
  print(2)
elif 164<n<189:
  print(3)
elif 188<n<195:
  print(4)
else:
  print(5)

Fixed code:
n=int(input())
if n<105:
  print(0)
elif 104<n<135:
  print(1)
elif 134<n<165:
  print(2)
elif 164<n<189:
  print(3)
elif 188<n<195:
  print(4)
else:
  print(5)
Buggy 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 :
	print(0)
else :
	for i in range(105,n+1) :
		if i%2 != 0 :
			if len(get_divisor(i)) == 8:
				count += 1

print(count)

Fixed 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)
Buggy code:
n = int(input())

result = 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:
        print(i)
        result += 1
print(result)

Fixed code:
n = int(input())

result = 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:
        result += 1
print(result)
Buggy 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)
                    print(i,a)
     if len(a) == 8:
          count += 1
     a.clear()
print(count)

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

Ans = 0

for i in range(1,N,2):
    count = 0
    for j in range(1,i,2):
        if i % j == 0:
            count += 1
    if count == 7:
        Ans += 1

print(Ans)

Fixed code:
N = int(input())

Ans = 0

for i in range(1,N+1,2):
    count = 0
    for j in range(1,i,2):
        if i % j == 0:
            count += 1
    if count == 7:
        Ans += 1

print(Ans)
Buggy code:
n = int(input())

def check(p):
  c = 0
  for i in range(1,p+1):
    if p % i == 0:
      c += 1
  return c

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

Fixed code:
n = int(input())
 
def check(p):
  c = 0
  for i in range(1,p+1):
    if p % i == 0:
      c += 1
  return c
 
ans = 0
for i in range(1,n+1):
  if i % 2 == 1:
    if check(i) == 8:
      ans += 1
      
print(ans)
Buggy code:
N = int(input())
cnt=0
y=[]

for i in range(1,N+1,2):
    for j in range(1,i):
        if i%j == 0:
            y.append(j)
    if len(y)==8:
        cnt += 1
        y.clear()
print(cnt)

Fixed code:
N = int(input())
cnt=0
y=[]

for i in range(1,N+1,2):
    for j in range(1,i+1):
        if i%j == 0:
            y.append(j)
    if len(y)==8:
        cnt += 1
    y.clear()
print(cnt)
Buggy code:
i = int(input())

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



Fixed code:
i = int(input())
total = 0
for n in range(1,i+1,2):
  ans = 0
  for m in range(1,n+1):
    if n % m == 0:
      ans += 1
  if ans == 8:
    total += 1
print(total)
Buggy code:
def get_divisors(n):
    div = []
    append = div.append
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            append(i)
            if i != n // i:
                append(n // i)
    div.sort()
    return div


# input
N = int(input())

# check
cnt = 0
for n in range(1, N + 1):
    div = get_divisors(n)
    if len(div) == 8:
        cnt += 1

print(cnt)

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


# input
N = int(input())

# check
cnt = 0
for n in range(1, N + 1, 2):
    div = get_divisors(n)
    if len(div) == 8:
        cnt += 1

print(cnt)
Buggy code:
n=int(input())
j=1
a=0
while j<=n:
  d=0
  for i in range(1,j):
    if j%i==0:
      d+=1
  if d==8:
    a+=1
  j+=2
print(a)


Fixed code:
n=int(input())
j=1
a=0
while j<=n:
  d=0
  for i in range(1,j+1):
    if j%i==0:
      d+=1
  if d==8:
    a+=1
  j+=2
print(a)