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: WA: Presentation Error

Solution code:
# coding=utf-8


def main():
    n = input()
    i = 1
    # -------------------------------------------------------------------------
    # CHECK_NUM
    while True:
        x = i
        if x % 3 == 0:
            print ' ' + str(i),
            # -----------------------
            # END_CHECK_NUM
            i += 1
            if i <= n:
                # goto CHECK_NUM
                continue
            else:
                print
                # END!!
                break
            # -----------------------
        # -----------------------------------------------------
        # INCLUDE3
        while True:
            if x % 10 == 3:
                print ' ' + str(i),
                # -----------------------
                # END_CHECK_NUM
                i += 1
                if i <= n:
                    # goto INCLUDE3
                    break
                else:
                    print
                    # END!!
                    return 0
                # -----------------------
            else:
                x /= 10
                if x:
                    # goto INCLUDE3
                    continue
                else:
                    # -----------------------
                    # END_CHECK_NUM
                    i += 1
                    if i <= n:
                        # goto CHECK_NUM
                        break
                    else:
                        print
                        # END!!
                        return 0
                    # -----------------------
        # -----------------------------------------------------
    # -------------------------------------------------------------------------

if __name__ == '__main__':
    main()

Submission status: WA: Presentation 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: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

Solution code:
i = int(input())

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

print()

Submission status: WA: Presentation Error

Solution code:
n = input()
x = 1
print " ",
while True:
    if x > n:
        break

    if x % 3 == 0:
        print x,
    elif x % 10 == 3:
        print x,
    x += 1

Submission status: WA: Presentation Error

Solution code:
n = input()
x = 1
while True:
    if x > n:
        break

    if x % 3 == 0:
        print x,
    elif x % 10 == 3:
        print x,
    x += 1

Submission status: WA: Presentation Error

Solution code:
n = input()
x = 1
result = []
while True:
    if x > n:
        break

    if x % 3 == 0:
        result.append(str(x)),
    elif x % 10 == 3:
        result.append(str(x))
    x += 1

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

Submission status: WA: Presentation Error

Solution code:
n = input()
x = 1
result = []
while True:
    if x > n:
        break

    if x % 3 == 0:
        result.append(str(x)),
    elif x % 10 == 3:
        result.append(str(x))
    x += 1
print ' '.join(result)

Submission status: WA: Presentation Error

Solution code:
n = input()
x = 1
while True:
    if x > n:
        break
    if x % 3 == 0:
        print x,
    elif x % 10 == 3:
        print x,
    x += 1

Submission status: WA: Presentation Error

Solution code:
n = input()
x = 1
print ''
while True:
    if x > n:
        break
    if x % 3 == 0:
        print x,
    elif x % 10 == 3:
        print x,
    x += 1

Submission status: WA: Presentation Error

Solution code:
num = input()
print " ",
for x in xrange(1,num+1):
    if x%3==0:
        print x,
    elif str(x)[-1]=="3":
        print x,
    else:
        pass

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

Solution code:
import sys
n = input()
for i in range(1, n + 1) :
    if (i % 3 == 0 or i % 10 == 3) :
        sys.stdout.write(" %d" % (i))

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation 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: WA: Presentation 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 = "")

Submission status: WA: Presentation Error

Solution code:
n = int(input())

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

Submission status: WA: Presentation 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: WA: Presentation Error

Solution code:
n = input()

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

Submission status: WA: Presentation Error

Solution code:

n = input()


for i in range(3,n+1) :
    if i % 3 == 0 :
        print" ",
        print i ,
    elif i%10 == 3 :
        print" ",
        print i,

Submission status: WA: Presentation Error

Solution code:

n = input()
print" ",

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

Submission status: WA: Presentation Error

Solution code:
n = int(raw_input())

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

Submission status: WA: Presentation Error

Solution code:
n = int(raw_input())

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

Submission status: WA: Presentation Error

Solution code:
import sys
n = input()
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: WA: Presentation Error

Solution code:
import sys
n = input()
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
print ' '

Submission status: WA: Presentation Error

Solution code:
import sys
n = input()
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: WA: Presentation Error

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

Submission status: WA: Presentation Error

Solution code:
n = int(raw_input())

print " ",

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

Submission status: WA: Presentation Error

