Problem
Imagine you are an explorer tasked with charting a precise path through uncharted territory. Your mission is to determine if three landmarks on your map lie perfectly on the same straight line, a crucial step for ensuring accurate navigation. To tackle this problem, you'll write a program that checks for collinearity among three points in a 2D plane. Here's how you can approach this: 1. Accept three points as input, each defined by a pair of coordinates (x, y). 2. Utilize the concept of the area of a triangle formed by these points. Calculate the area using the formula: Area = 0.5 * |x1(y2-y3) + x2(y3-y1) + x3(y1-y2)|. 3. If the calculated area is zero, the points are collinear; otherwise, they are not.
- Consider using the area of a triangle to determine collinearity.
- Think about how coordinate differences can help simplify the problem.
- Be mindful of edge cases such as overlapping points or axis-aligned points.
- Try optimizing your approach by minimizing unnecessary calculations through early exits if possible.
Input format
Input consists of three lines, each containing two integers x and y, representing the coordinates of a point.
Output format
Output 'Yes' if the points are collinear, otherwise output 'No'.
Constraints
The coordinates x and y are integers where -1000 ≤ x, y ≤ 1000.
Sample input
1 2 2 4 3 6
Sample output
Yes