Problem:
 Score : 200 points    Problem Statement 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 .       Constraints  1 \leq N \leq 100  1 \leq L_i \leq 10^9  All values in input are integers.         Input Input is given from Standard Input in the following format:  N  L_1  L_2  \cdots  L_N       Output Print the number of ways to choose three of the sticks with different lengths that can form a triangle.        Sample Input 1 5
4 4 9 7 5      Sample Output 1 5  The following five triples (i, j, k) satisfy the conditions: (1, 3, 4) , (1, 4, 5) , (2, 3, 4) , (2, 4, 5) , and (3, 4, 5) .       Sample Input 2 6
4 5 4 3 3 5      Sample Output 2 8  We have two sticks for each of the lengths 3 , 4 , and 5 . To satisfy the first condition, we have to choose one from each length.  There is a triangle whose sides have lengths 3 , 4 , and 5 , so we have 2 ^ 3 = 8 triples (i, j, k) that satisfy the conditions.       Sample Input 3 10
9 4 6 1 9 6 10 6 6 8      Sample Output 3 39       Sample Input 4 2
1 1      Sample Output 4 0  No triple (i, j, k) satisfies 1 \leq i < j < k \leq N , so we should print 0 .

Solution (Python):
n = int(input())
l = list(map(int, input().split()))
s = 0
for i in range(n - 2):
    for j in range(i + 1, n - 1):
        for k in range(j, n):
            if (l[i] == l[j]) | (l[j] == l[k]) | (l[i] == l[k]):
                continue
            if l[i] + l[j] <= l[k]:
                continue
            if abs(l[i]- l[j]) >= l[k]:
                continue
            s += 1
print(s)

Solution (Python):
N = int(input())
A = sorted(map(int, input().split())) 

X = 0
Y = 0

B = []

for i in range(N-2):
    X = i + 1
    for j in range(X,N-1):
        Y = j + 1
        for k in range(Y, N):
            if A[k] < A[i] + A[j]:
                if A[k] != A[i] and A[i] != A[j] and A[k] != A[j]:
                    B.append((A[i],A[j],A[k]))

print(len(B))

Solution (Python):
from itertools import combinations
n = int(input())
L = list(map(int,input().split()))
ans = 0
for a,b,c in combinations(L,3):
    ans += (2*max(a,b,c) < a+b+c)*(a != b and b != c and c != a)
print(ans)

Solution (Python):
from itertools import combinations
n = int(input())
L = list(map(int,input().split()))
ans = 0
for x in combinations(L,3):
    a,b,c = map(int,x)
    if a == b or b == c or c == a:
        continue
    ans += (2*max(a,b,c) < a+b+c)
print(ans)

Solution (Python):
n = int(input())
l = [int(i) for i in input().split()]
l.sort()
count = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        for k in range(j+1,n):
            l1 = l[i]
            l2 = l[j]
            l3 = l[k]
            if l1 != l2:
                if l2 != l3:
                    if l1 + l2 > l3:
                        count += 1
print(count)

Solution (Python):
n = int(input())
l = list(map(int, input().split()))

ans = 0
for i in range(n):
    for j in range(i+1, n):
        for k in range(j+1, n):
            a = sorted([l[i], l[j], l[k]])
            if a[0] == a[1] or a[1] == a[2] or a[2] == a[0]:
                continue
            if a[0] + a[1] > a[2]:
                ans += 1

print(ans)

Solution (Python):
N =int(input())
L=list(map(int, input().split()))
LL = sorted(L)
count=0
for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if LL[i]+LL[j]>LL[k]:
                if (LL[i]!=LL[j])and(LL[j]!=LL[k]):
                    count += 1
print(count)

Solution (Python):
n = int(input())
a = [int(x) for x in input().split()]

result = 0

for a_i in range(n):
  for b_i in range(a_i+1, n):
    for c_i in range(b_i+1, n):
      l_a = a[a_i]
      l_b = a[b_i]
      l_c = a[c_i]
      
      if l_a == l_b or l_b == l_c or l_a == l_c:
        continue

      if l_a + l_b > l_c and l_b + l_c > l_a and l_c + l_a > l_b:
        result += 1