Solution code:
n = int(raw_input())

print "",

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

Submission status: WA: Presentation Error

Solution code:
n = input()
result = " "
for x in xrange(1,n+1):
    if x % 3 == 0:
        result = result + str(x) + " "

    elif x % 10 == 3:
        result = result + str(x) + " "
        while x :
            x /= 10
            if x % 10 == 3:
                result = result + str(x) + " "

print result

Submission status: WA: Presentation Error

Solution code:
n = int(input())
print(' ', end="")
s = [x for x in range(1, n+1) if (not (x % 3) or not (x % 10 -3))]
for x in s:
    print(x, end=" ")

Submission status: WA: Presentation Error

Solution code:
n = int(input())
print(' ', end="")
s = [x for x in range(1, n+1) if (not (x % 3) or not (x % 10 -3))]
for x in s:
    print(x, end=" ")
print('\n')

Submission status: WA: Presentation Error

Solution code:
n = int(input())
s = [x for x in range(1, n+1) if (not (x % 3) or not (x % 10 -3))]
for x in s:
    print('',x, end="")
print('\n')

Submission status: WA: Presentation Error

Solution code:
n = int(input())
s = [x for x in range(1, n+1) if (not (x % 3) or not (x % 10 -3))]
for x in s:
    print('',x, end="")

Submission status: WA: Presentation Error

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

n = input()

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

Submission status: WA: Presentation Error

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

n = input()

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

Solution code:
# encoding:utf-8
n = int(input())
result = ''

for i in range(n + 1):
    if ((i % 3) == 0 or (i % 10) ==3) and i != 0:
        result += (str(i) + ' ')

result = result[:len(result) -1]
print(result)

Submission status: WA: Presentation Error

Solution code:
# encoding:utf-8
n = int(input())
result = ''

for i in range(n + 1):
    if ((i % 3) == 0 or (i % 10) ==3) and i != 0:
        result += (str(i) + ' ')

#result = result[:len(result) -1]
print(result)

Submission status: WA: Presentation Error

Solution code:
# encoding:utf-8
n = int(input())
result = ' '

for i in range(n + 1):
    if ((i % 3) == 0 or (i % 10) ==3) and i != 0:
        result += (str(i) + ' ')

#result = result[:len(result) -1]
print(result)

Submission status: WA: Presentation Error

Solution code:
n = input()
i = 1

while True: #CHECK_NUM:
    x = i
    if x%3==0:
        print ' %d' % i, #goto END_CHECK_NUM
    else:
        while True: #INCLUDE3:
            if x%10==3:
                print ' %d' % i,
                break #goto END_CHECK_NUM

            x /= 10
            if x==0:
                break #or goto INCLUDE3

    #END_CHECK_NUM:
    i = i+1
    if i > n:
        break

print ''

Submission status: WA: Presentation Error

Solution code:
n = input()
i = 1

while True: #CHECK_NUM:
    x = i
    if x%3==0:
        print ' %d' % i, #goto END_CHECK_NUM
    else:
        while True: #INCLUDE3:
            if x%10==3:
                print ' %d' % i,
                break #goto END_CHECK_NUM

            x /= 10
            if x==0:
                break #or goto INCLUDE3

    #END_CHECK_NUM:
    i = i+1
    if i > n:
        break

#print ''

Submission status: WA: Presentation Error

Solution code:
n = input()
i = 1

while True: #CHECK_NUM:
    x = i
    if x%3==0:
        print ' %d' % i, #goto END_CHECK_NUM
    else:
        while True: #INCLUDE3:
            if x%10==3:
                print ' %d' % i,
                break #goto END_CHECK_NUM

            x /= 10
            if x==0:
                break #or goto INCLUDE3

    #END_CHECK_NUM:
    i = i+1
    if i > n:
        break

Submission status: WA: Presentation Error

Solution code:
n = input()
i = 1

while True: #CHECK_NUM:
    x = i
    if x%3==0:
        print '%d ' % i, #goto END_CHECK_NUM
    else:
        while True: #INCLUDE3:
            if x%10==3:
                print '%d ' % i,
                break #goto END_CHECK_NUM

            x /= 10
            if x==0:
                break #or goto INCLUDE3

    #END_CHECK_NUM:
    i = i+1
    if i > n:
        break

