Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

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

	for sc.Scan() {
		var wgt []int
		i, _ := strconv.Atoi(sc.Text())

		if i > 1023 {
			i = 1023
		}

		bin := fmt.Sprintf("%010b", i)

		for i := 9; i >= 0; i-- {
			if bin[i] == '1' {
				wgt = append(wgt, weight[i])
			}
		}

		for i := 0; i < len(wgt); i++ {
			if i == len(wgt)-1 {
				fmt.Printf("%d\n", wgt[i])
			} else {
				fmt.Printf("%d ", wgt[i])
			}

		}
	}

}

C++: /////////////////////////////////////////////////////////
//
//  c/temp.cpp file
//  Last Updated: 2018-10-23 ...Maybe
//
//    I hope you adding this code to the setting file
//    alias g++='g++ -std=c++1y -DDEBUG_LOCAL'
//
/////////////////////////////////////////////////////////

#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back

//#define int long long

#define _overload3(_1,_2,_3,name,...) name
#define _REP(i,n) REAP(i,0,n)
#define REAP(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(...) _overload3(__VA_ARGS__,REAP,_REP,)(__VA_ARGS__)

#define _REPR(i,n) REAPR(i,n,0)
#define REAPR(i,a,b) for(int i=int(a-1);i>=int(b);--i)
#define REPR(...) _overload3(__VA_ARGS__,REAPR,_REPR,)(__VA_ARGS__)

#define ALL(a) a.begin(),a.end()
#define rALL(a) a.rbegin(),a.rend()

#define coutALL(a) {int loop_coutALL=0;for(auto e:a) cout<<(loop_coutALL++?" ":"")<<e; cout<<endl;}

#define coutYN(a) cout<<((a)?"YES":"NO")<<endl;
#define coutYn(a) cout<<((a)?"Yes":"No")<<endl;
#define coutyn(a) cout<<((a)?"yes":"no")<<endl;

#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)

const int INF=1145141919;
//const long long INF=114514191911451419;
const int MOD=(int)1e9+7;
const double EPS=1e-12;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
//const int dx[]={-1,-1,-1,0,1,1,1,0},dy[]={-1,0,1,1,1,0,-1,-1};

using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;

typedef pair<int,int> pii;
typedef pair<int,string> pis;
typedef pair<string,int> psi;
typedef pair<string,string> pss;

typedef long long ll;

template<typename T> istream &operator >> (istream &is, vector<T> &v){for(T &x:v) is>>x;return is;}
template<typename T> ostream &operator << (ostream &os, vector<T> &v){int i=0;for(T &x:v) os<<(i++?" ":"")<<x;return os;}

ll rev(ll n){ll x=0;for(;n>0;){x=x*10+n%10;n/=10;}return x;}

ll upper(ll n,ll m){return (n+m-1)/m;};
ll rounding(ll n){return (long double)n+0.5;};

bool inG(ll x,ll n){return 0<=x && 0<n;}
bool outG(ll x,ll n){return x<0 || n<=x;}

inline int qp(int a,ll b){if(!b)return 1;int ans=1;do{if(b&1)ans=1ll*ans*a;a=1ll*a*a;}while(b>>=1);return ans;}
inline int qp(int a,ll b,int mo){if(!b)return 1;int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

inline ll fac(ll k,ll n){ll a=1;for(int i=0;i<n;i++)a*=k--;return a;}
inline ll fac(ll k,ll n,int mo){ll a=1;for(int i=0;i<n;i++)a*=k--,a%=mo;return a;}

inline int dsum(ll n){int a=0;for(;n;n/=10)a+=n%10;return a;}

struct Arithmetic{Arithmetic(){cin.tie(0);ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);}};

//#define DEBUG_LOCAL

#ifdef DEBUG_LOCAL
template<typename T> void deb(T a){cerr<<"deb: "<<a<<"です"<<endl;}
#define debl {cerr<<"debug: "<<__LINE__<<"行目だ"<<endl;}
void what_cr(){cout<<__GCC_ATOMIC_CHAR16_T_LOCK_FREE<<" ←？"<<endl;}
//ori_func S

//ori_func E
#else
template<typename T>void deb(T a){}
#define debl
void what_cr(){}void t_t(){}
#endif

signed main(){

  Arithmetic Exception;

  for(int n;cin>>n;){

    vi ans;

    REP(i,15) if(n&(1<<i)) ans.pb(1<<i);

    cout<<ans<<endl;

  }

  return 0;

}

