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<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;
}

C++: #include<stdio.h>

int main(void)
{
	int wei[10]={1,2,4,8,16,32,64,128,256,512},kai[10];
	int w,i,j;
	while(scanf("%d",&w)!=EOF)
	{
		i=9;  j=0;
		while(0==0)
		{
			if(w-wei[i]>0){
				w-=wei[i];
				kai[j]=wei[i];
				j++;
			}
			else if(w-wei[i]==0){
				kai[j]=wei[i];
				for(i=j;i>0;i--)
					printf("%d ",kai[i]);
				printf("%d\n",kai[0]);
				break;
			}

			i--;
		}
	}
	return 0;
}

C++: #include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;

#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)
#define lengthof(x) (sizeof(x) / sizeof(*(x)))
#define FILL(ptr, value) FILL_((ptr), sizeof(ptr)/sizeof(value), (value))
template <typename T>
void FILL_(void * ptr, size_t size, T value){
  std::fill((T*)ptr, (T*)ptr+size, value);
}
//4方向ベクトル→↑←↓
int dx[] ={1,0,-1,0};
int dy[] ={0,-1,0,1};
int W;
int weights[10] ={1,2,4,8,16,32,64,128,256,512};
int main()
{
  while(cin>>W){
    int type[10]={0};
    for(int j = 10;j >=0;j--){
      if(W-weights[j] >=0){
	W -=weights[j];
	type[j] = 1;
      }
    }
      for(int i = 0;i <10;i++){
	if(type[i] ==1){
	  cout <<weights[i];
	  if(i !=9)
	    cout <<" ";
	}else if(i ==9)
	  cout <<endl;
      }
  }
  return 0;
}

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]<<flush;
        }
        i++;
        break;
    }
    for(j=i;j<10;j++){
        if(weight_f[j]==1){
            cout<<" "<<weight[j]<<flush;
        }
    }
    cout<<endl;
    }
    return(0);
}

C++: #include <iostream>
#include <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <sstream>
#include <istream>
#include <cmath>
#include <cstdio>

using namespace std;

#define vci vector<int>
#define vcs vector<string>
#define pb push_back
#define sz size()
#define mapii map<int, int>
#define mapci map<char, int>
#define mapsi map<string, int>
#define all(x) x.begin(), x.end()
#define minit(a, i) memset(a, i, sizeof(a));

#define for_(i, a, b) for (int i=(int)a; i<(int)b; i++)
#define for_d(i, a, b) for (int i=(int)a-1; i>=b; i--)
#define for_r(i, a, b, c) for (int i=(int)a; i<(int)b; i += c)
#define for_dr(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

typedef long long ll;

const int iINF = 2147483647;
const ll lINF = 9223372036854775807;

template <class T> inline void dbg(T t) { cout << t << endl; }





int main() {
	int in;
	while (cin >> in) {
		bitset<10> b(in);
		for_(i, 0, 10) if (b[i]) cout << pow(2, i) << " ";
		cout << endl;
	}
	
	return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

int n;
V vi;

int main(){
	while (cin >> n){
		for (int i = 9; i >= 0; i--){
			if (n >= pow(2, i)){
				n -= pow(2, i);
				vi.push_back(pow(2, i));
				if (n == 0)break;
			}
		}
		sort(ALL(vi));
		REP(i, vi.size()){
			cout << vi[i];
			if (i == vi.size() - 1)cout << endl;
			else cout << " ";
		}
		vi.clear();
	}
}