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 <cstdio>
#include <cstdlib>
#include <cmath>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <cstring>
#include <functional>

using namespace std;

#define REP(i,a,b) for((i)=(a);(i)<(int)(b);(i)++)
#define rep(i,n) REP(i,0,n)
// BEGIN CUT HERE
#define foreach(itr,c) for(typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
// END CUT HERE

int main(){
  int i,in;
  char to[12];
  int w[10] = {1,2,4,8,16,32,64,128,256,512};

  while(cin >> in){
  vector<int> ans;
    for(i=0;in;i++){ to[i] = in%2; in /= 2;}
    rep(i,12) if(to[i] == 1) ans.push_back(w[i]);
    reverse(ans.begin(),ans.end());
    for(i = ans.size()-1; i >= 0; i--){
      cout << ans[i];
      (i == 0) ? cout << endl : cout << " ";
    }
  }


  return 0;
}

C++: 
#include <iostream>

using namespace std;

int main() {
    int N;
    while(cin >> N) {
        bool first = true;
        for(int i = 1; i <= N; i <<= 1) {
            if(N & i) {
                if(!first) cout << ' ';
                cout << i;
                first = false;
            }
        }
        cout << endl;
    }
    return 0;
}

C++: #include <iostream>

int main(){
	int a,b,c=1;
	int d[10];
	
	while(std::cin>>a){
		
		for(b=0;b<2;b++){
			if(a==b){
				d[1]=b;
			}else{
				for(c=0;c<3;c=c+2){
					if(a==b+c){
						d[1]=b;
						d[2]=c;
						
						
					}else{
						for(int e=0;e<5;e=e+4){
			if(a==b+c+e){
				d[1]=b;
				d[2]=c;
						d[3]=e;
					
			}else{
				for(int f=0;f<9;f=f+8){
					if(a==b+c+e+f){
						d[1]=b;
						d[2]=c;
						d[3]=e;
						d[4]=f;
						
					}else{
						for(int g=0;g<17;g=g+16){
			if(a==b+c+e+f+g){
				d[1]=b;
				d[2]=c;
						d[3]=e;
						d[4]=f;
						d[5]=g;
						
			}else{
				for(int h=0;h<33;h=h+32){
					if(a==b+c+e+f+g+h){
						d[1]=b;
						d[2]=c;
						d[3]=e;
						d[4]=f;
						d[5]=g;
						d[6]=h;
						
					
					}else{
						for(int i=0;i<65;i=i+65){
			if(a==b+c+e+f+g+h+i){
				d[1]=b;d[2]=c;
						d[3]=e;
						d[4]=f;
						d[5]=g;
						d[6]=h;
						d[7]=i;
						
			}else{
				for(int j=0;j<129;j=j+128){
					if(a==b+c+e+f+g+h+i+j){
						d[1]=b;
						d[2]=c;
						d[3]=e;
						d[4]=f;
						d[5]=g;
						d[6]=h;
						d[7]=i;
						d[8]=j;
						
					}else{
						for(int k=0;k<257;k=k+256){
			if(a==b+c+e+f+g+h+i+j+k){
				d[1]=b;
				d[2]=c;
						d[3]=e;
						d[4]=f;
						d[5]=g;
						d[6]=h;
						d[7]=i;
						d[8]=j;
						d[9]=k;
						
			}else{
				for(int l=0;l<513;l=l+512){
					if(a==b+c+e+f+g+h+i+j+k+l){
						d[1]=b;
						d[2]=c;
						d[3]=e;
						d[4]=f;
						d[5]=g;
						d[6]=h;
						d[7]=i;
						d[8]=j;
						d[9]=k;
						d[10]=l;
					}else{
						
					}
				}
			}
			
		}
					}
				}
			}
			
		}
					}
				}
			}
			
		}
					}
				}
			}
			
		}
					}
				}
			}
			
		}
		for(int m=1;m<11;m++){
		if(d[m]!=0){
			std::cout<<d[m];
		}
	}
	std::cout<<std::endl;
	}
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int n, s;
int main() {
	while (true) {
		cin >> n; s = 0;
		for (int i = 1; i < 31; i++) {
			if ((n / (int)pow(2, i)) % 2 == 1) {
				if (s) { cout << ' '; }
				cout << pow(2, i - 1); s++;
			}
		}
		cout << endl;
	}
}

C++: #include<iostream>

using namespace std;

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

C++: #include<stdio.h>
int main(){
	int a;
	while(~scanf("%d",&a)){
		for(int i=0;i<10;i++)if(1<<i&a)printf(1<<i+1>a?"%d":"%d ",1<<i);
		printf("\n");
	}
}

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

using namespace std;

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

bool tukauka[10];//大きい順

int n,owari;
int main(){
	while(cin >> n){
		for(int i = 0;i < 10; i++) {
			if(n >= omosa[i]){
				tukauka[i] = true;
				n -= omosa[i];
			}
		}
		for(int i=9;i!=0;i--){
			if(tukauka[i])owari=i;
		}
		for(int i = 0; i < 10; i++) {
			if( i==9-owari) {
				cout << omosa[9 - i] ;
			}else if(tukauka[9 - i]){
				cout<< omosa [9 - i]<<" ";
			}
		}
		cout << endl;
		for(int i=0;i<10;i++)tukauka[i]=false;
	}
	return 0;
}

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

int main()
{
	int N;
	cin >> N;
	vector<int> res;
	for (int i = 0; i < 10; i++) {
		if (N & (1 << i)) {
			res.push_back(1 << i);
		}
	}
	reverse(res.begin(), res.end());
	for (int i = 0; i < (int)res.size(); i++) {
		cout << res[i] << " \n"[i +  1 == (int)res.size()];
	}
	return 0;
}

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

#define int long long int
#define main signed main()
#define bye return 0
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define each(p, v) for (auto p = (v).begin(); p != (v).end(); p++)
#define all(v) (v).begin(), (v).end()
#define prec(n) fixed << setprecision(n)
#define dump(x) cerr << "(L" << __LINE__ << ") " << #x << " = " << (x) << endl
#define clr(x, a) memset(x, a, sizeof(x))

#define sum(v) accumulate(all(v), 0)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define odd(n) ((n) % 2)
#define even(n) (!odd(n))

#define INF 1000000000
#define MOD 1000000007

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define vi vector<int>
#define vb vector<bool>
#define vc vector<char>

using namespace std;

main {
  int x;
  while(cin>>x) {
    vi r;
    x=x<<1;
    for(int i=0; x=x>>1; i++) {
      if (x&1) r.pb(1<<i);
     }
    if (!r.size()) {cout<<endl;continue;}
    cout<<r[0];
    loop(i,1,r.size()) cout<<' '<<r[i];
    cout<<endl;
  }
  bye;
}

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

int main() {
	int w;
	while (std::cin >> w) {
		std::vector<int> scales;
		while (w != 0) {
			int s = w % 2;
			scales.push_back(s);
			if (s == 1) w--;
			w = w / 2;
		}
		int weight = 0;
		bool first = false;
		for (std::vector<int>::iterator itr = scales.begin(); itr != scales.end(); ++itr) {
			if (weight == 0) weight = 1;
			else weight = weight * 2;
			if (*itr == 1) {
				if (first) std::cout << " ";
				std::cout << weight;
				first = true;
			}
		}
		std::cout << std::endl;
	}

	return 0;
}

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

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

C++: #include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  int p2[10] = {512,256,128,64,32,16,8,4,2,1},n;
  vector<int> v;
  while(cin>>n){
    for(int i=0;i<10;i++){
      if(n>=p2[i])n-=p2[i],v.push_back(p2[i]);
    }
    sort(v.begin(),v.end());
    vector<int>::iterator it=v.begin();
    for(;it!=v.end();it++){
      cout<<*it;
      (it==v.end())?cout<<endl:cout<<" ";
    }
    v.clear();
  }
  return 0;
}

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

int main() {
	int g;
	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;
	}
}