Submission status: WA: Presentation Error

Solution code:
import sys
n = input()
i = 1

while True: #CHECK_NUM:
    x = i
    if x%3==0:
        #print '%d ' % i, #goto END_CHECK_NUM
        sys.stdout.write(str(i) + ' ')
    else:
        while True: #INCLUDE3:
            if x%10==3:
                #print '%d ' % i,
                sys.stdout.write(str(i) + ' ')
                break #goto END_CHECK_NUM

            x /= 10
            if x==0:
                break #or goto INCLUDE3

    #END_CHECK_NUM:
    i = i+1
    if i > n:
        break

Submission status: WA: Presentation Error

Solution code:
import sys
n = input()
i = 1

while True: #CHECK_NUM:
    x = i
    if x%3==0:
        #print '%d ' % i, #goto END_CHECK_NUM
        sys.stdout.write(str(i) + ' ')
    else:
        while True: #INCLUDE3:
            if x%10==3:
                #print '%d ' % i,
                sys.stdout.write(str(i) + ' ')
                break #goto END_CHECK_NUM

            x /= 10
            if x==0:
                break #or goto INCLUDE3

    #END_CHECK_NUM:
    i = i+1
    if i > n:
        break
print ''

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

Solution code:
n = input()

for i in range(1, n+1):
    k = 1
    a = 0
    x = i
    if x%3 == 0:
        print i,
    else:
        while x != 0 and a == 0:
            if x%10 == 3:
                print i,
                a = 1
                k = 2
            else:
                x = x/10

Submission status: WA: Presentation Error

Solution code:
import sys
import math

n = input()

for x in xrange(1, n+1) :
    if x%3==0 or x%10==3 :
        sys.stdout.write(' ' + str(x))

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

Solution code:
a=int(input())
for x in range(1,a+1):
    if(x%3==0 or x%10==3):
        print(" "+str(x),end="")

Submission status: WA: Presentation Error

Solution code:

a=int(input())
for x in range(1,a+1):
    if(x%3==0 or x%10==3):
        print(str(x),end=" ")

Submission status: WA: Presentation Error

Solution code:

a=int(input())
for x in range(1,a+1):
    if(x%3==0 or x%10==3):
        print(" "+str(x),end="")

Submission status: WA: Presentation Error

Solution code:
# coding: utf-8
num = int(input())
i = 0
while (i != num):
    i+=1
    if i % 3 == 0:
        print(i, end=" ")
    elif "3" in str(i):
        print(i, end=" ")

Submission status: WA: Presentation Error

Solution code:
# coding: utf-8
num = int(input())
i = 0
while (i != num):
    i+=1
    if i % 3 == 0:
        print(i, end="")
        if i != num:
            print(" ", end="")
    elif "3" in str(i):
            print(i, end="")
            if i != num:
                print(" ",end="")

Submission status: WA: Presentation Error

Solution code:
# coding: utf-8
num = int(input())
i = 0
while (i != num):
    i+=1
    if i % 3 == 0:
        print(i, end="")
        if i != num:
            print(" ", end="")
    elif "3" in str(i):
            print(i, end="")
            if i != num:
                print(" ",end="")
print("")

Submission status: WA: Presentation Error

Solution code:
# coding: utf-8
num = int(input())
i = 0
print(" ",end="")
while (i != num):
    i+=1
    if i % 3 == 0:
        print(i, end="")
        if i != num:
            print(" ", end="")
    elif "3" in str(i):
            print(i, end="")
            if i != num:
                print(" ",end="")

Submission status: WA: Presentation Error

Solution code:
# coding: utf-8
num = int(input())
i = 0
print(" ",end="")
while (i != num):
    i+=1
    if i % 3 == 0:
        print(i, end="")
        if i != num:
            print(" ", end="")
    elif "3" in str(i):
            print(i, end="")
            if i != num:
                print(" ",end="")
print("")

Submission status: WA: Presentation Error

Solution code:
n = int(input())
ans = ""
for i in range(1,n+1):
    if (i % 3 == 0 or i % 10 == 3) and i != n:
        ans += str(i) + " "
    elif (i % 3 == 0 or i % 10 == 3) and i == n:
        ans += str(i)

print(ans)

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

