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++: 
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0031&lang=jp

#include <algorithm>
#include <iostream>
#include <vector>

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <math.h>

using namespace std;

//テ」ツδ榲」ツつッテ」ツδュテ・ツョツ堙ァツセツゥ
#define ALL(v) (v).begin(),(v).end()
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
#define REP(i,a,b) for(int i=(int)(a); i<(int)(b); ++i)
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define SORT(x) sort(begin(x),end(x))
#define SELECT_SORT(x, n) sort(begin(x),begin(x)+n)
#define SWAP(type, a, b) do {type tmp = a; a = b; b = tmp;} while (0)
#define rep_split(tok,a_str,re) for(char *tok = strtok((char *)a_str.c_str(),re); tok != NULL; tok = strtok(NULL,re))

//テ・ツョツ堙ヲツ閉ー
#define INF 2000000000000
#define MAX 10

//DEBUGテァツ板ィ
#define BAR() cout << "----------------------------" << endl;
#define DUMP(v) (cerr << #v << ": " << v << endl)
#define PRINT(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;


int binary(int x)
{
	int y,i,ans;
	ans=0;
	i=0;
	
	while (x>0)
	{
		y=x%2;
		ans=ans+y*pow(10,i);
		x=x/2;
		i=i+1;
	}
	return ans;
}

int main()
{
	vector<int> weight;
	
	weight.push_back(1);
	for(int i=1; i<10; ++i){
		weight.push_back(weight[i-1]*2);
	}
	
	int obj;
	string str;
	while(cin >> obj)
	{
		str = to_string(binary(obj));
		int i=0;
		for(char c : str){
			int num = (int)(c- '0');
			if(num){ cout << weight[i] << " "; }
			i++;
		}
		cout << endl;
	}
	
}

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

using namespace std;

int main()
{
  while (true) {
    int omori = 512, x;
    scanf("%d", &x);
    do {
      if (x % omori == 0) {
	x -= omori;
	cout << omori << " ";
	omori /= 2;
      }
    } while (x != 0);
  }
  return 0;
}
#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
  while (scanf("%d ", &x) == 1) {
    int omori = 512;
    while (x != 0) {
      if (x >= omori) {
	x -= omori;
	cout << omori << " ";
	omori /= 2;
      }
    }
    cout << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <cstdio>
using namespace std;
int n;
string bfs(int sum,string omori,int now){
    int weight[11] = {1,2,4,8,16,32,64,128,256,512};
    string weight2[11] = {"1","2","4","8","16","32","64","128","256","512"};
    if(sum==n)return omori;
    else if(now==10)return "Not_find";
    else if(sum>n)return "Not_find";
    
    string next = " ";
    if(omori=="")next = "";
    string result1 = bfs(sum+weight[now],omori+next+weight2[now],now+1);
    string result2 = bfs(sum, omori,now+1);
    if(result1!="Not_find")return result1;
    else return result2;
}

int main(){
    while (cin>>n) {
        string result = bfs(0,"",0);
        cout << result << endl;
    }
    return 0;
}

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

using namespace std;

int main(void){
  int w;
  int i=0;

  while(cin >> w){
	while(w > 1){
	  if(w%2){
		cout << pow(2, i) << " ";
	  }
	  w /= 2;
	  i++;
	}
	if(w) cout << pow(2,i) << endl;
	i=0;
  }

  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
 
typedef long long ll;
typedef pair<int, int> ii;

#define EPS 1e-8

int main(){
	
	int n;
	while(cin >> n){
		int w = 512;
		vector<bool> ans(10, false);
		for(int i = 9; i >= 0; i--){
			if(n >= w){
				ans[i] = true;
				n -= w;
			}
			w = w >> 1;
		}
		w = 1;
		bool f = false;
		rep(i, 10){
			if(ans[i]){
				if(f) cout << " ";
				cout << w;
				f = true;
			}
			w = w << 1;
		}
		cout << endl;
	}

	
	return 0;
}

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

int main(){
  int n, i, elm;
  int isFirst;

  while(cin>>n){
    elm=1; isFirst=1;
    for(i=0; i<10; i++){
      if(n%2==1){
        if(!isFirst) printf(" ");
        isFirst=0;
        printf("%d", elm);
      }
      n=n>>1; elm=elm<<1;
    }
    printf("\n");
  }

  return 0;
}

C++: #include <iostream>

int main()
{
	int weight;
	while (std::cin >> weight) {
		int scale_weight = 1;
		bool printed_any = false;
		while (weight > 0) {
			if ((weight & scale_weight) != 0) {
				weight -= scale_weight;
				if (printed_any) {
					std::cout << ' ';
				}
				std::cout << scale_weight;
				printed_any = true;
			}
			scale_weight *= 2;
		}
		std::cout << std::endl;
	}

	return 0;
}

C++: #include<iostream>
#include<vector>
using namespace std;
int main(){
  int n;
  while(cin >>n){
    vector<int> ans;
    for(int i=512; i>=1; i/=2){
      if(n>=i){
	n-=i;
	ans.push_back(i);
      }
    }
    for(int i=ans.size()-1; i>=0; i--){
      if(i!=ans.size()-1) cout <<" ";
      cout <<ans[i];
    }
    cout <<endl;
  }
  return 0;
}

C++: #include<stdio.h>
#include<math.h>

int output(int t,int a[10]);

int main()
{
	int n,t;
	while(scanf("%d",&n)!=EOF)
	{
		if(n>=1024||n<0)
		{
		}
		else
		{
			int a[10]={0};
			double x=0;
			t=0;

			for(x;x<10;x++)
			{
				int y;
				y=pow(2,x);

				if(n%(2*y)==y)
				{
					a[t]=y;
					t++;
					n-=y;
				}
				if(n==0)
				{
					for(int z=0;z<t;z++)
					{
						if(z==(t-1))
						{
							printf("%d\n",a[z]);
						}
						else
						{
							printf("%d ",a[z]);
						}
					}
					break;
				}
			}
		}
	}
}