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<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;
}

C++: #include <cstdio>

using namespace std;

int main() {
    int n = 0;

    while (scanf("%d", &n) != EOF) {
        int t = 1;

        for (int i = 0; i < 10; ++i) {
            if ((n & t) == t) {
                if (i != 0) {
                    printf(" ");
                }
                printf("%d", t);
            }

            t *= 2;
        }
        printf("\n");
    }

    return 0;
}

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

int main(){

  int a[10], b[10], g, cnt;

  for(int i=0; i<10; i++){
    a[i] = pow(2, i);
  }

  fill(b, b+10, 0);
  cnt = 0;
  while(cin >> g){
    for(int i=9; i>=0 || g == 0; i--){
      if(a[i] <= g){
        b[i] = 1;
        g -= a[i];
        cnt++;
      }
    }

    for(int i=0; i<10; i++){
      if(b[i] == 1){
        cnt--;
        cout << a[i] << (cnt? " " : "");
        b[i] = 0;
      }
    }
    cout << endl;

  }

  return 0;

}

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

using namespace std;
int weight[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
void solve()
{
	int a;
	while(cin >> a)
	{
		bool flag[10];
		memset(flag, 0, sizeof(bool)  * 10);
		for(int i = 9; i >= 0; --i)
		{
			if(a / weight[i])
			{
				flag[i] = true;
			}
			a %= weight[i];
		}
		int pos = 0;
		for(int i = 0; i < 10; ++i)
		{
			if(flag[i])
			{
				cout << weight[i];
				pos = i;
				break;
			}
		}
		for(int i = pos + 1; i < 10; ++i)
		{
			if(flag[i])
			{
				cout << " " << weight[i];
			}
		}
		cout << endl;
	}
}

int main()
{
	solve();
	return(0);
}