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<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<string.h>
#include<vector>
#include<math.h>
#include<queue>
#include <algorithm>
#include<functional>
#include<cstdlib>
#include<cmath>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define CI cin >>
#define CO cout <<
#define E << endl;

using namespace std;

typedef pair<int, int> P;
typedef pair<long, long> LP;
typedef pair<int, P> PP;
typedef pair<long, LP> LPP;

int N;

int dy[] = { 0, 0, 1, -1, 0 };
int dx[] = { 1, -1, 0, 0, 0 };

bool W_b[10] = { false };
int W[] = { 1, 2, 4, 8 ,16, 32, 64, 128, 256, 512 };

void input(void) {
	CI N;
	return;
}


int main(void) {
	int nn = 0;
	while (CI N) {
		for (int i = 9; i >= 0; i--) {
			if (W[i] <= N) {
				N -= W[i];
				W_b[i] = true;
				nn++;
			}
		}
		for (int i = 0; i < 10; i++) {
			if (W_b[i] == true) {
				CO W[i];
				if (i != nn)CO " ";
				W_b[i] = false;
			}
		}
		CO "\n";
		nn = 0;
	}
	
	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

#define all(c) (c).begin(), (c).end()
#define pb push_back
#define mp make_pair
#define EXIST(v,i) (find(all(v), i) != (v).end())
#define ERASE(v,i) (v).erase(remove(all(v), i), (v).end())
#define INDEX(v,i) (find(all(v), i) - (v).begin())
#define rep(i,n) for(int i = 0; i < (int)n; ++i)
#define debug(x) cerr << #x << " = " << (x) << endl;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

const int INF = 100000000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-10;

int weight[10] = {1, 1<<1, 1<<2, 1<<3, 1<<4, 1<<5, 1<<6, 1<<7, 1<<8, 1<<9};

int main() {
	sort(weight, weight + 10);
#if 0
	rep(i,10) cout << weight[i] << endl;
#endif
	for(int W; cin >> W;) {
		vector<int> ans;
		while(W) {
			int add = *(upper_bound(weight, weight + 10, W) - 1);
			//cout << add << W << endl;
			ans.pb(add);
			W -= add;
		}
		sort(all(ans));
		cout << ans[0];
		for(int i = 1, n = ans.size(); i < n; i++) {
			cout << " " << ans[i];
		}
		cout << endl;
	}
	return 0;
}

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

int main() 
{
  int wigth;
  cin >> wigth;
  int i = 1;
  bool flag = false;
  while (i <= 256) {
    if (wigth & i) {
      if (flag) cout << " ";
      cout << i;
      flag = true;
    }
    i *= 2;
  }
  cout << endl;

  return 0;
}

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

using namespace std;

int main()
{
    int n;
    while (cin >> n) {
        vector<int> a;
        for (int i = 9; i >= 0; --i) {
            if (!n) break;
            if ((1 << i) <= n) {
                n -= 1 << i;
                a.push_back(1<<i);
            }
        }
        sort(a.begin(),a.end());
        for (int i = 0; i < a.size(); ++i) printf(i == a.size() - 1 ? "%d\n" : "%d ", a[i]);
    }
}

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

int main() {
	int n;
	while (cin >> n) {
		stack<int> s;
		for (int i = 9; i >= 0; i--) {
			if (n >= pow(2, i)) {
				n -= pow(2, i);
				s.push(pow(2, i));
			}
		}

		while (!s.empty()) {
			cout << s.top();
			s.pop();

			if (s.size() != 0) {
				cout << " ";
				continue;
			}
			cout << endl;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <complex>
#include <functional>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cctype>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define tr(c,i) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main()
{
	for(int n;cin>>n;){
		vi a;
		rep(i,10)
			if((1<<i)&n)
				a.push_back(1<<i);
		rep(i,a.size())
			cout<<(i==0?"":" ")<<a[i];
		cout<<endl;
	}
	
	return 0;
}

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

int main(void){
	int omori[10]={1,2,4,8,16,32,64,128,256,512},a;
	stack<int> st; 
	int kari;
	while(cin>>a){
		for(int i=9; 0<=i; i--)
		{
			if(a-omori[i]>-1)
			{
				st.push(omori[i]);
				a=a-omori[i];
			}
		}
		while(1)
		{
			if (st.empty())break;
			cout << st.top()<<" ";
			st.pop();
		}
		puts("");
	}
	return 0;
}

C++: #include<stdio.h>
int n;int i;bool f;int main(){while(scanf("%d",&n)!=EOF){f=true;for(i=0;i<10;i++)if(n>>i&1){if(f){printf("%d",1<<i);f=false;}else printf(" %d",1<<i);}printf("\n");}}

C++: // includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>

// macros
#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a); i<(b);++i)
#define rep(i, n) FOR(i, 0, n)

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;

// solve

int main(int argc, char const* argv[])
{
  int n;
  while(cin >> n){
    int tmp = n;
    vector<int> res;
    for(int i = 9; i >= 0; i--){
      if(tmp >= (1 << i)){
        res.pb((1 << i));
        tmp -= (1 << i);
      }
    }
    for(int i = res.size() - 1; i >= 0; i--){
      cout << res[i];
      if(i != 0)cout << " ";
      else cout << endl;
    }
  }
	return 0;
}

C++: #include <stdio.h>
int main(){
int n,temp;
while(scanf("%d",&n)!=EOF){
temp=1;
while(temp<=n)temp*=2;
temp/=2;
printf("%d",temp);
n-=temp;
while(n){
temp/=2;
n-=temp;
printf("%d",temp);
}
printf("\n");
}
}

C++: #include <iostream>
using namespace std;
int factorial(int n){
	if(n==0) return 1 ; else return(2*factorial(n-1)) ;
}
int main(){
	int x;
	while(cin>>x){
		int ans[10]={0};int ptr=0;int sum=0;
		for(int i=9;i>=0;i--){
			if(x==sum) break;
			int temp=factorial(i);
			if(x>=sum+temp) {ans[ptr++]=temp;sum+=temp;};
		};
		for(int i=ptr-1;i>=0;i--){
		if(i!=ptr-1) cout << ' ' ; cout << ans[i] ;
		};
		cout << '\n' ;
	};