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 <sstream>
#include <string>
using namespace std;

int main() {
  int w = 0;
  ostringstream oss;
  while(cin >> w, w) {
    for (int i = 0; i < 32; i++) {
      if (w & (1<<i)) {
        oss << (1<<i);
        oss << " ";
      }
    }
    string out = oss.str();
    cout << out.substr(0, out.length() - 1) << endl;
    oss.str("");
    w = 0;
  }
}

C++: #include <bits/stdc++.h>

using namespace std;

int main ()
{
	int N;
	while( cin >> N )
	{
		int count = 0;
		bool f = true;
		while( N )
		{
			if( N % 2 )
			{
				if( f )
				{
					f = false;
				} else
				{
					cout << " ";
				}
				cout << (int) pow ( 2 , count );
			}
			N >>= 1;
			count++;
		}
		cout << endl;
	}
}

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

int baigaesi(int a){
  int n=1;
  if(a == 0)
    return 1;
  else
    for(int i=0;i<a;i++)
      n *= 2;
  return n;
}

int main(){

  int n;

  while(cin >> n){
    int i;
    std::vector<int> an;

    for(i=0;;i++){
      if(n==1){
	an.push_back(1);
	break;
      }
      an.push_back(n%2);
      n /= 2;
    }

    for(int j=0;j<=i;j++){
      if(an[j] == 1){
	cout << baigaesi(j);
	if(j==i) break;
	cout << ' ';
      }
    }
    cout << endl;
  }

  return 0;
}

C++: #include <stdio.h>
int main() {int N;while (scanf("%d",&N)!=EOF) {int i=0,j=1;while (N) {if (N&1) {if (i) printf(" ");printf("%d",j);i++,j<<=1;} N>>=1;} puts("");}return 0;}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    while(cin >> n)
    {
        vector<int> v;
        for(int i = 0; i < 10; i++)
        {
            if(n & (1<<i)) v.push_back(pow(2, i)); 
        }
        for(int i = 0; i < v.size(); i++)
        {
            if(i > 0) cout << " " << v[i];
            else cout << v[i];
        }
        cout << endl;
    }
    return 0;
}

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();
			if( st.size() == 1 )
				cout << endl;
			else
				cout << " ";
			st.pop();
		}
	}
	ret 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
    int n;
    
    while(cin >> n)
    {
        int t = 1, c = 0;
        
        for(int i = 0; i < 20; i++)
        {
            if(n & t)
            {
                if(c++) { cout << ' '; }
                
                cout << t;
            }
            
            t *= 2;
        }
        
        cout << endl;
    }
    
    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n,wei[10],ka=1,temp,ba[10];
  for(int i=0;i<10;i++){
    wei[i]=ka;
    ka*=2;
  }
   while(cin>>n){
     temp=0;
    for(int i=0;i<10;i++){
      ba[i]=0;
    }
    for(int i=9;i>=0;i--){
      if(n!=0){
	if(n-wei[i]>=0){
	  n-=wei[i];
	  ba[i]=wei[i];
	}
      }if(n==0){
	break;
      }
    }
    for(int i=0;i<10;i++){
      if(ba[i]!=0){
	temp++;
      }
    }
    for(int i=0;i<10;i++){
      if(ba[i]!=0){
	cout<<ba[i];
	if(temp>0){
	  cout<<" ";
	  temp--;
	}
      }
    }
    cout<<endl;
  }
  return 0;
}

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

int main(void){
	int N, ans;
	while(cin >> N){
		for(int i = 0; i < 10; i++){
			if(N & 1){
				ans = i << 1;
				cout << ans;
				if(N >> 1)
					cout << ' ';
			}
			N >>= 1;
		}
		cout << endl;
	}
}

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

using namespace std;

int main()
{
  int x;
  while (scanf("%d ", &x) == 1) {
    int omori = 512;
    while (x != 0)
      if (x % omori == 0) {
	x -= omori;
	cout << omori << " ";
	omori /= 2;
      }
    }
  }
  return 0;
}

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

int main(){
    bool fundo[10] = {false};
    int value[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};

    int weight;
    bool space_need = false;

    while(cin >> weight){
        for(int i=0; i<=9; i++){
            if(weight % 2 == 1){
                fundo[i] = true;
            }
            weight /= 2;
        }

        for(int i=0; i<=9; i++){
            if(fundo[i] == true){
                if(space_need) printf(" ");
                printf("%d", value[i]);
                fundo[i] = false;
                space_need = true;
            }
        }
        cout << endl;
        space_need = false;
    }

    return 0;
}

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

int main()
{

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

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

	return 0;
}

C++: #include <stdio.h>
#include <algorithm>
using namespace std;

int ans[101][10];

int pow(int a,int n){
	if(n <= 0){
		return 1;
	}
	return a * pow(a,n - 1);
}

int main(){
	int m;
	int flug = 0;
	while(scanf("%d",&m) != EOF){
		flug = 0;
		for(int j = 0; j < 10; j++){
			if(flug){
				printf(" ");
			}
			flug = 0;
			if((m / pow(2,j)) % 2 == 1){
				printf("%d",pow(2,j));
				flug = 1;
			}
		}
		printf("\n");
	}
	
	///////////////////////////////////
	//Sleep(200000);///////////////////// 提出するときは必ず外す！
	///////////////////////////////////
	return 0;

}

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

C++: #include <iostream>
#include <sstream>
using namespace std;
int main()
{
    int a[10], b[10];
    a[0] = 1;
    for (int i = 1; i < 10; ++i) a[i] = 2 * a[i-1];

    int n;
    while (cin >> n) {
        for (int i = 9; i >= 0; --i) b[i] = 0;
        for (int i = 9; i >= 0; --i) if (n >= a[i]) {
            n -= a[i];
            b[i]++;
        }
        ostringstream os;
        for (int i = 0; i < 10; ++i) if (b[i])
            os << " " << a[i];
        cout << os.str().substr(1) << endl;
    }
    return 0;
}