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>

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;
}

C++: #include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;
int n;

void solve() {
    int a=1;
    rep(i,10) {
        if((n>>i)&1) cout<<a<<" ";
        a<<=1;
    }
    cout<<endl;

}
int main() {
    while(cin>>n) {
        solve();
    }
    return 0;
}

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

int main() {
  int n,i,f;
  while(cin >> n) {
      f=0;
	  for (i=1; i<513; i*=2) if ((n & i) !=0) {
		  if (f==1) cout << ' '; else f=1;
		  cout << i ;
	  }
	  cout << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <string>
#include <algorithm>
#include <climits>
#include <utility>

#define PRINT(STR) cout << STR << endl;
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); (i)++)
#define REG(i, a, b) for (int (i) = ((int)(a)); (i) < ((int)(b)); i++)
#define ALL(V) (V).begin(), (V).end()
#define SPACE " "

typedef long long ll;

using namespace std;

int nextInt() { int n = -1; cin >> n; return n; }
double nextDouble() { double d = -1; cin >> d; return d; }
ll nextll() { ll n = -1; cin >> n; return n; }
string nextString() { string str; cin >> str; return str; }

int INF = 1LL << 25;
double EPS = 1e-9;
int numofbits(int bits)
{
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

// BEGIN //////////////////////////////////////////////////////////////
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    if (n == 0) {
      cout << 0 << endl;
      continue;
    }
    vector<int> ans;
    if (n % 2 == 1) {
      n -= 1;
      ans.push_back(1);
    }
    int t = 2;
    while (n) {
      if (numofbits(n) == 1) {
        ans.push_back(n);
        break;
      }
      n -= t;
      ans.push_back(t);
      t *= 2;
    }
    REP(i, ans.size()) {
      cout << ans[i] << SPACE;
    }
    cout << endl;
  }
	return 0;
}
// END   //////////////////////////////////////////////////////////////

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

int main(){
  int w[]={512,256,128,64,32,16,8,4,2,1};
  int n;
  while(cin>>n){
    stack<int> a;
    for(int i=0;i<10;i++){
      if(n>=w[i]){
	a.push(w[i]);
	n-=w[i];
      }
    }
    while(!a.empty()){
      cout<<a.top()<<" ";
      a.pop();
    }
    cout<<endl;
  }
  return 0;
}