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;

int main(){
	int div=512;
	int weight[10];
	int W;
	while(cin>>W){
      div=512;
		for(int i=0;i<10;i++){
			weight[i]=W/div;
            W=W%div;
			div=div/2;
		}
      int flag=0;
		for(int j=0;j<10;j++){
                      int a=1;
          if(weight[9-j]>0){

            for(int k=0;k<j;k++){
              a=a*2;
            }
            if(flag==1){cout<<" ";}
		cout <<a;
            flag=1;
		}

        }
 	cout<<endl;     
}
  return 0;
    }

C++: #include <iostream>

using namespace std;

int main()
{
    int input;
    const int weight[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
    bool check[10];

    while (cin >> input) {
        for (int i = 0; i < 10; i++)
            check[i] = false;

        int tmp = input;
        for (int i = 0; tmp != 0; i++) {
            if (tmp % 2)
                check[i] = true;
            tmp /= 2;
        }

        for (int i = 0; i < 10; i++)
            if (check[i])
                cout << weight[i] << " ";
        cout << "\b\n";
    }

    return 0;
}

C++: #include <iostream>

using namespace std;

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  while ( true )
  {
    bool  init = true;
    int   D;

    if ( !( cin >> D ) )  break ;

    for ( int mask = 1; mask <= 0x200; mask <<= 1 )
    {
      if ( D & mask )
      {
        if ( !init )
        {
          cout << " ";
        }
        cout << mask;
        init = false;
      }
    }
    cout << endl;
  }

  return ( 0 );
}

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

int input,i;


int main(){
	while(cin>>input){
		string ans("");
		while(1){
			if(input%2==0) ans.insert(ans.begin(),'0');
			else ans.insert(ans.begin(),'1');
			input/=2;
			if(input==0) break;
		}
		if(ans[ans.length()-1]=='1'){
			cout<<"1"<<" ";
		}
		//ans.pop_back();
		i=2;
		while(1){
			if(i==ans.length()+1) break;
			if(ans[ans.length()-i]=='1'&&i!=ans.length()){
				cout<<(int)pow(2.0,i)/2<<" ";
			}
			if(ans[ans.length()-i]=='1'&&i==ans.length()){
				cout<<(int)pow(2.0,i)/2;
			}
			//ans.pop_back();
			i++;
		}
		cout<<endl;
	}
	return 0;
}

C++: #include <stdio.h>
#include <stdlib.h>

int main(void)
{
	unsigned int n;
	char buf[256];
	int ans[10];
	
	
	while (fgets(buf, 256, stdin) != NULL){
		n = atoi(buf);
		
		int count = 0;
		for (int i = 0; i < 10; i++){
			if ((n & (1 << i)) != 0){
				ans[count++] = 1 << i;
			}
		}
		printf("%d", ans[0]);
		for (int i = 1; i < count; i++){
			printf(" %d", ans[i]);
		}
		puts("");
	}
	
	return (0);
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define For(i,a,b) for(int (i)=(a); (i)<(b); (i)++)

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

int main() {
    int n;
    while(cin >> n) {
        vector<int> needed;
        REP(i,10) {
            if (n / weights[i]) {
                needed.push_back(weights[i]);
                n %= weights[i];
            }
        }
        reverse(needed.begin(), needed.end());
        REP(i,needed.size()-1) {
            cout << needed[i] << " ";
        }
        cout << needed[needed.size()-1] << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <time.h>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <string>
#include <bitset>
using namespace std;
#define FOR(I,F,N) for(int I = F; I < (int)(N); I++)
#define rep(i, n) FOR(i, 0, n)
#define FIN(V) cout<<V<<endl
#define pb push_back
#define INF (1 << 30)
typedef pair<int, int> P;
typedef long long ll;
typedef priority_queue<int> pq;
int StrToInt(string);
string IntToStr(int);
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int main(void){
	int weight[10];
	weight[0] = 1;
	for(int i = 1; i < 10; i++){
		weight[i] = weight[i-1]*2;
	}
	int n;
	while(cin >> n){
		vector<int> ans;
		for(int i = 10; i >= 0; i--){
			if(weight[i] <= n){
				n -= weight[i];
				ans.pb(weight[i]);
			}
			if(n == 0)break;
		}
		for(int i = ans.size()-1; i > 0; i--){
			if(i == 1)cout << ans[i] << endl;
			else  cout << ans[i] << " ";
		}
	}


	return 0;
}



int StrToInt(string s){
	stringstream ss;
	ss << s;
	int val;
	ss >> val;
	return val;
}
string IntToStr(int i){
	stringstream ss;
	ss << i;
	return ss.str();
}

C++: #include <iostream>

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) {
                    cout << " ";
                }
                cout << t;
            }

            t *= 2;
        }
        cout << endl;
    }

    return 0;
}

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(void)
{
int n;
while (scanf("%d", &n) != EOF){
int i;
if ((n & 1) != 0) {
printf("1");
}
for (i = 1; i < 20; i++)
{
if (((n >> i) & 1) != 0){
printf(" %d", 2 << i);
}
}
puts("");
}

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

int main() {
	short int n;
	while (cin >> n) {
		for(int i=1; n>0; i*=2,n/=2){
			if (n % 2 == 1) {
				cout << i;
				if (n > 1)
					cout << " ";
			}
		}
		cout << endl;
	}
	return 0;
}

C++: /*
	0031:Weight
*/
#include	<iostream>
#include	<cmath>

using namespace std;

int main(void) {
	while(1) {
		int w;
		int bundo[2][10] = { 0 };
		
		cin >> w;
		if( cin.eof() ) { break; }
		
		for(int i = 0; i < 10; i++) {
			bundo[0][i] = pow(2, i);
		}
		
		for(int i = 0; i < 10; i++) {
			if(w >= bundo[0][9 - i]) {
				w -= bundo[0][9 - i];
				bundo[1][9 - i] = 1;
			}
		}
		
		for(int i = 0; i < 9; i++) {
			if(bundo[1][i] == 1) {
				cout << bundo[0][i];
				for(int j = i + 1; j < 10; j++) {
					if(bundo[1][j] == 1) {
						cout << ' ';
						break;
					}
				}
			}
		}
		if(bundo[1][9] == 1) {
			cout << bundo[0][9];
		}
		cout << endl;
	}
	return 0;
}

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

int main(){
	int n;
	int tmp;
	while(cin >> n){
		vector<int> ans;
		for(int i = 9; i >= 0; i--){
			if(n - pow(2, i) >= 0){
				ans.push_back(pow(2, i));
				n -= pow(2, i);
			}
		}
		sort(ans.begin(), ans.end());
		for(int i = 0; i < ans.size() - 1; i++){
			cout << ans[i] << " ";
			tmp = i;
		}
		cout << ans[tmp + 1] << endl;
	}
}

C++: // 2012/10/28 Tazoe

#include <iostream>
using namespace std;

int main()
{
	while(true){
		int obj;
		cin >> obj;

		if(cin.eof())
			break;

		bool spc = false;

		for(int i=0; i<8; i++){
			if(obj%2==1){
				if(spc){
					cout << ' ';
				}

				int wgt = 1;
				for(int j=0; j<i; j++){
					wgt *= 2;
				}
				cout << wgt;

				spc = true;
			}

			obj /= 2;
		}

		cout << endl;
	}

	return 0;
}