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 <iostream>
#include <cstdio>
#include <string>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <ctime>
using namespace std;

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 999999999

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long int ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int const MOD = 1000000007;

int main() {
    int n;
    while(cin >> n) {
        vector<int> v;
        while(n != 0) {
            v.pb(n % 2);
            n /= 2;
        }
        //reverse(v.begin(), v.end());
        rep(i,0,v.size()) (v[i] * pow(2,i) == 0) ? : cout << v[i] * pow(2,i) << " ";
        cout << endl;
    }

    return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
    int M,scale[10];
    scale[0]=1;
    for(int i=1;i<10;i++){
    scale[i] = scale[i-1]*2;
    }
    while(cin >> M){
    int i=0;
    int count=2;
    while(true){
        if(M==0) break;
        if(M % count!=0){
            M -= scale[i];
            cout << scale[i] << " ";
        }
        i++;
        count *= 2;
    }
    cout << endl;
    }
}

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

int main() {
  int w = 0;
  while (cin >> w, w) {
    for(int i = 0; i < 32; i++) {
      if(w & (1<<i)) {
        cout << (1 << i) << " ";
      }
    }
    w = 0;
    cout << endl;
  }
}

C++: #include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;

int main(void){
	int n;
	while(cin >> n){
		for (int i=0; i<10; i++){
			if (n%2==1){
				cout << (int)pow(2.0,i);
				n = (n-1)/2;
				
			if (n==0){
				cout << endl;
				break;
			}else{
				cout << " ";
			}
			}else{
				n = n/2;
			}
		}
	}



	return 0;
}

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

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

signed main() {
	int w;
	while (cin >> w) {
		int i(1),cnt(0);
		while (w) {
			if (w & 1) {
				if (cnt++)cout << " ";
				cout << i;
			}
			i *= 2;
			w >>= 1;
		}
		cout << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;
int main(){
    int bunndo[10]={1,2,4,8,16,32,64,128,256,512},n,cnt=0;
    while(cin>>n){
        bool num[10]={0};
        for(int i=9;i>=0;i--){
            if(n-bunndo[i]>=0){
                n=n-bunndo[i];
                num[i]=1;
                if(n==0)break;
            }
        }
        for(int i=0;i<10;i++){
            if(num[i]==1){
                if(cnt==0){
                    cnt=1;
                    cout<<bunndo[i];
                }else{
                    cout<<" "<<bunndo[i];
                }
            }
        }
        cnt=0;
        cout<<endl;
    }
    return 0;
}

C++: #include<iostream>
using namespace std;
int main(void)
{
int x;
while(cin>>x)
{
int a[10]={1,2,4,8,16,32,64,128,256,512};
int b[10]={0};

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 "bits/stdc++.h"
using namespace std;

int main(){
	int n;
	int a[]={1,2,4,8,16,32,64,128,256,512};
	while(cin>>n){
		vector<int> x;
		for(int i=0;i<10;i++){
			if(n/a[10-i-1]==1){
				//cout<<a[10-1-i]<<endl;
				n-=a[10-i-1];
				x.push_back(a[10-i-1]);
				if(n==0)break;
			}
		}
		
		for(int i=0;i<x.size()-1;i++){
			cout<<x[i]<<" ";
		}
		cout<<x[x.size()-1]<<endl;
	}
	return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#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++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

int main()
{
	int n;
	while(cin >> n)
	{
		bitset<10> o = n;

		rep(i, 10)
			if(o[i])
				cout << pow(2.0, i) << (pow(2.0, i+1) < n ? " " : "");

		cout << endl;
	}
}

C++: #include <iostream>

using namespace std;

int main() {
    int M,scale[10];
    scale[0]=1;
    for(int i=1;i<10;i++){
    scale[i] = scale[i-1]*2;
    }
    while(cin >> M){
    int i=0;
    int count=2;
    while(true){
        if(M==0) break;
        if(M % count!=0){
            M -= scale[i];
            if(M != 0){
            cout << scale[i] << " ";
            }
            else{
            cout << scale[i] <<endl;
            }
        }
        i++;
        count *= 2;
    }
    }
}

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

int main() {
  int d,a;

  while(cin>>d){
    a=1;
    for(;a<=d;a=a<<1) {
      if(a&d) cout<<a;
      if(d/a>2) cout<<" ";
    }
    cout<<endl;

    /*
    a=1;
    for(;d>0;) {
      if(d%2==1) {
	cout<<a;
	d--;
	if(d>0) cout<<" ";
      }
      d/=2;
      a*=2;
    }
    cout<<endl;
    */
  }

}

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

using namespace std;

int main()
{
	vector<int> bd;
	int n, cont;
	int weight[10] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};

	while(1){
		bd.clear();
		cont = 0;
		cin >> n;

		if(cin.eof())    break;

		while(n != 0){
			bd.push_back(n % 2);	
			n /= 2;
			cont++;
		}

		for(int i = 0; i < cont; i++){
			if(bd[i] == 1){
				cout << weight[i];
				if(i+1 != cont)
					cout << " ";
			}
		}

		cout << endl;
	}

	return 0;
}

C++: #include<iostream>
#include<cmath>
#include<string>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

string ans;

void func(int cnt,int w,string s){
 	if(cnt>=10){
 		if(w==0){
 			ans=s;
 		}
 	}else{
 		func(cnt+1,w,s);
 		s+=cnt+'0';
 		func(cnt+1,w-pow(2,cnt),s);
 	}
 }

int main(){
	int n;
	string s;
	while(cin>>n){
		s="";
		func(0,n,s);
		rep(i,ans.size()){
			cout<<pow(2,(int)(ans[i]-'0'));
			if(i==(ans.size()-1)){
				cout<<endl;
			}else{
				cout<<" ";
			}
		}
	}
	return 0;
}