Go: package main

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		num, _ := strconv.Atoi(scanner.Text())
		first := true
		beki := 1
		for num != 0 {
			if num % 2 == 1 {
				if !first {
					fmt.Print(" ")
				}
				fmt.Print(beki)
				first = false
			}
			num /= 2
			beki *= 2
		}
		fmt.Println()
	}
}

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

using namespace std;

int main(void){
    int i,j,k,l;
    int n;
    int weight[10]={1,2,4,8,16,32,64,128,256,512};
    int weight_f[10];
    
    while(cin>>n){
    
    memset(weight_f,0,sizeof(weight_f));
    
    for(i=9;i>=0;i--){
        if(n-weight[i]>=0){
            n=n-weight[i];
            weight_f[i]=1;
        }
    }
    i=0;
    while(true){
        if(weight_f[i]==1){
            cout<<weight[i];
        }
        i++;
        break;
    }
    for(j=i;j<10;j++){
        if(weight_f[j]==1){
            cout<<" "<<weight[j];
        }
    }
    cout<<endl;
    }
    return(0);
}

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

using namespace std;

int main(void){
	int cnt=0,j;
	double weight,hun,i;
	double dou[10];

	while(cin>>weight){
		for(i=9;i>=0;i--){
			hun=pow(2,i);
			if(weight>=hun){
				weight-=hun;
				dou[cnt]=hun;
				cnt++;
			}
		}
		for(j=cnt-1;j>=0;j--)
			cout<<dou[j]<<' ';
		cout<<endl;
		cnt=0;
	}

	return 0;
}

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

int main()
{
	int w;

	while (cin >> w){
		for (int i = 1; i <= 512; i *= 2){
			if (w % (i * 2) != 0){ // next check
				cout << i;
				w -= i;
				if (w != 0){
					cout << " ";
				}
			}
			if (w == 0){
				cout << endl;
				break;
			}
		}
	}

	return (0);
}

C++: #include<iostream>
#include<vector>
int n=1024;
std::vector<int> g;

int main(){
	int a;
	while(std::cin>>a){
		int n_=0;
		bool f=true;
		while(1){
			if(n<a&&f)g.push_back(n),a-=n,n_=n,f=false;
			else if(n<a)g.push_back(n),a-=n;
			else n/=2;
			if(a==1){
				g.push_back(1);
				break;
			}
		}
		
		for(auto it = g.rbegin();it!=g.rend();++it){
			std::cout<<*it;
			if(*it!=n_)std::cout<<" ";
		}
		std::cout<<std::endl;
		n=1024;
	}
	return 0;
}

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

int main() {
int n,m;
while(cin>>n){
	m=0;
	int wa=2;
	for (int k=0;k<=10;k++){
		if(n%wa!=0){
			if(m!=0){
				cout<<" ";
			}
			cout<<wa/2;
			n=n-wa/2;
			m=m+1;
		}
	wa=wa*2;
}
cout<<endl;
}
	return 0;
}

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

int i,j,k;
int n,flag[15],a=1,b=1;

int main(){
	while(scanf("%d",&n)!=EOF){
		while(n>=1)flag[a]=n%2*b,n/=2,a++,b*=2;
		for(i=1;i<11;i++)if(flag[i]!=0)printf("%d ",flag[i]);
		//printf("\n");
		for(i=1;i<11;i++)flag[i]=0;a=1;b=1;
	}
	return 0;
}

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

int main(){
    int n;
    while( cin >> n ){
        int m = 1, c = 0;
        while(n > 0){
            if( n%2 ){
                if( c ) cout << ' ';
                cout << m;
            }
            m *= 2;
            n /= 2;
            c = 1;
        }
        cout << endl;
    }
    return 0;
}

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


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

