Enjoy the awesomeness: https://www.hackerrank.com/domains/algorithms/
Keep pushing.
The repo is mixed up with Python 2.7.x and C++11, and I find the latter more elegant.
change
f = open("0.in", "r")
# f = sys.stdin
to
# f = open("0.in", "r")
f = sys.stdin
If you like it, star ⭐ the repo.