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 "bits/stdc++.h"
#define int long long
#define range(i, a, b) for(auto i = a; i < b; i++)
#define rep(i, a) range(i, 0, a)
#define all(a) (a).begin(),(a).end()
using namespace std;
const int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
const int MOD = 1000000007;
const long double EPS = 1e-8;
using vi = vector <int>;
using vvi = vector <vi>;

signed main() {
	int n;
	while (cin >> n) {
		rep (i, 1 << 10) {
			int sum = 0;
			rep (j, 10) {
				if (i >> j & 1) {
					sum += pow(2, j);
				}
			}
			if (sum == n) {
				bool First = true;
				rep (j, 10) {
					if (i >> j & 1) {
						if (!First)
							cout << " ";
						else
							First = false;
						cout << pow(2, j);
					}
				}
				cout << endl;
				break;
			}
		}
	}
	return 0;
}

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

int main() {
	int n;
	int w[10];
	int b[10];
	
	while (cin >> n) {
		for (int i=9;i>=0;i--){
			w[i] = pow(2,i);
			if (n >= w[i]) {
				n = n - w[i];
				b[i] = 1;
			}
			else { b[i] = 0; }
		}
		for (int i = 0; i <= 8; i++) {
			if (b[i]==1) {
				cout << w[i] << " ";
			}
		}
		if (b[9] == 1) {
			cout << w[9];
		}
		cout << endl;
	}
}

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

C++: #include <cstdio>
#include <cstdlib>
#include <algorithm>

using namespace std;

int input,temp,a;
int print[11];

int main()
{
	while(scanf("%d",&input)!= EOF)
	{
	a=10;
	temp=512;
	for(int z=0;z<11;z++)
	{
		print[z]=0;
	}
	while(temp>=1)
	{
		if(input<temp)
		{
			temp=temp/2;
		}
		else if(temp<=input&&temp!=1)
		{
			input-=temp;
			print[a]=temp;
			a--;
			temp/=2;
		}
		else
		{
			input-=temp;
			print[a]=temp;
			a--;
			temp=0;
			break;
		}
	}
	for(int z=0;z<11;z++)
	{
		if(print[z]!=0)
		printf("%d ",print[z]);
	}
	printf("\n");
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
	int W;
	while(cin>>W)
	{
		bool flag=0;
		for(int i=1;i<=W;i*=2)
		{
			if(W/i%2>0)
			{
				if(flag)
				{
					cout<<' ';
				}
				cout<<i;
				flag=1;
			}
		}
		cout<<endl;
	}
	return 0;
}

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

int main(){
    int n;
    while(cin >> n){
        int p = 1;
        bool f = false;
        while(n){
            if(n & 1){ if(f) cout << " "; cout << p; f = true; }
            p *= 2; n >>= 1;
        }
        cout << endl;
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
int main() {
    int n;
    while (cin >> n) {
        bool first = true;
        for (int i=1; i<=512; i*=2) {
            if (n & i) {
                if (first) {
                    first = false;
                    cout << i;
                } else {
                    cout << " " << i;
                }
            }
        }
        cout << endl;
    }
    return 0;
}

C++: #include <stdio.h>

int main(void) {
  int i, j, k, w;
  while( scanf("%d", &w) != EOF ) {
    int now = 1, f = 1;
    while(w) {
       if(w % 2) {
         if(f) {
           printf("%d", now);
           f = 0;
         } else printf(" %d", now);
       }
       w /= 2, now *= 2;
    }
    printf("\n");
  }
  return 0;
}

C++: 5
7
127

C++: #include<iostream>

using namespace std;

bool a[10];

int main(){
    
    int N;
    int i=0;
    
    while(!cin.eof())
    {
        cin>>N;
        
        for(j=0;j<10;j++)
        {
            a[j]=0;
        }
        
        i=0;
        
        if(i+512 <= N){
            i += 512;
            a[9] = 1;
        }

        if(i+256 <= N){
            i += 256;
            a[8] = 1;
        }
        
        if(i+128 <= N){
            i += 128;
            a[7] = 1;
        }
        
        if(i+64 <= N){
            i += 64;
            a[6] = 1;
        }
        
        if(i+32 <= N){
            i += 32;
            a[5] = 1;
        }
        
        if(i+16 <= N){
            i += 16;
            a[4] = 1;
        }
        
        if(i+8 <= N){
            i += 8;
            a[3] = 1;
        }
        
        if(i+4 <= N){
            i += 4;
            a[2] = 1;
        }
        
        if(i+2 <= N){
            i += 2;
            a[1] = 1;
        }
        
        if(i+1 <= N){
            i += 1;
            a[0] = 1;
        }
        
        cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<" "<<a[3]<<" "<<a[4]<<" "<<a[5]
            <<" "<<a[6]<<" "<<a[7]<<" "<<a[8]<<" "<<a[9]<<" "<<endl;
    }
}

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

using namespace std;

int main()
{
  while (true) {
    int omori = 512, x;
    scanf("%d", &x);
    do {
      if (x % omori == 0) {
	x -= omori;
	cout << omori << " ";
	omori /= 2;
      }
    } while (x != 0);
  }
  return 0;
}