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 w;
	while (cin >> w) {
		bool first_output = true;
		for (int weight = 1; w>0; w>>=1, weight<<=1) {
			if ((w&1)==1) {
				if (!first_output) cout << " ";
				cout << weight;
				first_output = false;
			}
		}
		cout << endl;
	}
	
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	int n;
	int now[10]={0};
	int max=0;
	bool brank=false;
	while(cin>>n){
		for(int i=512;i>=1;i/=2){
			if(n>=i){n-=i;now[max]=i;max++;}
		}
		while(max>=1){
			if(brank==true)cout<<" ";
			if(brank==false)brank=true;
			cout<<now[max-1];
			max--;
		}
		brank=false;
	}
}

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

int main(){
	int n;
	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(); i++){
			cout << ans[i] << " ";
		}
		cout << endl;
	}
}

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

int main(){
    int n;
    while(cin>>n,n!=EOF){
        vector<int>vec;
        for(int i=512;i>0;i=i>>1){
            if(n>=i){
                n-=i;
                vec.push_back(i);
            }
        }
        for(int i=0;i<vec.size();i++)
            cout<<vec[vec.size()-1-i]<<" ";
        cout<<endl;
    }
    return 0;
}

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

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

using namespace std;

int main() {
    int n, w[] = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 };
    while (cin >> n) {
        int s = 0;
        vector<int> vec;
        while (n > 0) {
            if (n % 2 == 1) {
                vec.push_back(w[s]);
            }
            n /= 2;
            s++;
        }
        for (int i = 0; i < vec.size() - 1; i++) {
            cout << vec[i] << " ";
        }
        cout << vec[vec.size() - 1] << endl;
    }

    return 0;
}

C++: #include<iostream>
#include<string>
#include<cmath>
#include<bitset>
int main(){
    int t;
    while(std::cin>>t){
    std::bitset<11> value(t);
    std::string s=value.to_string();
    for(int i=0;i<s.size();i++){if(s[0]=='0') s.erase(s.begin()); else break;}
    int num=std::stoi(s);
        for(int i=0;i<s.size();i++){if(num%10){std::cout<<pow(2,(double)(i)); if(i!=s.size()-1)std::cout<<" ";} num/=10;}
    std::cout<<std::endl;
    }
}

C++: #include<iostream>
#include<algorithm>
#include<functional>

using namespace std;

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

bool tukauka[10];//大きい順

int n,owari;
int main(){
	while(cin >> n){
		for(int i = 0;i < 10; i++) {
			if(n >= omosa[i])tukauka[i] = true, n -= omosa[i],owari=i;
		}
		for(int i = 0; i < 10; i++) {
			if(tukauka[9 - i]&&i==owari) {
				cout << omosa[9 - i] ;
			}else {
				cout<< omosa [9 - i]<<" ";
			}
		}
		cout << endl;
		for(int i=0;i<10;i++)tukauka[i]=false;
	}
	return 0;
}

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

int main() {
	int m;
	vector<int> M,N;
	vector<vector<int>> POW;
	while (cin >> m) 
		M.push_back(m);
	for (int i = 0; i < M.size(); i++) {
		int mi = M[i];
		for (int j = 0; j < 10; j++) {
			if (pow(2, j) <= mi && mi < pow(2, j + 1)) {
				N.push_back(j); mi -= pow(2, j);
				if (mi == 0)break;
				else j = -1;
			}
		}
		sort(N.begin(), N.end());
		POW.push_back(N); N.clear();
	}
	for (int i = 0; i < POW.size(); i++) {
		for (int j = 0; j < POW[i].size(); j++) {
			if (j != POW[i].size() - 1)cout << pow(2, POW[i][j]) << " ";
			else cout << pow(2,POW[i][j]) << endl;
		}
	}
	return 0;
}

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

int
main(void)
{
	char line[80];

	int w;

	int f[10];
	int u[10];

	int k = 512;
	for (int& d : f) {
		d = k;
		k >>= 1;
	}

	while (true) {
		if (fgets(line, sizeof line, stdin) == NULL) {
			break;
		}
		if (sscanf(line, "%d", &w) != 1) {
			break;
		}

		int p;
		for (p = 0; p < 10; p++) {
			if (w >= f[p]) {
				break;
			}
		}

		memset(u, 0, sizeof u);

		int t = f[p];
		u[p] = 1;
		p++;

		while (true) {
			if (t == w) {
				break;
			} else if (t > w) {
				t -= f[p-1];
				u[p-1] = 0;
			}

			t += f[p];
			u[p] = 1;
			p++;
		}

		const char* sp = "";
		for (int i = 9; i >= 0; i--) {
			if (u[i]) {
				printf("%s%d", sp, f[i]);
				if (*sp == 0) {
					sp = " ";
				}
			}
		}
		printf("\n");

	}

	return 0;
}