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: # AOJ 0031 Weight
# Python3 2018.6.14 bal4u

w = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512];

while True:
	try:
		a = int(input())
	except EOFError:
		break
		
	ans = []
	i = 0
	while a > 0:
		if a & 1:
			ans.append(w[i])
		a >>= 1
		i += 1
	print(*ans)

Python: blist = [int(2**i) for i in range(10)]
while(1):
    try:
        n = int(input())
        b_ = bin(n)
        b = list(b_)[-1:1:-1]
        for i in range(len(b)):
            if b[i] == "1":
                if i == len(b) - 1:
                    print(blist[i])
                else:
                    print(blist[i], end= " ")
    except EOFError:
        break

Python: # Aizu Problem 0031: Weight
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")

while True:
    try:
        w = int(input())
    except EOFError:
        break
    b = bin(w)[2:][::-1]
    while len(b) < 10:
        b += '0'
    out = ""
    for k in range(10):
        if b[k] == '1':
            out += str(2**k) + ' '
    print(out[:-1])

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]
    >>> print(solver_greedy(10))
    [2, 8]
    """
    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(line.rstrip("\n"))

    data = [int(d) for d in data[:-1]]

    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: import math
while True:
  try:
    n = int(input())
    ans = []
    while n != 0:
      if n%2 == 1:
        n -= 1
        ans.append( 1 )
      else:
        buff = []
        tmp = n
        while True:
          tmp //= 2
          buff.append(2)
          if tmp%2 != 0:
            n -= math.pow(2, len(buff))
            ans.append( math.pow(2, len(buff)) )
            break
    print( ' '.join( [f'{int(a)}' for a in ans] ) )
  except:
    break

Python: import sys
for line in sys.stdin:
    l = bin(int(line)).lstrip("0b")[::-1]
    ans = []
    for i,bit in enumerate(l):
        if bit == "1":
            ans.append(2**i)
    print(*ans)

Python: while 1:
    try:
        w = int(input())
    except:
        break

    fun = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]
    anslist = []
    for f in reversed(fun):
        if w - f >= 0:
            anslist.append(f)
            w -= f
    print(' '.join(str(ans) for ans in reversed(anslist)))

Python: import sys
for d in sys.stdin:
 c=0
 a=[]
 for b in bin(int(d))[2:][::-1]:
  if int(b):a+=[int(b)*2**c]
  c+=1
 print(*a)

Python: # coding=utf-8


def calc_weights(weight):
    weights_list = []
    counter = 0
    while weight > 0:
        if weight % 2 == 0:
            weight /= 2
        else:
            weights_list.append(2**counter)
        counter += 1
    print(' '.join(map(str, weights_list)))


if __name__ == '__main__':
    while True:
        try:
            W = int(input())
            calc_weights(W)
        except EOFError:
            break

Python: import sys
Ws = sys.stdin.readlines()
for w in Ws:
    b = bin(int(w))
    t = {0 : 1,
         1 : 2,
         2 : 4,
         3 : 8,
         4 : 16,
         5 : 32,
         6 : 64,
         7 : 128,
         8 : 256,
         9 : 512,
         10: 1024}
    print(* [t[digi] for digi in range(len(b)-2) if b[-1-digi] == '1'])

Python: import sys


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

Python: w_a = [1,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: import math
import fileinput
weight = [2**x for x in range(10)]
for line in fileinput.input():
    if line == "\n":
        break
    else:
        w = int(line)
        log = int(math.log2(w))
        w_type = []
        for i in range(log, -1, -1):
            if sum(w_type) + weight[i] <= w:
                w_type.append(weight[i])
        for i in reversed(range(len(w_type))):
            if i == 0:
                print(w_type[i])
            else:
                print(w_type[i], end=" ")

Python: while True:
    try:
        num = int(input())
        L = []
        for i in range(10):
            if num & (1<<i):
                L.append(2**i)
        print(" ".join(map(str,L)))
    except EOFError:
        break

Python: import sys
for d in sys.stdin:
 m=int(d)
 a,c=[],0
 while m:
  if m&1:a.append(2**c)
  c+=1
  m>>=1
 print(*a)

Python: while 1:
    try:m=int(input())
    except:break
    a,c=[],0
    while m:
        if m&1:a.append(2**c)
        c+=1
        m>>=1
    print(*a)

Python: import sys

l = [2 ** i for i in range(10)]
for line in sys.stdin:
	blist = list(bin(int(line))[2:])
	blist.reverse()
	#print(blist)
	anslist = []
	for i in range(len(blist)):
		if blist[i] == "1":
			anslist.append(str(l[i]))
	print(' '.join(anslist))

Python: import sys
print("\n".join((" ".join(str(2**i)for i, n in enumerate(bin(int(s))[:1:-1])if n=="1")for s in sys.stdin.readlines())))

Python: import sys
for line in sys.stdin:
    ans=[]
    n=1
    for i in reversed(bin(int(line))):
        if i=="1":
            ans.append(n)
        n*=2
    print(*ans)

Python: import sys
  
def toBin(n):
    l = []
    i = 0
    a,b = n,n
    while True:
        b = a % 2
        a = a // 2
        if b == 1:
            l.append(b*(2**i))
        i += 1
        if a == 0:
            break
    return l


for line in sys.stdin:
    n = int(line)
    print(*toBin(n),sep=' ')

Python: W = [2 ** i for i in range(0,10)]

while True:
    try:
        n = int(input())
    except EOFError:
        break
    ans = []
    for i in range(0,10):
        if n & (1 << i):
            ans.append(W [i])
    print(' '.join(map(str,ans)))

Python: import sys


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

Python: import sys
print("\n".join((" ".join(str(2**i)for i, n in enumerate(bin(int(s))[:1:-1])if n)for s in sys.stdin.readlines())))

Python: from sys import stdin
from itertools import product,permutations,combinations

while(True):
    try:
        n = int(stdin.readline())
        a = str(bin(n))
        print(" ".join(str(2**i) for i,s in enumerate(a[:1:-1]) if s=="1"))
    except:
        break