Go: package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		num, _ := strconv.Atoi(scanner.Text())
		first := true
		beki := 1
		for num != 0 {
			if num % 2 == 1 {
				if !first {
					fmt.Print(" ")
				}
				fmt.Print(beki)
				first = false
			}
			num /= 2
			beki *= 2
		}
		fmt.Println()
	}
}

C++: //-------------
//include
//-------------
#include <map>
#include <list>
#include <cmath>
#include <vector>
#include <string>
#include <cctype>
#include <cstdlib>
#include <iostream>
#include <algorithm>
using namespace std;
//-------------
//typedef
//-------------
typedef  long long LL;
typedef  vector<int> VI;
typedef  string STR;
typedef  pair<int, int> PII;
typedef  vector<int, int> VII;
typedef  map<string, int> MSI;
//-------------
//utillty
//-------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MK make_pair
#define PB push_back
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define COUT(a) cout<<a<<endl
//-------------
//repetition
//-------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//-------------
//debug
//-------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumpl(c) REP(i,SZ(c))cerr<<#c<<i<<"="<<(c[i])<<endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const int MOD = 1000000007;
int main()
{
	int wheit[10] = { 512, 256, 128, 64, 32, 16, 8, 4, 2, 1 };
	int a;
	while (cin >> a)
	{
		VI ANS;
		REP(i, 10)
		{
			if (a >= wheit[i])
			{
				a -= wheit[i];
				ANS.push_back(wheit[i]);
			}
		}
		REP(i, SZ(ANS))
		{
			if (i != SZ(ANS) - 1 || i == 0)
			{
				cout << ANS[SZ(ANS) - i];
			}
			else
			{
				cout << " ";
				cout << ANS[SZ(ANS) - i];
			}
		}
		cout << endl;
	}
#ifdef _DEBUG
	while (1);
#endif // _DEBUG

	return 0;
}

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

int main(){
	int n;
	while(cin >> n){
		int tmp = 0;
		vector<int> ans;
		for(int i = 9; i >= 0; i--){
			if(n - pow(2, i) >= 0){
				ans.push_back(pow(2, i));
				n -= pow(2, i);
			}
		}
		sort(ans.begin(), ans.end());
		for(int i = 0; i < ans.size() - 1; i++){
			cout << ans[i] << " ";
			tmp = i + 1;
		}
		cout << ans[tmp] << endl;
	}
}

C++: #include <iostream>
using namespace std;
int main(){
  int n;
  while(cin >> n){
	int flag = 1;
	for(int i = 0;i < 10;i++){	  
	  if((n & (1<<i)) && flag){
		flag = 0;
		cout << (1<<i);
	  }else if((n & (1<<i)) && !flag){
		cout << " " << (1<<i);
	  }


	}
	cout << endl;
  }
  return 0;
}

C++: #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<bool, int> P;

int a[10];
int v[1025][10];
int used[10];

void comv(int i, int s)
{
    if (i == 10)
    {
        rep(j, 10) v[s][j] = used[j];
        return;
    }

    used[i] = 0;
    comv(i + 1, s);
    used[i] = 1;
    comv(i + 1, s + a[i]);
}

int main()
{
    rep(i, 10)
        a[i] = pow(2, 9 - i);

    comv(0, 0);
    int n;
    while (cin >> n)
    {
        int t;
        for (int i = 9; i >= 0; i--)
            if (v[n][i] == 1)
                t = i;
        for (int i = 9; i >= 0; i--)
        {
            if (v[n][i] == 1)
                t != i ? cout << a[i] << " " : OP(a[i]);
        }
    }
    return 0;
}

C++: 
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <utility>
#include <complex>
#include <stack>
#include <climits>
#include <set>

using namespace std;

double sq(double x){return x*x;}

int main(){
	int n;
	while(cin>>n){
		vector<int> ans;
		for (int i = 0; i < 10; i++)
		{
			if(n & (1 << i)) ans.push_back(1<<i);
		}
		for (int i = 0; i < (int)ans.size(); i++)
		{
			printf("%d%c",ans[i],(i == (int)ans.size()-1) ? '\n' : ' ');
		}
	}


	return 0;
}

C++: #include <bits/stdc++.h>
#include <math.h>

using namespace std;

