PROBLEM LINK:Author: Chandan Boruah DIFFICULTY:Easy PREREQUISITES:Slope of a line, Observation. PROBLEM:Given $N$ lines represented by two points, we need to find maximum number of lines which can pass through a single point, without superimposing any other line. we can move any line but not rotate it. QUICK EXPLANATION
EXPLANATIONThe quick Explanation says it all. :) We can calculate slope of a line as $(y_2  y_1)/(x_2x_1)$, add them to a set and count the number of distinct values of slope in set. BUT BUT, what about REs we were getting in contest?? This was because of some lines having $x_1 = x_2$, test case specially added by devil tester :D, which caused arithmetic Division by zero error. We need to handle vertical (and probably horizontal too, if we wish) lines separately. Maybe having two boolean values horizontal and vertical would do fine. Each boolean value indicate whether input set contains a vertical (or horizontal) line. If true, would each of them contribute 1 to final answer. Complexity: AUTHOR'S SOLUTIONS:
asked 12 Aug '18, 10:59

@beardaspirant handle cases for 0 slope and infinity slope separately. answered 12 Aug '18, 15:40
why?? wouldn't infinity be handled automatically by Java Double? and 0 slope is anyhow 0.
(12 Aug '18, 21:01)
Suppose you have line given by points (1, 1) and (1, 3). Now, by using above formula for slope, we would get divide by zero error. We can handle this by checking if x1==x2, and handle this case separately. Slope 0 need not to be handled separately, but can be done if you wish to.
(13 Aug '18, 01:09)
@taran_1407 this would be handled by Java. Double has infinity and will never get div by 0 error.
(13 Aug '18, 23:59)

can someone point the mistake in https://www.codechef.com/viewsolution/19680526