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>

using namespace std;

void conv(int n, int a[10])
{
	for(int i=0;i<10;i++)
	{
		a[i]=n%2;
		n=n/2;
	}
}

int pow(int x, int n)
{
	int ans=1;
	for(int i=0;i<n;i++)
	{
		ans*=x;
	}
	return ans;
}

int main(void)
{
	int w;
	while(cin>>w)
	{
		int a[10];
		conv(w,a);
		int tmp=0;
		for(int i=0;i<10;i++)
		{	
			if(a[i]==1)
			{
				if(tmp!=0)
				{
					cout<<" ";
				}
				cout<<pow(2,i);
				tmp++;
			}
		}
		cout<<endl;
	}
}

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

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

int main()
{
    int in_data;
    while(cin >> in_data)
    {
        int gram_num = 0;
        bool is_used[10] = {};
        for(int i=9; i>=0; i--)
        {
            if(gram_num + WEIGHTS[i] <= in_data)
            {
                gram_num += WEIGHTS[i];
                is_used[i] = true;
            }
        }
        for(int i=0; i<9; i++)
        {
            if(is_used[i])
            {
                cout << WEIGHTS[i]  << " ";
            }
        }
        if(is_used[9])
        {
            cout << WEIGHTS[9];
        }
        cout << endl;
    }
    return 0;
}

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

using namespace std;

void solve();

int main() {

   solve();

   return 0;

}

/*void solve() {＃３

   vector<int> S;
   vector<int> T;
   int n;   //Sの個数
   int q;   //Tの個数
   int ans=0;
   int buf;

   cin >> n;

   for (int i = 0; i < n; i++) {
      
      cin >> buf;
      S.push_back(buf);

   }

   cin >> q;

   for (int i = 0; i < q; i++) {

      cin >> buf;
      T.push_back(buf);

   }

   //Sをソート

   sort(S.begin(),S.end());

   for (vector<int>::iterator i=T.begin();i<T.end();i++){  //Tの各値をSから探す。あったらans＋＋

      if(binary_search(S.begin(),S.end(),*i)){ans++;}

   }

   cout << ans << endl;

}*/

void solve() {

   int in;
   vector<int> input;
   vector<string> ans;
   int w[10];
   int now=0; //今何問目？
   char c=' ';
   string buf;

   for (int i = 0; i < 10; i++) {

      w[i]=(int)pow(2,i);

   }

   while (true) {

      getline(cin,buf);

      if(buf[0] == EOF) break;

   }


   for (vector<int>::iterator itr=input.begin();itr<input.end();itr++) {

      for (int i = 9; i >= 0; i--) {

         if (*itr > w[i]) {

            *itr-=w[i];
            ans[now]+=to_string(w[i]);
            ans[now]+=c;
         }

         ans[now].pop_back();       //ここ2行で整形
         ans[now].push_back('\n');

      }

      now++;

   }

   for (vector<string>::iterator itr = ans.begin(); itr < ans.end(); itr++) {

      cout << *itr;

   }

}

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


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

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

int main(){
	int div=512;
	int weight[10];
	int W;
	while(cin>>W){
      div=512;
		for(int i=0;i<10;i++){
			weight[i]=W/div;
            W=W%div;
			div=div/2;
		}
      int flag=0;
		for(int j=0;j<10;j++){
                      int a=1;
          if(weight[9-j]>0){

            for(int k=0;k<j;k++){
              a=a*2;
            }
            if(flag==1){cout<<" ";}
		cout <<a;
            flag=1;
		}

        }
 	cout<<endl;     
}
  return 0;
    }

C++: #include <iostream>

using namespace std;

int main()
{
    int input;
    const int weight[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
    bool check[10];

    while (cin >> input) {
        for (int i = 0; i < 10; i++)
            check[i] = false;

        int tmp = input;
        for (int i = 0; tmp != 0; i++) {
            if (tmp % 2)
                check[i] = true;
            tmp /= 2;
        }

        for (int i = 0; i < 10; i++)
            if (check[i])
                cout << weight[i] << " ";
        cout << "\b\n";
    }

    return 0;
}

C++: #include <iostream>

using namespace std;

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  while ( true )
  {
    bool  init = true;
    int   D;

    if ( !( cin >> D ) )  break ;

    for ( int mask = 1; mask <= 0x200; mask <<= 1 )
    {
      if ( D & mask )
      {
        if ( !init )
        {
          cout << " ";
        }
        cout << mask;
        init = false;
      }
    }
    cout << endl;
  }

  return ( 0 );
}

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

int input,i;


int main(){
	while(cin>>input){
		string ans("");
		while(1){
			if(input%2==0) ans.insert(ans.begin(),'0');
			else ans.insert(ans.begin(),'1');
			input/=2;
			if(input==0) break;
		}
		if(ans[ans.length()-1]=='1'){
			cout<<"1"<<" ";
		}
		//ans.pop_back();
		i=2;
		while(1){
			if(i==ans.length()+1) break;
			if(ans[ans.length()-i]=='1'&&i!=ans.length()){
				cout<<(int)pow(2.0,i)/2<<" ";
			}
			if(ans[ans.length()-i]=='1'&&i==ans.length()){
				cout<<(int)pow(2.0,i)/2;
			}
			//ans.pop_back();
			i++;
		}
		cout<<endl;
	}
	return 0;
}

C++: #include <stdio.h>
#include <stdlib.h>

int main(void)
{
	unsigned int n;
	char buf[256];
	int ans[10];
	
	
	while (fgets(buf, 256, stdin) != NULL){
		n = atoi(buf);
		
		int count = 0;
		for (int i = 0; i < 10; i++){
			if ((n & (1 << i)) != 0){
				ans[count++] = 1 << i;
			}
		}
		printf("%d", ans[0]);
		for (int i = 1; i < count; i++){
			printf(" %d", ans[i]);
		}
		puts("");
	}
	
	return (0);
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define For(i,a,b) for(int (i)=(a); (i)<(b); (i)++)

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

int main() {
    int n;
    while(cin >> n) {
        vector<int> needed;
        REP(i,10) {
            if (n / weights[i]) {
                needed.push_back(weights[i]);
                n %= weights[i];
            }
        }
        reverse(needed.begin(), needed.end());
        REP(i,needed.size()-1) {
            cout << needed[i] << " ";
        }
        cout << needed[needed.size()-1] << endl;
    }
    return 0;
}