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 <bitset>

using namespace std;


int main(int argc, char const* argv[])
{
	unsigned long weight;
	int count = 0;
	while( cin >> weight ){
		count = 0;
		bitset<16> a( weight );
		for( int i = 0;i < 10;i++ ){
			if( a[i] == 1 ){ cout << ( ( count == 0 ) ? "" : " " ) << ( 1 << i ); count++;}
		}
		cout << endl;
	}
	return 0;
}

C++: //AOJ 0031

#include<stdio.h>
#include<iostream>
#include<vector>

using namespace std;

int main(){

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

	int num;

	while(cin>>num){
		int tmp=0;
		for(int j=0;j<10;j++){

			if(num%2==1){
				if(tmp==0){
					printf("%d",data[j]);
					tmp++;
				}
				else{
					printf(" %d",data[j]);
				}
				num/=2;
			}

			printf("\n");
		}

	}
	return 0;
}

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

C++: #include <stdio.h>
#include <algorithm>
using namespace std;

int ans[101][10];

int pow(int a,int n){
	if(n <= 0){
		return 1;
	}
	return a * pow(a,n - 1);
}

int main(){
	int m;
	while(scanf("%d",&m) != EOF){
		for(int j = 0; j < 10; j++){
			if((m / pow(2,j)) % 2 == 1){
				printf("%d ",pow(2,j));
			}
		}
		printf("\n");
	}
	
	///////////////////////////////////
	//Sleep(200000);///////////////////// 提出するときは必ず外す！
	///////////////////////////////////
	return 0;

}

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

int main(void) {
  int weight[10];
  weight[0] = 1;
  for (int i = 1; i < 10; i++) {
    weight[i] = weight[i-1]*2;
  }

  int w;
  while (cin >> w) {
    vector<int> used_weight;
    int pos = 9;
    while (w > 0) {
      if (w - weight[pos] >= 0) {
        w -= weight[pos];
        used_weight.push_back(weight[pos]);
      }
      pos--;
    }

    for (int i = used_weight.size()-1; i >= 0; i--) {
      cout << used_weight[i] << (i?" ":"");
    }
    cout << endl;
  }

  return 0;
}

C++: #include <bits/stdc++.h>

#define SIZE 300005
#define MOD 1000000007LL
#define INF INT_MAX / 3
#define LLINF 1LL << 60
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,b,a) for(int i=b;i>=a;i--)
#define SET(a,c) memset(a,c,sizeof a)
#define FORALL(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define FOREACH(i,c) for(auto (i) : (c))
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
#define SQ(x) ((x)*(x))
using namespace std;
typedef long long ll;
typedef valarray<int> Array;
typedef pair<ll,ll> Pll;
typedef pair<int, int> Pii;
typedef pair<double, double> Pdd;
template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cout<<a[i];if(i==a.size()-1)cout<<endl;else cout<<" ";}}
int gcd(int a,int b){int c=max(a,b);int d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
int lcm(int a,int b){return a==0||b==0?0:a*b/gcd(a,b);}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int w;
  while (~scanf("%d",&w))
  {
    string str = "";
    FOR(i,0,9) if(w>>i & 1)
    {
      char tmp[256];
      sprintf(tmp,"%d ",1<<i);
      str += tmp;
    }
    str[str.size()-1] = '\n';
    printf("%s",str.c_str());
  }
  return 0;
}

C++: #include<cstdio>
bool first = true;
void write(int n){
  if(first){
    first=false;
    printf("%d",n);
  }else{
    printf(" %d",n);
  }
}
int main(){
  int n;
  while(scanf("%d",&n)>0){
    first = true;
    if(n&0x1)write(0x1);
    if(n&0x2)write(0x2);
    if(n&0x4)write(0x4);
    if(n&0x8)write(0x8);
    if(n&0x10)write(0x10);
    if(n&0x20)write(0x20);
    if(n&0x40)write(0x40);
    if(n&0x80)write(0x80);
    if(n&0x100)write(0x100);
    if(n&0x200)write(0x200);
    printf("\n");
  }
}

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

C++: #include <iostream>
using namespace std;
int main() {
    int n;
    while (cin >> n) {
        int d = 1;
        while (n != 0) {
            if (n & 1) {
                cout << d << " ";
            }
            n = n >> 1;
            d = d << 1;
        }
        cout << endl;
    }
    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n;
  while(cin >>n){
    bool f = false;
    for(int i=1; i<=512; i*=2){
      if(n%2){
	if(f){cout <<" ";}
	cout <<i;
	f = true;
      }
      n/=2;
    }
    cout <<endl;
  }
  return 0;
}

C++: /*
AizuOnline A0031
Weight
*/
#include <stdio.h>


main()
{
  int weight;
  int fundou;
  
  while(EOF !=scanf("%d",&weight))
    {  for(fundou=1;fundou <= 512;fundou <<= 1)
         if(weight & fundou)
           printf("%d ",fundou);
       printf("\n");
    }

return(0);
}

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]);
        }
        puts("");
    }
    return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main(){
	int n;
	while(cin>>n){
		int i=0, s=0;
		while(n){
			s+=(n%2)*pow(10, i);
			n/=2;
			i++;
		}
		i=0;
		while(s){
			if(s%10){
				if(s/10)	cout<<pow(2, i)<<" ";
				else	cout<<pow(2,i)<<endl;
			}
			s/=10;
			i++;
		}
	}
	return 0;
}

C++: #include <cstdio>
#include <algorithm>

using namespace std;

int main()
{
	int weight;
	int i;
	int a[8];
	int cu;
	int cnt = 0;

	while (scanf("%d", &weight) != EOF){
		for (i = 0; i < 8; i++) a[i] = 0;
		cnt = 0;
		cu = 512;
		i = 0;
		while (weight != 0){
			while (cu > weight) cu /= 2;
			a[i++] = cu;
			weight -= cu;
			cnt++;
		}
		sort(a, a + cnt);
		printf("%d", a[0]);
		for (i = 1; i < cnt; i++){
			printf(" %d", a[i]);
		}
		printf("\n");
	}

	return (0);
}