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):
import numpy as np
N = input()
bars = list(map(int, input().split(" ")))

length = len(bars)

def check_triangle(a, b, c):
    if a == b or b == c or c == a:
        return 0
    if ((a + b) > c) and ((b + c) > a) and ((c + a) > b):
        return 1
    else:
        return 0


count = 0
for i, li in enumerate(bars):
    for k in range(i+1, length):
        res = np.sum([check_triangle(bars[i], bars[k], bars[j]) for j in range(k+1, length)])
        count += int(res)
print(count)

Solution (Python):



import collections
N = int(input())
L = [int(i) for i in input().split()]

L = sorted(L)

c = collections.Counter(L)
l = list(c)






if N < 3:
    print(0)
else:
    cnt = 0
    tmp_cnt = 0
    i_tmp_cnt = 0
    for i in range(len(c)-1):
        j=i+1
        k=i+2
        while j < (len(c)-1):
            while k < (len(c)):
                if l[k] - l[i] < l[j] and l[j] < l[k] + l[i]:
                    
                    tmp_cnt += 1 * c[l[k]]
                    
                    k += 1
                else:
                    
                    k += 1
            
            tmp_cnt = tmp_cnt * c[l[j]]
            
            
            
            j += 1
            k = j + 1
            i_tmp_cnt += tmp_cnt
            tmp_cnt = 0
            
            
        
        
        cnt += i_tmp_cnt * c[l[i]]
        tmp_cnt = 0
        i_tmp_cnt = 0
        
        
        

    print(cnt)

Solution (Python):
import itertools

n, *l = map(int, open(0).read().split())

def f(a,b,c):
    return a+b>c and b+c>a and a+c>b


a=0
for t in itertools.combinations(range(n), 3):
    s=[l[i] for i in t]
    if len(s) != len(set(s)):
        continue
    if f(*s):
        a+=1

print(a)

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

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

input_L = input()
L = str(input_L)

listL = L.split(' ')

max = 0
tmp1 = 0
tmp2 = 0
result = 0

for i in range(n - 2):
    for j in range(i + 1, n - 1):
        for k in range(j + 1, n):
            if int(listL[i]) != int(listL[j]) and int(listL[j]) != int(listL[k]) and int(listL[k]) != int(listL[i]):
                if int(listL[i]) > int(listL[j]):
                    max = int(listL[i])
                    tmp1 = int(listL[j])
                else :
                    max = int(listL[j])
                    tmp1 = int(listL[i])
                if int(listL[k]) > max:
                    tmp2 = max
                    max = int(listL[k])
                else :
                    tmp2 = int(listL[k])
                if max < (tmp1 + tmp2):
                    result += 1

print(str(result))

Solution (Python):
import itertools


S = input()

l = input().split()

i = 0
if len(l) < 3:
    print('0')
else:

    for v in itertools.combinations(l, 3):
        
        if v[0] != v[1] and v[1] != v[2] and v[0] != v[2]:
        
            if int(v[0]) + int(v[1]) > int(v[2]) and int(v[1]) + int(v[2]) > int(v[0]) and int(v[0]) + int(v[2]) > int(v[1]) :
                i = i +1

    print(i)

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

count = 0
subL = []

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[j] != L[k] and L[k] != L[i]):
                if L[i] > L[j]:
                    max = L[i]
                else: max = L[j]
                if L[k] > max:
                    max = L[k]

                if L[i] < L[j]:
                    min =  L[i]
                else: min = L[j]
                if L[k] < min:
                    min = L[k]

                if min < L[i] < max:
                    mid = L[i]
                if min < L[j] < max:
                    mid = L[j]
                if min < L[k] < max:
                    mid = L[k]

                if max < mid + min:
                    count += 1

print(count)

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

count = 0
for i in range(N):
    for j in range(N):
        for k in range(N):
            if i < j and j < k:
                if l[i]<l[j] and l[j]<l[k] and l[i]+l[j]>l[k]:
                    count += 1
print(count)

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

count = 0

for i in L:
    for j in L:
        for k in L:
            if i < j < k:
                if (i + j) > k:
                    if (i + k) > j:
                        if (k + j) > i:
                            count += 1
print(count)

Solution (Python):
n=int(input(""))
lisl=input("").split(" ")
l=[]
for i in lisl:
    l+=[int(i)]
l.sort()
t=0
for i in range(2,n):
    for ii in range(1,i):
        for iii in range(ii):
            if(l[i]<l[ii]+l[iii] and l[i]!=l[ii] and l[ii]!=l[iii]):
                t+=1
