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>
using namespace std;
int n;
int main(){
  while(cin>>n){
    for(int i=1;n>0;i*=2){
   
      if(n&1){
	if(i>1)cout<<' ';
	cout<<i;
      }
      n=n>>1;
    }
    cout<<endl;
  }
  return 0;
}

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

int main(){
	int n,i;
	stack <int> ans;
	while(cin >> n){
		for (i = 9; i >= 0; i--) {
			if(pow(2.0, i) <= n){
				n -= pow(2.0, i);
				ans.push(pow(2.0, i));
			}
		}

		while(!ans.empty()){
			cout << ans.top();
			ans.pop();
			if(!ans.empty()){
				cout << " ";
			}
		}
		cout << endl;
	}
	return 0;
}

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

int main(){
  int w,we[10]={1,2,4,8,16,32,64,128,256,512},i;
  queue<int> k;
  while(cin>>w){
    while(w!=0){
      k.push(w%2);
      w=w/2;
    }
    i=0;
    while(k.size()){
      if(k.front()==1&&k.size()>=2)cout<<we[i]<<" ";
      else if(k.front()==1)cout<<we[i]<<endl;
      k.pop();
      i++;
    }
  }
  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<iostream>
using namespace std;
int main(){
	int n=0;
	while(cin >>n){
		int x=1;
		for(int i=0; i<10; i++){
			if(n%2 == 1 && i == 0){cout<<x;}
			else if(n%2 == 1 && i != 0){cout<<" "<<x;}
			x*=2;
			n = n/2;
		}
		cout<<endl;
	}
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

int main()
{
//	cut here before submit 
//	freopen ("testcase.weight", "r", stdin );
	string str = "";
	while (getline (cin, str ) ){
		stringstream ss (str );
		int w;
		ss >> w;
		vector<int> res; res.clear();
		int weight = 1;
		while (w > 0 ){
			if (w % 2 != 0 ) res.push_back (weight );
			weight *= 2;
			w /= 2;
		} // end while
		rep (i, res.size() ){
			cout << res[i] << (i != res.size() - 1 ? ' ' : '\n' );
		} // end rep

	} // end loop
		
	return 0;
}

C++: #include<stdio.h>
int main(){
int a,x[12],k,i;
while(scanf("%d",&a)!=EOF){
k=0;
if(a>=512){
x[k++]=512;
a-=512;
if(a>=256){
x[k++]=256;
a-=256;
}
if(a>=128){
x[k++]=128;
a-=128;
}
if(a>=64){
x[k++]=64;
a-=64;
}
if(a>=32){
x[k++]=32;
a-=32;
}
if(a>=16){
x[k++]=16;
a-=16;
}
if(a>=8){
x[k++]=8;
a-=8;
}
if(a>=4){
x[k++]=4;
a-=4;
}
if(a>=2){
x[k++]=2;
a-=2;
}
if(a>=1){
x[k++]=1;
a-=1;
}
if(a==0)
for(i=k-1;i>=0;i--)
printf("%d ",x[i]);
printf("\n");
}
return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    while (cin >> n) {
        bool f = false;
        for (int i = 0; i <= 9; ++i) {
            if (n >> i & 1) {
                printf(f ? " %d" : "%d", 1 << i);
                f = true;
            }
        }
        printf("\n");
    }
}

C++: #include <stdio.h>
  int main(){
   int x[10]={1,2,4,8,16,32,64,128,256,512};
   int n,i;
    while(scanf("%d",&n) != EOF){
		int y[10]={};
     for(i=9;i>=0;i--){
		 if(n>=x[i]){  n -= x[i]; y[i]=1;}
       }
      for(i=0;i<10;i++){
         if(y[i]==1) printf("%d ",x[i]);
            }

      printf("\n");
}
return 0;
}

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

bool used[10], ans[10], endR;
int bundo[] = {1, 2, 4, 8, 16, 32, 64, 128, 256};

void init(){ for(int i = 0; i < 10; i++) used[i] = false; endR = false;}

void copyAns(){
  for(int i = 0; i < 10; i++) ans[i] = used[i];
}

void dfs(int i, int w){
  if(w == 0) { copyAns(); endR = true; return; }
  if(i == 10 || w < 0 || endR) return;

  if(!used[i]){
    used[i] = true;
    dfs(i + 1, w - bundo[i]);
  }
  used[i] = false;
  dfs(i + 1, w);
}

int main(void){
  int w;
  while(cin >> w){
    init();
    dfs(0, w);
    for(int i = 0; i < 10; i++){
      if(ans[i]) cout << bundo[i];
      if(ans[i] && i < 9) cout << " ";
    }
    cout << endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

int main()
{
    int w;
    while (cin >> w) {
        vector<int> v;
        for (int i = 0; i <= 9; i++) {
            if (w >> i & 1) {
                v.push_back(1<<i);
            }
        }
        for (int i = 0; i < (int)v.size(); i++) {
            if (i > 0) cout << " ";
            cout << v[i];
        }
        cout << endl;
    }
    return 0;
}

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

int main(){
  int n;
  int elm[]={1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
  int use[10];
  int i;

  while(cin>>n){
    for(i=0; i<10; i++) use[i]=0;
    for(i=9; i>=0; i--){
      if(n<elm[i]) continue;
      n-=elm[i]; use[i]=1;
      if(n==0) break;
    }
    if(use[0]==1) printf("1");
    for(i=1; i<9; i++)
      if(use[i]==1) printf(" %d", elm[i]);
    printf("\n");
  }

  return 0;
}

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

using namespace std;

int main(void)
{
    int a;
    while ( scanf("%d", &a) != EOF) {
        bool fl = false;
        for (int i = 0; i < 10; i++) {
            if ((a&1) == 1) {
                if (fl) {
                    cout << " ";
                } else { 
                    fl = true;
                }
                cout << (1<<i);
            } 
            a >>= 1;
        }
        puts("");
    }
    return 0;
}

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

using namespace std;

int main(void){

  int w[10];
  for( int i = 0 ; i < 10 ; i++ ){
    w[i] = pow( (double)2 , i );
  }

  int thing;
 b:
  while( cin >> thing ){

    int h[10];
    int j = 0;
    int cnt = 0;

    for( int i = 9 ; i >= 0 ; i-- ){
      thing -= w[i];
      if( thing < 0 ){
	thing += w[i];
      }
      else {
	h[j++] = i;
	cnt++;
      }
      if( thing == 0 ){
	for( int i = cnt - 1 ; i >= 0 ; i-- ){
	  if(i) {
	    cout << w[h[i]] << " ";
	  }
	  else{
	    cout << w[h[i]] << endl;
	    goto b;
	  }
	}
      }
      }
  end:;
  }
  return 0;
}

C++: #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;

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

C++: #include <stdio.h>

int main(void)
{
	int n;
	while (scanf("%d", &n) != EOF){
		int i;
		int flag;

		flag = 0;
		for (i = 0; i < 9; i++){
			if (((n >> i) & 1) != 0){
				if (flag == 0){
					printf("%d", 1 << i);
				}
				else {
					printf(" %d", 2 << i);
				}
				flag = 1;
			}
		}
		puts("");
	}
	return (0);
}