print(result)

Solution (Python):
n = int(input())
l = list(map(int,input().split()))
l.sort()
ans = 0
for i in range(n):
  for j in range(i+1,n):
    for k in range(j+1,n):
      a = l[i]
      b = l[j]
      c = l[k]
      if a == b or b == c or c == a:
        continue
      if l[i] + l[j] > l[k]:
        ans += 1
print(ans)

Solution (Python):
a = [input() for i in range(2)]
b = a[1].split(" ")
ans = 0

num = int(a[0])
if num>2:
  for i in range (0,num-2):
    for j in range (i+1,num-1):
      for k in range (j+1, num):
        if int(b[i])!=int(b[j]):
          if int(b[j])!=int(b[k]):
            if int(b[k])!=int(b[i]):
              if int(b[i])+int(b[j])>int(b[k]):
                if int(b[j])+int(b[k])>int(b[i]):
                  if int(b[k])+int(b[i])>int(b[j]):
                    ans=ans+1
print(ans)

Solution (Python):
sticks=int(input())
lengths=input()
new_list=lengths.split()
list=[]
for item in new_list:
    list.append(int(item))
i=len(list)-1
j=i-1
k=i-2
count=0
empty=[]
while i>=2:
    while j>=1:
        while k>=0:
            if list[i]!=list[j]and list[i]!=list[k]and list[j]!=list[k]:
                empty.append((list[i],list[j],list[k]))
            k=k-1
        j=j-1
        k=j-1
    i=i-1
    j=i-1
    k=j-1
for items in empty:
    if items[0]+items[1]>items[2]and items[1]+items[2]>items[0]and items[2]+items[0]>items[1]:
        count=count+1
print(count)

Solution (Python):
N = int(input())
L = list(map(int, input().split()))
L.sort()

cnt = 0
for i in range(N-2):
    for j in range(i, N-1):
        for k in range(j, N):
            a, b, c = L[i], L[j], L[k]
            if a == b or b == c or c == a:
                continue
            elif a+b>c and b+c>a and c+a>b:
                cnt+=1

print(cnt)

Solution (Python):
from itertools import combinations

def main():
    _ = int(input())
    A = list(map(int, input().split()))
    if len(set(A)) < 3:
        print(0)
        return
    C = combinations(A, 3)
    ans = 0
    for c in C:
        c = sorted(c)
        if c[0] != c[1] and c[0] != c[1] and c[1] != c[2]:
            if c[2] < c[1] + c[0]:
                ans += 1
    print(ans)
    
    
if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
ls = list(map(int, input().split()))

cnt = 0
for i in range(n - 2):
    for j in range(i, n - 1):
        for k in range(j, n):
            a, b, c = ls[i], ls[j], ls[k]
            if a == b or b == c or c == a:
                continue
            if a + b > c and b + c > a and c + a > b:
                cnt += 1

print(cnt)

Solution (Python):
from itertools import combinations

data1 = input()
data2 = [int(i) for i in input().split(" ")]

count = 0
if len(data2) >= 3:
  for d1, d2, d3 in combinations(data2, 3):
    if d1 == d2 or d2 == d3 or d1 == d3:
      continue
    if d1 + d2 <= d3 or d1 + d3 <= d2 or d2 + d3 <= d1:
      continue
    count += 1

  print(count)
else:
  print(0)

Solution (Python):
def check(a,b,c):
    if a == b:
        return False
    if b == c:
        return False
    if c == a:
        return False
    m = max(a,b,c)
    if m >= (a+b+c)-m:
        return False
    return True

N = int(input())
L = list(map(int,input().split()))
ans = 0
if N >= 3:
    for i in range(0,N-2):
        for j in range(i+1,N-1):
            for k in range(j+1,N):
                if check(L[i],L[j],L[k]):
                    ans += 1
print(ans)

Solution (Python):
N = int(input())
ls = list(map(int, input().split()))

def is_valid(a, b, c):
    valid = a != b and a != c and b != c
    is_triangle = a + b > c and b + c > a and c + a > b

    return valid and is_triangle


count = 0
for i in range(N):
    for j in range(i, N):
        for k in range(j, N):
            if is_valid(ls[i], ls[j], ls[k]):
                
                count += 1

