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

C++: #include <iostream>
using namespace std;
int main(){
  int n;
  while(cin >> n){

    int ans[1000];
    int p = 0;

    int m = n;
    for(int i = 2 ; i < m ; i*=2){
      if(i*2 > m)m = i;
    }

    for(int i = m ;i > 0; i/=2 ){
      if(n - i >= 0 ){
	ans[p++] = i;
	n -= i;
      }
    }
  for(int i = p - 1 ; i > 0 ; i-- ){
    cout << ans[i] << " ";
  }
  cout <<ans[0]<< endl;

  }
  }

C++: #include<iostream>
#include<string>
#include<cmath>
#include<bitset>
int main(){
    int t; std::cin>>t;
    std::bitset<11> value(t);
    std::string s=value.to_string();
    for(int i=0;i<s.size();i++){if(s[0]=='0') s.erase(s.begin()); else break;}
    int num=std::stoi(s);
    for(int i=0;i<s.size();i++){if(num%10)std::cout<<pow(2,(double)(i))<<" "; num/=10;}
    std::cout<<std::endl;
}

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

// ?????¬???????????¬??????
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// ???
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long double> vld;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T> int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F> int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T> void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C> void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U> void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U> void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C> void reverse(C& c) { reverse(ALL(c)); }
template<typename C> void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred> void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// ?????°
#pragma region CONST_VAL
constexpr int PI = (2*acos(0.0));
constexpr int EPS = (1e-9);
constexpr int MOD = (int)(1e9+7);
constexpr int INF = 100000000;
#pragma endregion


int main()
{
    int data[10];
    data[0] = 1;
    REP(i,1,10) data[i] = data[i-1] * 2;
    while(true) {
        int n;
        cin >>n;
        if(n==EOF) break;

        bool check[10];
        rep(i, 10) check[i] = false;
        for(int i=9; i>=0; --i) {
            if(n>=data[i]) {
                n -= data[i];
                check[i] = true;
            }
        }

        bool check2 = false;
        rep(i, 10) {
            if(check[i]) {
                if(check2) cout << " ";
                else check2 = true;
                cout << data[i];
            }
        }
        cout << endl;
    }
    return 0;
}

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

int main(){
    int n;
    int i;
    int j;
    while(cin >> n){
        i = 1;
        for(j=0;j<10;j++){
            if(n & 1){
                cout << i;
                i <<= 1;
                n >>= 1;
                break;
            }
            i <<= 1;
            n >>= 1;
        }
        for(j=j;j<10;j++){
            if(n & 1){
                cout << " ";
                cout << i;
            }
            i <<= 1;
            n >>= 1;
        }
        cout << endl;
    }
    return 0;
}

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

using namespace std;

int main(){
  int n;
  while(cin >> n){
    if(cin.eof())break;
    vector<int> ar;
    int flg = 0;   
    for(int i = 512 ; i>=1; i/=2){

      if(n >= i&&flg == 0){
	cout << i;
	flg = 1;
	n-=i; 
	continue;
      }
      if(n >= i&&flg == 1){
	cout <<" "<< i;
	n-=i; 
      }
    }
    cout << endl;
  }
  return 0;
}

C++: // #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cmath>
#include <set>
using namespace std;

int main(){
	int n;
	set<int> ansset;
	while (cin >> n, !cin.eof()){
		ansset.clear();
		for (int i = 9; i >= 0; i--){
			int hundou = pow(2, i);
			if (n >= hundou){
				ansset.insert(hundou);
				n -= hundou;
			}
		}
		// output
		set<int>::iterator it = ansset.begin();
		while (it != ansset.end()){
			cout << *it;
			++it;
			if (it != ansset.end())	
				cout << " ";
		}
		cout << endl;
	}
	return 0;
}

C++:  
 #include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 
 using namespace std;
 
 int arr[10]={1,2,4,8,16,32,64,128,256,512}; 
  
 int main()
 {
   int N;
   while(cin>>N)
   {
     int count=0;
     int num[10]={0};
     while(N)
     {
       num[count++]=N%2;
       N/=2;        
     }      
     for(int i=0;i<count-1;i++)
     {
       if(num[i]) cout<<arr[num[i]]<<" ";
     }
     if(num[count-1]) cout<<arr[num[count-1]]<<endl;
     else cout<<endl;           
   }
   //while(1);     
   return 0;  
 }

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

int main(){
	int n,f[10],flag;
	while (cin >> n){
		flag = 0;
		for (int i = 0; i < 10; i++) f[i] = 0;
		for (int i = 0; n; i++){
			f[i] = n % 2;
			n /= 2;
		}
		for (int i = 0; i < 10; i++){
			if (f[i]) {
				if(!flag){
					cout << (int)pow(2.0, i);
					flag = 1;
				}
				else cout << " " << (int)pow(2.0, i);
			}
		}
		cout << endl;
	}
}

C++: #include <iostream>
using namespace std;
int main() {
  int a, i;
  while(cin>>a) {
    for(i=0;i<=9;i++) {
      if(a&1<<i){
        cout<<(1<<i);
        if(a<2<<i)break;
        cout<<' ';
      }
    }
    cout<<endl;
  }
}

C++: #include<iostream>

using namespace std;

int bekijou(int);

int main(){

  int in,data[10];

  while(cin >> in){

    for(int i = 0; i < 10; i++) data[i] = 0;

    for(int i = 0;i < 10; i++){
      data[i] = in % 2;
      in /= 2;
    }
    int out = 0;

    for(int i = 0; i < 10; i++){
      if(data[i] == 1 && out == 0){
	cout << bekijou(i);
	out++;
      }else if(data[i] == 1){
	cout << " " << bekijou(i);
      }
    }
    cout << endl;
  }
  return 0;
}
  
int bekijou(int n){
  int ret = 1;

  for(int i = 0; i < n; i++){
    ret *= 2;
  }

  return ret;
}