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 <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

int main()
{
//	cut here before submit 
//	freopen ("testcase.weight", "r", stdin );

	int w;
	while (scanf ("%d", &w ) != EOF ){
		vector<int> res; res.clear();
		for (int i = 1; i <= 512; i<<=1 ){
			 if (w & i ) res.push_back (i );
		} // end for
		rep (i, res.size() ){
			cout << res[i] << (i != res.size() - 1 ? ' ' : '\n' );
		} // end rep
	} // end while

	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= i/2 ){
	//	cout << "i="<<i<<endl;
	if( w>=i ){
	  w-=i;
	v.push_back( i );
	}
      }

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

  return 0;
}

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

int n;

int main() {
  while (1) {
    if (scanf("%d", &n) != 1) return 0;

    bool first = true;
    for (int i=0; i<10; i++) {
      if (n >> i & 1) {
        if (first) printf("%d", 1 << i);
        else printf(" %d", 1 << i);
        first = false;
      }
    }
    puts("");
  }
}

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<deque>
#include<list>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<map>
#include<queue>
#include<vector>
using namespace std;

//C++11

int main() {
	for (int w; cin >> w;) {
		string s = "";
		for (int i = 9; i >= 0; i--) {
			int a = pow(2, i);
			if (w / a) {
				if (s == "")
					s = to_string(a);
				else
					s = to_string(a) + " " + s;
				w -= a;
			}
		}
		cout << s << endl;
	}

	return 0;
}

C++: #include<iostream>
using namespace std;
main()
{
	int a;
	while(cin>>a)
	{
		int f=0;
		for(int i=1;i<=a;i*=2)if(i&a)cout<<(f++?" ":"")<<i;
		cout<<endl;
	}
}

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;
		}
		
		if(ans[0]==1)
			cout << "1" ;
		
		for(i=1,j=2;i<10;i++,j*=2)
			if(ans[i]==1)
				cout << " " << j ;
				
		cout << endl;
	}
}

C++: #include <iostream>
using namespace std;
int main(){
	int n;
	int weight[10] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
	while(cin >> n){
		int t = 0;
		for(int i = 0; i < 10; i++){
			if(n % 2){
				if(t++) cout << " ";
				cout << weight[i];
			}
			n /= 2;
		}
		cout << endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
  int n;
  int used[10]={0,0,0,0,0,0,0,0,0,0};
  int omori[10] = {1,2,4,8,16,32,64,128,256,512};

  while( cin >> n){
    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 <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
// #define first first
// #define second se
using namespace std;
typedef pair<int, int> P;
typedef vector<int> vi;


signed main(){
    int n;
    while(cin >> n){
        vector<int> ans;
        rep(i, 0, 10){
            int t = 1 << i;
            if(n & t){
                ans. push_back(t);
            }
        }
        rep(i, 0, ans.size()){
            if(i != 0) cout << " ";
            cout << ans[i];
        }
        cout << endl;
    }
}

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

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

int main(){
    int input,count;
    bool is_use[10];

    while(1){

      cin >> input;

      if(cin.eof()){
        break;
      }

      for(int i=0;i<10;i++){
        is_use[i] = false;
      }

      count = 0;

      for(int i=9;i>=0;i--){
        if(input >= weight[i]){
          input -= weight[i];
          is_use[i] = true;
          count++;
          if(input == 0){
            break;
          }
        }
      }

      for(int i=0; i<10; i++){
        if(is_use[i]){
          count--;
          if(count==0){
            cout << weight[i] << endl;
          }
          else{
            cout << weight[i] << " ";
          }
        }
      }


    }


    return 0;
}

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

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

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", 1 << i);
				}
				flag = 1;
			}
		}
		puts("");
	}
	return (0);
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  vector<int> m, ans;
  int n, x=1;
  m.push_back(x);
  for(int i=0; i<9; i++){
    x = x*2;
    m.push_back(x);
  }
  sort(m.begin(), m.end(), greater<int>());

  while(cin >> n){
    ans.clear();
    if(n > 1023) return 0;
    vector<int>::iterator it = m.begin();
    while( it != m.end() ){
      if(n - *it >= 0){
	n = n - *it;
	ans.push_back(*it);
      }
      ++it;
    }
    sort(ans.begin(), ans.end());
    vector<int>::iterator it2 = ans.begin();
    while( it2 != ans.end() ){
      cout << *it2 << " ";
      ++it2;
    }
    cout << endl;
    
  }
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int w,ans[10],wei[10],tot=0;
signed main(void){
		ios::sync_with_stdio(false);
		for(int i=0;i<10;i++)
			wei[i]=1<<i;
		while(cin>>w){
			for(int i=9;i>=0;i--)
				if(w>=wei[i]){
					ans[++tot]=wei[i];
					w-=wei[i];	
				}
			while(tot>1)
				cout<<ans[tot--]<<" ";
			cout<<ans[tot--]<<endl;
		}
}

C++: #include<iostream>
using namespace std;
int main()
{
	int n;
	while(cin>>n)
	{
		bool flag=false;
		for(int cnt = 1; cnt < 1<<10; cnt*=2)
		{
			if(cnt&n)
			{
				if(flag) cout<<" "<<cnt;
				else cout<<cnt;
				flag=true;
			}
		}
		cout<<endl;
	}
  return 0;
}