print(t)

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

for i in range(len(s)-2):
  a = s[i]
  for j in range(i + 1, len(s)-1):
    b = s[j]
    if a == b:
      continue
    for k in range(j + 1, len(s)):
      c = s[k]

      if a == c or b == c:
        continue
      if a > b and a > c and a < b + c:
        ans += 1
      elif b > c and b > a and b < c + a:
        ans += 1
      elif c > a and c > b and c < a + b:
        ans += 1

print(ans)

Solution (Python):


import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
l = LI()
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[j] != l[k] and l[k] != l[i]:
                L = max(l[i], l[j], l[k])
                s = l[i] + l[j] + l[k]
                if s - L > L:
                    ans += 1
print(ans)

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

l.sort()

count = 0

for i in range(n-2):
	for j in range(i+1, n-1):
		if l[i] == l[j]:
			continue

		for k in range(j+1, n):
			if l[j] == l[k]:
				continue

			if l[i]+l[j] > l[k]:
				count += 1

print(count)

Solution (Python):
import sys
import numpy as np
import math
N = int(input())
L = list(map(int, input().split()))
L = sorted(L)
e = 0

for i in range(len(L)):
    s = 0
    s = L[i]
    for j, b in enumerate(L[i+1:]):
        if L[i] == b:
            continue
        g = s + b
        for w, n in enumerate(L[i+j+2:]):
            if n == b or n == L[i]:
                continue

            a = g - n
            if a > 0:
                e += 1

print(e)

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

cnt = 0

for i in range(N):
    for j in range(i+1,N):
        for n in range(j+1,N):
            if (L[i] < L[j] + L[n]):
                if (L[j] < L[i] + L[n]):
                    if (L[n] < L[i] + L[j]):
                        if(L[n] != L[i]):
                            if(L[j] != L[i]):
                                if(L[n] != L[j]):
                                    cnt += 1










print(cnt)

Solution (Python):
n=int(input())
s=[int(i) for i in input().split()]
s.sort()
count=0
for x in range(n-2):
  len_one=s[x]
  for f in range(n-x-1):
    len_two=s[f+x+1]
    if len_two==len_one:
      pass
    else:
      for z in range(n-x-f-2):
        len_three=s[z+x+f+2]
        if len_three==len_two or len_three==len_one:
          pass
        else:
          if (len_one+len_two)>len_three:
            count+=1
          else:
            pass
print(count)

Solution (Python):
import sys


def read_input_line():
    return sys.stdin.readline().strip()


def task(N: int, L: list):
    edges = sorted(L)
    l = len(edges)
    if l < 3:
        return 0
    count = 0
    triples = []
    i = 0
    while i < l:
        j = i + 1
        while j < l:
            if edges[j] != edges[i]:
                _ = [edge for edge in edges[j+1:] if edge != edges[j] and edge < edges[i] + edges[j]]
                triples.extend([[edges[i], edges[j], edge] for edge in _])
                count += len(_)
            j += 1
        i += 1
    return count


def main():
    N = int(read_input_line())
    L = [int(s) for s in read_input_line().split(' ')]
    result = task(N, L)
    print(result)


main()

Solution (Python):
import itertools
x = int(input())
count = 0
c=list(map(int, input().split()))
c_list = list(itertools.combinations_with_replacement(c, 3))
for i in range(len(c_list)):
  if c_list[i][0] != c_list[i][1] and c_list[i][1]!= c_list[i][2] and c_list[i][2] != c_list[i][0]:
    if c_list[i][0] + c_list[i][1]  > c_list[i][2] and c_list[i][1] + c_list[i][2] > c_list[i][0] and c_list[i][0] + c_list[i][2] > c_list[i][1]:
      count += 1
print(count)

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

Solution (Python):
import itertools
import sys

N = int(input())
if N < 3:
  print(0)
  sys.exit()

lis = list(map(int, input().split()))
count = 0
for tri in itertools.combinations(lis, 3):
  if tri[0] != tri[1] and tri[1] != tri[2] and tri[2] != tri[0]:
    if tri[0]+tri[1] > tri[2] and tri[1]+tri[2] > tri[0] and tri[2]+tri[0] > tri[1]:
      count += 1
print(count)

Solution (Python):
import itertools
num = int(input())
lis = list(map(int,input().split()))
tri = list(itertools.combinations(lis,3))
count = 0

