Hello @S18ML0016,
There is surely a problem with this code:
The result of MULTIPLICATION is the problem.
The first for loop that you have used will result in the values that would be out of the range of unsigned long long int.
You can see the following code where i have printed the result of multiplication in each iteration:
You will see the drop in the value of ans after i=35.
While it should have been increased with each iteration.
Reason:
The result of the product being too large, the value of ans is revolving within the range of unsigned long long int.
NOTE:
It is failing for N=20 while the constraint given in the question is 1<=N<=100.
Solution:

where T(n) is the nth Catalan number.
Logic:
We can observe that the above recursive implementation does a lot of repeated work (we can the same by drawing the recursion tree). Since there are overlapping subproblems, we can use dynamic programming for this. Following is a Dynamic programming based implementation.
As you might have not studied the DP yet.
I’ll give you a brief idea of it:
When you use recursive code, you might call the same function(which is recursion) with same parameters multiple times.
Example: finding nth Fibonacci number.
Formula: fib(n)=fib(n-1)+fib(n-2)
So, to find fib of n you need to call fib of n-1 and n-2.
But, when you have to find fib of n-1, you will call fib(n-2) and fib(n-3).
But, as you have already computed the value of fib(n-2) while calling for fib(n). So, there is no need to repeat the same process again, as it will be a chain of the recursive call.
This is called overlapping subproblems.
Thus, to avoid this repetition of same chain of process, we will store the results and if the same call is made again i.e. f(n-2) in case of f(n-1), we will just read the stored value.
This is called memorization.
Let me know if you face any difficulty in understanding the code.