print(count)

Solution (Python):
n = int(input())
l = input()
l = l.split()
a = 0
b = 1
c = 2
e = [0]
for d in range(int(n*(n-1)*(n-2)/6)):
    e.append(int(l[a]))
    e.append(int(l[b]))
    e.append(int(l[c]))
    if b == n - 2 and c == n - 1:
        a = a + 1
        b = a + 1
        c = a + 2
    elif c == n - 1:
        b = b + 1
        c = b + 1
    else:
        c = c + 1
j = 0
for f in range(int((len(e)-1)/3)):
    g = e[f*3+1]
    h = e[f*3+2]
    i = e[f*3+3]
    if g != h and h != i and g != i:
        if g + h > i and h + i > g and g + i > h:
            j = j + 1
print(j)

Solution (Python):
n = int(input())
a = [int(i) for i in input().split()]

ans = 0
for i in range(n):
    for j in range(i+1, n):
        for k in range(j+1, n):
            if a[i]!=a[j] and a[i]!=a[k] and a[k]!=a[j]:
                if a[i]<a[j]+a[k] and a[j]<a[i]+a[k] and a[k]<a[j]+a[i]:
                    ans += 1
print(ans)

Solution (Python):
n = int(input())
l = sorted(list(map(int, input().split())))

a = 0
        