for i in range(len(tri)):
    a = tri[i][0]
    b = tri[i][1]
    c = tri[i][2]
    if len(tri[i]) == len(set(tri[i])):
        if a+b > c and b+c > a and a+c > b:
            count += 1

print(count)

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

Solution (Python):
import collections
import itertools
import sys
input = sys.stdin.readline


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


def print_ans(lr):
    """Test Case
    >>> print_ans([4, 4, 9, 7, 5])
    5
    >>> print_ans([4, 5, 4, 3, 3, 5])
    8
    >>> print_ans([9, 4, 6, 1, 9, 6, 10, 6, 6, 8])
    39
    >>> print_ans([1,1])
    0
    """
    ans = 0
    c = collections.Counter(lr)
    target = itertools.combinations(list(c.keys()), 3)
    for t in target:
        if check_tri(t[0], t[1], t[2]):
            tmp = (c[t[0]] * c[t[1]] * c[t[2]])
            ans += tmp
    print(ans)


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

Solution (Python):
n=int(input())
long=0
middle=0
short=0
count=0
pre=0
a=0
b=0
c=0
list=[]
list=input().split()
for i in range(len(list)):
  list[i]=int(list[i])

for i in range(n-2):
 for s in range(i+1,n-1):
  for t in range(s+1,n):
   if list[i]!=list[s] and list[s]!=list[t] and list[i]!=list[t]:
    if list[i]>list[s] and list[i]>list[t]:
     long=i
     if list[s]>list[t]:
      middle=s
      short=t
     else:
      middle=t
      short=s

    if list[s]>list[i] and list[s]>list[t]:
     long=s
     if list[i]>list[t]:
      middle=i
      short=t
     else:
      middle=t
      short=i

    if list[t]>list[s] and list[t]>list[i]:
     long=t
     if list[s]>list[i]:
      middle=s
      short=i
     else:
      middle=i
      short=s
    if int(list[long])<int(list[middle])+int(list[short]):
     count+=1
print(count)

Solution (Python):
N = int(input())
L = list(map(int, input(). split()))
count = 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] > 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]):
                count += 1
            else:
                continue
print(count)

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

cnt = 0

for a in range(len(L)-2):
    for b in range(a+1, len(L)-1):
        if L[a] != L[b]:
            for c in range(b+1, len(L)):
                if L[b] != L[c]:
                    if L[a] +L[b] > L[c]:
                        cnt += 1
            


print(cnt)

