Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() (int, error) {
	return strconv.Atoi(nextString())
}

func main() {
	scanner.Split(bufio.ScanWords)

	for {
		n, err := nextInt()
		if err != nil {
			break
		}

		w := 512
		weights := make([]int, 10)
		for i := 9; i >= 0; i-- {
			if n >= w {
				weights[i] = w
				n -= w
			}
			w /= 2
		}

		output := []int{}
		for i := 0; i < 10; i++ {
			if weights[i] > 0 {
				output = append(output, weights[i])
			}
		}
		outputStr := fmt.Sprint(output)
		fmt.Println(outputStr[1:(len(outputStr) - 1)])
	}
}

Python: import sys
bundo = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]
bundo.reverse()
for line in sys.stdin:
    n = int(line)
    ans = ''
    for i in bundo:
        if n >= i:
            n -= i
            ans = str(i) + ' ' + ans
    print(ans[:-1])

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

while True:
    try:
        w_b = int(input())
        b = list(bin(w_b))[::-1]
        w_c = []
        for i in range(len(b)):
            if b[i] == "b":
                break
            elif b[i] == "1":
                w_c.append(w_a[i])
        print(*w_c)
    except:
        break

Python: while True:
    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)))

Python: import sys
l=[int(i) for i in sys.stdin]
[print(" ".join(map(str,i))) for i in [[2**i for i in range(10) if j&(1<<i)] for j in l]]

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

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: import bisect
cp=[1,2,4,8,16,32,64,128,256,512]
while 1:
    try:
        ans=[]
        n=input()
        while 1:
            index=bisect.bisect_left(cp,n)
            if n in cp:
                ans.append(n)
                break
            ans.append(cp[index-1])
            n%=cp[index-1]
        ans.reverse()
        print(' '.join(map(str,ans)))
    except:
        break

Python: def solve(x):
	B=list(map(int,x))
	B.reverse()
	for i in range(len(B)):
		B[i]=B[i]*(2**i)
	#remove 0
	while 0 in B:
		B.remove(0)
	print(" ".join(map(str,B)))	


while True:
	try:
		x=int(input())
		solve(format(x,'b'))

	except EOFError:
		break

Python: def solve(x):
	B=list(map(int,x))
	B.reverse()
	for i in range(len(B)):
		B[i]=B[i]*(2**i)
	if 0 in B:
		B.remove(0)
	print(" ".join(map(str,B)))	


while True:
	try:
		x=int(input())
		solve(format(x,'b'))

	except EOFError:
		break

Python: import sys
W = []
N = [1,2,4,8,16,32,64,128,256,512]
for line in sys.stdin:
    W.append(int(line))
for x in W:
    ans = []
    for y in N:
        if x & y:
            ans.append(str(y))
    print(' '.join(ans))

Python: import sys
for d in sys.stdin:print(*[w for w in[2**i for i in range(10)]if int(d)& w])

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

while True:
    try:
        s = []
        num = int(input())
        for i in lst:
            if num >= i:
                num = num - i
                s.append(i)
        
        s.sort()
        print(*s)

    except EOFError:
        break

Python: import sys
for d in sys.stdin:print(*[int(b)*2**i for i,b in enumerate(bin(int(d))[2:][::-1])if int(b)])

Python: import sys
readlines = sys.stdin.readlines
write = sys.stdout.write
def solve():
    for line in readlines():
        v = int(line)
        res = []
        for i in range(10):
            if v & (1 << i):
                res.append(1 << i)
        write(" ".join(map(str, res)))
        write("\n")
solve()

Python: import sys

w = [512,256,128,64,32,16,8,4,2,1]
ans = []
for x in sys.stdin:
    for i in range(10) :
        if int(x) % w[i] == 0:
            ans.append(w[i])
            ans.reverse()
            print(*ans)
            ans = []
            break
        else:
            if int(x) // w[i] == 1 :
                ans.append(w[i])
                x = int(x) % w[i]

Python: import sys

weight = [2**x for x in range(10)]
weight.reverse()

for s in sys.stdin:
	w = int(s)
	ans = []
	for i in range(10):
		if w == 0:
			break
		if w >= weight[i]:
			w -= weight[i]
			ans.append(weight[i])

	ans.reverse()
	for i in range(len(ans)):
		print(ans[i], end='')
		if i < len(ans)-1:
			print(' ', end='')
	print()

Python: while(True):
    try:
        n = int(input())
    except:
        break
    a = []
    for i in [2 ** j for j in range(9, -1, -1)]:
        if n >= i:
            a.insert(0, i)
            n -= i
    print(*a)

Python: # -*- coding: utf-8 -*-
# !/usr/bin/env python
# vim: set fileencoding=utf-8 :

"""
#
# Author:   Noname
# URL:      https://github.com/pettan0818
# License:  MIT License
# Created: 木 10/26 19:32:38 2017

# Usage
#
"""
import sys

WEIGHTS = [2 ** i for i in range(9)]

def solver_greedy(target_weight: int):
    """
    >>> print(solver_greedy(127))
    [1, 2, 4, 8, 16, 32, 64]
    """
    res = []
    for w in sorted(WEIGHTS, reverse=True):
        if w <= target_weight:
            res.append(w)
            target_weight = target_weight - w
        if target_weight == 0:
            return sorted(res)


if __name__ == '__main__':
    data = []
    for line in sys.stdin:
        data.append(int(line))

    for i in data:
        res = solver_greedy(i)

        for x,n in enumerate(res):
            sys.stdout.write(str(n))
            if x + 1 == len(data):
                sys.stdout.write("\n")
                break
            sys.stdout.write(" ")

Python: def main():
    W = [512,256,128,64,32,16,8,4,2,1]
    while True:
        try:
            w = []
            weight = int(input())
            for value in W:
                if weight >= value:
                    weight -= value
                    w.append(value)
            print(*reversed(w))
        except EOFError:
            break
if __name__ == '__main__':
    main()

Python: # coding=utf-8
import math


def binary_conv(number: int) -> list:
    binary_list = []
    while True:
        binary_list.append(number % 2)
        if number == 1 or number == 0:
            break
        number //= 2
    binary_list.reverse()
    return binary_list


if __name__ == '__main__':
    while True:
        try:
            w = int(input())
        except EOFError:
            break
        weight_list = []
        w_binary = binary_conv(w)
        for i in range(len(w_binary)):
            if w_binary[i] != 0:
                weight_list.append(int(math.pow(2, i)))
        print(' '.join(map(str, weight_list)))

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

   return w
def sort1(num):
   i = 0
   j = 0
   for i in range(0,len(num)):
        for j in range(0,len(num)-i-1):
            if num[j] < num[j+1]:
               temp = num[j]
               num[j] = num[j+1]
               num[j+1]=temp
   return num
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)