Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	for scanner.Scan() {
		n, _ := strconv.Atoi(scanner.Text())
		if n == -1 {
			break
		}
		if n == 0 {
			fmt.Println(0)
			continue
		}
		ans := make([]int, 0)
		for n > 0 {
			ans = append([]int{n % 4}, ans...)
			n = n / 4
		}

		buf := make([]string, len(ans))
		for i := range ans {
			buf[i] = strconv.Itoa(ans[i])
		}
		fmt.Println(strings.Join(buf, ""))
	}
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <vector>
#include <string>
#include <cmath>
#include <map> 
using namespace std;
 
const int MAX= 10000100;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()
#define ll long long int
#define gcd(a,b) __gcd(a,b)

int GCD(int a, int b) {if(!b) return a; return gcd(b, a%b);}
int lcm(int a, int b) {return a*b / gcd(a, b);}

int main(void){
  int n;
  while(cin>>n,n>=0){
    vector<int> ans;
    if(n==0){cout<<"0"<<endl;continue;}
    while(n){
      ans.push_back(n%4);
      n /= 4;
    }
    rep(i,ans.size())cout<<ans[ans.size()-i-1];
    cout<<endl;
  }

}

C++: #include<iostream>
#include<bitset>
#include<string>
using namespace std;
int main() {
    int n, a,j=0;
    bool bo = false;
    int ans[102] = { 0 },ans1=0;
    bitset <101> bset;
    while (1) {
        cin >> n;
        if (n == 0) {
            break;
        }
        bset = n;
        for (int i = bset.size() - 1; i >= 0; i--) {
            if (i % 2 == 0) {
                if (1 & bset[i] == 1) {
                    ans[j] += 1;
                }
                if (i != 0) {
                    j++;
                }
            }
            else {
                if (1 & bset[i] == 1) {
                    ans[j] += 2;
                }
            }
        }
        for (int i = 0; i <= j; i++) {
            if (ans[i] != 0) {
                bo = true;
            }
            if (bo) {
                cout << ans[i];
            }
        }cout << endl;
        bo = false;
        for (int i = 0; i < 102; i++) {
            ans[i] = 0;
        }
        j = 0;
        bset = 0;
    }
    return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

int main() {
  
  int N;
  
  while(cin >> N && N != -1) {
    string s;
    
    if(N == 0) s = "0";
    while(N > 0) {
      s = (char)('0' + (N % 4)) + s;
      N /= 4;
    }
    
    cout << s << endl;
  }
  
  return 0;
}

C++: #include<stdio.h>

#define N 4

void Nshinsu(int);

int main(){
  while(1){
    int n;
    scanf("%d",&n);
    if(n==-1)break;
    Nshinsu(n);
  }
  return 0;
}

void Nshinsu(int n){

  int i,y=0,b=1;

  for(i=0;i<100;i++){    
    y+=(n%N)*b;
    n/=N;
    b*=10;
  }

  printf("%d\n",y);
}

C++: #include<iostream>
#include<string>
using namespace std;
int main() {
	int a[100], b = 0, n, c[100], sum2 = 1;
	long long sum = 1;
	while (sum <= 1000000) {
		a[b] = sum;
		c[b] = sum2;
		b++;
		sum *= 4;
		sum2 *= 10;
	}
	while (cin >> n&&n != -1) {
		char sum3[100];
		bool e = false, f = false;
		sum2 = 0;
		for (int i = b - 1; i >= 0; i--) {
			if (n >= a[i]) {
				e = true;
				f = true;
				int d = (n - (n%a[i])) / a[i];
				sum3[sum2] = (char)d+'0';
				sum2++;
				n -= (a[i] * d);
			}
			if (e&&!f) {
				sum3[sum2] = '0';
				sum2++;
			}
			f = false;
		}
		for (int i = 0; i < sum2; i++) {
			cout << sum3[i];
		}
		cout << endl;
	}
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define INF 1<<30

int main() {
  int n;
  while(cin>>n,n!=-1) {
    string s;
    do {
      s += '0' + n % 4;
      n /= 4;
    } while(n != 0);
    reverse(ALL(s));
    cout << s << endl;
  }
}

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

int main(){
    char num[100];
    int s,value;
    while(cin >> s && s != -1){
        value = 0;
        if(s == 0){
            cout << "0" << endl;
            continue;
        }
        memset(num,0,sizeof(num));
        while(s !=  0){
            num[value] = (s%4)+'0';
            s /= 4;
            value++;
        }
        for(int i=value-1;i>=0;i--){
            (i == 0)? cout << num[i] << endl : cout << num[i];
        }
    }
}

C++: #include<iostream>
using namespace std;
int main() {
	int z[2222], x, kaisuu, m, kai,b;
	kaisuu = 0;
	while (1) {
		cin >> x;
		if (x == -1) {
			goto a;
		}
		kaisuu = kaisuu + 1;
		b = 0;
		kai = 1;
		while (1) {
			m = x % 4;
			x = x - m;
			x = x / 4;
			if (kai == 1) {
				z[kaisuu] = m;
			}
			else {
				z[kaisuu] = z[kaisuu] + m * kai;
			}
			kai = kai * 10;
			if (x == 0) {
				goto aa;
			}
		}
	aa:;
	}
a:;
	for (int i = 1; i <= kaisuu; i++) {
		cout << z[i] << endl;
	}
}

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

int main(){
  int a,b,cou;
  while(1){
    cin >>a;
    if(a==-1)break;
    b=4;
    for(b=4;b<=a;b=b*4);
    b=b/4;
    while(1){
      cout<< a/b;
      a%=b;
      if(b==1)break;
      b=b/4;
    }
    cout << endl;
  }
  return 0;

}

C++: #include <stdio.h>

int main(void)
{
int a[100];
int n;
int index;

while (1){
scanf("%d", &n);
if (n == -1) break;
index = 0;
do {
a[index++] = (n & 0x3);
n >> 2;
} while (n != 0);

index--;
while (index >= 0){
printf("%d", a[index--]);
}

puts("");
}
}

C++: #include<iostream>
using namespace std;
int n,t[1000],size;
int main(){
  while(cin>>n&&n!=-1){
    size=0;
    while(n>0){
      t[size++]=n%4;
      n/=4;
    }

    if(size==0)cout<<0<<endl;
    else{
      for(int i=size-1;i>=0;i--){
	cout<<t[i];
      }
      cout<<endl;
    }
  }
  return 0;
}

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>
#include <cstring>
#include <sstream>
#include <cassert>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
typedef pair<int,int> PI;
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define MP make_pair
#define PB push_back

main(){
  int n;
  while(cin>>n,~n){
    string str;
    while(n){
      str+=n%4+'0';
      n/=4;
    }
    reverse(str.begin(),str.end());
    cout<<str<<endl;
  }
}

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

int main(){
  int n;
  while(1){
    vector<int> ans;
    cin>>n;
    if(n==-1)break;
    if(!n)ans.push_back(0);
    while(n){
      ans.push_back(n%4);
      n/=4;
    }
    for(int i=ans.size()-1;i>=0;i--){
      cout<<ans[i];
    }
    cout<<endl;
  }
}

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

int main(){
    long int n;
    while(cin >>n){
        if(n == -1) break;
        vector<int> vec;
        int shift = 0;
        for(long int i = 3; i <= MAX_N; i = i << 2){
            int tmp = n & i;
            for(int j = 0; j < shift; j++){
                tmp = tmp >> 2;
            }
            shift++;
            vec.push_back(tmp);
        }
        int stop = vec.size() - 1;
        while(vec[stop] == 0){
            stop--;
            if(stop < 0) break;
        }
        if(stop < 0){
            cout <<"0" <<endl;
        } else{
            for(int i = stop; i >= 0; i--){
                cout <<vec[i];
            }
            cout <<endl;
        }
    }
    return 0;
}