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

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

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

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

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

Python: import sys
for line in sys.stdin:
    g = int(line)
    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])

C++: #include <stdio.h>

int main()
{
	int n;
	int i;
	int weight[]={1,2,4,8,16,32,64,128,256,512};

	while(scanf("%d", &n)!=EOF){
		for(i=0; i<10; i++){
			if(n%2==1) printf("%d ", weight[i]);
			n = n>>1;
		}
		printf("\n");
	}

	return 0;
}

C++: #include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;

int main(){

  int a[10], b[10], g;

  for(int i=0; i<10; i++){
    a[i] = pow(2, i);
  }

  while(cin >> g){
    fill(b, b+10, 0);
    for(int i=9; i>=0; i--){
      if(a[i] <= g){
        b[i] = 1;
        g -= a[i];
      }
      if(g == 0){
        break;
      }
    }

    for(int i=0; i<10; i++){
      if(b[i] == 1){
        cout << a[i] << " ";
      }
    }
    cout << endl;

  }

  return 0;

}

C++: #include<iostream>
using namespace std;
int main() {
    int a;
    while (cin >> a) {
        for (int i = 0; i < 10; i++) {
            if (1 << i & a) {
                if ((1 << (i + 1)) > a) { //一番右 " " いらない
                    cout << (1 << i);
                } else {
                    cout << (1 << i) << " ";
                }
            }
        }
        cout << endl;
    }
        
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int n, s;
int main() {
	while (cin >> n) {
		s = 0;
		for (int i = 1; i < 31; i++) {
			if ((n / (int)pow(2, i)) % 2 == 1) {
				if (s) { cout << ' '; }
				cout << pow(2, i - 1); s++;
			}
		}
		cout << endl;
	}
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
#define INF 100000



int main(){
	int w;
	bool ans[10];
	for(int i=0;i<9;i++){
		ans[i]=0;
	}
	while(cin>>w){
		for(int i=10;i--;){
			if(w>=pow(2,i)){
				ans[i]=1;
				w=w-pow(2,i);
			}
		}
		
		if(ans[0]){
			cout<<1;
		}
		for(int i=1;i<11;i++){
			if(ans[i]){
				cout<<" "<<pow(2,i);
			}
		}cout<<endl;
	}
	return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0031>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    int n;
    while(cin >> n){
        vector<int> w;
        for(int i = 0; i < 10;i++) if((n>>i)&1) w.push_back(1<<i);
        cout << w << endl;
    }
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    solve(0);
    // cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}

C++: #include<stdio.h>
#include<string.h>
int main()
{
    int i,left,tmp;
    int w[10];
    int first;
    while (scanf("%d", &left) != EOF) {
        memset(w,0,sizeof(w));
        for (i=9;i>=0;i--) {
            tmp = 1<<i;
            if (left>=tmp) {
                w[i]=1;
                left-=tmp;
            }
        }
        first = 1;
        for (i=0;i<10;i++) {
            if (w[i]) {
                if (first) printf("%d", 1<<i);
                else       printf(" %d",1<<i);
                first = 0;
            }
        }
        printf("\n");
    }
    return 0;
}