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>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <string>
#include <algorithm>
#include <climits>
#include <utility>

#define PRINT(STR) cout << STR << endl;
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); (i)++)
#define REG(i, a, b) for (int (i) = ((int)(a)); (i) < ((int)(b)); i++)
#define ALL(V) (V).begin(), (V).end()
#define SPACE " "

typedef long long ll;

using namespace std;

int nextInt() { int n = -1; cin >> n; return n; }
double nextDouble() { double d = -1; cin >> d; return d; }
ll nextll() { ll n = -1; cin >> n; return n; }
string nextString() { string str; cin >> str; return str; }

int INF = 1LL << 25;
double EPS = 1e-9;
int numofbits(int bits)
{
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

// BEGIN //////////////////////////////////////////////////////////////
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    vector<int> ans;
    while (n) {
      for (int t = 1024; ; t >>= 1) {
        if (n & t) {
          ans.push_back(t);
          n ^= t;
          break;
        }
      }
    }
    for (int i = ans.size() - 1; i; i--) {
      cout << ans[i] << SPACE;
    }
    cout << ans[0] << endl;
  }
	return 0;
}
// END   //////////////////////////////////////////////////////////////

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 = 1 << i;
				cout << ans;
				if(N >> 1)
					cout << ' ';
			}
			N >>= 1;
		}
		cout << endl;
	}
}

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

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

  return 0;
}

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

using namespace std;

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

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()-1; i>=0; i--){
        if(i==0){
            cout<< w[i];
        }else{
            cout<< w[i]<< " ";
        }

    }
    cout<<endl;
}
int main(){
    while(cin>>n){
        solve();
    }
    return 0;
}

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

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

C++: #include <cstdio>

using namespace std;

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

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

int main() {
	int we[10] = { 1,2,4,8,16,32,64,128,256,512 };
	int n;
	vector<int>v;
	vector<int>::iterator pv=v.begin();
	while (cin >> n) {
		int h = 9;
		while (n == 0) {
			if (n - we[h] >= 0) {
				n -= we[h];
				v.push_back(h);
			}
			h--;
		}
		for (int i = v.size(); i >-1; i--) {
			int x = v[i];
			cout << we[x];
			if (i != 0) { cout <<" "; }
			else { cout << endl; }
		}
	}
	return 0;
}

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

using std::cout;

int main()
{
    int weight;
    while (std::cin >> weight) {
        std::vector<int> list;
        for (int bundou = 1; bundou <= 512; bundou *= 2) {
            if (weight % (bundou * 2) != 0) {
                list.push_back(bundou);
                weight -= bundou;
            }
            if (weight == 0) {
                break;
            }
        }

        for (auto i = 0; i < list.size(); i++) {
            if (i != 0) {
                cout << " ";
            }
            cout << list.at(i);
        }
        cout << std::endl;
    }

    return 0;
}

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(pow(2,i)*2<t)std::cout<<" ";}num/=10;}
    std::cout<<std::endl;
    }
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int n, s;
int main() {
	while (cin >> n) {
		s = 0;
		for (int i = 0; i < 31; i++) {
			if (n % 2 == 1) {
				if (s) { cout << ' '; }
				cout << pow(2, i); s++;
				n = (n - 1) / 2;
			}
		}
		cout << endl;
	}
}