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 <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;
}

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

#define rep(x,to) for(int x=0;x<to;x++)
#define rep2(x,from,to) for(x=from;x<to;x++)

using namespace std;


int main(void){

int sg;
int bn[] = {1,2,4,8,16,32,64,128,256,512};
bool ck[10] ={false};
	while(cin >>  sg){
		rep(i,10){
			if(sg >= bn[9-i]){
				sg -= bn[9-i];
				ck[9-i] = true;
			}
		}
		int cnt=0;
		bool dsw=false;
		rep(i,10)
			if(ck[i]){
				cout << (dsw ? " ":"") << bn[i] ;
				dsw=true;
			}
		cout << endl;
	}
	return 0;
}

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

int main() {
  int x10=0;
  int x2=0;

  while(cin >> x10) {
    for(int i=0;i<10;i++) {
      x2 = x10 % (int)(pow(2,i+1));
      if(x2 != 0){
        if(i == 9) {
          cout << (int)pow(2,i);
          break;
        }
        cout << (int)pow(2,i) << " ";
        x10 -= x2;
      }
    }
    cout << endl;
  }
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <queue>
#include <vector>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
#include <cctype>
#include <cstdlib>
#include <string.h>
#include <utility>
#include <cstdio>
#include <set>
#include <map>
#include <assert.h>
using namespace std;

#define INF (1 << 20)
#define EPS (1e-10)
#define EQ(a,b) (fabs((a)-(b)) < EPS)

#define ll long long
#define LL long long

int main() {
	int w;
	while (cin >> w) {
		int bun = 1;
		if (w % 2) {
			cout << bun;
			w -= bun;
		}
		bun *= 2;
		while (bun != 1024) {
			if (w % (2 * bun)) {
				cout << ' ' << bun;
				w -= bun;
			}
			bun *= 2;
		}
		cout << endl;
	}
	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();
        }
        cout<<endl;
    }
    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();
        }
        cout<<endl;
    }
    return 0;
}

C++: #include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
int main(){
  int n;
  bool w[10];
  bool flg;
  while(cin>>n){
    for(int i=0;i<10;i++)w[i]=false;
    flg=false;
    for(int i=9;i>=0;i--){
      if(n>=(int)pow(2.0,(double)i)){w[i]=true; n-=(int)pow(2.0,(double)i);}
    }
    for(int i=0;i<10;i++){
      if(w[i]){
	if(!flg){flg=true;
cout<<(int)pow(2.0,(double)i);
	}
	else{
	  cout<<' '<<(int)pow(2.0,(double)i);
	}
      }
    }
    cout<<endl;
  }
}