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++: 
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0031&lang=jp

#include <algorithm>
#include <iostream>
#include <vector>

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <math.h>

using namespace std;

//テ」ツδ榲」ツつッテ」ツδュテ・ツョツ堙ァツセツゥ
#define ALL(v) (v).begin(),(v).end()
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
#define REP(i,a,b) for(int i=(int)(a); i<(int)(b); ++i)
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define SORT(x) sort(begin(x),end(x))
#define SELECT_SORT(x, n) sort(begin(x),begin(x)+n)
#define SWAP(type, a, b) do {type tmp = a; a = b; b = tmp;} while (0)
#define rep_split(tok,a_str,re) for(char *tok = strtok((char *)a_str.c_str(),re); tok != NULL; tok = strtok(NULL,re))

//テ・ツョツ堙ヲツ閉ー
#define INF 2000000000000
#define MAX 10

//DEBUGテァツ板ィ
#define BAR() cout << "----------------------------" << endl;
#define DUMP(v) (cerr << #v << ": " << v << endl)
#define PRINT(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;


int binary(int x)
{
	int y,i,ans;
	ans=0;
	i=0;
	
	while (x>0)
	{
		y=x%2;
		ans=ans+y*pow(10,i);
		x=x/2;
		i=i+1;
	}
	return ans;
}

int main()
{
	vector<int> weight;
	
	weight.push_back(1);
	for(int i=1; i<10; ++i){
		weight.push_back(weight[i-1]*2);
	}
	
	int obj;
	string str;
	while(cin >> obj)
	{
		str = to_string(binary(obj));
		int i=0;
		bool first=true;
		string ans="";
		for(char c : str){
			int num = (int)(c- '0');
			if(num){
				if(first){
					cout << weight[i]; first=false;
				}else{
					cout << " " << weight[i];
				}
			}
			i++;
		}
		cout << endl;
	}
	
}

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

using namespace std;

int test(int n, int s, int i){//n個でsを作る
	//cout << n <<" "<<s<<" "<<i<<endl;
	if(n==0){
		if(s==0){
			return 1;//作れた
		}else{
			return 0;
		}
	}
	if(i>=10 || s-i<0){
		return 0;
	}

	return test(n, s, i+1) + test(n-1, s-i, i+1);
}

int main(){
	int n;
	string omori[]={"1", "2", "4", "8", "16", "32", "64", "128", "256", "512"};
	int t[10];
	while(cin >> n ){
		for(int i=0;i<10;i++){
			t[i]=(n%2);
			n/=2;
		}
		string str="";
		for(int i=0;i<10;i++){
			//cout << t[i] << endl;
			if(t[i])str+=omori[i]+" ";
		}
		str.erase(str.end()-1);
		cout << str << 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;
				if (w != 0)
				{
					std::cout << 'a';
				}
				else
				{
					std::cout << std::endl;
					break;
				}
			}
			else
			{
				w >>= 1;
			}
		}
	}
	return 0;
}

C++: #include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<string.h>
#include<vector>
#include<math.h>
#include<queue>
#include <algorithm>
#include<functional>
#include<cstdlib>
#include<cmath>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define CI cin >>
#define CO cout <<
#define E << endl;

using namespace std;

typedef pair<int, int> P;
typedef pair<long, long> LP;
typedef pair<int, P> PP;
typedef pair<long, LP> LPP;

int N;

int dy[] = { 0, 0, 1, -1, 0 };
int dx[] = { 1, -1, 0, 0, 0 };

bool W_b[10] = { false };
int W[] = { 1, 2, 4, 8 ,16, 32, 64, 128, 256, 512 };

void input(void) {
	CI N;
	return;
}


int main(void) {
	int nn = 0;
	while (CI N) {
		for (int i = 9; i >= 0; i--) {
			if (W[i] <= N) {
				N -= W[i];
				W_b[i] = true;
			}
		}
		for (int i = 0; i < 10; i++) {
			if (W_b[i] == true) {
				CO W[i] << " ";
				W_b[i] = false;
			}
		}
		CO "\n";
	}
	
	return 0;
}

C++: #include <iostream>
using namespace std;
int main( void )
{
	int l[10];
	l[0] = 1;
	for ( int i = 1; i < 10; i++ )
		l[i] = l[i-1] * 2;

	int n;
	while ( cin >> n )
	{
		bool f = false;
		for ( int i = 0; i < 10; i++ )
		{
			if ( n & 1 << i )
			{
				cout << (f?" ":"") << l[i];
				f = true;
			}
		}
		cout << endl;
	}

	return 0;
}

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

int main() {
	int weight;

	while (cin >> weight) {
		vector<int> list;
		
		for (int i = 0; weight != 0;i++) {
			int candidate = pow(2, 9 - i);

			if (weight >= candidate) {
				list.push_back(candidate);
				weight -= candidate;
			}
		}

		int max = list.size();

		for (int j = 0;j < max; j++) {
			if (j != 0)cout << " ";
			cout << list.at(max - j);
		}
		cout << endl;
	}
	
	return 0;
}

C++: #include<iostream>

using namespace std;

int main()
{
	int ln;
	int weit[] = {1,2,4,8,16,32,64,128,256};
	bool fl;
	int n;

	
	
	while (cin >> n)
	{
		ln = 0;
		fl = 0;
		bool two[20] = { 0 };
		while (n)
		{
			two[ln] = n % 2;
			n /= 2;

			ln++;
		}

		int i;
		//cout << ln;
		for (i = 0; i < ln; i++)
		{
			//cout << "A" << two[i];
			if (two[i]==1)
			{
				if (fl)
				{
					cout << " ";
				}
				fl = true;
				cout << weit[ i ];
			}
		}
		cout << endl;
	}

	return 0;
}

C++: # include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
using namespace std;
using LL = long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = 1000000000;
const double PI = acos(-1);

int main() {
	int n;
	while (cin >> n) {
		bool a[1100] = {};
		for (int i = 512; i >= 1; i /= 2) {
			if (n >= i) {
				n -= i;
				a[i] = true;
			}
		}
		for (int i = 1; i <= 512; i *= 2) {
			if (a[i])cout << i << " ";
		}
		cout << endl;
	}
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
	int n,h,c;
	while(cin>>n){
		h=1;
		c=0;
	for(int i=0;i<10;i++){
		if(n%(h*2)!=0){
			n-=h;
			if(c==0)
			    cout<<h;
			else
				cout<<" "<<h;
			c=1;
		}
		h*=2;
	}
	cout<<endl;
	}
	return 0;
}

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

using namespace std;

int main()
{
	int n;
	while(cin >> n)
	{
		stringstream stream;
		for(int i = 0; n; i++)
		{
			if(n & 1)
				stream << (1 << i) << ' ';
			n >>= 1;
		}

		string str = stream.str();
		str.erase(str.length());
		cout << str << endl;
	}

	return 0;
}

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

using namespace std;

int main(){
	int N;
	while (scanf("%d",&N)!=EOF){
		bool f=false;
		for (int i=1;i<=512;i<<=1){
			if (N&i){
				if (f) putchar(' ');
				printf("%d",i);
				f=true;
			}
		}
		putchar('\n');
	}
	return 0;
}

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

using namespace std;

int main(void)
{
    ios::sync_with_stdio(false);
    int n;
    while(cin >> n, n) {
        vector<int> v;
        for(int i = 512; i >= 1; i /= 2) {
            if(n < i) continue;
            n -= i;
            v.push_back(i);
            if(n <= 0) break;
        }
        for(int i=v.size()-1; i>=0; i--) {
            printf("%d%c", v[i], i ? ' ' : '\n');
        }

    }


    return 0;
}