I was trying to solve this task you can say for the last three hours.
I got the idea but idk why am i getting TLE at all, maybe cause of a big factor idk.
And you can compare between the two submissions to see the difference and to be exact #include and the space.
Also i know that it's not dp at all and i had to choose a better name, consider it length.
Can anyone explain how is this even possible?