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 <bits/stdc++.h>
using namespace std;

const vector<int> v = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};

int main() {
  int n;
  vector<int> sum(1024, 0);
  for (int i = 0; i <= 1024; ++i) {
    for (int j = 0; j < 10; ++j) {
      if ((i >> j) & 1) sum[i] += v[j];
    }
  }
  while (cin >> n) {
    int pos = 0;
    for (int i = 0; i <= 1024; ++i) {
      pos = i;
      if (sum[i] == n) break;
    }
    bool ok = false;
    for (int i = 0; i <= 10; ++i) {
      if ((sum[pos] >> i) & 1) {
        if (ok) {
          cout << ' ';
        } else {
          ok = true;
        }
        cout << (1 << i);
      }
    }
    cout << endl;
  }
  return 0;
}

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

int hoge(int s, int n) {
    int w = pow(2,n);

    if (n == -1)
        return 0;

    if (w == s) {
        cout << w;
        return 1;
    }

    if (w < s && hoge(s-w, n-1)) {
        cout << " " << w;
        return 1;
    }

    if (hoge(s, n-1)) {
        return 1;
    }

    return 0;
}

int main(void) {
    int s;
    while (cin >> s) {
        hoge(s, 9);
        cout << endl;
    }
    return 0;
}

C++: #include<iostream>

using namespace std;

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

C++: //0031
//include-------------------------------------
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<stack>

using namespace std;

//typedef--------------------------------------
typedef vector<int> VI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

#define MP make_pair

//repetition-----------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)

//constant-------------------------------------
const double PI = acos(-1.0);

//cout,cin-------------------------------------
#define COUT(x) cout<<(x)<<endl;
#define CIN(x) cin>>(x);

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

int main(){

	int w;
	while (1){
		stack <int> st;
		CIN(w)
		for (int i = 10; i >= 0; i--){
			if (w >= weight[i]) {
				st.push(weight[i]);
				w -= weight[i];
			}
		}

		while (st.top()!=0){
			cout << st.top()<<" ";
				st.pop();
		}
		cout << endl;
	}

	return 0;

}

C++: #include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
using namespace std;
int main(){
  vector<int> ar;
  int g[]={1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
  int n;
  while(cin >> n){
    for(int i=9;i>=0;i--){
      if(n>=g[i]){
	n -= g[i];
	ar.push_back( g[i] );
      }
    }
    for(int i=ar.size()-1;i>=0;i--){
      if(i != 0)cout << ar[i] << ' ';
      else cout << ar[i] << endl;
    }
  }
}

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;

    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(i) printf(" ");
                printf("%d", value[i]);
                fundo[i] = false;
            }
        }
        cout << endl;
    }

    return 0;
}

C++: #include <stdio.h>

int main(){
	int i,w,g[10] = {1,2,4,8,16,32,64,128,256,512};
	while(scanf("%d",&w) != EOF){
		if(w % 2 == 1) {
			printf("1 ");
			w--;
		}
		for(i = 1;i < 10;i++){
			if(w % (g[i] * 2) == g[i]) {
				printf("%d ",g[i]);
				w -= g[i];
			}
			if(!w) break;
		}
		printf("\n");
	}
	return 0;
}

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

void dfs(int cw, int remain)
{
  if (!cw || !remain)
    return;

  if (remain >= cw) {
    dfs(cw/2, remain-cw);
    if (remain != cw)
      cout << " ";
    cout << cw;
  } else {
    dfs(cw/2, remain);
  }
}

int main(int argc, char **argv)
{
  int x;

  for (;;) {
    cin >> x;
    if (cin.eof())
      break;
    dfs(512, x);
    cout << endl;
  }
  return 0;
}

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

int main(){
	int n;
	while( cin >> n ){
		int i=0;
		for( ; i<10; i++ ){
			if( n & (1<<i) ){
				cout << (1<<i);
				i++;
				break;
			}
		}
		for( ; i<10; i++ ){
			if( n & (1<<i) ){
				cout << " " << (1<<i);
			}
		}
		cout << endl;
	}
	return 0;
}

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

int main()
{
	int w;

	while (cin >> w, cin.eof() != true){
		for (int i = 1; i <= 512; i *= 2){
			if (w % (i * 2) != 0){
				cout << i;
				w -= i;
				if (w != 0){
					cout << " ";
				}
			}
			if (w == 0){
				cout << endl;
				break;
			}
		}
	}

	return (0);
}

C++: #include <string>
#include <vector>
#include <algorithm>
#include <iostream>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <map>
#define INF 100000000
#define rep(i,a) for(int i=0;i<(a);i++)

using namespace std;
typedef long long ll;

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

int main(){
    stack<int> ans;
    int n;
    while(cin>>n){
        rep(i,10){
            if(n>=hun[i]){
                n-=hun[i];
                ans.push(hun[i]);
            }
        }
        while(ans.size()){
            cout<<ans.top();
            ans.pop();
            if(ans.empty())cout<<endl;
            else cout<<" ";
        }
    }
    return 0;
}

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

int main(){
	int n;
	while(cin>>n){
		bool fla=false;
		for(int i=0;i<10;i++){
			if(n&(1<<i)){
				if(fla){
					cout<<" ";
				}
				else fla=true;
				cout<<(1<<i);
			}
		}
		cout<<endl;
	}
	return 0;
}

C++: #include<bits//stdc++.h>
using namespace std;
int main(){
  int n;
  while(cin>>n){
    vector<int> v;
    for(int i=10;i>=0;i--){
      if(n>=(1<<i)){
	     n-=(1<<i);
	     v.push_back(1<<i);
      }
    }sort(v.begin(),v.end());
    cout << v[0];
    for(int i=1;i<v.size();i++) cout << " " << v[i];
    cout << endl;
  }
}

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

int output[10],len;

int main(){
	int n;
	
	while( cin >> n )
	{
		len = 0;
		for( int i = 0;i < 10;i++ ){
			if( n&(1<<i) ){
				output[len] = (1<<i);
				len++;
			}
		}
		for( int i = 0;i < len-1;i++ ){
			cout << output[i] << " ";
		}
		cout << output[len-1] << endl;
	}
	return 0;
}

C++: #include<cstdio>

using namespace std;

const int Weit=2;
int weit;
int date;
bool flag;

int main()
{
	while(true)
	{
		flag=true;
		scanf("%d",&date);
		for(int i=0;i<10;i++)
		{
			if(i==0)weit=Weit;
			else weit*=2;
			if(date%weit!=0)
			{
				date-=date%weit;
				if(flag==true) flag=false;
				else printf(" ");
				printf("%d",weit/2);
			}
		}
		printf("\n");
	}
	return 0;
}

C++: #include <iostream>
#include <math.h>
using namespace std;
int main(void)
{
	int n;
	while(cin >> n){
		int count=0;
		bool first = true;
		while(n){
			if(n%2){
				if(first){
					cout << pow(2,count);
					first = false;
				}else cout << " " << pow (2,count);
			}
			count++;
			n/=2;
		}
		cout << endl;
	}
	return 0;
}