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: 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;
}

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




int main(){
	int weight[10];
	weight[1] = 1;
	for(int i = 2;i<=9;i++)weight[i]=2*weight[i-1];
	while(true)
	{
	int object;
	cin >> object;
	if (cin.eof())break;
	for(int i =1;i <=9;i++){
		if((object % 2)==1)
			{
			cout << weight[i] ;
			if( i != 9 ) cout << " ";
			}
		object = object /2;
		}
	cout << endl;
	}
	
	return 0;
}

C++: #include <iostream>
#include <string>
#include <math.h>
#include <stdio.h>
#include <ctype.h>

using namespace std;

int main () {
    int weight[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
    int x;
    while(cin>>x){
        for(int i=0; i<1023; i++){
            int bit =i;
            int sum =0;
            for(int j=0; j<10; j++){
                if(bit&1==1){
                    sum+=weight[j];
                }
                bit=bit>>1;
            }
            
            if(sum == x){
                int flag = 0;
                for(int j=0; j<10; j++){
                    if(i&1==1&&flag==0){
                        cout<<weight[j];
                        flag++;
                    }else if(i&1==1){
                        cout<<" "<<weight[j];
                    }
                    i=i>>1;
                }
                cout<<endl;
                break;
            }
            
            
            
        }
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
int main() {
  bool f = 0;
  int n, i;
  while (cin >> n) {
    f = 0;
    for (i = 0; i < 10; i++) {
      if (f) {
        cout << ' ';
        f = 0;
      }
      if (n & 1 << i) {
        cout << (1 << i);
        f = 1;
      }
    }
    cout << endl;
  }
  return 0;
}