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<bitset>
#include<cmath>
using namespace std;
int main(){
	int weight;
	while(cin>>weight){
		bitset<10> num(weight);
		int i;
		for(i=0;num[i]==0;++i);
		cout<<pow(2.0,i);
		for(++i;i<10;++i){
			if(num[i]==1)cout<<' '<<pow(2.0,i);
		}
		cout<<endl;
	}
}

C++: #include <stdio.h>
int main() {int N;while (scanf("%d",&N)!=EOF) {int i=0,j=1;while (N) {if (N&1) {if (i) printf(" ");printf("%d",j);i++;} N>>=1,j<<=1;} puts("");}return 0;}

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

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

	int n;
	while(cin >> n){

		bool check[10];
		for(int i = 0; i < 10; ++i){
			check[i] = false;
		}

		for(int i = 9; i >= 0; --i){
			if(n >= data[i]){
				n -= data[i];
				check[i] = true;
			}
		}

		bool check2 = false;
		for(int i = 0; i < 10; ++i){
			if(check[i]){
				if(check2) cout << " ";
				else check2 = true;
				cout << data[i];
			}
		}

		cout << endl;

	}

	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>

#define PI 3.14159265359

#define INF 1000000;

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

typedef long long ll;

using namespace std;


/*
class ElectronicPetEasy
{
public:
	string isDifficult(int st1, int p1, int t1, int st2, int p2, int t2)
	{
		
	}
};
*/




int main()
{
	int weight[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
	int n;
	set<int> weights;
	
	
	while (cin >> n)
	{
		for (int i=9; i>=0; i--)
		{
			if (n >= weight[i])
			{
				weights.insert(weight[i]);
				n -= weight[i];
			}
		}
		bool first_flag = true;
		set<int>::iterator it = weights.begin();
		while (it != weights.end())
		{
			if (first_flag)
			{
				cout << *it;
				first_flag = false;
			} else {
				cout << " " << *it;
			}
			it++;
		}
		cout << endl;
	}
	
	return 0;
}

C++: #include <iostream>

using namespace std;

int main(void){
	int n;
	int list[11];
	int size;
	while(cin >>n,!cin.eof()){
		int i=1,size=0;
		if(i&n)
			list[size++]=i;
		i <<=1;
		while(i<=n){
			if(i&n)
				list[size++]=i;
 			i <<=1;
		}
		for(i=0;i<size;i++)
			cout << (i?" ":"")  << list[i];
		cout << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <string>
#include <cctype>
#include <stack>
#include <queue>
#include <vector>
#include <cstdlib>
#include <list>
#include <cmath>

#define _USE_MATH_DEFINES
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define INF 999999999
#define atcoder 1000000007
#define MAX_N 100

using namespace std;

int V[10] = { 1,2,4,8,16,32,64,128,256,512 };
bool judge[10] = { false };

int main() {

	int n;

	while (cin >> n && n!= EOF) {
		REPR(i,9) {
			if (n >= V[i]) {
				judge[i] = true;
				n -= V[i];
			}
			if (n == 0)
				break;
		}

		REP(i,10) {
			if (i != 0 && judge[i] == true)cout << " " << V[i];
			if (i == 0 && judge[i] == true)cout << V[i];
			judge[i] = false;
		}
		cout << endl;
	}

	return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
    int M,scale[10];
    scale[0]=1;
    for(int i=1;i<10;i++){
    scale[i] = scale[i-1]*2;
    }
    while(cin >> M){
    int i=0;
    int count=2;
    while(true){
        if(M==0) break;
        if(M % count!=0){
            M -= scale[i];
            if(M != 0){
            cout << scale[i] << " ";
            }
            else{
            cout << scale[i] <<endl;
            }
        }
        i++;
        count *= 2;
    }
    }
}

C++: #include<iostream>
#include<string>
#include<cmath>
#include<bitset>
int main(){
    int t;
    while(std::cin>>t){
    std::bitset<11> value(t);
    std::string s=value.to_string();
    for(int i=0;i<s.size();i++){if(s[0]=='0') s.erase(s.begin()); else break;}
    int num=std::stoi(s);
        for(int i=0;i<s.size();i++){if(num%10){std::cout<<pow(2,(double)(i)); if(i!=(s.size()-1))std::cout<<" ";} num/=10;}
    std::cout<<std::endl;
    }
}

C++: #include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
typedef vector<int> vi;

const int w[] = {9,8,7,6,5,4,3,2,1,0};

int main() {
	int in;
	while (cin>>in) {
		vi used;
		REP(i,10) {
			int weight = pow(2,w[i]);
			if (weight<=in) {
				in -= weight;
				used.push_back(weight);
			}
		}
		sort(used.begin(),used.end());
		REP(i,used.size()) {
			if(i!=0) cout<<" ";
			cout<<used[i];
		}
		cout<<endl;
	}
}

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((m / pow(2,j)) % 2 == 1){
				if(flug){
				printf(" ");
			}
				printf("%d",pow(2,j));
				flug = 1;
			}
		}
		printf("\n");
	}
	
	///////////////////////////////////
	//Sleep(200000);///////////////////// 提出するときは必ず外す！
	///////////////////////////////////
	return 0;

}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>

using namespace std;


#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> P;

int main() {
	for (int n; cin >> n; ) {
		for (int i = 0; (n >> i); i++) if ((n >> i) & 1) cout << (1 << i) << ((n >> (i + 1)) ? ' ' : '\n');
	}
	
	return 0;
}

C++: #include <stdio.h>
int main(){
int n,temp;
while(scanf("%d",&n)!=EOF){
temp=1;
while(temp<=n)temp*=2;
temp/=2;
printf("%d",temp);
n-=temp;
while(n>0){
while(temp>n)temp/=2;
n-=temp;
printf(" %d",temp);
}
printf("\n");
}
}

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

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define EPS (1e-10)
using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef complex<double> P;

int main(){
  int n;
  while(cin>>n){
    int i = 1;
    bool f = true;
    while(i != 1024){
      if((n&i)!=0){
	if(f) f=false;
	else printf(" ");
	printf("%d",i);
      }
      i <<= 1;
    }
    puts("");
  }
  return 0;
}