C++: #include<iostream>
using namespace std;
int main(void)
{
while(true)
{
int a[10]={1,2,4,8,16,32,64,128,256,512};
int b[10]={0};
int x;
cin>>x;
int j=0;
for(int i=9;i>=0;i--)
{
	if(x>=a[i])
	{
	x-=a[i];
	b[j]=a[i];
	j++;
	if(x==0)break;
	}
}
for(int i=9;i>=0;i--)
{
if(b[i]==0)continue;
else if(b[i]!=0)cout<<b[i]<<(i==0?"\n":" ");
}
}
return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <sstream>
#include <istream>
#include <cmath>
#include <cstdio>

using namespace std;

#define vci vector<int>
#define vcs vector<string>
#define pb push_back
#define sz size()
#define mapii map<int, int>
#define mapci map<char, int>
#define mapsi map<string, int>
#define all(x) x.begin(), x.end()
#define minit(a, i) memset(a, i, sizeof(a));

#define for_(i, a, b) for (int i=(int)a; i<(int)b; i++)
#define for_d(i, a, b) for (int i=(int)a-1; i>=b; i--)
#define for_r(i, a, b, c) for (int i=(int)a; i<(int)b; i += c)
#define for_dr(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

typedef long long ll;

const int iINF = 2147483647;
const ll lINF = 9223372036854775807;

template <class T> inline void dbg(T t) { cout << t << endl; }





int main() {
	int in;
	while (cin >> in) {
		bitset<10> b(in);
		for_(i, 0, 9) if (b[i]) cout << pow(2, i) << " ";
		if (b[9]) cout << pow(2, 9);
		cout << endl;
	}
	
	return 0;
}

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

int main() {
	
	int w,n,f;
	
	while(cin>>w){
		n=1;
		f=0;
		
		for(;n<=512;n<<=1){
			if(w&n){
				cout<<(f?" ":"")<<n;
				f=1;
			}
		}
		cout<<endl;
		
	}
	return 0;
}

C++: #include<stdio.h>
int ex(int n)
{
    if(n == 0)return 1;
    return ex(n - 1) * 2;
}
int main()
{
    int n;
    while(scanf("%d",&n) != -1)
    {
        int mem[10] = {0};
        for(int i = 9; i >= 0; i--)
        {
            if(n >= ex(i))mem[i] = 1,n -= ex(i);
        }
        for(int i = 0; i < 10; i++)
        {
            if(mem[i] == 1)printf("%d ",ex(i));
        }
        printf("\n");
    }
    return 0;
}

C++: //AOJ 0031

#include<stdio.h>
#include<iostream>
#include<vector>

using namespace std;

int main(){

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

	int num;

	while(cin>>num){
		int tmp=0;
		for(int j=0;j<10;j++){

			if(num%2==1){
				if(tmp==0){
					printf("%d",data[j]);
					tmp++;
				}
				else{
					printf(" %d",data[j]);
				}
			}
			num/=2;
		}
		printf("\n");

	}
	return 0;
}

C++: #include <iostream>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <vector>

using namespace std;



int main(){
	vector<int> weight;
	for(int i = 0; i < 10; i++){
		weight.push_back(pow((float)2, i));
	}

	int w;

	while(cin >> w){
		int use[10] = {0};
		for(int i = 9; i >= 0; i--){
			if(w >= weight[i]){
				w -= weight[i];
				use[i] = 1;
			}
		}

		bool f = true;
		for(int i = 0; i < 10; i++){
			if(use[i]){
				if(!f){
					cout << ' ';
				}
				cout << weight[i];
				f = false;
			}
		}
		cout << endl;
	}

	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	int W;
	while(cin>>W){
		bool flag=0;
		for(int i=1;i<=W;i*=2){
			if((W/i)%2==1){
				cout<<(flag?" ":"")<<i;
				flag=1;
			}
		}
		cout<<endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;
int r(int n)
{
    int v=1;
    for(int i=0;i<n;++i)v*=2;
    return v;
}
int main()
{
    int n;
    while(cin>>n)
    {
        bool flag=true,w[10]={false};
        int b=0;
        for(int i=9;i>=0;--i){
            if(n>=r(i)){
                w[i]=true;
                n-=r(i);
                if(flag){
                    b=i;
                    flag=false;
                }
            }
        }
        for(int i=0;i<10;++i){
            if(w[i]){
                cout<<r(i);
                if(i!=b)cout<<" ";
                else cout<<endl;
            }
        }
    }
    return 0;
}