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 <cstdio>
#include <cstdlib>
#include <time.h>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <string>
#include <bitset>
using namespace std;
#define FOR(I,F,N) for(int I = F; I < (int)(N); I++)
#define rep(i, n) FOR(i, 0, n)
#define FIN(V) cout<<V<<endl
#define pb push_back
#define INF (1 << 30)
typedef pair<int, int> P;
typedef long long ll;
typedef priority_queue<int> pq;
int StrToInt(string);
string IntToStr(int);
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int main(void){
	int weight[10];
	weight[0] = 1;
	for(int i = 1; i < 10; i++){
		weight[i] = weight[i-1]*2;
	}
	int n;
	while(cin >> n){
		vector<int> ans;
		for(int i = 10; i >= 0; i--){
			if(weight[i] <= n){
				n -= weight[i];
				ans.pb(weight[i]);
			}
			if(n == 0)break;
		}
		for(int i = ans.size()-1; i > 0; i--){
			if(i == 1)cout << ans[i] << endl;
			else  cout << ans[i] << " ";
		}
	}


	return 0;
}



int StrToInt(string s){
	stringstream ss;
	ss << s;
	int val;
	ss >> val;
	return val;
}
string IntToStr(int i){
	stringstream ss;
	ss << i;
	return ss.str();
}

C++: #include <iostream>

using namespace std;

int main() {
    int n = 0;

    while (scanf("%d", &n) != EOF) {
        int t = 1;

        for (int i = 0; i < 10; ++i) {
            if ((n & t) == t) {
                if (i != 0) {
                    cout << " ";
                }
                cout << t;
            }

            t *= 2;
        }
        cout << endl;
    }

    return 0;
}

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

int baigaesi(int a){
  int n=1;
  if(a == 0)
    return 1;
  else
    for(int i=0;i<a;i++)
      n *= 2;
  return n;
}

int main(){

  int n;

  while(cin >> n){
    int i;
    std::vector<int> an;

    for(i=0;;i++){
      if(n==1){
	an.push_back(1);
	break;
      }
      an.push_back(n%2);
      n /= 2;
    }

    for(int j=0;j<=i;j++){
      if(an[j] == 1)
	cout << baigaesi(j);
      if(j==i) break;
      cout << ' ';
    }
    cout << endl;
  }

  return 0;
}

C++: #include <stdio.h>

int main(void)
{
int n;
while (scanf("%d", &n) != EOF){
int i;
if ((n & 1) != 0) {
printf("1");
}
for (i = 1; i < 20; i++)
{
if (((n >> i) & 1) != 0){
printf(" %d", 2 << i);
}
}
puts("");
}

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

int main() {
	short int n;
	while (cin >> n) {
		for(int i=1; n>0; i*=2,n/=2){
			if (n % 2 == 1) {
				cout << i;
				if (n > 1)
					cout << " ";
			}
		}
		cout << endl;
	}
	return 0;
}

C++: /*
	0031:Weight
*/
#include	<iostream>
#include	<cmath>

using namespace std;

int main(void) {
	while(1) {
		int w;
		int bundo[2][10] = { 0 };
		
		cin >> w;
		if( cin.eof() ) { break; }
		
		for(int i = 0; i < 10; i++) {
			bundo[0][i] = pow(2, i);
		}
		
		for(int i = 0; i < 10; i++) {
			if(w >= bundo[0][9 - i]) {
				w -= bundo[0][9 - i];
				bundo[1][9 - i] = 1;
			}
		}
		
		for(int i = 0; i < 9; i++) {
			if(bundo[1][i] == 1) {
				cout << bundo[0][i];
				for(int j = i + 1; j < 10; j++) {
					if(bundo[1][j] == 1) {
						cout << ' ';
						break;
					}
				}
			}
		}
		if(bundo[1][9] == 1) {
			cout << bundo[0][9];
		}
		cout << endl;
	}
	return 0;
}

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

int main(){
	int n;
	int tmp;
	while(cin >> n){
		vector<int> ans;
		for(int i = 9; i >= 0; i--){
			if(n - pow(2, i) >= 0){
				ans.push_back(pow(2, i));
				n -= pow(2, i);
			}
		}
		sort(ans.begin(), ans.end());
		for(int i = 0; i < ans.size() - 1; i++){
			cout << ans[i] << " ";
			tmp = i;
		}
		cout << ans[tmp + 1] << endl;
	}
}

C++: // 2012/10/28 Tazoe

#include <iostream>
using namespace std;

int main()
{
	while(true){
		int obj;
		cin >> obj;

		if(cin.eof())
			break;

		bool spc = false;

		for(int i=0; i<8; i++){
			if(obj%2==1){
				if(spc){
					cout << ' ';
				}

				int wgt = 1;
				for(int j=0; j<i; j++){
					wgt *= 2;
				}
				cout << wgt;

				spc = true;
			}

			obj /= 2;
		}

		cout << endl;
	}

	return 0;
}

C++: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <math.h>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(long i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const long double EPS = 1e-12;
const LL INF = 1e18;

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

int main(){
	int m;
	sort(g,g+10,greater<int>());
	while(cin>>m){
		vector<int>res;
		REP(i,10){
			if(m>=g[i]){
				m%=g[i];
				res.PB(g[i]);
			}
		}
		SORT(res);
		REP(i,SZ(res)){
			cout<<res[i];
			if(i!=SZ(res)-1)cout<<" ";
		}
		cout<<endl;
	}
	return 0;
}
/*

*/

C++: #include<iostream>
#include<bitset>
#include<cmath>
using namespace std;
int main(){
	int weight;
	cin>>weight;
	bitset<10> num(weight);
	int i;
	for(i=0;num[i]==0;++i);
	cout<<pow(2.0,i);
	for(++i;i<10;++i){
		if(num[i]==1)cout<<' '<<pow(2.0,i);
	}
	cout<<endl;
}

C++: #include <iostream>

using namespace std;

void output(int num){
  static bool flag=true;
  if(num == -1){
    flag=true;
    cout << endl;
  }  
  else if(flag){
    cout << num;
    flag=false;
  }
  else
    cout << " " << num;
}

void func(int weight){
  if(weight > 0){
    int buf=1;
    while(buf <= weight)
      buf <<= 1;
    buf >>=1;
    output(buf);
    func(weight-buf);
  }
}

int main(){
  int buf;
  while(cin >> buf){
    func(buf);
    output(-1);
  }
  return 0;
}