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 <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max() / 2;
const int NEG_INF = numeric_limits<int>::min() / 2;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  int g[10]={1,2,4,8,16,32,64,128,256,512};
  int n;
  while(cin>>n){
      std::vector<int> v;
      for(int i=9;i>=0;i--){
          if(n>=g[i]){
              v.push_back(g[i]);
              n-=g[i];
          }
      }
      sort(v.begin(),v.end());
      for(int i=0;i<(int)v.size();i++){
          if(i!=(int)v.size()-1) cout<<v[i]<<" ";
          else cout<<v[i]<<endl;
      }
  }
}

C++: #include <iostream>
using namespace std;
int main(){
  int n;
  while(cin >> n){
	int flag = 1;
	for(int i = 0;i < 10;i++){	  
	  if((n & (1<<i)) && flag){
		flag = 0;
		cout << (1<<i);
	  }else if((n & (1<<i)) && !flag){
		cout << " " << (1<<i);
	  }


	}
	cout << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(void){
	int a;
	int b=512;
	int c[10]={0};
	int d=0;
        while(cin>>a){

            int i=0;
            if (a>=512){
                a-=512;
                c[i]=512;
                i++;
            }
            if (a>=256){
                a-=256;
                c[i]=256;
                i++;
            }
            if (a>=128){
                a-=128;
                c[i]=128;
                i++;
            }
            if (a>=64){
                a-=64;
                c[i]=64;
                i++;
            }
            if (a>=32){
                a-=32;
                c[i]=32;
                i++;
            }
            if (a>=16){
                a-=16;
                c[i]=16;
                i++;
            }
            if (a>=8){
                a-=8;
                c[i]=8;
                i++;
            }
            if (a>=4){
                a-=4;
                c[i]=4;
                i++;
            }
            if (a>=2){
                a-=2;
                c[i]=2;
                i++;
            }
            if (a>=1){
                a-=1;
                c[i]=1;
                i++;
            }

            for(i-=1;i>=0;i--){
                cout<<c[i]<<" ";

            }
            cout<<endl;
        }
	return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define gt first
#define gc second.first
#define gr second.second
#define MOD (1000000007ll)
#define l_ength size
#define PI 3.14159265358979

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

int main(void){
	int n,g;
	while(scanf("%d",&n)!=EOF){
		g = 1;
		while(n > 0){
			if(n%2){
				cout << g << ((n/2)?" ":"\n");
			}
			n /= 2;
			g *= 2;
		}
	}
}

C++: #include <iostream>
using namespace std;
int main(){
  int n;
  while(cin >> n){

    int ans[1000];
    int p = 0;

    int m = n;
    for(int i = 2 ; i < m ; i*=2){
      if(i*2 > m)m = i;
    }

    for(int i = m ;i > 0; i/=2 ){
      if(n - i >= 0 ){
	ans[p++] = i;
	n -= i;
      }
    }
  for(int i = p - 1 ; i > 0 ; i-- ){
    cout << ans[i] << " ";
  }
  cout <<ans[0]<< endl;

  }
  }

C++: #include<iostream>
#include<string>
#include<cmath>
#include<bitset>
int main(){
    int t; 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))<<" "; num/=10;}
    std::cout<<std::endl;
}

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

// ?????¬???????????¬??????
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// ???
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long double> vld;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T> int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F> int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T> void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C> void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U> void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U> void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C> void reverse(C& c) { reverse(ALL(c)); }
template<typename C> void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred> void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// ?????°
#pragma region CONST_VAL
constexpr int PI = (2*acos(0.0));
constexpr int EPS = (1e-9);
constexpr int MOD = (int)(1e9+7);
constexpr int INF = 100000000;
#pragma endregion


int main()
{
    int data[10];
    data[0] = 1;
    REP(i,1,10) data[i] = data[i-1] * 2;
    while(true) {
        int n;
        cin >>n;
        if(n==EOF) break;

        bool check[10];
        rep(i, 10) check[i] = false;
        for(int i=9; i>=0; --i) {
            if(n>=data[i]) {
                n -= data[i];
                check[i] = true;
            }
        }

        bool check2 = false;
        rep(i, 10) {
            if(check[i]) {
                if(check2) cout << " ";
                else check2 = true;
                cout << data[i];
            }
        }
        cout << endl;
    }
    return 0;
}

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

int main(){
    int n;
    int i;
    int j;
    while(cin >> n){
        i = 1;
        for(j=0;j<10;j++){
            if(n & 1){
                cout << i;
                i <<= 1;
                n >>= 1;
                break;
            }
            i <<= 1;
            n >>= 1;
        }
        for(j=j;j<10;j++){
            if(n & 1){
                cout << " ";
                cout << i;
            }
            i <<= 1;
            n >>= 1;
        }
        cout << endl;
    }
    return 0;
}

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

using namespace std;

int main(){
  int n;
  while(cin >> n){
    if(cin.eof())break;
    vector<int> ar;
    int flg = 0;   
    for(int i = 512 ; i>=1; i/=2){

      if(n >= i&&flg == 0){
	cout << i;
	flg = 1;
	n-=i; 
	continue;
      }
      if(n >= i&&flg == 1){
	cout <<" "<< i;
	n-=i; 
      }
    }
    cout << endl;
  }
  return 0;
}