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>
using namespace std;

int main() {
  int n;
  while (cin >> n) {
    bool f = false;
    for (int i = 0; i < 10; i++) {
      if (n & (1 << i)) {
        if (f) cout << " ";
        cout << (1 << i);
        f = true;
      }
    }
    cout << endl;
  }
}

C++: #include <stdio.h>

int main(void)
{
	int n;
	while (scanf("%d", &n) != EOF){
		int i;
		int flag;

		flag = 0;
		for (i = 0; i < 9; i++){
			if (((n >> i) & 1) != 0){
				if (flag == 0){
					printf("%d", 1 << i);
				}
				else {
					printf(" %d", 1 << i);
				}
				flag = 1;
			}
		}
		puts("");
	}
	return (0);
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  vector<int> m, ans;
  int n, x=1;
  m.push_back(x);
  for(int i=0; i<9; i++){
    x = x*2;
    m.push_back(x);
  }
  sort(m.begin(), m.end(), greater<int>());

  while(cin >> n){
    ans.clear();
    if(n > 1023) return 0;
    vector<int>::iterator it = m.begin();
    while( it != m.end() ){
      if(n - *it >= 0){
	n = n - *it;
	ans.push_back(*it);
      }
      ++it;
    }
    sort(ans.begin(), ans.end());
    vector<int>::iterator it2 = ans.begin();
    while( it2 != ans.end() ){
      cout << *it2 << " ";
      ++it2;
    }
    cout << endl;
    
  }
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int w,ans[10],wei[10],tot=0;
signed main(void){
		ios::sync_with_stdio(false);
		for(int i=0;i<10;i++)
			wei[i]=1<<i;
		while(cin>>w){
			for(int i=9;i>=0;i--)
				if(w>=wei[i]){
					ans[++tot]=wei[i];
					w-=wei[i];	
				}
			while(tot>1)
				cout<<ans[tot--]<<" ";
			cout<<ans[tot--]<<endl;
		}
}

C++: #include<iostream>
using namespace std;
int main()
{
	int n;
	while(cin>>n)
	{
		bool flag=false;
		for(int cnt = 1; cnt < 1<<10; cnt*=2)
		{
			if(cnt&n)
			{
				if(flag) cout<<" "<<cnt;
				else cout<<cnt;
				flag=true;
			}
		}
		cout<<endl;
	}
  return 0;
}

C++: #include<cstdio>
#include<vector>
using namespace std;
int main(){
    int n;
    while(~scanf("%d",&n)){
        vector<int> ar;
        for(int i=512;i>=1;i/=2){
            if(n>=i){
                ar.push_back(i);
                n-=i;
            }
        }
        for(int i=ar.size()-1;i>0;i--){
            printf("%d ",ar[i]);
        }
        printf("%d",ar[0]);
        printf("\n");
    }
}

C++: #include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <list>
#include <queue>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <math.h>

#define PREP(i, n) for(int i = 0; i <= n; i++)
#define MREP(i, n) for(int i = n; i >= 0; i--)

using namespace std;

int main(){
	int input;
	int tmp = 1, n = 9;
	bool fact[10];
	int trueCount = 0;
	
	PREP(i, n){
		tmp *= (!i) ? 1 : 2;
		fact[i] = false;
	}

	while(cin >> input){
		MREP(i, n){
			if(tmp <= input){
				input -= tmp;
				fact[i] = true;
				trueCount++;
			}
			if(input == 0) break;
			tmp /= 2;
		}
		tmp = 1;
		PREP(i, n){
			tmp *= (!i) ? 1 : 2;
			if(fact[i] == true){
				fact[i] = false;
				trueCount--;
				cout << tmp;
				if(trueCount) cout << " ";
			}
		}
		cout << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <math.h>

int sample;
std::vector<int> weight;
std::vector<int> answer;

void dfs(int i, std::vector<int> choice){
	int sum = 0;
	for(unsigned int j=0; j<choice.size(); j++){
		sum += choice[j];
	}
	if(sum==sample) { answer = choice; }
	if(i>9 || sum > sample) return;

	dfs(i+1, choice);
	choice.insert(choice.end(), weight[i]);
	dfs(i+1, choice);
}

int main(void){
	int i;
	for(i=0;i<10;i++){
		weight.insert(weight.end(), (int)pow(2.0, i));
	}
	while( (std::cin >> sample)!=NULL ){
		answer.clear();
		dfs(0,answer);
		for(unsigned int i=0; i<answer.size(); i++){
			std::cout << answer[i];
			if(i==answer.size()-1) { break; }
			else { std::cout << " "; }
		}
		std::cout << std::endl;
	}
	return 0;
}

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;

// 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 ((int)log2(n) == log2(n)) {
        ans.push_back(n);
        break;
      }
      n -= t;
      ans.push_back(t);
      t *= 2;
    }
    REP(i, ans.size()) {
      cout << ans[i] << SPACE;
    }
    cout << endl;
  }
	return 0;
}
// END   //////////////////////////////////////////////////////////////

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

int main() {
	int weight;

	while (cin >> weight) {
		vector<int> list;
		
		for (int i = 0; i < 10; i++) {
			int candidate = pow(2, 9 - i);

			if (weight >= candidate) {
				list.push_back(candidate);
				weight -= candidate;
			}
		}

		int max = list.size();

		for (int j = 0;j < max; j++) {
			if (j != 0)cout << " ";
			cout << list.at(max - j);
		}
		cout << endl;
	}
	
	return 0;
}