Problem: We have sticks numbered 1, \cdots, N. The length of Stick i (1 \leq i \leq N) is L_i.  In how many ways can we choose three of the sticks with different lengths that can form a triangle?  That is, find the number of triples of integers (i, j, k) (1 \leq i < j < k \leq N) that satisfy both of the following conditions:    * L_i, L_j, and L_k are all different.   * There exists a triangle whose sides have lengths L_i, L_j, and L_k.

Submission attempts (in order):
n = int(input())
a = (int(x) for x in input().split())

b = list(a)
cnt = []

for i in range(len(list(b))) :
        for j in range(len(list(b))) :
                for k in range(len(list(b))):
                        if i != j and j != k and k != i :
                                d = [b[i],b[j],b[k]]
                                m = max(d) 
                                if m < sum(d) - m :
                                        cnt.append(1)
                                else :
                                        None
                        else :
                                None
                                
print(sum(cnt))

n = int(input())
a = (int(x) for x in input().split())

b = list(a)
cnt = []

for i in range(len(list(b))) :
        for j in range(len(list(b))) :
                for k in range(len(list(b))):
                        if i != j and j != k and k != i :
                                d = [b[i],b[j],b[k]]
                                m = max(d) 
                                if m < sum(d) - m :
                                        cnt.append(1)
                                else :
                                        None
                        else :
                                None
                                
print(int(sum(cnt)/6))

n = int(input())
a = (int(x) for x in input().split())

b = list(a)
cnt = 0

for i in range(len(list(b))) :
        for j in range(len(list(b))) :
                for k in range(len(list(b))):
                        c = [i,j,k]
                        if len(c) == len(set(c)) :
                                d = [b[i],b[j],b[k]]
                                m = max(d) 
                                if m < sum(d) - m :
                                        cnt += 1
                                else :
                                        None
                        else :
                                None
                                
print(int(cnt/6))

n = int(input())
a = (int(x) for x in input().split())

b = list(a)

cnt = 0

for i in range(len(b)) :
        for j in range(len(b)) :
                for k in range(len(b)):
                        c = [i,j,k]
                        if len(c) == len(set(c)) :
                                d = [b[i],b[j],b[k]]
                                m = max(d) 
                                if m < sum(d) - m and b[i] != b[j] and b[j] != b[k] and b[k] !=b[i]:
                                        cnt += 1
                                else :
                                        None
                        else :
                                None
                                
print(int(cnt/6))

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted