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()))

count = 0

if N <=2:
  print(0)
else:
  for i in range(N-2):
    for j in range(i, N-1):
      if L[i] != L[j]:
        for k in range(j,N):
          if L[i] != L[k]:
            if L[j] != L[k]:

              if L[i] < L[j]:
                if L[j]<L[k]:
                  if L[i] + L[j] > L[k]:
                    count = count + 1
                else:
                  if L[i] + L[k] > L[j]:
                    count = count + 1
              else:
                if L[i]<L[k]:
                  if L[i] + L[j] > L[k]:
                    count = count + 1
                else:
                  if L[j] + L[k] > L[i]:
                    count = count + 1
  print(count)

Solution (Python):
""" B
    https://atcoder.jp/contests/abc175/tasks/abc175_b
"""
import sys
import math
from functools import reduce
from bisect import bisect_left

def readString():
    return sys.stdin.readline()

def readInteger():
    return int(readString())

def readStringSet(n):
    return sys.stdin.readline().split(" ")[:n]

def readIntegerSet(n):
    return list(map(int, readStringSet(n)))

def readIntegerMatrix(n, m):
    return [readIntegerSet(m) for _ in range(0, n)]

def main(N, L):
    count = 0

    for i in range(0, N):
        for j in range(i+1, N):
            for k in range(j+1, N):
                lines = [L[i], L[j], L[k]]
                if L[i] == L[j] or L[j] == L[k] or L[i] == L[k]:
                    continue
                max_line = max(lines)
                sum_line = sum(lines) 
                if max_line < sum_line - max_line:
                    count += 1

    return count

if __name__ == "__main__":
    _N = readInteger()
    _L = readIntegerSet(_N)

    print(main(_N, _L))

Solution (Python):
n = int(input())
ls = list(map(int, input().split()))
ans = 0
san = []

for i in range(len(ls)):
    for j in range(i+1, len(ls)):
        for k in range(j+1, len(ls)):
            temp1 = ls[i] != ls[j] and ls[j] != ls[k] and ls[i] != ls[k]
            temp2 = ls[i] + ls[j] > ls[k] > abs(ls[i]-ls[j])
            temp3 = ls[j] + ls[k] > ls[i] > abs(ls[j]-ls[k])
            temp4 = ls[i] + ls[k] > ls[j] > abs(ls[i]-ls[k])
            if temp1 and (temp2 or temp3 or temp4):
                san.append([ls[i], ls[j], ls[k]])

                ans += 1

print(ans)

Solution (Python):


def solve():
	n=int(input())
	arr=[int(i) for i in input().split()]
	
	arr.sort()
	count=0
	for i in range(len(arr)):
		for j in range(i+1,len(arr)):
			for k in range(j+1,len(arr)):
				if(arr[i]+arr[j]>arr[k]):
					if(arr[i]!=arr[j] and arr[j]!=arr[k]):
						count+=1
					
	print(count)




	


	   
	    
	
	

test=1
while test:

	solve()
	test-=1

Solution (Python):
n = int(input())
l = list(map(int,input().split()))
l.sort()
l.reverse()
c = 0
for i in range(n-2):
    for k in range(i+1,n-1):
        if l[i] == l[k]:continue
        a = l[i] - l[k]
        for m in range(k+1,n):
            if (l[i] == l[m] or l[k] == l[m]):continue
            if a - l[m] < 0:
                c += 1
            else:
                break
print(c)

Solution (Python):
import itertools

n = int(input())
l = list(map(int, input().split()))
cnt = 0
for a, b, c in itertools.combinations(l, 3) :
    if max([a, b, c]) < (sum([a, b, c]) - max([a, b, c])) :
        if len([a, b, c]) == len(set([a, b, c])) :
            cnt += 1
print(cnt)

Solution (Python):
import itertools
import numpy as np

N = int(input(''))
L = (list(map(int, input('').split(' '))))
L = np.array(sorted(L))
set_L = set(L)

