Problem:


Weight

祖母が天秤を使っています。天秤は、二つの皿の両方に同じ目方のものを載せると釣合い、そうでない場合には、重い方に傾きます。10 個の分銅の重さは、軽い順に 1g, 2g, 4g, 8g, 16g, 32g, 64g, 128g, 256g, 512g です。

祖母は、「1kg くらいまでグラム単位で量れるのよ。」と言います。「じゃあ、試しに、ここにあるジュースの重さを量ってよ」と言ってみると、祖母は左の皿にジュースを、右の皿に 8g と64g と128g の分銅を載せて釣合わせてから、「分銅の目方の合計は 200g だから、ジュースの目方は 200g ね。どう、正しいでしょう？」と答えました。

左の皿に載せる品物の重さを与えるので、天秤で与えられた重みの品物と釣合わせるときに、右の皿に載せる分銅を軽い順に出力するプログラムを作成して下さい。ただし、量るべき品物の重さは、すべての分銅の重さの合計 (=1023g) 以下とします。

Input

複数のデータセットが与えられます。各データセットに、左の皿に載せる品物の重さが１行に与えられます。入力の最後まで処理して下さい。データセットの数は 50 を超えません。

Output

各データセットに対して、右の皿に載せる分銅（昇順）を１つの空白で区切って、１行に出力して下さい。

Sample Input

5
7
127

Output for the Sample Input

1 4
1 2 4
1 2 4 8 16 32 64

Hint

分銅の重さは 2 の n 乗 ( n = 0, 1, .... 9 )g です。



Sample input:
5
7
127


Sample output:
1 4
1 2 4
1 2 4 8 16 32 64

Submission status: Wrong Answer

Solution code:
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

Submission status: Wrong Answer

Solution code:
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

Submission status: Wrong Answer

Solution code:
n = int(raw_input())
m = 0
ls = []
while n>0:
    if n%2==1:
        ls.append(2**m)
    n = n/2
    m +=1
print ' '.join(map(str,ls))

Submission status: Wrong Answer

Solution code:
while True:
    try:
        n=int(input())
    except:
        break

    l=list(format(n,'b'))
    
    for i in range(len(l)):
        if l[-i-1] == "1":
            print(2**i, end="???")
            
    print()

Submission status: Wrong Answer

Solution code:
def get_int():
    while True:
        try:
            yield int(raw_input())
        except EOFError:
            break

def orchestra(n, move_count, current, flag):
    for i in range(move_count):
        n_lis.append(multiple_lis[current+i])
        if flag == n:
            if calculate():
                return True
            del n_lis[-1]
        else:
            if orchestra(n, move_count, current+i+1, flag+1):
                return True
            move_count -= 1
            del n_lis[-1]
    
def calculate():
    if sum(n_lis) == _num:
        result_lis = [2*n for n in n_lis]
        if num % 2 != 0:
            result_lis.insert(0, 1)
        for result in result_lis:
            print result,
        print ''
        return True
    
multiple_lis = [1, 2, 4, 8, 16, 32, 64, 128, 256]       
num_lis = list(get_int())
n = 0
n_lis = []
for num in num_lis:
    _num = num / 2
    for i in range(9):
        n = i
        move_count = 9-i
        current = 0
        flag = 0
        if orchestra(n, move_count, current, flag):
            break

Submission status: Wrong Answer

Solution code:
def get_int():
    while True:
        try:
            yield int(raw_input())
        except EOFError:
            break

def orchestra(n, move_count, current, flag):
    for i in range(move_count):
        n_lis.append(multiple_lis[current+i])
        if flag == n:
            if calculate():
                return True
            del n_lis[-1]
        else:
            if orchestra(n, move_count, current+i+1, flag+1):
                return True
            move_count -= 1
            del n_lis[-1]
    
def calculate():
    if sum(n_lis) == _num:
        result_lis = [str(2*n) for n in n_lis]
        if num % 2 != 0:
            result_lis.insert(0, '1')
        print ' '.join(result_lis),
        return True
    
