Getting TLE for Median of Two sorted arrays. Please help

Why am I getting Time LImit Exceeded in the Median of Two sorted arrays when I use the LogN approach to solve the problem

The code can be found in the link given below:
https://pastebin.com/5shCmidM

Thank you