Go: package main

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		num, _ := strconv.Atoi(scanner.Text())
		first := true
		beki := 1
		for num != 0 {
			if num % 2 == 1 {
				if !first {
					fmt.Print(" ")
				}
				fmt.Print(beki)
				first = false
			}
			num /= 2
			beki *= 2
		}
		fmt.Println()
	}
}

Python: while True:
    g = int(input())
    now = 512
    ans = []
    while True:
        if g == 0:
            break
        elif g >= now:
            g -= now
            ans.append(now)
        now //= 2
    temp = ''
    for i in ans[::-1]:
        temp += str(i) + ' '
    print(temp[:-1])

Python: while 1:
    try:
        n = int(input())
        s = format(n, '10b')
        ans = [2 ** (9-i) for i in range(10)[::-1] if s[i] == '1']
        print(*ans)

    except:
        break

Python: def get_input():
    while True:
        try:
            yield ''.join(input())
        except EOFError:
            break

N = list(get_input())
w = [1,2,4,8,16,32,64,128,256,512]
w.reverse()

for l in range(len(N)):
    n = int(N[l])
    ans = []
    for i in range(10):
        if n >= w[i]:
            n = n - w[i]
            ans.append(w[i])
    ans.sort()
    print(ans[0], end="")
    for i in range(1,len(ans)):
        print(" " + str(ans[i]), end="")
    print("")