Solution code:
i = input()
if 3 < i < 10000:
        for n in xrange(1,i+1):
                if n%3==0 or "3" in  str(n):
                        print n,

Submission status: WA: Presentation Error

Solution code:
i = input()
if 3 < i < 10000:
        for n in xrange(1,i+1):
                if n%3==0 or "3" in  str(n):
                        print n,
else:
        print ""

Submission status: WA: Presentation Error

Solution code:
i = input()
if 3 < i < 10000:
        for n in xrange(1,i+1):
                if n%3==0 or "3" in  str(n):
                        print n,
else:
        print "",

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation 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: WA: Presentation 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: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation 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='')

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

Solution code:
N = int(input())
Plist = []
i=1
while i <= N:
    if i%3 == 0:
        Plist.append(i)
    elif i//10 == 3:
        Plist.append(i)
    elif i%10 == 3:
        Plist.append(i)
    i=i+1
print(" ".join(map(str, Plist)))

Submission status: WA: Presentation Error

Solution code:
#coding:utf-8
#3????????°???????????????

n = input()

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

Submission status: WA: Presentation Error

Solution code:
#coding:utf-8
#3????????°???????????????

n = input()

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

print ""

Submission status: WA: Presentation Error

Solution code:
#coding:utf-8
#3????????°???????????????

n = input()

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

print "\n"

Submission status: WA: Presentation Error

Solution code:
#coding:utf-8
#3????????°???????????????

n = input()

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

Submission status: WA: Presentation Error

Solution code:
#coding:utf-8
#3????????°???????????????

n = input()

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

Submission status: WA: Presentation Error

Solution code:
#coding:utf-8
#3????????°???????????????

n = input()

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

Submission status: WA: Presentation Error

Solution code:
#coding:utf-8
#3????????°???????????????

n = input()

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

Solution code:
n = [int(x) for x in input().split()]

for nn in range(1, n[0] + 1):
  if nn % 3 == 0 or '3' in str(nn):
    print(' ' + str(nn), end = '')

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

Solution code:
#coding: UTF-8
import math

def SP(a):
    ans=""
    for i in range(3,a+1):
        if i<10:
            if i%3==0:
                ans += str(i)+" "
        else:
            i2=int(i/10)
            if i2%10==3 or i%3==0 or i%10==3:
                ans += str(i)+" "
    print(ans)

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

Submission status: WA: Presentation Error

Solution code:
#coding: UTF-8
import math

def SP(a):
    ans=""
    for i in range(3,a+1):
        if i<10:
            if i%3==0:
                ans += str(i)
                if i<a:
                     ans+=" "
            
        else:
            i2=int(i/10)
            if i2%10==3 or i%3==0 or i%10==3:
                ans += str(i)
                if i<a:
                    ans+=" "
    print(ans)

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

Submission status: WA: Presentation Error

Solution code:
#coding: UTF-8
import math

def SP(a):
    ans=""
    for i in range(1,a+1):
        if 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: WA: Presentation 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: WA: Presentation Error

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

Submission status: WA: Presentation Error

Solution code:
n = input()
i = 1
num = []
while i <= n:
    if i % 3 == 0:
        num.append(i)
        i +=1
    elif i % 10 == 3:
        num.append(i)
        i +=1
    elif i / 10 == 3:
        num.append(i)
        i +=1
    else:
        i +=1
print("{}".format(num).replace("[","").replace("]","").replace(",",""))

Submission status: WA: Presentation Error

Solution code:
n = input()
i = 1
num = []
while i <= n:
    if i % 3 == 0:
        num.append(i)
        i +=1
    elif i % 10 == 3:
        num.append(i)
        i +=1
    elif i / 10 == 3:
        num.append(i)
        i +=1
    else:
        i +=1
num_str=map(str,num)
print("{}".format(num_str).replace("[","").replace("]","").replace(",","").replace("'",""))

Submission status: WA: Presentation Error

Solution code:
n = input()
i = 1
num = []
while i <= n:
    if i % 3 == 0:
        num.append(i)
        i +=1
    elif i % 10 == 3:
        num.append(i)
        i +=1
    elif i / 10 == 3:
        num.append(i)
        i +=1
    else:
        i +=1
print("{}".format(str(num)).replace("[","").replace("]","").replace(",",""))