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 <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
using namespace std;

int main(){
	int n,a[10],b[10],k;
	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];
			}
		}
		k=0;
		for(int i=0;i<10;i++){
			
			if(b[i]!=0){
				if(k!=0){
					cout <<" ";
				}
				cout << b[i] ;
				k++;
			}
		}
		cout << "\n" ;
	}
		
		
		
return 0;
}

C++: #include <iostream>

using namespace std;
 
int main(){
  int n;
  while(cin >> n){
    int i = 1;
    bool f = true;
    while(i != 1024){
      if((n&i) != 0){
	if(f) f = false;
	else cout << " ";
	cout << i;
      }
      i <<= 1;
    }
    cout << endl;
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	int weight[10] = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 };
	int n;
	while( cin >> n, n ){
		int j = 0;
		int ans[10];
		for( int i = 9; i >= 0; i-- ){
			if( n == 0 ) break;
			if( n >= weight[i] ){
				n -= weight[i];
				ans[j++] = weight[i];
			}
		}
		for( int i = j - 1; i >= 0; i-- ){
			cout << ans[i] << ' ';
		}
		cout << endl;
	}
}

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

int main() {
  int x10=0;
  int x2=0;
  int k=0;
  int ans[10] = {0};

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

C++: #include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>

#define PI 3.14159265359

#define INF 1000000;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)

typedef long long ll;

using namespace std;


/*
class ElectronicPetEasy
{
public:
	string isDifficult(int st1, int p1, int t1, int st2, int p2, int t2)
	{
		
	}
};
*/




int main()
{
	int weight[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
	int n;
	set<int> weights;
	
	
	while (cin >> n)
	{
		for (int i=9; i>=0; i--)
		{
			if (n >= weight[i])
			{
				weights.insert(weight[i]);
				n -= weight[i];
			}
		}
		bool first_flag = true;
		set<int>::iterator it = weights.begin();
		while (it != weights.end())
		{
			if (first_flag)
			{
				cout << *it;
				first_flag = false;
			} else {
				cout << " " << *it;
			}
			it++;
		}
		cout << endl;
		weights.clear();
	}
	
	return 0;
}

C++: #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"


int main() {
	int N;
	while (cin >> N) {
		vector<int>anss;
		for (int i = 0; i < 100; ++i) {
			if (N % 2) {
				anss.push_back(1<<i);
			}
			N /= 2;
		}
		for (int i = 0; i < anss.size(); ++i) {
			cout << anss[i];
			if (i == anss.size() - 1)cout << endl;
			else cout << " ";
		}
	}
	return 0;
}

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

using namespace std;
 
int main(){
	int w[]={1,2,4,8,16,32,64,128,256,512};
	int n;

	while(scanf("%d",&n)!=EOF){
		int a[10]={0};
		int i=10, j=0;

		while(0<n&&0<=i){
			if(w[--i]<=n){
				a[i]=1;
				n-=w[i];
				++j;
			}
		}

		for(i=0,--j; i<10&&0<j; ++i,--j)
			if(a[i])	printf("%d ", w[i]);

		for(; i<10; ++i)
			if(a[i])	printf("%d\n", w[i]);
	}

    return 0;
}

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

int n;

int main(){
	while(cin >> n){
		for(int i = 0; i <= 9; i++){
			if(n & (1 << i)){
				int scale = 1;
				for(int j = 0; j < i; j++){
					scale *= 2;
				}
				cout << scale << " ";
			}
		}
		cout << '\b' << endl;
	}
	return 0;
}

C++: #include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>
#include <climits>
#include <map>

using namespace std;

#define reep(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reep(i,0,n)

typedef vector<int> vi;

int main()
{
	int w;
	while(scanf("%d", &w) != EOF){
		rep(i, 10){
			if(w&1){
				printf("%d", 1<<i);
				w >>= 1;
				if(w) printf(" ");
			}else
				w>>=1;
		}
		puts("");
	}

	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
  int n;
  while(cin >> n){

    int ans[1000];
    int p = 0;

    int m = n;
    for(int i = 2 ; i < m ; i*=2){
      if(i*2 > m)m = i;
    }

    for(int i = m ;i > 1; i/=2 ){
      if(n - i > 0 ){
	ans[p++] = i;
	n -= i;
      }
    }
  cout << 1;
  for(int i = p - 1 ; i >= 0 ; i-- ){
    cout << " " << ans[i];
  }
  cout << endl;

  }
  }

C++: #include <iostream>
#include <string.h>

using namespace std;
int weight[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
void solve()
{
	int a;
	while(cin >> a)
	{
		bool flag[10];
		memset(flag, 0, sizeof(bool)  * 10);
		for(int i = 9; i >= 0; --i)
		{
			if(a / weight[i])
			{
				flag[i] = true;
			}
			a %= weight[i];
		}
		for(int i = 0; i < 9; ++i)
		{
			if(flag[i])
			{
				cout << weight[i] << " ";
			}
		}
		if(flag[9])
		{
			cout << weight[9];
		}
		cout << endl;
	}
}

int main()
{
	solve();
	return(0);
}

C++: //53
#include<iostream>

using namespace std;

int main(){
  for(int n;cin>>n;){
    bool out=false;
    for(int i=0;i<=9;i++){
      if(n&1<<i){
	if(out){
	  cout<<' ';
	}
	out=true;
	cout<<(1<<i);
      }
    }
    cout<<endl;
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
 
int main() {
  int n,i,f;
  while(cin >> n) {
      f=0;
      for (i=1; i<513; i*=2) if ((n & i) !=0) {
          if (f==1) cout << ' '; else f=1;
          cout << i ;
      }
      cout << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<complex>
#include<map>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define EPS (1e-10)
using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef complex<double> P;

int main(){
  int n;
  while(cin>>n){
    int i = 1;
    while(i != 1024){
      if((n&i)!=0)
	printf("%d ",i);
      i <<= 1;
    }
    puts("");
  }
  return 0;
}

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

using namespace std;

int main(){
  vector<int> weightarray;
  int weight;
  while(cin>>weight){
    weightarray.push_back(weight);
  }
  for(auto weight:weightarray){
    bool first=true;
    for(int i=0;i<sizeof(weight)*8;i++){
      int bit=1<<i;
      if(weight&bit){
        if(!first)cout<<" ";
        first=false;
        cout<<bit;
      }
    }
    cout<<endl;
  }
}

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