qyliang/CodeNanoFix huggingface dataset:
Buggy code:
#coding:utf-8

def call(n):
    for i in range(1,n+1):
        x=i
        if x%3==0:
            print(" "+str(i,end="")
        else:
            while x!=0:
                if x%10==3:
                    print(" "+str(i),end="")
                    break
                else:
                    x//=10
                    
    print("")

n=int(input())
call(n)

Fixed code:
#coding:utf-8

def call(n):
    for i in range(1,n+1):
        x=i
        if x%3==0:
            print(" "+str(i),end="")
        else:
            while x!=0:
                if x%10==3:
                    print(" "+str(i),end="")
                    break
                else:
                    x//=10
                    
    print("")

n=int(input())
call(n)
Buggy code:
n = int(input())
x = 0
for i in range(1, n+1):
  if i%3 == 0:
    print(' %d'%i, end="")
  else:
    x = i
while(x):
  if x%10 == 3:
    print(' %d'%i, end="")
    break
    x //= 10
print()


Fixed code:
n = int(input())

for i in range(1, n+1):
    if i%3 == 0:
        print(" %d"%(i), end = "")
        continue
    elif i%10 == 3:
        print(" %d" % (i), end="")
        continue
    else:
        x = i
        while x > 0:
            x //= 10
            if x%10 == 3:
                print(" %d"%(i), end="")
                break

print()
Buggy code:
if __name__ == '__main__':
    limit = int(input())

    data = []
    for i in range(3, limit+1):
        if (i % 3) == 0 or (i // 10 % 10) == 3:
            data.append(str(i))


    txt = ' '.join(data)
    print(' {0}'.format(txt))

Fixed code:
if __name__ == '__main__':
    limit = int(input())

    data = []
    for i in range(3, limit+1):
        if (i % 3) == 0 or '3' in str(i):
            data.append(str(i))

    txt = ' '.join(data)
    print(' {0}'.format(txt))
Buggy code:
n = int(input())
for i in range(n+1):
    if i%3 == 0:
        print("",i,end="")
    else:
        list("i")
        if str(i).count("3") != 0:
            print("",i,end="")

Fixed code:
n = int(input())
for i in range(1,n+1):
    if i%3 == 0:
        print("",i,end="")
    else:
        list("i")
        if str(i).count("3") != 0:
            print("",i,end="")
print("")
Buggy code:
for i in range(3,int(input())+1,3):
    x=i
    if x % 3 == 0:
        print(" "+str(i), end="")
    else:
        while x != 0:
            if x % 10 == 0:
                print(" "+str(i), end="")
                break
            else:
                x = x//10
print("")

Fixed code:
for i in range(1,int(input())+1):
    x=i
    if x % 3 == 0:
        print(" "+str(i), end="")
    else:
        while x != 0:
            if x % 10 == 3:
                print(" "+str(i), end="")
                break
            else:
                x = x//10
print("")
Buggy code:
def call(n):
    ret = ""
    for i in range(int(n)):
        if 0 == i % 3:
            ret += " " + str(i)
        elif -1 != str(i).find("3"):
            ret += " " + str(i)

    return ret

if __name__ == "__main__":
    n = input()
    ret = call(n)
    print (ret)


Fixed code:
def call(n):
    ret = ""
    for i in range(1, int(n)+1):
        if 0 == i % 3:
            ret += " " + str(i)
        elif -1 != str(i).find("3"):
            ret += " " + str(i)

    return ret

if __name__ == "__main__":
    n = input()
    ret = call(n)
    print (ret)
Buggy code:
n=int(input())
d=[]
for i in range(3, n+1)
  if i%3==0 or "3" in str(i):
    d.append(i)
print(' ', end="")
print(*d)


Fixed code:
n=int(input())
d=[]
for i in range(1,n+1):
    if i%3==0 or "3" in str(i):
        d.append(i)
print(" ",end="")
print(*d)
Buggy code:
from sys import stdout
n = int(input())
i = 1

while True:
    x = i
    if x % 3 == 0:
        stdout.write(" " + str(i))
    else:
        while x:
            if x % 10 == 3:
                stdout.write(" " + str(i))
                i += 1
                if i > n: break
            x //= 10
    i += 1
    if i > n: break
print()


Fixed code:
from sys import stdout
n = int(input())
i = 1

while True:
    x = i
    if x % 3 == 0:
        stdout.write(" " + str(i))
    else:
        while x:
            if x % 10 == 3:
                stdout.write(" " + str(i))
                break
            x //= 10
    i += 1
    if i > n: break
print()
Buggy code:
n = int(input())

for  i in range(1,n+1):
    if i%3 == 0 or str(i).find("") != -1:
        print(" %d" %i ,end="")
print()


Fixed code:
n = int(input())

for  i in range(1,n+1):
    if i%3 == 0 or str(i).find("3") != -1:
        print(" %d" %i ,end="")
print()
Buggy code:
a = int(input())
b = []
for i in range(1, a+1, 1):
    if "3" in str(i):
        b.append(i)
    elif i % 3 == 0:
        b.append(i)
    else:
        pass
for i in b:
    print(i + " ", end='')



Fixed code:
a = int(input())
b = []
print(" ",end="")
for i in range(1, a+1, 1):
    if "3" in str(i):
        b.append(i)
    elif i % 3 == 0:
        b.append(i)
    else:
        pass
count = 0
for i in b:
    count += 1
    if len(b) == count:
        print(i)
        break
    print(i, end="")
    print(" ", end="")
Buggy code:
n = int(input())
for i in range(1,n+1):
    if i % 3 == 0 or str(i).find("3"):
        print(" " + str(i),end = "")
print()


Fixed code:
n = int(input())
for i in range(1,n+1):
    if i % 3 == 0 or str(i).find("3") != -1:
        print(" " + str(i),end = "")
print()
Buggy code:

n=int(input())
for i in range(n):
    if (i+1) % 3 == 0 or "3" in str(i+1) :
        print(str(i+1) + " ")



Fixed code:
n=int(input())
L=""
for i in range(1,n+1):
    if i%3==0 or '3' in str(i):
        L +=' '+str(i)
print(L)
Buggy code:
n = int(input())
for i in range(3, n + 1):
    if i % 3 == 0 or i % 10 == 3 or '3' in str(i):
        print(' ',i,end='')
print()

Fixed code:
n = int(input())
for i in range(3, n + 1):
    if i % 3 == 0 or '3' in str(i):
        print('', i, end='')
print()
Buggy code:
x = int(input())

for i in range(1,x+1):
     if i % 3 == 0 or i % 10 == 3 :
         print(" {}".format(i),end='')
    print()

Fixed code:
x = int(input())

for i in range(1,x+1):
     if i % 3 == 0 or i % 10 == 3 or '3' in str(i):
         print(" {}".format(i),end='')
print()
Buggy code:
n = int(input())
for i in range(1, n + 1):
    x = i
    if x % 3 == 0:
        print(" ", i, sep="")
    else:
        while x > 0:
            if x % 10 == 3:
                print(" ", i, sep="")
                break
            x //= 10
print()

Fixed code:
n = int(input())
for i in range(1, n + 1):
    x = i
    if x % 3 == 0:
        print(" ", i, sep="", end="")
    else:
        while x > 0:
            if x % 10 == 3:
                print(" ", i, sep="", end="")
                break
            x //= 10
print()
Buggy code:
#coding: utf-8

n = int(input())

for i in range(1, n+1):
    x = i
    if x % 3 == 0:
        print(" " + str(x), end = '')
        continue

    for j in range(1,6):
        if int(x / (10**j)) % 10 == 3:
            print(" " + str(x), end = '')
            break
print("")


Fixed code:
#coding: utf-8

n = int(input())

for i in range(1, n+1):
    x = i
    if x % 3 == 0:
        print(" " + str(x), end = '')
        continue
    

    for j in range(6):
        if int(x / (10**j)) % 10 == 3:
            print(" " + str(x), end = '')
            break
print("")
Buggy code:
n=int(input())
 
result=[]
for i in range(1,n+1):
    if i %3==0:
        result.append(i)
    else:
        k=i
        for j in range(1,len(str(n))+1):
            if k%10**==3:
                result.append(i)
                break
            else:
                k=k//10**j
        else:
            continue
 
print("",*result)

Fixed code:
n=int(input())
 
result=[]
for i in range(1,n+1):
    if i %3==0:
        result.append(i)
    else:
        k=i
        for j in range(1,5):
            if k%10==3:
                result.append(i)
                break
            else:
                k=k//10
        else:
            continue
 
print("",*result)
Buggy code:
n = int(input())
for i in range(3, n+1):
    x = i
    if x % 3 == 0:
        print(' {0}'.format(i), end=' ')
        continue

    while x != 0:
        if x % 10 == 3:
            print(' {0}'.format(i), end=' ')
            break
        x // = 10

print()

Fixed code:
n = int(input())
for i in range(1, n+1):
    if i % 3 == 0:
        print(" {}".format(i), end = "")
    else:
        x = i 
        while x:
            if x % 10 == 3:
                print(" {}".format(i), end = "")
                break
            x //= 10
print()
Buggy code:
n = int(input())
for i in range(1,n+1):
   x = i
   if x % 3 == 0:
        print('', i, end='')
    else:
        while True:
            if x % 10 == 3:
                print('', i, end='')
            x //= 10
            if x == 0:
                break

Fixed code:
n = int(input())
for i in range(1,n+1):
   x = i
   if x % 3 == 0:
        print('', i, end='')
   else:
        while True:
            if x % 10 == 3:
                print('', i, end='')
                break
            x //= 10
            if x == 0:
                break
print()
Buggy code:
N = int(input())

def num(i):
 num = []
 n = i
 while n != 0:
  num.append(n % 10)
  n = n // 10
 num.reverse()
 return int(num[0])

for i in range(1, N+1):
 if i % 3 == 0:
  print(" " + str(i), end="")
 elif num(i) == 3:
  print(" " + str(i), end="")
print("")

Fixed code:
N = int(input())

def num(i):
 num = []
 n = i
 while n != 0:
  num.append(n % 10)
  n = n // 10
 return 3 in num

for i in range(1, N+1):
 if i % 3 == 0:
  print(" " + str(i), end="")
 elif num(i):
  print(" " + str(i), end="")
print("")
Buggy code:
def nabeatsu(n):
    if(n % 3 == 0):
        return True
    temp = n
    while(temp > 0):
        if(temp % 10 == 3):
            return True
        temp = temp // 10
    return False

x = int(input())
for i in range(x):
    if(nabeatsu(i + 1)):
        print(' ', i + 1, end = '')
print()


Fixed code:
def nabeatsu(n):
    if(n % 3 == 0):
        return True
    temp = n
    while(temp > 0):
        if(temp % 10 == 3):
            return True
        temp = temp // 10
    return False

x = int(input())
for i in range(x):
    if(nabeatsu(i + 1)):
        print(' ', end = '')
        print(i + 1, end = '')
print()
Buggy code:
n = int(input())
for i in range(3,n+1):
  x = i
  if x % 3 == 0:
    print(' {0}'.format(i), end='')
    continue

  while x != 0:
    if x % 10 == 3:
      print(' {0}.format(i), end='')
      break
    x //= 10

print()

Fixed code:
n = int(input())
for i in range(3,n+1):
  x = i
  if x % 3 == 0:
    print(' {0}'.format(i), end='')
    continue

  while x != 0:
    if x % 10 == 3:
      print(' {0}'.format(i), end='')
      break
    x //= 10

print()
Buggy code:
a=input()
num=[]
for x in range(int(a)):
    if x!=0 and x%3==0 or x%10==3:
        num.append(x)

str_list=map(str,num)
print(" "+" ".join(str_list))

Fixed code:
a=input()
num=[]
for x in range(int(a)+1):
    if x!=0 and x%3==0 or x%10==3 or "3" in str(x):
        num.append(x)

str_list=map(str,num)
print(" "+" ".join(str_list))
Buggy code:
def is_correct(i):
    if i % 3 == 0: return True
    while i > 0:
        if i % 10 == 3: return True
        i = i // 10
    return False

def main():
    n = int(input())
    for i in range(1, n + 1):
        if is_correct(i): print(' %d' % i)

if __name__ == "__main__":
    main()


Fixed code:
def is_correct(i):
    if i % 3 == 0: return True
    while i > 0:
        if i % 10 == 3: return True
        i = i // 10
    return False
 
def main():
    n = int(input())
    answer = ""
    for i in range(1, n + 1):
        if is_correct(i): answer += " " + str(i)
    print(answer)    
 
if __name__ == "__main__":
    main()
Buggy code:
n=int(input())                                                               
for i in range(1,n+1):
      if i % 3 == 0 or '3' in str(i):
          print(' ', end='')
          print(i)

Fixed code:
n = input()
x = int(n)
for i in range(3,x+1) :
  if i%3 == 0 or '3' in str(i) :
    print('',i,end='')
print()
Buggy code:
n = int(input())
i = 1
while i <= n:
    x = i
    if (x % 3 == 0 or x % 10 == 3):
        print(' ', i, end='')
    else:
        x /= 10
        if (x % 10 == 3):
            print(' ', i, end='')
    i += 1
print()

Fixed code:
n = int(input())
i = 1
while i <= n:
    x = i
    if (x % 3 == 0 or x % 10 == 3):
        print('', i, end='')
    else:
        x = int(x / 10)
        while x > 0:
            if (x % 10 == 3):
                print('', i, end='')
                break
            x = int(x / 10)
    i += 1
print()
Buggy code:
n=int(input())
for i in range(1,n+1):
  if i % 3 == 0 or '3' in str(i):
    print('{0}'.format(i), end='') 

Fixed code:
n = int(input())

for i in range(1,(n+1)):
    if i%3 == 0 or '3' in str(i) :
        print(" {}".format(i),end="")
print()
Buggy code:
def check(num):
    n = str(num)
    for i in range(len(n)):
        if n[i] == '3': return True
    return False

n = int(input())
print('3', end = '')
for i in range(4, n):
    if i % 3 == 0: print(' ' + str(i), end = '')
    elif check(i):
        print(' ' + str(i), end = '')



Fixed code:
def check(num):
    n = str(num)
    for i in range(len(n)):
        if n[i] == '3': return True
    return False

n = int(input())
for i in range(1, n + 1):
    if i % 3 == 0: print(' ' + str(i), end = '')
    elif check(i):
        print(' ' + str(i), end = '')
print()
Buggy code:
n = int(input())
for i in range(n + 1):
	if i % 3 == 0 or str(i).find("3") != -1:
		print(" {}".format(i), end = '')
print()


Fixed code:
n = int(input())
for i in range(1, n + 1):
	if i % 3 == 0 or str(i).find("3") != -1:
		print(" {}".format(i), end = '')
print()
Buggy code:
n = int(input())
print(" ",end="")
print(*[i for in range(1,1+n) if i%3==0 or'3' in str(i)])


Fixed code:
print("", *[i for i in range(1, int(input()) + 1) if i % 3 == 0 or "3" in str(i)])
Buggy code:
a=int(input())

for i in range(3,a+1):
    if i% 3==0:
        print(" "+str(i),end=" ")

  
    

Fixed code:
a = int(input())
for i in range(1, a + 1):
    if i % 3==0 or '3' in str(i):
        print(' ' + str(i) , end='')
    if i == a:
        print('')
Buggy code:
N = int(input())

result = ' '.join([str(c) for c in range(1, N + 1) 
  if c == 3 or '3' in str(c)])

print(' ' + result)

Fixed code:
N = int(input())

result = ' '.join([str(c) for c in range(1, N + 1) 
  if c % 3 == 0 or '3' in str(c)])

print(' ' + result)
Buggy code:
N = int(input())

print(' {}'.format(' '.join([str(c) for c in range(1, N + 1) 
  if c % 3 == 0 or '3' in str(c)])

Fixed code:
N = int(input())

print(' {}'.format(' '.join([str(c) for c in range(1, N + 1) 
  if c % 3 == 0 or '3' in str(c)])))
Buggy code:
n = int(input())

result = [" "]
for i in range(3, n + 1):
    if i % 3 == 0:
        result.append(i)
    elif "3" in str(result):
        result.append(i)
print(*result)

Fixed code:
n = int(input())

result = [""]
for i in range(3, n + 1):
    if i % 3 == 0:
        result.append(i)
    elif "3" in list((str(i))):
        result.append(i)
print(*result)
Buggy code:
def call(n):

    i = 0
    while True:
        i += 1
        if i > n:
            break
        x = i
        if x % 3 == 0:
            print(' ' + str(i), end = '')
            continue

        while True:
            if x % 10 == 3:
                print(' ' + str(i), end = '')
                break
            x /= 10
            if x == 0:
                break
            
    print()

Fixed code:
n = int(input())

def call(n):
    i = 0
    while True:
        i += 1
        if i > n:
            break
        x = i
        if x % 3 == 0:
            print(' ' + str(i), end = '')
            continue

        while True:
            if int(x) % 10 == 3:
                print(' ' + str(i), end = '')
                break
            x /= 10
            if x == 0:
                break
            
    print()
    
call(n)
Buggy code:
import sys
n=int(input())
a=[]
for i in range(1,n+1):
    if (i%3==0):
        a.append(i)
    else:
        j=str(i)
        for k in range(len(j)-1):
            if j[k]=="3":
                a.append(i)
                break
for i in a:
    sys.stdout.write(" {0}".format(i))
sys.stdout.write("\n")

Fixed code:
import sys
n=int(input())
a=[]
for i in range(1,n+1):
    if (i%3==0):
        a.append(i)
    else:
        j=str(i)
        for k in range(len(j)):
            if j[k]=="3":
                a.append(i)
                break
for i in a:
    sys.stdout.write(" {0}".format(i))
sys.stdout.write("\n")
Buggy code:
n = int(input())                                                                
for i in range(n + 1):
    if i != 0:
        if i % 3 == 0:
            print('',i,end='')
        elif '3' in str(i):
            print('',i,end='')
    print('')

Fixed code:
n = int(input())
for i in range(n + 1):
    if i != 0:
        if i % 3 == 0 or '3' in str(i):
            print('',i,end='')                                                  
print()
Buggy code:
n = int(input().split())
for i in range(n):
    if i%3==0:
        print(" "+str(i+1), end="")
    else:
        x = i+1
        while(x>0):
            if x%10==3:
                print(" "+str(i+1), end="")
                break
            else:
                x = x//10

Fixed code:
n = int(input())
for i in range(n):
    if (i+1)%3==0:
        print(" "+str(i+1), end="")
    else:
        x = i+1
        while(x>0):
            if x%10==3:
                print(" "+str(i+1), end="")
                break
            else:
                x = x//10
print("")
Buggy code:
a = 500
for i in range(1,a+1):
    x = i
    if i % 3 == 0 or i % 10 == 3:
        print(" {}".format(i), end = "")
    else:
        while int(x) > 0:
            x /= 10
            if int(x) % 10 == 3:
                print(" {}".format(i), end = "")
                break
print()


Fixed code:
a = int(input())
for i in range(1,a+1):
    x = i
    if i % 3 == 0 or i % 10 == 3:
        print(" {}".format(i), end = "")
    else:
        while int(x) > 0:
            x /= 10
            if int(x) % 10 == 3:
                print(" {}".format(i), end = "")
                break
print()
Buggy code:
#15dpro
n=int(input())
#s=
#print(n)
for i in range(1,n+1):
 #   print(i)
    if i%3==0:
        print(' '+str(i),end='')
    else:
        x=i
  #      print(x)
        while x>0 and x%10!=3:
      #      print(x)
            x//=10
        if x%10==3:
            print(' '+str(i),end='')
print('/n')

Fixed code:
#15dpro
n=int(input())
s=''
#print(n)
for i in range(1,n+1):
 #   print(i)
    if i%3==0:
        s+=' '+str(i)
    else:
        x=i
  #      print(x)
        while x>0 and x%10!=3:
      #      print(x)
            x//=10
        if x%10==3:
            s+=' '+str(i)
print(s)
Buggy code:
n=input()
s=''
for i in range(1,int(n)+1):
    s += (str(i) + ' ') if i%3==0 or '3' in str(i) else ''
print(s[0:int(n)])

Fixed code:
n=input()
s=''
for i in range(1,int(n)+1):
    s += (' '+str(i)) if i%3==0 or '3' in str(i) else ''
print(s)
Buggy code:
n = int(input())
x = 1
y = ""
z = 1
while True:
    z = 1
    x += 1
    if x % 3 == 0:
        y += " "
        y += str(x)
    else:
        while True:
            b = int(x % 10 ** (z - 1))
            a = int((x - b) / 10 ** z)
            c = a % 10 ** z
            d = a % 10 ** (z - 1)
            if a == 3 or b == 3 or c == 3 or d == 3:
                y += " "
                y += str(x)
                break
            z += 1
            if a < 3:
                break
    if x >= n:
        break
print(y)


Fixed code:
n = int(input())
x = 1
y = ""
z = 1
while True:
    z = 1
    x += 1
    if x % 3 == 0:
        y += " "
        y += str(x)
    else:
        while True:
            b = int(x % 10 ** (z - 1))
            a = int((x - b) / 10 ** z)
            c = a % 10 ** z
            d = a % 10 ** (z - 1)
            if a == 3 or b == 3 or c == 3 or d == 3:
                y += " "
                y += str(x)
                break
            z += 1
            if a < 3 and z > 3:
                break
    if x >= n:
        break
print(y)
Buggy code:
n = int(input())
print(' ' + ''.join(map(str, [x for x in range(3, n + 1) if x % 3 == 0 or x % 10 == 3])))

Fixed code:
n = int(input())
print(' ' + ' '.join(map(str, [x for x in range(3, n + 1) if x % 3 == 0 or '3' in str(x)])))
Buggy code:
import sys
n = int(input())
sys.stdout.write(" ")
answer = []
for i in range(n + 1):
    if i%3 == 0:
        answer.append(i)
    elif '3' in str(i):
        answer.append(i)
print(*answer)

Fixed code:
import sys
n = int(input())
sys.stdout.write(" ")
answer = []
for i in range(3, n + 1):
    if i%3 == 0:
        answer.append(i)
    elif '3' in str(i):
        answer.append(i)
print(*answer)
Buggy code:
n = int(input())
i = 1
a = ''
while i <= n:
    x = i
    if x % 3 == 0:
        a += ' ' + str(i)
    elif x % 10 == 3:
        a += ' ' + str(i)
    x /= 10
    while x:
        if x % 10 == 3:
            a += ' ' + str(i)
        x /= 10
    i += 1
print(a)


Fixed code:
n = int(input())
i = 1
a = ''
while i <= n:
    x = i
    if x % 3 == 0:
        a += ' ' + str(i)
    elif x % 10 == 3:
        a += ' ' + str(i)
    else:
        x /= 10
        x = int(x)
        while x:
            if x % 10 == 3:
                a += ' ' + str(i)
                break
            x /= 10
            x = int(x)
    i += 1
print(a)
Buggy code:
import sys
n=int(input())
for i in range(1,n+1):
	if(i%3==0 or i%10==3):
		i=str(i)
		sys.stdout.write(' '+i)
		i=int(i)
	print('')

Fixed code:
import sys
n=int(input())
for i in range(1,n+1):
	if(i%3==0 or i%10==3 or '3' in str(i)):		
		sys.stdout.write(' '+str(i))		
print('')
Buggy code:
n = int(input())
for i in range(1, n+1):
	if i%3 == 0 or str(i) in "3":
		print(" {0}".format(i), end='')
print()

Fixed code:
n = int(input())
for i in range(1, n+1):
	if i%3 == 0 or "3" in str(i):
		print(" {0}".format(i), end='')
print()
Buggy code:
def include3(n):
	cond = 0
	while True:
		if n%10==3:
			cond = 1
			return cond
		elif n>9:
			n /= 10
		else:
			return cond

n = int(input())
print(' ',end='')
for i in range(i,n+1):
	if i%3==0 or include3(n)==1:
		print('%d ' % (n))


Fixed code:
def include3(n):
	cond = 0
	while True:
		if n%10==3:
			cond = 1
			return cond
		elif n>9:
			n //= 10
		else:
			return cond

n = int(input())
for i in range(1,n+1):
	if i%3==0 or include3(i)==1:
		print(' ',end='')
		print(i,end='')
print()
Buggy code:
def contains3(n):
    while n > 0:
        if n % 10 == 3:
            return True
        else:
            n /= 10
    return Falses

x = int(input())
out = ""
for i in range(x):
    n = i + 1
    if n % 3 == 0 or contains3(n):
        out += (" %d" % n)
print(out)

Fixed code:
def contains3(n):
    x = n
    while x > 0:
        if x % 10 == 3:
            return True
        else:
            x //= 10
    return False

x = int(input())
out = ""
for i in range(x):
    n = i + 1
    if n % 3 == 0 or contains3(n):
        out += (" %d" % n)
print(out)
Buggy code:
def inc3(i):
    if i % 3 == 0: return(True)
    elif i//10==0:
        return(False)
    else:    
        return(inc3(i//10))

n = int(input())
for i in range(1,n+1):
    if inc3(i):
        print(" " + str(i),end="")
print()

Fixed code:
def inc3(i):
    if i - (i // 10)*10 == 3:
        return(True)
    elif i//10==0:
        return(False)
    else:    
        return(inc3(i//10))

n = int(input())
for i in range(1,n+1):
    if i%3==0 or inc3(i):
        print(" " + str(i),end="")
print()
Buggy code:
x=int(input())
for i in range(1,x+1):
    if i % 3 == 0 or "3" in str(i):
        print("{}".format(i),end="")

Fixed code:
num = int(input())
for i in range(1,num+1):
    if i % 3 == 0 or '3' in str(i): 
        print(" {0}".format(i), end="")
print("")