int main() {

    int i;
    int weight;

    while(cin >> weight) {
        i = 0;
        do {
            if(weight & 1) {
                cout << pow((double)2, (double)i);
                if(weight != 1) {
                    cout << ' ';
                }
            }
            i++;
        } while(weight >>= 1);
        cout << endl;
    }

}

C++: #include<iostream>
using namespace std;
int weights[10] = { 1,2,4,8,16,32,64,128,256,512 };
bool have[10] = { false,false,false,false,false,false,false,false,false,false };
int main() {
	int w;
	while (cin >> w) {
		int now = 0;
		int tmp = 0;
		for (int i = 0; i < 10; i++)have[i] = false;
		while (tmp < w) {
			tmp += weights[now];
			have[now] = true;
			now++;
		}
		while (tmp != w) {

			if (have[now]) {
				if (tmp - weights[now] >= w) {
					tmp -= weights[now];
					have[now] = false;
					now--;
				}
				else now--;
			}
			else {
				now--;
			}
		}
		int last;
		for (int i = 0; i < 10; i++)if (have[i])last = i;
		for (int i = 0; i < 10; i++) {
			if (have[i]) {
				if (i!=last)cout << weights[i] << ' ';
				else cout << weights[i];
			}
		}
		cout << endl;
	}
}

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

int main(){
  int n;
  while(cin >> n){
    int a = 1;
    bool first = true;
    while(true){
      if(n % 2  == 1){
	if(first) first = false;
	else cout << " ";
	cout << a;
      }
      a *= 2;
      n /= 2;
      if(n == 0) break;
    }
    cout << endl;
  }

  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n,wei[10],ka=1,temp,ba[10];
  for(int i=0;i<10;i++){
    wei[i]=ka;
    ka*=2;
  }
   while(cin>>n){
    for(int i=0;i<10;i++){
      ba[i]=0;
    }
    for(int i=9;i>=0;i--){
      if(n!=0){
	if(n-wei[i]>=0){
	  n-=wei[i];
	  ba[i]=wei[i];
	}
      }if(n==0){
	break;
      }
    }
    for(int i=0;i<10;i++){
      if(ba[i]!=0){
	cout<<ba[i]<<" ";
      }
    }
    cout<<endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;

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

C++: #include<iostream>
using namespace std;
int main()
{
int a;
int i[10][3];
i[0][2]=1;
i[1][2]=2;
i[2][2]=4;
i[3][2]=8;
i[4][2]=16;
i[5][2]=32;
i[6][2]=64;
i[7][2]=128;
i[8][2]=256;
i[9][2]=512;
while(cin>>a)
{
	for(int h=0;h<10;h++)
	{
		i[h][0]=0;
		i[h][1]=0;
	}
	for(i[0][0]=0;i[0][0]<=1;i[0][0]++)
	{
	for(i[1][0]=0;i[1][0]<=2;i[1][0]+=2)
	{
	for(i[2][0]=0;i[2][0]<=4;i[2][0]+=4)
	{
	for(i[3][0]=0;i[3][0]<=8;i[3][0]+=8)
	{
	for(i[4][0]=0;i[4][0]<=16;i[4][0]+=16)
	{
	for(i[5][0]=0;i[5][0]<=32;i[5][0]+=32)
	{
	for(i[6][0]=0;i[6][0]<=64;i[6][0]+=64)
	{
	for(i[7][0]=0;i[7][0]<=128;i[7][0]+=128)
	{
	for(i[8][0]=0;i[8][0]<=256;i[8][0]+=256)
	{
	for(i[9][0]=0;i[9][0]<=512;i[9][0]+=512)
	{
	if(i[0][0]+i[1][0]+i[2][0]+i[3][0]+i[4][0]+i[5][0]+i[6][0]+i[7][0]+i[8][0]+i[9][0]==a)
	{
	for(int j=0;j<10;j++)
	{
	if(i[j][0]!=0)
	{
	i[j][1]++;
	}
	}
	}
	}
	}
	}
	}
	}
	}
	}
	}
	}
	}
	int l=0;
	for(int k=0;k<10;k++)
	{
	if(l==0&&i[k][1]>0)
	{
	cout<<i[k][2];
	l++;
	}
	else if(i[k][1]>0)
	{
	cout<<" "<<i[k][2];
	}
	}
	cout<<endl;
}
return 0;
}