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>
#include <cstdio>

using namespace std;

int main(void)
{
    int a;
    while ( scanf("%d", &a) != EOF) {
        bool fl = false;
        for (int i = 0; i < 10; i++) {
            if ((a&1) == 1) {
                if (fl) {
                    cout << " ";
                } else { 
                    fl = true;
                }
                cout << (1<<i);
            } 
            a >>= 1;
        }
        puts("");
    }
    return 0;
}

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

using namespace std;

int main(void){

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

  int thing;
 b:
  while( cin >> thing ){

    int h[10];
    int j = 0;
    int cnt = 0;

    for( int i = 9 ; i >= 0 ; i-- ){
      thing -= w[i];
      if( thing < 0 ){
	thing += w[i];
      }
      else {
	h[j++] = i;
	cnt++;
      }
      if( thing == 0 ){
	for( int i = cnt - 1 ; i >= 0 ; i-- ){
	  if(i) {
	    cout << w[h[i]] << " ";
	  }
	  else{
	    cout << w[h[i]] << endl;
	    goto b;
	  }
	}
      }
      }
  end:;
  }
  return 0;
}

C++: #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;

int main() {
	int n;
	while (cin >> n) {
		for (int i = 0; n; i++) {
			if (n & 1)cout << pow(2, i) << (n >> 1 ? ' ' : '\n');
			n >>= 1;
		}
	}
	return 0;
}

C++: #include <stdio.h>

int main(void)
{
	int n;
	while (scanf("%d", &n) != EOF){
		int i;
		int flag;

		flag = 0;
		for (i = 0; i < 9; i++){
			if (((n >> i) & 1) != 0){
				if (flag == 0){
					printf("%d", 1 << i);
				}
				else {
					printf(" %d", 2 << i);
				}
				flag = 1;
			}
		}
		puts("");
	}
	return (0);
}

C++: #include <iostream>

using namespace std;

int main(){
  int n;

  int omori[10] = {1,2,4,8,16,32,64,128,256,512};

  while( cin >> n){
  int used[10]={0,0,0,0,0,0,0,0,0,0};
    int i = 0;
    int f = 0;
    while(n){
      if(n >= omori[9-i]) {n -= omori[9-i];used[i] = omori[9-i];f++;}
      i++;
    }

    for(int j=9;j >= 0;j--){
      if(used[j] != 0 && f == 1){ cout << used[j] << endl;}
      if(used[j] != 0 && f != 1){ cout << used[j] << ' ' << flush;f--;}
    }
  }
  return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <algorithm>
#include <map>
#include <string>
#include <cstdio>
#include <cstring>
#include <climits>
#include <vector>
//#include <tuple>
using namespace std;
#define rep(i,n) for(LL i=0;i<n;i++)
#define all(v)	(v).begin(),(v).end()
#define MOD  1000000007
const int INF = INT_MAX;
typedef long long LL;
typedef pair<int, int> pii;
//typedef tuple<int, int> tii;

int main(){
	int w[10] = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 };
	int n;
	while (cin >> n){
		vector<int> v;
		for (int i = 9; i >= 0; i--){
			if (n >= w[i]){
				v.push_back(w[i]);
				n -= w[i];
			}
		}
		sort(all(v));
		rep(i, v.size()-1){
			cout << v[i] <<" ";
		}
		cout << v[v.size() - 1] << endl;
	}
	return 0;
}

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

int main(){
  int w;  
  while(cin >> w){
	int bit = pow(2,9);
	vector<int> a;
	for(int i=0;i<10;i++){
	  if(w/bit) a.push_back(bit);
	  w = w%bit;
	  bit /= 2;
	}
	reverse(a.begin(),a.end());
	for(int i=0;i<a.size();i++){
	  cout << a[i];
	  if(i==a.size()-1) cout << endl;
	  else cout << ' ';
	}
  }
  return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <set>
#include <stack>
#include <queue>
#include <time.h>

using namespace std;
typedef long long ll;
#define pl pair<ll,ll>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); itr++)
#define dbg(x) cout << #x"="<< (x) << endl
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back(a) 
#define in(x) cin >> x;
#define all(x) (x).begin(), (x).end()
#define INF 2147483600
#define fi first
#define se second

int main(){
	int n;
	while(cin>>n){
		bool flg=false;
		rep(i,10){
			if(1&(n>>i)){
				if(flg) cout<<' ';
				cout<<pow(2,i);
				flg=true;
			}
		}
		cout<<endl;
	}
    return 0;
}

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

int main(){
  int w;
  vector<int> v;

  while( !cin.eof() && cin>>w ){

    if( w>0 ){
      v.clear();
      for( int i=512;i>=1;i/=2 ){
	if( w>i ){
	  w-=i;
	v.push_back( i );
	}
      }
      if( w==1 ) v.push_back( 1 );

      for( int i=v.size()-1;i>0;--i )
	cout << v[i]<< " ";
      cout << v[0] << endl;
    }else
      cout << endl;
  }

  return 0;
}

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

int main() {
	short int n;
	while (cin >> n) {
		for(int i=1; n>0; i*=2,n/=2){
			if (n % 2 == 1) {
				cout << i<<" ";
				//if (n > 1)
					//cout << " ";
			}
		}
		cout << endl;
	}
	return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <bitset>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef long long LL;

int Pow(int a, int n) {
	int ans = 1;
	while (n > 0) {
		if (n & 1)ans *= a;
		a *= a;
		n >>= 1;
	}
	return ans;
}

int main() {
	int x;
	while (cin >> x) {
		bitset<10> b = x;
		VI print;
		rep(i, 10) {
			if (b.test(i))print.pb(Pow(2, i));
		}
		rep(i, sz(print)) {
			cout << print[i];
			printf(i == sz(print) - 1 ? "\n" : " ");
		}
	}
}

C++: #include <iostream>

using namespace std;

int main() {
    int scale[10];
    scale[0]=1;
    for(int i=1;i<10;i++){
    scale[i] = scale[i-1];
    }
    while(true){
    int M,i=0;
    cin >> M;
    int count=2;
    while(true){
        if(M==0) break;
        if(M % count!=0){
            M -= scale[i];
        }
        cout << scale[i] << " ";
        i++;
        count *= 2;
    }
    cout << endl;
    }
}

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

int main()
{	
	int w;

	while (cin >> w) {
		int i = 0;
		bool f = 0;
		while ((1 << i) <= w) {
			if ((1 << i) & w) {
				if (f)
					cout << " ";
				else
					f = 1;

				cout << (1 << i);
			}

			i++;
		}

		cout << endl;
	}

	return 0;
}

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

int weight[10] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};

int main(){
	int i = 1, n;
	bool p[10];

	while(scanf("%d", &n) != EOF){
		fill(p, p+10, false);

		for(int i= 9; 0 <= i; i--){
			if(n == 0) break;
			if(weight[i] <= n){
				p[i] = true;
				n -= weight[i];
			}
		}
		for(int i =0; i < 10; i++){
			if(p[i]) cout << weight[i] << ' ';
		}
		cout << endl;
	}
	return 0;
}