cf 269 div2 C - math/binary search