for i in range(n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            if l[k] < l[i] + l[j] and l[i] < l[j] and l[j] < l[k]:
                a += 1

print(a)

Solution (Python):
n = int(input())
arr = list(map(int, input().split()))
ans = 0
for i in range(n):
    for j in range(i + 1, n):
        for k in range(j + 1, n):
            if arr[i] != arr[j] and arr[i] != arr[k] and arr[j] != arr[k]:
                if (arr[i] + arr[j]) > arr[k] and (arr[i] + arr[k]) > arr[j] and (arr[j] + arr[k]) > arr[i]:
                    ans += 1
print(ans)

Solution (Python):
N = int(input())
L = [int(i)for i in input().split()]
ans = 0
L.sort(reverse=True)
for i,l in enumerate(L[:-2]):
    for j,l2 in enumerate(L[i+1:N-1]):
        for l3 in L[i+j+2:]:
            if l < l2 + l3:
                if l > l2 > l3:
                    ans += 1
            else:
                break
print(ans)

Solution (Python):
count = 0

length = int(input())
length_list = list(map(int, input().split()))

for i in range(length - 2):
    for j in range(i + 1, length - 1):
        if length_list[i] != length_list[j]:
            for k in range(j + 1, length):
                if length_list[j] != length_list[k] and length_list[k] != length_list[i]:
                    half_length_sum = (length_list[i] + length_list[j] + length_list[k]) / 2
                    if half_length_sum > max(length_list[i], length_list[j], length_list[k]):
                        count += 1
print(count)

Solution (Python):
N = int(input())
L = list(map(int, input().split()))

ans = 0

for k in range(2, N):
    for j in range(1, k):
        for i in range(j):
            if L[i] == L[j] or L[j] == L[k] or L[k] == L[i]:
                continue
            elif L[i] + L[j] > L[k] and L[j] + L[k] > L[i] and L[k] + L[i] > L[j]:
                ans += 1

print(ans)

Solution (Python):
def main():
    n = int(input())
    l = list(map(int, input().split()))
    count = 0
    for i in range(n):
        for j in range(i, n):
            for k in range(j, n):
                if l[i] != l[j] and l[j] != l[k] and l[k] != l[i] and l[i]+l[j] > l[k] and l[j]+l[k] > l[i] and l[k]+l[i] > l[j]:
                    count += 1
    print(count)


if __name__ == '__main__':
    main()

Solution (Python):
n=int(input())
llist=list(map(int,input().split()))
ans=0
for i in range(n):
    for j in range(n-i-1):
        for k in range(n-i-j-2):
            ii=llist[i]
            ji=llist[i+j+1]
            ki=llist[i+j+k+2]
            if ji != ii and ji != ki and ii != ki:
                if max(ii,ji,ki)*2 < ji+ii+ki:
                    ans+=1

print(ans)

Solution (Python):
N=int(input())
Ls = list(map(int,input().split()))
score=0
for i in range(0,N-2):
  a = Ls[i]
  for j in range(i+1, N-1):
      b = Ls[j]
      for k in range(j+1, N):
        c = Ls[k]
        if ((a+b>c)&(a+c>b)&(b+c>a)&(a!=b)&(a!=c)&(b!=c)):
          score+=1

print(score)

Solution (Python):
N = int(input())
Ls = list(map(int,input().split()))
ans = 0

for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            m = max(Ls[i],Ls[j],Ls[k])
            if Ls[i] + Ls[j] + Ls[k] - 2*m > 0 and Ls[i] != Ls[j] and Ls[i] != Ls[k] and Ls[j] != Ls[k]:
                ans += 1

print(ans)

Solution (Python):

N = int(input())
Ns = list(map(int, input().split()))
Ns.sort()
ans = 0

for i in range(0, N - 2):
	for j in range(i + 1, N - 1):
		for k in range(j + 1, N):
			if(Ns[i] == Ns[j] or Ns[k] == Ns[j]):
				continue

			if(Ns[i] + Ns[j] > Ns[k] and Ns[j] + Ns[k] > Ns[i] and Ns[k] + Ns[i] > Ns[j]):
				ans += 1
print(ans)

Solution (Python):

N = int(input())
L = list(map(int,input().split()))
ans = 0
for i in range(N):
    for j in range(i+1,N):
        for k in range(j+1,N):
            if L[i]!=L[j] and L[k]!=L[j] and L[i]!=L[k]:
                if L[i] + L[j] > L[k] and L[k] + L[j] > L[i] and L[i] + L[k] > L[j]:
                    ans +=1
                    
print(ans)

Solution (Python):
from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
from fractions import gcd
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
EPS = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

n = int(input())
l_list = list(map(int, input().split()))
l_combo = itertools.combinations(l_list, 3)
ans = 0
for i in l_combo:
    if i[0] + i[1] > i[2] and i[1]+i[2] > i[0] and i[0] + i[2] > i[1] and i[0] != i[1] and i[1] != i[2] and i[0] != i[2]:
        ans += 1

print(ans)

Solution (Python):
n = int(input())
l = list(map(int, input().split()))

ans = 0
for i in range(n-2):
  for j in range(i+1, n-1):
    for k in range(j+1, n):
      if l[i] != l[j] and l[i] != l[k] and l[j] != l[k]:
        if l[i]+l[j] > l[k] and l[i]+l[k] > l[j] and l[j]+l[k] > l[i]: ans += 1
print(ans)

Solution (Python):
n=int(input())
l=list(map(int,input().split()))
if n<=2:
    print(0)
else:
    count=0
    for i in range(n):
        for j in range(i+1,n):
            for k in range(j+1,n):
                if l[i]!=l[j] and l[j]!=l[k] and l[k]!=l[i]:
                    a=[l[i],l[j],l[k]]
                    a.sort()
                    if a[2]<a[0]+a[1]:
                        count+=1
    print(count)

Solution (Python):
N = int(input())
hen = list(map(int, input().split()))

kosu = 0

if N <= 2:
    print(kosu)

else:
    for i in range(N - 2):
        for j in range(i + 1, N - 1):
            for k in range(j + 1, N):
                if hen[i] != hen[j] and hen[j] != hen[k] and hen[k] != hen[i]\
                and hen[i] + hen[j] > hen[k] and hen[k] + hen[i] > hen[j] and hen[j] + hen[k] > hen[i]\
                and i < j < k:
                    kosu += 1

    print(kosu)

Solution (Python):


n=int(input())
s=list(map(int,input().split()))
s.sort()
ans=0
for i in range(n):
  for j in range(n):
    if s[i]<s[j]:
      for k in range(n):
        if s[j]<s[k] and s[i]+s[j]>s[k]:
          ans+=1
print(ans)

Solution (Python):
n = int(input())
l = list(sorted(map(int, input().split())))
x = 0
if n >= 3:
    for k in range(n - 2):
        for j in range(k + 1):
            for i in range(j + 1):
                if l[i] < l[j + 1] < l[k + 2] and l[i] + l[j + 1] > l[k + 2]:
                    x += 1
print(x)

Solution (Python):
import itertools
 
N = int(input())
L = list(map(int,(input().split())))
 
Combination = list(itertools.permutations(L, 3))
count = 0
for i in Combination:
    
    a = int(i[0])
    b = int(i[1])
    c = int(i[2])
    if((a+b)> c and (b+c) >a and (c+a) >b and a!=b and b!= c and a!= c and a<b and b<c):
        count+=1
 
print(count)

Solution (Python):
import itertools
 
N = int(input())
L = list(map(int,(input().split())))
L.sort()
Combi = list(itertools.combinations(L, 3))
count = 0
 
for i in Combi:
    a = int(i[0])
    b = int(i[1])
    c = int(i[2])
    if((a+b)> c and a!=b != c and  a<b <c ):
        count+=1
 
print(count)

Solution (Python):
import itertools

N = int(input())
L = list(map(int,(input().split())))
L.sort()
Combi = itertools.combinations(L, 3)
count = 0

for i, j, k in Combi:

    if((i+j)> k and i!=j!=k and  i<j <k ):
        count+=1
print(count)

Solution (Python):
n = int(input())
l = list(map(int, input().split()))
l.sort()

ans = 0
for i in range(n):
    for j in range(i + 1, n):
        for k in range(j + 1, n):
            if l[i] != l[j] != l[k]:
                if l[i] + l[j] > l[k]:
                    ans += 1
print(ans)

Solution (Python):
N = int(input())
L = [int(i) for i in input().split()]

ans = 0
for i in range(N):
    for j in range(i):
        for k in range(j):
            if L[i] != L[j] and L[j] != L[k] and L[k] != L[i] and L[i] + L[j] > L[k] and L[i] + L[k] > L[j] and L[j] + L[k] > L[i]:
                ans += 1
print(ans)

Solution (Python):
N = int(input())

L = list(map(int, input().split()))

L.sort()

ans = 0

if N >= 3 :
    for i in range(0, N - 1) :
        for j in range(1, N - 1 - i) :
            for k in range(2, N - i):
                if L[i] < L[i+j] < L[i+k] and L[i] + L[i+j] > L[i+k]:
                    ans += 1

print(ans)

Solution (Python):
def inp():
    return input()
def iinp():
    return int(input())
def inps():
    return input().split()
def miinps():
    return map(int,input().split())
def linps():
    return list(input().split())
def lmiinps():
    return list(map(int,input().split()))
def lmiinpsf(n):
    return [list(map(int,input().split()))for _ in range(n)]

n = iinp()
l = lmiinps()

ans = 0

if n < 3:
    print(0)
    exit()

for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            if l[i] == l[j] or l[j] == l[k] or l[i] == l[k]:
                continue
            if l[i]+l[j] > l[k] and l[j]+l[k] > l[i] and l[k]+l[i] > l[j]:
                ans += 1

print(ans)

Solution (Python):
N = int(input())
L = list(map(int, input().split()))
cnt = 0

for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if (L[i] != L[j] and L[i] != L[k] and L[j] != L[k]) and (L[i] + L[j] > L[k] and L[i] + L[k] > L[j] and L[j] + L[k] > L[i]):
                cnt += 1
print(cnt)

Solution (Python):
N = int(input())
L = list(map(int, input().split()))
cnt = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if L[i] == L[j] or L[i] == L[k] or L[j] == L[k]:
                continue
            if L[i] + L[j] <= L[k] or L[i] + L[k] <= L[j] or L[j] + L[k] <= L[i]:
                continue
            cnt += 1
print(cnt)

Solution (Python):
import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().rstrip().split())
inl = lambda: list(map(int, input().split()))
out = lambda x, s='\n': print(s.join(map(str, x)))