Solution (Python):
N = int(input())
L = sorted([int(x) for x 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 L[i] == L[j] or L[j] == L[k] or L[k] == L[i]:
                continue
            if L[k] < L[i] + L[j]:
                ans += 1

print(ans)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
a.sort()
ans=0

for i in range(n-2):
    for y in range(i+1,n-1):
        if a[y]==a[i]:
            continue
        for j in range(y+1,n):
            if a[j]==a[y]:
                continue
            if a[i]+a[y]>a[j]:
                ans+=1
            else:
                break

print(ans)

Solution (Python):
n = int(input())
l = 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 (l[i] != l[j] and l[j] != l[k] and l[i] != l[k]) \
            and (l[i] + l[j] > l[k] and l[j] + l[k] > l[i] and l[k] + l[i] > l[j]):
                cnt += 1
                
print(cnt)

Solution (Python):
N = int(input())
L = input().split()
count = 0
for x in range(N-2):
    X = int(L[x])
    for y in range(x+1, N-1):
        Y = int(L[y])
        for z in range(y+1, N):
            Z = int(L[z])

            if X == Y or Y == Z or Z == X:
                pass
            elif X + Y > Z and X + Z > Y and Y + Z > X:
                count += 1
            else:
                pass
print(count)

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

Solution (Python):
import itertools

n = int(input())
num_list = list(map(int, input().split()))

combi = list(itertools.combinations(num_list, 3))

new_list = []
for a in combi:
  if not((a[0] == a[1] or a[1] == a[2] or a[0] == a[2]) or sum(a)-max(a) <= max(a)):
    new_list.append(a)
print(len(new_list))

Solution (Python):
n=int(input())
a=[int(k) for k in input().split()][ :n]
c=0
a.sort();
for i in range(len(a)):
    for j in range(i+1,len(a)):
        for m in range(j + 1, len(a) ):
            if (a[i]+a[j]>a[m] and a[i]+a[m]>a[j] and a[m]+a[j]>a[i]) and (a[i]<a[j] and a[j]<a[m]) :
                c+=1

print(c)

Solution (Python):
N=int(input())
ai=list(map(int,input().split()))
c=int(0)
if N > 2:
  for i in range(N):
    for k in range(i+1,N):
      for l in range(k+1,N):
        if ai[i] != ai[k] and ai[i] != ai[l] and ai[l] != ai[k]:
          if max(ai[i],ai[k],ai[l]) < ai[i] + ai[k] + ai[l] - max(ai[i],ai[k],ai[l]):
             c += 1          
print(c)

Solution (Python):
from itertools import combinations 
N = int(input())
L = list(map(int,input().split()))


ans = list(combinations(L,3))
ans1 = 0
for i in ans:
    if (i[0]+i[1]>i[2] and i[0]+i[2]>i[1] and i[1]+i[2]>i[0] and i[0]!=i[1] and i[0]!=i[2] and i[1]!=i[2]):
        ans1+=1

print(ans1)

Solution (Python):
import itertools
N=int(input())
LN=list(input().split(' '))
LN.sort(key=int)
LN_sort=list(dict.fromkeys(LN))
cbn=list(itertools.combinations(LN_sort,3))
cnt=int(0)
for i in range(len(cbn)):
    if int(cbn[i][0])+int(cbn[i][1])>int(cbn[i][2]):
        cnt+=LN.count(cbn[i][0])*LN.count(cbn[i][1])*LN.count(cbn[i][2])

print(cnt)

Solution (Python):
import itertools

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

comb = list(itertools.combinations(l, 3))



count = 0

for c in comb:
    if c[0] + c[1] > c[2] and c[1] + c[2] > c[0] and c[0] + c[2] > c[1]\
            and c[0]!=c[1] and c[0]!=c[2] and c[1]!=c[2]:
        
        count += 1

print(count)

Solution (Python):
from itertools import combinations 
N = int(input())
L = list(map(int,input().split()))


ans = list(combinations(L,3))
ans1 = 0
for i in ans:
    if (i[0]+i[1]>i[2] and i[0]+i[2]>i[1] and i[1]+i[2]>i[0] and i[0]!=i[1] and i[0]!=i[2] and i[1]!=i[2]):
        ans1+=1

print(ans1)

Solution (Python):
n = int(input())
sis = list(map(int,input().split(" ")))
cou = 0
li = []
for i in range(n-2):
    for j in range(i+1,n-1):
        if sis[j] != sis[i]:
            for k in range(j+1,n):
                if sis[j] != sis[k] and sis[k]!= sis[i]:
                    if sis[k] < (sis[j] + sis[i]) and sis[j] < (sis[k] + sis[i]) and sis[i] < (sis[j] + sis[k]):
                        li.append((sis[i],sis[j],sis[k]))
                        cou += 1
                        
print(cou)

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):
        if l[i] != l[j]:
            
            t = l[i] + l[j]
            for k in range(j+1,n):
                t_2 = l[j] + l[k]
                t_3 = l[i] + l[k]
                if l[k] != l[i] and l[k] != l[j] and l[k] < t and l[i] < t_2 and l[j] < t_3:
                    
                    ans += 1
        else:
            continue

print(ans)

Solution (Python):
import itertools as it
n=int(input())
tr=list(map(int,input().split()))
tr=it.combinations(tr, 3)
ans=[]
c=0
for i in tr:
    if (i[0]+i[1]>i[2] and i[2]+i[1]>i[0] and i[0]+i[2]>i[1]) and (i[0]!=i[1] and i[0]!=i[2]) and (i[1]!=i[2] and i[1]!=i[0]) :
        c+=1
print(c)

Solution (Python):
N = int(input())
L = list(map(int,input().split()))
ans = 0
for i in range(N):
    j = i+1
    for j in range(N):
        k = j+1
        for k in range(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[j]<L[i]+L[k] and L[k]<L[i]+L[j]:
                    ans += 1
            k += 1
        j += 1
    i += 1
print(ans//6)

Solution (Python):
import itertools

n=int(input())
a=list(map(int,input().split()))
count=0

n=list(itertools.combinations(a,3))

for i in n:
  if i[0]!=i[1] and i[1]!=i[2] and i[0]!=i[2]:
    if i[0]+i[1]>i[2] and i[0]+i[2]>i[1] and i[2]+i[1]>i[0]:
      count+=1

print(count)

Solution (Python):
a = [input().split() for l in range(2)]
count = 0
N = int(a[0][0])
for i in range(N):
    for j in range(i):
        for k in range(j):
           if int(a[1][i]) != int(a[1][j]) and int(a[1][j]) != int(a[1][k]) and int(a[1][k]) != int(a[1][i]):
                if int(a[1][i]) > abs(int(a[1][j])-int(a[1][k])) and int(a[1][i]) < int(a[1][j])+int(a[1][k]):
                    count = count + 1
print(count)

Solution (Python):
x=input()
y = list(map(int, input().split()))
total = 0
for p in y:
    for j in y:
        for k in y:
            if p != j and j!= k and k !=p:
                if p + j > k and j + k > p and k + p > j:
                    total += 1
print(int(total/6))

Solution (Python):
from itertools import combinations
n=int(input())
l=[int(i) for i in input().split()][:n]
cnt=0
if n<3:
  print(0)
else:
  c=list(combinations(l,3))
  for j in range(len(c)):
    if c[j][0]==c[j][1] or c[j][1]==c[j][2] or c[j][0]==c[j][2]:
      continue
    else:
        if c[j][0]+c[j][1]>c[j][2] and c[j][0]+c[j][2]>c[j][1] and c[j][1]+c[j][2]>c[j][0]:
            cnt+=1
    
  print(cnt)

Solution (Python):
import itertools

def has_duplicates(seq):
    return len(seq) != len(set(seq))

N = int(input())

if N < 3:
  print('0')
else:
 numList = list(map(int,input().split()))
 cnt = 0
 comblist = itertools.combinations(numList,3)
 for pair  in comblist:
  if has_duplicates(pair):  
   continue
  else:
   if (pair[0] + pair[1] > pair[2]) and (pair[0] + pair[2] > pair[1]) and (pair[1] + pair[2] > pair[0]):
    cnt = cnt + 1
 print(cnt)

Solution (Python):
N = int(input())
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]:
                
                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):
import itertools
N = int(input())
L = sorted(list(map(int,input().split())))
SS = itertools.combinations(L,3)
count = 0

for x,y,z in SS:
    if x + y > z and x + z > y and y + z > x and x != y != z:
        count += 1
print(count)

Solution (Python):
def MakingTriangle():
    
    num = int(input())

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

    count = 0

    if num <= 2:
        print(0)
        
    else:
        
        for i in range(num - 2):
            
            for j in range(i+1, num-1):
            
                for k in range(j+1, num):
                    if (data[i] != data[j]) and (data[j] != data[k]) and (data[i] != data[k]):
                        
                        if (data[i] + data[j] > data[k]) and (data[j] + data[k] > data[i]) and (data[i] + data[k] > data[j]):

                            count = count + 1
            
        print(count)
        
if __name__ == '__main__':
    MakingTriangle()

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

l = l_before.split(' ')



i = 0
j = 0
k = 0

count = 0

for ic in range(n):
    for jc in range(n-ic-1):
        for kc in range(n-ic-jc-2):
            i = ic
            j = i + jc + 1
            k = j + kc + 1
            if int(l[i]) != int(l[j]):
                if int(l[j]) != int(l[k]):
                    if int(l[i]) != int(l[k]):
                        if int(l[i]) >= int(l[j]):
                            if int(l[k]) >= int(l[i]):
                                if int(l[k]) < int(l[i]) + int(l[j]):
                                    count = count + 1
                            else:
                                if int(l[i]) < int(l[k]) + int(l[j]):
                                    count = count + 1
                        else:
                            if int(l[k]) > int(l[j]):
                                if int(l[k]) < int(l[i]) + int(l[j]):
                                    count = count + 1
                            else:
                                if int(l[j]) < int(l[k]) + int(l[i]):
                                    count = count + 1

print(count)

Solution (Python):
N = int(input())
A = list(map(int , input().split()))
B = sorted(list(set(A)),reverse=True)
S = len(B)
if N <=2 or S<= 2:
    print(0)
else:
    count = 0
    for i in range(S-2):
        high = B[i]
        hc = A.count(B[i])
        for j in range(S-2-i):
            mid = B[i +j+1]
            mc = A.count(B[i +j+1])
            for k in range(S-2- i -j):
                if B[i +j+k +2]>(high - mid):
                    lc = A.count(B[i +j+k +2])
                    count += (hc*mc*lc)
    print(count)

Solution (Python):
N, = map(int, input().split())
X = list(map(int, input().split()))
X.sort()
R = 0
for i in range(N):
    x = X[i]
    for j in range(i+1, N):
        y = X[j]
        if x == y:
            continue
        for k in range(j+1, N):
            z = X[k]
            if x == z or y == z:
                continue
            if x+y>z:
                R += 1
print(R)

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

l.sort()
ans = 0
f = l[0]
for i in range(len(l)):
    less = l[:i]
    for v in itertools.combinations(less, 2):
        if v[0] != v[1]:
            if l[i] < v[0] + v[1]:
                if not l[i] in v: 
                    ans += 1
print(ans)

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


count = 0
R = set(range(N))
A = set()
for i in R:
    B = set()
    A.add(i)
    B = A.union(B)
    for j in R - A:
        B.add(j)
        if K[i] != K[j]:
            for k in R - B:
                if (K[i] != K[k]) and (K[j] != K[k]) and ((K[i]+K[j]) > K[k]) and ((K[j]+K[k]) > K[i]) and ((K[k]+K[i]) > K[j]):
                    count += 1

print(count)

Solution (Python):
n = int(input())
l = list(map(int,input().split()))
l = sorted(l)
n= len(l)
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[k]<(l[i]+l[j]) and l[i]<(l[j]+l[k]) and l[j]<(l[i]+l[k]) and l[i]!=l[j]!=l[k]:
                cnt+=1
print(cnt)

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,N):
        for k in range(j,N):
            li = L[i]
            lj = L[j]
            lk = L[k]
            if li + lj > lk and lj + lk > li and lk + li >= lj and li != lj and lj != lk:
                ans += 1
