My approch is right still getting TLE

can you look at my solution for KLCS I think my approach is correct but still getting tle