def check(a, b, c):
    if a == b or a == c or b == c:
        return False
    if a + b <= c:
        return False
    if a + c <= b:
        return False
    if b + c <= a:
        return False
    return True

n = ini()
a = inl()
ans = 0
for i in range(n):
    for j in range(i+1, n):
        for t in range(j+1, n):
            if check(a[i], a[j], a[t]):
                ans += 1
print(ans)

Solution (Python):
n = int(input())
l = list(map(int,input().split()))
c= 0

for i in range(n):
  for j in range(n):
    for k in range(n):
      if l[i] + l[j] > l[k] and l[j]+l[k]>l[i] and l[k]+l[i]>l[j]  and i<j and j<k and l[i] != l[j] != l[k] != l[i]:
        c += 1

print(c)

Solution (Python):
n = int(input())
l = list(map(int,input().split()))
count = 0
for i in range(n):
    for ii in range(n):
        for iii in range(n):
            if l[i] + l[ii] > l[iii] and l[ii] + l[iii] > l[i] and l[iii] + l[i] > l[ii] and i<ii and ii < iii and l[i] != l[ii] and l[i] != l[iii] and l[ii] != l[iii]:
                count += 1
print(count)

Solution (Python):
import numpy as np
from numba import *

N = int(input())
length = np.array(input().split(), np.int64)

