Bottom up approach - K ordered LCS

I tried solving using bottom up approach but I am getting WA for 3 test cases. Can you please help me solving this question? Question link: https://www.hackerearth.com/problem/algorithm/mancunian-and-k-ordered-lcs-e6a4b8c6/

Solution link: https://ide.codingblocks.com/s/159825