Recursion-Dictionary Order(Larger)

my 2nd and 3rd test cases are failing ,plzz help!!
Here is my code https://ide.codingblocks.com/s/149454