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<queue>
#define N 1 << 9
using namespace std;

int main(){
    int n;
    queue<int> qu;
    while(cin >>n){
        for(int i = 1; i <= N; i = i << 1){
            if((n & i) != 0){
                qu.push(i);
            }
        }
        while(qu.empty() != 1){
            cout <<qu.front();
            if(qu.size() != 1){
                cout <<" ";
            }
            qu.pop();
        }
        cout <<endl;
    }
    return 0;

}

C++: //53
#include<iostream>

using namespace std;

int main(){
  for(int n;cin>>n;){
    bool out=false;
    for(int i=0;i<=8;i++){
      if(n&1<<i){
	if(out){
	  cout<<' ';
	}
	out=true;
	cout<<(1<<i);
      }
    }
    cout<<endl;
  }
  return 0;
}

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

bool used[10], ans[10], endR;
int bundo[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};

void init(){ for(int i = 0; i < 10; i++) used[i] = false; endR = false;}

void copyAns(){
  for(int i = 0; i < 10; i++) ans[i] = used[i];
}

void dfs(int i, int w){
  if(w == 0) { copyAns(); endR = true; return; }
  if(i == 10 || w < 0 || endR) return;

  if(!used[i]){
    used[i] = true;
    dfs(i + 1, w - bundo[i]);
  }
  used[i] = false;
  dfs(i + 1, w);
}

int main(void){
  int w;
  while(cin >> w){
    init();
    dfs(0, w);
    int cnt = 0;
    for(int i = 0; i < 10; i++){
      if(ans[i]) cnt++;
    }
    for(int i = 0; i < 10; i++){
      if(ans[i]) cout << bundo[i];
      if(ans[i] && --cnt) cout << " ";
    }
    cout << endl;
  }
  return 0;
}

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

int main(int argc, const char * argv[])
{
    int cu[10] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
    int g, j = 0, cu2[10] = {0};
    scanf("%d", &g);
    
    for (int i = 0; i < 10; i++) {
        if ((g - cu[i]) < 0) {
            g -= cu [i - 1];
            cu2[j] = cu[i - 1];
            i = 0; j++;
        }
        if (g == 0) break;
    }
    for (int i = 0; i < j / 2; i++) {
        int tmp;
        tmp = cu2[j - 1 - i];
        cu2[j - 1 - i] = cu2[i];
        cu2[i] = tmp;
    }
    
    for (int i = 0; i < j; i++) {
        printf("%d ", cu2[i]);
    }
    puts("");
    
    return 0;
}

C++: #include<iostream>

using namespace std;

int main()
{
	int weight;
	int i,j;
	int ans[10];
	int flag;
	
	for(;cin >> weight;)
	{
		for(i=0;i<10;i++)
			ans[i]=0;
			
		for(i=0;weight>0;weight/=2,i++)
		{
			ans[i]=weight%2;
			if(weight%2==1)
				flag=i;
		}
		
		for(i=0,j=1;i<10;i++,j*=2)
		{
			if(ans[i]==1 && i<flag)
				cout << j << " " ;
			if(i==flag)
				cout << j ;
				
		}
		cout << endl;
	}
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int n, s;
int main() {
	while (cin >> n) {
		s = 0;
		for (int i = 0; i < 31; i++) {
			if (n % 2 == 1) {
				if (s) { cout << ' '; }
				cout << pow(2, i); s++;
				n -= 1;
			}
			n /= 2;
		}
		cout << endl;
	}
}

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=' ';
   char buf[100]="";

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

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

   }

   while (cin >> in) {

      input.push_back(in);

   }


   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>
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 << ' ';
				}
				else
				{
					std::cout << std::endl;
					break;
				}
			}
			else
			{
				w >>= 1;
			}
		}
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(void){
	int a;
	int b=512;
	int c[10]={0};
	int d=0;
        while(cin>>a){

            int i=0;
            if (a>=512){
                a-=512;
                c[i]=512;
                i++;
            }
            if (a>=256){
                a-=256;
                c[i]=256;
                i++;
            }
            if (a>=128){
                a-=128;
                c[i]=128;
                i++;
            }
            if (a>=64){
                a-=64;
                c[i]=64;
                i++;
            }
            if (a>=32){
                a-=32;
                c[i]=32;
                i++;
            }
            if (a>=16){
                a-=16;
                c[i]=16;
                i++;
            }
            if (a>=8){
                a-=8;
                c[i]=8;
                i++;
            }
            if (a>=4){
                a-=4;
                c[i]=4;
                i++;
            }
            if (a>=2){
                a-=2;
                c[i]=2;
                i++;
            }
            if (a>=1){
                a-=1;
                c[i]=1;
                i++;
            }

            for(i-=1;i>=0;i--){
                if(i==0){
                    cout<<c[i];
                    break;
                }
                cout<<c[i]<<" ";

            }
            cout<<endl;
        }
	return 0;
}

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

using namespace std;

int main() {
	vector<int> weights;
	vector<int> use;
	weights.push_back(1);
	weights.push_back(2);
	weights.push_back(4);
	weights.push_back(8);
	weights.push_back(16);
	weights.push_back(32);
	weights.push_back(64);
	weights.push_back(128);
	weights.push_back(256);
	int w;

	while(cin>>w,!cin.eof()) {
		while(w!=0){
			for(int i=0; i<weights.size(); i++){
				if(w == 0) break;
				if(weights.at(i) > w){
					w -= weights.at(i-1);
					use.push_back(weights.at(i-1));
					break;
				}
			}
		}
		sort(use.begin(), use.end());
		for(int i=0; i<use.size()-1; i++){
			cout<<use[i]<<" ";
		}
		cout<<use[use.size()-1]<<endl;
		use.clear();
	}
	return 0;
}

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

int main(){
	int n;
	while(cin >> n;){ 
		int weight[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
		for(int i = 9; i >= 0; i--){
			if(n >= pow(2, i)){
				n -= pow(2, i);
				weight[i] = 1;
			}
		}

		cout << "1";
		for(int i = 1; i < 10; i++){
			if(weight[i]){
				cout << " " << pow(2, i);
			}
		}
		cout << endl;
	}

	return 0;
}