print(ans)

Solution (Python):
import itertools


n = input()
l = list(map(int, input().split())) 
l.sort()
cnt = 0
c_list = list(itertools.combinations(l, 3))



for lis in c_list:
    
    if (lis[-3]+ lis[-2] > lis[-1])and (lis[-1]!=lis[-2])and (lis[-1]!=lis[-3])and(lis[-2]!=lis[-3]):
        cnt += 1

print(cnt)

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

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

Solution (Python):
n=int(input())
L=list(map(int,input().split()))
l=len(L)
ans=0
for i in range(l-2):
  for j in range(i+1,l-1):
    if L[i]==L[j]:
      continue
    for k in range(j+1,l):
      if L[j]==L[k] or L[k]==L[i]:
        continue
      m=max(L[i],L[j],L[k])
      s=L[i]+L[j]+L[k]
      if s <= 2*m:
        continue
      ans+=1
print(ans)

Solution (Python):
def solve(n, a):
	cnt = 0
	
	
	S = []
	for i in range(n):
		for j in range(i+1, n):
			for k in range(j+1, n):
				lens = a[i]+a[j]+a[k]
				ma = max(a[i], max(a[j], a[k]))
				rest = lens - ma
				if (ma < rest):
					
					
					
					
					
					
					
					if(a[i] != a[j] & a[j] != a[k]):
						if(a[i] != a[k]):
							cnt += 1
	return cnt

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


