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 <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

#define all(c) (c).begin(), (c).end()
#define pb push_back
#define mp make_pair
#define EXIST(v,i) (find(all(v), i) != (v).end())
#define ERASE(v,i) (v).erase(remove(all(v), i), (v).end())
#define INDEX(v,i) (find(all(v), i) - (v).begin())
#define rep(i,n) for(int i = 0; i < (int)n; ++i)
#define debug(x) cerr << #x << " = " << (x) << endl;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

const int INF = 100000000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-10;

int weight[10] = {1, 1<<1, 1<<2, 1<<3, 1<<4, 1<<5, 1<<6, 1<<7, 1<<8, 1<<9};

int main() {
	sort(weight, weight + 10);
#if 0
	rep(i,10) cout << weight[i] << endl;
#endif
	for(int W; cin >> W;) {
		vector<int> ans;
		while(W) {
			int add = *(upper_bound(weight, weight + 10, W) - 1);
			//cout << add << W << endl;
			ans.pb(add);
			W -= add;
		}
		sort(all(ans));
		cout << ans[0];
		for(int i = 1, n = ans.size(); i < n; i++) {
			cout << " " << ans[i];
		}
		cout << endl;
	}
	return 0;
}

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

int main() 
{
  int wigth;
  cin >> wigth;
  int i = 1;
  bool flag = false;
  while (i <= 256) {
    if (wigth & i) {
      if (flag) cout << " ";
      cout << i;
      flag = true;
    }
    i *= 2;
  }
  cout << endl;

  return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    while (cin >> n) {
        vector<int> a;
        for (int i = 9; i >= 0; --i) {
            if (!n) break;
            if ((1 << i) <= n) {
                n -= 1 << i;
                a.push_back(1<<i);
            }
        }
        sort(a.begin(),a.end());
        for (int i = 0; i < a.size(); ++i) printf(i == a.size() - 1 ? "%d\n" : "%d ", a[i]);
    }
}

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

int main() {
	int n;
	while (cin >> n) {
		stack<int> s;
		for (int i = 9; i >= 0; i--) {
			if (n >= pow(2, i)) {
				n -= pow(2, i);
				s.push(pow(2, i));
			}
		}

		while (!s.empty()) {
			cout << s.top();
			s.pop();

			if (s.size() != 0) {
				cout << " ";
				continue;
			}
			cout << endl;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <complex>
#include <functional>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cctype>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define tr(c,i) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main()
{
	for(int n;cin>>n;){
		vi a;
		rep(i,10)
			if((1<<i)&n)
				a.push_back(1<<i);
		rep(i,a.size())
			cout<<(i==0?"":" ")<<a[i];
		cout<<endl;
	}
	
	return 0;
}

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

int main(void){
	int omori[10]={1,2,4,8,16,32,64,128,256,512},a;
	stack<int> st; 
	int kari;
	while(cin>>a){
		for(int i=9; 0<=i; i--)
		{
			if(a-omori[i]>-1)
			{
				st.push(omori[i]);
				a=a-omori[i];
			}
		}
		while(1)
		{
			if (st.empty())break;
			cout << st.top()<<" ";
			st.pop();
		}
		puts("");
	}
	return 0;
}

C++: #include<stdio.h>
int n;int i;bool f;int main(){while(scanf("%d",&n)!=EOF){f=true;for(i=0;i<10;i++)if(n>>i&1){if(f){printf("%d",1<<i);f=false;}else printf(" %d",1<<i);}printf("\n");}}

C++: // includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>

// macros
#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a); i<(b);++i)
#define rep(i, n) FOR(i, 0, n)

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;

// solve

int main(int argc, char const* argv[])
{
  int n;
  while(cin >> n){
    int tmp = n;
    vector<int> res;
    for(int i = 9; i >= 0; i--){
      if(tmp >= (1 << i)){
        res.pb((1 << i));
        tmp -= (1 << i);
      }
    }
    for(int i = res.size() - 1; i >= 0; i--){
      cout << res[i];
      if(i != 0)cout << " ";
      else cout << endl;
    }
  }
	return 0;
}

C++: #include <stdio.h>
int main(){
int n,temp;
while(scanf("%d",&n)!=EOF){
temp=1;
while(temp<=n)temp*=2;
temp/=2;
printf("%d",temp);
n-=temp;
while(n){
temp/=2;
n-=temp;
printf("%d",temp);
}
printf("\n");
}
}

C++: #include <iostream>
using namespace std;
int factorial(int n){
	if(n==0) return 1 ; else return(2*factorial(n-1)) ;
}
int main(){
	int x;
	while(cin>>x){
		int ans[10]={0};int ptr=0;int sum=0;
		for(int i=9;i>=0;i--){
			if(x==sum) break;
			int temp=factorial(i);
			if(x>=sum+temp) {ans[ptr++]=temp;sum+=temp;};
		};
		for(int i=ptr-1;i>=0;i--){
		if(i!=ptr-1) cout << ' ' ; cout << ans[i] ;
		};
		cout << '\n' ;
	};

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

using namespace std;

int main()
{
	int weight[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
	int gram;
	vector<int> ans;
	while(cin>>gram){
		for(int i=9;i>=0;i--){
			if(gram >= weight[i]){
				ans.push_back(i);
				gram -= weight[i];
			}
		}
		
		for(int i=ans.size()-1;i>=0;i--){
			cout<<weight[ ans[i] ];
			if(i != 0) cout<<' ';
		}
		cout<<endl;  
		
	}
	return 0;
}

C++: #include <stdio.h>

int quo,rem;

void divide_by_2(int x) {

  quo=x/2;
  rem=x%2;

}

int main(void) {

  int w;

  int count;

  while(scanf("%d",&w)!=EOF) {

    count=1;
    quo=w;

    while(quo>=0) {

      if(quo==0) {
	printf("\n");
	break;
      }

      divide_by_2(quo);
      
      if(rem==1) {
	
	printf("%d ",count);

      }

      count*=2;

    }

    //printf("\n");

  }

  return 0;

}

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

using namespace std;

int main()
{
	int weight[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
	int gram;
	vector<int> ans;
	while(cin>>gram){
		for(int i=9;i>=0;i--){
			if(gram >= weight[i]){
				ans.push_back(i);
				gram -= weight[i];
			}
		}
		
		for(int i=ans.size()-1;i>=0;i--){
			cout<<weight[ ans[i] ];
			if(i != 0) cout<<' ';
		}
		cout<<endl;  
		ans.clear();
	}
	return 0;
}