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, ""))
	}
}

Python: import heapq
from collections import deque
from enum import Enum
import sys
import math
from _heapq import heappush, heappop
import copy
from test.support import _MemoryWatchdog

BIG_NUM = 2000000000
HUGE_NUM = 99999999999999999
MOD = 1000000007
EPS = 0.000000001
sys.setrecursionlimit(100000)


MAX = 10
POW = [1]*(MAX)

for i in range(1,MAX):
    POW[i] = POW[i-1]*4

while True:
    NUM = int(input())
    if NUM == -1:
        break
    elif NUM == 0:
        print("0")
        continue

    First = True
    for i in range(MAX-1,-1,-1):
        if POW[i] <= NUM:
            print("%d"%(NUM//POW[i]),end="")
            NUM %= POW[i]
            First = False
        else:
            if First: #
                pass
            else:
                print("0",end="")
    print()

Python: def to_four(n):
  if n == 0:
    return "0"
  acc = ""
  while n:
    acc = str(n % 4) + acc
    n //= 4
  return acc

while True:
  n = int(input())
  if n == -1:
    break
  print(to_four(n))

Python: while True:
    v = int(input())
    if v == -1:
        break
    if v < 4:
        print(v)
    else:
        b = str(bin(v))[2:]
        bb = [b[i:i+2] for i in range(len(b)-2, -1, -2)]
        if len(b) % 2 != 0:
            bb.append(b[0])
        ans = []
        for t in bb:
            tmp = 0
            for i, v in enumerate(t[::-1]):
                tmp += pow(2, i) * int(v)
            ans.append(tmp)
        print(''.join(map(str, ans[::-1])))

Python: def to_4(x):
    if x // 4:
        return to_4(x//4) + str(x%4)
    return str(x%4)

while True:
    n = int(input())
    if n == -1: break
    print(to_4(n))

Python: def f(n):
  if int(n/4):
    return(f(int(n/4))+str(n%4))
  return str(n%4)
while 1:
  n=int(input())
  if n==-1:
    break
  print(f(n))

C++: #include <iostream>
using namespace std;
int pow(int a,int b){
	int result=1;
	for(int i=0; i<b; ++i) result*=a;
	return result;
}

int main(){
	int N;
	while(std::cin >> N&&N!=-1){
		int i=0,ans=0;
		while(pow(4,i)<=N+1) ++i;
		--i;
		for( ; i>=0; --i){
			int tmp=pow(4,i);
			ans+=N/tmp*pow(10,i);
			N%=tmp;
		}
		cout << ans << endl;
	}
	return 0; 
}

C++: 		res += j * v[i];
		j *= 10;
	}

	return res;
}

int main(){
	int i;
	while(std::cin >> i, i >= 0){
		std::cout << Decimal4(i) << '\n';
	}
}

C++: #include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
int main(){
    int n;
    vector<int>vc;
    while(cin>>n){
        if(n==-1)break;
        vc.clear();
        if(n==0){
            cout<<'0'<<endl;
            continue;
        }
        while(1){
            if(n==0) break;
            vc.insert(vc.begin(),n%4);
            n=(n-n%4)/4;
        }
        for(int i=0;i<vc.size();i++){
            cout<<vc[i];
        }
        cout<<endl;
    }
    return 0;
}

C++: // 2011/08/21 Tazoe

#include <iostream>
using namespace std;

void radix(int n)
{
	if(n/4!=0)		// nª0ÌÆ«ÉC0ÆoÍ³êéæ¤É
		radix(n/4);

	cout << n%4;
}

int main()
{
	while(true){
		int n;
		cin >> n;
		if(n==-1)
			break;

		radix(n);
		cout << endl;
	}

	return 0;
}

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

typedef long long ll;
typedef pair<int, int> P;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod 1e9+7

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

int main() {
  int a;
  while(cin >> a) {
    if(a == -1) return 0;
    string ans = "0";
    rep(i, 0, a) {
      int f = 0;
      dep(j, ans.length() - 1, 0) {
        if(ans[j] == '3') {
          ans[j] = '0';
          if(j == 0) {
            ans = "1" + ans;
            break;
          }
        }else {
          if(f) break;
          ans[j]++;
          break;
        }
      }
    }
    cout << ans << endl;
  }
}

C++: #include<bits/stdc++.h>
using namespace std;
string calc(int n){
  string s;int x=1;
  while(n){
    char c='0'+n%4;s=c+s; n/=4;
  }return s;
}
int main(){
  int n;
  while(cin>>n,n!=-1){
    if(n==0) cout << 0 << endl;
    else cout << calc(n) << endl;
  }
}

C++: #include<functional>
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<string>
#include<math.h>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,x,n) for(int i=x;i<n;i++)
using namespace std;
const int INF=100000000;
int main(){
  int n;
  while(cin>>n,n!=-1){
    vector<int> a;
    if(n<4){
      cout<<n<<endl;
    }else{
      for(int i=0; ;i++){
	int amari=n%4;
	a.push_back(amari);
	n=n/4;
	if(n<4){
	  a.push_back(n);
	  break;
	}
      }
      for(int i=a.size()-1;i>=0;i--){
	cout<<a[i];
      }
      cout<<endl;
    }
  }
  return 0;
}

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

int n;

void init(){
 n=0;
}

bool input(){
  cin>>n;
  if(n==-1)return false;
  return true;
}

string ans(){
  string res="";
  while(n!=0){
    res=char(n%4+'0')+res;
    n/=4;
  }
  if(res.size()==0)res="0";
  return res;
}

int main(){
  while(init(),input()){
    string a=ans();
    cout<<a<<endl;
  }
}

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

int main(){
	int n;
	while (std::cin >> n){

		if (n == -1)break;

		std::vector<int>res;

		do{

			res.push_back(n % 4);

			n /= 4;

		} while (n != 0);

		for (int i = res.size() - 1; i >= 0; i--)std::cout << res[i];
		std::cout << std::endl;
	}
	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int n,i,w[11],cnt,z;
	while(1){
		cnt=0;
		scanf("%d",&n);
		if(n==-1) break;
		while(1){
			z=n/4;
			if(z<1) break;
			w[cnt]=n%4;
			n=z;
			cnt++;
		}
		printf("%d",n);
	for(i=cnt-1;i>=0;i--)	printf("%d",w[i]);
	printf("\n");
	}
	return 0;
}

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

long int pow(int x, int y)
{
  long int result = 1;
  for (int i=0; i<y; i++)
  {
    result *= x;
  }
  return result;
}

long int dec_to_4(int x)
{
  long int result = 0;
  for (int i=0; x != 0 ;i++)
  {
    result += (x % 4) * pow(10, i);
    x /= 4;
  }
  return result;
}

int main()
{
  while(true)
  {
    int num;
    cin >> num;
    if ( num == -1 ) break;

    cout << dec_to_4(num) << endl;
  }
}

C++: #include<iostream>
using namespace std;
int main() {
	int z[2002], x, kaisuu, m, kai;
	kaisuu = 0;
	while (1) {
		cin >> x;
		if (x == -1) {
			goto a;
		}
		kaisuu = kaisuu + 1;
		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<stdio.h>
int main()
{
	int a,b[100]={},c=0;
	scanf("%d",&a);
	while(a!=-1){
		if(a==0){
			printf("0");
			goto A;
		}
	while(a>0){
		b[c]=a%4;
		a=a/4;
		c++;
	}
	for(int j=c-1;j>=0;j--){
		printf("%d",b[j]);
	}
	A:
	printf("\n");
	int b[100]={};
	c=0;
	scanf("%d",&a);
	}
	return 0;
}