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())
i = 1
ret = ""
while True:
    x = i
    if  x % 3 == 0:
        ret += " " + str(i)
    elif x % 10 == 3:
        ret += " " + str(i)
    else:
        x //= 10
        while x != 0:
            if x % 10 == 3:
                ret += " " + str(i)
            x //= 10
    i+=1
    if i > n:
        break

print(ret)

Submission status: Wrong Answer

Solution code:
n = int(input())
res = [i for i in range(3, n+1) if i % 3 == 0]
print(*res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())
k = []
for i in range(1, x + 1):
    y = i
    if i % 3 == 0:
        k.append(i)
    else:
        while y >= 10:
            y %= 10
            if y == 3:
                k.append(i)

for i in range(len(k)):
    print(' '+ str(k[i]))

Submission status: Wrong Answer

Solution code:
a = []
i = 1
n = 30
def checkNum():
    global a, i, x
    x = i
    if x%3 ==0:
        a.append(x)
        endCheck()
    include3()
    endCheck()

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

print(*a)

Submission status: Wrong Answer

Solution code:
a = []
i = 1
n = int(input())
def checkNum():
    global a, i, x
    x = i
    if x%3 ==0:
        a.append(x)
        endCheck()
    include3()
    endCheck()

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

print('',*a)

Submission status: Wrong Answer

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

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

print('',*a)

Submission status: Wrong Answer

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

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

print('',*a)

Submission status: Wrong Answer

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

    
        
checkNum()

print('',*a)

Submission status: Wrong Answer

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

    
        
checkNum()

print('',*a)

Submission status: Wrong Answer

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

    
        
checkNum()