length = np.sort(length)

@njit
def calc(cache=True):
    cnt = 0

    for i in range(N):
        for j in range(i + 1, N):
            for k in range(j + 1, N):
                l1, l2, l3 = length[i], length[j], length[k]
                if (l1 != l2 and l1 != l3 and l2 != l3):
                    if (l1 + l2 > l3):
                        cnt += 1
    
    return (cnt)

ans = calc()
print(ans)

Solution (Python):
n = int(input())
L = list(map(int,input().split()))

ans = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            if L[i]!=L[j] and L[i]!=L[k] and L[j]!=L[k] and abs(L[j]-L[k])<L[i]<L[j]+L[k]:
                ans += 1
print(ans)

Solution (Python):
n = int(input())
l = list(map(int,input().split()))
count = 0
l.sort()
for a,i in enumerate(l):
    for b,j in enumerate(l,a+1):
        if i >= j:
            continue
        for c,k in enumerate(l,b+1):
            if j >= k:
                continue
            if k-j<i:
                count+=1
                
print(count)

Solution (Python):
n=int(input())

a=input().split(' ')
b=[int(i) for i in a]
s=0
for k in range(2,n):
  for j in range(1,k):
    for i in range(j):
      if (b[i]!=b[j] and b[j]!=b[k] and b[k]!=b[i]):
        m=max(b[i],b[j],b[k])
        if 2*m<b[i]+b[j]+b[k]:
          s+=1
print(s)

