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: Wrong Answer

Solution code:
n = int(input())

print(" ",end="")
for i in range(1,n-1):
    if i % 3 == 0:
        print(i,end=" ")
    else:
        while True:
            if int(i%10) == 3:
                print(i,end=" ")
                break
            elif int(i%10) < 10:
                break
            else:
                i = int(i/10)

if n % 3 == 0:
        print(n)
else:
        while True:
            if int(n/10) == 3:
                print(n)
                break
            elif int(n/10) < 10:
                print(n)
                break
            else:
                n = int(n/10)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

print("")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
data = [" "+str(i+1) for i in range(n) 
        if (i+1)%3==0 or (i+1)%10==3 or (((i+1)//10)%3==0 and (i+1)>=30)]
print("".join(data))

Submission status: Wrong Answer

Solution code:
n = int(input())
data = [" "+str(i+1) for i in range(n) 
        if (i+1)%3==0 or (i+1)%10==3 or (((i+1)//10)%10==0 and (i+1)>=30)]
print("".join(data))

Submission status: Wrong Answer

Solution code:
n = int(input())
data = [" "+str(i+1) for i in range(n) 
        if (i+1)%3==0 or (i+1)%10==3 or (((i+1)//10)%10==3 and (i+1)>=30)]
print("".join(data))

Submission status: Wrong Answer

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 call(n):
    i = 1
    while i <= n:
        x = i
        if x % 3 == 0:
            print(" ", end='')
            print(i, end='')
            i += 1
        else:
            while x > 0:
                if x % 10 == 3:
                    print(" ", end='')
                    print(i, end='')
                    i += 1
                    break
                else:
                    x //= 10
                    i += 1

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8

num = int(input())
result = ""

for i in range(num+1):
    if (((i+1) % 3) == 0) or (((i+1) % 10) == 3):
        result = result + str(" " + str(i+1))

print(result)

Submission status: Wrong Answer

Solution code:
# coding: utf-8

num = int(input())
result = ""

for i in range(num):
    if (((i+1) % 3) == 0) or (((i+1) % 10) == 3):
        result = result + str(" " + str(i+1))

print(result)

Submission status: Wrong Answer

Solution code:
# coding: utf-8

num = int(input())
result = ""

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8

num = int(input())
result = ""

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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: Wrong Answer

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: Wrong Answer

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: Wrong Answer

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))
        elif '3' in str(i):
            l.append(str(i))    

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

Submission status: Wrong Answer

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: Wrong Answer

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: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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))
    else:
        pass
print(" ".join(y))

Submission status: Wrong Answer

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: Wrong Answer

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: Wrong Answer

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: Wrong Answer

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)

func()

Submission status: Wrong Answer

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):
            result += " "+str(i)
        else:
            devided=i
            while(True):
                if(devided % 10 == 3):
                    result += " "+str(i)
                    break
                elif(devided > 9):
                    devided /= 10
                else:
                    break
                
    print(result)

func()

Submission status: Wrong Answer

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)
    print(" ", end='')
    for i in range(len(rlt)):
        if rlt[i] == rlt[-1]:
            print(rlt[i], end='')
        else:
            print(rlt[i], end=' ')
print()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

print("")

Submission status: Wrong Answer

Solution code:
n = int(input())

i = 1

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

print("")

Submission status: Wrong Answer

Solution code:
n = int(input())

i = 1

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

print("")

Submission status: Wrong Answer

Solution code:
n = int(input())

i = 1

while i <= n:
    x = i
    if x%3 == 0:
        print(" %d" % i, end = '')
        i += 1
    elif x%10 == 3:
        print(" %d" % i, end = '')
        i += 1
    else:
        x = str(i)
        if len(x) > 1:    
            if x[-2] == '3':
                print(" %d" % i, end = '')
                i += 1
            else:
                i += 1
        else:
            i += 1
print("")

Submission status: Wrong Answer

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)
print(answer)

Submission status: Wrong Answer

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 = x // 10
        while x >= 1:
            if x % 3 == 0:
                result.append(i)
            elif x % 10 == 3:
                result.append(i)
            x /= 10
    i += 1
answer = ""
for a in result:
    answer += " " + str(a)
print(answer)

Submission status: Wrong Answer

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 = x // 10
        while x >= 1:
            if x % 3 == 0:
                result.append(i)
            elif x % 10 == 3:
                result.append(i)
            x = x // 10
    i += 1
answer = ""
for a in result:
    answer += " " + str(a)
print(answer)

Submission status: Wrong Answer

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 = x // 10
        while x >= 1:
            if x % 3 == 0:
                result.append(i)
            elif x % 10 == 3:
                result.append(i)
            x = x // 10
    i += 1
if n not in result:
    result.append(n)
answer = ""
for a in result:
    answer += " " + str(a)
print(answer)

Submission status: Wrong Answer

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: Wrong Answer

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="")
print("")

