ACCBIP - Editorial

If there are 10 lines out of which 8 lines are intersecting at one point, and 2 lines are parallel,
So it would be better to delete the these 2 lines having higher frequency instead of one of those 8 lines having lesser frequency as per your explanation. Can you please clarify?

The constraints stated that no three lines are concurrent.

I was stuck in the same boat as you. Found this article - combinatorics - Find sum of product of all possible triplets in an array in O(n)? - Mathematics Stack Exchange
Edit - Using this equation (A+B+C)³ = 6ABC+3(A²+B²+C²)(A+B+C)−2(A³+B³+C³) and rewriting terms in form of σk to obtain ABC.

This article is generalized for subset size of ‘k’ (However, it is O(n²)) : https://www.geeksforgeeks.org/sum-of-products-of-all-possible-k-size-subsets-of-the-given-array/

I cant understand how to implement knapsack dp in this problem. Please explain someone.

Can you pls tell me how to apply knapsack in this problem. I am unable to figure it out. Thanks in advance