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

C++: #include<iostream>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<sstream>
#include<algorithm>
#include<map>
#include<complex>
using namespace std;


#define li			long long int
#define rep(i,to)	for(int i=0;i<((int)(to));i++)
#define repp(i,start,to)	for(int i=(int)(start);i<((int)(to));i++)
#define pb			push_back
#define sz(v)		((li)(v).size())
#define bgn(v)		((v).begin())
#define eend(v)		((v).end())
#define allof(v)	(v).begin(), (v).end()
#define dodp(v,n)		memset(v,(li)n,sizeof(v))
#define bit(n)		(1ll<<(li)(n))
#define mp(a,b)		make_pair(a,b)
#define rin	rep(i,n)
#define EPS 1e-10
#define ETOL 1e-8
#define MOD 1000000007
#define p2(a,b)		cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)		cout<<a<<"\t"<<b<<"\t"<<c<<endl


int main(){
	
	li a;
	while(cin>>a){
		bool omori[10]={false};
		li div=512;
		li now=9;
		while(a>0){
			//p2(a,div);
			if(a>=div){
				a-=div;
				omori[now]++;
			}
			div/=2;
			now--;
		}
		li w=1;
		rep(i,10){
			if(omori[i])cout<<w<<" ";
			w*=2;
		}
		puts("");
	}
	
	
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){

	int n;
	while(cin>>n){
		int mul=1;
		vector<int> v;
		while(n!=0){
			if(n%2==1){
				v.push_back(mul);
			}
			mul*=2;
			n/=2;
		}
		for(int i = 0; i < v.size(); i++){
			cout<<v[i];
			if(i!=v.size()-1)
				cout<<" ";
			else
				cout<<endl;
		}
	}

	return 0;
}

C++: #include <iostream>
#include <cstdlib>

#define TRUE 1
#define FALSE 0

int use_num[10];

int get_input(void) {
    int i;
    std::cin >> i;
    if (std::cin.fail()) 
        exit(0);
    return i;
}

int power(int m, int n) {
    int acc = 1;
    for (int i = 0; i < n; i++) {
        acc *= m;
    }
    return acc;
}    

void solve(int weight) {
    for (int i = 9; i >= 0; i--) {
        if (power(2, i) > weight) {
            use_num[i] = FALSE;
        } else {
            use_num[i] = TRUE;
            weight -= power(2, i);
        }
    }
}

void output(void) {
    // find last TRUE elem
    int last;
    for (int i = 0; i <= 9; i++) {
        if (use_num[i] == TRUE) {
            last = i;
        }
    }

    for (int i = 0; i < last; i++) {
        if (use_num[i] != FALSE) {
            std::cout << power(2, i) << ' ';
        }
    }
    if (use_num[last] != FALSE) {
        std::cout << power(2, last);
    }
    std::cout << std::endl;
}

int main(void) {
    int weight;
    while (weight = get_input()) {
        solve(weight);
        output();
    }
    return 0;
}

C++: #include <iostream>

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

    int w;

    while (std::cin >> w) {
        for (int i = 0; i < 9; ++i) {
            int num = 1 << i;
            if (w & num) {
                w -= num;
                std::cout << num;

                if (w) {
                    std::cout << " ";
                }
            }
        }
        std::cout << std::endl;
    }

    return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
  int w[10]={1,2,4,8,16,32,64,128,256,512};
  int n;
  while(cin>>n){
    for(int i=0;;i++){
      if (n%2) cout<<w[i];
      n/=2;
      if(!n)break;
      cout<<" ";
    }
    cout<<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <vector>

using namespace std;

int main(int argc, char *argv[]) {
  int weight;
  int item[10] = {1, 2, 4, 8, 16, 32,
                  64, 128, 256, 512};
  vector< vector<int> > result;
  while (cin >> weight) {
    vector<int> r;
    for (int i = 10; i > 0; i--)
      if (weight >= item[i-1]) {
        r.push_back(item[i-1]);
        weight -= item[i-1];
      }
    result.push_back(r);
  }

  for (int i = 0; i < result.size(); i++) {
    vector<int> r = result[i];
    for (int j = r.size(); j > 0; j--) {
      if (j != r.size())
        cout << ' ';
      cout << r[j-1];
    }
    cout << endl;
  }
  return 0;
}

C++: //Weight

#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;

bool g[65];

//?????????????????£??°??????????????°?????°??????
int count_bits(unsigned x){
    int count = 0;
    while(x){
        if(x & 1U) count++;
        x >>= 1;
    }
    return count;
}

//unsinged??????bit??°?????????
int int_bit(void){
    return count_bits(~0U);
}
//??£??°?????????????????§?????????????????????????????¨??????????°??????????????????????????´?????????????
void createArray(unsigned x){
    int n = int_bit();
    for(int i = 0; i < n; i++){
        if((x >> i) & 1U) g[i] = true; 
    }
}

int main(void){

    int i = 9;
    unsigned int x;
    int dp[10][10]; // i?????????????????????????????????weight
    //Dp??§???
    
    while((scanf("%d", &x)) != EOF){
       for(int i = 0; i < 65; i++) g[i] = false;
       createArray(x);
       
       //flag????????£???????????????????°???????????????¨???????????????
       for(int i = 0, j = 0; i < 10; i++) {
           if(g[i]) {
               if(j) printf(" ");
               printf("%d", (int)pow(2.0, (double)i));
               j++;
           }
       }
       putchar('\n');
       
    }
    
    return 0;
}

C++: #include <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;

int main() {
	int N, S;
	vector<int> v(10, 1);
	for (int i = 0; i < 10; i++) {
		int& p = v.at(i);
		for (int j = 0; j < i; j++) {
			p *= 2;
		}
		//cout << p << endl;
	}
	
	int n;
	while (cin >> n) {
		bitset<10> bs(n);
		int c = bs.count();

		for (int i = 0; i < 10; i++) {
			if (bs.test(i)) {
				cout << v.at(i);
				c--;

				if (!c) {
					cout << endl;
					break;
				}
				else {
					cout << ' ';
				}
			}
		}
	}
}

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

int main()
{
	int w[10] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
	int g;
	bool flag[10];
	bool fl;
	
	while (cin >> g){
		for (int i = 0; i < 10; i++){
			flag[i] = false;
		}
		
		for (int i = 9; i >= 0; i--){
			if (g >= w[i]){
				flag[i] = true;
				g -= w[i];
			}
		}
		
		fl = false;
		for (int i = 0; i < 10; i++){
			if (flag[i] == true){
				if (fl == true){
					cout << " ";
				}
				cout << w[i];
				if (fl == false){
					fl = true;
				}
			}
		}
		cout << endl;
	}
	
	return (0);
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int weights[] = {1,2,4,8,16,32,64,128,256,512,1024};
int main(){
	int n,a[10],b,c;
	while(cin >> n){
		b = 0;
		c = 11;
		while(n != 0){
			for(int i = 0;i < c;++i){
				if(n < weights[i]){
					n -= weights[i - 1];
					a[b] = i - 1;
					c = i;
					++b;
					break;
				}
			}
		}
		sort(a,a+b);
		for(int i = 0;i < b;++i){
			if(i == 0) cout << weights[a[i]];
			else cout << " " << weights[a[i]];
		}
		cout << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <bitset>

using namespace std;


int main(int argc, char const* argv[])
{
	unsigned long weight;
	while( cin >> weight ){
		bitset<16> a( weight );
		for( int i = 0;i < 10;i++ ){
			if( a[i] == 1 ) cout << ( ( i == 0 ) ? "" : " " ) << ( 1 << i );
		}
		cout << endl;
	}
	return 0;
}