Go: 
package main

import (
	"fmt"
	"math"
)

func solve(n int) int {
	i := 0
	for {
		if val := math.Pow(2, float64(i)); val*2 > float64(n) {
			return int(val)
		}
		i++
	}
}

func main() {
	for {
		var n int
		_, err := fmt.Scan(&n)
		if err != nil {
			break
		}

		res := []int{}
		for {
			val := solve(n)
			res = append(res, val)
			n -= val

			if n <= 0 {
				break
			}
		}

		for i := range res {
			if i != 0 {
				fmt.Print(" ")
			}
			fmt.Print(res[len(res)-i-1])
		}
		fmt.Println()
	}
}

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

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

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

int main(){
	int x;
	while(cin>>x){
		vector<int>ans;
		for(int i=0;i<10;i++){
			if((x>>i)&1)ans.push_back(1<<i);
		}
		for(int i=0;i<ans.size();i++){
			if(i>0)cout<<" ";
			cout<<ans[i];
		}
		cout<<endl;
	}
}

C++: #include<iostream>

using namespace std;

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

C++: #include <iostream>

using namespace std;

int main()
{
    int input;
    const int weight[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
    bool check[10];

    while (cin >> input) {
        for (int i = 0; i < 10; i++)
            check[i] = false;

        int tmp = input;
        for (int i = 0; tmp != 0; i++) {
            if (tmp % 2)
                check[i] = true;
            tmp /= 2;
        }

        int max = 0;
        for (int i = 0; i < 10; i++)
            if (check[i] && i > max)
                max = i;

        for (int i = 0; i < max; i++)
            if (check[i])
                cout << weight[i] << " ";
        cout << weight[max] << endl;
    }

    return 0;
}

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

using namespace std;

int main(void)
{
    int a;
    while ( scanf("%d", &a) != EOF) {
        bool fl;
        for (int i = 0; i < 10; i++) {
            if ((a&1) == 1) {
                if (fl) {
                    cout << " ";
                } else { 
                    fl = true;
                }
                cout << (1<<i);
            } 
            a >>= 1;
        }
        puts("");
    }
    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <time.h>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <string>
#include <bitset>
using namespace std;
#define FOR(I,F,N) for(int I = F; I < (int)(N); I++)
#define rep(i, n) FOR(i, 0, n)
#define FIN(V) cout<<V<<endl
#define pb push_back
#define INF (1 << 30)
typedef pair<int, int> P;
typedef long long ll;
typedef priority_queue<int> pq;
int StrToInt(string);
string IntToStr(int);
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int main(void){
	int weight[10] = {1};
	for(int i = 1; i < 10; i++){
		weight[i] = weight[i-1]*2;
	}
	int n;
	while(cin >> n){
		vector<int> ans;
		for(int i = 10; i >= 0; i--){
			if(weight[i] < n){
				n -= weight[i];
				ans.pb(weight[i]);
			}
		}
		for(int i = ans.size(); i >=0; i--){
			if(i == 0)cout << ans[i] << endl;
			else cout << ans[i] << " ";
		}
	}


	return 0;
}

C++: #include <iostream>
#include <stdlib.h>

using namespace std;

int main(int argc, char **argv)
{
	int n, tmp, *array, tmp2;
	
	while(cin >> n){
		array = (int *)calloc(10, sizeof(int));
		tmp2 = 0;
		while(n > 0){
			tmp = 1;
			while(n >= tmp){
				tmp *= 2;
			}
			tmp /= 2;
			array[tmp2++] = tmp;
			n -= tmp;
		}
		tmp2--;
		cout << array[tmp2];
		for(int i = tmp2 - 1; i >= 0; i--){
			cout << " " << array[i];
		}
		cout << endl;
		free(array);
	}
	
	return 0;
}

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

int main() {
    int n;
    int weights[10] = {512, 256, 128, 64, 32, 16, 8, 4, 2, 1};
    
    while (cin >> n) {
        vector<int> result;
        for (int i = 0; i != 10; ++i) {
            if (n - weights[i] >= 0) {
                n -= weights[i];
                result.push_back(weights[i]);
            }
        }
        sort(result.begin(), result.end());

        for (int i = 0; i != result.size()-1; ++i) {
            cout << result[i] << " ";
        }
        cout << result[result.size()-1];
        cout << endl;
    }
    return 0;
}

C++: #include <stdio.h>

int main(void){
	int w;
	char s[100];
	int st = 0;
	int i = 0;
	while(scanf("%d", &w) != EOF){
		st = i = 0;
		while(10 > i){
			if(w & 1 == 1){
				st += sprintf(s+st, "%d ", 1<<i);
			}
			w >>= 1;
			i++;
		}
		s[st - 1] = '\0';
		puts(s);
	}
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>

using namespace std;


int main(){
	int w[] = {1,2,4,8,16,32,64,128,256,512};
	int n;
	while(cin >> n){
		int flag[10], num[10];
		int end = 0;
		for(int i = 0;i < 10;i++){
			flag[i] = 0;
			num[i] = 0;
		}
		num[0] = n;
		for(int i = 0;i < 10;i++){
			flag[i] = num[i] % 2;
			num[i+1] = num[i] / 2;
			if(num[i+1] == 0) break;
		}
		for(int i = 0;i < 10;i++){
			if(flag[i] == 1) end = i; 
		}
		for(int i = 0;i < 10;i++){
			if(i == end) cout << w[i] << endl;
			else if(flag[i] == 1) cout << w[i] << " ";
		}

	}
	return 0;
}

C++: #include<iostream>
#include<vector>
#include<cassert>
using namespace std;
int main(){
  int n,index,bg;
  vector<int> dp[1024];
  for(int i=1;i<=1023;i++){
    if(!dp[i].empty())continue;
    if(i == 1 || i == 2 || i == 4 || i == 8 || i == 16 || i == 32 || i == 64 || i == 128 || i == 256 || i == 512){
      dp[i].push_back(i);
      continue;
    }  
    bg = i-1;
    for(int j=1;j<bg;j++){
      index = bg+j;
      for(int k=0;k<dp[j].size();k++){
	dp[index].push_back(dp[j][k]);
      }
      for(int k=0;k<dp[bg].size();k++){
	dp[index].push_back(dp[bg][k]);
      }
    }
  }

  while(cin >> n){
    assert(n<=1023);
    for(int i=0;i<dp[n].size();i++){
      cout << dp[n][i];
      i==dp[n].size()-1?cout << endl:cout << " ";
    }
  }
  return 0;
}

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

using namespace std;

int main(){
	int w, g[10];
	vector<int> ans;
	
	for(int i=0; i<10; i++) g[i] = pow(2,i);
	
	while(cin >> w){
		ans.clear();
		for(int i=9; i>=0; i--){
			if(w<=1){
				if(w==1)ans.push_back(w);
				break;
			}
			else if(g[i]<=w){
				w -= g[i];
				ans.push_back(g[i]);
			}
						
		}
		for(int 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 weight[10];
	weight[1] = 1;
	for(int i = 2;i<=9;i++)weight[i]=2*weight[i-1];
	while(true)
	{
	int object;
	cin >> object;
	for(int i =1;i <=9;i++){
		if((object % 2)==1)
			{
			cout << weight[i] ;
			if( i != 9 ) cout << " ";
			}
		object = object /2;
		}
	cout << endl;
	if (cin.eof())break;
	}
	
	return 0;
}

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

using namespace std;

string IntToString(int number) {
	stringstream ss;
	ss << number;
	return ss.str();
}

int main(void) {
	int in;
	int omori[] = {512,256,128,64,32,16,8,4,2,1};
	int i;
	string ret;

	while(!cin.eof()) {
		cin >> in;
		ret = "";
		for(i = 0; i < 10; i++) {
			if(omori[i] <= in) {
				in -= omori[i];
				ret = IntToString(omori[i]) + ((ret=="")?(""):(" ")) + ret;
			}
			if(in == 0) { break; }
		}
		cout << ret << endl;
	}

	return 0;
}