Submission status: Wrong Answer

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="")
 elif (i // 10)  % 10 == 3:
  print(" " + str(i), end="")
print("")

Submission status: Wrong Answer

Solution code:
N = int(input())

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

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

Submission status: Wrong Answer

Solution code:
n = int(raw_input())

out = ""
for i in range(1, n + 1):
    if (i % 3 == 0) or (i % 10 == 3):
        out += " " + str(i)
        continue
    tmp = i / 10
    if tmp % 10 == 3:
        out += " " + str(i)

print out

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
result = 0
i = 1
while result < n:
    result = i * 3
    print(" {0}".format(result), end="")
    i += 1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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
print("")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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: Wrong Answer

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 = "")
print()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/python

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

Submission status: Wrong Answer

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: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

print()

Submission status: Wrong Answer

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

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

print()

Submission status: Wrong Answer

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: Wrong Answer

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

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

print()

Submission status: Wrong Answer

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

while j <= i:
  if j%3 == 0 or 30 <= j%100 <=39 or 300 <= j%1000 <=399 or 3000 <= j%10000 <= 3999:
    print(' ',end='')
    print(j,end='')
  j += 1

print()

Submission status: Wrong Answer

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

while j <= i:
  if j%3 == 0 or 30 <= j%100 <=39 or 300 <= j%1000 <=399 :
    print(' ',end='')
    print(j,end='')
  j += 1

print()

Submission status: Wrong Answer

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

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

print()

Submission status: Wrong Answer

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: Wrong Answer

Solution code:
i = int(input())
j = 1
 
while j <= i:
  if j%3 == 0 or j%10 ==3 or 30 <= j%100 <= 39:
    print(' ',end='')
    print(j,end='')
  j += 1
 
print()

Submission status: Wrong Answer

Solution code:
i = int(input())
j = 1
 
while j <= i+1:
  if j%3 == 0 or j%10 ==3 or 30 <= j%100 <=39 or 300 <= j%1000 <= 399 or 3000 <= j%100 <= 3999:
    print(' ',end='')
    print(j,end='')
  j += 1
 
print()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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: Wrong Answer

Solution code:
n = int(input())

r = ''
for i in range(1, n+1):
    x = i
    if x % 3 == 0:
        r += ' '+str(x)
        continue
    while x > 0 and x % 10 != 3:
        x = x // 10
    if x % 10 == 3:
        r += ' '+str(x)
print(r)

Submission status: Wrong Answer

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

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

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: Wrong Answer

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)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

print(' ' + result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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
print("")

Submission status: Wrong Answer

Solution code:
n = int(input())

for i in range(n):
  x = i+1

  if x % 3 == 0:
    print( " ", i+1, sep = '', end = '' )
  else:
    while x and x % 10 == 3:
      print( " ", i+1, sep = '', end = '' )
      x /= 10

print("")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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
print('')

Submission status: Wrong Answer

Solution code:
x = int(input())
n = 3
L = ""
while x >= n:
    L += str(n) + " "
    n += 3
print (L)

Submission status: Wrong Answer

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: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
i = x = 1
ret = ''

x /= 10

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

Submission status: Wrong Answer

Solution code:
n = int(input())
ret = ''

for i in range(1,n+1):
    if (i % 3 == 0): ret += ' ' + repr(i)
    str = repr(i)

    if (len(str) > 1):
        if(str[len(str)-2:len(str)-1] == '3'):
            ret += ' ' + repr(i)
print(ret)

Submission status: Wrong Answer

Solution code:
n = int(input())
ret = ''

for i in range(1,n+1):
    str = repr(i)
    if (i % 3 == 0): ret += ' ' + repr(i)
    
    elif (i % 10 == 3): ret += ' ' + repr(i)
    
    elif (len(str) > 1):
        if(str[len(str)-2:len(str)-1] == '3'):
            ret += ' ' + repr(i)
print(ret)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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: Wrong Answer

Solution code:
lst=""
x=int(input())
for i in range(1,x+1):
  if i%3==0:
   lst += " "+str(i)
  else:
    for s in range(i):
      if s=="3":
        lst += " "+str(s)
        break
print(lst)

Submission status: Wrong Answer

Solution code:
x=int(input())
lst=""
for i in range(1,x+1):
  if i%3 == 0:
   lst += " "+str(i)
  else:
    for s in range(i):
      if s =="3":
        lst += " "+str(s)
        break
print(lst)

Submission status: Wrong Answer

Solution code:
x=int(input())
lst = ""
for i in range(1,x+1):
  if i%3 == 0:
   lst += " "+str(i)
  else:
    for s in range(i):
      if s =="3":
        lst += " "+str(i)
        break
print(lst)

Submission status: Wrong Answer

Solution code:
def func(n):
    i = 1
    dst = ""

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

    return dst

print(func(int(input())))

Submission status: Wrong Answer

Solution code:
def func(n):
    i = 1
    dst = ""

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

    return dst

print(func(int(input())))

Submission status: Wrong Answer

Solution code:
def func(n):
    i = 1
    dst = ""

    def include3(x, i):
        local_dst = ""

        if x % 10 == 3:
            local_dst += " " + str(i)
        else:
            if x // 10:
                local_dst += include3(x // 10, i)

        return local_dst

    while i <= n:
        x = i
        if x % 3 == 0:
            dst += " " + str(i)
        else:
            dst += include3(x, i)
        i += 1

    return dst


print(func(int(input())).split())

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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: Wrong Answer

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: Wrong Answer

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