Go: 
package main

import (
	"fmt"
	"math"
)

func solve(n int) int {
	i := 0
	for {
		if val := math.Pow(2, float64(i)); val*2 > float64(n) {
			return int(val)
		}
		i++
	}
}

func main() {
	for {
		var n int
		_, err := fmt.Scan(&n)
		if err != nil {
			break
		}

		res := []int{}
		for {
			val := solve(n)
			res = append(res, val)
			n -= val

			if n <= 0 {
				break
			}
		}

		for i := range res {
			if i != 0 {
				fmt.Print(" ")
			}
			fmt.Print(res[len(res)-i-1])
		}
		fmt.Println()
	}
}

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

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

int main(){
	int N, total;
	while (cin >> N) {
		for (int i = 0; i < 10; i++) {
			if (N & 1) {
				total = 1 << i;
				cout << total;
				if (N >> 1) {
					cout << ' ';
				}
			}
			N >>= 1;
		}
		cout << endl;
	}
}

C++: #include<iostream>
#include<vector>
int n=1024;
std::vector<int> g;

int main(){
	int a;
	while(std::cin>>a){
		int n_=0;
		bool f=true;
		while(1){
			if(n<a&&f)g.push_back(n),a-=n,n_=n,f=false;
			else if(n<a)g.push_back(n),a-=n;
			else n/=2;
			if(a==1){
				g.push_back(1);
				break;
			}
		}
		
		for(std::vector<int>::reverse_iterator it = g.rbegin();it!=g.rend();++it){
			std::cout<<*it;
			if(*it!=n_)std::cout<<" ";
		}
		std::cout<<std::endl;
		n=1024;
	}
	return 0;
}

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

int main() {
  int data[] = {1,2,4,8,16,32,64,128,256,512};
  int n;
  while ( cin >> n ) {
    vector<int> num;
    num.clear();
    for ( int i = 9; i >= 0; i-- ) {
      if ( n - data[i] >= 0 ) {
	n-= data[i];
	num.push_back(data[i]);
      }
    }
    for ( int i = num.size()-1; i >= 0; i-- ) {
      if ( i == 0 ) cout << num[i] << endl;
      else cout << num[i] << " ";
    }
  }

  return 0;
}

C++: #include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;

#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)
#define lengthof(x) (sizeof(x) / sizeof(*(x)))
#define FILL(ptr, value) FILL_((ptr), sizeof(ptr)/sizeof(value), (value))
template <typename T>
void FILL_(void * ptr, size_t size, T value){
  std::fill((T*)ptr, (T*)ptr+size, value);
}
//4方向ベクトル→↑←↓
int dx[] ={1,0,-1,0};
int dy[] ={0,-1,0,1};
int W;
int weights[10] ={1,2,4,8,16,32,64,128,256,512};
int main()
{
  while(cin>>W){
    if(cin.eof())
      break;
    int type[10]={0};
    int first = 100;
    for(int j = 9;j >=0;j--){
      if(W-weights[j] >=0){
	W -=weights[j];
	type[j] = 1;
	if(first ==100)
	  first =j;
      }
    }
      for(int i = 0;i <=first;i++){
	if(type[i] ==1){
	  cout <<weights[i];
	  if(i !=first){
	  cout <<" ";
	  }
	}
	if(i ==first)
	  cout <<endl;
      }
  }
  return 0;
}