Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() (int, error) {
	return strconv.Atoi(nextString())
}

func main() {
	scanner.Split(bufio.ScanWords)

	for {
		n, err := nextInt()
		if err != nil {
			break
		}

		w := 512
		weights := make([]int, 10)
		for i := 9; i >= 0; i-- {
			if n >= w {
				weights[i] = w
				n -= w
			}
			w /= 2
		}

		output := []int{}
		for i := 0; i < 10; i++ {
			if weights[i] > 0 {
				output = append(output, weights[i])
			}
		}
		outputStr := fmt.Sprint(output)
		fmt.Println(outputStr[1:(len(outputStr) - 1)])
	}
}

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

int main() {
    int month, day;
    string weekday[7] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };
    while (cin >> month >> day) {     
        time_t rawtime;
        struct tm * timeinfo;

        time(&rawtime);
        timeinfo = localtime(&rawtime);

        timeinfo->tm_year = 2004-1900;
        timeinfo->tm_mon = month - 1;
        timeinfo->tm_mday = day;
        
        mktime(timeinfo);

        cout << weekday[timeinfo->tm_wday] << endl;
    }
    return 0;
}

C++: #include <stdio.h>

#define SIZE 10
int main(void){
    int w;
    int tmp;
    int first;

    while (scanf("%d", &w)!= EOF){
        tmp = 1;
        first = 1;
        while (w){
            if (w & 1){
                printf(first?"%d":" %d", tmp);
                first = 0;
            }
            tmp <<= 1;
            w >>= 1;
        }
        printf("\n");
    }

    return 0;
}

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

int main() 
{
  int wigth;
  cin >> wigth;
  int i = 1;
  bool flag = false;
  while (i < 256) {
    if (wigth & i) {
      if (flag) cout << " ";
      cout << i;
      flag = true;
    }
    i *= 2;
  }
  if (flag) cout << " ";
  if (wigth & i) cout << i << endl;
  else cout << endl;

  return 0;
}

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


int main(){
	int weight[11];
	weight[1] = 1;
	for(int i = 2;i<=10;i++)weight[i]=2*weight[i-1];
	while(true)
	{
	int object;
	cin >> object;
	for(int i =1;i <=10;i++){
		if((object % 2)==1)
			{
			cout << weight[i] ;
			if( i != 10 ) cout << " ";
			}
		object = object /2;
		}
	cout << endl;
	if (cin.eof())break;
	}
	
	return 0;
}

C++: #include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define LOOP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define MP make_pair
#define FR first
#define SC second
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;


signed main(){
  int n;
  while(cin>>n){
    vector<int> x={1,2,4,8,16,32,64,128,256,512};
    vector<int> ans;
    while(n){
      int tmp;
      for(int i=0;i<10;i++){
        if(n>=x[i])tmp=x[i];
      }
      n-=tmp;
      ans.PB(tmp);
    }
    for(int i=ans.size()-1;i>=0;i--){
      cout<<ans[i]<<' ';
    }
    cout<<endl;
  }
  return 0;
}

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

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

C++: #include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define LOOP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define MP make_pair
#define FR first
#define SC second
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;


signed main(){
  int n;
  while(cin>>n){
    vector<int> x={1,2,4,8,16,32,64,128,256,512};
    vector<int> ans;
    while(n){
      int tmp;
      for(int i=0;i<10;i++){
        if(n>=x[i])tmp=x[i];
      }
      n-=tmp;
      ans.PB(tmp);
    }
    for(int i=ans.size()-1;i>=0;i--){
      cout<<ans[i];
      if(i!=0)cout<<' ';
    }
    cout<<endl;
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int weights[10] = { 1,2,4,8,16,32,64,128,256,512 };
bool have[10] = { false,false,false,false,false,false,false,false,false,false };
int main() {
	int w;
	while (cin >> w) {
		int now = 0;
		int tmp = 0;
		for (int i = 0; i < 10; i++)have[i] = false;
		while (tmp < w) {
			tmp += weights[now];
			have[now] = true;
			now++;
		}
		while (tmp != w) {

			if (have[now]) {
				if (tmp - weights[now] >= w) {
					tmp -= weights[now];
					have[now] = false;
					now--;
				}
				else now--;
			}
			else {
				now--;
			}
		}
		for (int i = 0; i < 10; i++) {
			if (have[i]) {
				if (i != 9)cout << weights[i] << ' ';
				else  cout << weights[i];
			}
		}
		cout << endl;
	}
}

C++: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main() {
  int n, max;
  bool b[10];
  int w[10] = {512, 256, 128, 64, 32, 16, 8, 4, 2, 1};

  while(cin >> n) {
    fill(b, b+10, false);
    max = 0;    
    for(int i = 0; i < 10; i++) {
      if(n/w[i] > 0) {
	b[i] = true;
	n -= w[i];
	if(max < w[i]) max = w[i];
      }
    }

    for(int i = 9; i >= 0; i--) {
      if(b[i]) {
	cout << w[i];
	if(w[i] == max) cout << endl;
	else cout << ' ';
      }
    }
  }
}

C++: #include<stdio.h>
#include<string.h>
int main()
{
    int i,left,tmp;
    int w[10];
    char c;
    while (scanf("%d", &left) != EOF) {
        memset(w,0,sizeof(w));
        for (i=9;i>=0;i--) {
            tmp = 1<<i;
            if (left>=tmp) {
                w[i]=1;
                left-=tmp;
            }
        }
        c = '\0';
        for (i=0;i<10;i++) {
            if (w[i]) {
                printf("%c%d",c,1<<i);
                fprintf(stderr, "%c%d",c,1<<i);
                c = ' ';
            }
        }
        printf("\n");
    }
    return 0;
}