Problem:


Structured Programming

In programming languages like C/C++, a goto statement provides an unconditional jump from the "goto" to a labeled statement. For example, a statement "goto CHECK_NUM;" is executed, control of the program jumps to CHECK_NUM. Using these constructs, you can implement, for example, loops.

Note that use of goto statement is highly discouraged, because it is difficult to trace the control flow of a program which includes goto.

Write a program which does precisely the same thing as the following program (this example is wrtten in C++). Let's try to write the program without goto statements.

void call(int n){
  int i = 1;
 CHECK_NUM:
  int x = i;
  if ( x % 3 == 0 ){
    cout n is given in a line.

Output

Print the output result of the above program for given integer n.

Constraints

3 ≤ n ≤ 10000

Sample Input

30

Sample Output

 3 6 9 12 13 15 18 21 23 24 27 30

  Put a single space character before each element.



Sample input:
30


Sample output:
 3 6 9 12 13 15 18 21 23 24 27 30

Submission status: Accepted

Solution code:
n=int(input())
for i in range(1,n+1):
	if i%3==0:
		print(" "+str(i),end="")
	else:
		temp=i
		while temp>0:
			if temp%10==3:
				print(" "+str(i),end="")
				break
			else:
				temp=int(temp/10)
print("")

Submission status: Accepted

Solution code:
def include_3(n) :
    ans = False
    if n >= 10 :
        if n % 10 == 3 :
            ans = True
            return ans
        if n // 10 == 3 :
            ans = True
            return ans
        ans = include_3(n // 10)
    return ans

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

Submission status: Accepted

Solution code:
n = int(input())
i = 1

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

Submission status: Accepted

Solution code:
n = int(input())
i=1
while True:
    if i % 3 == 0 or "3" in str(i):
        print(" "+str(i), end="")
    if i == n:
        break
    i+=1
print()

Submission status: Accepted

Solution code:
n = int(input())

ans = [i for i in range(3, n+1) if i % 3 == 0 or "3" in str(i)]
print(' ' + ' '.join(map(str, ans)))

Submission status: Accepted

Solution code:
n = int(input())
x = 1
i = 0
while x <= n:
    if x % 3 == 0:
        print(" %d"%x,end="")
    elif x % 10 == 3:
        print(" %d"%x,end="")
    else:
        i = x
        while i:
            i //= 10
            if i % 10 == 3:
                print(" %d"%x,end="")
                break
    x += 1
print()

Submission status: Accepted

Solution code:
n = int(input())
s = ""
for i in range(1, n+1):
    x = i
    if (x % 3 == 0):
        s = s + " " + str(i)
    else:
        while x % 10 != 3 and x > 0:
            x = x // 10
        if x % 10 == 3:
            s = s + " " + str(i)
print(s)

Submission status: Accepted

Solution code:
N = int(input())
L = []
for i in range(1,N+1):
    if i %3 ==0:
        L.append(i)
    elif '3' in str(i):
        L.append(i)

word = ""
for i in range(len(L)):
    word =  word + " "+str(L[i])

print(word)

Submission status: Accepted

Solution code:
print("".join([" " + str(i) for i in range(1, int(input())+1) if i % 3 == 0 or '3' in str(i)]))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
print"".join(" "+str(i)for i in range(1,input()+1)if i%3==0 or'3'in str(i))

Submission status: Accepted

Solution code:
s = ''
n = int(input())
for i in range(1, n+1):
    if i % 3 == 0 or '3' in str(i):
        s += ' {0}'.format(i)
print(s)

Submission status: Accepted

Solution code:
n = int(input())
ans = ""
for i in range(1, n + 1):
    if i % 3 == 0:
        ans += " " + str(i)
    else:
        for j in list(str(i)):
            if j == "3":
                ans += " " + str(i)
                break
print(ans)

Submission status: Accepted

Solution code:
def doSame(n):
	i = 0
	while i <= n:
		i += 1
		cn(i, n)
	print()

def cn(i, n):
	x = i
	if x % 3 == 0:
		if i <= n:
			print(' %d' % (i), end='')
		return
	i3(x, i, n)

def i3(x, i, n):
	if x % 10 == 3:
		if i <= n:
			print(' %d' % (i), end='')
		return
	x = int(x / 10)
	if x > 0:
		i3(x, i, n)

doSame(int(input()))

Submission status: Accepted

Solution code:
n = int(input())
i = 1
while i<=n:
  if i%3==0:
    print("", i, end="")
  else:
    x = i
    while x:
      if x%10==3:
        print("", i, end="")
        break
      x //= 10
  i += 1
print()

Submission status: Accepted

Solution code:
# coding: utf-8
# input  : 30
# otuput : 3 6 9 12 13 15 18 21 23 24 27 30
num = int(input())
ans = ""
for num in range(3, num + 1):
    if num % 3 == 0 or num % 10 == 3 or '3' in list(str(num)):
        ans += ' ' + str(num)
print(ans)

Submission status: Accepted

Solution code:
s = int(input())
numbers = []
for i in range(s+1):
    if (i % 3 == 0 or "3" in str(i)) and i != 0:
        numbers.append(i)

for p in numbers:
    if len(numbers) == 1:
        print("",p)
    else:
        if p == numbers[0]:
            print("",p,end=" ")
        elif p == numbers[-1]:
            print(p)
        else:
            print(p,end=" ")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
s = ''
for i in range(1, n+1):
	if i % 3 == 0: 
		s += ' {0}'.format(i)
		continue
	x = i
	while x > 0:
		if x % 10 == 3:
			s += ' {0}'.format(i)
			break
		x //= 10
print(s)

Submission status: Accepted

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

def main():

	n = int(raw_input())
	i = 1
	print(''),
	while i <= n:
		x = i
		if x % 3 == 0:
			print('%d' % i),
		else:
			while x > 0:
				if x % 10 == 3:
					print('%d' % i),
					break
				x /= 10
		i += 1

if __name__ == "__main__":

	main()

Submission status: Accepted

Solution code:
arg = int(input())
data = []
for x in range(3,arg+1):
    if x % 3 == 0 or '3' in str(x):
        print('',x,end='')
    else:
        pass
print("")

Submission status: Runtime Error

Solution code:
a = int(input())
for i in range(1, a+1):
    if(i % 3 == 0 or i % 10 == 3):
        print(" %d"%i, emd = "")
print()

Submission status: Runtime Error

Solution code:
a = int(input())
for i in range(1, a+1):
    while True:
        if(i < 100):
            break
    if(i % 3 == 0 or i % 10 == 3 or i // 10 = 3):
        print(" %d"%i, end = "")
print()

Submission status: Runtime Error

Solution code:
inData = int(input())

seqData = list(range(1,inData+1,1))
outData = [0] * inData
for thisData in seqData:
    if thisData == inData:
        if thisData%3 == 0 or thisData%10==3 or int((thisData/10))%10==3:
            print(" "+str(thisData))
        else:
            print(" "+""\n")
    else:
        if thisData%3 == 0 or thisData%10==3 or int((thisData/10))%10==3:
            print(" "+str(thisData), end = "")
        else:
            pass

Submission status: Runtime Error

Solution code:
inData = int(input())

seqData = list(range(1,inData+1,1))
outData = [0] * inData
for thisData in seqData:
    if thisData == inData:
        if thisData%3 == 0 or thisData%10==3:
            print(" "+str(thisData), end = "")
        else:
            for i in range(5):
                i=i+1
                over =  10 ** i
                tmp = thisData/over
                if int(tmp % 10) == 3:
                    print(" "+str(thisData), end = "")
                    break
                else:
                    print("")
    else:
        if thisData%3 == 0 or thisData%10==3:
            print(" "+str(thisData), end = "")
        else:
            for i in range(5):
                i=i+1
                over =  10 ** i
                tmp = thisData/over
                if int(tmp % 10) == 3:
                    print(" "+str(thisData), end = "")
                    break
                else:
                    pass:

Submission status: Runtime Error

Solution code:
inData = int(input())

seqData = list(range(1,inData+1,1))
outData = [0] * inData
for thisData in seqData:
    if thisData == inData:
        if thisData%3 == 0 or thisData%10==3:
            print(" "+str(thisData))
        else:
            for i in range(5):
                i=i+1
                over =  10 ** i
                tmp = thisData/over
                if int(tmp % 10) == 3:
                    print(" "+str(thisData))
                    break
                else:
                    pass:
    else:
        if thisData%3 == 0 or thisData%10==3:
            print(" "+str(thisData), end = "")
        else:
            for i in range(5):
                i=i+1
                over =  10 ** i
                tmp = thisData/over
                if int(tmp % 10) == 3:
                    print(" "+str(thisData), end = "")
                    break
                else:
                    pass

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
a = 1
for i range in (1,n):
    if i % 10 == 3:
        print('{0}'.format(i))
    elif i % 3 == 0:
        if i % 10 == 3:
            continue
        print('{0}'.format(i))
    a = i
    a = a + 1

Submission status: Runtime Error

Solution code:
n = int(input())
a = 1
for i range in (1,n+1):
    if i % 10 == 3:
        print('{0}'.format(i))
    elif i % 3 == 0:
        if i % 10 == 3:
            continue
        print('{0}'.format(i))
    a = i
    a = a + 1

Submission status: Runtime Error

Solution code:
n = int(input())
a = 1
for i range in (n):
    if i % 10 == 3:
        print('{0}'.format(i))
    elif i % 3 == 0:
        if i % 10 == 3:
            continue
        print('{0}'.format(i))
    a = i
    a = a + 1

Submission status: Runtime Error

Solution code:
n = int(input())
a = 1
for i range in (n):
    if i % 10 == 3:
        print('{0}'.format(i))
    elif i % 3 == 0:
        if i % 10 == 3:
            continue
        print('{0}'.format(i))

Submission status: Runtime Error

Solution code:
n = int(input())
a = 1
for i range in (1,n):
    if i % 10 == 3:
        print('{0}'.format(i))
    elif i % 3 == 0:
        if i % 10 == 3:
            continue
        print('{0}'.format(i))

Submission status: Runtime Error

Solution 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())
ans = []
for i in range(x):
    if(nabeatsu(i + 1)):
        ans.append(i + 1)
print(' '.join(ans))

Submission status: Runtime Error

Solution 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())
ans = []
for i in range(x):
    if(nabeatsu(i + 1)):
        ans.append(i + 1)
print((' '.join(ans)))

Submission status: Runtime Error

Solution code:
a = int(input())
for i in range(1,a+3):
    if i % 3 == 0 or i % 10 == 3 or (int(i/10) % 3 == 0 and int(i/10) != 0:
        print(" {}".format(i), end = "")
    elif i % 10 == 3:
        print(" {}".format(i), end = "")
print()

Submission status: Runtime Error

Solution code:
a = int(input())
for i in range(1,a+1):
    if i % 3 == 0 or i % 10 == 3:
        print(" {}".format(i), end = "")
    else:
        while x < 0:
            int(x/=10)
            if x % 10 == 3:
                print(" {}".format(i), end = "")

print()

Submission status: Runtime Error

Solution code:
n = int(input())
i = 1

while True:
    x = i
    if  x % 3 == 0 or x % 10 ==3 or x / 10 == 0:
        print(" %d" i)
        i+=1
        if i > n:
            print()
            break

Submission status: Runtime Error

Solution code:
n = int(input())
i = 1

while True:
    x = i
    if  x % 3 == 0 or x % 10 ==3 or x / 10 == 0:
        print(" " + i)
    i+=1
    if i > n:
        print()
        break

Submission status: Runtime Error

Solution code:
n = int(input())
i = 1

while True:
    x = i
    if  x % 3 == 0 or x % 10 ==3 or x / 10 == 0:
        print(" %d" i)
    i+=1
    if i > n:
        print()
        break

Submission status: Runtime Error

Solution code:
n = int(input())
i = 1

while True:
    x = i
    if  x % 3 == 0:
        print(" %d" ,i)
        i+=1
        if i > n:
            print()
            break
    if x % 10 == 3:
        print(" %d" ,i)
        i+=1
        if i > n:
            print()
            break
    else:
        x /= 10
        if x != 0
        continue

Submission status: Runtime Error

Solution code:
n = int(input())
i = 1

while True:
    x = i
    if  x % 3 == 0:
        print(" %d" ,i)
        i+=1
        if i > n:
            print()
            break
    if x % 10 == 3:
        print(" %d" ,i)
        i+=1
        if i > n:
            print()
            break
    else:
        x /= 10
        if x != 0:
        continue

Submission status: Runtime Error

Solution code:
n = int(input())
i = 1
ret = ""
while True:
    x = i
    if  x % 3 == 0:
        ret += " " + str(i)
    elif x % 10 == 3:
        ret += " " + str(i)
    else
        while x /= 10 > 0:
        if x % 10 == 3:
            ret += " " + str(i)
    i+=1
    if i > n:
        break

print(ret)

Submission status: Runtime Error

Solution code:
n = int(input())
i = 1
ret = ""
while True:
    x = i
    if  x % 3 == 0:
        ret += " " + str(i)
    elif x % 10 == 3:
        ret += " " + str(i)
    else:
        while x /= 10 > 0:
        if x % 10 == 3:
            ret += " " + str(i)
    i+=1
    if i > n:
        break

print(ret)

Submission status: Runtime Error

Solution code:
n = int(input())
i = 1
ret = ""
while True:
    x = i
    if  x % 3 == 0:
        ret += " " + str(i)
    elif x % 10 == 3:
        ret += " " + str(i)
    else:
        x /= 10
        while x > 0 :
        if x % 10 == 3:
            ret += " " + str(i)
            x /= 10
    i+=1
    if i > n:
        break

print(ret)

Submission status: Runtime Error

Solution code:
n = int(input())
i = 1
ret = ""
while True:
    x = i
    if  x % 3 == 0:
        ret += " " + str(i)
    elif x % 10 == 3:
        ret += " " + str(i)
    else:
        x /= 10
        while x > 0:
        if x % 10 == 3:
            ret += " " + str(i)
            x /= 10
    i+=1
    if i > n:
        break

print(ret)

Submission status: Runtime Error

Solution code:
a = set()
i = 1
n = int(input())
def checkNum():
    global a, i, x
    x = i
    if x%3 ==0:
        a.add(i)
        endCheck()
    include3()
    x //= 10;
    if x:
        include3()
    endCheck()

def include3():
    global a, i
    if x%10 == 3:
        a.add(i)
        endCheck()
        
def endCheck():
    global i
    if i+1 <= n:
        i += 1
        checkNum()
    
        
checkNum()

print('',*a)

Submission status: Runtime Error

Solution code:
n = int(input())
x = 1
while x <= 30:
    if(x%3==0 or x%10==3):
        print(' ',end=str(x))
    x += 1

Submission status: Runtime Error

Solution code:
function check(n):
    i = 1
    print(" ",end="")
    while(i != n):
        if  (i % 3 == 0):
            print(i,end="")
        elif(i % 10 == 3):
            print(i,end="")
            i = i / 10

Submission status: Runtime Error

Solution code:
function check(n):
    i = 1
    print(" ",end="")
    while(i != n):
        if  (i % 3 == 0):
            print(i,end="")
        elif(i % 10 == 3):
            print(i,end="")
            i = i / 10
        
check(30)

Submission status: Runtime Error

Solution code:
inp = int(input())

function check(n):
    i = 1
    print(" ",end="")
    while(i != n):
        if  (i % 3 == 0):
            print(i,end="")
        elif(i % 10 == 3):
            print(i,end="")
            i = i / 10

check(inp)

Submission status: Runtime Error

Solution code:
inp = int(input())

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

        
        

check(inp)

Submission status: Runtime Error

Solution code:
:!cat tes.py
array = []
for i in range(3,int(input()) + 1):
  if i % 3 == 0 or i % 10 == 3:
    array.append(i)
for i in array:
  print('',"{0}".format(i),end='')

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

  x //= 10
print()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

print()

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
for i in range(1, 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()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = input()
array = []
for i in range(1, n + 1):
    if x % 3 == 0 or x % 10 == 3:
        array.append(x)
print str(array).replace('[', '').replace(']', '').replace(',', '')

Submission status: Runtime Error

Solution code:
n = int(raw_input())
for i in range(1, n+1)
  if (i % 3 == 0 or i % 10 == 3)
    print (" %d" % i),

Submission status: Runtime Error

Solution code:
n = int(raw_input())
for i in range(1, n+1)
  if (i % 3 == 0 or i % 10 == 3)
    print " %d" % i,

Submission status: Runtime Error

Solution code:
n = int(raw_input())
for i in range(1, n+1)
  if (i % 3 == 0 or i % 10 == 3)
    print " %d" % i

Submission status: Runtime Error

Solution code:
n = int(raw_input())
for i in range(1, n+1)
  if (i % 3 == 0 or i % 10 == 3):
    print " %d" % i

Submission status: Runtime Error

Solution code:
import sys

n = input()
i = 1
for i in range(n) :
	if i%3==0 :
		sys.stdout.write(??? %d???%i)
for j in range(n) :
	if(j%10==3):
		sys.stdout.wite(??? %d???%j)
print??????

Submission status: Runtime Error

Solution code:
import sys

n = input()
for i in range(n) :
	if i%3==0 :
		sys.stdout.write(??? %d???%i)
for j in range(n) :
	if(j%10==3):
		sys.stdout.wite(??? %d???%j)
print??????

Submission status: Runtime Error

Solution code:
import sys

n = input()
for i in range(n) :
	if i%3==0 :
		sys.stdout.write(??? ???)
		sys.stdout.write(str(i))
for j in range(n) :
	if(j%10==3):
		sys.stdout.write(??? ???)
		sys.stdout.wite(str(j))
print??????

Submission status: Runtime Error

Solution code:
import sys

n = input()
for i in range(1,n+1) :
	if i%3==0 :
		sys.stdout.write(??? ???)
		sys.stdout.write(str(i))
	elif(i%10==3):
		sys.stdout.write(??? ???)
		sys.stdout.wite(str(i))
print ??????

Submission status: Runtime Error

Solution 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

Submission status: Runtime Error

Solution code:
n = int(raw_input())
print "",
for i in range(n+1):
  if i%3 == 0:
    print ("{0}",.format(i))
  elif i%3 == 3:
    print ("{0}",.format(i))
  else:
    i += 1

Submission status: Runtime Error

Solution code:
n=input()
print"",
for i in range(n+1):
  if i%3==0 or str(i).count('3'):
  print i,

Submission status: Runtime Error

Solution code:
n=input()
print"",
for i in range(1,n+1):
  if i%3==0 or str(i).count('3'):
  print i,

Submission status: Runtime Error

Solution code:
n = int(raw_input())
i =0
while i <=n:
 if i%3==0
print'i'

Submission status: Runtime Error

Solution code:
n = input()
x = 1
print ''
while True:
    if x > n:
        break
    if (x % 3 == 0) or ('3' in str(x)):
        print x

     x =x + 1

Submission status: Runtime Error

Solution code:
n = input()

print ,
for i in xrange(1, n+1):
    if i % 3 == 0 or i % 10 == 3:
        print i,

Submission status: Runtime Error

Solution code:
for i in range(n):
  if i%3==0 or i%10==3:
    print ' %d' % i

Submission status: Runtime Error

Solution code:
n = input()
x = 1
ans = ''
while 1:
  if x > n:
     break
  if ( x % 3 == 0 ) or ( '3' in str(x) ):
     ans = ans + x
  x += 1
  print ans

Submission status: Runtime Error

Solution code:
n = input()
x = 1
ans = ''
while 1:
  if x > n:
     break
  if ( x % 3 == 0 ) or ( '3' in str(x) ):
     ans = ans + x
  x += 1
print ans

Submission status: Runtime Error

Solution code:
n = input()
x = 1
ans = ' '
while 1:
  if x > n:
     break
  if ( x % 3 == 0 ) or ( '3' in str(x) ):
     ans = ans + x
  x += 1
print ans

Submission status: Runtime Error

Solution code:
n = input()
x = 1
ans = 0
while 1:
  if x > n:
     break
  if ( x % 3 == 0 ) or ( '3' in str(x) ):
     ans = ans + str(x)
  x += 1
print ans

Submission status: Runtime Error

Solution code:
n = int(raw_input())
s = ''

for i in range(1, n+1):
    if i%3 == 0:
        s = s + ' ' + str(i)
    elif i%10 == 3:
        s = s + ' ' + srt(i)
print s

Submission status: Runtime Error

Solution code:
n = input()
for i in range(1,n+1):
  x = i
  if x%3==0:
    print ' %d', % x
    continue
  elif x<=n:
    if x%10==3:
      print ' %d', % x
      break
    else:
      x /= 10
      if x==0:
        break

Submission status: Runtime Error

Solution code:
import sys
for i in range(1,n+1):
  x = i
  if x%3==0:
    sys.stdout.write(' %d' % x)
    continue
  while x<=n:
    if x%10==3:
      sys.stdout.write(' %d' % x)
      break
    else:
      x /= 10
      if x==0:
        break

Submission status: Runtime Error

Solution code:
a = gets.to_i
for num in 1..a
    if num.to_s =~ /3/ || num % 3 == 0
        print " #{num}"
    end
end
puts

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = input()
lst = []
for i in range(3,n+1):
	if i%3==0:
		lst.append(i)
	elif i%10==3:
		lst.append(i)
print " "+lst

Submission status: Runtime Error

Solution code:
n = input()
for i in range(1,n+1):
	if i%3==0 or str(i).count.("3"):
		print i

Submission status: Runtime Error

Solution code:
n = input()
print "",
for i in range(1,n+1):
	if i%3==0 or str(i).count.('3'):
		print i

Submission status: Runtime Error

Solution code:
x = int(input())
for i in range(1,x+1):
    if i%3 ==0:
        print(' ',i,end='',sep='')
    elif i%10 ==3:
        print(' ',i,end='',sep='')
prinit()

Submission status: Runtime Error

Solution code:
x = int(input())
for i in range(1,x+1):
    if i%3 ==0:
        print(i,' '.end='',sep='')
    elif i%10 ==3:
        print(i,'',end='',sep='')

Submission status: Runtime Error

Solution code:
while 1:
    m,n=map(int, raw_input().split())
    if n==m==0: break
    else: print (('#'*n+'\n')*m)

Submission status: Runtime Error

Solution code:
#coding: UTF-8
import math

def SP(a):
    ans=" "
    for i in range(a+1):
        if i!=0 and i%3==0 or i%10==3:
            ans+=str(i)+" "
            continue
        if int(i/10) >= 1:
            if int(i/10)%10==3:
                ans += str(i)+" "
    print(ans[:-1])

if __name__=="__main__":
    a=input()
    SP(int(a)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
x = int(input())

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

Submission status: Runtime Error

Solution code:
#coding:utf-8

def call(n):
    i=1

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
<?php
    fscanf(STDIN,"%d",$n);
    $i=1;

    while(true){
        $flag=false;
        if($i%3==0){
            $flag=true;
        }
        $a=$i;
        while($a>0){
            if($a%10==3){
                $flag=true;
            }
            $a/=10;
        }
        if($flag){
            echo " ", $i;
        }
        if($i==$n)break;
        $i++;
    }
 ?>

Submission status: Runtime Error

Solution code:
import sys
while 1:
	N=input()
	sys.stdout.write('\n')
	i = 1
	while 1:
		if (i % 3) == 0:
			sys.stdout.write(" ")
			sys.stdout.write("%d" % i)
		else :
			if (i % 10 ) == 3:
				sys.stdout.write(' ')
				sys.stdout.write("%d" % i)
		if i+1  >  N:
			break
		i += 1

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution 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

Submission status: Runtime Error

Solution code:
a = int(input())
x=-1
y=[]
while x<=a:
    x+=1
    if x%10==3 or x%3==0:
    y.append(str(x))
    
print(" ".join(y))

Submission status: Runtime Error

Solution code:
i = int(input())
j = 1

while j <= i:
  if j%3 == 0 or j%10 ==3 or'3' in str(j):
    print(' ',end='')
    print(j,end='')
  j += 1

print()

Submission status: Runtime Error

Solution 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)])

Submission status: Runtime Error

Solution code:
i = 1
n = int(input())
while i <= n:
	if i % 3 == 0:
		print(i , end = ' ')
	elif i % 10 == 3:
		print(i , end = ' ')
	i = i + 1

Submission status: Runtime Error

Solution code:
result=[]
for i in range(1,n+1):
    print(i)
    if i %3==0:
        result.append(i)
        print("3?????°")
   # elif i%10==3:
      #  result.append(i)
    else:
        k=i
        for j in range(1,5):
           # print(10**j,  i%(10**j))
            if k%(10**j)==3:
                result.append(i)
                print("include 3")
                break
            else:
                k=k//10**j
        else:
            continue

Submission status: Runtime Error

Solution code:
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**j)==3:
                result.append(i)
                break
            else:
                k=k//10**j
        else:
            continue

Submission status: Runtime Error

Solution code:
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**j)==3:
                result.append(i)
                break
            else:
                k=k//10**j
        else:
            continue

print(" ",*result)

Submission status: Runtime Error

Solution 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**j)==3:
                result.append(i)
                break
            else:
                k=k//10**j
        else:
            continue

print(" "," ".join(result))

Submission status: Runtime Error

Solution 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)):
            if k%(10**j)==3:
                result.append(i)
                break
            else:
                k=k//10**j
        else:
            continue

print(*result)

Submission status: Runtime Error

Solution 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**j)==3:
                result.append(i)
                break
            else:
                k=k//10**j
        else:
            continue

print(*result)