cnt = solve(N, ls)
print(cnt)

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




count = 0

for i in range(len(L)):
    for j in range(len(L)):
        for k in range(len(L)):
            if i < j and j < k:
                if L[i] != L[j] and L[i]!= L[k]:
                    if L[j] != L[k]:
                        
                        koko = [L[i],L[j],L[k]]
                        
                        koko.sort()
                        
                        if koko[2] < koko[1]+koko[0]:
                            count += 1
                            
print(count)

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

new_L = sorted(L, reverse = True)

k = 0
j = k + 1
i = j + 1
count = 0

while(k < N):

    while(j < N):

        while(i < N):

            if (new_L[k] < (new_L[j] + new_L[i])):
                if(new_L[k] != new_L[j]) and (new_L[j] != new_L[i]) and (new_L[i] != new_L[k]):
                    count += 1

            i += 1
        
        j += 1
        i = j + 1
    
    k += 1
    j = k + 1
    i = j + 1

print(count)

Solution (Python):
N = int(input())
L = list(map(int,input().split()))
count = 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[j]!=L[k] and L[k]!=L[i] and L[i]+L[j]>L[k] and L[k]+L[j]>L[i] and L[i]+L[k]>L[j]:
        count += 1
        
print(count)

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

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

l = sorted(l)

cnt = 0

for x in range(len(l)):
    for y in range(x+1, len(l)):
        su = l[x] + l[y]
        for z in range(y+1, len(l)):
            if l[x] == l[y] or l[x] == l[z] or l[y] == l[z]:
                continue
            if su > l[z]:
                cnt += 1
                
            else:
                break

    continue

print(cnt)