Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() (int, error) {
	return strconv.Atoi(nextString())
}

func main() {
	scanner.Split(bufio.ScanWords)

	for {
		n, err := nextInt()
		if err != nil {
			break
		}

		w := 512
		weights := make([]int, 10)
		for i := 9; i >= 0; i-- {
			if n >= w {
				weights[i] = w
				n -= w
			}
			w /= 2
		}

		output := []int{}
		for i := 0; i < 10; i++ {
			if weights[i] > 0 {
				output = append(output, weights[i])
			}
		}
		outputStr := fmt.Sprint(output)
		fmt.Println(outputStr[1:(len(outputStr) - 1)])
	}
}

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) << (pow(2.0, i+1) < n ? " " : "");

		cout << endl;
	}
}

C++: #include <iostream>

using namespace std;

int main() {
    int M,scale[10];
    scale[0]=1;
    for(int i=1;i<10;i++){
    scale[i] = scale[i-1]*2;
    }
    while(cin >> M){
    int i=0;
    int count=2;
    while(true){
        if(M==0) break;
        if(M % count!=0){
            M -= scale[i];
            if(M != 0){
            cout << scale[i] << " ";
            }
            else{
            cout << scale[i] <<endl;
            }
        }
        i++;
        count *= 2;
    }
    }
}

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

int main() {
  int d,a;

  while(cin>>d){
    a=1;
    for(;a<=d;a=a<<1) {
      if(a&d) cout<<a;
      if(d/a>2) cout<<" ";
    }
    cout<<endl;

    /*
    a=1;
    for(;d>0;) {
      if(d%2==1) {
	cout<<a;
	d--;
	if(d>0) cout<<" ";
      }
      d/=2;
      a*=2;
    }
    cout<<endl;
    */
  }

}

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

using namespace std;

int main()
{
	vector<int> bd;
	int n, cont;
	int weight[10] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};

	while(1){
		bd.clear();
		cont = 0;
		cin >> n;

		if(cin.eof())    break;

		while(n != 0){
			bd.push_back(n % 2);	
			n /= 2;
			cont++;
		}

		for(int i = 0; i < cont; i++){
			if(bd[i] == 1){
				cout << weight[i];
				if(i+1 != cont)
					cout << " ";
			}
		}

		cout << endl;
	}

	return 0;
}

C++: #include<iostream>
#include<cmath>
#include<string>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

string ans;

void func(int cnt,int w,string s){
 	if(cnt>=10){
 		if(w==0){
 			ans=s;
 		}
 	}else{
 		func(cnt+1,w,s);
 		s+=cnt+'0';
 		func(cnt+1,w-pow(2,cnt),s);
 	}
 }

int main(){
	int n;
	string s;
	while(cin>>n){
		s="";
		func(0,n,s);
		rep(i,ans.size()){
			cout<<pow(2,(int)(ans[i]-'0'));
			if(i==(ans.size()-1)){
				cout<<endl;
			}else{
				cout<<" ";
			}
		}
	}
	return 0;
}

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

using namespace std;

int main(void){
    int i,j,k,l;
    int n;
    int weight[10]={1,2,4,8,16,32,64,128,256,512};
    int weight_f[10];
    
    while(cin>>n){
    
    memset(weight_f,0,sizeof(weight_f));
    
    for(i=9;i>=0;i--){
        if(n-weight[i]>=0){
            n=n-weight[i];
            weight_f[i]=1;
        }
    }
    i=0;
    while(true){
        if(weight_f[i]==1){
            cout<<weight[i];
        }
        i++;
        break;
    }
    for(j=i;j<10;j++){
        if(weight_f[j]==1){
            cout<<" "<<weight[j];
        }
    }
    cout<<endl;
    }
    return(0);
}

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

using namespace std;

int main(void){
	int cnt=0,j;
	double weight,hun,i;
	double dou[10];

	while(cin>>weight){
		for(i=9;i>=0;i--){
			hun=pow(2,i);
			if(weight>=hun){
				weight-=hun;
				dou[cnt]=hun;
				cnt++;
			}
		}
		for(j=cnt-1;j>=0;j--)
			cout<<dou[j]<<' ';
		cout<<endl;
		cnt=0;
	}

	return 0;
}

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

int main()
{
	int w;

	while (cin >> w){
		for (int i = 1; i <= 512; i *= 2){
			if (w % (i * 2) != 0){ // next check
				cout << i;
				w -= i;
				if (w != 0){
					cout << " ";
				}
			}
			if (w == 0){
				cout << endl;
				break;
			}
		}
	}

	return (0);
}

C++: #include<iostream>
#include<vector>
int n=1024;
std::vector<int> g;

int main(){
	int a;
	while(std::cin>>a){
		int n_=0;
		bool f=true;
		while(1){
			if(n<a&&f)g.push_back(n),a-=n,n_=n,f=false;
			else if(n<a)g.push_back(n),a-=n;
			else n/=2;
			if(a==1){
				g.push_back(1);
				break;
			}
		}
		
		for(auto it = g.rbegin();it!=g.rend();++it){
			std::cout<<*it;
			if(*it!=n_)std::cout<<" ";
		}
		std::cout<<std::endl;
		n=1024;
	}
	return 0;
}

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

int main() {
int n,m;
while(cin>>n){
	m=0;
	int wa=2;
	for (int k=0;k<=10;k++){
		if(n%wa!=0){
			if(m!=0){
				cout<<" ";
			}
			cout<<wa/2;
			n=n-wa/2;
			m=m+1;
		}
	wa=wa*2;
}
cout<<endl;
}
	return 0;
}

C++: #include<stdio.h>
#include<stdlib.h>
#include<string.h>

int i,j,k;
int n,flag[15],a=1,b=1;

int main(){
	while(scanf("%d",&n)!=EOF){
		while(n>=1)flag[a]=n%2*b,n/=2,a++,b*=2;
		for(i=1;i<11;i++)if(flag[i]!=0)printf("%d ",flag[i]);
		//printf("\n");
		for(i=1;i<11;i++)flag[i]=0;a=1;b=1;
	}
	return 0;
}

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;
            }
            m *= 2;
            n /= 2;
            c = 1;
        }
        cout << endl;
    }
    return 0;
}

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


int main(){
	int weight[11];
	weight[0] = 1;
	for(int i = 1;i<=10;i++)weight[i]=2*weight[i-1];
	while(true)
	{
	int object;
	cin >> object;
	if (cin.eof())break;
	int j = 0;
	for(int i = 0;i <=9;i++){
		if((object % 2)==1)
			{
			cout << weight[i];
			if(object == 1) break;
			else cout << " ";
			}
		object = object /2;
		}
	cout << endl;
	}
	
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n;
  while(cin >>n){
    bool f = false;
    for(int i=1;i<=512;i*=2){
      if(n%2 == 1){
	if(f) cout <<" ";
	cout<<i;
	f = true;
      }
      n/=2;
    }
    cout <<endl;
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

template <class Type>
Type power(Type X, int Y)
{
	Type Ans = 1;

	if (Y >= 0)
	{
		for (int i = 0; i < Y; i++)
		{
			Ans *= X;
		}
	}
	else
	{
		for (int i = 0; i < (-Y); i++)
		{
			Ans /= X;
		}
	}

	return Ans;
}

int main()
{
	int N;

	while (cin >> N)
	{
		for (int i = 0; i < 10; i++)
		{
			if ((N / power<int>(2, i)) % 2 == 1)
			{
				cout << power<int>(2, i) << ' ';
			}
		}

		cout << char(127) << endl;
	}

	return 0;
}