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 <queue>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <string>
#include <algorithm>
#include <climits>
#include <utility>

#define PRINT(STR) cout << STR << endl;
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); (i)++)
#define REG(i, a, b) for (int (i) = ((int)(a)); (i) < ((int)(b)); i++)
#define ALL(V) (V).begin(), (V).end()
#define SPACE " "

typedef long long ll;

using namespace std;

int nextInt() { int n = -1; cin >> n; return n; }
double nextDouble() { double d = -1; cin >> d; return d; }
ll nextll() { ll n = -1; cin >> n; return n; }
string nextString() { string str; cin >> str; return str; }

int INF = 1LL << 25;
double EPS = 1e-9;
int numofbits(int bits)
{
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

// BEGIN //////////////////////////////////////////////////////////////
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    if (n == 0) {
      cout << 0 << endl;
      continue;
    }
    vector<int> ans;
    if (n % 2 == 1) {
      n -= 1;
      ans.push_back(1);
    }
    int t = 2;
    while (n) {
      if (numofbits(n) == 1) {
        ans.push_back(n);
        break;
      }
      n -= t;
      ans.push_back(t);
      t *= 2;
    }
    REP(i, ans.size() - 1) {
      cout << ans[i] << SPACE;
    }
    cout << ans[ans.size() - 1] << endl;
  }
	return 0;
}
// END   //////////////////////////////////////////////////////////////

C++: while g=gets
    g=g.chomp.to_i
    h=Array.new
    loop do
        break if(g==0)
        h<<g%2
        g=g/2
    end
    ans=[]
    h.each_with_index{|item,num| ans<<item*2**num if(item*2**num!=0)}
    puts ans.join(" ")
end

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

C++: #include <iostream>
#include <cmath>
#include <vector>
#include <cstdio>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define repp(i,r,n) for(int i=r;i<(int)n;i++)
using namespace std;
int in(){int x;cin>>x;return x;}
string s[10]={"1","2","4","8","16","32","64","128","256","512"};
int ss[10]={1,2,4,8,16,32,64,128,256,512};
string ans[1200];

void sss(string z,int y,int l)
{
	if(l==10)return ;
	ans[y]=z;
	sss(z,y,l+1);
	z+=" ";
	z+=s[l];
	y+=ss[l];
	sss(z,y,l+1);
	return ;

}


int main ()
{
	int a;
	sss("",0,0);	
	while(scanf("%d",&a)!=EOF)
	{
		cout<<ans[a]<<endl;
	}

	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	int n;
	int now[10]={0};
	int max=0;
	while(cin>>n){
		for(int i=512;i>=1;i/=2){
			if(n>=i){n-=i;now[max]=i;max++;}
		}
		while(max>=1){
			cout<<now[max-1]<<" ";
			max--;
		}
	}
}

C++: #include <cstdio>
#include <iostream>
#include <cstring>

using namespace std;

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


	while(cin >> n){
		bool one = 0;
		memset(count,0,sizeof(count));

		while(n != 0){
			int u = 9;
			while(n < weight[u])u--;
			n -= weight[u];
			count[u]++;
		}

		for(int i=0;i<10;i++){
			if(count[i] != 0){
				if(one)printf(" ");
				printf("%d",weight[i]);
				one = 1;
			}
		}
		printf("\n");
	}

}

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

int main(){
	int weight;
	while(cin >> weight){
		vector<int> vi;
		for(int i = 512; weight != 0; i = i / 2){
			if(weight >= i){
				weight -= i;
				vi.push_back(i);
			}
		}
		int size = vi.size();
		if(size > 0){
			cout << vi[size - 1];
			for(int i = size - 2; i >= 0; i--){
				cout << " " << vi[i];
			}
		}
		cout << endl;
	}
	return 0;
}

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

int pow(int number, int count) {
	if (count == 0 )
		return 1;
	return number * pow(number, count - 1);
}

int main(int argc, char *argv[]) {
	const int WeightNumber = 10;
	int weight[WeightNumber];
	// Make Weight
	for (int i = 0; i < 10; i++) {
		weight[i] = pow(2, i);
	}
	// Load
	int rcv;
	while (EOF != fscanf(stdin, "%d", &rcv)) {
		vector<int> answer;
		// Find Heaviest Weight
		int max_weight_ar_number;
		for (int i = 0; i < WeightNumber; i++) {
			if (weight[i] > rcv) {
				max_weight_ar_number = i;
				break;
			}
		}
		// Get Weight
		for (int i = max_weight_ar_number; i >= 0; i--) {
			if (rcv >= weight[i]) {
				rcv -= weight[i];
				answer.push_back(weight[i]);
			}
			if (rcv == 0) {
				break;
			}
		}
		// Print Result
		sort(answer.begin(), answer.end());
		const int loop_max = static_cast<int>(answer.size());
		for (int i = 0; i < loop_max ; i++) {
			if (i == loop_max - 1)
				printf("%d\n", answer[i]);
			else
				printf("%d ", answer[i]);
		}
	}
	
	return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
	int two[15]={},n,cnt=-1,check[15]={},last=0;
	for(int i=0;i<11;i++){
		two[i]=1;
		for(int j=0;j<i;j++)two[i]*=2;
	}
	while(cin>>n){
		cnt=0;
		last=0;
		for(int i=0;i<10;i++){
			check[i]=0;
			if(n<two[i+1]){
				cnt=i;
				break;
			}
		}
		for(int i=cnt;i>=0;i--){
			if(n%2==1)check[i]++;
			n/=2;
		}
		for(int i=0;i<10;i++)if(check[i]==1)last=i;
		for(int i=0;i<10;i++){
			if(check[i]==1&&last!=i)cout<<two[i]<<" ";	
			else if(i==last)cout<<two[i]<<endl;
		}
	}
	}

C++: #include <iostream>
#include <cstdio>
#include <string>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <ctime>
using namespace std;

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 999999999

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long int ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int const MOD = 1000000007;

int main() {
    int n;
    while(cin >> n) {
        vector<int> v;
        while(n != 0) {
            v.pb(n % 2);
            n /= 2;
        }
        //reverse(v.begin(), v.end());
        rep(i,0,v.size()) (v[i] * pow(2,i) == 0) ? : cout << v[i] * pow(2,i) << " ";
        cout << endl;
    }

    return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
    int M,scale[10];
    scale[0]=1;
    for(int i=1;i<10;i++){
    scale[i] = scale[i-1]*2;
    }
    while(cin >> M){
    int i=0;
    int count=2;
    while(true){
        if(M==0) break;
        if(M % count!=0){
            M -= scale[i];
            cout << scale[i] << " ";
        }
        i++;
        count *= 2;
    }
    cout << endl;
    }
}