print('',*a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def call(n):
    ans = []

    for x in range(n + 1):
        if x % 3 == 0:
            ans.append(x)
            continue

        while x % 10 == 3:
            ans.append(x)
            x //= 10

    print(" ".join(map(str, ans)))


if __name__ == '__main__':
    from sys import stdin

    n = int(stdin.readline().rstrip())

    print(call(n))

Submission status: Wrong Answer

Solution code:
def call(n):
    ans = []

    for x in range(1, n + 1):
        if x % 3 == 0:
            ans.append(x)
            continue

        while x % 10 == 3:
            ans.append(x)
            x //= 10

    return " " + " ".join(map(str, ans))


if __name__ == '__main__':
    from sys import stdin

    n = int(stdin.readline().rstrip())

    print(call(n))

Submission status: Wrong Answer

Solution code:
def call(n):
    ans = []

    for x in range(1, n + 1):
        # print('x:', x)
        if x % 3 == 0:
            ans.append(x)
            # print(' +:', x)
            continue

        while x and x % 10 == 3:
            ans.append(x)
            # print(' +:', x)
            x //= 10
            
    return " " + " ".join(map(str, ans))


if __name__ == '__main__':
    from sys import stdin

    n = int(stdin.readline().rstrip())

    print(call(n))

Submission status: Wrong Answer

Solution code:
def call(n):
    ans = []

    for i, x in enumerate(range(1, n + 1), 1):
        if x % 3 == 0:
            ans.append(i)
            continue

        while x:
            if x % 10 == 3:
                ans.append(i)
            x //= 10

    print(" " + " ".join(map(str, ans)))


if __name__ == '__main__':
    from sys import stdin

    n = int(stdin.readline().rstrip())

    call(n)

Submission status: Wrong Answer

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

while y <= n :
    if(y % 3 == 0):
        print(' %d'%y,end='')
    else:
        p = y
        while(p != 0):
            if(p % 10 == 3):
                print(' %d'%y,end='')
            p //= 10
    y+=1
print()

Submission status: Wrong Answer

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

while y <= n :
    if(y % 3 == 0):
        print(' %d'%y,end='')
    else:
        p = y
        while(p != 0):
            if(p % 10 == 3):
                print(' %d'%y,end='')
            break
            p //= 10
    y+=1
print()

Submission status: Wrong Answer

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

while y <= n+1 :
    if(y % 3 == 0):
        print(' %d'%y,end='')
    else:
        p = y
        while(p != 0):
            if(p % 10 == 3):
                print(' %d'%y,end='')
            
            p //= 10
    y+=1
print()

Submission status: Wrong Answer

Solution code:
inp = int(input())

def check(n):
    i = 1
    print(" ",end="")
    while(i <= n):
        if  (i % 3 == 0):
            print("%d " %i,end="")
        i = i + 1
    print()

        

check(inp)

Submission status: Wrong Answer

Solution code:
inp = int(input())

def check(n):
    i = 1
    while(i <= n):
        if  (i % 3 == 0):
            print(" %d" %i,end="")
        i = i + 1
    print()

        

check(inp)

Submission status: Wrong Answer

Solution code:
inp = int(input())

def check(n):
    i = 1
    while(i <= n):
        if(i % 3 == 0):
            print(" %d" %i,end="")
        if(i % 10 == 3):
            print(" %d" %i,end="")
        i = i + 1
    print()

        

check(inp)

Submission status: Wrong Answer

Solution code:
inp = int(input())

def check(n):
    i = 1
    while(i <= n):
        if(i % 3 == 0):
            print(" %d" %i,end="")
        elif(i % 10 == 3):
            print(" %d" %i,end="")
        i = i + 1
    print()

        

check(inp)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
a=int(input())
b=3
while True:
    if b>a:
        break
    print(b)
    b+=3

Submission status: Wrong Answer

Solution code:
a=int(input())
b=3
c=[]
while True:
    if b>a:
        break
    c.append(str(b))
    b+=3
print(' '.join(c))

Submission status: Wrong Answer

Solution code:
import sys
write = sys.stdout.write
n = input()
i = 1
while i <= n:
	if i % 3 == 0:
		write(' ' + str(i))
	elif i % 10 == 3:
		write(' ' + str(i))
		j = i
		while j == 0:
			j /= 10
			if j % 10 == 3:
				write(' ' + str(j))
	i += 1
print \

Submission status: Wrong Answer

Solution code:
import sys
write = sys.stdout.write
n = input()
i = 1
while i <= n:
	if i % 3 == 0:
		write(' ' + str(i))
	elif i % 10 == 3:
		write(' ' + str(i))
	else:
		j = i
		while j > 0:	
			j /= 10
			if j % 10 == 3:
				write(' ' + str(i))
				continue
	i += 1
print \

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def call(n):
    res = []
    for i in range(1, n + 1):
        if i % 3 == 0:
            res.append(str(i))
        elif str(i)[-1] == '3':
            res.append(str(i))
    print(' ' + ' '.join(res))

call(int(input()))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(raw_input())

print "",

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

Submission status: Wrong Answer

Solution code:
import sys
def call(n):	
	for i in xrange(1, n+1):
		if (i % 3) == 0:
			sys.stdout.write(" " + str(i))
		elif (i % 10) == 3:
			sys.stdout.write(" " + str(i))
	print ""

n = int(raw_input())
call(n)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = input()
i = 1
while i <= n:
	if i % 3 == 0:
		print i,
		i += 3
	else:
		i += 1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = input()
s = x%3 if x%3 else 3
print " ".join(map(str, range(x+1)[s::3]))

Submission status: Wrong Answer

Solution code:

import sys

def call(n):
    i = 1
    x = 1
    while True:
        if x % 3 == 0:
            sys.stdout.write(" "+str(i))
        if x % 10 == 3:
            sys.stdout.write(" "+str(i))
        x = x + 10
        if i <= n :
            i = i+1
        else:
            break
n = input()
call(n)

Submission status: Wrong Answer

Solution code:
import sys

def call(n):
    i = 1
    flg = 1
    while True:
        x = i
        if x % 3 == 0:
            sys.stdout.write(" "+str(i))
            flg = 0
        while flg == 1:
            if x % 10 == 3:
                sys.stdout.write(" "+str(i))
                flg = 0
            x /= 10
            if not x:
                flg = 0
        if i < n :
            i = i+1
        else:
            break
n = input()
call(n)

Submission status: Wrong Answer

Solution code:

num = int(raw_input())

for x in range(1, num + 1):
	if x % 3 == 0:
		print x,

Submission status: Wrong Answer

Solution code:
n = int(raw_input())
i=1
x=i
nums = []


def include3():
    global n
    global i
    global x
    global nums

    while True:
        if x % 10 == 3:
            nums.append(str(i))
            if end_check_num():
                return 0

        x /= 10
        if x==0:
            return 1
    return 1

def end_check_num():
    global n
    global i
    global x

    i+=1
    if i <= n:
        return False
    return True


while True:
    x=i
    if x % 3==0:
        nums.append(str(i))
        if end_check_num():
            break
        continue
    if 0==include3():
        break


    if end_check_num():
        break

print " ".join(nums)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

def check_num(i):
    if i%3 is 0:
        print i,
        end_check_num(i)

def include_3(i):
    if i%10 is 3:
        print i,
        end_check_num(i)

def end_check_num(i):
    i+=1
    if i<=n:
        check_num(i)

while (i>n):
    check_num(i)
    n/=10
    end_check_num(i)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(raw_input())
i = 1
print "",
while(i<n):
    x=i
    if x%3 is 0:
        print i,
    x=x/10
    if x%10 is 3:
        print i,
    i = i+1
print n

Submission status: Wrong Answer

Solution code:
n=int(raw_input())
i = 1
print "",
while(i<n):
    x=i
    if x%3 is 0:
        print i,
    elif x%10 is 3:
        print i,
    elif (x/10)%10 is 3:
        print i,
    i = i+1
print n

Submission status: Wrong Answer

Solution code:
n=int(raw_input())
i = 1
print "",
while(i<=n):
    x=i
    if x%3 is 0:
        print i,
    elif x%10 is 3:
        print i,
    elif (x/10)%10 is 3:
        print i,
    i = i+1
# print n

Submission status: Wrong Answer

Solution code:
n=int(raw_input())
i = 1
print "",
while(i<=n):
    x=i
    if x%3 is 0:
        print i,
    elif (x/10**1)%10 is 3:
        print i,
    elif (x/10**2)%10 is 3:
        print i,
    elif (x/10**3)%10 is 3:
        print i,
    elif (x/10**4)%10 is 3:
        print i,
    i = i+1

Submission status: Wrong Answer

Solution code:
n = int(input())
a = []
for x in range(3,n + 1):
    if x % 3 == 0:
        a = a + [x]
print(a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

n = input()

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

Submission status: Wrong Answer

Solution code:
import sys

n = input()

for i in range(n):
    x = i + 1
    y = i + 1
    flag = 0
    if(x % 3 == 0):
        flag = 1
        sys.stdout.write(" ")
        sys.stdout.write(str(x))
        if(i+1 > n):
            break

    while(1):
        if flag == 1:
            break
        if(y % 10 == 3):
            sys.stdout.write(" ")
            sys.stdout.write(str(x))
            break
            if(i+1 > n):
                break
        y = y/10
        if(y == 0 or y%10 != 3):
            break
print

Submission status: Wrong Answer

Solution code:
import sys

n = input()

for i in range(1,n+1):
    x = i
    y = i
    flag = 0
    if(x % 3 == 0):
        flag = 1
        sys.stdout.write(" ")
        sys.stdout.write(str(x))
        if(i+1 > n):
            break

    while(1):
        if flag == 1:
            break
        if(y % 10 == 3):
            sys.stdout.write(" ")
            sys.stdout.write(str(x))
            break
            if(i+1 > n):
                break
        y = y/10
        if(y == 0 or y%10 != 3):
            break
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(' ' + str(i),end='')
print('')

Submission status: Wrong Answer

Solution code:

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

    x //= 10
print()

Submission status: Wrong Answer

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

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

print()

Submission status: Wrong Answer

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

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

print()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = input()
array = []
i = 1
while i <= n:
    x = i
    if x % 3 == 0:
        array.append(x)
    else:
        while x != 0:
            if x % 10 == 3:
                array.append(x)
                break
            x /= 10
    i += 1
print str(array).replace('[', ' ').replace(']', '').replace(',', '')

Submission status: Wrong Answer

Solution code:
import sys

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

n = int(sys.stdin.readline())
call(n)

Submission status: Wrong Answer

Solution code:
import sys

def call(n):
    nums = []
    for i in range(1, n + 1):
        if i % 3 == 0:
            nums.append(str(i))
            continue
        x = i
        while x > 0:
            if x % 10 == 3:
                nums.append(str(x))
                break
            x /= 10
    print('', ' '.join(nums))

n = int(sys.stdin.readline())
call(n)

Submission status: Wrong Answer

Solution code:
from sys import stdin
n = int(stdin.readline())
for i in range(1,n+1):
        x = i
        if x % 3 == 0 or x % 10 == 3:
            print('', i, end='')
            continue

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

Submission status: Wrong Answer

Solution code:
from sys import stdin
n = int(stdin.readline())
for i in range(1,n+1):
        x = i
        if x % 3 == 0 or x % 10 == 3:
            print('', i, end='')
            continue
        x //= 10
        while x != 0:
            if x % 10 == 3:
                print(''.format(i),end='')
            break
            x //= 10
print()

Submission status: Wrong Answer

Solution code:
from sys import stdin
n = int(stdin.readline())
for i in range(1,n+1):
        x = i
        if x % 3 == 0 or x % 10 == 3:
            print('', i, end='')
            continue
        x //= 10
        while x != 0:
            if x % 10 == 3:
                print('', i, end='')
            break
            x //= 10
print()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = input()
y= []
for i in range(x):
	if i == 0:
		continue
	if i % 3 == 0:
		y.append(str(i))
	else:
		z = i
		while 1:
			if z < 10:
				break
			else:
				z -= 10
		if z == 3:
			y.append(str(i))
print " ".join(y)

Submission status: Wrong Answer

Solution code:
x = input()
y= []
for i in range(x+1):
	if i == 0:
		continue
	if i % 3 == 0:
		y.append(str(i))
	else:
		z = i
		while 1:
			if z < 10:
				break
			else:
				z -= 10
		if z == 3:
			y.append(str(i))
print " " + " ".join(y)

Submission status: Wrong Answer

Solution code:
x = input()
y= []
for i in range(x+1):
	if i == 0:
		continue
	if i % 3 == 0:
		y.append(str(i))
	else:
		z = i
		c = 0
		while 1:
			if z < 10:
				break
			else:
				z -= 10
				c += 1
		if z == 3 or c == 3:
			y.append(str(i))
			
print " " + " ".join(y)

Submission status: Wrong Answer

Solution code:
# Python 3

def PrintI(i):
	print(" ", i)
	return i + 1

if __name__ == "__main__":
	n = input()
	n = int(n)
	s = ""
	for i in range(1, n + 1):
		if i % 3 == 0:
			s += " " + str(i)
		elif i % 10 == 3:
			s += " " + str(i)
	print(s)

Submission status: Wrong Answer

Solution code:
import sys
n=int(input())
for i in range(1,n+1):
	if(i%3==0):
		i=str(i)
		sys.stdout.write(' '+i)
		i=int(i)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

n = int( sys.stdin.readline() )
output = []
for i in range( 1, n+1 ):
	x = i
	if x%3 == 0:
		output.append( " {:d}".format( i ) )
	else:
		while x:
			if x%10 == 3:
				output.append( " {:d}".format( i ) )
			x /= 10
print( "".join( output ) )

Submission status: Wrong Answer

Solution code:
import sys

n = int( sys.stdin.readline() )
output = []
for i in range( 1, n+1 ):
	x = i
	if x%3 == 0:
		output.append( " {:d}".format( i ) )
	else:
		while x:
			if x%10 == 3:
				output.append( " {:d}".format( i ) )
				break
			x /= 10
print( "".join( output ) )

Submission status: Wrong Answer

Solution code:
import sys

n = int( sys.stdin.readline() )
output = []
for i in range( 1, n+1 ):
	x = i
	if x%3 == 0:
		output.append( " {:d}".format( i ) )
	else:
		while x != 0:
			if x%10 == 3:
				output.append( " {:d}".format( i ) )
				break
			x /= 10
print( "".join( output ) )

Submission status: Wrong Answer

Solution code:
def call(i, n):
	while 1:
		if i > n:
			print
			break
		if i % 3 == 0:
			print i,
			i += 1
			continue
		if i % 10 == 3:
			print i,
			i += 1
			continue
		i += 1




if __name__ == '__main__':
	n = int(raw_input())
	print "",
	call(1, n)

Submission status: Wrong Answer

Solution code:
def call(n):
	print '',
	for i in xrange(1, n+1):
		if i % 3 == 0:
			print(i),
		elif i % 10 == 3:
			print(i),
	print


n = int(raw_input())
call(n)

Submission status: Wrong Answer

Solution code:
def call(n):
	print '',
	for i in xrange(1, n+1):
		if check(i):
			print(i),
	print

def check(i):
	if i % 3 == 0:
		return True
	if i % 10 == 3:
		return True
	if i / 10 > 0:
		return check(i / 10)
	return False


n = int(raw_input())
call(n)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(raw_input())
ls = []
for i in range(n):
    if i%3==0 or "3" in str(i) :
		ls.append(i)
print " " + " ".join(map(str,ls))

Submission status: Wrong Answer

Solution code:
# coding=utf-8


def main():
    n = input()
    i = 1
    s = ''
    # -------------------------------------------------------------------------
    # CHECK_NUM
    while True:
        x = i
        if x % 3 == 0:
            s += ' '+str(i)
            # -----------------------
            # END_CHECK_NUM
            i += 1
            if i <= n:
                # goto CHECK_NUM
                continue
            else:
                # END!!
                break
            # -----------------------
        # -----------------------------------------------------
        # INCLUDE3
        while True:
            if x % 10 == 3:
                s += ' '+str(i)
                # -----------------------
                # END_CHECK_NUM
                i += 1
                if i <= n:
                    # goto INCLUDE3
                    break
                else:
                    # 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:
                        # END!!
                        return 0
                    # -----------------------
        # -----------------------------------------------------
    # -------------------------------------------------------------------------
    print s

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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

Solution code:
n = int(raw_input())

output = ""
for x in range(1, n + 1):
  if x % 3 == 0:
    output += " "
    output += str(x)
  elif x % 10 == 3:
    output += " "
    output += str(x)
  elif (x / 10) % 10 == 3:
    output += " "
    output += str(x)
print output

Submission status: Wrong Answer

Solution code:
n = int(raw_input())

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