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>

using namespace std;

template<typename T> string to_string(const T& v) {
  string str;
  for (const auto& i : const_cast<T&>(v)) str += to_string(i) + " ";
  return str.substr(0, max(0, (int)str.size() - 1));
}

#ifdef __MINGW32__

template<> string to_string<int>(const int& v) {
  stringstream ss;
  ss << v;
  return ss.str();
}

template<> string to_string<long>(const long& v) {
  stringstream ss;
  ss << v;
  return ss.str();
}

template<> string to_string<long long>(const long long& v) {
  stringstream ss;
  ss << v;
  return ss.str();
}

template<> string to_string<unsigned int>(const unsigned int& v) {
  stringstream ss;
  ss << v;
  return ss.str();
}

template<> string to_string<unsigned long>(const unsigned long& v) {
  stringstream ss;
  ss << v;
  return ss.str();
}

template<> string to_string<unsigned long long>(const unsigned long long& v) {
  stringstream ss;
  ss << v;
  return ss.str();
}

template<> string to_string<float>(const float& v) {
  stringstream ss;
  ss << v;
  return ss.str();
}

template<> string to_string<double>(const double& v) {
  stringstream ss;
  ss << v;
  return ss.str();
}

template<> string to_string<long double>(const long double& v) {
  stringstream ss;
  ss << v;
  return ss.str();
}

#endif

int main() {
  int n;
  while (cin >> n) {
    int t = 1;
    vector<int> res;
    for (; n; n /= 2, t *= 2) if (n % 2) res.emplace_back(t);
    cout << to_string(res) << endl;
  }
}

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

int main(){
	int n;
	int bit[10];
	for(int i=0;i<10;i++){
		int a = 1;
		for(int j=0;j<i;j++) a *= 2;
		bit[i] = a;
	}
	while(cin>>n){
		bool s = false;
		int k[10];
		for(int i=0;i<10;i++){
			k[i] = n%2;
			n = (n-k[i])/2;
			if(k[i]==1){
				if(not s){ s = true; cout << bit[i];}
				else cout << " " << bit[i];
			}
		}
		cout << endl;
	}
}

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

using namespace std;

int main(void) {
	int weight;
	while(cin >> weight) {
		int bundo[10];
		for(int i = 9; i >= 0; i--) {
			if(weight >= pow(2, i)) {
				bundo[i] = 1;
				weight -= pow(2, i);
			} else {
				bundo[i] = 0;
			}
		}
		
		for(int i = 0; i < 8; i++) {
			if(bundo[i] == 1) {
				cout << pow(2, i) << ' ';
			}
		}
		if(bundo[9] == 1) {
			cout << pow(2, 9);
		}
		cout << endl;
	}
	
	return 0;
}

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

int main(){
  int w;
  while(cin >> w){
    int a = 1; 

    while(w > 0){
      if(w == 1){
        cout << a;
      } else if(w & 1){
        cout << a << " ";
      }
      w /= 2; a *= 2;
    }
    cout << endl;
  }
}

C++: #include<iostream>

using namespace std;

bool a[10];

int main(){
    
    int N;
    int i=0;
    
    while(!cin.eof())
    {
        cin>>N;
        
        for(int 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>
using namespace std;

int main()
{
	int n, count = 0, sum = 1;
	int ans[100][9], data[100] = {0}, ansdata[100];
	for (int a = 0; a <= 9; a++) {
		data[a+1] = sum;
		sum = sum * 2;
	}
	while (cin >> n) {
		sum = 0;
		int count2 = 0,sin=1;
		for (int a = 0; a <= 9; a++) {
			if (n % 2 == 0 && sin==1) {
				sum = sum - 1;
			}
			sum = sum + data[a + 1];
			ans[count][count2] = a+1;
			if (sum > n) {
				sum = sum - (data[a]);
				count2 = count2 - 1;
				ans[count][count2] = a + 1;
				a--;
			}
			if (n % 2 == 0 && sin == 1) {
				count2--;
				sin = 2;
			}
			count2++;
			if (sum == n)
				break;
		}
		ansdata[count] = count2;
		count++;
	}
	for (int a = 0; a <= count; a++) {
		for (int b = 0; b < ansdata[a]; b++) {
			cout << data[ans[a][b]]<< " ";
		}
		cout << endl;
	}
	return 0;
}

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 <iostream>
#include <stack>
using namespace std;

int main(){
  int w,we[9]={1,2,4,8,16,32,64,128,256},i;
  stack<int> k;
  while(cin>>w){

    while(w!=0){
      k.push(w%2);
      w=w/2;
    }
    i=0;
    while(k.size()){
      if(k.top()==1&&k.size()>=2)cout<<we[i]<<" ";
      else if(k.top()==1)cout<<we[i]<<endl;
      k.pop();
      i++;
    }
  }
  return 0;
}

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

using namespace std;

int str[10];

void getBinStr(int target) {
  int nowMod;
  int nowDiv = target;
  int i;

  for(i = 0; i < 10 && nowDiv != 0; i++) {
    nowMod = nowDiv % 2;
    nowDiv /= 2;
    str[i] = nowMod;
  }
  for(int j = i; j < 10; j++) {
    str[j] = 0;
  }
}


int main(void) {
  int target;
  const static int weight[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
  while(cin >> target) {
    getBinStr(target);
    bool isFirst = true;
    for(int i = 0; i < 10; i++) {
      if(str[i] == 1) {
        if(isFirst) {
          cout << weight[i];
          isFirst = false;
        }
        else {
          cout << " " << weight[i];
        }
      }
    }
    cout << endl;
  }
  return 0;
}

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

C++: #include <iostream>

using namespace std;

int main(){
	int two[15]={},n,cnt=-1,check[15]={},last=0;
	for(int i=0;i<11;i++){
		two[i]=1;
		for(int j=0;j<i;j++)two[i]*=2;
	}
	while(cin>>n){
		cnt=-1;
		last=0;
		for(int i=0;i<10;i++){
			check[i]=0;
			if(n<two[i+1]){
				cnt=i;
				break;
			}
		}
		for(int i=cnt;i>=0;i--){
			if(n%2==1)check[i]++;
			n/=2;
			//cout<<check[i]<<" "<<n<<endl;
		}
		for(int i=0;i<10;i++)if(check[i]==1)last=i;
		for(int i=0;i<10;i++){
			if(check[i]==1&&last!=i)cout<<two[i]<<" ";	
			else if(i==last)cout<<two[i]<<endl;
		}
	}
	}