Solution (Python):
n = int(input())
l = list(map(int, input().split()))
ans = 0
l = sorted(l)
for i in range(n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            if l[i] != l[j] != l[k] != l[i]:
                if l[i] + l[j] > l[k]:
                    ans += 1
print(ans)

Solution (Python):
N = int(input())
L = list(map(int, input().split()))

ans = 0
for x in L:
    for y in L:
        for z in L:
            if x != y:
                if x < z:
                    if y < z:
                        if x + y > z:
                            ans += 1

print(int(ans/2))

Solution (Python):
N = int(input())
L = list(map(int,input().split()))
if N < 3:
    print(0)
    exit()
count = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        if L[i] == L[j]:
            continue
        else:
            for k in range(j+1,N):
                if L[i]==L[k] or L[j]==L[k]:
                    continue
                elif abs(L[i]+L[j])>L[k]and abs(L[i]-L[j])<L[k]:
                    count += 1
print(count)

Solution (Python):
def execute(N, L):
    c = 0
    for i in range(N-2):
        for j in range(i+1,N-1):
            for k in range(j+1,N):
                if judge(L[i], L[j], L[k]):
                    c += 1

    return c

def judge(a, b, c):
    if a==b or b==c or c==a:
        return False
    if a+b > c and b+c > a and a+c >b:
        return True
    else:
        return False

if __name__ == '__main__':
    N = int(input())
    L = list(map(int, input().split()))

    print(execute(N, L))

Solution (Python):
n = int(input())
l = list(map(int,input().split()))
ans = 0
for a in range(n-2):
    for b in range(a,n-1):
        for c in range(b,n):
            if l[a]+l[b] > l[c] and l[b]+l[c] > l[a] and l[c]+l[a] > l[b]:
                if l[a] != l[b] and l[b] != l[c] and l[a] != l[c]:
                    ans += 1
print(ans)

Solution (Python):
n = int(input())
l = list(map(int, input().split()))
l.sort()

ans = 0
for i in range(n):
    for j in range(i + 1, n):
        for k in range(j + 1, n):
            if l[i] != l[j] != l[k]:
                if l[i] + l[j] > l[k]:
                    ans += 1
print(ans)

Solution (Python):
N = int(input())
L = list(map(int, input().split()))
L.sort()

ans = 0

for i in range(N-2):
	for j in range(i,N-1):
		for k in range(j,N):
			if L[i] + L[j] > L[k] and L[i]!=L[j] and L[j]!=L[k]:
				ans += 1

print(ans)

Solution (Python):
n = int(input())
l = list(map(int, input().split(" ")))

arr_arr = []

for i in range(n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            arr = sorted([l[i], l[j], l[k]])
            if (arr[0] + arr[1] > arr[2]) and ((arr[0] != arr[1])and(arr[1] != arr[2])):
                arr_arr.append(arr)

print(len(arr_arr))

Solution (Python):
N = int(input())
L = list(map(int, input().split()))

counter = 0
if N < 3:
    print(counter)
else:
    for x in range(0, N - 2):
        for y in range(x + 1, N):
            for z in range(y + 1, N):
                if L[x] != L[y] and L[x] != L[z] and L[y] != L[z]:
                    if L[x] + L[y] > L[z] and L[x] + L[z] > L[y] and L[y] + L[z] > L[x]:
                        counter += 1
    print(counter)

Solution (Python):
import sys

"""
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

x = read().rstrip().decode()
"""

N = int(input())
L = list(map(int,input().split()));
L.sort();

def solve():
    ret = 0
    for i in range(0,N-2):
      for j in range(i+1,N-1):
        for k in range(j+1,N):
          if L[i] != L[j] and L[j] != L[k] and L[i]+L[j] > L[k]:
            ret += 1
            
    
    return ret

print(solve())

Solution (Python):
def main():
    n = int(input())
    ls = sorted(list(map(int, input().split())))
    ans = 0

    for i, li in enumerate(ls):
        for j, lj in enumerate(ls[i+1:]):
            if li == lj:
                continue
            for lk in ls[i+j+2:]:
                if lj == lk:
                    continue

                if li + lj > lk:
                    ans += 1

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
import itertools
N = int(input())
L = list(map(int,input().split()))
tri_list = list(itertools.combinations(L,3))
num = 0
for i in range(len(tri_list)):
    combi = tri_list[i]
    if (combi[0] != combi[1]) and (combi[1] != combi[2]) and (combi[2] != combi[0]):
        if ((abs(combi[0] - combi[1])) < combi[2]) and (combi[2] < (combi[0] + combi[1])):
            num += 1
print(num)

Solution (Python):


n = int(input())
l = list(map(int, input().split()))
assert n == len(l)

count = 0
for i in range(n):
    for j in range(i + 1, n):
        for k in range(j + 1, n):
            if l[i] == l[j] or l[j] == l[k] or l[k] == l[i]:
                continue
            a, b, c = sorted((l[i], l[j], l[k]))
            if a + b > c:
                count += 1
print(count)

Solution (Python):
n = int(input())
l = list(map(int,input().split()))

l_dic = {}
for i in range(n):
    if l[i] not in l_dic:
        l_dic[l[i]] = 0
    l_dic[l[i]] += 1

l_item = list(l_dic.items())
l_item.sort(key = lambda x:x[0])

if len(l_dic) < 3:
    print(0)
    exit()

ans = 0
for i in range(len(l_item)):
    for j in range(i+1,len(l_item)):
        for k in range(j+1,len(l_item)):
            if l_item[i][0] + l_item[j][0] > l_item[k][0] and l_item[i][0] + l_item[k][0] > l_item[j][0] and l_item[k][0] + l_item[j][0] > l_item[i][0]:
                ans += 1*l_item[i][1]*l_item[j][1]*l_item[k][1]

print(ans)

Solution (Python):
n = int(input())
if n < 3:
    print(0)
    exit()
L = list(map(int,input().split()))
ans = 0
for i in range(n):
    for j in range(i,n):
        for k in range(j,n):
            if L[i] != L[j] and L[i] != L[k] and L[j] != L[k]:
                m = max(L[i],L[j],L[k])
                s = L[i]+L[j]+L[k]
                if m < s-m:
                    ans += 1
print(ans)

Solution (Python):

from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement


n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
for x in combinations(l, 3):
    if x[0]!=x[1] and x[0]!=x[2] and x[1]!=x[2]:
        if x[0] + x[1] > x[2]:
            ans+=1
print(ans)

Solution (Python):

from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement


n = int(input())
l = list(map(int, input().split()))
l = sorted(l)
ans = 0
for x in combinations(l, 3):
    if x[0]!=x[1] and x[0]!=x[2] and x[1]!=x[2]:
        if x[0] + x[1] > x[2]:
            ans+=1
print(ans)

Solution (Python):

from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement


n = int(input())
l = list(map(int, input().split()))
l = sorted(l)
t = defaultdict(int)
ans = 0
for x in combinations(l, 3):
    if x[0]!=x[1] and x[0]!=x[2] and x[1]!=x[2]:
        if x[0] + x[1] > x[2]:
            ans+=1
print(ans)

Solution (Python):
from sys import stdin
input = stdin.readline
N = map(int, input().split())
L = list(map(int, input().split()))

c=0

for i in range(len(L)-2):
    for j in range(i+1,len(L)):
        for k in range(j+1,len(L)):
            if L[i]+L[j]>L[k] and L[j]+L[k]>L[i] and L[k]+L[i]>L[j] and L[i]!=L[j] and L[j]!=L[k] and L[k]!=L[i]:c=c+1

print(c)

Solution (Python):
def main():
    n = int(input())
    a = list(map(int, input().split()))
    cnt = 0
    for i in range(n):
        for j in range(i+1, n):
            for k in range(j+1, n):
                if a[i]+a[j] > a[k] and a[j]+a[k] > a[i] and a[k]+a[i] > a[j] and a[i] != a[j] and a[j] != a[k] and a[k] != a[i]:
                    cnt += 1
    print(cnt)


main()

Solution (Python):
N = int(input())
L = sorted(map(int,input().split()))

cnt = 0

for i in range(N-2):
    a = L[i]
    
    for j in range(i+1,N-1):
        b = L[j]
        if a != b:
            
            for k in range(j+1,N):
                c = L[k]
                if b != c & c != a:
                    if a + b > c:
                        cnt += 1
print(cnt)

Solution (Python):
n = int(input())
l = list(map(int, input().split()))
l.sort()
cnt = 0
for i in range(n):
    for j in range(i+1, n):
        for k in range(j+1, n):
            if l[i]!=l[j] and l[j]!=l[k] and l[k]!=l[i] and l[k]-l[j]<l[i]:
                cnt +=1

print(cnt)

Solution (Python):
n, *a = map(int, open(0).read().split())
print(sum(i < j < k < i + j for k in a for j in a for i in a))

Solution (Python):
import itertools

def is_triangle(list_L):
    
    if (list_L[0] + list_L[1] > list_L[2]) and (list_L[1] + list_L[2] > list_L[0]) and (list_L[2] + list_L[0] > list_L[1]) :
        return True
    else :
        return False

def is_uniqueL(list_L):

    return len(list_L) == len(set(list_L))

N = int(input())
L = map(int,input().split())

comb_L = list(itertools.combinations(L, 3))

sum = 0

for a_comb_L in comb_L :

    if is_uniqueL(a_comb_L) == True and is_triangle(a_comb_L) == True:
        sum += 1

print(sum)

Solution (Python):
N=int(input())
L=[int(i) for i in input().split()]

count=0
for i in range(0,N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if (L[i]!=L[j])&(L[i]!=L[k])&(L[j]!=L[k]):
                if (L[i]+L[j]>L[k])&(L[i]+L[k]>L[j])&(L[j]+L[k]>L[i]):
                    count+=1
print(count)