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 <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <sstream>
#include <istream>
#include <cmath>
#include <cstdio>

using namespace std;

#define vci vector<int>
#define vcs vector<string>
#define pb push_back
#define sz size()
#define mapii map<int, int>
#define mapci map<char, int>
#define mapsi map<string, int>
#define all(x) x.begin(), x.end()
#define minit(a, i) memset(a, i, sizeof(a));

#define for_(i, a, b) for (int i=(int)a; i<(int)b; i++)
#define for_d(i, a, b) for (int i=(int)a-1; i>=b; i--)
#define for_r(i, a, b, c) for (int i=(int)a; i<(int)b; i += c)
#define for_dr(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

typedef long long ll;

const int iINF = 2147483647;
const ll lINF = 9223372036854775807;

template <class T> inline void dbg(T t) { cout << t << endl; }





int main() {
	int in;
	while (cin >> in) {
		bitset<10> b(in);
		int hit = 0;
		for_(i, 0, 9) {
			if (b[i]) {
				if (hit>0) cout << " ";
				cout << pow(2, i);
				hit++;
			}
		}
		cout << endl;
	}
	
	return 0;
}

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

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

	while (cin >> n)
	{
		ans.clear();
		for (int i = 0; i < 10; ++i)
		{
			if (n >= weights[i])
			{
				n -= weights[i];
				ans.push_back(weights[i]);
			}
		}

		//??????????????????
		for (int i = ans.size() - 1; i >= 0; --i)
		{
			cout << ans[i];
			if (i != 0) cout << " ";
		}

		cout << endl;
	}

	return 0;
}

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

int main(){
	int n,a[10],b[10];
	a[0]=1;
	for(int i=1;i<10;i++){
		a[i]=2*a[i-1];
	}
	
	while(cin >> n){
		for(int i=0;i<10;i++){
			b[i]=0;
		}
		for(int i=9;n!=0;i--){
			if(n>=a[i]){
				n-=a[i];
				b[i]=a[i];
			}
		}
		for(int i=0;i<10;i++){
			if(b[i]!=0){
				cout << b[i] << " ";
			}
		}
		cout << "\n" ;
	}
		
		
		
return 0;
}

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";
		nn = 0;
	}
	
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
using namespace std;
int main(){
  vector<int> ar;
  int g[]={1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
  int n;
  while(cin >> n){
    for(int i=9;i>=0;i--){
      if(n>=g[i]){
	n -= g[i];
	ar.push_back( g[i] );
      }
    }
    for(int i=ar.size()-1;i>=0;i--){
      if(i != 0)cout << ar[i] << ' ';
      else cout << ar[i] << endl;
    }
  }
}

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

using namespace std;

int main()
{
	int w;

	while ( cin >> w )
	{
		set<int> weights;

		for ( int i = 9; 0 <= i; i-- )
		{
			int weight = pow( 2, i );

			if ( weight <= w )
			{
				w -= weight;
				weights.insert( weight );
			}
		}

		for ( set<int>::iterator it = weights.begin(); it != weights.end(); )
		{
			cout << *it;

			if ( ++it == weights.end() )
			{
				cout << endl;
			}
			else
			{
				cout << ' ';
			}
		}
	}
	
	return 0;
}

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

using namespace std;

int main()
{
	int weight[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
	int gram;
	vector<int> ans;
	while(cin>>gram){
		for(int i=9;i>=0;i--){
			if(gram >= weight[i]){
				ans.push_back(i);
				gram -= weight[i];
			}
		}
		
		for(size_t i=ans.size()-1;i>=0;i--){
			cout<<weight[ ans[i] ];
			if(i != 0) cout<<' ';
		}
		cout<<endl;
		ans.clear();
		
	}
	return 0;
}

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

int main(void){
    int n;
    int weight[10];
    bool flag;
    while(cin>>n){
        for(int i=0;i<10;i++){
            weight[i]=0;
        }
        flag=false;
        for(int i=9;i>=0;i--){
            if(pow(2,i)<=n){
                weight[i]=1;
                n-=pow(2,i);
            }
        }
        for(int i=0;i<10;i++){
            if(flag==false and weight[i]==1){
                flag=true;
                cout<<pow(2,i);
            }
            else if(weight[i]==1){
                cout<<" "<<pow(2,i);
            }
        }
        cout<<endl;
    }
}

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]);
            if (i + 1 < j)
                printf(" ");
        }
        puts("");
    }
    return 0;
}

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

int main(){
	int n;
	while(cin >> n){ 
		int weight[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
		for(int i = 9; i >= 0; i--){
			if(n >= pow(2, i)){
				n -= pow(2, i);
				weight[i] = 1;
			}
		}

		int i;
		for(i = 0; i < 10; i++){
			if(weight[i]){
				cout << pow(2, i);
				i++;
				break;
			}
		}
		for(; i < 10; i++){
			if(weight[i]){
				cout << " " << pow(2, i);
			}
		}
		cout << endl;
	}

	return 0;
}