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<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
    int n;
    while(cin>>n){
        int weight=512,weights=1,flags=0;
        bool flag[15]={0};
        for(int i=1;i<11;i++){
            if(n-weight>=0){
                flag[i]=1;
                n-=weight;
            }
            weight/=2;
        }
        for(int i=10;i>0;i--){
            if(flag[i]==1&&flags==1){
                cout<<" ";
                flags=0;
            }
            if(flag[i]==1){
                flags=1;
                cout<<weights;
            }
            weights*=2;
        }
        cout<<endl;
    }
    return 0;
}

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

int main() {
    int weight;
    while (cin >> weight) {
        for (int i = 0; weight > 0; weight /= 2, i++) {
            if (weight % 2 == 1) {
                if (i > 0) {
                    cout << " ";
                }
                cout << pow(2, i);
            }
        }
        cout << endl;
    }
}

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());
        int j;
        rep(i,0,v.size()) {
            if(v[i] * pow(2,i) != 0) {
                j = i;
                cout << v[i] * pow(2,i);
                break;
            }
        }
        if(j != v.size()-1)
            rep(i,j+1,v.size()) (v[i] * pow(2,i) == 0) ? : cout << " " << v[i] * pow(2,i);
        cout << endl;
    }

    return 0;
}

C++: //0031
//include-------------------------------------
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<stack>

using namespace std;

//typedef--------------------------------------
typedef vector<int> VI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

#define MP make_pair

//repetition-----------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)

//constant-------------------------------------
const double PI = acos(-1.0);

//cout,cin-------------------------------------
#define COUT(x) cout<<(x)<<endl;
#define CIN(x) cin>>(x);

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

int main(){

	int w;
	while (1){
		vector <int> v;
		CIN(w)
		int p = 0;
		for (int i = 9; i >= 0; i--){
			if (w >= weight[i]) {
				v[p] = weight[i];
				p++;
				w -= weight[i];
			}
		}

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

	return 0;

}

C++: #include <iostream>
#include <string>
using namespace std;
int main( void )
{
  int n;
  while( 1 ){
    string s="";
    cin>>n;
    if( cin.eof() ) break;
    for( int i=0; i<10; i++ ){
      if( n & (1<<i) ){ cout << s << (1<<i); s = " "; }
    }
    cout << endl;
  }
  return 0;
}

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

int main()
{
	int w;

	while (cin >> w){
		for (int i = 1; i <= 512; i *= 2){
			if (w % (i * 2) != 0){
				cout << i;
				w -= i;
				if (w != 0){
					cout << " ";
				}
			}
			if (w == 0){
				cout << endl;
				break;
			}
		}
	}

	return (0);
}

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

int main()
{
	int m;
	while(cin >> m)
	{
		int w=1;
		while(m)
		{
			if(m&1) cout << w << " ";
			m = m>>1;
			w = w<<1;
		}
		cout << endl;
	}
}

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

using namespace std;

vector< bool > w( 9, 0 );

///2進法のｎ桁目を考える。
//（ pow( 2, n ) <= input ）→ n + 1 digit == 1 (n:整数)

int main()
{
    int weight;
    while( scanf( "%d\n", &weight ) != EOF )
    {
        for( int i = 8; i >= 0; i-- )
        {
            if( pow( 2, i ) <= weight )
            {
                weight %= ( int ) pow( 2, i );
                w[i] = 1;
            }
        }
        for( int i = 0; i < 9; i++ )
        {
            if( w[i] )
            {
                printf( "%.0lf ", pow( 2 , i ) );
            }
        }
        printf( "\n" );
    }
    return 0;
}

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

int main() {
	int g,idx;
	int num[]={1,2,4,8,16,32,64,128,256,512};
	stack<int> ans;
	while(cin>>g){
		for(int i=9;i>=0;i--){
			if(g>=num[i]){
				g-=num[i];
				ans.push(num[i]);
			}
		}while(!ans.empty()){
			cout << ans.top() << " ";
			ans.pop();
		}cout<<endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main(void){
	int n;
	while(cin >>n,!cin.eof()){
		int i=1;
		if(i&n)
			cout << i;
		i <<=1;
		while(i<=n){
			if(i&n)
				cout << ' ' << i ;
 			i <<=1;
		}
		cout << endl;
	}
	return 0;
}

C++: #include<stdio.h>
int main()
{
	const int MASK = 0x10000000;
	unsigned n, i;
	while(scanf("%u", &n) == 1)
	{
		for(i = 1; i < 0x400; i<<=1)
		{
			if(n&i)
			{
				if(n&MASK)
					printf(" %d", i);
				else
					printf("%d", i), n|=MASK;
			}
		}
		putchar('\n');
	}
	return 0;
}

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

int main(){
	int n, g;
	while(scanf("%d\n", &g) != EOF){
		n = 1;
		while(g > 0){
			if(g % (n * 2) > 0){
				printf("%d", n);
				g -= n;
				printf("%c", (g > 1)? ' ' : '\n');
			}
			n *= 2;
		}
	}
}

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

using namespace std;

int main(void){
	int cnt=0,j;
	double weight,hun,i;
	double dou[10];

	while(cin>>weight){
		for(i=9;i>=0;i--){
			hun=pow(2,i);
			if(weight>=hun){
				weight-=hun;
				dou[cnt]=hun;
				cnt++;
			}
		}
		cout<<dou[cnt-1];
		for(j=cnt-2;j>=0;j--)
			cout<<' '<<dou[j];
		cout<<endl;
		cnt=0;
	}

	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
typedef vector<int>V;
int main(void){
	int n,m;
	int box[10]={512,256,128,64,32,16,8,4,2,1};
	int sum;
	V v;
	int i;
	while(1){
		cin>>n;
		if(cin.eof())	break;
		m=0;
		v.clear();
		while(1){
			if(n==0||m==10)	break;
			if(n-box[m]>=0){
				//cout<<box[m]<<endl;
				n-=box[m];
				v.push_back(box[m]);
			}
			//cout<<"N="<<n<<"M="<<m<<endl;
			m++;
		}
		reverse(v.begin(),v.end());
		for(i=0;i<(int)v.size();i++){
			if(i)	cout<<" ";
			cout<<v[i];
		}
		cout<<endl;
	}
	return 0;
}

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

int main(){
    int data[10] = {1,2,4,8,16,32,64,128,256,512};
    int ch[10];
    int sta;
    while(cin >> sta){
        memset(ch,0,sizeof(ch));
        for(int i=9;i>=0;i--){
            if(sta >= data[i]){
                sta -= data[i];
                ch[i] = 1;
            }
        }
        for(int i=0;i<10;i++){
            if(ch[i] == 1){
                cout << data[i] << " ";
            }
        }
        cout << endl;
    }
}