Python Time Monotonic Stack Codeforces