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 <stdio.h>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <sstream>

using namespace std;

#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) (EQ((a).real(),(b).real()) && EQ((a).imag(),(b).imag()))

typedef complex<double> P;
typedef long long ll;

const int MAX_SIZE = 10000;

int main(){

	int n;
	while(cin >> n && n != 0){
		ll *b = new ll[41126];
		fill(b,b+41126,0);

		ll *prv = new ll[41126];
		ll *nxt = new ll[41126];
		int p ,nx;
		p = nx = 0;
		for(int i = 0; i < (n*(n+1))/2; i++){
			ll tmp;
			cin >> tmp;
			if(tmp % 2 == 0){
				prv[p++] = tmp;
			}
			else{
				nxt[nx++] = tmp;
			}
		}
		sort(prv,prv+p);
		sort(nxt,nxt+nx);

		int idx = 0;
		for(int i = 0; i < p; i++){
			b[idx++] = prv[i];
		}
		for(int i = 0; i < nx; i++){
			b[idx++] = nxt[i];
		}

		double aa = (b[0]*b[1])/b[n];
		aa = sqrt(aa);
		vector<int> nums;
		int vvv = (int)(aa+0.1);
		for(int i = 0; i < p; i++){
			nums.push_back(b[i]/vvv);
		}

		cout << vvv << endl;
		sort(nums.begin(),nums.end());
		for(int i  = 0; i < nums.size(); i++){
			cout << nums[i];
			if(nums.size() - 1 == i)
				cout << endl;
			else
				cout << " ";
		}
		delete [] prv;
		delete [] nxt;
		delete [] b;
	}

	return 0;
}

C++: //
//
//
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <algorithm>
using namespace std;
const int a[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
vector<int> solve(int n){
	vector<int> ans;
	int res = n;
	while(res != 0){
		for (int i = 0; i < 10; i++) {
			if(n - a[i] < 0){
				continue;
			}
			if((n - a[i]) < res) {
				res = n - a[i];
			}
		}
		ans.push_back(n - res);
		n = res;
	}
	return ans;
}
int main(void) {
	vector<int> ans;
	int n;
	while(cin >> n) {
		ans = solve(n);
		while(ans.size() > 1){
			cout << ans.back() << " ";
			ans.pop_back();
		}
		cout << ans.back() << endl;
	}
	return 0;
}

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

int main(){
int n;
while(cin>>n)
{
	if(n%2==1){
		cout<<"1 ";
		n-=1;
		}
		
	if(n%4==2){
		cout<<"2 ";
		n-=2;
		}	
		
	if(n%8==4){
		cout<<"4 ";
		n-=4;
		}	
		
	if(n%16==8){
		cout<<"8 ";
		n-=8;
		}	
		
	if(n%32==16){
		cout<<"16 ";
		n-=16;
		}	
		
	if(n%64==32){
		cout<<"32 ";
		n-=32;
		}	
		
	if(n%128==64){
		cout<<"64 ";
		n-=64;
		}	
		
	if(n%256==128){
		cout<<"128 ";
		n-=128;
		}	
		
	if(n%512==256){
		cout<<"256 ";
		n-=256;
		}	
		
	if(n%1024==512){
		cout<<"512 ";
		n-=512;
		}	
		cout<<'\b'<<'\n';
	}
	return 0;
		}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>

#define rep(i, n) for(int i = 0; i < n; i ++)
#define ALL(T) T.begin(), T.end()

using namespace std;

typedef pair<int, int> pii;
typedef unsigned long long ull;

const int M = 512;

int main(void){
    for(int w; cin >> w; cout << endl)
        for(int a = 1; a <= M; a *= 2)
            if(a & w) cout << (a - 1 ? " ":"") << a;

    return 0;
}

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 && n!= EOF) {
		REPR(i,9) {
			if (n >= V[i]) {
				judge[i] = true;
				n -= V[i];
			}
			if (n == 0)
				break;
		}

		REP(i,10) {
			if (judge[i] == true)cout << V[i] << ' ';
			judge[i] = false;
		}
		cout << endl;
	}

	return 0;
}

C++: #include<stdio.h>
int main(){
	int a;
	while(~scanf("%d",&a)){
		for(int i=0;i<10;i++)if(1<<i&a)printf("%d ",1<<i);
		printf("\n");
	}
}

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

C++: #include <iostream>

int main() {
	int w;
	while (std::cin >> w) {
		bool f = false;
		for (int s = 1; s <= 512; s <<= 1, w >>= 1) {
			if ((w & 1) != 0) {
				if (f) { std::cout << ' '; }
				else { f = true; }
				std::cout << s;
			}
		}
		std::cout << std::endl;
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <string>
#include <map>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

int main(void)
{
    int h[10], w;
    vector<int> ans;
    rep(i, 10) {
        h[i] = pow(2.0, (double)i);
    }
    
    while (cin >> w) {
        ans.clear();
        for (int i = 9; i >= 0; i--) {
            if (w <= 1) {
                ans.push_back(h[0]);
                break;
            }
            else if (h[i] <= w){
                ans.push_back(h[i]);
                w -= h[i];
            }
        }
        
        for (int i = (int)ans.size() - 1; i >= 0; i--) {
            cout << ans[i];
            i == 0 ? cout << endl : cout << " ";
        }
    }

    return 0;
}

C++: #include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 };

int main() {
int n;
while (cin >> n){
	REP(i, 10){
		if (n % (1 << (i+1))){
			cout << (1<<i);
			n -= 1 << i;
			if (n==0)
			break;
			cout << " ";
		}
		
	}
	cout << endl;
}
	return 0;
}

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

int main(){
	int w, g[10];
	vector<int> ans;

	for(int i=0,j=1 ; j<=512 ; j*=2, i++){
		g[i] = j;
	}

	while( cin >> w ){
		ans.clear();
		for(int i=9 ; i>=0 ; i--){
			if( w <= 1 ){
				if( w == 1 ) ans.push_back( w ); 
				break;
			}
			else if( g[i] <= w ){
				w -= g[i];
				ans.push_back( g[i] ); 
			}
		}
		for(int i=ans.size()-1 ; i>=0 ; i--){
			cout << ans[i] ;
			(i==0)? cout << endl : cout << " ";
		}
	}
}