if len(set_L) <= 2:
    print(0)
else:
    K = {i:len(L[L==i]) for i in set_L}
    
    i = 0
    for team in itertools.combinations(K.keys(), 3):
        if (team[0] < team[1] + team[2]) & (team[1] < team[0] + team[2]) & (team[2] < team[0] + team[1]):
            i += K[team[0]]*K[team[1]]*K[team[2]]
    print(i)

Solution (Python):
N = int(input())
L = sorted(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] > L[k]) and (L[i] != L[j] !=L[k]):
                ans += 1
print(ans)

Solution (Python):
n = int(input())
l = [int(i) for i in input().split()]
l.sort()
d = {}
dd = set()
for i in l:
    if i in d:
        d[i] += 1
        dd.add(i)
    else:
        d[i] = 1
r = list(d.keys())
m = len(set(l))
c = 0
x = 0
for i in range(m):
    for j in range(i + 1, m):
        for k in range(j + 1, m):
            x = 0
            if r[i] + r[j] > r[k]:
                x = 1
            if r[i] in dd:
                x *= d[r[i]]
            if r[j] in dd:
                x *= d[r[j]]
            if r[k] in dd:
                x *= d[r[k]]
            c += x
print(c)

Solution (Python):
n = int(input())
l = list(map(int, input().split()))
cnt = 0
l.sort()
for i in l:
    for j in l:
        for k in l:
            if (i != j and i != k and j != k) and (i+j > k and j+k > i and k+i > j):
                cnt += 1
print(int(cnt/6))

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[k] != L[i] 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()))
ans = 0
l.sort()
for i in range(0, n-2):
  for j in range(1, n-1):
    for k in range(2, n):
      if l[i] < l[j] and l[j] < l[k]:
        if l[i] + l[j] > l[k]:
          ans += 1

print(ans)

Solution (Python):
n = int(input())
lst = 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):
      lst2 = [lst[i], lst[j], lst[k]]
      if (lst2[0] != lst2[1] and lst2[0] != lst2[2] and lst2[1] != lst2[2]):
        if (lst2[0] < lst2[1] + lst2[2] and lst2[1] < lst2[0] + lst2[2] and lst2[2] < lst2[0] + lst2[1]):
          ans = ans + 1
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[k]<l[i]+l[j] and l[i]<l[j]+l[k] and l[j]<l[i]+l[k]:
                if l[i] != l[j] and l[i] != l[k] and l[j] != l[k]:
                    cnt += 1
print(cnt)

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

import itertools
C = itertools.combinations(L,3)

for c in C: 
  if len(set(c)) != 3: continue
  if sum(c) > 2*max(c): a += 1
    
print(a)

Solution (Python):
def same_hantei(a, b, c):
    if a==b or b==c or c==a:
        return 0
    else:
        return 1

def is_triangle(a, b, c):
    ret = same_hantei(a, b, c)
    if ret == 0:
        return 0
    if a+b > c and b+c > a and c+a > b:
        return 1
    else:
        return 0

num = int(input())
arr = [int(e) for e in input().split()]

count = 0
for i in range(0, num-2):
    for j in range(i+1, num-1):
        for k in range(j+1, num):
            res = is_triangle(arr[i], arr[j], arr[k])
            count += res

print(count)

Solution (Python):
import itertools

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

count = 0

l.sort()

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

for i in range(len(kumiawase)):
  if kumiawase[i][0] != kumiawase[i][1] and kumiawase[i][1] != kumiawase[i][2]:
    if kumiawase[i][0] + kumiawase[i][1] > kumiawase[i][2]:
      count += 1
      
print(count)

Solution (Python):
N = int(input())
L = (sorted([int(l) for l in input().split()]))
cnt = 0
for i in range(len(L)):
  for j in range(i+1,len(L)):
    if L[i] == L[j]:
      continue
    for k in range(j+1,len(L)):
      if L[i] == L[k] or L[j] == L[k]:
        continue
      if 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(" ")))

