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<stdio.h>

int main(void)
{
	int wei[10]={1,2,4,8,16,32,64,128,256,512},kai[10];
	int w,i,j;
	while(scanf("%d",&w)!=EOF)
	{
		i=9;  j=0;
		while(0==0)
		{
			if(w-wei[i]>0){
				w-=wei[i];
				kai[j]=wei[i];
				j++;
			}
			else if(w-wei[i]==0){
				kai[j]=wei[i];
				for(i=j;i>0;i--)
					printf("%d ",kai[i]);
				printf("%d\n",kai[0]);
				break;
			}

			i--;
		}
	}
	return 0;
}

C++: #include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;

#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)
#define lengthof(x) (sizeof(x) / sizeof(*(x)))
#define FILL(ptr, value) FILL_((ptr), sizeof(ptr)/sizeof(value), (value))
template <typename T>
void FILL_(void * ptr, size_t size, T value){
  std::fill((T*)ptr, (T*)ptr+size, value);
}
//4方向ベクトル→↑←↓
int dx[] ={1,0,-1,0};
int dy[] ={0,-1,0,1};
int W;
int weights[10] ={1,2,4,8,16,32,64,128,256,512};
int main()
{
  while(cin>>W){
    int type[10]={0};
    for(int j = 10;j >=0;j--){
      if(W-weights[j] >=0){
	W -=weights[j];
	type[j] = 1;
      }
    }
      for(int i = 0;i <10;i++){
	if(type[i] ==1){
	  cout <<weights[i];
	  if(i !=9)
	    cout <<" ";
	}else if(i ==9)
	  cout <<endl;
      }
  }
  return 0;
}

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

using namespace std;

int main(void){
    int i,j,k,l;
    int n;
    int weight[10]={1,2,4,8,16,32,64,128,256,512};
    int weight_f[10];
    
    while(cin>>n){
    
    memset(weight_f,0,sizeof(weight_f));
    
    for(i=9;i>=0;i--){
        if(n-weight[i]>=0){
            n=n-weight[i];
            weight_f[i]=1;
        }
    }
    i=0;
    while(true){
        if(weight_f[i]==1){
            cout<<weight[i]<<flush;
        }
        i++;
        break;
    }
    for(j=i;j<10;j++){
        if(weight_f[j]==1){
            cout<<" "<<weight[j]<<flush;
        }
    }
    cout<<endl;
    }
    return(0);
}

C++: #include <iostream>
#include <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <sstream>
#include <istream>
#include <cmath>
#include <cstdio>

using namespace std;

#define vci vector<int>
#define vcs vector<string>
#define pb push_back
#define sz size()
#define mapii map<int, int>
#define mapci map<char, int>
#define mapsi map<string, int>
#define all(x) x.begin(), x.end()
#define minit(a, i) memset(a, i, sizeof(a));

#define for_(i, a, b) for (int i=(int)a; i<(int)b; i++)
#define for_d(i, a, b) for (int i=(int)a-1; i>=b; i--)
#define for_r(i, a, b, c) for (int i=(int)a; i<(int)b; i += c)
#define for_dr(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

typedef long long ll;

const int iINF = 2147483647;
const ll lINF = 9223372036854775807;

template <class T> inline void dbg(T t) { cout << t << endl; }





int main() {
	int in;
	while (cin >> in) {
		bitset<10> b(in);
		for_(i, 0, 10) if (b[i]) cout << pow(2, i) << " ";
		cout << endl;
	}
	
	return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

int n;
V vi;

int main(){
	while (cin >> n){
		for (int i = 9; i >= 0; i--){
			if (n >= pow(2, i)){
				n -= pow(2, i);
				vi.push_back(pow(2, i));
				if (n == 0)break;
			}
		}
		sort(ALL(vi));
		REP(i, vi.size()){
			cout << vi[i];
			if (i == vi.size() - 1)cout << endl;
			else cout << " ";
		}
		vi.clear();
	}
}

C++: #include <stddef.h>
#include <iostream>
#include <vector>
using namespace std;
int main() {
  int g;
  vector<int> v;
  while (cin >> g) {
    v.clear();
    for (int i = 0; i < 10; i++)
      if (g & (1 << i)) v.push_back(1 << i);
    cout << v[0];
    for (size_t i = 1; i < v.size(); i++)
      cout << ' ' << v[i];
    cout << endl;
  }
}

C++: #include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <string>
#include <map>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

int main(void)
{
    int h[10], w;
    vector<int> ans;
    rep(i, 10) {
        h[i] = pow(2.0, (double)i);
    }
    
    while (cin >> w) {
        ans.clear();
        for (int i = 9; i >= 0; i--) {
            if (w == 1) {
                ans.push_back(h[0]);
                break;
            }
            else if (h[i] <= w){
                ans.push_back(h[i]);
                w -= h[i];
            }
        }
        
        for (int i = (int)ans.size() - 1; i >= 0; i--) {
            cout << ans[i];
            i == 0 ? cout << endl : cout << " ";
        }
    }

    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
    int weight[11],n,co[11],a=0;
    for(int i=0;i<11;i++)weight[i]=exp2(i);
    while(cin>>n){
        for(int i=0;i<11;i++)co[i]=0;
        for(int i=10;i>=0;i--){
            if(n>=weight[i]){
                co[i]=1;
                n-=weight[i];
            }
        }
        for(int i=0;i<11;i++){
            if(co[i]==1&&a==0){
                cout<<weight[i];
                a=1;
            }
            else if(co[i]==1)cout<<" "<<weight[i];
        }
        cout<<endl;
        a=0;
    }
}

C++: #include<stdio.h>
int main()
{
	int n,i,l[16],j;
	while(scanf("%d",&n)!=EOF){
		j=0;
		for(i=1024;i>0;i/=2){
			if(i<=n){
				l[j]=i;
				n-=i;
				j++;
			}
		}
		for(i=j-1;i>=0;i--){
			printf("%d",l[i]);
			if(i==0){
				printf("\n");
			}else{
				printf(" ");
			}
		}
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main () {
  int w;

  while(cin >> w){
    bool space = false;

    for(int r = 0; r < 10; r++){
      if(w >> r & 1 == 1) {
        if(space)
          cout << ' ';
        else
          space = true;
        cout << (1 << r);
      }
    }

    cout << endl;
  }

}

C++: #include<bits/stdc++.h>
using namespace std;
int n;
int main() {
	while(cin>>n){
		for (int i = 0; i < 11; ++i) {
			if(n%2){
				if(i!=0){
					cout<<' ';
					cout<<pow(2,i);
				}else{
					cout<<pow(2,i);
				}
			}
			if(n==1)break;
			n=n/2;
		}
		cout<<endl;
	}
return 0;
}

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=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;
}