Go: package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	weight := []int{512, 256, 128, 64, 32, 16, 8, 4, 2, 1}

	for sc.Scan() {
		var wgt []int
		i, _ := strconv.Atoi(sc.Text())

		if i > 1023 {
			i = 1023
		}

		bin := fmt.Sprintf("%010b", i)

		for i := 9; i >= 0; i-- {
			if bin[i] == '1' {
				wgt = append(wgt, weight[i])
			}
		}

		for i := 0; i < len(wgt); i++ {
			if i == len(wgt)-1 {
				fmt.Printf("%d\n", wgt[i])
			} else {
				fmt.Printf("%d ", wgt[i])
			}

		}
	}

}

C++: #include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<cstring>
#include<sstream>
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define lb(v,n) lower_bound(v.begin(),v.end(),n)
#define ub(v,n) upper_bound(v.begin(),v.end(),n)
#define mae(v) max_element(v.begin(),v.end())
#define mie(v) min_element(v.begin(),v.end())
#define INF 0x7FFFFFFF
#define mod 1000000007
typedef long long ll;
////////////////////////////////////////////////////////////

int main(){
	int n;
	while( cin >> n ){
		int s = 512;
		stack<int> st;
		while( n != 0 ){
			if( n - s >= 0 ){
				st.push(s);
				n -= s;
				s /= 2;
			}
			else{
				s /= 2;
			}

		}

		while( !st.empty() ){	
			cout << st.top();
			if( st.size() == 1 )
				cout << endl;
			else
				cout << " ";
			st.pop();
		}
	}
	ret 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
    int n;
    
    while(cin >> n)
    {
        int t = 1, c = 0;
        
        for(int i = 0; i < 20; i++)
        {
            if(n & t)
            {
                if(c++) { cout << ' '; }
                
                cout << t;
            }
            
            t *= 2;
        }
        
        cout << endl;
    }
    
    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n,wei[10],ka=1,temp,ba[10];
  for(int i=0;i<10;i++){
    wei[i]=ka;
    ka*=2;
  }
   while(cin>>n){
     temp=0;
    for(int i=0;i<10;i++){
      ba[i]=0;
    }
    for(int i=9;i>=0;i--){
      if(n!=0){
	if(n-wei[i]>=0){
	  n-=wei[i];
	  ba[i]=wei[i];
	}
      }if(n==0){
	break;
      }
    }
    for(int i=0;i<10;i++){
      if(ba[i]!=0){
	temp++;
      }
    }
    for(int i=0;i<10;i++){
      if(ba[i]!=0){
	cout<<ba[i];
	if(temp>0){
	  cout<<" ";
	  temp--;
	}
      }
    }
    cout<<endl;
  }
  return 0;
}

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

int main(void){
	int N, ans;
	while(cin >> N){
		for(int i = 0; i < 10; i++){
			if(N & 1){
				ans = i << 1;
				cout << ans;
				if(N >> 1)
					cout << ' ';
			}
			N >>= 1;
		}
		cout << endl;
	}
}

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

using namespace std;

int main()
{
  int x;
  while (scanf("%d ", &x) == 1) {
    int omori = 512;
    while (x != 0)
      if (x % omori == 0) {
	x -= omori;
	cout << omori << " ";
	omori /= 2;
      }
    }
  }
  return 0;
}

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

int main(){
    bool fundo[10] = {false};
    int value[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};

    int weight;
    bool space_need = false;

    while(cin >> weight){
        for(int i=0; i<=9; i++){
            if(weight % 2 == 1){
                fundo[i] = true;
            }
            weight /= 2;
        }

        for(int i=0; i<=9; i++){
            if(fundo[i] == true){
                if(space_need) printf(" ");
                printf("%d", value[i]);
                fundo[i] = false;
                space_need = true;
            }
        }
        cout << endl;
        space_need = false;
    }

    return 0;
}

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

int main()
{

	int weight = 0;
	while (std::cin >> weight)
	{
		std::bitset<10> bit(weight);

		for (int i = 0; i < 10; i++)
		{
			if (bit[i])
			{
				std::cout << std::pow(2, i);
				if (i != 9)
				{
					std::cout << " ";
				}
			}
		}
		std::cout << std::endl;
		
	}

	return 0;
}

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

}

C++: #include<iostream>
using namespace std;
int main(void){
    int n,flg;   
    while(cin >> n){
        flg=0;
        for(int i=1;n>0;i*=2){
            if(n&1){
                if(flg>0)cout<<' ';
                cout<<i;
                flg=1;
            }
            n=n>>1;
        }
    cout<<endl;
    }
}

C++: #include <iostream>
#include <sstream>
using namespace std;
int main()
{
    int a[10], b[10];
    a[0] = 1;
    for (int i = 1; i < 10; ++i) a[i] = 2 * a[i-1];

    int n;
    while (cin >> n) {
        for (int i = 9; i >= 0; --i) b[i] = 0;
        for (int i = 9; i >= 0; --i) if (n >= a[i]) {
            n -= a[i];
            b[i]++;
        }
        ostringstream os;
        for (int i = 0; i < 10; ++i) if (b[i])
            os << " " << a[i];
        cout << os.str().substr(1) << endl;
    }
    return 0;
}

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