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>
using namespace std;
int main() {
    int n;
    while (cin >> n) {
        int d = 1;
        while (n != 0) {
            if (n & 1) {
                cout << d << " ";
            }
            n = n >> 1;
            d = d << 1;
        }
        cout << endl;
    }
    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n;
  while(cin >>n){
    bool f = false;
    for(int i=1; i<=512; i*=2){
      if(n%2){
	if(f){cout <<" ";}
	cout <<i;
	f = true;
      }
      n/=2;
    }
    cout <<endl;
  }
  return 0;
}

C++: /*
AizuOnline A0031
Weight
*/
#include <stdio.h>


main()
{
  int weight;
  int fundou;
  
  while(EOF !=scanf("%d",&weight))
    {  for(fundou=1;fundou <= 512;fundou <<= 1)
         if(weight & fundou)
           printf("%d ",fundou);
       printf("\n");
    }

return(0);
}

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

int main(int argc, const char * argv[])
{
    int cu[11] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024};
    int g, j, cu2[10];
    while (cin >> g) {
        for (int i = 0; i < 10; i++) {
            cu2[i] = 0;
        }
        j = 0;
        for (int i = 0; i < 11; i++) {
            if ((g - cu[i]) < 0) {
                g -= cu [i - 1];
                cu2[j] = cu[i - 1];
                i = 0; j++;
            }
            if (g == 0) break;
        }
        for (int i = 0; i < j / 2; i++) {
            int tmp;
            tmp = cu2[j - 1 - i];
            cu2[j - 1 - i] = cu2[i];
            cu2[i] = tmp;
        }
        for (int i = 0; i < j; i++) {
            printf("%d ", cu2[i]);
        }
        puts("");
    }
    return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main(){
	int n;
	while(cin>>n){
		int i=0, s=0;
		while(n){
			s+=(n%2)*pow(10, i);
			n/=2;
			i++;
		}
		i=0;
		while(s){
			if(s%10){
				if(s/10)	cout<<pow(2, i)<<" ";
				else	cout<<pow(2,i)<<endl;
			}
			s/=10;
			i++;
		}
	}
	return 0;
}

C++: #include <cstdio>
#include <algorithm>

using namespace std;

int main()
{
	int weight;
	int i;
	int a[8];
	int cu;
	int cnt = 0;

	while (scanf("%d", &weight) != EOF){
		for (i = 0; i < 8; i++) a[i] = 0;
		cnt = 0;
		cu = 512;
		i = 0;
		while (weight != 0){
			while (cu > weight) cu /= 2;
			a[i++] = cu;
			weight -= cu;
			cnt++;
		}
		sort(a, a + cnt);
		printf("%d", a[0]);
		for (i = 1; i < cnt; i++){
			printf(" %d", a[i]);
		}
		printf("\n");
	}

	return (0);
}

C++: #include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <list>
#include <queue>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <math.h>

#define PREP(i, n) for(int i = 0; i <= n; i++)
#define MREP(i, n) for(int i = n; i >= 0; i--)

using namespace std;

int main(){
	int input;
	int tmp = 1, n = 9;
	bool fact[10];
	
	PREP(i, n){
		tmp *= (!i) ? 1 : 2;
		fact[i] = false;
	}

	while(cin >> input){
		MREP(i, n){
			if(tmp <= input){
				input -= tmp;
				fact[i] = true;
			}
			if(input == 0) break;
			tmp /= 2;
		}
		tmp = 1;
		PREP(i, n){
			tmp *= (!i) ? 1 : 2;
			if(fact[i] == true){
				fact[i] = false;
				cout << tmp;
				if(i != n) cout << " ";
			}
		}
		cout << endl;
	}
	return 0;
}

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

int main(){
	unsigned o;

	while ( cin >> o ){
		bool first = true;
		for ( int i = 0; i < 10; ++i ){
			if ( o & 1 << i ){
				if ( first ){
					cout << ( 1 << i );
					first = false;
				}else{
					cout << " " << ( 1 << i );
				}
			}
		}
		cout << endl;
	}

	return 0;
}

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

int main() {
  int w;
  while (cin >> w) {
    vector<int> ans;
    for (int i = 512; i >= 1; i /= 2)
      if (i <= w)
        ans.push_back(i), w -= i;

    reverse(ans.begin(), ans.end());

    for (int i = 0; i < ans.size(); ++i)
      if (i == ans.size() - 1)
        cout << ans[i] << endl;
      else
        cout << ans[i] << ' ';
  }
}

C++: #include <bits/stdc++.h>
 
using namespace std;
 
/*-------------------------------*/
#define FOR(i, a, b) for(int i = (a); i < (b); i++) 
#define RFOR(i, a, b) for(int i = (b) - 1; i >= (a); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define RREP(i, n) for(int i = (n) - 1; i >= 0; i--)
#define all(i) (i).begin(),(i).end()
#define pb push_back
#define mp make_pair 
 
typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef vector<long long> llv;
typedef vector<pint> vpint;
/*-------------------------------*/
 
int main(void)
{
  int pw[10] = {512, 256, 128, 64, 32, 16, 8, 4, 2, 1};
  int n;
  
  while (cin >> n){
    vi li;
    int cnt = 0;
    REP(i, 10){
      if (n - pw[i] >= 0){
        n -= pw[i];
        li.pb(pw[i]);
        cnt++;
      }
    }
    sort(all(li));
    REP(i, cnt){
      if (i == cnt - 1) cout << li[i] << endl;
      else cout << li[i] << " ";
    }
  }

  return 0;
}

C++: #include<iostream>
using namespace std;
int n;
int main(){
  while(cin>>n){
    for(int i=1;n>0;i*=2){
   
      if(n&1){

	cout<<i<<' ';
      }
      n=n>>1;
    }
    cout<<endl;
  }
  return 0;
}

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

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

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

int main()
{
	int nishin[] = {1,2,4,8,16,32,64,128,256,512};
	int n;
	vector<int> result;

	while(cin >> n) {
		result.clear();
		while(true) {
			if(n<=0) break;
			if(n%2 == 1) result.push_back(1);
			else		 result.push_back(0);
			n /= 2;
		}

		for(int i=0;i<result.size();i++) {
			if(result[i] == 1 && i<result.size()-1) 
				cout << pow(2,i) << ' ';
			else 
				cout << pow(2,i);
		}
		cout << '\n';
	}

	return 0;
}

C++: #include<iostream>
#include <stdio.h>
#include <vector>
using namespace std;
int main(){int a1;
while(cin>>a1){
int w[10],i=0;
	if(a1>=512){
	a1-=512;w[i]=512;i++;}
	if(a1>=256){
	a1-=256;w[i]=256;i++;}
	if(a1>=128){
	a1-=128;w[i]=128;i++;}
	if(a1>=64){
	a1-=64;w[i]=64;i++;}
	if(a1>=32){
	a1-=32;w[i]=32;i++;}
	if(a1>=16){
	a1-=16;w[i]=16;i++;}
	if(a1>=8){
	a1-=8;w[i]=8;i++;}
	if(a1>=4){
	a1-=4;w[i]=4;i++;}
	if(a1>=2){
	a1-=2;w[i]=2;i++;}
	if(a1==1){
	a1-=1;w[i]=1;i++;}
	for(int ii=0;ii<i-1;ii++){
	cout<<w[i-ii-1]<<" ";}
	cout<<w[0]<<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;
		v.clear();
	}
	return 0; 
}