L.sort()

counter=0

for i in L:
  for j in L:
    if i==j:
      continue
    for k in L:
      if i==k or j==k:
        continue
      else:
        if i+j>k and j+k>i and k+i> j:
          counter=counter+1

print(counter//6)

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

ans = 0

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

print(ans)

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

cnt = 0
for i in range(n):
    a = l[i]
    for j in range(i+1, n):
        b = l[j]
        for k in range(j+1, n):
            c = l[k]
            if a == b or a == c or b == c:
                continue
            m = max(a, b, c)
            if m == a and a < b + c:
                cnt += 1
            elif m == b and b < a + c:
                cnt += 1
            elif m == c and c < a + b:
                cnt += 1
print(cnt)

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]>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]:
                ans += 1
print(ans)

Solution (Python):
from itertools import combinations
n=int(input())
l=list(map(int, input().split()))
base = list(combinations(l,3))
c = len(base)
ans=0
for i in range(c):
  if base[i][0]==base[i][1] or base[i][0]==base[i][2] or base[i][1]==base[i][2]:
    continue
  ct1 = base[i][0]+base[i][1]
  ct2 = base[i][0]+base[i][2]
  ct3 = base[i][1]+base[i][2]
  if ct1>base[i][2] and ct2>base[i][1] and ct3>base[i][0]:
    ans+=1
    
print(ans)

Solution (Python):
import itertools

N = input()
L = input().split()
count = 0

for v_s in itertools.combinations(L, 3):
    v = [int (vv) for vv in v_s]
    if (v[0] != v[1]) and (v[1] != v[2]) and (v[2] != v[0]): 
        if (v[0]+v[1]>v[2]) and (v[1]+v[2]>v[0]) and (v[2]+v[0]>v[1]):
            count += 1

print(count)

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

for i in range(n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            tmp = [l[i], l[j], l[k]]
            tmp.sort()
            if tmp[0] == tmp[1] or tmp[1] == tmp[2]:
                continue
            if tmp[0] + tmp[1] <= tmp[2]:
                continue
            cnt += 1

print(cnt)

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

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

l.sort()

cnt=0
for i in l:
    for j in l:
        for k in l:
            if i<j<k and i+j>k:
                cnt+=1

print(cnt)

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] or l[j] == l[k] or l[k] == l[i]:
        continue
      if l[i]+l[j]>l[k] and l[j]+l[k]>l[i] and l[k]+l[i]>l[j]:
        ans = ans + 1
print(ans)

Solution (Python):
from itertools import combinations
n=int(input())
l=list(map(int, input().split()))
base = list(combinations(l,3))
c = len(base)
ans=0
for i in range(c):
  if base[i][0]==base[i][1] or base[i][0]==base[i][2] or base[i][1]==base[i][2]:
    continue
  ct1 = base[i][0]+base[i][1]
  ct2 = base[i][0]+base[i][2]
  ct3 = base[i][1]+base[i][2]
  if ct1>base[i][2] and ct2>base[i][1] and ct3>base[i][0]:
    ans+=1
    
print(ans)

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

ans = 0

for i in range(n):
    for j in range(1,n):
        for k in range(2,n):
            tmp = []
            if i != j != k and i < j < k:
                tmp.append(a[i])
                tmp.append(a[j])
                tmp.append(a[k])
                tmp.sort()
                if len(tmp) == 3 and abs(tmp[0]-tmp[1]) < tmp[2] and tmp[2] < tmp[0]+tmp[1] and tmp[0] != tmp[1] != tmp[2]:
                    ans += 1

print(ans)

Solution (Python):

