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<vector>

using namespace std;
const int V[10] = {512, 256, 128, 64, 32, 16, 8, 4, 2, 1};
int n;

void solve(){
    vector<int> w;
    for(int i=0; i<10; i++){
        int f = n/V[i];
        if(f!=0){
            n -= V[i];
            w.push_back(V[i]);
        }
    }
    for(int i=w.size()-2; i>=0; i--){
        cout<<" "<< w[i];
    }
    cout<<endl;
}
int main(){
    while(cin>>n){
        solve();
    }
    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 << endl;
	}

	return 0;
}

C++: #include <iostream>
 
int main(){
    int a,b,c;
    int d[11];
     
     
    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;
                    }
                }
            }
             
        }
                    }
                }
            }
             
        }
                    }
                }
            }
             
        }
                    }
                }
            }
             
        }
                    }
                }
            }
             
        }
        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<iostream>

int main()
{
	int a;
	while( std::cin >> a ){
		int i = 0;
		while( a > 0 ){
			if( a & 1 ) std::cout << ( 1 << i ) << ( ( a >> 1 ) & -( a >> 1 ) ? " " : "" );
			a >>= 1;
			i++;
		}
		
		std::cout << std::endl;
	}

 	return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <iostream>


using namespace std;

int main()
{
	int	w;
	while (scanf("%d", &w) != EOF)
	{
		vector<int> v;
		for (int i = 0; i < 10; ++i)
		{
			if (w & 1 << i)
				v.push_back(1<<i);
		}
		for (int i = 0; i < v.size()-1; ++i)
			printf("%d ", v[i]);
		printf("%d\n", v[v.size()-1]);
	}
	return 0;
}

C++: #include <stdio.h>

int main(){
	int i,w,g[10] = {1,2,4,8,16,32,64,128,256,512};
	while(scanf("%d",&w) != EOF){
		if(w % 2 == 1) {
			printf("1");
			w--;
		}
		for(i = 1;i < 10;i++){
			if(w % (g[i] * 2) == g[i]) {
				printf(" %d",g[i]);
				w -= g[i];
			}
			if(!w) break;
		}
		printf("\n");
	}
	return 0;
}

C++: #include<iostream>
int main()
{
	auto powor_of_two = [](int n)
	{
		int result = 1;
		for (int i = 0; i < n; i++)
		{
			result *= 2;
		}
		return result;
	};
	for (int w; std::cin >> w;)
	{
		for (int i = 0; i < 10; i++)
		{
			int bit = w & 1;
			if (bit == 1)
			{
				std::cout << powor_of_two(i);
			}
			w >>= 1;
			if (w != 0)
			{
				std::cout << ' ';
			}
			else
			{
				std::cout << std::endl;
				break;
			}
		}
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	int w;
	while (cin >> w) {
		for (int weight = 1; w>0; w>>=1, weight<<=1) {
			if ((w&1)==1) cout << weight << " ";
		}
		cout << endl;
	}
	
	return 0;
}

C++: #include <stdio.h>

int main(){
  int n;
  int i;
  while(scanf("%d", &n)!=EOF){
    for(i=0;i<10;i++){
      if(n&1){
        printf("%d", 1<<i);
        if(n>>1) printf(" ");
      }
      n >>= 1;
    }
    printf("\n");
  }
  return 0;
}

C++: // 2012/10/28 Tazoe

#include <iostream>
using namespace std;

int main()
{
	while(true){
		int obj;
		cin >> obj;

		if(cin.eof())
			break;

		bool spc = false;

		for(int i=0; i<10; i++){
			if(obj%2==1){
				if(spc){
					cout << ' ';
				}

				int wgt = 1;
				for(int j=0; j<i; j++){
					wgt *= 2;
				}
				cout << wgt;

				spc = true;
			}

			obj /= 2;
		}

		cout << endl;
	}

	return 0;
}

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

using namespace std;

int main()
{
	int targ, square[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
	vector<int> num;
	while(cin >> targ)
	{
		if(targ == 0) break;

		for(int i = 9; i >= 0; i--)
		{
			if(targ >= square[i])
			{
				num.push_back(i);
				targ -= square[i];
			}
		}

		for(int i = num.size()-1; i >= 0; i--)
		{
			cout << square[ num[i] ];
			if(i != 0) cout <<" ";
			else cout << endl;
		}
		num.clear();
	}
}