multiple_lis = [1, 2, 4, 8, 16, 32, 64, 128, 256]       
num_lis = list(get_int())
n = 0
n_lis = []
for num in num_lis:
    _num = num / 2
    for i in range(9):
        n = i
        move_count = 9-i
        current = 0
        flag = 0
        if orchestra(n, move_count, current, flag):
            break

Submission status: Wrong Answer

Solution code:
def get_int():
    while True:
        try:
            yield int(raw_input())
        except EOFError:
            break

def orchestra(n, move_count, current, flag):
    for i in range(move_count):
        n_lis.append(multiple_lis[current+i])
        if flag == n:
            if calculate():
                return True
            del n_lis[-1]
        else:
            if orchestra(n, move_count, current+i+1, flag+1):
                return True
            move_count -= 1
            del n_lis[-1]
    
def calculate():
    if sum(n_lis) == _num:
        result_lis = [str(2*n) for n in n_lis]
        if num % 2 != 0:
            result_lis.insert(0, '1')
        print ' '.join(result_lis),
        return True
    
multiple_lis = [1, 2, 4, 8, 16, 32, 64, 128, 256]       
num_lis = list(get_int())
n = 0
n_lis = []
for num in num_lis:
    _num = num / 2
    for i in range(8, -1, -1):
        n = i
        move_count = 9-i
        current = 0
        flag = 0
        if orchestra(n, move_count, current, flag):
            break

Submission status: Wrong Answer

Solution code:
def orchestra(n, move_count, current, flag):
    for i in range(move_count):
        n_lis.append(multiple_lis[current+i])
        if flag == n:
            if calculate():
                return True
            del n_lis[-1]
        else:
            if orchestra(n, move_count, current+i+1, flag+1):
                return True
            move_count -= 1
            del n_lis[-1]
    
def calculate():
    if sum(n_lis) == _num:
        result_lis = [str(2*n) for n in n_lis]
        if num % 2 != 0:
            result_lis.insert(0, '1')
        print ' '.join(result_lis),
        return True
    
multiple_lis = [1, 2, 4, 8, 16, 32, 64, 128, 256]
while True:
    try:   
        num = int(raw_input())
        n = 0
        n_lis = []
        _num = num / 2
        for i in range(8, -1, -1):
            n = i
            move_count = 9-i
            current = 0
            flag = 0
            orchestra(n, move_count, current, flag)
    except EOFError:
        break

Submission status: Wrong Answer

Solution code:
def orchestra(n, move_count, current, flag):
    for i in range(move_count):
        n_lis.append(multiple_lis[current+i])
        if flag == n:
            if calculate():
                return True
            del n_lis[-1]
        else:
            if orchestra(n, move_count, current+i+1, flag+1):
                return True
            move_count -= 1
            del n_lis[-1]
    
def calculate():
    if sum(n_lis) == _num:
        result_lis = [str(2*n) for n in n_lis]
        if num % 2 != 0:
            result_lis.insert(0, '1')
        print ' '.join(result_lis)
        return True
    
multiple_lis = [1, 2, 4, 8, 16, 32, 64, 128, 256]
while True:
    try:   
        num = int(raw_input())
        n = 0
        n_lis = []
        _num = num / 2
        for i in range(8, -1, -1):
            n = i
            move_count = 9-i
            current = 0
            flag = 0
            orchestra(n, move_count, current, flag)
    except EOFError:
        break

Submission status: Wrong Answer

Solution code:
def orchestra(n, move_count, current, flag):
    for i in range(move_count):
        n_lis.append(multiple_lis[current+i])
        if flag == n:
            if calculate():
                return True
            del n_lis[-1]
        else:
            if orchestra(n, move_count, current+i+1, flag+1):
                return True
            move_count -= 1
            del n_lis[-1]
    
def calculate():
    if sum(n_lis) == _num:
        result_lis = [str(2*n) for n in n_lis]
        if num % 2 != 0:
            result_lis.insert(0, '1')
        print ' '.join(result_lis)
        return True
    
multiple_lis = [1, 2, 4, 8, 16, 32, 64, 128, 256]
while True:
    try:   
        num = int(raw_input())
        n_lis = []
        _num = num / 2
        for i in range(8, -1, -1):
            n = i
            move_count = 9-i
            current = 0
            flag = 0
            if orchestra(n, move_count, current, flag):
                break
    except EOFError:
        break