N = int(input())
L = [int(a) for a in 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

print(count)

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

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

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

res = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        if i == j: continue
        for k in range(j+1, n):
            if i == k or j == k:
                continue;
            if l[i] + l[j] > l[k] and l[k] + l[j] > l[i] and l[i] + l[k] > l[j] \
                    and l[i] != l[j] and l[i] != l[k] and l[j] != l[k]:
                
                
                res += 1


print(res)

Solution (Python):
import itertools
from collections import Counter

n = int(input())
l = list(map(int,input().split()))
a = sorted(list(set(l)))
b = Counter(l)
ans = 0
for v in itertools.combinations(a, 3):
    if v[0]+v[1]>v[2]:
        ans += b[v[0]]*b[v[1]]*b[v[2]]
print(ans)

Solution (Python):




import sys
input = sys.stdin.readline



def main():
    N = int(input())
    L = list(map(int,input().split()))

    res = 0

    for i in range(N):
        for j in range(i+1,N):
            if L[i] == L[j]:
                continue
            for k in range(j+1,N):
                if (L[j] == L[k]) | (L[k] == L[i]):
                    continue
                temp = [L[i], L[j], L[k]]
                temp = sorted(temp)
                if temp[0] + temp[1] > temp[2]:
                    res += 1

    print(res)



main()

Solution (Python):
n=int(input())
L=sorted(map(int,input().split()))
x=0
for i in L:
  for j in L[:i]:
    if j==i:
      break
    for k in L[:j]:
      if k==j:
        break
      if i<j+k:
        x+=1
print(x)

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

count = 0
for i in itertools.combinations(L, 3):
    if i[0] == i[1] or i[1] == i[2] or i[0] == i[2]:
        continue
    if (i[0] < (i[1] + i[2])) and\
    (i[1] < (i[0] + i[2])) and\
    (i[2] < (i[0] + i[1])):
        count += 1
        continue
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):
        count = 0
        for k in range(j + 1, N):
            
            if L[i] + L[j]  > L[k]  and L[i] < L[j] and L[j] < L[k]:
                count += 1
                
            elif L[i] + L[j]  < L[k] :
                
                break
        ans = ans + count
            
print(ans)

Solution (Python):
from collections import Counter
from itertools import combinations
from bisect import bisect_left

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

S = sorted(L.keys())

count = 0
for i, j in combinations(range(len(S) - 1), 2):
  for k in range(j + 1, bisect_left(S, S[i] + S[j])):
    count += L[S[i]] * L[S[j]] * L[S[k]]

print(count)

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

ans = 0
for x, y, z in itertools.combinations(range(N), 3):
    if nums[x] != nums[y] and nums[x] != nums[z] and nums[z] != nums[y]:
        if nums[x] > nums[y] and nums[x] > nums[z]:
            if nums[x] < nums[y]+nums[z]:
                ans += 1
        elif nums[y] > nums[x] and nums[y] > nums[z]:
            if nums[y] < nums[x]+nums[z]:
                ans += 1
        elif nums[z] > nums[x] and nums[z] > nums[y]:
            if nums[z] < nums[x]+nums[y]:
                ans += 1
print(ans)

Solution (Python):
N = int(input())
a = list(map(int,input().split()))
s = 0
for i in range(N):
    for j in range(N):
        for k in range(N):
            if a[i] != a[j] and a[j] != a[k] and a[i] != a[k] and i<j and j<k:
                if a[i]<(a[j]+a[k]) and a[j]<(a[i]+a[k]) and a[k]<(a[i]+a[j]):
                    s += 1
print(s)

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

c=0
n=len(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] or L[j]==L[k]:
                continue
            if L[i]+L[j]>L[k] :
                c+=1           
print(c)

Solution (Python):
import itertools
N=input()
L=list(map(int,input().split()))
L.sort()
C=list(itertools.combinations(L,3))
ans=0
for a in C:
    if a[0]==a[1] or a[0]==a[2] or a[1]==a[2]:
        continue
    else:
        
        if (a[0]+a[1])>a[2]:
            ans+=1
print(ans)

