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 <cmath>
#include <string>
#include <vector>


using namespace std;

int retMaxPow2(int n){
  int i=0;
  while(true){
    int tmp = pow(2, i);
    if(n<tmp){
      break;
    }
    i++;
  }

  return (i-1);
}

int main(){
  int tmp;
  vector<int> nums;
  while(cin >> tmp){
    int n = tmp;
    while(true){   
      // cout << n << " >= " << "2^" << retMaxPow2(n) << endl;
      nums.push_back(pow(2, retMaxPow2(n)));
      n -= pow(2, retMaxPow2(n));
      
      if(n==0){
	break;
      }
    }

    for(int i=0;i<nums.size();i++){
      if(i==nums.size()-1){
	cout << nums[nums.size()-1-i] << endl;
      }else{
	cout << nums[nums.size()-1-i] << " ";
      }
    }
    nums.clear();
      
  }
}

C++: #include <bits/stdc++.h>
using namespace std;

void solve(int n) {
  string str;
  for (int i = 0; i < 10; i++)
    if ((n >> i) & 1)
      str += to_string(1 << i) + " ";

  if (!str.empty())
    str.pop_back();

  cout << str << endl;
}

int main() {
  int n;
  while (cin >> n)
    solve(n);

  return 0;
}

C++: #include <iostream>
#include <cmath>
#include <vector>
#include <cstdio>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define repp(i,r,n) for(int i=r;i<(int)n;i++)
using namespace std;
int in(){int x;cin>>x;return x;}
string s[10]={"1","2","4","8","16","32","64","128","256","512"};
int ss[10]={1,2,4,8,16,32,64,128,256,512};
string ans[1200];

void sss(string z,int y,int l)
{
	
	ans[y]=z;
	if(l==10)return ;
	sss(z,y,l+1);
	z+=" ";
	z+=s[l];
	y+=ss[l];
	sss(z,y,l+1);
	return ;

}


int main ()
{
	int a;
	sss("",0,0);	
	while(scanf("%d",&a)!=EOF)
	{
		cout<<ans[a]<<endl;
	}

	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;

int main(){
    int n;
    while(scanf("%d",&n)!=EOF){
        bool flag=false;
        for(int i=0;i<10;i++){
            if((n>>i)&1){
                if(flag)printf(" ");
                else flag=true;

                printf("%d",1<<i);
            }
        }
        puts("");
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
int main() {
  int n;
  while(cin>>n) {
    for(int i=0; i<10; i++) {
      if(n&1) {
    cout << (1<<i);
    if(n>>1) cout << " ";
      }
      n >>= 1;
    }
    cout << endl;
  }
  return 0;
}

C++: #include<iostream>

using namespace std;

int main(){
	int n,d[10]={512,256,128,64,32,16,8,4,2,1};
	int a[10],c=0;
	while(cin>>n){
	c=0;
		for(int i=0;i<10;i++){
			a[i]=0;
			while(d[i]<=n){n-=d[i];a[i]=++c;}
		}
		
		for(int i=9;i>=0;i--){
			if(a[i]>1)cout<<d[i]<<" ";
			if(a[i]==1){cout<<d[i];}
		}
		cout<<endl;
	}

}

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

int main() {
  int w;
  while(cin >> w) {
    int data[10];
    int p = 0;
    for(int i = 512; i > 0; i /= 2) {
      if(i <= w) {
	data[p++] = i;
	w -= i;
	if(w == 0) {
	  break;
	}
      }
    }
    for(p--; p >= 0; p--) {
      cout << data[p];
      if(p == 0) {
	cout << endl;
      } else {
	cout << ' ';
      }
    }
  }
  return 0;
}

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

int main(){

  int weight;
  int n;

  while(cin>>weight){
    vector<int> result;
    while(1){
      if(weight == 0 || weight == 1 || weight ==2 || weight ==4 || weight ==8 || weight ==16 || weight ==32 || weight ==64 || weight ==128 || weight ==256 || weight ==512){
	result.push_back(weight);
	break;
      }
      if(weight<4)
	n=2;
      else if(weight<8)
	n=4;
      else if(weight<16)
	n=8;
      else if(weight<32)
	n=16;
      else if(weight<64)
	n=32;
      else if(weight<128)
	n=64;
      else if(weight<256)
	n=128;
      else if(weight<512)
	n=256;
      else
	n=512;
      
      result.push_back(n);
      weight-=n;
    }

    sort(result.begin(),result.end());

    for(auto i:result)
      cout<<i<<" ";
    cout<<endl;
    result.clear();
  }
}

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) {
		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>
#include <vector>
using namespace std;

int main() {
	for (int left; cin >> left;) {
		vector<int> scales;
		for (int right = 512; right; right /= 2) {
			if (left / right) {
				left -= right;
				scales.push_back(right);
			}
		}
		do {
			cout << scales.back();
			scales.pop_back();
			cout << (scales.empty() ? '\n' : ' ');
		} while (!scales.empty());
	}

	return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <set>
#include <cmath>
#include <algorithm>
using namespace std;

int main(){
	int n , j=0;
	vector<int> v;
	while(cin>>n){
		for(int i=512 ; i>=1 ; i>>=1){
			if(n>=i){
				v.push_back(i);
				n-=i;
			}
		}
		sort(v.begin(),v.end());
		vector<int>::iterator it;
		for(it=v.begin();it!=v.end()-1;++it){
			cout << *it << " ";
		}
		cout << *it << endl;
		v.clear();
	}
	return 0; 
}

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

int main(){
	int n;
	while(cin >> n){ 
		int weight[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
		for(int i = 9; i >= 0; i--){
			if(n >= pow(2, i)){
				n -= pow(2, i);
				weight[i] = 1;
			}
		}

		cout << "1";
		for(int i = 1; i < 10; i++){
			if(weight[i]){
				cout << " " << pow(2, i);
			}
		}
		cout << endl;
	}

	return 0;
}

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

int main()
{
	int m;
	while(cin >> m)
	{
		int w=1;
		while(m)
		{
			if(m&1) cout << (w==1?"":" ") << w;
			m = m>>1;
			w = w<<1;
		}
		cout << endl;
	}
}

C++: #include <iostream>

using namespace std;
int main(void){
    // Here your code !
int n;

while(cin>>n){
bool flag=false;

for(int i=1;i<=512;i=i*2){

if(n%(i*2)!=0){
    if(flag) cout<<" ";
    flag=true;
    cout<<i;
    n=n-i;
}
}

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

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

using namespace std;

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

C++: #include<bits/stdc++.h>
using namespace std;
int n;
int main() {
	while(cin>>n){
		for (int i = 0; i < 11; ++i) {

			if(n%2){
				if(i!=0){
					cout<<" "<<pow(2,i);
				}else{
					cout<<pow(2,i);
				}
			}
			if(n==1)break;
			n=n/2;
		}
		cout<<" "<<endl;
	}
}