SPOJ - GNYR09F - Adjacent Bit Counts

Why am I getting the wrong answer after applying memoization?
Getting the correct answer without memoization.

problem link - https://www.spoj.com/problems/GNYR09F/
code - https://ide.codingblocks.com/s/116090
(the memoization line is commented)