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<cstdio>
#include<cstdlib>
#include<cstring>
#include<cctype>
#include<cmath>
#include<ctime>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<bitset>
#include<utility>
#include<string>

using namespace std;

int bun[10]={1,2,4,8,16,32,64,128,256,512};

main(){
  int n;
  int i,j,temp;
  while(cin >> n){
    int c[15]={0};
    for(i=9;n!=0;i--){
      if(bun[i]<=n){
	n-=bun[i];
	c[i]=1;
      }
    }
    for(i=0;i<10;i++){
      if(c[i]==1){
	cout << bun[i];
      }
      if(c[i+1]==1){
	cout <<' ';
      }
    }
    puts("");
  }
}

C++: #include<iostream>
using namespace std;
int main(){
  int w;
  int B[10]={1,2,4,8,16,32,64,128,256,512};
  while(cin>>w){
    int u[10],c=0;
    for(int i=9;i>-1;i--){
      if(w>=B[i]){
	w-=B[i];
	u[c]=B[i];
	c++;
      }
    }
    for(int i=c-1;i>-1;i--){
      cout<<u[i];
      if(i!=0)cout<<" ";
    }
    cout<<"\n";
  }
  return 0;
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(all(v),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  while(cin >> n){
    string s = "";
    rep(i,10){
      if(n & (1 << i)){
        s += to_string(1<<i)+ " ";
      }
    }
    s.resize(s.size()-1);
    cout << s <<endl;
  }
  return 0;
}

C++: #include <stdio.h>

int main(){
  int n;
  int i;
  while(scanf("%d", &n)!=EOF){
    for(i=0;i<10;i++){
      if(n&1){
        printf("%d", 1<<i);
        if(i!=9) printf(" ");
      }
      n >>= 1;
    }
    printf("\n");
  }
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(all(v),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  while(cin >> n){
    string s = "";
    rep(i,10){
      if(n & (1 << i)){
        s += to_string(1<<i)+ " ";
      }
    }
    s[s.size()-1] = '\0';
    cout << s <<endl;
  }
  return 0;
}

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

int main() {
  int x10=0;
  int x2=0;

  while(cin >> x10) {
    for(int i=0;i<10;i++) {
      x2 = x10 % (int)(pow(2,i+1));
      if(x2 != 0){
        cout << (int)pow(2,i) << " ";
      x10 -= x2;
      }
    }
    cout << endl;
  }
}

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

int main(){
	int n;
	
	while((scanf("%d", &n)) != EOF){
		for(int i = 0; i < 10; i++){
			if(n >> i & 1){
				n -= 1 << i;
				printf("%d%c", 1 << i, (n > 0)? ' ' : '\n');
			}
		}
	}
	
	return 0;
}

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

int main(){
  int i,j,n,a[10];
  while(cin >> n){
    for(i=0;i<10;i++){
      a[i] = 0;
    }

    for(i=9;i>=0;i--){
      if(n >= pow(2,(double)i)){
	n -= (int)pow(2,(double)i);
	a[i++]++;
      }
    }

    
    for(i=0;i<10;i++){
      if(a[i] > 0){
	cout << pow(2,(double)i);
	a[i]--;
	break;
      }
    }
    
    for(i=0;i<10;i++){
      for(j=0;j<a[i];j++){
	cout << " " << pow(2,(double)i);
      }
    }
    cout << endl;

  }
  return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include<math.h>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int main(){
	int n,i,a;
	while (cin >> n) {
		a = 1;
		for (i = 0; i < 10; i++) {
			a *= 2;
			if (n%a != 0) {
				cout << a/2;
				n -= a / 2;
				if (n != 0) {
					cout << " ";
				}
			}
		}
		cout << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <stack>

using namespace std;

int main() {
	int W;
	while (cin >> W) {
		stack<int> ans;
		for (int i = 512; i >= 1; i /= 2) {
			if (W - i >= 0) {
				W -= i;
				ans.push(i);
			}
			if (W == 0)
				break;
		}
		int ifs = 1;
		while (ans.empty() != true) {
			if (ifs == 0)
				cout << " ";
			cout << ans.top(); ans.pop();
			ifs = 0;
		}
		cout << endl;
	}
	return 0;
}

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

C++:  
 #include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 
 using namespace std;
 
 int arr[10]={1,2,4,8,16,32,64,128,256,512};
 int num[10]={0}; 
  
 int main()
 {
   int N;
   while(cin>>N)
   {
     int count=0;
     while(N)
     {
       num[count++]=N%2;
       N/=2;        
     }      
     for(int i=0;i<count-1;i++) cout<<num[i]<<" "
     cout<<num[count-1]<<endl;           
   }
   //while(1);     
   return 0;  
 }

C++: #include<iostream>
using namespace std;
main(){
	for(int W,i,f;cin>>W;cout<<endl)
		for(i=f=1;W/i;i*=2)
			W&i&&(cout<<" "+f<<i,f=0);
}