Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() (int, error) {
	return strconv.Atoi(nextString())
}

func main() {
	scanner.Split(bufio.ScanWords)

	for {
		n, err := nextInt()
		if err != nil {
			break
		}

		w := 512
		weights := make([]int, 10)
		for i := 9; i >= 0; i-- {
			if n >= w {
				weights[i] = w
				n -= w
			}
			w /= 2
		}

		output := []int{}
		for i := 0; i < 10; i++ {
			if weights[i] > 0 {
				output = append(output, weights[i])
			}
		}
		outputStr := fmt.Sprint(output)
		fmt.Println(outputStr[1:(len(outputStr) - 1)])
	}
}

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

using namespace std;

int main()
{
	int wei[11];
	int sinn[11];
	int omosa=1;
	int n;
	int flag=0;
	for(int i=0;i<=10;i++){
		wei[i]=omosa;
		omosa*=2;
	}
	while(cin>>n){
		flag=0;
		for(int i=0;i<=10;i++){
			sinn[i]=n%2;
			n/=2;
		}
		for(int i=0;i<10;i++){
			if(sinn[i]==1){
				if(flag==0){
					flag=1;
					cout<<wei[i];
				}
				else cout<<' '<<wei[i];
			}
		}
		cout<<'\n';
	}
	return 0;
}

C++: #include <iostream>

int main(){
	int a,b,c;
	int d[10];
	
	
	while(std::cin>>a){
		for(b=1;b<=10;b++){
		d[b]=0;
	}
		
		for(b=0;b<2;b++){
			if(a==b){
				d[1]=b;
			}else{
				for(c=0;c<3;c=c+2){
					if(a==b+c){
						d[1]=b;
						d[2]=c;
						
						
					}else{
						for(int e=0;e<5;e=e+4){
			if(a==b+c+e){
				d[1]=b;
				d[2]=c;
						d[3]=e;
					
			}else{
				for(int f=0;f<9;f=f+8){
					if(a==b+c+e+f){
						d[1]=b;
						d[2]=c;
						d[3]=e;
						d[4]=f;
						
					}else{
						for(int g=0;g<17;g=g+16){
			if(a==b+c+e+f+g){
				d[1]=b;
				d[2]=c;
						d[3]=e;
						d[4]=f;
						d[5]=g;
						
			}else{
				for(int h=0;h<33;h=h+32){
					if(a==b+c+e+f+g+h){
						d[1]=b;
						d[2]=c;
						d[3]=e;
						d[4]=f;
						d[5]=g;
						d[6]=h;
						
					
					}else{
						for(int i=0;i<65;i=i+64){
			if(a==b+c+e+f+g+h+i){
				d[1]=b;d[2]=c;
						d[3]=e;
						d[4]=f;
						d[5]=g;
						d[6]=h;
						d[7]=i;
						
			}else{
				for(int j=0;j<129;j=j+128){
					if(a==b+c+e+f+g+h+i+j){
						d[1]=b;
						d[2]=c;
						d[3]=e;
						d[4]=f;
						d[5]=g;
						d[6]=h;
						d[7]=i;
						d[8]=j;
						
					}else{
						for(int k=0;k<257;k=k+256){
			if(a==b+c+e+f+g+h+i+j+k){
				d[1]=b;
				d[2]=c;
						d[3]=e;
						d[4]=f;
						d[5]=g;
						d[6]=h;
						d[7]=i;
						d[8]=j;
						d[9]=k;
						
			}else{
				for(int l=0;l<513;l=l+512){
					if(a==b+c+e+f+g+h+i+j+k+l){
						d[1]=b;
						d[2]=c;
						d[3]=e;
						d[4]=f;
						d[5]=g;
						d[6]=h;
						d[7]=i;
						d[8]=j;
						d[9]=k;
						d[10]=l;
					}else{
						
					}
				}
			}
			
		}
					}
				}
			}
			
		}
					}
				}
			}
			
		}
					}
				}
			}
			
		}
					}
				}
			}
			
		}
		int n=0;
		for(int m=1;m<11;m++){
		if(d[m]!=0&&n==0)
		{
			std::cout<<d[m];
			n++;
		}
		else if(d[m]!=0){
			std::cout<<" "<<d[m];
		}
	}
	std::cout<<std::endl;
	}
	return 0;
}

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

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

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

