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;

int main()
{
    int n;
    
    while(cin >> n)
    {
        int t = 1, c = 0;
        
        for(int i = 0; i < 20; i++)
        {
            if(n & t)
            {
                if(c++) { cout << ' '; }
                
                cout << t;
            }
            
            t *= 2;
        }
        
        cout << endl;
    }
    
    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n,wei[10],ka=1,temp,ba[10];
  for(int i=0;i<10;i++){
    wei[i]=ka;
    ka*=2;
  }
   while(cin>>n){
     temp=0;
    for(int i=0;i<10;i++){
      ba[i]=0;
    }
    for(int i=9;i>=0;i--){
      if(n!=0){
	if(n-wei[i]>=0){
	  n-=wei[i];
	  ba[i]=wei[i];
	}
      }if(n==0){
	break;
      }
    }
    for(int i=0;i<10;i++){
      if(ba[i]!=0){
	temp++;
      }
    }
    for(int i=0;i<10;i++){
      if(ba[i]!=0){
	cout<<ba[i];
	if(temp>0){
	  cout<<" ";
	  temp--;
	}
      }
    }
    cout<<endl;
  }
  return 0;
}

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

int main(void){
	int N, ans;
	while(cin >> N){
		for(int i = 0; i < 10; i++){
			if(N & 1){
				ans = i << 1;
				cout << ans;
				if(N >> 1)
					cout << ' ';
			}
			N >>= 1;
		}
		cout << endl;
	}
}

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

using namespace std;

int main()
{
  int x;
  while (scanf("%d ", &x) == 1) {
    int omori = 512;
    while (x != 0)
      if (x % omori == 0) {
	x -= omori;
	cout << omori << " ";
	omori /= 2;
      }
    }
  }
  return 0;
}

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

int main(){
    bool fundo[10] = {false};
    int value[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};

    int weight;
    bool space_need = false;

    while(cin >> weight){
        for(int i=0; i<=9; i++){
            if(weight % 2 == 1){
                fundo[i] = true;
            }
            weight /= 2;
        }

        for(int i=0; i<=9; i++){
            if(fundo[i] == true){
                if(space_need) printf(" ");
                printf("%d", value[i]);
                fundo[i] = false;
                space_need = true;
            }
        }
        cout << endl;
        space_need = false;
    }

    return 0;
}

C++: #include <iostream>
#include <bitset>
#include <cmath>

int main()
{

	int weight = 0;
	while (std::cin >> weight)
	{
		std::bitset<10> bit(weight);

		for (int i = 0; i < 10; i++)
		{
			if (bit[i])
			{
				std::cout << std::pow(2, i);
				if (i != 9)
				{
					std::cout << " ";
				}
			}
		}
		std::cout << std::endl;
		
	}

	return 0;
}

C++: #include <stdio.h>
#include <algorithm>
using namespace std;

int ans[101][10];

int pow(int a,int n){
	if(n <= 0){
		return 1;
	}
	return a * pow(a,n - 1);
}

int main(){
	int m;
	int flug = 0;
	while(scanf("%d",&m) != EOF){
		flug = 0;
		for(int j = 0; j < 10; j++){
			if(flug){
				printf(" ");
			}
			flug = 0;
			if((m / pow(2,j)) % 2 == 1){
				printf("%d",pow(2,j));
				flug = 1;
			}
		}
		printf("\n");
	}
	
	///////////////////////////////////
	//Sleep(200000);///////////////////// 提出するときは必ず外す！
	///////////////////////////////////
	return 0;

}

C++: #include<iostream>
using namespace std;
int main(void){
    int n,flg;   
    while(cin >> n){
        flg=0;
        for(int i=1;n>0;i*=2){
            if(n&1){
                if(flg>0)cout<<' ';
                cout<<i;
                flg=1;
            }
            n=n>>1;
        }
    cout<<endl;
    }
}

C++: #include <iostream>
#include <sstream>
using namespace std;
int main()
{
    int a[10], b[10];
    a[0] = 1;
    for (int i = 1; i < 10; ++i) a[i] = 2 * a[i-1];

    int n;
    while (cin >> n) {
        for (int i = 9; i >= 0; --i) b[i] = 0;
        for (int i = 9; i >= 0; --i) if (n >= a[i]) {
            n -= a[i];
            b[i]++;
        }
        ostringstream os;
        for (int i = 0; i < 10; ++i) if (b[i])
            os << " " << a[i];
        cout << os.str().substr(1) << 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(ans.empty()==1) break;
			if(ans[ans.length()-1]=='1'){
				cout<<(int)pow(2.0,i)/2<<" ";
			}
			ans.pop_back();
			i++;
		}
		cout<<endl;
	}
	return 0;
}

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

int main(){
	int n;
	int ans[10] = {};
	while(cin >> n){
		while(n >= 512){
			n -= 512;
			ans[9]++;
		}
		while(n >= 256){
			n -= 256;
			ans[8]++;
		}
		while(n >= 128){
			n -= 128;
			ans[7]++;
		}
		while(n >= 64){
			n -= 64;
			ans[6]++;
		}
		while(n >= 32){
			n -= 32;
			ans[5]++;
		}
		while(n >= 16){
			n -= 16;
			ans[4]++;
		}
		while(n >= 8){
			n -= 8;
			ans[3]++;
		}
		while(n >= 4){
			n -= 4;
			ans[2]++;
		}
		while(n >= 2){
			n -= 2;
			ans[1]++;
		}
		while(n >= 1){
			n -= 1;
			ans[0]++;
		}

		int cnt = 0;
		for(int i = 0; i < 10; i++){
			if(ans[i] == 0) continue;
			if(cnt == 0){
				cnt++;
				cout << pow(2, i);
				continue;
			}
			cout << " ";
			cout << pow(2, i);
		}
		cout << endl;
	}


}

C++: #include<cstdio>

int main(){
	int m, t;
	while(scanf("%d", &m) + 1){
		t = 1;
		bool f = 0;
		while(1024 - t){
			if(m & t){
				if(f){
					printf(" ");
				}
				printf("%d", t);
				f = 1;
			}
			t *= 2;
		}
		printf("\n");
	}
	return 0;
}

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

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	while(cin>>n){
		int a[10]={};
		if(n>=512){
			a[1]=512;
			n-=512;
		}
		if(n>=256){
			a[2]=256;
			n-=256;
		}
		if(n>=128){
			a[3]=128;
			n-=128;
		}
		if(n>=64){
			a[4]=64;
			n-=64;
		}
		if(n>=32){
			a[5]=32;
			n-=32;
		}
		if(n>=16){
			a[6]=16;
			n-=16;
		}
		if(n>=8){
			a[7]=8;
			n-=8;
		}
		if(n>=4){
			a[8]=4;
			n-=4;
		}
		if(n>=2){
			a[9]=2;
			n-=2;
		}
		if(n==1){
			cout<<1<<" ";
		}
		int i;
		for(i=9;i>0;i--){
			if(a[i]!=0){
				cout<<a[i];break;
			}
		}
		i--;
		for(;i>0;i--){
			if(a[i]!=0){
				cout<<" "<<a[i];
			}
		}
		cout<<endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
int n;
int g;
while(cin >>n){
g=1;
while(g<1000){
if(n%(2*g)==g&&n!=0){cout <<g<<" "; n=n-g;}
else if(n%(2*g)==g&&n==g){cout <<g<<endl; n=n-g;}
g=g*2;}
}
}

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

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