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>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
typedef pair<int,int> pint;
#define rep(i,n) for(int i=0;i<n;i++)
#define F first
#define S second
int dx[]={1,-1,0,0},dy[]={0,0,1,-1};

int main(){
	int n;
	for(;cin>>n;){
		int k=1;
		while(n){
			if(n&1){
				cout<<k;
				cout<<(n!=1?' ':'\n');
			}
			n/=2;
			k*=2;
		}
	}
	return 0;
}

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

void solve( int w, int* g, bitset<10> b, int i )
{
    if( i == 10 )
    {
        int sum = 0;
        int p;                              //prsentation error回避
        for( int j = 0; j < 10; j++ )
        {
            if( b[j] == 1 )
            {
                sum += g[j];
                p = j;
            }
        }
        if( w == sum )
        {
            for( int j = 0; j < 10; j++ )
            {
                if( b[j] == 1 )
                {
                    cout << g[j];
                    if( p != j )
                        cout << " ";
                }
            }
        }
        return;
    }
    b[i] = 0;
    solve( w, g, b, i + 1 );

    b[i] = 1;
    solve( w, g, b, i + 1 );

}

int main()
{
    int a = 1, w, g[10];
    bitset<10> b;

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

    while( cin >> w )
    {
        solve( w, g, b, 0 );
        cout << endl;
    }

    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  while(cin >> n){
    int ans[100]={},cnt=0;
    while(n){
      ans[cnt]=n%2;
      n/=2;
      cnt++;
    }
    int tmp=1;
    bool f=true;
    for(int i=0;i<cnt;i++){
      if(ans[i]>0){
        if(!f){
          cout << " ";
        }
        cout << ans[i]*tmp;
        f=false;
      }
      tmp*=2;
    }
    cout << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <string>
#include <math.h>
#include <stdio.h>
#include <ctype.h>

using namespace std;

int main () {
    int weight[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
    int x;
    while(cin>>x){
        for(int i=0; i<1023; i++){
            int bit =i;
            int sum =0;
            for(int j=0; j<10; j++){
                if(bit&1==1){
                    sum+=weight[j];
                }
                bit=bit>>1;
            }
            
            if(sum == x){
                for(int j=0; j<10; j++){
                    if(i&1==1){
                        cout<<weight[j]<<" ";
                    }
                    i=i>>1;
                }
                cout<<endl;
                break;
            }
            
            
            
        }
    }
    return 0;
}

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

int main(){
  int w[]={512,256,128,64,32,16,8,4,2,1};
  int n;
  while(cin>>n){
    stack<int> a;
    for(int i=0;i<10;i++){
      if(n>=w[i]){
	a.push(w[i]);
	n-=w[i];
      }
    }
    cout<<a.top();
    a.pop();
    while(!a.empty()){
      cout<<' '<<a.top();
      a.pop();
    }
    cout<<endl;
  }
  return 0;
}

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

int main(void){
	int n;
	while(cin>>n){
		int m[10]={0};
		int i=0;
		for(int max = 1024;max /= 2;max<1){
			if(n>=max){
//				cout<<max<<" "<<n<<endl;
				n=n-max;
				m[i++]=max;
//				cout<<max<<endl;
			}
		}
		
		sort(m,m+10);
		for(i=0;i<10;i++)
			if(m[i]!=0){
				cout<<m[i];
				break;
			}
		for(int j=i+1;j<10;j++)
			if(m[j]!=0)cout<<" "<<m[j];
		cout<<endl;
	}
}

C++: #include <iostream>
#include <string>
#include <math.h>
#include <stdio.h>
#include <ctype.h>

using namespace std;

int main () {
    int weight[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
    int x;
    while(cin>>x){
        for(int i=0; i<=1023; i++){
            int bit =i;
            int sum =0;
            for(int j=0; j<10; j++){
                if(bit%2==1){
                    sum+=weight[j];
                }
                bit=bit/2;
            }
            
            if(sum == x){
                int flag = 0;
                for(int j=0; j<10; j++){
                    if(i%2==1&&flag==0){
                        cout<<weight[j];
                        flag++;
                    }else if(i%2==1){
                        cout<<" "<<weight[j];
                    }
                    i=i/2;
                }
                cout<<endl;
                break;
            }
            
            
            
        }
    }
    return 0;
}

C++: #include<iostream>
#include<vector>
int main(){
	int w;
	int weight[10]={1,2,4,8,16,32,64,128,256,512};
	std::vector<bool> vec(10,0);
	while(1){
		int a=0;
		std::cin>>w;
		if(std::cin.eof())break;
		//if(w==0)break;
		while(w>0){
			vec[a]=w%2;
			w/=2;
			a++;
		}
		for(int i=0;i<10;i++){
			if(vec[i]!=0)std::cout<<weight[i]<<" ";
		}
		std::cout<<std::endl;
	}
	return 0;
}

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

int main() {
  int n;
  while (cin >> n) {
    vector<int> v;
    for (int i = 0; i < 10; i++) {
      if (1 << i & n) {
        v.push_back(1 << i);
      }
    }
    cout << v[0];
    for (size_t i = 1; i < v.size(); i++) {
      cout << " " << v[i];
    }
    cout << "\n";
  }
}

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());

    int flag=0;
    for(auto i:result){
      if(flag==1)
	cout<<" ";
      else flag=1;
      cout<<i;
    }
    
    cout<<endl;
    result.clear();
  }
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
  int n;
  int square[]={1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
  vector<int> num;

  while(cin >> n){
    if(n == 0) break;

    for(int i = 9; i >= 0; i--){
      if(n >= square[i]){
        num.push_back(i);
        n -= square[i];
      }
    }

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

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

using namespace std;

int main() {

	int v;
	while (cin >> v) {
		int sum = 0;
		for(unsigned i = 0; i < 10; ++i) {
			if ((v>>i)&1) {
				sum += pow(2,i);
				cout << pow(2,i);
				if (sum != v) cout << " ";
			}
		}
		cout << endl;
	}

	return 0;
}