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:
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 str(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
    else:
        x = i
        while x > 0:
            if x % 10 == 3:
                num.append(i)
                break
            elif x / 10 == 3:
                num.append(i)
                break
            else:
                x /=  10                
        i += 1
print("{}".format(str(num)).replace("[","").replace("]","").replace(",",""))

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

Submission status: WA: Presentation Error

Solution code:
n = int(raw_input())

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

Submission status: WA: Presentation Error

Solution code:
from __future__ import print_function
n = int(raw_input())

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

Submission status: WA: Presentation Error

Solution code:
from __future__ import print_function
n = int(raw_input())

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

Solution code:
Max = int(input())
print(' '.join((str(x) for x in range(1, Max + 1) if 0 == x % 3 or 3 == x % 10)))

Submission status: WA: Presentation Error

Solution code:
Max = int(input())
print(' ',' '.join((str(x) for x in range(1, Max + 1) if 0 == x % 3 or 3 == x % 10)))

Submission status: WA: Presentation Error

Solution code:
def call(n):
    i = 1
    while i <= n:
        if i % 3 == 0:
            print(' {}'.format(i),end='')
        elif i % 10 == 3:
            print(' {}'.format(i),end='')
        i += 1

call(int(input()))

Submission status: WA: Presentation Error

Solution code:
def call(n):
    i = 1
    while i <= n:
        if i % 3 == 0:
            print(' {}'.format(i),end='')
        elif i % 10 == 3:
            print(' {}'.format(i),end='')
        i += 1

if __name__ == '__main__':
    call(int(input()))

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

Solution code:
import sys
x=[]
n=input()
for i in range(3,n+1):
    if i%3==0:
        x.append(i)
    else:
        j=i
        while j!=0:
            if j%10==3:
                x.append(i)
            j=j/10
X=iter(x)
sys.stdout.write(' ')
for i in X:
    sys.stdout.write('%d'%i)
    sys.stdout.write(' ')
print('')

Submission status: WA: Presentation Error

Solution code:
# -*- coding: utf-8 -*-
n=int(input())
d=[]
for i in range(3,n+1):
    if i%3==0 or "3" in str(i):
        d.append(i)
print(*d)

Submission status: WA: Presentation Error

Solution code:
n = int(input())
result = []
for i in range(1,n+1):
    si = str(i)
    if (not i % 3) or "3" in si:
        result.append(si)
print(" ".join(result))

Submission status: WA: Presentation Error

Solution code:
n = int(input())

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

print("")

Submission status: WA: Presentation Error

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

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

Submission status: WA: Presentation Error

Solution code:
n = int(input())
a = []

for i in range(1, n+1):
    if i % 3 == 0 or i % 10 == 3:
        a.append(str(i))

print(' '.join(a))

Submission status: WA: Presentation Error

Solution code:
import sys
try:
	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:

				raise Exception
			i += 1
except Exception:
	pass

Submission status: WA: Presentation Error

Solution code:
import sys
try:
	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:
				sys.stdout.write('\n')
				raise Exception
			i += 1
except Exception:
	pass

Submission status: WA: Presentation Error

Solution code:
import sys
N=input()
i = 1
for i in range(1,N+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)
        else:
            if (i/10)%10 == 3:
                #print (i/10)%10,"a"
                sys.stdout.write(' ')
                sys.stdout.write("%d" % i)
            else:
                if (i/100)%10 == 3:
                    sys.stdout.write(' ')
                    sys.stdout.write("%d" % i)

Submission status: WA: Presentation Error

Solution code:
num = int(input())
res = " ".join([str(x) for x in range(1, num+1) if x % 3 == 0 or str(x).find("3") != -1])
print(" {}".format(res), end="")

Submission status: WA: Presentation Error

Solution code:
n = int(input())

for i in range(1,n+1): #(m,n)..start:m and number:n
	if i%3 == 0 or i%10 == 3:
		print(" "+str(i), end='')

Submission status: WA: Presentation Error

Solution code:
n = int(input())

for i in range(1, n+1): #(m,n)..start:m and number:n
	if i%3 == 0 or 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 or i % 10 == 3 or (i // 10 == True and i % 10 == 3):
        print(" {}".format(i), end='')

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(i, end=' ')

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

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

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('',i,end=' ')
print()

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(' ',i,end='')
print()

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 or '3' in str(i):
        print(' ',i,end='')
print()

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

Solution code:
n = int(input())
for i in range(1,n+1):
    if i%3 == 0:
        if i == n:
            print(" "+str(i))
        else:
            print(" "+str(i),end="")
    elif i%10 == 3:
        if i == n:
            print(" "+str(i))
        else:
            print(" "+str(i),end="")
    elif str(i).find("3") > -1:
        if i == n:
            print(" "+str(i))
        else:
            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:
        if i == n or i == n-1:
            print(" "+str(i))
        else:
            print(" "+str(i),end="")
    elif i%10 == 3:
        if i == n or i == n-1:
            print(" "+str(i))
        else:
            print(" "+str(i),end="")
    elif str(i).find("3") > -1:
        if i == n or i == n-1:
            print(" "+str(i))
        else:
            print(" "+str(i),end="")

Submission status: WA: Presentation Error

Solution code:
import sys
n=input()
for i in xrange(1,n+1):
  if i%3==0 or ("%d"%i).find('3')!=-1:sys.stdout.write("%d"%i)

Submission status: WA: Presentation Error

Solution 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

Submission status: WA: Presentation Error

Solution 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("\n")

Submission status: WA: Presentation Error

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

import sys
import os



"""
void call(int n){
  int i = 1;
 CHECK_NUM:
  int x = i;
  if ( x % 3 == 0 ){
    cout << " " << i;
    goto END_CHECK_NUM;
  }
 INCLUDE3:
  if ( x % 10 == 3 ){
    cout << " " << i;
    goto END_CHECK_NUM;
  }
  x /= 10;
  if ( x ) goto INCLUDE3;
 END_CHECK_NUM:
  if ( ++i <= n ) goto CHECK_NUM;

  cout << endl;
}
"""

def include3(v):
    s = str(v)
    if '3' in s:
        return True
    else:
        return False

def call(n):
    for i in range(1, n + 1):
        if i % 3 == 0:
            print(" ", end='')
            print(i, end='')
        else:
            if include3(i):
                print(" ", end='')
                print(i, end='')

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

Submission status: WA: Presentation Error

Solution code:
n = int(input())
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('', i, end='')
    elif i%10 == 3:
        print('', i, end='')

Submission status: WA: Presentation Error

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

numbers = ' '.join(l)
print(numbers)

Submission status: WA: Presentation Error

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

numbers = ' '.join(l)
print('' + numbers)

Submission status: WA: Presentation Error

Solution code:
x = int(input())
l =[]
if 3 <= x <= 1000:
    for i in range(1,(x + 1)):
        if i % 3 == 0:
            l.append(str(i))
        elif i % 10 == 3:
            l.append(str(i))

numbers = ' '.join(l)
print('' + numbers)

Submission status: WA: Presentation Error

Solution code:
x = int(input())
l =[]
if 3 <= x <= 1000:
    for i in range(1,(x + 1)):
        if i % 3 == 0:
            l.append(str(i))
        elif i % 10 == 3:
            l.append(str(i))

numbers = ' '.join(l)
print('' + numbers)
print()

Submission status: WA: Presentation Error

Solution code:
x = int(input())
l =[]
if 3 <= x <= 1000:
    for i in range(1,(x + 1)):
        if i % 3 == 0:
            l.append(str(i))
        elif i % 10 == 3:
            l.append(str(i))

numbers = ''.join(l)
print(' ' + numbers)

Submission status: WA: Presentation Error

Solution code:
x = int(input())
l =[]
if 3 <= x <= 1000:
    for i in range(1,(x + 1)):
        if i % 3 == 0:
            l.append(str(i))
        elif i % 10 == 3:
            l.append(str(i))

numbers = ''.join(l)
print('' + numbers)

Submission status: WA: Presentation Error

Solution code:
n = int(input())

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

Solution code:
# coding: utf-8
# Here your code !

def func():
    result=""
    try:
        line = input().rstrip()
        num = int(line)
    except:
        print("input error")
        return -1
        
    for i in range(1,num+1):
        if( (i % 3 ==0) or (i % 10 == 3) ):
            result += str(i)+" "
          
    print(result.rstrip(" "))

func()

Submission status: WA: Presentation Error

Solution code:
def func(n):
    x = []
    for i in range(1,n+1):
        if i % 3 == 0 or i %10 == 3:
            x.append(i)
    return x

if __name__ == '__main__':
    N = int(input())
    rlt = func(N)
    for i in range(len(rlt)):
        if rlt[i] == rlt[-1]:
            print(rlt[i], end='')
        else:
            print(rlt[i], end=' ')
print()

Submission status: WA: Presentation Error

Solution code:
n = int(input())

x = 1

while x <= n:
    if x%3 == 0:
        print(" %d" % x, end = '')
        x += 1
    elif x%10 == 3:
        print(" %d" % x, end = '')
        x += 1
    else:
        x += 1

Submission status: WA: Presentation Error

Solution code:
n = int(input())

x = 1
print(" ", end = '')
while x <= n:
    if x%3 == 0:
        print(" %d" % x, end = '')
        x += 1
    elif x%10 == 3:
        print(" %d" % x, end = '')
        x += 1
    else:
        x += 1

Submission status: WA: Presentation Error

Solution code:
result = []
n = int(input())
i = 1
while i <= n:
    x = i
    if x % 3 == 0:
        result.append(i)
    elif x % 10 == 3:
        result.append(i)
    else:
        x /= 10
        while x >= 1:
            if x % 10 == 3:
                result.append(i)
            x /= 10
    i += 1
print(*result)

Submission status: WA: Presentation Error

Solution code:
result = [" "]
n = int(input())
i = 1
while i <= n:
    x = i
    if x % 3 == 0:
        result.append(i)
    elif x % 10 == 3:
        result.append(i)
    else:
        x /= 10
        while x >= 1:
            if x % 10 == 3:
                result.append(i)
            x /= 10
    i += 1
print(*result)

Submission status: WA: Presentation Error

Solution code:
result = []
n = int(input())
i = 1
while i <= n:
    x = i
    if x % 3 == 0:
        result.append(i)
    elif x % 10 == 3:
        result.append(i)
    else:
        x /= 10
        while x >= 1:
            if x % 10 == 3:
                result.append(i)
            x /= 10
    i += 1
answer = ""
for a in result:
    answer += " " + str(a)
answer += " "
print(answer)

Submission status: WA: Presentation Error

Solution code:
def check_num(n):
    if n % 3 == 0 or n % 10 == 3:
        print(" {0}".format(n), end="")

n = int(input())
for i in range(3, n+1):
    check_num(i)

Submission status: WA: Presentation Error

Solution code:
def hitoketame3(num):
    if num % 10 == 3:
        return True
    else:
        return False

n = int(input())
for i in range(1, n+1):
    x = i
    if x % 3 == 0:
        print(" {0}".format(i),end="")
        continue
    if hitoketame3(x) == True:
        print(" {0}".format(i),end="")
    while x != 0:
        x = x // 10
        if hitoketame3(x) == True:
            print(" {0}".format(i),end="")
            break

Submission status: WA: Presentation Error

Solution code:
#coding:utf-8

n = int(input().rstrip())
kazu =[]
for i in range(1,n+1):
    if i%3==0:
        kazu.append(i)
        
    elif i%10 ==3:
        kazu.append(i)

    else:
        if (i//10)%10==3:
            kazu.append(i)

print(" ".join(list(map(str,kazu))))

Submission status: WA: Presentation Error

Solution code:
#coding:utf-8
def jyu_waru(a):
    x = a
    b = 0
    while x>10:
        x = x//10
        if x%10 ==3:
            b = a
            break
    return b

n = int(input().rstrip())
kazu =[]
x = 0
for i in range(1,n+1):
    if i%3==0:
        kazu.append(i)
        
    elif i%10 ==3:
        kazu.append(i)

    else:
        x = jyu_waru(i)
        if x != 0:
            kazu.append(i)

print(" ".join(list(map(str,kazu))))

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

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

Submission status: WA: Presentation Error

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

while j <= i:
  if j%3 == 0 or j%10 ==3:
    print(' ',end='')
    print(j,end='')
  j += 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='')
    elif '3' in str(i):
        print(' '+str(i), end='')

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

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

print(' ')

Submission status: WA: Presentation Error

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

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

Solution code:
n=int(input())
for i in range(1,n+1):
    I=str(i)
    if i % 3 == 0:
        print(' {0}'.format(i), end='')
    elif I[len(I)-1] == '3':
        print(' {0}'.format(i), end='')

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

Solution code:
n=int(input())
for i in range(1,n+1):
    I=str(i)
    if i % 3 == 0:
        print(' {0}'.format(i), end='')
    elif I[len(I)-1] == '3':
        print(' {0}'.format(i), end='')
        if i == n:
            print(' ')

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

Solution code:
x=int(input())
for i in range(1,x+1):
    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(x//10,x+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())
i=1
while i<=n :
    x=i
    if x%3==0  :
        print("",i,end="")
    else:
        if x%10==3 :
            print("",i,end="")
        else :
            x=x//10
            if x>=1 :
                if x % 10 ==3 :
                    print("",i,end="")
    i=i+1

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

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation 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(" ",*result)

Submission status: WA: Presentation 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(*result)

Submission status: WA: Presentation 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(" ",*result)

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

Submission status: WA: Presentation Error

Solution code:
result = list()
n = int(raw_input())
for i in range(1, n + 1):
    if i % 3 == 0:
        result.append(i)
    elif i % 10 == 3:
        result.append(i)
print(" ".join(str(i) for i in result))

Submission status: WA: Presentation Error

Solution code:
for i in range(1, int(raw_input())+1):
    if i % 3 == 0:
        print '%s' % i,
    elif i % 10 == 3:
        print '%s' % 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:
        list("i")
        if str(i).count("3") != 0:
            print("",i,end="")

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

Solution code:
# Aizu Problem ITP_1_5_D: Structured Programming
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")

res = []


def CHECK_NUM(n, i):
    x = i
    if x % 3 == 0:
        res.append(i)
    else:
        while True:
            if x % 10 == 3:
                res.append(i)
                break
            x //= 10
            if x == 0:
                break
    i += 1
    if i <= n:
        CHECK_NUM(n, i)
        
        
def call(n):
    CHECK_NUM(n, 1)
    

n = int(input())
call(n)
print(' '.join([str(r) for r in res]))

Submission status: WA: Presentation Error

Solution code:
# Aizu Problem ITP_1_5_D: Structured Programming
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")

res = []


def CHECK_NUM(n, i):
    x = i
    if x % 3 == 0:
        res.append(i)
    else:
        while True:
            if x % 10 == 3:
                res.append(i)
                break
            x //= 10
            if x == 0:
                break
    i += 1
    if i <= n:
        CHECK_NUM(n, i)
        
        
def call(n):
    CHECK_NUM(n, 1)
    

n = int(input())
call(n)
print(' '.join([str(r) for r in res]) + ' ')

Submission status: WA: Presentation Error

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

while i <= n:
	x = i
	if x % 3 == 0:
		print(" ", end ="")
		print(i, end ="")
	elif x % 10 == 3:
		print(" ", end ="")
		print(i, end ="")
	else:
		x = x / 10
	i += 1

Submission status: WA: Presentation Error

Solution code:
n = int(input())
op = False

for idx in range(1, n + 1):
    if idx % 3 == 0:
        op = True
    if idx % 10 == 3:
        op = True
    if op == True:
        print(str(idx) + ' ', end = '')
    op = False

Submission status: WA: Presentation Error

Solution code:
n = int(input())
op = False

for idx in range(1, n + 1):
    if idx % 3 == 0:
        op = True
    if idx % 10 == 3:
        op = True
    if op == True:
        print(' ' + str(idx), end = '')
    op = False

Submission status: WA: Presentation Error

Solution code:
n = int(input())
op = False

for idx in range(1, n):
    if idx % 3 == 0:
        op = True
    if idx % 10 == 3:
        op = True
    if op == True:
        print(' ' + str(idx), end = '')
    op = False
idx += 1
print(' ' + str(idx), end = '')