### PROBLEM LINK

### DIFFICULTY

EASY

### PROBLEM

Given the number of lines and the number of parallel lines in each set, you have to find the total number of triangles formed.

### EXPLANATION

Total number of triangles that can be formed with n lines without any parallel lines is nC3. Now if we consider parallel lines, we cannot form a triangle if all three lines chosen are parallel to each other or any of the two lines in chosen three line are parallel. Now we have to subtract these triangle, since they cannot form a triangle.

No.of triangles =nC3-(((n-m1)*m1C3)+m1C3)- (((n-m2)*m2C3)+m2C3)… etc for all parallel sets.