Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() (int, error) {
	return strconv.Atoi(nextString())
}

func main() {
	scanner.Split(bufio.ScanWords)

	for {
		n, err := nextInt()
		if err != nil {
			break
		}

		w := 512
		weights := make([]int, 10)
		for i := 9; i >= 0; i-- {
			if n >= w {
				weights[i] = w
				n -= w
			}
			w /= 2
		}

		output := []int{}
		for i := 0; i < 10; i++ {
			if weights[i] > 0 {
				output = append(output, weights[i])
			}
		}
		outputStr := fmt.Sprint(output)
		fmt.Println(outputStr[1:(len(outputStr) - 1)])
	}
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
 
int main(){
	int value[10], w;
	vector<int> v;

	for(int i=0; i<10; i++)
	{
		value[i] = (int)pow(2.0,i);
	}
	sort(value,value+10,greater<int>());

	while(cin>>w)
	{
		v.clear();
		for(int i=0; i<10; i++)
		{
			if(value[i]<=w)
			{
				w -= value[i];
				v.push_back(value[i]);
			}
		}
		for(int i=v.size()-1; i>=0; i--)
		{
			if(i == 0)
			{
				cout << v[i] << endl;
			}
			else
			{
				cout << v[i] << " ";
			}
		}
	}
    return 0;  
}

C++: #include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
using namespace std;
#define INF 100000000
typedef long long ll;

int main(void) {
    int n;
    while (cin >> n) {
        vector<int> ans;
        while (n > 0) {
            int p = 512;
            while (p > n) p /= 2;
            n -= p;
            ans.push_back(p);
        }
        cout << ans[ans.size()-1];
        for (int i = ans.size()-2; i >= 0 ; i--) {
            cout << " " << ans[i];
        }
        cout << 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;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main() {
    int n;
    while(cin >> n) {
        vector<int> res;
        for(int i=0; i<10; ++i) {
            if(n & (1 << i)) {
                res.push_back(1 << i);
            }
        }
        for(int i=0; i<res.size(); ++i) {
            cout << res[i] << " \n"[i == res.size()-1] << flush;
        }
    }
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<cassert>
using namespace std;
int inf = 1000000000;


int main(void) {

  int n;
  while(cin >> n){
    if( n == 0 ) break;
    int a = 1024;
    vector<int> b;
    while( a != 0 ){
      if( n / a != 0 ){
        n %= a;
        b.push_back(a);
      }
      a /= 2;
    }
    for(int i=0; i<b.size(); i++){
      if( i != b.size()-1 ) cout << b[b.size()-1-i] << " ";
      else cout << b[b.size()-1-i] << endl;
    }

  }


  return 0;
}


// EOF

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

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

int main(){
	int n;
	int ans[10] = {};
	while(cin >> n){
		while(n >= 512){
			n -= 512;
			ans[9]++;
		}
		while(n >= 256){
			n -= 256;
			ans[8]++;
		}
		while(n >= 128){
			n -= 128;
			ans[7]++;
		}
		while(n >= 64){
			n -= 64;
			ans[6]++;
		}
		while(n >= 32){
			n -= 32;
			ans[5]++;
		}
		while(n >= 16){
			n -= 16;
			ans[4]++;
		}
		while(n >= 8){
			n -= 8;
			ans[3]++;
		}
		while(n >= 4){
			n -= 4;
			ans[2]++;
		}
		while(n >= 2){
			n -= 2;
			ans[1]++;
		}
		while(n >= 1){
			n -= 1;
			ans[0]++;
		}

		for(int i = 0; i < 10; i++){
			if(i == 9) cout << endl;
			if(ans[i] == 0) continue;
			cout << pow(2, i);
			if(i < 9) cout << " ";
		}


	}


}

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

int main() {
  int x;
  while(cin >> x) {
    int w[10][2]={{1},{2},{4},{8},{16},{32},{64},{128},{256},{512}};
    for(int i=9; i>=0; i--) {
      if(x-w[i][0]>=0) {
	w[i][1]=1;
	x-=w[i][0];
      }
    }
    int k=0;
    for(int i=0; i<10; i++) {
      if(w[i][1]==1) {
	if(k!=0) cout << " ";
	cout << w[i][0];
	k=1;
      }
    }
    cout << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <set>
#include <cmath>
#include <algorithm>
using namespace std;

int main(){
	int n , j=0;
	vector<int> v;
	while(cin>>n){
		for(int i=512 ; i>=1 ; i>>=1){
			if(n>=i){
				v.push_back(i);
				n-=i;
			}
		}
		sort(v.begin(),v.end());
		for(vector<int>::iterator it=v.begin();it!=v.end();++it){
			cout << *it << " ";
		}
		cout << endl;
	}
	return 0; 
}

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

int i,j,k;
int n,flag[15],a=1,b=1;

int main(){
	while(scanf("%d",&n)!=EOF){
		while(n>=1)flag[a]=n%2*b,n/=2,a++,b*=2;
		for(i=1;i<11;i++)if(flag[i]!=0)printf("%d ",flag[i]);
		printf("\n");
		for(i=1;i<11;i++)flag[i]=0;a=1;b=1;
	}
printf("\b");
	return 0;
}

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

int main() {
    int n;
    while (cin >> n) {
        bool first = true;
        for (int i=1; i<=512; i<<=1) {
            if (n & i) {
                cout << (first ? "" : " ") << i;
                first = false;
            }
        }
        cout << endl;
    }
    return 0;
}

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

int main() {
	
	int weight[10];
	for(int i = 0; i < 10; i++)
		weight[i] = 1 << i;
		
	int n;
	while(cin >> n){
		if(n % 2){
			n -= 1;
			cout << weight[0] << (n ? " " : "");
		}
	
		while(n){
			int c = 0;
			for(int i = n; i % 2 == 0;){
				c++;
				i /= 2;
			}
			n -= weight[c];
			cout << weight[c] << (n ? " " : "");
		}
		cout << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<vector>
using namespace std;
int main(){
  int n;
  while(cin >>n){
    vector<int> ans;
    for(int i=0,a=1; i<10; i++,a*=2){
      if(n%2 == 1) ans.push_back(a);
      n/=2;
    }
    for(int i=0; i<ans.size(); i++){
      if(i !=0) cout <<" ";
      cout <<ans[i];
    }
    cout <<endl;
  }
  return 0;
}