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 <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a*b/gcd(a,b);}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



int a;

signed main() {
	while (scanf("%d",&a)!=EOF) {
		vector<int> r;
		rep(i,30) if (a>>i&1) r.push_back(1<<i);
		rep(i,r.size()) cout << r[i] << bln(i,r.size());
	}
}

C++: # include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
using namespace std;
using LL = long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = 1000000000;
const double PI = acos(-1);

int main() {
	int n;
	while (cin >> n) {
		bool a[1100] = {};
		int maxl = 0;
		for (int i = 512; i >= 1; i /= 2) {
			if (n >= i) {
				n -= i;
				a[i] = true;
				maxl = max(maxl, i);
			}
		}
		for (int i = 1; i <= 512; i *= 2) {
			if (a[i]) {
				if (i == maxl) {
					cout << i << endl;
				}
				else {
					cout << i << " ";
				}
			}
		}
	}
}

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

int main(){
int n;
while(cin>>n)
{
	if(n%2==1){
		cout<<"1 ";
		n-=1;
		}
		
	if(n%4==2){
		cout<<"2 ";
		n-=2;
		}	
		
	if(n%8==4){
		cout<<"4 ";
		n-=4;
		}	
		
	if(n%16==8){
		cout<<"8 ";
		n-=8;
		}	
		
	if(n%32==16){
		cout<<"16 ";
		n-=16;
		}	
		
	if(n%64==32){
		cout<<"32 ";
		n-=32;
		}	
		
	if(n%128==64){
		cout<<"64 ";
		n-=64;
		}	
		
	if(n%256==128){
		cout<<"128 ";
		n-=128;
		}	
		
	if(n%512==256){
		cout<<"256 ";
		n-=256;
		}	
		
	if(n%1024==512){
		cout<<"512 ";
		n-=512;
		}	
		cout<<"\b"<<endl;
	}
	return 0;
		}

C++: #include<iostream>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<sstream>
#include<algorithm>
#include<map>
#include<complex>
using namespace std;


#define li			long long int
#define rep(i,to)	for(int i=0;i<((int)(to));i++)
#define repp(i,start,to)	for(int i=(int)(start);i<((int)(to));i++)
#define pb			push_back
#define sz(v)		((li)(v).size())
#define bgn(v)		((v).begin())
#define eend(v)		((v).end())
#define allof(v)	(v).begin(), (v).end()
#define dodp(v,n)		memset(v,(li)n,sizeof(v))
#define bit(n)		(1ll<<(li)(n))
#define mp(a,b)		make_pair(a,b)
#define rin	rep(i,n)
#define EPS 1e-10
#define ETOL 1e-8
#define MOD 1000000007
#define p2(a,b)		cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)		cout<<a<<"\t"<<b<<"\t"<<c<<endl


int main(){
	
	li a;
	while(cin>>a){
		bool omori[10]={false};
		bool ff=true;
		li fo=9;
		li div=512;
		li now=9;
		while(a>0){
			//p2(a,div);
			if(a>=div){
				if(ff){ff=false; fo=now;}
				a-=div;
				omori[now]++;
			}
			div/=2;
			now--;
		}
		li w=1;
		rep(i,10){
			if(omori[i]){
				cout<<w;
				if(i!=fo)cout<<" ";
			}
			w*=2;
		}
		puts("");
	}
	
	
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	vector<int> a;
	while(cin>>n){
		if(n>=512){
			n-=512;
			a.push_back(512);
		}
		if(n>=256){
			n-=256;
			a.push_back(256);
		}
		if(n>=128){
			n-=128;
			a.push_back(128);
		}
		if(n>=64){
			n-=64;
			a.push_back(64);
		}
		if(n>=32){
			n-=32;
			a.push_back(32);
		}
		if(n>=16){
			n-=16;
			a.push_back(16);
		}
		if(n>=8){
			n-=8;
			a.push_back(8);
		}
		if(n>=4){
			n-=4;
			a.push_back(4);
		}
		if(n>=2){
			n-=2;
			a.push_back(2);
		}
		if(n==1){
			a.push_back(1);
		}
		sort(a.begin(),a.end());
		cout<<a[0];
		for(int i=1;i<a.size();i++){
			cout<<" "<<a[i];
		}
		cout<<endl;
	}
	return 0;
}

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

int main(int argc, const char * argv[])
{
    int cu[11] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024};
    int g, j = 0, cu2[10] = {0};
    while (cin >> g) {
        for (int i = 0; i < 11; i++) {
            if ((g - cu[i]) < 0) {
                g -= cu [i - 1];
                cu2[j] = cu[i - 1];
                i = 0; j++;
            }
            if (g == 0) break;
        }
        for (int i = 0; i < j / 2; i++) {
            int tmp;
            tmp = cu2[j - 1 - i];
            cu2[j - 1 - i] = cu2[i];
            cu2[i] = tmp;
        }
        for (int i = 0; i < j; i++) {
            printf("%d ", cu2[i]);
        }
        puts("");
    }
    return 0;
}

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

using namespace std;

bool a[10];

    int main(){

    int N;
    int i=0;
    
    while(!cin.eof())
    {
        cin>>N;
        i = 0;
        for(int j=0;j<10;j++)
        {
            a[j] = 0;
        }
        
        for(int k=9;k>-1;k--){
            
            if(i+(pow(2,k)) <= N){
                i += pow(2,k);
                a[k] = 1;
            }
        }
        
        bool last = false;
        for(int k=0;k<10;k++){
            
            if(a[k] ==1)
            {
                if(last){
                    cout<<" ";
                }
                last =true;
                cout<<pow(2,k);    
            }        
        }
 
        cout<<endl;
    }
}

C++: #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;

int main() {
	int n;
	while (cin >> n) {
		ostringstream oss;
		for (int i = 0; n; i++) {
			if (n & 1)oss << pow(2, i) << ' ';
			n >>= 1;
		}
		oss.str().pop_back();
		cout << oss.str() << endl;
	}
	return 0;
}