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:
#coding:utf-8
#3????????°???????????????

n = input()

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

Submission status: Wrong Answer

Solution code:
import sys

def call(n):
    i = 1
    while i <= n:
        x = i
        if x % 3 == 0:
            print(' ', x, sep='', end='')
        else:
            while x:
                if x % 10 == 3:
                    print(' ', x, sep='', end='')

                x //= 10
            
        i += 1
        
    print('')
    
if __name__ == '__main__':
    n = int(sys.stdin.readline().strip())
    call(n)

Submission status: Wrong Answer

Solution code:
import sys

def call(n):
    i = 1
    while i <= n:
        x = i
        if x % 3 == 0:
            print(' ', i, sep='', end='')
        else:
            while x:
                if x % 10 == 3:
                    print(' ', i, sep='', end='')

                x //= 10
            
        i += 1
        
    print('')
    
if __name__ == '__main__':
    n = int(sys.stdin.readline().strip())
    call(n)

Submission status: Wrong Answer

Solution code:
n = int(input())
d = [x for x in range(1 ,n+1) if (x % 3 == 0)|(x % 10 == 3)]
s = ''
for i in d:
    s += ' {}'.format(i)
print(s)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
i = 1
for i in range(1, n + 1):
 if i % 3 == 0:
  print(' {0}'.format(i), end = '')
 elif i % 10 == 3:
  print(' {0}'.format(i), end = '')
 else:
  y = 1
  for x in range(1, 5):
   y *= 10
   if i // y == 3:
    print(' {0}'.format(i), end = '')
    break
print()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# get line input split by space
def getLnInput():
    return input().split()


# ceil(a / b) for a > b
def ceilDivision(a, b):
    return (a - 1) // b + 1


def call(n):
    i = 1
    while i < n:
        i += 1
        x = i
        if not x % 3:
            print(" " + str(i), end="")
        else:
            while True:
                if x % 10 == 3:
                    print(" " + str(i), end="")
                x //= 10
                if not x:
                    break
    print()


def main():
    n = int(getLnInput()[0])
    call(n)
    return


main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def contains3(n):
    while n > 0:
        if n % 10 == 3:
            return True
        else:
            n /= 10
    return False

x = int(input())
out = ""
for i in range(x):
    n = i + 1
    if n % 3 == 0 or contains3(n):
        out += (" %d" % n)
print(out)

Submission status: Wrong Answer

Solution code:
x = int(input())

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

Submission status: Wrong Answer

Solution code:
#coding:utf-8

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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="")
    else:
        x = i
        while True:
            x = x / 10
            if x == 0:
                break
            if i != 0 and x % 3 == 0:
                print (" %i" % i, end="")
            elif i != 0 and x % 10 == 3:
                print (" %i" % i, end="")
print("")

Submission status: Wrong Answer

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="")
    else:
        x = i
        while True:
            x = x / 10
            if x == 0:
                break
            if i != 0 and x == 3:
                print (" %i" % i, end="")
print("")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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 int(y % 10) == 3: print(" %d" % i, end="")
        y /= 10
        if y == 0: break
print("")

Submission status: Wrong Answer

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="")
            break
        y /= 10
        if int(y == 0): break
print("")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    limit = int(input())

    data = []
    for i in range(3, limit+1):
        if (i % 3) == 0 or (i % 10 == 3):
            data.append(str(i))

    txt = ' '.join(data)
    print(' {0}'.format(txt))

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    limit = int(input())

    data = []
    for i in range(3, limit+1):
        if (i % 3) == 0 :
            data.append(str(i))
        if (i % 10) == 3 and i > 10:
            data.append(str(i))

    txt = ' '.join(data)
    print(' {0}'.format(txt))

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    limit = int(input())

    data = []
    for i in range(3, limit+1):
        if (i % 3) == 0 or (i // 10 % 10) == 3:
            data.append(str(i))


    txt = ' '.join(data)
    print(' {0}'.format(txt))

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    limit = int(input())

    data = []
    for i in range(3, limit+1):
        if (i % 3) == 0 or (i // 10 % 10 == 3) or (i % 10 == 3):
            data.append(str(i))


    txt = ' '.join(data)
    print(' {0}'.format(txt))

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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:
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)
	else:
		while(i%10!=0):
			i/=10
			if i%10==3:
				s+=" "+str(i)
print(s)

Submission status: Wrong Answer

Solution code:
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)
	else:
		x=i
		while(x%10):
			x//=10
			if x%10==3:
				s+=" "+str(i)
print(s)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

call(int(input()))

Submission status: Wrong Answer

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

call(int(input()))

Submission status: Wrong Answer

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
sys.stdout.write(' ')
print(' '.join(map(str,x)))

Submission status: Wrong Answer

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)
for i in X:
    sys.stdout.write(' ')
    sys.stdout.write('%d'%i)
print('')

Submission status: Wrong Answer

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)
for i in X:
    sys.stdout.write(' ')
    sys.stdout.write('%d'%i)
print('')

Submission status: Wrong Answer

