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 <cmath>
#include <vector>
#include <cstdio>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define repp(i,r,n) for(int i=r;i<(int)n;i++)
using namespace std;
int in(){int x;cin>>x;return x;}

string s[10]={"1","2","4","8","16","32","64","128","256","512"};
int ss[10]={1,2,4,8,16,32,64,128,256,512};

string ans[1200];
void sss(string z,int y,int l)
{
	ans[y]=z;
	if(l==10)return ;
	sss(z,y,l+1);
	if(z!="")z+=" ";
	z+=s[l];
	y+=ss[l];
	sss(z,y,l+1);
	return ;

}


int main ()
{
	int a;
	sss("",0,0);	
	while(scanf("%d",&a)!=EOF)
	{
		cout<<ans[a]<<endl;
	}

	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
using namespace std;
int main(){
  vector<int> ar;
  int g[]={1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
  int n;
  while(cin >> n){
    for(int i=9;i>=0;i--){
      if(n>=g[i]){
	n -= g[i];
	ar.push_back( g[i] );
      }
    }
    for(int i=ar.size()-1;i>=0;i--){
      if(i != 0)cout << ar[i] << ' ';
      else cout << ar[i] << endl;
    }
    ar.clear();
  }
}

C++: #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
int main(){
    int n;
    while(cin>>n){
        for(int i=0;n;i++){
            if(n&1)
                cout<<pow(2,i)<<(n>>1?' ':'\n');
            // cout<<i<<" "<<n<<endl;
            n>>=1;
            // cout<<i<<" "<<n<<endl;
        }
    }
    return 0;
}

C++: #include <cstdio>
#include <algorithm>

using namespace std;

int main()
{
	int n, c;
	int a[10] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 516};
	int b[10];
	
	while (scanf("%d", &n) != EOF){
		c = 0;
		for (int i = 9; 0 <= i; i--){
			if (n >= a[i]){
				n -= a[i];
				b[c] = a[i];
				c++;
			}
		}
		reverse(b, b + c);
		for (int i = 0; i < c; i++){
			printf("%d", b[i]);
			if (i < c - 1){
				printf(" ");
			}
		}
		
		printf("\n");
	}
	return (0);
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
	int n,h;
	while(cin>>n){
		h=1;
	for(int i=0;i<10;i++){
		if(n%(h*2)!=0){
			n-=h;
			cout<<h<<" ";
		}
		h*=2;
	}
	cout<<endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
	int W;
	while(cin>>W)
	{
		for(int i=1;i<=W;i*=2)
		{
			if(W/i%2==1)
			{
				cout<<' '<<i;
			}
		}
		cout<<endl;
	}
	return 0;
}

C++: n,k;main(a){for(;~scanf("%d",&n);puts())for(k=1;n;n^=a)k=!printf(k+" %d",a=n&-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<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<cassert>
using namespace std;
int inf = 1000000000;


int main(void) {

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

  }


  return 0;
}


// EOF

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

int main()
{
    int n;
	int w[10]={1,2,4,8,16,32,64,128,256,512};
	int start;
	while(1){
		cin >> n;
		if(cin.eof()){break;}
		int	flag[10]={0};
		start=0;

		// n - w[i] で引けた配列番号を flag[i] で記憶

		for(int i=9 ; i>=0; i--){
			if(n>=w[i]){
				n-=w[i];
				flag[i]++;
				start=i;
			}
		}

		// flag[i] が 0 でなければ w[i] を表示

		cout << w[start];
		for(int i=start+1; i<=9 ; i++){
			if(flag[i]!=0){
				cout << " " << w[i];
			}
		}
		
		cout << endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main()
{
	const int b[10] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
	int w, i, j, t, a[10];
	while (cin >> w)
	{
		if (cin.eof()) return 0;
		for (i = 9, j = 0, t = 0; i >= 0; i--)
		{
			if (w >= t + b[i])
			{
				a[j] = b[i];
				t += a[j];
				if (w == t + b[i])
					break;
				j++;
			}
		}
		for (i = j - 1; i > 0; i--)
			cout << a[i] << " ";
		cout << a[0] << endl;
	}

	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){
    if(cin.eof())
      break;
    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 <sstream>

using namespace std;

string IntToString(int number) {
	stringstream ss;
	ss << number;
	return ss.str();
}

int main(void) {
	int in;
	int omori[] = {512,256,128,64,32,16,8,4,2,1};
	int i;
	string ret;

	while(true) {
		cin >> in;
		if(cin.eof()) { break; }
		ret = "";
		for(i = 0; i < 10; i++) {
			if(omori[i] <= in) {
				in -= omori[i];
				ret = IntToString(omori[i]) + ((ret=="")?(""):(" ")) + ret;
			}
			if(in == 0) { break; }
		}
		cout << ret << endl;
	}

	return 0;
}

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

int main()
{
	int n, count = 0, sum = 1;
	int ans[100][9] = { 0 }, data[100] = { 0 }, ansdata[100] = {0};
	for (int a = 0; a <= 10; a++) {
		data[a+1] = sum;
		sum = sum * 2;
	}
	while (cin >> n) {
		int data2, count2 = 0;
		for (int a = 0; a <= 10; a++) {
			if (n < data[a + 1]) {
				sum = data[a];
				data2 = a;
				ans[count][count2] = a;
				count2++;
				break;
			}
		}
		for (int a = data2-1; a > 0; a--) {
			sum = sum + data[a];
			if (sum > n) {
				sum = sum - data[a];
			}
			else {
				ans[count][count2] = a;
				count2++;
			}
			if (sum == n) {
				break;
			}
		}
		ansdata[count] = count2;
		count++;
	}
	for (int a = 0; a < count; a++) {
		for (int b = ansdata[a]-1; b>=0; b--) {
			cout << data[ans[a][b]]<< " ";
		}
		cout << endl;
	}
	return 0;
}