Solution (Python):
n = int(input())
L = sorted(map(int, input().split()))
ans = 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[k] < L[i] + L[j]:
                ans += 1
print(ans)

Solution (Python):
n = int(input())
l = list(map(int, input().split()))
l.sort()
iter = 0
if len(l)<3:
  print(iter)
  exit()
for i in range(n):
  lst = [j for j in l if j > l[i]]
  if len(lst)<2:
    break
  else:
    
    for k in range(len(lst)):
      for m in range(len(lst)):
        if l[i]+lst[k]>lst[m] and l[i]+lst[m]>lst[k] and lst[m]+lst[k]>l[i] and l[i]!=lst[k] and lst[k]!=lst[m] and lst[m]!=l[i]:
          iter+=1
  
print(int(iter/2))

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

if n <= 2:
    print(0)
else:
    cnt = 0
    c = list(itertools.combinations(l, 3))
    for i in range(len(c)):
        if c[i][0] != c[i][1] and c[i][0] != c[i][2] and c[i][1] != c[i][2]:
            if c[i][0] + c[i][1] > c[i][2] and c[i][0] + c[i][2] > c[i][1] and c[i][2] + c[i][1] > c[i][0]:
                cnt += 1
    print(cnt)

Solution (Python):


def sankakuteiri(a, b, c):
    
    list = [a, b, c]
    list.sort(reverse=True)

    if (list[0] == list[1]) or (list[1] == list[2]):
        return False
    elif(list[1] + list[2] > list[0]):
        return True
    else:
        return False


n = int(input())
numbers = input().split(" ")
l = [int(x) for x in numbers]


r = 0
if len(l) >= 3:
    for i in range(len(l)):
        for j in range(i + 1, len(l)):
            for k in range(j + 1, len(l)):
                if sankakuteiri(l[i], l[j], l[k]):
                    r += 1

print(r)

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

Solution (Python):
param_n = int(input())
param_list = list(map(int, input().split()))

if param_n in [0,1,2]:
  print(0)

else:
  param_list.sort()
  
  
  
  param_count = 0
  int_len = len(param_list)
  
  for small in range(0, int_len):
    for middle in range(small+1, int_len):
      for large in range(middle+1, int_len):
        list_tmp = list()
        list_tmp.append(param_list[small])
        list_tmp.append(param_list[middle])
        list_tmp.append(param_list[large])
        
        
        
        if (len(set(list_tmp)) == 3) & (list_tmp[0] + list_tmp[1] > list_tmp[2]):
          param_count = param_count + 1
          
  print(param_count)

Solution (Python):
import itertools
n = int(input())
l = list(map(int,input().split()))
t = list(itertools.combinations(l,3))
ans = 0
for i in range(len(t)):
    x = t[i][0]
    y = t[i][1]
    z = t[i][2]
    if x != y and y != z and z != x:
        if x < y+z and y < z+x and z < x+y:
            ans+=1
print(ans)

Solution (Python):


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

L_set = list(set(L))
L_set.sort()
N_set = len(L_set)

L_count = [0] * N_set
for i in range( N_set ):
  L_count[i] = L.count( L_set[i] )




ans = 0

for i in range( N_set-2 ):
  for j in range( i+1, N_set-1 ):
    for k in range( j+1, N_set ):
      
      if ( L_set[i]+L_set[j] > L_set[k] ):
        ans += L_count[i]*L_count[j]*L_count[k]

print(ans)

Solution (Python):

import io, sys

def main():
    N = int( sys.stdin.readline() )
    L_list = list(map(int, sys.stdin.readline().split()))

    cnt = 0

    for i in range(len(L_list)):
        for j in range(i+1, len(L_list)):
            for k in range(j+1, len(L_list)):
                a,b,c = sorted( [L_list[i], L_list[j], L_list[k]] )

                if c < (a + b)  and  (a != b) and (b != c):
                    cnt += 1

    print(cnt)