C++: #include<iostream>
using namespace std;
int main(){
  int n;
  while(cin >>n){
    bool f = false;
    for(int i=1;i<=512;i*=2){
      if(n%2 == 1){
	if(f) cout <<" ";
	cout<<i;
	f = true;
      }
      n/=2;
    }
    cout <<endl;
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

template <class Type>
Type power(Type X, int Y)
{
	Type Ans = 1;

	if (Y >= 0)
	{
		for (int i = 0; i < Y; i++)
		{
			Ans *= X;
		}
	}
	else
	{
		for (int i = 0; i < (-Y); i++)
		{
			Ans /= X;
		}
	}

	return Ans;
}

int main()
{
	int N;

	while (cin >> N)
	{
		for (int i = 0; i < 10; i++)
		{
			if ((N / power<int>(2, i)) % 2 == 1)
			{
				cout << power<int>(2, i) << ' ';
			}
		}

		cout << char(127) << endl;
	}

	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<functional>

using namespace std;

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

bool tukauka[10];//大きい順

int n,owari;
int main(){
	cin >> n;
	for(int i = 0;i < 10; i++) {
		if(n >= omosa[i])tukauka[i] = true, n -= omosa[i],owari=i;
	}
	for(int i = 0; i < 10; i++) {
		if(tukauka[9 - i]&&i==owari) {
			cout << omosa[9 - i] ;
		}else {
			cout<< omosa [ 9 - i]<<" ";
		}
	}
	cout << endl;
	return 0;
}

C++: #include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <iomanip>
#include <string>
#include <queue>
#include <algorithm>
#include <cctype>
#define shosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const double pi=acos(-1);

int n;

int main(){
	while(cin>>n){
		int two=1;
		vi ans;
		for(int i=0;i<10;i++){
			two*=2;
			if(n%two){
				n-=two/2;
				ans.push_back(two/2);
			}
		}
		for(int i=0;i<ans.size()-1;i++) cout<<ans[i]<<' ';
		cout<<ans[ans.size()-1]<<endl;
	}
}

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

using namespace std;

int main(void){

	int inp,arr[100],cnt;
	int wei[]={1,2,4,8,16,32,64,128,256,512};

	while(cin>>inp){
		cnt=0;
		for(int i=9;inp!=0;i--){
			if(inp-wei[i]>=0){
				inp-=wei[i];
				arr[cnt]=wei[i];
				cnt++;
			}
		}
		for(int j=cnt-1;j>=0;j--){
			cout<<arr[j];
			if(j==0) cout<<endl;
			else cout<<" ";
		}
	}

	return 0;
}

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

int main(){
	int n;
	while(cin>>n){
		bool f=false;
		for(int i=0; i<10; i++){
			if((n & 1<<i)!=0){
				if(f) cout << " ";
				cout << (1<<i);
				f = true;
			}
		}
		cout << endl;
	}
	return 0;
}

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

int main() {
  int a[10];
  int n;
  int x;

  a[0] = 1;
  for (int i=1; i<10; i++) {
    a[i] = a[i-1] << 1;
  }

  while (cin >> n) {
    for (int i=0; i<10; i++){
      x = n & 1;
      n >>=1;
      if (x) {
        if (n) {
          cout << a[i] << " ";
        } else {
          cout << a[i] << endl;
        }
      }
    }
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int main() {
	int a;
	while (cin >> a){
		bool b = false;
		if (a % 2 == 1){
			cout << '1';
			b = true;
			a -= 1;
		}
		if (a % 4 == 2){
			if (b == true) 
				cout << ' ';
			else b = true;
			cout << 2;
			a -= 2;
		}
		if (a % 8 == 4) {
			if (b == true) 
				cout << ' ';
			else b = true;
			cout << 4;
			a -= 4;
		}
		if (a % 16 == 8) {
			if (b == true) 
				cout << ' ';
			else b = true;
			cout << 8;
			a -= 8;
		}
		if (a % 32 == 16) {
			if (b == true) 
				cout << ' ';
			else b = true;
			cout << 16;
			a -= 16;
		}
		if (a % 64 == 32) {
			if (b == true) 
				cout << ' ';
			else b = true;
			cout << 32;
			a -= 32;
		}
		if (a % 128 == 64) {
			if (b == true) 
				cout << ' ';
			else b = true;
			cout << 64;
			a -= 64;
		}
		if (a % 256 == 128) {
			if (b == true) 
				cout << ' ';
			else b = true;
			cout << 128;
			a -= 128;
		}
		if (a % 512 == 256) {
			if (b == true) 
				cout << ' ';
			else b = true;
			cout << 256;
			a -= 256;
		}
		if (a % 1024 == 512) {
			if (b == true) 
				cout << ' ';
			else b = true;
			cout << 512;
			a -= 512;
		}
		cout << endl;
	}
}