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>
using namespace std;

int n;

int main(){
	while( cin >> n ){
		if( n == -1 )break;
		
		int ans[30],cor = 0;
		
		if( n == 0 ){
			ans[0] = 0;cor++;
		}
		while( n > 0 ){
			ans[cor] = n%4;
			n/=4;
			cor++;
		}
		for(int i = cor-1;i>=0;i--)
			cout << ans[i];
		cout << endl;
	}
	return 0;
}

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

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <map>
#include <vector>

using namespace std;

int main(){
	
	int num;
	
	while(true){
		cin >> num;
		if(num == -1){
			break;
		}
		string str = "D";
		string dum = "D";
		str[0] = '0' + num % 4;
		while(true){
			num /= 4;
			if(num == 0){
				break;
			}
			dum[0] = '0' + num % 4;
			str = dum + str;
		}
		cout << str << endl;
	}
	
	return 0;
}

C++: #include<stdio.h>

int main(){

int x;

while(1){

scanf("%d",&x);if(x==-1)break;
int s=0;int k=0;int p=1;
while(1){
k=x%4;
s+=k*p;
x=x/4;
if(x==0)break;
p=p*10;
}
printf("%d\n",s);
}
return 0;
}

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

string convert(int n) {
    string s;
    while (n >= 4) {
        int p = n % 4;
        s.push_back(p+'0');
        n /= 4;
    }
    s.push_back(n+'0');
    reverse(s.begin(), s.end());
    return s;
}

int main() {
    int n;
    while (cin >> n) {
        if (n == -1) break;
        cout << convert(n) << endl;
    }
    return 0;
}

C++: #include <stdio.h>
int main(){
    long int a,b,c[1024]={0},i,j;
        
        scanf("%ld\n",&a);
        do{
        i=0;
        if (a!=-1){
        b=a;
                do{
                
        
            a=b%4;
            b/=4;
                        c[i++]=a;
                        //printf("%d",a);
                }while(b>3);
                if(b!=0)
                c[i]=b;
                for(j=i;j>=0;j--){
                        printf("%ld",c[j]);
                }
                printf("\n");
        }
        else{
                break;
        }
        scanf("%ld\n",&a);
        }while(1);
        return 0;
}

C++: #include <stdio.h>

int main(void){
    int n,q, dig;
    
    while (scanf("%d", &n), n!=-1){
        dig = 0;
        q=0;
        while (n){
            q += n%4;
            q *= 10;
            n /= 4;
            dig++;
        }
        q /= 10;
        if (dig){
            while (dig--){
                printf("%d", q%10);
                q /= 10;
            }
        } else printf("0");
        printf("\n");
    }
    
    return 0;
}

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

int main(){
	int n,t;
	while(1){
		string a;
		cin >> n;
		if(n==-1){
			return 0;
		}
		if(n==0){
			a += '0';
		}
		for(t=0;n!=0;t++){
			a += '0' + n%4;
			n=n/4;
		}
		reverse(a.begin(), a.end());
		cout << a << endl;

	}
}

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

using ll = long long;

int main() {
    int n;
    while(cin >> n, n != -1) {
        string res;
        while(n > 0) {
            res += '0' + (n % 4);
            n /= 4;
        }
        reverse(res.begin(), res.end());
        if(res.size() == 0) {
            res += '0';
        }
        cout << res << endl;
    }
}

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

int main(){
	int n;
	while(cin >> n && n != -1 ){
		if( n == 0 ) cout << 0 << endl;
		else{
			string s;
			while(n){
				s += n % 4 + '0';
				n /= 10;
			}
			for(int i = s.size()-1 ; i >= 0 ; i--)
				cout << s[i];
			cout << endl; 
		}
	}
}

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

C++: #include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <cstring>
#include <deque>
#include <cstdio>
#include <cmath>
#include <complex>
#include <iostream>
#include <iterator>

using namespace std;

#define reep(i,f,t) for(int i=f ; i<int(t) ; ++i)
#define rep(i,n) reep(i, 0, n) 

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main()
{
	int n;
	while(scanf("%d", &n), n!=-1){
		vi v;
		do{
			v.push_back(n%4);
			n /= 4;
		}while(n);
		for(int i=v.size()-1; i>=0; --i)
			printf("%d", v[i]);
		puts("");
	}
	return 0;
}

C++: #include <stdio.h>
int main(){
    long int a,b,c[1024]={0},i,j;
	
	scanf("%ld\n",&a);
	do{
	    i=0;
        if(a>=0&&a<=3){
            printf("%ld\n",a);
        }
	    else if (a!=-1){
            b=a;
		    do{
                a=b%4;
                b/=4;
			    c[i++]=a;
			//printf("%d",a);
		    }while(b>3);
		if(b!=0)
		    c[i]=b;
		for(j=i;j>=0;j--){
			printf("%ld",c[j]);
		}
		printf("\n");
	}
	else{
		break;
	}
	scanf("%ld\n",&a);
	}while(1);
	return 0;
}

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

#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
 
int main(){
  int n;
  int a[]={262144,65536,16384,4096,1024,256,64,16,4,1};
  int i,j,s=10;
  int ans=0;
  cin >> n;
 
  if(n==0){
    cout << 0;
  }
  rep(i,10){
    if(n>=a[i]){  
      if(i<s){
	s=i;
      }
    }
  }
  for(j=s;j<10;j++){
    cout << n/a[j]; 
    n=n%a[j];
  }
                     
  cout <<'\n';
                
  return 0;
}