Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	weight := []int{512, 256, 128, 64, 32, 16, 8, 4, 2, 1}

	for sc.Scan() {
		var wgt []int
		i, _ := strconv.Atoi(sc.Text())

		if i > 1023 {
			i = 1023
		}

		bin := fmt.Sprintf("%010b", i)

		for i := 9; i >= 0; i-- {
			if bin[i] == '1' {
				wgt = append(wgt, weight[i])
			}
		}

		for i := 0; i < len(wgt); i++ {
			if i == len(wgt)-1 {
				fmt.Printf("%d\n", wgt[i])
			} else {
				fmt.Printf("%d ", wgt[i])
			}

		}
	}

}

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;
  int w[10] = {1,2,4,8,16,32,64,128,256,512};

  while(cin >> in){
    vector<int> ans;
    string to;

    for(i=0;in;i++){ to += in%2 + '0'; in /= 2;}
    rep(i,to.size()) if(to[i] == '1') ans.push_back(w[i]);
    rep(i,ans.size()){
      cout << ans[i];
      (i == ans.size()-1) ? cout << endl : cout << " ";
    }
  }


  return 0;
}

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

int twopow(int n)
{
	int ans = 1;
	for(int i=0;i<n;i++){
		ans *= 2;
	}
	return ans;
}

int main()
{
	int n;
	while(cin >> n){
		bool o[10] = {0};
		int mn=n;
		for(int i=0;i<10;i++){
			o[i] = (mn%2==1);
			mn/=2;
		}
		for(int i=0;i<10;i++){
			if(o[i]==1){
				cout << twopow(i);
				if(i!=9)
					cout << " ";
			}
		}
		cout << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<bitset>
using namespace std;
int W[10] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};

main(){
    int weight;
    bitset<10> B;

    while ( cin >> weight ){
	B = weight;
	bool isFirst = true;
	for ( int i = 0; i < 10; i++ ) {
	    if ( B[i] ) {
		if ( isFirst ) isFirst = false;
		else cout << " ";
		cout << W[i];
	    }
	}
	cout << endl;
    }
}

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

int main(){
    int n;
    while( cin >> n ){
        int m = 1, c = 0;
        while(n > 0){
            if( n%2 ){
                if( c ) cout << ' ';
                cout << m;
                c = 1;
            }
            m *= 2;
            n /= 2;
        }
        cout << endl;
    }
    return 0;
}

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

C++: #include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <iterator>
using namespace std;
int main(){
  int n;
  ostream_iterator<int> out_it(cout, " ");
  while(cin >> n){
    int b = 1;
    vector<int> ans;
    while(n > 0){
      if((n & 1) == 1){
	ans.push_back(b);
      }
      b <<= 1;
      n >>= 1;
    }
    copy(ans.begin(), ans.end(), out_it);
    cout << endl;
  }
  return 0;
}

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

int main(void) {
    int weight = 512, num;
   
    while(cin >> num) {
         vector<int> output;
        for(int r = weight; r > 0; r >>= 1) {
            while(num >= r) {
                num -= r;
                output.push_back(r);
            }
        }
        for(int r = (int)output.size() - 1; r >= 0; r--) {
            cout << output[r];
            if(r != 0) cout << " ";
            else cout << endl;
        }

    }
    return(0);
}

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

int main(){
	int n;
	int ary[] = { 512, 256, 128, 64, 32, 16, 8, 4, 2, 1 };

	while (cin >> n){
		vector<int> v;
		for (int i = 0; i < 10; i++){
			if (n >= ary[i]){
				n -= ary[i];
				v.push_back(ary[i]);
			}
		}
		for (auto i = v.rbegin(); i < v.rend(); i++){
			if (i != v.rbegin()) cout << " ";
			cout << *i;
		}
		cout << endl;
		n = 0;
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
using namespace std;
int main(){
  int n;
  vector<int>a;
  for(int i = 1 ; i <= 1024 ; i*=2 )a.push_back(i);
  while( cin >> n ){
    vector<int>ans;
    int p = a.size();
    for(int i = p-1 ; i >= 0 ; i-- ){
      if(n-a[i] >= 0){
	ans.push_back(a[i]);
	n-=a[i];
      }
      if(n == 0)break;
    }
    for(int i = ans.size()-1 ; i >= 0 ; i-- ){
      if(i == (int)ans.size()-1)cout << ans[i]; 
      else cout <<" "<< ans[i];
    }
    cout << endl;
  }
}

C++: #include <iostream>

using namespace std;

int main(){
	int num,count;
	int weight[10];
	for(int i=0,j=1;i<10;i++,j*=2){
		weight[i]=j;
	}
	//for(int i=0;i<10;i++){
	//	cout << weight[i] << endl;
	//}
	while(cin >> num){
		count = 0;
		for(int i=0;i<10 && num;i++){
			if(num%2){
				if(count){
					cout << " " << weight[i];
				}
				else{
					cout << weight[i];
					count++;
				}
			}
			num /= 2;
		}
		cout << endl;
	}

}

C++: #include <stdio.h>

int main(void)
{
int n;
while (scanf("%d", &n) != EOF){
int i;
if ((n & 1) != 0) {
printf("1");
}
for (i = 1; i < 20; i++){
if (((n >> i) & 1) != 0){
printf(" %d", 2 << i);
}
}
puts("");
}
return (0);
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;
 
int main()
{
    int n;
    while(1){
	cin>>n;
	if(cin.eof()) break;
	vector <int> a;
	while(n>1){
		a.push_back(n%2);
		n=n/2;
	}
	a.push_back(n);
	for(int i=0;i<a.size()-1;i++){
		if(a[i]*pow(2,i)==0) continue;
		cout<<a[i]*pow(2,i)<<" ";
	}
	cout<<a[a.size()-1]*pow(2,a.size()-1)<<endl;
    }
    return 0;
}

C++: #include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
#define INF 100000



int main(){
	int w;
	bool ans[10];
	for(int i=0;i<9;i++){
		ans[i]=0;
	}
	while(cin>>w){
		for(int i=10;i--;){
			if(w>=pow(2,i)){
				ans[i]=1;
				w=w-pow(2,i);
			}
		}
		
		if(ans[0]){
			cout<<1;
		}
		for(int i=1;i<11;i++){
			if(ans[i]){
				cout<<" "<<pow(2,i);
			}
		}cout<<endl;
	}
	return 0;
}

C++: #include<iostream>
int main()
{
	auto powor_of_two = [](int n)
	{
		int result = 1;
		for (int i = 0; i < n; i++)
		{
			result *= 2;
		}
		return result;
	};
	for (int w; std::cin >> w;)
	{
		for (int i = 0; i < 10; i++)
		{
			int bit = w & 1;
			if (bit == 1)
			{
				std::cout << powor_of_two(i) << ' ';
			}
			w >>= 1;
		}
		std::cout << std::endl;
	}
	return 0;
}

C++: #include <iostream>

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

    int w;

    while (std::cin >> w) {
        for (int i = 0; i < 10; ++i) {
            int num = 1 << i;
            if (w & num) {
                w -= num;
                std::cout << num;

                if (w) {
                    std::cout << " ";
                }
            }
        }
        std::cout << std::endl;
    }

    return 0;
}

C++: #include<stdio.h>
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
int num[10]={};
int N,cou=0,jj=0,sum=0;
while(scanf("%d",&N)!=EOF)
{
	jj=0;cou=0;sum=0;
do{
num[jj]=N%2;cou++;jj++;
N=N/2;
}while(N!=0);
for(int i=0;i<cou;i++)
{
if(num[i]==1){
	
	sum=pow( 2, (double) (i) );
	if(i>0)cout<<" ";
	cout<<sum;
}
}
cout<<endl;
}
return 0;
}