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>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<climits>
#include<map>
#include<set>
#include<cassert>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define INF 1<<30
using namespace std;

int main(){
  int n;
   vector<int> dp[1024];
  
  for(int i=1;i<=1023;i++){
    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;
    }
    if(dp[i].empty()){
      int index,bg;
      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>

using namespace std;

int main()
{
	int w;
	while (cin >> w) {
		for (int weight = 1; w>0; w>>=1, weight<<=1) {
			if ((w&1)==1) {
				if (weight > 1) cout << " ";
				cout << weight;
			}
		}
		cout << endl;
	}
	
	return 0;
}

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

using namespace std;

void solve();

int main() {

   solve();

   return 0;

}

/*void solve() {＃３

   vector<int> S;
   vector<int> T;
   int n;   //Sの個数
   int q;   //Tの個数
   int ans=0;
   int buf;

   cin >> n;

   for (int i = 0; i < n; i++) {
      
      cin >> buf;
      S.push_back(buf);

   }

   cin >> q;

   for (int i = 0; i < q; i++) {

      cin >> buf;
      T.push_back(buf);

   }

   //Sをソート

   sort(S.begin(),S.end());

   for (vector<int>::iterator i=T.begin();i<T.end();i++){  //Tの各値をSから探す。あったらans＋＋

      if(binary_search(S.begin(),S.end(),*i)){ans++;}

   }

   cout << ans << endl;

}*/

void solve() {

   int in;
   vector<int> input;
   vector<string> ans;
   int w[10];
   int now=0; //今何問目？
   char c=' ';
   string buf;

   for (int i = 0; i < 10; i++) {

      w[i]=(int)pow(2,i);

   }

   while (true) {

      getline(cin,buf);
     
      if(buf[buf.length()-1]==EOF || buf[0] == '\n') break;

      input.push_back(stoi(buf));

   }


   for (vector<int>::iterator itr=input.begin();itr<input.end();itr++) {

      for (int i = 9; i >= 0; i--) {

         if (*itr > w[i]) {

            *itr-=w[i];
            ans[now]+=to_string(w[i]);
            ans[now]+=c;
         }

         ans[now].pop_back();       //ここ2行で整形
         ans[now].push_back('\n');

      }

      now++;

   }

   for (vector<string>::iterator itr = ans.begin(); itr < ans.end(); itr++) {

      cout << *itr;

   }

}

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

vi dec2binv(int n){
	vi x;
	while (n>0){
		if (n%2==1) x.push_back(1);
		else x.push_back(0);
		n/=2;
	}
	if (x.empty()) x.push_back(0);
	return x;
}

int main(void){

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

	while (true){
		int n;
		cin>>n;
		if (cin.eof()) break;
		vi tmp = dec2binv(n);
		bool f=false;
		for (int i=0; i<int(tmp.size()); i++){
			if (tmp[i]==1){
				if (f) cout<<" ";
				else f=true;
				cout<<weight[i];
			}
		}
		cout<<endl;
	}
	return 0;
}

C++: #include<stdio.h>
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
bool f=false;
int num[10]={};
int N,cou=0,jj=0,sum=0;
while(scanf("%d",&N)!=EOF)
{
	jj=0;cou=0;sum=0;f=false;
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(f==true)cout<<" ";
	cout<<sum;f=true;
}
}
cout<<endl;
}
return 0;
}

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

int main() {
  int n;
  int w;
  while (cin >> n) {
    vector<int> v;
    w = 512;
    while (n) {
      if (n >= w) {
        v.push_back(w);
        n -= w;
      }
      w /= 2;
    }
    int i;
    for (i = v.size() - 1; i >= 0; i--) {
      cout << v[i];
      if (i) {
        cout << ' ';
      }
    }
    cout << endl;
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
int main() {
  int a, i;
  while (cin >> a) {
    for (i = 0; i <= 9; i++) {
      if (a & 1 << i) {
        cout << (1 << i);
        if (a < 2 << i)
          break;
        cout << ' ';
      }
    }
    cout << endl;
  }
}

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

int main(){
//変数の宣言
int a[10],c[10];
int n,b;
//初期化
a[0]=1;
for(int i=1;i<10;i++){
a[i]=a[i-1]*2;}

while(cin>>n){
//初期化
b=0;
for(int i=0;i<10;i++){
c[i]=0;}
//おもりを乗せるか
for(int i=9;i>-1;i--){
if(n>=a[i]){
c[b]=a[i];
b++;
n-=a[i];}
if(n==0){break;}
}
//出力
for(int i=b-1;i>0;i--){
cout<<c[i]<<" ";}
cout<<c[0]<<endl;
}}

C++: #include <stdio.h>
  int main(){
   int x[10]={1,2,4,8,16,32,64,128,256,512};
   int n,i;
    while(scanf("%d",&n) != EOF){
		int y[10]={};
     for(i=9;i>=0;i--){
		 if(n>=x[i]){  n -= x[i]; y[i]=1;}
       }
      for(i=0;i<10;i++){
         if(y[i]==1) printf(" %d",x[i]);
            }

      printf("\n");
}
return 0;
}

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

using namespace std;
int main()
{
    int N;
    while ( !cin.eof() )
    {
        cin >> N;
        vector<int> ans;
        
        for (int a = 9; a > -1; a = a-1)
        {   
            if (N >= (1 << a))
            {
                N = N - (1 << a);
                ans.push_back(1 << a);
            }
            
        }
        reverse(ans.begin(), ans.end());
        
        for (int i = 0; i < ans.size(); i++)
        {
            cout << ans[i] ;
            if (i == ans.size()-1)
                cout << endl;
            else
                cout << " ";
        }
    }
}

C++: #include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<complex>
#include<stack>
#include<cmath>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)


int main(){
	int n;
	while(cin>>n){
		bool flg = false;
		rep(i,20){
			if((n&(1<<i))>0){
				if(flg)printf(" ");
				printf("%d",(1<<i));
				flg=true;
			}
		}puts("");
	}
	
	
}

C++: #include <stdio.h>

int main(){
  int n;
  int i;
  while(scanf("%d", &n)!=EOF){
    for(i=0;i<10;i++){
      if(n&1){
        printf("%d ", 1<<i);
	//        if(i!=9) printf(" ");
      }
      n >>= 1;
    }
    printf("\n");
  }
}

C++: #include <iostream>

#define TRUE 1
#define FALSE 0

int use_num[10];

int get_input(void) {
    int i;
    std::cin >> i;
    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);
        }
    }
}

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