my code worked properly till n=30 but at 31 its doent respond
Class asignment
@coolio.boy385
Your code requires a lot of time to work. As it is mentioned in the problem statement that n<=44 and your first loop works till 2^n. That means in worst case your outer loop will work 2^44 = 1.75 * 10^13 iterations. And then there’s the inner loop as well which will further increase the time complexity. Your code will not work for these constraints. Try to optimize this code. You might have to change much of your code. Think of a better way to solve this problem.
If you look closely at the testcases and answers , you will notice there is a pattern forming up. Just write down the answers for values upto 5 or 6. Notice these values and look out for some pattern forming up. When you find this pattern , write a code to precompute the values for this pattern upto the largest value of n specified in the constraints. After this run the testcase loop and simply output the stored values which we computed during our precomputation part.