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++: //0031
//include-------------------------------------
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<stack>

using namespace std;

//typedef--------------------------------------
typedef vector<int> VI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

#define MP make_pair

//repetition-----------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)

//constant-------------------------------------
const double PI = acos(-1.0);

//cout,cin-------------------------------------
#define COUT(x) cout<<(x)<<endl;
#define CIN(x) cin>>(x);

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

int main(){

	int w;
	while (1){
		stack <int> st;
		CIN(w)
		for (int i = 10; i >= 0; i--){
			if (w >= weight[i]) {
				st.push(weight[i]);
				w -= weight[i];
			}
		}

		while (st.top()!=0){
			cout << st.top();
			st.pop();
			if (st.size()  > 1) cout << " ";
		}
		cout << endl;
	}

	return 0;

}

C++: #include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int W;
	int C[10]={1,2,4,8,16,32,64,128,256,512};
	while(cin>>W){
		int V=W;
		int digit=0,output=0;
		while(V){
			if(V&1){
				if(output++) cout << ' ';
				cout << C[digit];
			}
			V>>=1;
			digit++;
		}
		cout << endl;
	}
	return 0;
}

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

int main(){
int n;
vector<int>v;
while(cin>>n)
{
	if(n%2==1){
		n-=1;
		v.push_back(1);
		}
		
	if(n%4==2){
		n-=2;
		v.push_back(2);
		}	
		
	if(n%8==4){
		n-=4;
		v.push_back(4);
		}	
		
	if(n%16==8){
		n-=8;
		v.push_back(8);
		}	
		
	if(n%32==16){
		n-=16;
		v.push_back(16);
		}	
		
	if(n%64==32){
		n-=32;
		v.push_back(32);
		}	
		
	if(n%128==64){
		n-=64;
		v.push_back(64);
		}	
		
	if(n%256==128){
		n-=128;
		v.push_back(128);
		}	
		
	if(n%512==256){
		n-=256;
		v.push_back(256);
		}	
		
	if(n%1024==512){
		n-=512;
		v.push_back(512);
		}	
		int a=v.size();
		for(int i=0;i<a;i++){
			cout<<v[i];
			if(i==a-1){
				cout<<endl;
				}
			else{
				cout<<" ";
				}	
			}
			v.erase(v.begin(),v.end());
	}
	return 0;
		}

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

using namespace std;

int main(){
	int n;
	while(cin >> n){
		bool flag = true;
		for(int i = 1; i <= 512; i *= 2){
			if(n & i){
				if(flag){
					cout << i;
					flag = false;
				}
				else cout << " " << i;
			}
		}
		cout << endl;
	}
	return 0;
}

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

int main(){
	unsigned o;

	while ( cin >> o ){
		for ( int i = 0; i < 10; ++i ){
			if ( o & 1 << i ){
				cout << ( 1 << i ) << " ";
			}
		}
		cout << endl;
	}

	return 0;
}

C++: import std.stdio;
import std.array;
import std.conv;
import std.algorithm;
import std.math;
void main() {
	string s;
	while( (s=readln()).length != 0 ){
		string[] input = split(s);
		int a = to!int(input[0]);
		for(int i=0;i<10;i++){
			if(a%2==1) write(pow(2,i)," ");
			a/=2;
		}
			writeln();
	}
}

C++: #include <iostream>

using namespace std;
int weight[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
void solve()
{
	int a;
	while(cin >> a)
	{
		bool flag[10];
		memset(flag, 0, sizeof(bool)  * 10);
		for(int i = 9; i >= 0; --i)
		{
			if(a / weight[i])
			{
				flag[i] = true;
			}
			a %= weight[i];
		}
		for(int i = 0; i < 9; ++i)
		{
			if(flag[i])
			{
				cout << weight[i] << " ";
			}
		}
		if(flag[9])
		{
			cout << weight[9];
		}
		cout << endl;
	}
}

int main()
{
	solve();
	return(0);
}

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

int main() {
    int month, day;
    string weekday[7] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };
    while (cin >> month >> day) {     
        time_t rawtime;
        struct tm * timeinfo;

        time(&rawtime);
        timeinfo = localtime(&rawtime);

        timeinfo->tm_year = 2004-1900;
        timeinfo->tm_mon = month - 1;
        timeinfo->tm_mday = day;
        
        mktime(timeinfo);

        cout << weekday[timeinfo->tm_wday] << endl;
    }
    return 0;
}

C++: #include <stdio.h>

#define SIZE 10
int main(void){
    int w;
    int tmp;
    int first;

    while (scanf("%d", &w)!= EOF){
        tmp = 1;
        first = 1;
        while (w){
            if (w & 1){
                printf(first?"%d":" %d", tmp);
                first = 0;
            }
            tmp <<= 1;
            w >>= 1;
        }
        printf("\n");
    }

    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;
  }
  if (flag) cout << " ";
  if (wigth & i) cout << i << endl;
  else cout << endl;

  return 0;
}

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


int main(){
	int weight[11];
	weight[1] = 1;
	for(int i = 2;i<=10;i++)weight[i]=2*weight[i-1];
	while(true)
	{
	int object;
	cin >> object;
	for(int i =1;i <=10;i++){
		if((object % 2)==1)
			{
			cout << weight[i] ;
			if( i != 10 ) cout << " ";
			}
		object = object /2;
		}
	cout << endl;
	if (cin.eof())break;
	}
	
	return 0;
}

C++: #include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define LOOP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define MP make_pair
#define FR first
#define SC second
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;


signed main(){
  int n;
  while(cin>>n){
    vector<int> x={1,2,4,8,16,32,64,128,256,512};
    vector<int> ans;
    while(n){
      int tmp;
      for(int i=0;i<10;i++){
        if(n>=x[i])tmp=x[i];
      }
      n-=tmp;
      ans.PB(tmp);
    }
    for(int i=ans.size()-1;i>=0;i--){
      cout<<ans[i]<<' ';
    }
    cout<<endl;
  }
  return 0;
}

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

int main()
{
	int N;
	while (cin >> N) {
		vector<int> res;
		for (int i = 0; i < 10; i++) {
			if (N & (1 << i)) {
				res.push_back(1 << i);
			}
		}
		for (int i = 0; i < (int)res.size(); i++) {
			cout << res[i] << " \n"[i + 1 == (int)res.size()];
		}
	}
	return 0;
}