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++: #include <iostream>
#include <cmath>
using namespace std;

int hoge(int s, int n) {
    int w = pow(2,n);

    if (n == -1)
        return 0;

    if (w == s) {
        cout << w;
        return 1;
    }

    if (w < s && hoge(s-w, n-1)) {
        cout << " " << w;
        return 1;
    }

    if (hoge(s, n-1)) {
        return 1;
    }

    return 0;
}

int main(void) {
    int s;
    while (cin >> s) {
        hoge(s, 9);
        cout << endl;
    }
    return 0;
}

C++: #include<iostream>

using namespace std;

int main()
{
	int weight;
	int i,j;
	int ans[10];
	
	for(;cin >> weight;)
	{
		for(i=0;i<10;i++)
			ans[i]=0;
			
		for(i=0;weight>0;weight/=2,i++)
		{
			ans[i]=weight%2;
		}
		
		for(i=0,j=1;i<10;i++,j*=2)
			if(ans[i]==1)
				cout << j << " " ;
		cout << endl;
	}
}

C++: //0031
//include-------------------------------------
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<stack>

using namespace std;

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

#define MP make_pair

//repetition-----------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)

//constant-------------------------------------
const double PI = acos(-1.0);

//cout,cin-------------------------------------
#define COUT(x) cout<<(x)<<endl;
#define CIN(x) cin>>(x);

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

int main(){

	int w;
	while (1){
		stack <int> st;
		CIN(w)
		for (int i = 10; i >= 0; i--){
			if (w >= weight[i]) {
				st.push(weight[i]);
				w -= weight[i];
			}
		}

		while (st.top()!=0){
			cout << st.top()<<" ";
				st.pop();
		}
		cout << endl;
	}

	return 0;

}

C++: #include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
using namespace std;
int main(){
  vector<int> ar;
  int g[]={1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
  int n;
  while(cin >> n){
    for(int i=9;i>=0;i--){
      if(n>=g[i]){
	n -= g[i];
	ar.push_back( g[i] );
      }
    }
    for(int i=ar.size()-1;i>=0;i--){
      if(i != 0)cout << ar[i] << ' ';
      else cout << ar[i] << endl;
    }
  }
}

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

int main(){
    bool fundo[10] = {false};
    int value[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};

    int weight;

    while(cin >> weight){
        for(int i=0; i<=9; i++){
            if(weight % 2 == 1){
                fundo[i] = true;
            }
            weight /= 2;
        }

        for(int i=0; i<=9; i++){
            if(fundo[i] == true){
                if(i) printf(" ");
                printf("%d", value[i]);
                fundo[i] = false;
            }
        }
        cout << endl;
    }

    return 0;
}

C++: #include <stdio.h>

int main(){
	int i,w,g[10] = {1,2,4,8,16,32,64,128,256,512};
	while(scanf("%d",&w) != EOF){
		if(w % 2 == 1) {
			printf("1 ");
			w--;
		}
		for(i = 1;i < 10;i++){
			if(w % (g[i] * 2) == g[i]) {
				printf("%d ",g[i]);
				w -= g[i];
			}
			if(!w) break;
		}
		printf("\n");
	}
	return 0;
}

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

void dfs(int cw, int remain)
{
  if (!cw || !remain)
    return;

  if (remain >= cw) {
    dfs(cw/2, remain-cw);
    if (remain != cw)
      cout << " ";
    cout << cw;
  } else {
    dfs(cw/2, remain);
  }
}

int main(int argc, char **argv)
{
  int x;

  for (;;) {
    cin >> x;
    if (cin.eof())
      break;
    dfs(512, x);
    cout << endl;
  }
  return 0;
}

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

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

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

int main()
{
	int w;

	while (cin >> w, cin.eof() != true){
		for (int i = 1; i <= 512; i *= 2){
			if (w % (i * 2) != 0){
				cout << i;
				w -= i;
				if (w != 0){
					cout << " ";
				}
			}
			if (w == 0){
				cout << endl;
				break;
			}
		}
	}

	return (0);
}

C++: #include <string>
#include <vector>
#include <algorithm>
#include <iostream>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <map>
#define INF 100000000
#define rep(i,a) for(int i=0;i<(a);i++)

using namespace std;
typedef long long ll;

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

int main(){
    stack<int> ans;
    int n;
    while(cin>>n){
        rep(i,10){
            if(n>=hun[i]){
                n-=hun[i];
                ans.push(hun[i]);
            }
        }
        while(ans.size()){
            cout<<ans.top();
            ans.pop();
            if(ans.empty())cout<<endl;
            else cout<<" ";
        }
    }
    return 0;
}

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

int main(){
	int n;
	while(cin>>n){
		bool fla=false;
		for(int i=0;i<10;i++){
			if(n&(1<<i)){
				if(fla){
					cout<<" ";
				}
				else fla=true;
				cout<<(1<<i);
			}
		}
		cout<<endl;
	}
	return 0;
}

C++: #include<bits//stdc++.h>
using namespace std;
int main(){
  int n;
  while(cin>>n){
    vector<int> v;
    for(int i=10;i>=0;i--){
      if(n>=(1<<i)){
	     n-=(1<<i);
	     v.push_back(1<<i);
      }
    }sort(v.begin(),v.end());
    cout << v[0];
    for(int i=1;i<v.size();i++) cout << " " << v[i];
    cout << endl;
  }
}

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

int output[10],len;

int main(){
	int n;
	
	while( cin >> n )
	{
		len = 0;
		for( int i = 0;i < 10;i++ ){
			if( n&(1<<i) ){
				output[len] = (1<<i);
				len++;
			}
		}
		for( int i = 0;i < len-1;i++ ){
			cout << output[i] << " ";
		}
		cout << output[len-1] << endl;
	}
	return 0;
}

C++: #include<cstdio>

using namespace std;

const int Weit=2;
int weit;
int date;
bool flag;

int main()
{
	while(true)
	{
		flag=true;
		scanf("%d",&date);
		for(int i=0;i<10;i++)
		{
			if(i==0)weit=Weit;
			else weit*=2;
			if(date%weit!=0)
			{
				date-=date%weit;
				if(flag==true) flag=false;
				else printf(" ");
				printf("%d",weit/2);
			}
		}
		printf("\n");
	}
	return 0;
}

C++: #include <iostream>
#include <math.h>
using namespace std;
int main(void)
{
	int n;
	while(cin >> n){
		int count=0;
		bool first = true;
		while(n){
			if(n%2){
				if(first){
					cout << pow(2,count);
					first = false;
				}else cout << " " << pow (2,count);
			}
			count++;
			n/=2;
		}
		cout << endl;
	}
	return 0;
}

C++: #include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;
int n;

void solve() {
    int a=1;
    rep(i,10) {
        if((n>>i)&1) cout<<a<<" ";
        a<<=1;
    }
    cout<<endl;

}
int main() {
    while(cin>>n) {
        solve();
    }
    return 0;
}