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):
'''
自宅用PCでの解答
'''
import math

import itertools
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit


ipt = stdin.readline
setrecursionlimit(10**7)
mod = 10**9+7
dir = [(-1,0),(0,-1),(1,0),(0,1)]
alp = "abcdefghijklmnopqrstuvwxyz"

def main():
    n = int(ipt())
    nm = 0
    l = [int(i) for i in ipt().split()]
    for i in range(n):
        li = l[i]
        for j in range(i+1,n):
            lj = l[j]
            for k in range(j+1,n):
                lk = l[k]
                if li == lj or lj == lk or lk == li or li >= lj+lk or lj >= li+lk or lk >= lj+li:
                    continue
                else:
                    nm += 1

    print(nm)

    return None

if __name__ == '__main__':
    main()

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

Solution (Python):
(N,) = [int(x) for x in input().split()]
L = [int(x) for x in input().split()]
count = 0
for i in range(N):
    for j in range(i + 1, N):
        for k in range(j + 1, N):
            a, b, c = L[i], L[j], L[k]
            if len(set([a, b, c])) == 3 and a + b > c and a + c > b and b + c > a:
                count += 1
print(count)

Solution (Python):
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
res = 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[j] != a[k]) and (a[k] != a[i]):
        if a[i] + a[j] > a[k] and (a[j] + a[k] > a[i]) and (a[k] + a[i] > a[j]): res += 1
print(res)

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

Solution (Python):


import sys
sys.setrecursionlimit(300000)


def solve(N: int, L: "List[int]"):
    ret = 0
    for i in range(N):
        for j in range(i + 1, N):
            for k in range(j + 1, N):
                s = L[i] + L[j] + L[k]
                m = max(L[i], L[j], L[k])
                if L[i] != L[j] and L[j] != L[k] and L[k] != L[i] and m < s - m:
                    ret += 1
                    
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    L = [int(next(tokens)) for _ in range(N)]  
    solve(N, L)

if __name__ == '__main__':
    main()

Solution (Python):
n=int(input())
ar=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(ar[i]==ar[j]):continue
            if(ar[j]==ar[k]):continue
            if(ar[i]+ar[j]>ar[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):
    for j in range(i+1,n):
        if l[i] != l[j]:
            for k in range(j+1,n):
                if l[i] != l[k] and 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()))

K=0
for i in range(N):
    for j in range(i+1,N):
        for k in range(j+1,N):
            a,b,c=sorted([L[i],L[j],L[k]])
            if a!=b and b!=c and a+b>c:
                K+=1
print(K)

Solution (Python):
import sys
from itertools import combinations

n, *lll = map(int, sys.stdin.buffer.read().split())
ans = 0
for i, j, k in combinations(lll, 3):
    if i == j or j == k or k == i:
        continue
    l = max(i, j, k)
    if (i + j + k - l) > l:
        ans += 1
print(ans)

Solution (Python):

import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

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

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

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

Solution (Python):

import os
import sys
from io import BytesIO, IOBase

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")


from math import gcd, ceil

def pre(s):
    n = len(s)
    pi = [0] * n
    for i in range(1, n):
        j = pi[i - 1]
        while j and s[i] != s[j]:
            j = pi[j - 1]
        if s[i] == s[j]:
            j += 1
        pi[i] = j
    return pi


def prod(a):
    ans = 1
    for each in a:
        ans = (ans * each)
    return ans

def lcm(a, b): return a * b // gcd(a, b)


def binary(x, length=16):
    y = bin(x)[2:]
    return y if len(y) >= length else "0" * (length - len(y)) + y


for _ in range(int(input()) if not True else 1):
    n = int(input())
    
    
    
    a = sorted(list(map(int, input().split())))
    
    from itertools import combinations
    ans = 0
    for x,y,z in combinations(a, 3):
        if x == y or y == z:continue
        if x+y > z and x+z > y and y+z > x:
            ans += 1
    print(ans)

Solution (Python):

from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    l = LI()
    l.sort()
    ans = 0
    for i in range(n):
        for j in range(i):
            for k in range(j):
                if l[j]+l[k] > l[i] and l[i] != l[j] and l[j] != l[k] and l[i] != l[k]:
                    ans += 1
    print(ans)
    return


if __name__ == "__main__":
    solve()

Solution (Python):
import sys

sys.setrecursionlimit(500005)
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()

n = ni()
L = na()
L.sort()

ct = 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[j] > L[k]:
                ct += 1
print(ct)

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

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
a = sorted(a)
res = 0
for i in range(n):
    for j in range(i + 1, n):
        for k in range(j + 1, n):
            if len(list(set([a[i], a[j], a[k]]))) < 3:
                continue
            if a[i] + a[j] <= a[k]:
                continue
            res += 1
print(res)