Submission status: Wrong Answer

Solution code:
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

Submission status: Wrong Answer

Solution code:
#encoding=utf-8
import itertools as iter
import sys
for i in sys.stdin:
    omori = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]
    x = int(i)
    for i in xrange(1,10):
        for element in iter.combinations(omori,i):
            if sum(element) == x:
                for k in xrange(len(element)):
                    print element[k],
                print ""

Submission status: Wrong Answer

Solution code:
while True:
    try:
        w = int(input())
    except:
        break
    print(*[2 ** i if w // 2 ** i else '' for i in range(10)])

Submission status: Wrong Answer

Solution code:
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

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

Submission status: Wrong Answer

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

import sys
import os
import datetime
from itertools import combinations

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

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

    print(*reversed(use))

Submission status: Wrong Answer

Solution code:
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

Submission status: Wrong Answer

Solution code:
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))])

Submission status: Wrong Answer

Solution code:
# 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)))

Submission status: Wrong Answer

Solution code:
import sys

def n2(x):
    a = 1
    temp = 0
    while(True):
        temp += a
        print a,
        a *= 2
        if((a + temp) > x):
            break
    print

l = []
for input in sys.stdin:
    l.append(int(input))
for data in l:
    n2(data)

Submission status: Wrong Answer

Solution code:
import sys

def isn2(x):
    if(x == 1):
        return True
    elif(x % 2 != 0):
        return False
    return True and isn2(x/2)

def n2(x):
    a = 1
    if(isn2(x) == True):
        print x,
    else:
        while(True):
            print a,
            x -= a
            if(isn2(x) == True):
                print x,
                break
            a *= 2
            if(a > x):
                break
    print

l = []
for input in sys.stdin:
    l.append(int(input))
for data in l:
    n2(data)

Submission status: Wrong Answer

Solution code:
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

Submission status: Wrong Answer

Solution code:
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())))

Submission status: Wrong Answer

Solution code:
while True:
  try:
    a=int(input())
    b=a ; c=0
    for i in range(10):
      if b <=0: break
      else:
        b -=2**i
        c+=1
    for i in range(c):
      print 2**i,
    else: print ""
  except EOFError: break

Submission status: Wrong Answer

Solution code:
while True:
 try:
  l = [];
  n = input();
  for i in range(10):
   if ((n >> i) & 1) == 1:
    l.append(1 << i);
  print " ".join(l)
 except:
  break

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env

import sys

weights = map(lambda n: 2 ** n, range(0, 9))
weights.reverse()
for line in sys.stdin:
    m = int(line)
    s = []
    for w in weights:
        if w <= m:
            s.append(w)
            m -= w
    s.reverse()
    print ' '.join(map(str, s))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env

import sys

weights = map(lambda n: 2 ** n, range(0, 9))
weights.reverse()
while True:
    try:
        m = int(raw_input())
    except EOFError:
        break
    s = []
    for w in weights:
        if w <= m:
            s.append(w)
            m -= w
    s.reverse()
    print ' '.join(map(str, s))

Submission status: Wrong Answer

Solution code:
W=[1,2,4,8,16,32,64,128,256,512]
import sys
for s in sys.stdin:
    B=format(int(s),'b')
    i=0
    for e in B:
        if e=="1": print W[i],
        i+=1

Submission status: Wrong Answer

Solution code:
W=[1,2,4,8,16,32,64,128,256,512]
import sys
for s in sys.stdin:
    B=format(int(s),'b')
    i=0
    for e in B:
        if e=="1": print W[i],
        i+=1
    print

Submission status: Wrong Answer

Solution code:
import sys,math
for v in sys.stdin:
	m=int(v)
	for i in range(10):
		if m&(2**i):
			print 2**i,

Submission status: Time Limit Exceeded

Solution code:
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)

Submission status: Time Limit Exceeded

Solution code:
# 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

Submission status: Memory Limit Exceeded

