#include <stdio.h>
f(x){return x>3?4*f(x/4)+f(x%4):x%3?3-x:x;}
int main (int argc, char **argv) {
int i;
int testcases[] = {0, 1, 9, 85, 220, 1827, 47525};
for (i = 0; i < (sizeof(testcases) / sizeof(testcases[0])); i++) {
printf("f(%d)=%d\n", testcases
[i
], f
(testcases
[i
])); }
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgpmKHgpe3JldHVybiB4PjM/NCpmKHgvNCkrZih4JTQpOnglMz8zLXg6eDt9CgppbnQgbWFpbiAoaW50IGFyZ2MsIGNoYXIgKiphcmd2KSB7CiAgICBpbnQgaTsKICAgIGludCB0ZXN0Y2FzZXNbXSA9IHswLCAxLCA5LCA4NSwgMjIwLCAxODI3LCA0NzUyNX07CgogICAgZm9yIChpID0gMDsgaSA8IChzaXplb2YodGVzdGNhc2VzKSAvIHNpemVvZih0ZXN0Y2FzZXNbMF0pKTsgaSsrKSB7CiAgICAgICAgcHJpbnRmKCJmKCVkKT0lZFxuIiwgdGVzdGNhc2VzW2ldLCBmKHRlc3RjYXNlc1tpXSkpOwogICAgfQogICAgcmV0dXJuIDA7Cn0K