Codeforces Theatre Square Solution In C