Help i a past year icpc problem

The above is the link to which I am trying to find a solution to.
I tried creating a recursive approach for f(a,b) and found a logarithmic solution for that but transforming it to find the sum for the problem was not possible using it.

People have discussed that this is an unsolvable problem.

actually there is one user on codechef that solved it using some kind of dp which I could not understand but had the complexity of a b 2*log(n) which works in this case. A few of the conditions used could be worked out by me also such as this question can be turned into two logic gate tables.

https://www.codechef.com/viewsolution/14770253
above mentioned is the link to the solution. However I need help in understanding what the dps in itself stand for.

Sir,sorry to say…what is the point in solving this question when u even cannot get it verified?You even cannot make submissions.It is fruitless.