int main(){
	int n,tmp[]={512,256,128,64,32,16,8,4,2,1};
	while(cin >> n){
		int cou[10]={0};
		for(int i=0;i<10;i++){
			if(n-tmp[i]>=0){
				n-=tmp[i];
				cou[i]++;
			}
			if(n==0) break;
		}
		int flag = 0;
		for(int i=9;i>=0;i--){
			if(cou[i] == 1){
				if(flag == 1) cout << " ";
				cout << tmp[i];
				flag = 1;
			}
		}
		cout << endl;
	}
}

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

int main(){
    int n;
    while(cin>>n,n!=EOF){
        vector<int>vec;
        for(int i=512;i>0;i=i>>1){
            if(n>=i){
                n-=i;
                vec.push_back(i);
            }
        }
        for(int i=0;i<vec.size();i++)
            cout<<vec[vec.size()-1-i]<<" ";
        cout<<endl;
    }
    return 0;
}

C++: #include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>
#include <climits>
#include <map>

using namespace std;

#define reep(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reep(i,0,n)

typedef vector<int> vi;

int main()
{
	int w;
	while(scanf("%d", &w) != EOF){
		rep(i, 10){
			if(w&1) printf("%d ", 1<<i);
			w>>=1;
		}
		puts("");
	}

	return 0;
}

C++: #include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>
#include <climits>
#include <map>

using namespace std;

#define reep(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reep(i,0,n)

typedef vector<int> vi;

int main()
{
	int w;
	while(scanf("%d", &w) != EOF){
		rep(i, 10){
			if(w&1){
				printf("%d", 1<<i);
				if(w) printf(" ");
			}
			w>>=1;
		}
		puts("");
	}

	return 0;
}

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

using namespace std;

int main() {

	int i, j, l, n, x;
	deque<int> g;

	while(cin >> n) {
		j=0;
		x=0;
		for(i=9; ; i--) {
			l=pow((double)2, (double)i);
			if(l+x<=n) {
				x+=l;
				g.push_back(l);
				j++;
			}
			if(x==n)
				break;
		}
		for(j-=1; j>0; j--) {
			cout << g[j] << " ";
		}
		cout << g[j] << endl;
		g.clear();
	}

	return 0;

}

C++: #include <stdio.h>

int quo,rem;

void divide_by_2(int x) {

  quo=x/2;
  rem=x%2;

}

int main(void) {

  int w;

  int count;

  while(scanf("%d",&w)!=EOF) {

    count=1;
    quo=w;

    while(quo>0) {

      divide_by_2(quo);
      
      if(rem==1) {
	
	if(quo==0) printf("%d\n",count);
	else printf("%d ",count);

      }

      count*=2;

    }

    //printf("\n");

  }

  return 0;

}

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

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

#define MAX 10	// ªºÌ

int main()
{
	int n;
	int flag;
	int i;

	while (cin >> n) {
		flag = 0;
		for (i = 0; i < MAX; i++) {
			if ( (n & 1<<i) == 0) continue;
			if (flag) cout << " ";
			else flag = 1;
			cout << (1<<i);
		}
		cout << endl;
	}

	return 0;
}

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

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

  return 0;
}

C++: #include<stdio.h>
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
int num[10]={};
int N,cou=0,jj=0,sum=0;
while(scanf("%d",&N)!=EOF)
{
do{
num[jj]=N%2;cou++;jj++;
N=N/2;
}while(N!=0);
for(int i=0;i<cou;i++)
{
if(num[i]==1){
	
	sum=pow( 2, (double) (i) );
	if(i>0)cout<<" ";
	cout<<sum;
}
}
cout<<endl;
}
return 0;
}

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

int main(){
	int n;
	deque<int> ans;

	while(cin>>n){
		for(int i=512;i>0;i/=2){
			if(n-i>=0){
				n-=i;
				ans.push_front(i);
				if(n==0) break;
			}
		}
		for(int i=0;i<ans.size();i++){
			if(i>0) cout<<" ";
			cout<<ans[i];
		}
		cout<<endl;
		ans.clear();
	}

	return 0;
}