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 <string>
#include <algorithm>
#include <utility>
#include <stack>
#include <functional>
#include <queue>
#include <cmath>

#define rep(i,j,k) for(int i=j;i<k;i++)
#define drep(n,m) for(int i=0;i<n;i++)for(int j=0;j<m;j++)
#define Sort(x) sort((x).begin(),(x).end())
#define fi first
#define se second
#define vi vector<int>
#define INF 1000000000
#define MOD 1000000009
#define pb push_back
#define mp make_pair
typedef long long ll;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;

ll gcd(ll a,ll b){
    if(a<b){
        int t=a;a=b;b=t;
    }
    int c=a%b;
    while(c!=0){
        a=b;
        b=c;
        c=a%b;
    }
    return b;
}

ll lcm(ll a,ll b){
    return a*b/gcd(a,b);
}

bool isPrime(int x){
    if(x==1)return false;
    if(x==2)return true;
    if(x%2==0)return false;
    for(int i=3;i<=sqrt(x);i+=2){
        if(x%i==0)return false;
    }
    return true;
}

int kaizyo(int x){
    if(x==1)return x;
    else return x*kaizyo(x-1);
}


int main() {
    int n;
    vi ans;
    vi v;
    rep(i,0,10)v.pb(pow(2,i));
    
    while(cin>>n){
        for(int i=9;i>=0;i--){
            if(n>=v[i]){
                n-=v[i];
                ans.pb(v[i]);
            }
        }
    
        for(int i=ans.size()-1;i>=0;i--){
            if(i==0)cout<<ans[i];
            else cout<<ans[i]<<" ";
        }
        cout<<endl;
        ans.clear();
    }
  
    return 0;
}

C++:  
 #include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 
 using namespace std;
 
 int arr[10]={1,2,4,8,16,32,64,128,256,512}; 
  
 int main()
 {
   int N;
   while(cin>>N)
   {
     int count=0;
     int num[10]={0};
     while(N)
     {
       num[count++]=N%2;
       N/=2;        
     }      
     for(int i=0;i<count-1;i++)
     {
       if(num[i]) cout<<arr[i]<<" ";
     }
     if(num[count-1]) cout<<arr[count-1]<<endl;
     else cout<<endl;           
   }
   //while(1);     
   return 0;  
 }

C++: #include<iostream>
using namespace std;
int weight[10]={1,2,4,8,16,32,64,128,256,512,};
bool weightFlag[10];
int main(){
    int n,dummy=0;
    while(cin>>n){
        if(n>=weight[9]){
            n-=weight[9];
            weightFlag[9]=true;
        }
        if(n>=weight[8]){
            n-=weight[8];
            weightFlag[8]=true;
        }
        if(n>=weight[7]){
            n-=weight[7];
            weightFlag[7]=true;
        }
        if(n>=weight[6]){
            n-=weight[6];
            weightFlag[6]=true;
        }
        if(n>=weight[6]){
            n-=weight[6];
            weightFlag[6]=true;
        }
        if(n>=weight[5]){
            n-=weight[5];
            weightFlag[5]=true;
        }
        if(n>=weight[4]){
            n-=weight[4];
            weightFlag[4]=true;
        }
        if(n>=weight[3]){
            n-=weight[3];
            weightFlag[3]=true;
        }
        if(n>=weight[2]){
            n-=weight[2];
            weightFlag[2]=true;
        }
        if(n>=weight[1]){
            n-=weight[1];
            weightFlag[1]=true;
        }
        if(n>=weight[0]){
            n-=weight[0];
            weightFlag[0]=true;
        }
        for(int i=0;i<10;i++){
            if(weightFlag[i]){
                cout<<weight[i];
                if(i!=9){
                    cout<<' ';
                }
            }
        }
        cout<<endl;
        for(int i=0;i<10;i++) weightFlag[i]=false;
    }
    return 0;
}

C++: #include<iostream>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<sstream>
#include<algorithm>
#include<map>
#include<complex>
using namespace std;


#define li			long long int
#define rep(i,to)	for(int i=0;i<((int)(to));i++)
#define repp(i,start,to)	for(int i=(int)(start);i<((int)(to));i++)
#define pb			push_back
#define sz(v)		((li)(v).size())
#define bgn(v)		((v).begin())
#define eend(v)		((v).end())
#define allof(v)	(v).begin(), (v).end()
#define dodp(v,n)		memset(v,(li)n,sizeof(v))
#define bit(n)		(1ll<<(li)(n))
#define mp(a,b)		make_pair(a,b)
#define rin	rep(i,n)
#define EPS 1e-10
#define ETOL 1e-8
#define MOD 1000000007
#define p2(a,b)		cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)		cout<<a<<"\t"<<b<<"\t"<<c<<endl


int main(){
	
	li a;
	while(cin>>a){
		bool omori[10]={false};
		li div=512;
		li now=9;
		while(a>0){
			//p2(a,div);
			if(a>=div){
				a-=div;
				omori[now]++;
			}
			div/=2;
			now--;
		}
		li w=1;
		rep(i,10){
			if(omori[i])cout<<w<<" ";
			w*=2;
		}
		puts("");
	}
	
	
	return 0;
}

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

using namespace std;

int main(){

	int n;
	while(cin>>n){
		int mul=1;
		vector<int> v;
		while(n!=0){
			if(n%2==1){
				v.push_back(mul);
			}
			mul*=2;
			n/=2;
		}
		for(int i = 0; i < v.size(); i++){
			cout<<v[i];
			if(i!=v.size()-1)
				cout<<" ";
			else
				cout<<endl;
		}
	}

	return 0;
}

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

#define TRUE 1
#define FALSE 0

int use_num[10];

int get_input(void) {
    int i;
    std::cin >> i;
    if (std::cin.fail()) 
        exit(0);
    return i;
}

int power(int m, int n) {
    int acc = 1;
    for (int i = 0; i < n; i++) {
        acc *= m;
    }
    return acc;
}    

void solve(int weight) {
    for (int i = 9; i >= 0; i--) {
        if (power(2, i) > weight) {
            use_num[i] = FALSE;
        } else {
            use_num[i] = TRUE;
            weight -= power(2, i);
        }
    }
}

void output(void) {
    // find last TRUE elem
    int last;
    for (int i = 0; i <= 9; i++) {
        if (use_num[i] == TRUE) {
            last = i;
        }
    }

    for (int i = 0; i < last; i++) {
        if (use_num[i] != FALSE) {
            std::cout << power(2, i) << ' ';
        }
    }
    if (use_num[last] != FALSE) {
        std::cout << power(2, last);
    }
    std::cout << std::endl;
}

int main(void) {
    int weight;
    while (weight = get_input()) {
        solve(weight);
        output();
    }
    return 0;
}

C++: #include <iostream>

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

    int w;

    while (std::cin >> w) {
        for (int i = 0; i < 9; ++i) {
            int num = 1 << i;
            if (w & num) {
                w -= num;
                std::cout << num;

                if (w) {
                    std::cout << " ";
                }
            }
        }
        std::cout << std::endl;
    }

    return 0;
}

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