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 <iostream>
#include <bitset>
#include <cmath>

int main()
{

	int weight = 0;
	while (std::cin >> weight)
	{
		std::bitset<10> bit(weight);
		int count = bit.count();

		for (int i = 0; i < 10; i++)
		{
			if (bit[i])
			{
				std::cout << std::pow(2, i);
				count--;
				if (count != 0)
				{
					std::cout << " ";
				}
			}
		}
		std::cout << std::endl;
		
	}

	return 0;
}

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

#define TRUE 1
#define FALSE 0

int use_num[10];

int get_input(void) {
    int i;
    std::cin >> i;
    if (std::cin.fail()) 
        exit(0);
    return i;
}

int power(int m, int n) {
    int acc = 1;
    for (int i = 0; i < n; i++) {
        acc *= m;
    }
    return acc;
}    

void solve(int weight) {
    for (int i = 9; i >= 0; i--) {
        if (power(2, i) > weight) {
            use_num[i] = FALSE;
        } else {
            use_num[i] = TRUE;
            weight -= power(2, i);
        }
    }
}

void output(void) {
    for (int i = 0; i <= 9; i++) {
        if (use_num[i] != FALSE) {
            std::cout << power(2, i) << ' ';
        }
    }
    std::cout << std::endl;
}

int main(void) {
    int weight;
    while (weight = get_input()) {
        solve(weight);
        output();
    }
    return 0;
}

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

using namespace std;

int main() {
	vector<int> v;
	vector<int> ans;
	int temp;
	while(1) {
		cin >> temp;
		if(cin.eof()) {
			//cout << "EOF" << endl;
			break;
		}
		v.push_back(temp);
	}
	for(auto it = v.begin(); it != v.end(); it++) {
		int weight = 512;
		for(int i=0;i<10;i++) {
			if(*it >= weight) {
				ans.push_back(weight);
				*it -= weight;
			}
			weight /= 2;
		}
		sort(ans.begin(), ans.end());
		for(auto ans_it = ans.begin(); ans_it != ans.end(); ans_it++) {
			cout << *ans_it;
			if(it - ans.begin() < 10) {
				cout << " ";
			}
		}
		cout << endl;
		ans.clear();
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  
  int n,b;
  int a[10],i;
  while(cin >> n){
    fill_n(a,10,1024);
    b = 512;
    i=0;
    
    while(n != 0){
      if(n >= b){
	a[i] = b;
	i++;
	n -= b;
      }
      if(b == 1) b--;
      else b /= 2;
    }
    sort(a,a+10);
    for(int j = 0;j < i;j++){
      if(j == i-1) cout << a[j] << endl;
      else cout << a[j] << ' ';
    }
  }

  return (0);
}

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

int main(){

int m,w[10];

while(cin>>m){
	int k=0;
	for(int i=0;i<10;i++)w[i]=0;
	
	for(int i=9;i>=0;i--)if(m>=pow(2,i)){w[i]=1;m-=pow(2,i);}
	
	for(int i=0;i<10;i++){
		if(w[i]==1&&k==0){cout<<pow(2,i);k=1;}
		else if(w[i]==1)cout<<" "<<pow(2,i);
	}
	cout<<endl;
	}
	return 0;
}

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

int main()
{
    int n,weight;
	int w[10]={1,2,4,8,16,32,64,128,256,512};
	while(1){
		cin >> n;
		if(cin.eof()){break;}
		int	flag[10]={0};
	
		for(int i=9 ; i>=0; i--){
			if(n>=w[i]){
				n-=w[i];
				flag[i]++;
			}
		}
		for(int i=0; i<10 ; i++){
			if(flag[i]!=0){
				cout << w[i] << " ";
			}
		}
		//cout << endl;
	}
	return 0;
}

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

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

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

int main() {
    int n;
    while(cin >> n) {
        vector<int> res;
        for(int i=0; i<10; ++i) {
            if(n & (1 << i)) {
                res.push_back(1 << i);
            }
        }
        for(int i=0; i<res.size(); ++i) {
            cout << res[i] << " \n"[i == res.size()-1] << flush;
        }
    }
}

C++: #include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <list>
#include <queue>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <math.h>

#define PREP(i, n) for(int i = 0; i <= n; i++)
#define MREP(i, n) for(int i = n; i >= 0; i--)

using namespace std;

int main(){
	int input;
	int tmp = 1, n = 9;
	bool fact[10];
	
	PREP(i, n){
		tmp *= (!i) ? 1 : 2;
		fact[i] = false;
	}

	while(cin >> input){
		MREP(i, n){
			if(tmp <= input){
				input -= tmp;
				fact[i] = true;
			}
			if(input == 0) break;
			tmp /= 2;
		}
		tmp = 1;
		PREP(i, n){
			tmp *= (!i) ? 1 : 2;
			if(fact[i] == true){
				fact[i] = false;
				cout << tmp;
				if(i != n) cout << " ";
			}
		}
		cout << endl;
	}
	return 0;
}

C++: #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cctype>
#include<cmath>
#include<ctime>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<bitset>
#include<utility>
#include<string>

using namespace std;

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

main(){
  int n;
  int i,j,temp;
  int t;
  while(cin >> n){
    int c[15]={0};
    for(i=9;n!=0;i--){
      if(bun[i]<=n){
	n-=bun[i];
	c[i]=1;
      }
    }
    t=0;
    for(i=0;i<10;i++){
      if(c[i]==1){
	if(t==1){
	  cout << ' ';
	}
	cout << bun[i];
	t=1;
      }
    }
    puts("");
  }
}

C++: #include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<cstring>
#include<sstream>
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define lb(v,n) lower_bound(v.begin(),v.end(),n)
#define ub(v,n) upper_bound(v.begin(),v.end(),n)
#define mae(v) max_element(v.begin(),v.end())
#define mie(v) min_element(v.begin(),v.end())
#define INF 0x7FFFFFFF
#define mod 1000000007
typedef long long ll;
////////////////////////////////////////////////////////////

int main(){
	int n;
	while( cin >> n ){
		int s = 512;
		stack<int> st;
		while( n != 0 ){
			if( n - s >= 0 ){
				st.push(s);
				n -= s;
				s /= 2;
			}
			else{
				s /= 2;
			}

		}

		while( !st.empty() ){
			cout << st.top() << " ";
			st.pop();
		}
		cout << endl;
	}
	ret 0;
}