# Task
Given some sticks by an array `V` of positive integers, where V[i] represents the length of the sticks, find the number of ways we can choose three of them to form a triangle.

# Example

 For `V = [2, 3, 7, 4]`, the result should be `1`.

 There is only `(2, 3, 4)` can form a triangle.
 
 For `V = [5, 6, 7, 8]`, the result should be `4`.
 
 `(5, 6, 7), (5, 6, 8), (5, 7, 8), (6, 7, 8)` 

# Input/Output


 - `[input]` integer array `V`

 stick lengths
 
 `3 <= V.length <= 100`
 
 `0 < V[i] <=100`


 - `[output]` an integer

 number of ways we can choose 3 sticks to form a triangle.

Source: codewars | Difficulty: EASY

Starter code: def counting_triangles(V):
	

Solutions:
from itertools import combinations

def counting_triangles(v):
	v.sort()
	return sum((a + b > c for (a, b, c) in combinations(v, 3)))


counting_triangles = lambda V: sum((a + b > c for (a, b, c) in __import__('itertools').combinations(sorted(V), 3)))


import itertools

def counting_triangles(V):
	count = 0
	for x in itertools.combinations(V, 3):
		if sum([x[0] + x[1] > x[2], x[0] + x[2] > x[1], x[1] + x[2] > x[0], abs(x[0] - x[1]) < x[2], abs(x[0] - x[2]) < x[1], abs(x[1] - x[2]) < x[0]]) == 6:
			count += 1
	return count


from itertools import combinations

def counting_triangles(V):
	count = 0
	for i in combinations(V, 3):
		i = sorted(i)
		if i[0] + i[1] > i[2]:
			count += 1
	return count


from itertools import combinations

def counting_triangles(V):
	number = 0
	for i in sorted(combinations(V, 3)):
		(x, y, z) = sorted(i)
		if x + y > z:
			number += 1
	return number


from itertools import combinations

def counting_triangles(V):
	return sum((sum(comb) > 2 * max(comb) for comb in combinations(V, 3)))


counting_triangles = lambda v: len([x for x in list(__import__('itertools').combinations(v, 3)) if all([k < sum(x) - k for k in x])])


counting_triangles = lambda V: (lambda v, W: sum([W[k] < W[i] + W[j] for i in range(v) for j in range(i + 1, v) for k in range(j + 1, v)]))(len(V), sorted(V))


from itertools import combinations as C

def counting_triangles(V):
	return sum((a + b > c for (a, b, c) in C(sorted(V), 3)))