if __name__ == "__main__":
    main()

Solution (Python):
from sys import stdin
n = int(stdin.readline().rstrip())
arr = list(map(int, stdin.readline().rstrip().split()))
tmp = []
count = 0

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

for i in range(0, len(arr)):
    for j in range(i+1, len(arr)):
        for k in range(j+1, len(arr)):
            tmp = sorted([arr[i],arr[j],arr[k]])
            if (tmp[2] < tmp[0] + tmp[1]) and (has_duplicates(tmp)):
                count += 1
print(count)

Solution (Python):

import os
import re
import sys
from bisect import bisect, bisect_left, insort, insort_left
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from io import BytesIO, IOBase
from itertools import (
    accumulate, combinations, combinations_with_replacement, groupby,
    permutations, product)
from math import (
    acos, asin, atan, ceil, cos, degrees, factorial, hypot, log2, pi, radians,
    sin, sqrt, tan)
from operator import itemgetter, mul
from string import ascii_lowercase, ascii_uppercase, digits


def inp():
    return(int(input()))


def inlist():
    return(list(map(int, input().split())))


def instr():
    s = input()
    return(list(s[:len(s)]))


def invr():
    return(map(int, input().split()))


def main():
    n = inp()
    a = inlist()
    ans = 0
    for i in range(n):
        for j in range(i+1, n):
            for k in range(j+1, n):
                x = a[i]
                y = a[j]
                z = a[k]
                if x + y > z and y + z > x and z + x > y and (x != y and y != z and z != x):
                    ans += 1
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
a = int(input())
b = list(input().split(" "))

for i in range(a):
    b[i] = int(b[i])

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

print(c)

Solution (Python):
from itertools import combinations
from collections import Counter


def main():
    n = int(input())
    l = list(map(int, input().split()))
    c = Counter(l)
    s = list(c.keys())

    ans = 0
    for item in combinations(s, 3):
        item = sorted(item)
        if item[2] < item[0] + item[1]:
            ans_this = 1
            for i in item:
                ans_this *= c[i]
            ans += ans_this
    print(ans)


if __name__ == "__main__":
    main()

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

def calc(a, b, c):
    max = a
    mid = b
    min = c

    if a < b:
        max = b
        mid = a
        min = c
    if a < c:
        max = c
        mid = a
        min = b
    if abs(mid-min) < max and max < mid + min:
        return True
    else:
        return False

for i in range(0, N):
    for k in range(i + 1, N):
        for l in range(k+ 1, N):
            if L[i] != L[k] and L[k] != L[l] and L[l] != L[i]:
                if calc(L[i], L[k], L[l]) == True:
                    count += 1
print(str(count))

Solution (Python):
import itertools


num_sticks = int(input())

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

stick_combinations = list(itertools.combinations(sticks, 3))

counter = 0

for a, b, c in stick_combinations:
    if a == b or b == c or c == a:
        continue

    if abs(b - c) < a < (b + c):
        counter += 1

print(counter)

Solution (Python):
n = int(input())
l = list(map(int,input().split()))
length = len(l)
count = 0
if length < 3:
    print(0)
    exit()

for i in range(length-2):
    for j in range(i+1,length-1):
        for k in range(j+1,length):
            if len(set([l[i],l[j],l[k]])) == 3:
                li = sorted([l[i],l[j],l[k]])
                if li[0] + li[1] > li[2]:



                    count+=1

print(count)

Solution (Python):
from collections import Counter
import numpy as np


num_bar = int(input())
bar_list = list(map(int, input().split()))
counter = Counter(bar_list)
bars = np.unique(bar_list)

ans = 0
for longest in bars:
    for b1 in bars:
        min_b2 = longest - b1
        if min_b2 <= 0:
            continue
        target = bars[(bars < longest) & (bars > min_b2)]
        for t in target:
            if t - b1 >= 0:
                continue
            ans += counter[longest] * counter[b1] * counter[t]