Solution code:
from math import *
PI = 3.1415926535898
while True:
	try:
		n = input()
		base = 1
		ans = ""
		while base < n:
			base *= 2
		base /= 2
		res = [base]
		n -= base
		while n > 0:
			base /= 2
			if n >= base:
				res.append(base)
				n -= base
		ans = ""
		for x in reversed(res):
			if len(ans) > 0:
				ans += " "
			ans += str(x)
		print ans
	except EOFError:
		break

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
import itertools

for s in sys.stdin:
  lis_weight = [1,2,4,8,16,32,64,128,256,512] 
  lis = []
  d = int(s)
  lis_weight.reverse()
  for e in lis_weight:
    if d >= e:
      lis.append(e)
      d -= e
  lis.reverse()
  for e in lis:
    print e,
  print

Submission status: Accepted

Solution code:
import sys
f = sys.stdin

for line in f:
    target = int(line)
    print(*[weight for weight in [2 ** i for i in range(10)] if target & weight])

Submission status: Accepted

Solution code:
while True:
    try:
        n = int(raw_input())
    except EOFError:
        break
    m = 0
    ls = []
    while n>0:
        if n%2==1:
            ls.append(2**m)
        n = n/2
        m +=1
    print ' '.join(map(str,ls))

Submission status: Accepted

Solution code:
while True:
    try:
        n=int(input())
    except:
        break

    l=list(format(n,'b'))
    
    for i in range(len(l)):
        if l[-i-1] == "1":
            print(2**i, end="")
            if i != len(l)-1:
                    print(" ",end="")
            
    print()

Submission status: Accepted

Solution code:
import sys

for weight in sys.stdin:
    binary=[0]*10
    weight = int(weight)
    i=0
    while i<=9 or weight!=0:
        binary[i]=weight%2
        weight/=2
        i+=1
    print ' '.join(map(str,[2**b for b in range(len(binary)) if binary[b]==1]))

Submission status: Accepted

Solution code:
import sys
for n in map(int,sys.stdin):
	for i in range(10):
		if n&1:print 2**i,
		n/=2
	print

Submission status: Accepted

Solution code:
def orchestra(n, move_count, current, flag):
    for i in range(move_count):
        n_lis.append(multiple_lis[current+i])
        if flag == n:
            if calculate():
                return True
            del n_lis[-1]
        else:
            if orchestra(n, move_count, current+i+1, flag+1):
                return True
            move_count -= 1
            del n_lis[-1]
    
def calculate():
    if sum(n_lis) == _num:
        result_lis = [str(2*n) for n in n_lis]
        if num % 2 != 0:
            result_lis.insert(0, '1')
        print ' '.join(result_lis)
        return True
    
multiple_lis = [1, 2, 4, 8, 16, 32, 64, 128, 256]
while True:
    try:   
        num = int(raw_input())
        n_lis = []
        _num = num / 2
        for i in range(8, -1, -1):
            n = i
            move_count = 9-i
            current = 0
            flag = 0
            if orchestra(n, move_count, current, flag):
                break
        else:
            print 1
    except EOFError:
        break

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

Solution code:
while 1:
    try:
        ans=0
        for i,j in enumerate(bin(int(raw_input()))[::-1]):
            if j=="1":
                print 2**i,
        print
    except:
        break

Submission status: Accepted

Solution code:
# -*- 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()

Submission status: Accepted

Solution code:
import sys
for line in sys.stdin.readlines():
  m = int(line)
  c = 0
  l = []
  while m > 0:
    a = m % 2
    if a == 1:
      l.append(str(2**c))
    m = m // 2
    c += 1
  print(' '.join(l))

Submission status: Accepted

Solution code:
from math import *
PI = 3.1415926535898
while True:
	try:
		n = input()
		base = 1
		ans = ""
		while base < n:
			base *= 2
		if base > n:
			base /= 2
		res = [base]
		n -= base
		while n > 0:
			base /= 2
			if n >= base:
				res.append(base)
				n -= base
		ans = ""
		for x in reversed(res):
			if len(ans) > 0:
				ans += " "
			ans += str(x)
		print ans
	except EOFError:
		break

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
#encoding=utf-8
import itertools as iter
import sys
for i in sys.stdin:
    omori = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]
    x = int(i)
    for i in xrange(1,11):
        for element in iter.combinations(omori,i):
             if sum(element) == x:
                 for k in xrange(len(element) - 1):
                     print element[k],
                 print element[len(element) -1]

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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'])

