Go: 
package main

import (
	"fmt"
	"math"
)

func solve(n int) int {
	i := 0
	for {
		if val := math.Pow(2, float64(i)); val*2 > float64(n) {
			return int(val)
		}
		i++
	}
}

func main() {
	for {
		var n int
		_, err := fmt.Scan(&n)
		if err != nil {
			break
		}

		res := []int{}
		for {
			val := solve(n)
			res = append(res, val)
			n -= val

			if n <= 0 {
				break
			}
		}

		for i := range res {
			if i != 0 {
				fmt.Print(" ")
			}
			fmt.Print(res[len(res)-i-1])
		}
		fmt.Println()
	}
}

C++: #include <cstdio>

using namespace std;

int main() {
    int n = 0;

    while (scanf("%d", &n) != EOF) {
        int t = 1;

        for (int i = 0; i < 10; ++i) {
            if ((n & t) == t) {
                if (i != 0) {
                    printf(" ");
                }
                printf("%d", t);
            }

            t *= 2;
        }
        printf("\n");
    }

    return 0;
}

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

int main(){

  int a[10], b[10], g, cnt;

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

  fill(b, b+10, 0);
  cnt = 0;
  while(cin >> g){
    for(int i=9; i>=0 || g == 0; i--){
      if(a[i] <= g){
        b[i] = 1;
        g -= a[i];
        cnt++;
      }
    }

    for(int i=0; i<10; i++){
      if(b[i] == 1){
        cnt--;
        cout << a[i] << (cnt? " " : "");
        b[i] = 0;
      }
    }
    cout << endl;

  }

  return 0;

}

C++: #include <iostream>
#include <string.h>

using namespace std;
int weight[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
void solve()
{
	int a;
	while(cin >> a)
	{
		bool flag[10];
		memset(flag, 0, sizeof(bool)  * 10);
		for(int i = 9; i >= 0; --i)
		{
			if(a / weight[i])
			{
				flag[i] = true;
			}
			a %= weight[i];
		}
		int pos = 0;
		for(int i = 0; i < 10; ++i)
		{
			if(flag[i])
			{
				cout << weight[i];
				pos = i;
				break;
			}
		}
		for(int i = pos + 1; i < 10; ++i)
		{
			if(flag[i])
			{
				cout << " " << weight[i];
			}
		}
		cout << endl;
	}
}

int main()
{
	solve();
	return(0);
}

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