• + 13 comments

    Doesn't handle the case where 2 starts ahead and 1 never catches up (e.g., 0 2 5 3). You need to ensure that the sign of the position difference and the sign of the velocity difference are opposite, i.e., the velocity will overcome the position difference rather than increase it:

    print("YES" if (x2 - x1) * (v2 - v1) < 0 and (x2 - x1) % (v2 - v1) == 0 else "NO")

    This also short-circuits a divide-by-zero error if the velocity difference is zero (e.g., 43 2 70 2).