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 <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) << " ";
		cout << endl;
	}
}

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

bool used[10], ans[10], endR;
int bundo[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};

void init(){ for(int i = 0; i < 10; i++) used[i] = false; endR = false;}

void copyAns(){
  for(int i = 0; i < 10; i++) ans[i] = used[i];
}

void dfs(int i, int w){
  if(w == 0) { copyAns(); endR = true; return; }
  if(i == 10 || w < 0 || endR) return;

  if(!used[i]){
    used[i] = true;
    dfs(i + 1, w - bundo[i]);
  }
  used[i] = false;
  dfs(i + 1, w);
}

int main(void){
  int w;
  while(cin >> w){
    init();
    dfs(0, w);
    for(int i = 0; i < 10; i++){
      if(ans[i]) cout << bundo[i];
      if(ans[i] && i < 9) cout << " ";
    }
    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){
     temp=-1;
    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){
	temp++;
      }
    }
    for(int i=0;i<10;i++){
      if(ba[i]!=0){
	cout<<ba[i];
	if(temp>0){
	  cout<<" ";
	  temp--;
	}
      }
    }
    cout<<endl;
  }
  return 0;
}

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

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

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

C++: #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int n;
  while(cin>>n){
    vector<int> v;
    for(int i=10;i>=0;i--){
      if(n>=(1<<i)){
	n-=(1<<i);
	v.push_back(1<<i);
      }
    }
    sort(v.begin(),v.end());
    cout << v[0];
    for(int i=1;i<v.size();i++) cout << " " << v[i];
    cout << endl;
  }
}

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

using namespace std;

int main(){
  int n;
  while(cin >> n){
    vector<int> ar;
    for(int i = 1024 ; i>=1; i /=2){
      if(n >= i){
	cout << i<<" ";
	n-=i; 
      }
    }
  }
  return 0;
}

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

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

C++: #include<cstdio>
#include<vector>
using namespace std;
int main(){
    int n;
    while(~scanf("%d",&n)){
        vector<int> ar;
        for(int i=512;i>=1;i/=2){
            if(n>=i){
                ar.push_back(i);
                n-=i;
            }
        }
        for(int i=ar.size()-1;i>=0;i--){
            printf("%d ",ar[i]);
        }
        printf("\n");
    }
}

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

int main()
{
	int n, count = 0, sum = 1;
	static int ans[100][9] = { 0 };
	int data[100] = { 0 }, ansdata[100] = {0};
	for (int a = 0; a <= 10; a++) {
		data[a+1] = sum;
		sum = sum * 2;
	}
	while (cin >> n) {
		int data2, count2 = 0;
		for (int a = 0; a <= 10; a++) {
			if (n < data[a + 1]) {
				sum = data[a];
				data2 = a;
				ans[count][count2] = a;
				count2++;
				break;
			}
		}
		for (int a = data2-1; a > 0; a--) {
			sum = sum + data[a];
			if (sum > n) {
				sum = sum - data[a];
			}
			else {
				ans[count][count2] = a;
				count2++;
			}
			if (sum == n) {
				break;
			}
		}
		ansdata[count] = count2;
		count++;
	}
	for (int a = 0; a < count; a++) {
		for (int b = ansdata[a]-1; b>=0; b--) {
			cout << data[ans[a][b]]<< " ";
		}
		cout << endl;
	}
	return 0;
}

C++: 
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <cassert>

using namespace std;


bool solve(){
	int n;
	while(cin>>n){
		vector<int> a;
		int k = 0;
		int end_num;
		while(n){
			if(n%2) end_num = k;
			a.push_back(n%2);
			n /= 2;
			k++;
		}
		int num = 1;
		for(int i=0;i<k;i++){
			if(a[i]){
				cout<< num;
				if(i != k-1) cout<< " ";
			}
			num *= 2;
		}
		cout<< endl;
	}
	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(10);
	solve();
	
	return 0;
}

C++: #include<iostream>

using namespace std;

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

}

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

#define rep(x,to) for(int x=0;x<to;x++)
#define rep2(x,from,to) for(x=from;x<to;x++)

using namespace std;


int main(void){

int sg;
int bn[] = {1,2,4,8,16,32,64,128,256,512};

	while(cin >>  sg){
		bool ck[10] ={false};
		rep(i,10){
			if(sg >= bn[9-i]){
				sg -= bn[9-i];
				ck[9-i] = true;
			}
		}
		int cnt=0;
		bool dsw=false;
		rep(i,10)
			if(ck[i]){
				cout << (dsw ? " ":"") << bn[i] ;
				dsw=true;
			}
		cout << endl;
	}
	return 0;
}

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

int main(){
	int n;
	while(cin >> n){ 
		int weight[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
		for(int i = 9; i >= 0; i--){
			if(n >= pow(2, i)){
				n -= pow(2, i);
				weight[i] = 1;
			}
		}

		int i;
		for(i = 0; i < 10; i++){
			if(weight[i]){
				cout << pow(2, i);
			}
		}
		for(; i < 10; i++){
			if(weight[i]){
				cout << " " << pow(2, i);
			}
		}
		cout << endl;
	}

	return 0;
}