DistanceFor given two segments s1 and s2, print the distance between them.s1 is formed by end points p0 and p1, and s2 is formed by end points p2 and p3.InputThe entire input looks like:q (the number of queries)1st query2nd query...qth queryEach query consists of integer coordinates of end points of s1 and s2 in the following format:xp0 yp0 xp1 yp1 xp2 yp2 xp3 yp3OutputFor each query, print the distance. The output values should be in a decimal fraction with an error less than 0.00000001.Constra ...

## CGL_2_C: Cross Point

Cross PointFor given two segments s1 and s2, print the coordinate of the cross point of them.s1 is formed by end points p0 and p1, and s2 is formed by end points p2 and p3.InputThe entire input looks like:q (the number of queries)1st query2nd query...qth queryEach query consists of integer coordinates of end points of s1 and s2 in the following format:xp0 yp0 xp1 yp1 xp2 yp2 xp3 yp3OutputFor each query, print the coordinate of the cross point. The output values should be in a decimal fraction wi ...

## CGL_2_B: Intersection

IntersectionFor given two segments s1 and s2, print “1” if they are intersect, “0” otherwise.s1 is formed by end points p0 and p1, and s2 is formed by end points p2 and p3.InputThe entire input looks like:q (the number of queries)1st query2nd query...qth queryEach query consists of integer coordinates of end points of s1 and s2 in the following format:xp0 yp0 xp1 yp1 xp2 yp2 xp3 yp3OutputFor each query, print “1” or “0”.Constraints1 ≤ q ≤ 1000-10000 ≤ $x_{p_i},y_{p_i}$ ≤ 10000p0≠p1 and p2≠p3.Sam ...

## CGL_2_A: Parallel/Orthogonal

Parallel/OrthogonalFor given two lines s1 and s2, print “2” if they are parallel, “1” if they are orthogonal, or “0” otherwise.s1 crosses points p0 and p1, and s2 crosses points p2 and p3.InputThe entire input looks like:q (the number of queries)1st query2nd query...qth queryEach query consists of integer coordinates of the points p0, p1, p2, p3 in the following format:xp0 yp0 xp1 yp1 xp2 yp2 xp3 yp3OutputFor each query, print “2”, “1” or “0”.Constraints1 ≤ q ≤ 1000-10000 ≤ $x_{p_i},y_{p_i}$ ≤ 1 ...

## CGL_1_C: Counter-Clockwise

Counter-ClockwiseFor given three points p0,p1,p2, printCOUNTER_CLOCKWISEif p0,p1,p2 make a counterclockwise turn (1),CLOCKWISEif p0,p1,p2 make a clockwise turn (2),ONLINE_BACKif p2 is on a line p2,p0,p1 in this order (3),ONLINE_FRONTif p2 is on a line p0,p1,p2 in this order (4),ON_SEGMENTif p2 is on a segment p0p1 (5).Inputxp0 yp0 xp1 yp1qxp20 yp20xp21 yp21...xp2q−1 yp2q−1In the first line, integer coordinates of p0 and p1 are given. Then, q queries are given for integer coordinates of p2.Output ...

## CGL_1_B: Reflection

ReflectionFor given three points p1,p2,p, find the reflection point x of p onto p1p2.Inputxp1 yp1 xp2 yp2qxp0 yp0xp1 yp1...xpq−1 ypq−1In the first line, integer coordinates of p1 and p2 are given. Then, q queries are given for integer coordinates of p.OutputFor each query, print the coordinate of the reflection point x. The output values should be in a decimal fraction with an error less than 0.00000001.Constraints1≤q≤1000−10000≤xi,yi≤10000p1 and p2 are not identical.Sample Input 10 0 2 03-1 10 ...