print(ans)

Solution (Python):
n = int(input())
L = list(map(int,input().split()))
L = sorted(L)
ans = 0
if n >= 3:
    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[j] == L[k] or L[i] == L[k]:
                    pass
                else:
                    if L[i] + L[j] > L[k]:
                        if L[j] + L[k] > L[i]:
                            if L[i] + L[k] > L[j]:
                                ans += 1
            
print(ans)

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

lista = input().split(' ')
lista = list(map(int, lista))

count = 0
for i in range(n):
    for j in range(i+1, n):
        for k in range(j+1, n):
            if lista[i] != lista[j] and lista[j] != lista[k]  and lista[i] != lista[k]  and lista[i] + lista[j]  > lista[k] and lista[i] + lista[k]  > lista[j] and lista[k] + lista[j]  > lista[i]:
                count += 1



print(count)

Solution (Python):
import math

n = int(input())
lL = sorted(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 len(set([lL[i], lL[j], lL[k]])) != 3:
                continue
            sm, no, lo = sorted([lL[i], lL[j], lL[k]])
            if lo < no + sm:
                ans += 1

print(ans)

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

import itertools

count = 0
L = sorted(L)
Cmb = itertools.combinations(L,3)
for cmb in Cmb:
    a = cmb[0]
    b = cmb[1]
    c = cmb[2]
    if not(a == b or b == c or c == a):
        if a + b > c:
            count += 1
print(count)

Solution (Python):
import collections

def main():
    N = input()
    LList = list(map(int, input().split()))
    LListLen = len(LList)

    answer = 0

    if(LListLen < 3):
        print(answer)
        return

    for i in range(LListLen):
        a_key = LList[i]
        
        for j in range(i, LListLen):
            b_key = LList[j]

            if a_key == b_key:
                continue

            for k in range(j, LListLen):
                c_key = LList[k]

                if (a_key == c_key) or (b_key == c_key):
                    continue
                
                if (a_key + b_key > c_key) and (b_key + c_key > a_key) and (c_key + a_key > b_key):
                    answer = answer + 1

    print(answer)

if __name__ == "__main__":
    main()

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

import itertools

for t in itertools.combinations(L, 3):
  if len(set(t)) == len(list(t)):
                        T.append(list(t))
  
for i in range(len(T)):
  T[i].sort()
  if T[i][0] + T[i][1] > T[i][2]:
    cnt += 1

print(cnt)

Solution (Python):
nn = int(input())
ll = list(map(int,input().split()))

uniqlen = sorted(set(ll),reverse=True)
mydb = [[0]*2 for i in range(len(uniqlen))]
for ind in range(len(uniqlen)):
    mydb[ind][0] = uniqlen[ind]
    mydb[ind][1] = ll.count(uniqlen[ind])

ans = 0

for i in range(len(mydb)):
    for j in range(i+1,len(mydb)):
        for k in range(j+1,len(mydb)):
                if max([mydb[i][0],mydb[j][0],mydb[k][0]])*2 < sum([mydb[i][0],mydb[j][0],mydb[k][0]]):
 
                    ans += mydb[i][1]*mydb[j][1]*mydb[k][1]

print(ans)

Solution (Python):
import itertools

N = int(input())
L = list(map(int, input().split()))
count = 0

for p in itertools.combinations(L, 3):
  if len(set(p)) != 3:
    continue
  else:
    if p[0] < p[1] + p[2] and p[1] < p[0] + p[2] and p[2] < p[0] + p[1]:
      count += 1
print(count)

Solution (Python):
N=int(input())
bou=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):
            max_bou=max(bou[i],bou[j],bou[k])
            if ((bou[i]!=bou[j]) and (bou[j]!=bou[k]) and (bou[k]!=bou[i])):
                if bou[i]+bou[j]+bou[k]-max_bou>max_bou:
                    count=count+1
print(count)