Python: def solve(num, l):
  if num == 0:
    return l

  l.append(num % 2)
  return solve(num // 2, l)

while True:
  try:
    num = int(input())
    nums = solve(num, [])
    ans = ""
    for i, v in enumerate(nums):
      if v:
        ans += str(2 ** i) + " "
    print(ans.rstrip())

  except EOFError:
    break

Python: while True:
  n = []
  try:
    w = bin(int(input()))
  except EOFError:
    break
  for i in range(len(w)-1,1,-1):
    if int(w[i]):
      n.append(int(2**(len(w)-i-1)))
  print(*n)

Python: #2進数化
def bin(w, l):
  if w == 0:
    return l

  l.append(w % 2)
  return bin(w // 2, l)

while True:
  try:
    w = int(input())
    w_bin = bin(w, [])
    ans = ""
    for i, v in enumerate(w_bin):
      if v:
        ans += str(2 ** i) + " "
    print(ans.rstrip())

  except EOFError:
    break

Python: while True:
    try:
        left = int(input())
        right = []
        i = 9
        while i >= 0:
            w = 2 ** i
            if left >= w:
                left -= w
                right.insert(0, w)
            i -= 1
        print(*right, sep=" ")
    except:
        break

Python: w = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]
w.reverse()
def weight(x):
    res = []
    for i in range(len(w)):
        if w[i] <= x:
           res.append(i)
           x = x-w[i]
    return res
while True:
    try:
        x = int(input())
        res = weight(x)
        res.reverse()
        print(w[res[0]],end = '')
        for i in range(1,len(res)):
            print(' ',w[res[i]],sep = '',end = '')
        print('')
    except EOFError:
        break

Python: while True:
    try:
        N=int(input())
        lis=[]
        while N!=1:
            lis.append(N%2)
            N=N//2
            if N==1:
                lis.append(N)
        num=0
        ans=""
        for i in lis:
            if i==1:
                ans +=str(2**num)+" "
            num +=1
        print(ans)
    except:break

Python: while True:
    try:
        weight = int(input())
    except:
        break
    g = []
    while weight != 1:
        weight, b = divmod(weight, 2)
        g.append(b)
    g.append(weight)
    print(*[pow(2*g[i], i) for i in range(len(g)) if g[i]])

Python: 
if __name__ == '__main__':

	while True:
		try:
			n = int(input())

			ans = []
			for i in range(9,-1,-1):
				if n >=  2**i:
					ans.append(2**i)
					n -= 2**i

			print(*sorted(ans))

		except EOFError:
			break

Python: # -*- coding: utf-8 -*-

import sys
import os

for s in sys.stdin:
    target = int(s)

    use = []
    W = [512, 256, 128, 64, 32, 16, 8, 4, 2, 1]
    for w in W:
        if target >= w:
            target -= w
            use.append(w)

    print(*reversed(use))

Python: import sys

for line in sys.stdin:
    n = int(line)
    print(' '.join(map(str, [2**i for i, b in enumerate(bin(n)[-1:1:-1]) if b == '1'])))

Python: import sys
def func(w,result):
   list = [1,2,4,8,16,32,64,128,256,512]
   for i in range(len(list)):
       if w == list[i]:
           result.append(list[i])
           w = w - list[i]
           break
       else:
           if list[i] > w :
               result.append(list[i-1])
               w = w - list[i-1]
               break
           elif w > 512:
               result.append(512)
               w = w - 512
               break

   return w
for line in sys.stdin.readlines():
   result = []
   w = int(line)
   while w > 0 :
       w = func(w,result)
   i = len(result)-1
   while i > 0:
       print(result[i],end=' ')
       i -= 1
   print(result[0])
   del(result)

Python: while True:
    try:
        n=int(input())
    except:
        break
    b=bin(n)[2:][::-1]
    c=[]
    for i in range(len(b)):
        if b[i]=='1':
            c.append(2**i)
    print(" ".join(map(str,c)))

Python: while True:
    try:
        weight = int(input())
    except:
        break
    g = []
    while weight != 1:
        weight, b = divmod(weight, 2)
        g.append(b)
    g.append(weight)
    print(*[pow(2*g[i], i) for i in range(len(g))])

Python: # -*- coding:utf-8 -*-

def main():
    while True:
        try:
            val=str(format(int(input()),'010b'))
            LIST=[2**(10-x) for x in range(10,0,-1) if val[x-1]=="1"]

            for i in LIST:
                print(i,end="")
                if LIST.index(i)==len(LIST)-1:
                    print("")
                else:
                    print(" ",end="")
        except:
            break

    
if __name__ == '__main__':
    main()

Python: while 1:
	li=[]
	w = list(2**i for i in range(10))
	try: a = int(input())
	except: break
	for i in range(9,-1,-1):
		if w[i] <= a:
			a = a - w[i]
			li.append(w[i])
	li.reverse()
	for i in li: 
		if i == li[len(li)-1]:
			print(i)
		else:
			print(i, end=' ')

Python: while True:
    try:
        Num = []
        n = int(input())
        while n > 0:
            if n % 2 == 1:
                Num.append(1)
                n = (n - 1) / 2
            else:
                Num.append(0)
                n = n / 2
        for i in range(len(Num) - 1):
            if Num[i] == 1:
                print(2**i,end = " ")
        print(2**(len(Num)-1))
    except EOFError:
        break

Python: while True:
    try:
        instr = str(bin(int(input())))
        ans = []
        for i in range(len(instr)):
            if instr[-i]=="1": ans.append(1<<i-1)
        print(" ".join(map(lambda x: str(x), ans)))
    except EOFError:
        break

Python: g = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]

while True :
    try :
        c = -1
        left, right = int(input()), []
        while True :
            if left <= 0 : break
            else :
                if left - g[c] < 0 : c += -1
                else :
                    left -= g[c]
                    right.append(g[c])
        right.sort()
        print(right)
    except : break

Python: import sys


for line in sys.stdin:
    weight = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]
    ans = []
    n = bin(int(line))[2:]
    for i, x in enumerate(n[::-1]):
        if x == "1":
            ans.append(str(weight[i]))
    print(" ".join(ans))

Python: import sys
for l in sys.stdin: print(*[k*2**j for j,k in enumerate([int(b) for b in (str(bin(int(l)))[:1:-1])]) if k])

Python: b = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]
b.reverse()
try:
    while 1:
        n = int(input())
        l = []
        for i in b:
            if i <= n:
                l.insert(0, i)
                n -= i
        print(*l)
except:
    pass