Scanf.scanf "%d" (fun n -> let xy = Array.init n (fun _ -> Scanf.scanf " %d %d" (fun x y -> x, y)) in let rec loop_i i acc = let rec loop_j j acc = if j >= n then acc else ( let x1, y1 = xy.(i) in let x2, y2 = xy.(j) in let acc = max acc @@ Array.fold_left (fun acc (x, y) -> if (x2 - x1) * (y - y1) = (y2 - y1) * (x - x1) then acc + 1 else acc) 0 xy in loop_j (j + 1) acc ) in if i = n then acc else loop_i (i + 1) (loop_j (i + 1) acc) in loop_i 0 0 |> Printf.printf "%d\n" )