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<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 - 1)CO " ";
				W_b[i] = false;
			}
		}
		CO "\n";
		CO pow(2, 32) E;
		nn = 0;
	}
	

	
	return 0;
}

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

int main(){
	int n;
	while(cin >> n){
		stack<int> s;
		for(int i = 512; i > 0; i /= 2){
			if(n - i >= 0){
				s.push(i);
				n -= i;
			}
		}
		int o;
		while(!s.empty()){
			o = s.top();
			s.pop();
			if(s.empty())cout << o << endl;
			else cout << o << " ";
		}
	}
}

C++: #include <iostream>
#include <string>
#include <map>
#include <vector>
using namespace std;
int main(){
  int p2[10] = {512,256,128,64,32,16,8,4,2,1},n;
  vector<int> v;
  while(cin>>n){
    for(int i=0;i<10;i++){
      if(n>=p2[i])n-=p2[i],v.push_back(p2[i]);
    }
    vector<int>::iterator it=v.begin();
    while(it!=v.end()){
      cout<<*it<<endl;
      it++;
    }
    v.clear();
  }
  return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

int main()
{
//	cut here before submit 
//	freopen ("testcase.weight", "r", stdin );

	int w;
	while (scanf ("%d", &w ) != EOF ){
		vector<int> res; res.clear();
		for (int i = 1; i <= 512; i<<=1 ){
			 if (w & i ) res.push_back (i );
		} // end for
		rep (i, res.size() ){
			cout << res[i] << (i != res.size() - 1 ? ' ' : '\n' );
		} // end rep
	} // end while

	return 0;
}

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

int main(){
  int w;
  vector<int> v;

  while( !cin.eof() && cin>>w ){

    if( w>0 ){
      v.clear();
      for( int i=512;i>=1;i= i/2 ){
	//	cout << "i="<<i<<endl;
	if( w>=i ){
	  w-=i;
	v.push_back( i );
	}
      }

      for( int i=v.size()-1;i>0;--i )
	cout << v[i]<< " ";
      cout << v[0] << endl;
    }else
      cout << "0" << endl;
  }

  return 0;
}

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

int n;

int main() {
  while (1) {
    if (scanf("%d", &n) != 1) return 0;

    bool first = true;
    for (int i=0; i<10; i++) {
      if (n >> i & 1) {
        if (first) printf("%d", 1 << i);
        else printf(" %d", 1 << i);
        first = false;
      }
    }
    puts("");
  }
}

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<deque>
#include<list>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<map>
#include<queue>
#include<vector>
using namespace std;

//C++11

int main() {
	for (int w; cin >> w;) {
		string s = "";
		for (int i = 9; i >= 0; i--) {
			int a = pow(2, i);
			if (w / a) {
				if (s == "")
					s = to_string(a);
				else
					s = to_string(a) + " " + s;
				w -= a;
			}
		}
		cout << s << endl;
	}

	return 0;
}

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

C++: #include<iostream>

using namespace std;

int main()
{
	int weight;
	int i,j;
	int ans[10];
	
	for(;cin >> weight;)
	{
		for(i=0;i<10;i++)
			ans[i]=0;
			
		for(i=0;weight>0;weight/=2,i++)
		{
			ans[i]=weight%2;
		}
		
		if(ans[0]==1)
			cout << "1" ;
		
		for(i=1,j=2;i<10;i++,j*=2)
			if(ans[i]==1)
				cout << " " << j ;
				
		cout << endl;
	}
}

C++: #include <iostream>
using namespace std;
int main(){
	int n;
	int weight[10] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
	while(cin >> n){
		int t = 0;
		for(int i = 0; i < 10; i++){
			if(n % 2){
				if(t++) cout << " ";
				cout << weight[i];
			}
			n /= 2;
		}
		cout << endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
  int n;
  int used[10]={0,0,0,0,0,0,0,0,0,0};
  int omori[10] = {1,2,4,8,16,32,64,128,256,512};

  while( cin >> n){
    int i = 0;
    int f = 0;
    while(n){
      if(n >= omori[9-i]) {n -= omori[9-i];used[i] = omori[9-i];f++;}
      i++;
    }

    for(int j=9;j >= 0;j--){
      if(used[j] != 0 && f == 1){ cout << used[j] << endl;}
      if(used[j] != 0 && f != 1){ cout << used[j] << ' ' << flush;f--;}
    }
  }
  return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
// #define first first
// #define second se
using namespace std;
typedef pair<int, int> P;
typedef vector<int> vi;


signed main(){
    int n;
    while(cin >> n){
        vector<int> ans;
        rep(i, 0, 10){
            int t = 1 << i;
            if(n & t){
                ans. push_back(t);
            }
        }
        rep(i, 0, ans.size()){
            if(i != 0) cout << " ";
            cout << ans[i];
        }
        cout << endl;
    }
}

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

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

int main(){
    int input,count;
    bool is_use[10];

    while(1){

      cin >> input;

      if(cin.eof()){
        break;
      }

      for(int i=0;i<10;i++){
        is_use[i] = false;
      }

      count = 0;

      for(int i=9;i>=0;i--){
        if(input >= weight[i]){
          input -= weight[i];
          is_use[i] = true;
          count++;
          if(input == 0){
            break;
          }
        }
      }

      for(int i=0; i<10; i++){
        if(is_use[i]){
          count--;
          if(count==0){
            cout << weight[i] << endl;
          }
          else{
            cout << weight[i] << " ";
          }
        }
      }


    }


    return 0;
}