Submission status: Accepted

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

import sys

w = []
tmp = 1
for i in range(10):
    w.append(tmp)
    tmp *= 2

for line in sys.stdin:
    weight = int(line)
    parts = []
    for i in range(9, -1, -1):
        if weight == 0:
            break
        if weight >= w[i]:
            weight -= w[i]
            parts.append(w[i])
    parts.reverse()
    print " ".join(map(str, parts))

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
while True:
    try:
        w = int(input())
    except:
        break
    ans = [2 ** i if w // 2 ** i % 2 else 0 for i in range(10)]
    while ans.count(0):
        del ans[ans.index(0)]
    print(*ans)

Submission status: Accepted

Solution code:
import itertools

weights = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]
combo = []
for i in xrange(len(weights)):
    combo += itertools.combinations(weights, i + 1)
sums = map(sum, combo)

while 1:
    try:
        print " ".join(map(str, combo[sums.index(input())]))
    except:
        break

Submission status: Accepted

Solution code:
import sys

for line in sys.stdin:
	x=int(line)
	out=1
	ret=""
	while x:
		if x&1:
			ret+=" "+str(out)
		x/=2
		out*=2
	print ret[1::]

Submission status: Accepted

Solution code:
import sys

for line in sys.stdin:
    n = int(line.rstrip())
    x = 1
    a = []
    while n > 0:
        if n % 2 == 1:
            a.append(x)
        x *= 2
        n /= 2
    print ' '.join(map(str, a))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
import sys
from itertools import compress


def solve(w):
    """ w[g]???????????¨???????????????????????????????????????
        ???????????? 1g????????? 2g????????? ??? 512g????????????????????????????????????????????????????????¢???
    """
    bin_w = '{0:010b}'.format(w)  # ?????????2?????°??¢??????(512g??????????????§???????????§???????????????0????????£?????°??????)
    result = [int(x) for x in bin_w]  # ??????????????????????????????????????°??????
    result.reverse()  # ???????????????????????¨???1g, 2g????????§?????????????????¨???????????????????????????????????????
    return result


if __name__ == '__main__':
    weights = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]  # ??????????????????

    # ??????????????\???
    for line in sys.stdin:
        w = int(line.strip())

        # ???????????????????±???????
        ans = solve(w)
        # print(ans)

        # ???????????????
        comp = compress(weights, ans)  # weights[]??????????????????ans[i]???1?????¨??????????????????
        print('{0}'.format(' '.join(map(str, comp))))

Submission status: Accepted

Solution code:
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)))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
import sys

while True:
  n = sys.stdin.readline()
  if not n: break
  n = int(n)
  b = bin(n)
  s = str(b)
  is_first = True
  sm=1
  l = len(s)
  while True:
    l-=1
    if s[l] == "1":
      if not is_first: sys.stdout.write(" ")
      sys.stdout.write(str(sm))
      is_first = False
    sm*=2
    if l == 0: break
  print ""

Submission status: Accepted

Solution code:
def aux(x,ans,b):
    if x == 0:
        return(' '.join(map(str,ans)))
    elif x % 2 == 1:
        return(aux(x//2, ans+[b],b*2))
    else:
        return(aux(x//2, ans, b*2))

while True:
    try:
        x = int(input())
        print(aux(x,[],1))
    except EOFError:
        break

Submission status: Accepted

Solution code:
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)))

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
# -*- 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))

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
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]])

Submission status: Accepted

Solution code:
# coding: utf-8
# Here your code !
import sys

ws = [pow(2,i) for i in range(10)]

for line in sys.stdin:
    a = []
    t = int(line)
    for w in ws[::-1]:
        if t>=w:
            a.append(w)
            t=t-w
    print ' '.join(map(str, sorted(a)))

Submission status: Accepted

Solution code:
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])