Solution code:
def inc3(i):
    if i % 3 == 0: return(True)
    elif i//10==0:
        return(False)
    else:    
        return(inc3(i//10))

n = int(input())
for i in range(1,n+1):
    if inc3(i):
        print(" " + str(i),end="")
print()

Submission status: Wrong Answer

Solution code:
def inc3(i):
    if i % 3 == 0 or i % 10 == 3: return(True)
    elif i//10==0:
        return(False)
    else:    
        return(inc3(i//10))

n = int(input())
for i in range(1,n+1):
    if inc3(i):
        print(" " + str(i),end="")
print()

Submission status: Wrong Answer

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

n = int(input())

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

Submission status: Wrong Answer

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

n = int(input())

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

Submission status: Wrong Answer

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

n = int(input())

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

Submission status: Wrong Answer

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

n = int(input())

for i in range(1,n+1):
    a = i // 10
    a = a % 10
    if i % 3 == 0:
        print(' ',i,sep='',end='')
    elif i % 10 == 3:
        print(' ',i,sep='',end='')
    elif a == 3:
        print(' ',i,sep='',end='')
    elif a % 300 == 0:
        print(' ',i,sep='',end='')
print('')

Submission status: Wrong Answer

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

n = int(input())

for i in range(2,n+1):
    a = i // 10
    a = a % 10
    if i % 3 == 0:
        print(' ',i,sep='',end='')
    elif i % 10 == 3:
        print(' ',i,sep='',end='')
    elif a == 3:
        print(' ',i,sep='',end='')
    elif a % 100 == 3:
        print(' ',i,sep='',end='')
print('')

Submission status: Wrong Answer

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

n = int(input())

for i in range(2,n+1):
    a = i // 10
    a = a % 10
    if i % 3 == 0:
        print(' ',i,sep='',end='')
    elif i % 10 == 3:
        print(' ',i,sep='',end='')
    elif a == 3:
        print(' ',i,sep='',end='')
    elif i // 100 == 3:
        print(' ',i,sep='',end='')
print('')

Submission status: Wrong Answer

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

n = int(input())

for i in range(2,n+1):
    if i % 3 == 0:
        print(' ',i,sep='',end='')
    elif i % 10 == 3:
        print(' ',i,sep='',end='')
    elif i // 10 == 3:
        print(' ',i,sep='',end='')
    elif i // 100 == 3:
        print(' ',i,sep='',end='')
    elif i // 1000 == 3:
        print(' ',i,sep='',end='')
    elif i // 10000 == 3:
        print(' ',i,sep='',end='')
print('')

Submission status: Wrong Answer

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

n = int(input())

for i in range(2,n+1):
    a = i // 10
    a = a % 10
    if i % 3 == 0:
        print(' ',i,sep='',end='')
    elif i % 10 == 3:
        print(' ',i,sep='',end='')
    elif a == 3:
        print(' ',i,sep='',end='')
    elif i // 100 == 3:
        print(' ',i,sep='',end='')
    elif i // 1000 == 3:
        print(' ',i,sep='',end='')
    elif i // 10000 == 3:
        print(' ',i,sep='',end='')
print('')

Submission status: Wrong Answer

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

print()

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

Submission status: Wrong Answer

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

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

print()

Submission status: Wrong Answer

Solution code:
n = int(input())

i = 1

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

i = 1

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
import sys
try:
	while 1:
		N=input()
		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: Wrong Answer

Solution code:
import sys
try:
	while 1:
		N=input()
		i = 1
		while 1:
			if (i % 3) == 0 :
				sys.stdout.write(" ")
				sys.stdout.write("%d" % i)
			else:
				if (i % 10 ) == 3 or (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: Wrong Answer

Solution code:
import sys
try:
	while 1:
		N=input()
		i = 1
		while 1:
			if (i % 3) == 0 :
				sys.stdout.write(" ")
				sys.stdout.write("%d" % i)
			else:
				if (i % 10 ) == 3 or  (i/10)%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: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
result = ""
for i in range(n+1):
    if i % 3 == 0 or i % 10 == 3 or i // 10 == 3 or i // 100 == 3 or i // 1000 == 3 or i // 10000 == 3:
        result += " " + str(i)

print(result)

Submission status: Wrong Answer

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

print(result)

Submission status: Wrong Answer

Solution code:
#!usr/bin/env python3

import sys


def int_fetcher():
    num = int(sys.stdin.readline())
    return num


def generate_factors_of_three():
    res = ''
    for i in range(1, int_fetcher()+1):
        if (i % 3 == 0):
            res += ' ' + str(i)
    return res


def main():
    print(generate_factors_of_three())


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#!usr/bin/env python3

import sys


def int_fetcher():
    num = int(sys.stdin.readline())
    return num


def calc():
    res = ''
    for i in range(1, int_fetcher()+1):
        if i % 3 == 0:
            res += ' ' + str(i)
        elif i % 10 == 3:
            res += ' ' + str(i)
    return res


def main():
    print(calc())


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#!usr/bin/env python3

import sys


def int_fetcher():
    num = int(sys.stdin.readline())
    return num


def call(num):
    res = ''
    for i in range(1, num+1):
        x = i
        if x % 3 == 0 or x % 10 == 3:
            res += ' ' + str(i)
            print('Added: %d' % i)
            continue
        while x:
            if x % 10 == 3:
                res += ' ' + str(i)
                print('Added 2: %d' % i)
                break
            x //= 10
            print('incremented x: %d' % x)
    return res


def main():
    print(call(int_fetcher()))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
try:
	while 1:
		N=input()
		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)
				else:
					if  (i/10)%10 == 3:
						print (i/10)%10,"a"
						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: Wrong Answer

Solution code:
import sys
try:
	while 1:
		N=input()
		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)
				else:
					if  (i/10)%10 == 3:
						#print (i/10)%10,"a"
						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: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

for i in range(1,n-1):
    if i % 3 == 0:
        print(i,)
    else:
        while True:
            if int(i/10) == 3:
                print(i,)
                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):
    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())

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

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)