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>

using namespace std;

int main(){
  int n;

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

  while( cin >> n){
  int used[10]={0,0,0,0,0,0,0,0,0,0};
    int i = 0;
    int f = 0;
    while(n){
      if(n >= omori[9-i]) {n -= omori[9-i];used[i] = omori[9-i];f++;}
      i++;
    }

    for(int j=9;j >= 0;j--){
      if(used[j] != 0 && f == 1){ cout << used[j] << endl;}
      if(used[j] != 0 && f != 1){ cout << used[j] << ' ' << flush;f--;}
    }
  }
  return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <algorithm>
#include <map>
#include <string>
#include <cstdio>
#include <cstring>
#include <climits>
#include <vector>
//#include <tuple>
using namespace std;
#define rep(i,n) for(LL i=0;i<n;i++)
#define all(v)	(v).begin(),(v).end()
#define MOD  1000000007
const int INF = INT_MAX;
typedef long long LL;
typedef pair<int, int> pii;
//typedef tuple<int, int> tii;

int main(){
	int w[10] = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 };
	int n;
	while (cin >> n){
		vector<int> v;
		for (int i = 9; i >= 0; i--){
			if (n >= w[i]){
				v.push_back(w[i]);
				n -= w[i];
			}
		}
		sort(all(v));
		rep(i, v.size()-1){
			cout << v[i] <<" ";
		}
		cout << v[v.size() - 1] << endl;
	}
	return 0;
}

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

int main(){
  int w;  
  while(cin >> w){
	int bit = pow(2,9);
	vector<int> a;
	for(int i=0;i<10;i++){
	  if(w/bit) a.push_back(bit);
	  w = w%bit;
	  bit /= 2;
	}
	reverse(a.begin(),a.end());
	for(int i=0;i<a.size();i++){
	  cout << a[i];
	  if(i==a.size()-1) cout << endl;
	  else cout << ' ';
	}
  }
  return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <set>
#include <stack>
#include <queue>
#include <time.h>

using namespace std;
typedef long long ll;
#define pl pair<ll,ll>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); itr++)
#define dbg(x) cout << #x"="<< (x) << endl
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back(a) 
#define in(x) cin >> x;
#define all(x) (x).begin(), (x).end()
#define INF 2147483600
#define fi first
#define se second

int main(){
	int n;
	while(cin>>n){
		bool flg=false;
		rep(i,10){
			if(1&(n>>i)){
				if(flg) cout<<' ';
				cout<<pow(2,i);
				flg=true;
			}
		}
		cout<<endl;
	}
    return 0;
}

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

int main(){
  int w;
  vector<int> v;

  while( !cin.eof() && cin>>w ){

    if( w>0 ){
      v.clear();
      for( int i=512;i>=1;i/=2 ){
	if( w>i ){
	  w-=i;
	v.push_back( i );
	}
      }
      if( w==1 ) v.push_back( 1 );

      for( int i=v.size()-1;i>0;--i )
	cout << v[i]<< " ";
      cout << v[0] << endl;
    }else
      cout << endl;
  }

  return 0;
}

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++: #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <bitset>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back

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

int Pow(int a, int n) {
	int ans = 1;
	while (n > 0) {
		if (n & 1)ans *= a;
		a *= a;
		n >>= 1;
	}
	return ans;
}

int main() {
	int x;
	while (cin >> x) {
		bitset<10> b = x;
		VI print;
		rep(i, 10) {
			if (b.test(i))print.pb(Pow(2, i));
		}
		rep(i, sz(print)) {
			cout << print[i];
			printf(i == sz(print) - 1 ? "\n" : " ");
		}
	}
}

C++: #include <iostream>

using namespace std;

int main() {
    int scale[10];
    scale[0]=1;
    for(int i=1;i<10;i++){
    scale[i] = scale[i-1];
    }
    while(true){
    int M,i=0;
    cin >> M;
    int count=2;
    while(true){
        if(M==0) break;
        if(M % count!=0){
            M -= scale[i];
        }
        cout << scale[i] << " ";
        i++;
        count *= 2;
    }
    cout << endl;
    }
}

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

int main()
{	
	int w;

	while (cin >> w) {
		int i = 0;
		bool f = 0;
		while ((1 << i) <= w) {
			if ((1 << i) & w) {
				if (f)
					cout << " ";
				else
					f = 1;

				cout << (1 << i);
			}

			i++;
		}

		cout << endl;
	}

	return 0;
}

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

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

int main(){
	int i = 1, n;
	bool p[10];

	while(scanf("%d", &n) != EOF){
		fill(p, p+10, false);

		for(int i= 9; 0 <= i; i--){
			if(n == 0) break;
			if(weight[i] <= n){
				p[i] = true;
				n -= weight[i];
			}
		}
		for(int i =0; i < 10; i++){
			if(p[i]) cout << weight[i] << ' ';
		}
		cout << endl;
	}
	return 0;
}

C++: #include <cstdio>

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 <vector>
using namespace std;
int main(){
	int w[10] = {1,2,4,8,16,32,64,128,256,512};
	int n;
	while(cin>>n){
		vector<int> num;
		int b=n;
		for(int i=0;i<10;i++){
			if(b==0) break;
			if(b>=w[9-i]){
				num.push_back(w[9-i]);
				b -= w[9-i];
			}else if(b==w[9-i]) break;			
		}
		for(int j=1;j<=num.size();j++){
			if(j!=1) cout<<" ";
			cout<<num[num.size()-j];
		}
		cout<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define rp(a) while(a--)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main(){
	int n;
	while(cin>>n){
		vector<int>out;
		rep(i,10)if(n>=pow(2,9-i)){
			out.pb(pow(2,9-i));
			n-=pow(2,9-i);
		}
		sort(all(out));
		rep(i,out.size()){
			if(i)cout<<" ";
			cout<<out[i];
		}
		cout<<endl;
	}
}

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

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

C++: #include <cstdio>
int main(){int n,s;while(scanf("%d",&n)+1){for(s=1;n;s*=2){n&s&&printf("%d%c",s,n-s?32:10);n-=n&s;}}}