Used memoization but getting TLE

In this question I used 3D Dp…but basically memoization as sequence was hard to be generalised in which the columns were to be filled…But while submitting my solution got TLE…on 78th test case,I tried with Fast I/O also but nothing hapenned…Can anyone tell me any optimisation I could make in it…The thing am doing is that I check if the 2 characters at the 2 string r same…then I find how many characters in this substring are same starting at those indexes…then I just do function calls…which means that upto this character I take my nth string…supppose the common substring is ababa then I will make recursive calls on (baba…,baba…,k-1),(aba…,…aba…,k-1)…(a…,a…,k-1) and also leaving this as one of my common substring…(baba…,ababa…,k) and (ababa…,baba…,k).

This is my code link…