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.



Sample input:
5
4 4 9 7 5


Sample output:
5

Submission status: Wrong Answer

Solution code:
n=int(input())
A=list(map(int,input().split()))
ans=0
for i in range(n-2):
  for j in range(i,n-1):
    for k in range(n):
      if A[i]+A[j]+A[k]>2*max(A[i],A[j],A[k]):
        if max(A[i],A[j],A[k])!=min(A[i],A[j],A[k]):
          ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
arr=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(arr[i]+arr[j]>arr[k] and arr[i]+arr[k]>arr[j] and arr[k]+arr[j]>arr[i]):
        count+=1
print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())
LL = list(map(int,input().split()))
cnt = 0
L = list(set(LL))
for i in range(len(L)-2):
    for j in range(1, len(L)-1-i):
        for k in range(1, len(L)-i-j):
#             print(L)
#             print(L[i],L[i+j],L[i+j+k])
            if L[i] + L[i+j] > L[i+j+k] and L[i+j] - L[i] < L[i+j+k]:
#                 print("------------")
#                 print(L[i],L[i+j],L[i+j+k])
#                 print(LL.count(L[i]),LL.count(L[i+j]),LL.count(L[i+j+k]))
                cnt += LL.count(L[i])*LL.count(L[i+j])*LL.count(L[i+j+k])
                
print(cnt)

Submission status: Wrong Answer

Solution code:
import bisect
import collections
n=int(input())
l=sorted(list(map(int,input().split())))
d=collections.Counter(l)
ans=0
for i in range(1,51):
  for j in range(i+1,52):
    c=min(i+j,101)
    for k in range(j+1,c):
      ans+=d[i]*d[j]*d[k]
print(ans)

Submission status: Wrong Answer

Solution code:
X = int(input())
A = list(map(int, input().split()))


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


print(count)

Submission status: Wrong Answer

Solution code:
n=int(input()) 
l = list(map(int,input().split())) 
if n<=2:
  print(0)
  exit()
  
cnt = 0
for i in range(n):
  for j in range(n):
    for k in range(n):
      if (l[i]-l[j])*(l[j]-l[k])*(l[k]-l[i])==0:
        continue
      if l[i]<l[j]+l[k] and l[j]<l[i]+l[k] and l[k]<l[i]+l[j]:
        cnt+= 1
print(cnt)

Submission status: Wrong Answer

Solution code:
n=int(input())
l=list(map(int,input().split()))
l.sort(reverse=True)
d=dict()
for i in l:
  if i in d:
    d[i]+=1
  else:
    d[i]=1
#print(d)
li=list(d.keys())  
ans=0
for i in range(len(li)-1,0,-1):
  a,b=0,i-1
  while(a<b):
    if li[a]+li[b]>li[i]:
      #print(li[a],li[b],li[i])
      ans+=d[li[a]]*d[li[b]]*d[li[i]]
      ans+=b-1
      b-=1
    else:
      a+=1
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
LL = list(map(int,input().split()))
cnt = 0
L = list(set(LL))
for i in range(len(L)-2):
    for j in range(1, len(L)-1-i):
        for k in range(1, len(L)-i-j):
#             print(L)
#             print(L[i],L[i+j],L[i+j+k])
            if L[i] + L[i+j] > L[i+j+k]:
#                 print("------------")
#                 print(L[i],L[i+j],L[i+j+k])
#                 print(LL.count(L[i]),LL.count(L[i+j]),LL.count(L[i+j+k]))
                cnt += LL.count(L[i])*LL.count(L[i+j])*LL.count(L[i+j+k])
                
print(cnt)

Submission status: Wrong Answer

Solution code:
import itertools

n = int(input())
nums = list(map(int,input().split()))
count= 0
for i, j, k in itertools.combinations(nums, 3):
    I = i**2
    J = j **2
    K = k **2
    if I == J + K:
        count += 1
    elif J == I + K:
        count += 1
    elif K == I + J:
        count += 1
                    
print(count)

Submission status: Wrong Answer

Solution code:
import bisect
import collections
n=int(input())
l=sorted(list(map(int,input().split())))
d=collections.Counter(l)
ans=0
for i in range(1,50):
  for j in range(i+1,51):
    c=i+j
    for k in range(j+1,c):
      ans+=d[i]*d[j]*d[k]
print(ans)

Submission status: Wrong Answer

Solution code:
def hold(a):

    ans=0
    K={}

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

    print(ans)

a=int(input())
l=list(map(int,input().strip().split()))
print(l)
if a<3:
    print(0)

else:
    hold(l)

Submission status: Wrong Answer

Solution code:
n = int(input())
L = input().split()
L.sort()
count = 0
for i in range(n):
  for j in range(i + 1,n):
    for k in range(j + 1 ,n):

        if ((int(L[k]) < int(L[i]) + int(L[j])) & (L[k] != L[i])& (L[k] != L[j])& (L[j] != L[i])):
            count += 1
        
print(count)

Submission status: Wrong Answer

Solution code:
N=int(input())
s=list(map(int,input().split()))
s.sort()
cnt=0
for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if s[i]+s[j]>s[k] and s[i]+s[k]>s[j] and s[j]+s[k]>s[i]:
                if s[i]!=s[j] and s[i]!=s[k] and s[j]!=s[k]:
                    print(i,j,k)
                    cnt+=1
            else:
                break
print(cnt)

Submission status: Wrong Answer

Solution code:
N = int(input())
L_list = list(map(int, input().split()))
c = 0
if len(L_list) < 3:
    print(c)
else:
    for i in range(N):
        for j in range(i,N):
            for k in range(j,N):
                if L_list[i] == L_list[j] or L_list[i] == L_list[k] or L_list[j] == L_list[k]:
                    continue
                else:
                    m1 = max(L_list[i], L_list[j], L_list[k])
                    m3 = min(L_list[i], L_list[j], L_list[k])
                    if m1 != m3 != L_list[i]:
                        m2 = L_list[i]
                    elif m1 != m3 != L_list[j]:
                        m2 = L_list[j]
                    else:
                        m2 = l_list[k]
                    if m1 ** 2 >= (m2 ** 2)+(m3 ** 2):
                        c += 1
                       
    print(c)

Submission status: Wrong Answer

Solution code:
x=eval(input())
num=list(map(int,input().split()))
res=0
for i in num:
    for j in num:
        for k in num[::-1]:
            if i==j or i==k or j==k:
                continue
            else:
                if j-k<i and j+k>i:
                    res+=1
print(res/6)

Submission status: Wrong Answer

Solution code:
n=int(input()) 
l = list(map(int,input().split())) 
if n<=2:
  print(0)
  exit()
  
cnt = 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[i]+l[k] and l[k]<l[i]+l[j]:
        cnt+= 1
print(cnt)

Submission status: Wrong Answer

Solution code:
N = int(input())
L = list(map(int,input().split()))
ans = 0



for i in L:
    for j in L:
        for k in L:
            if i != j and i != k and j != k:
                if i + j > k and i + k > j and j + k > i:
                    if i > j > k:
                        ans += 1
                        print(i,j,k)
                    
print(ans)

Submission status: Wrong Answer

Solution code:
import collections

def main():
    n = int(input())
    l = list(map(int, input().split()))
    
    if n<3:
        print(0)
        return
    
    leng = n
    ans = 0
    for i in range(leng-2):
        a = l[i]
        for j in range(i+1, leng-1):
            b = l[j]
            if a==b:
                continue
            
            for j in range(j+1, leng):
                c = l[j]
                if c==a or c==b:
                    continue
                print(a,b,c)
                if a<b+c:
                    if b<c+a:
                        if c<a+b:
                            ans += 1
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

ans = 0
for i in L:
    for j in L:
        for k in L:
            if i != j and j != k and i != k and i+j > k and j+k > i and k+i > j:
                ans += 1
                print(i,j,k)

print(int(ans/6))

Submission status: Wrong Answer

Solution code:
import itertools

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

# lis = list(set(lis))
ans=0
lis = sorted(lis)
for pair in itertools.combinations(lis, 3):
    if pair[0]**2 + pair[1]**2 == pair[2]**2:
        ans+=1

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
L = list(map(int, input().split()))
a = 0
if N > 2:
    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[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]:
                    a = a + 1
print(a)

Submission status: Wrong Answer

Solution code:
import itertools

n = int(input())

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

li = list(itertools.combinations(li, 3))

# print(li)
count = 0

for i in li:
    print(i)
    amari = sum(i) - max(i)
    if amari > max(i):
        if len(set(i)) == 3:
            count += 1

print(count)

Submission status: Wrong Answer

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

L.sort()
# print(input_L.sort())
length = len(L)
count = 0

# print(L)
if N <= 2:
    print("0")

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

print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
l = [0 for x in range(n)]
l = list(map(int,input().split()))
l.sort()
cnt = 0
a = 0
b = 0
c = 0
if n < 3:
    print(0)
else:
    for i in range(n-2):
        a = l[i]
        for j in range(i+1,n-1):
            b = l[j]
            for k in range(j+1,n):
                c = l[k]
                if a+b > c and a != b and b != c:
                    cnt += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
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] or a[j] == a[k] or a[i] == a[k]:
                continue
            if a[i] + a[j] >= a[k] or a[i] + a[k] >= a[j] or a[k] + a[j] >= a[i]:
                continue
            cnt += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
N = int(input())
h = list(map(int,input().split()))

l = list(set(h))
a = []
for i in range(len(l)):
    a.append(h.count(l[i]))
ans = 0
for i in range(len(l)):
    for j in range(i+1, len(l)):
        for k in range(j +1, len(l)):
            if l[i] + l[j] > l[k]:
                ans += a[i] * a[j] * a[k]
print(ans)

Submission status: Wrong Answer

Solution code:
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(cnt/6)

Submission status: Wrong Answer

Solution code:
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])) :
            print(a, b, c)
            cnt += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
import itertools

n = int(input())
dt = input()
l = dt.split()
print(l)
count = 0
for team in itertools.combinations(l,3):
    team1 = list(team)
    for i in range(3):
        team1[i] = int(team1[i])
        
    if team1[0] != team1[1] and team1[1] != team1[2] and team1[0] != team1[2]:
        if team1[0] + team1[1] > team1[2] and team1[0] + team1[2] > team1[1] and team1[1] + team1[2] > team1[0]:
            count += 1

print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = set(map(int, input().split()))
A = list(A)
a_len = len(A)
answer = []
for i in range(0, a_len-2):
  for j in range(i+1, a_len-1):
    for k in range(j+1, a_len):
      answer.append([A[i], A[j], A[k]])

answer_len = len(answer)
print(f"{answer_len}")

Submission status: Wrong Answer

Solution code:
N = int(input())
L_list = list(map(int, input().split()))
c = 0
if len(L_list) < 3:
    print(c)
else:
    for i in range(N):
        for j in range(i,N):
            for k in range(j,N):
                if L_list[i] == L_list[j] or L_list[i] == L_list[k] or L_list[j] == L_list[k]:
                    continue
                else:
                    m1 = max(L_list[i], L_list[j], L_list[k])
                    m3 = min(L_list[i], L_list[j], L_list[k])
                    if m1 != m3 != L_list[i]:
                        m2 = L_list[i]
                    elif m1 != m3 != L_list[j]:
                        m2 = L_list[j]
                    else:
                        m2 = l_list[k]
                    if m1 ** 2 >= (m2 ** 2)+(m3 ** 2):
                        c += 1
                        print(i,j,k)
    print(c)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
L = list(map(int, input().split()))
R = list(set(L))
L.sort()
R.sort()
M = len(R)
ans = 0
if M <= 2:
    print(ans)
else:
    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)

Submission status: Wrong Answer

Solution code:

N = input()
L_list = [int(l) for l in input().split()]
L_list = list(set(sorted(L_list)))[::-1]
count = 0
for i in range(len(L_list)):
    for j in range(i, len(L_list)):
        for k in range(i, len(L_list)):
            if L_list[i] + L_list[j] > L_list[k]:
                if L_list[i] != +L_list[j] and L_list[k] != L_list[j] and L_list[k] != L_list[i]:
                    count += 1
print(count)

Submission status: Wrong Answer

Solution code:
n=int(input())

l= list(map(int,input().split()))
l.sort()
con=0

if n<=2:
    print('0')
else:
    for i in range(n-2):
        for e in range(1,n-1):
            for o in range(2,n):
                if o<=e or o<=i or e<=i or l[i]==l[e] or l[e]==l[o] or l[i]==l[o]:
                    con+=0
 
                elif l[i]+l[e]>l[o] and l[e]+l[o]>l[i] and l[o]+l[i]>l[e]:
                    con+=1
                                         
print(con)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
from pdb import set_trace

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

if N<3:
    print(0)
    exit()
LN = [i for i in range(N)]
cnt = []
for xa, a in enumerate(L[:-2]):
    for xb, b in enumerate(L[xa+1:-1]):
        for xc, c in enumerate(L[xa+2:]):
            if a+b>c and b+c>a and c+a>b and a!=b and b!=c and c!=a:
                li = sorted([xa, xb+xa+1, xc+xa+2])
                flag = True
                for _cnt in cnt:
                    if _cnt==li:
                        flag = False
                if flag:
                    cnt.append(li)
                    print(li, [a, b, c])
print(len(cnt))

Submission status: Wrong Answer

Solution code:

def resolve():
    n = int(input())
    l = list(map(int,input().split()))
    out = 0
    if n < 3:
        print(0)
    else:
        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[i] != l[k]:
                        if l[i] + l[j] > l[k] and l[i] + l[k] > l[j] and l[k] + l[j] > l[i]:
                            out += 1
    print(out)
resolve()

Submission status: Wrong Answer

Solution code:
s=int(input())
a=list(map(int, input().split()))
a=list(set(a))
s=len(a)
count=0
a.sort()
#print(a)
for i in range(s):
  for j in range(i+1,s):
    for k in range(j+1,s):
      #print(i,j,k)
      ij = a[i]+a[j]
      jk = a[j]+a[k]
      ki = a[k]+a[i]
      #print(ij,jk,ki)
      #print(a[i],a[j],a[k])
      if (ij > a[k]) and (jk > a[i])and (ki > a[j]):
        count +=1
print(count)

Submission status: Wrong Answer

Solution code:
import itertools

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

count=0

for x in itertools.combinations(a, 3):
  if(x[0]+x[1]>x[2] and x[0]+x[2]>x[1] and x[1]+x[2]>x[0]):
    count+=1
  else:
    pass
    
print(count)

Submission status: Wrong Answer

Solution code:
n = input()
Ls = list(map(int, input().split()))

count = 0
l_set = set()
for i1 in range(len(Ls)):
    for i2 in range(i1+1,len(Ls)):
        for i3 in range(i2+1, len(Ls)):
            l1 = Ls[i1]
            l2 = Ls[i2]
            l3 = Ls[i3]
            max_l = max(l1, l2 ,l3)
            if max_l < l1+l2+l3 - max_l:
                if (l1, l2, l3) not in l_set:
                    count += 1
                    l_set.add((l1, l2, l3))
print(count)

Submission status: Wrong Answer

Solution code:
N=int(input())
L=list(map(int,input().split()))
L.sort()
print(L)
c=0
for s in range(N-2):
	for t in range(s+1,N-1):
		two=L[s]+L[t]
		if L[s] != L[t]:
			for u in range(t+1,N):
				if L[u] == L[t]:
					c+=0
				elif two > L[u]:
					c+=1
					#print(s,t,u)
				else:
					break
print(c)

Submission status: Wrong Answer

Solution code:
import bisect

N = int(input())
L = list(map(int, input().split()))
L.sort(reverse=True)
if N < 3:
    print(0)

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[i] == L[k] or L[j] == L[k]:
                continue
            if L[i] < L[j] + L[k]:
                ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
import itertools
n=int(input())
length=list(map(int,input().split()))
combination=list(itertools.combinations(length,3))
new_list=[]
for com in combination:
    a=com[0]
    b=com[1]
    c=com[2]
    if a!=b and b!=c:
        if com[0]+com[1]>com[2] and com[1]+com[2]>com[0] and com[0]+com[2]>com[1]:
            new_list.append(com)
        else:
            continue
print(len(new_list))

Submission status: Wrong Answer

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

if n <= 2:
  print(0)
  exit()

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
bar = [int(n) for n in input().split(' ')]
count = 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 (bar[i] != bar[j]) and (bar[j] != bar[k]) and (bar[k] != bar[i]):
                    if (bar[i] + bar[j] > bar[k]) and (bar[i] + bar[k] > bar[j]) and (bar[k] + bar[j] > bar[i]):
                        count += 1
                        print(bar[i], bar[j], bar[k])

print(count)

Submission status: Wrong Answer

Solution code:
import bisect

N = int(input())
L = list(map(int, input().split()))
L.sort(reverse=True)
if N < 3:
    print(0)

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

print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
l=list(map(int, input().split()))
a=0
for i in range(n):
  for j in range(i+1, n):
    for k in range(j+1, n):
      tot = l[i]+l[j]+l[k]
      maxl = max(l[i],l[j],l[k])
      if l[i]!=l[j] and l[i]!=l[k] and l[j]!=l[k] and tot>2*maxl:
        a+=1
        print(i,j,k)
print(a)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
n=int(input())
if n<3:
  print(0)
else:
  cnt=0
  l_list=list(map(int,input().split()))
  sl_list=list(set(l_list))
  k=len(sl_list)
  for i in range(k):
    for j in range(i+1,k):
      for g in range(j+1,k):
        m=sl_list[i]+sl_list[j]
        if sl_list[g]<m:
          cnt+=1
  print(cnt)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

n = int(input())
li = list(map(int,input().split()))
li.sort()
print(li)
count = 0
for i in range(n-1):
    for j in range(i+1,n-1):
        if li[i] == li[j]:
            continue
        else:
            count += len([k for k in li[j+1:] if k < (li[i] + li[j]) and k != li[i] and k != li[j]])
print(count)

Submission status: Wrong Answer

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

ans = 0

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

print(ans)

Submission status: Wrong Answer

Solution code:
from bisect import bisect_left
N = int(input())
L = sorted(list(map(int, input().split())))

ans = 0
for i in range(N):  # １番短い棒
    for j in range(i + 1, N):  # 真ん中の長さの棒
        ans += bisect_left(L, L[i] + L[j]) - (j + 1)

print(ans)

Submission status: Wrong Answer

Solution code:

def istri(a, b, c):
	f = False
	if a == b or b == c or c == a:
		return f
	elif a < b+c and b < c+a and c < a+b:
		f = True
	return f

n = int(input())
l = list(map(int, input().split()))
ans = 0
# print(l)
# print(istri(l[0], l[1], l[2]))


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

Submission status: Wrong Answer

Solution code:
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] != ls[k]
            temp2 = ls[i] + ls[j] > ls[k]
            temp3 = ls[j] + ls[k] > ls[i]
            temp4 = ls[i] + ls[k] > ls[j]
            temp5 = [i, j, k] in san
            if temp1 and not temp5 and (temp2 and temp3 and temp4):
                #print(i+1, j+1, k+1)
                #print(temp2, temp3, temp4)
                san.append([i, j, k])

                ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

l.sort()

ans = 0
if n <3:
  print(0)
else:
  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]:
          ans += 1
  print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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] + lst2[2] and lst2[1] < lst2[0] + lst2[2] and lst2[2] < lst2[0] + lst2[1]):
        ans = ans + 1
print(ans)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
# 幅優先探索（行きがけ）
import collections
import sys
import copy
import re
import math
import itertools


def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())


def main():
    N = I()
    LArray = LI()
    ans = 0
    for v in itertools.combinations(LArray, 3):
        list(v).sort()
        
        if v[0] == v[1] or v[2] == v[1] or v[0] == v[2] or v[2] > N:
            continue
        elif v[0]+v[1] < v[2]:
            continue
        else:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:

def main():
    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):
                a = L[i]
                b = L[j]
                c = L[k]
                if (a + b <= c) or (b + c <= a) or (c + a <= b):
                    continue
                if (a != b and b != c and c != a):
                    ans += 1
                    print(f"({i+1}, {j+1}, {k+1})")
    
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import itertools

n = int(input())
list = list(map(int, input().split()))
list2 = itertools.combinations(list, 3)

ans = 0
for ele in list2:
    a = ele[0]
    b = ele[1]
    c = ele[2]
    if a == b or b == c or c == a:
        continue
    if abs(a-b) < c and c < a+b:
        ans += 1
print(ans//6)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L_list = list(map(int, input().split()))
c = 0
if len(L_list) < 3:
    print(c)
else:
    for i in range(N):
        for j in range(i,N):
            for k in range(j,N):
                if L_list[i] == L_list[j] or L_list[i] == L_list[k] or L_list[j] == L_list[k]:
                    continue
                else:
                    m1 = max(L_list[i], L_list[j], L_list[k])
                    m3 = min(L_list[i], L_list[j], L_list[k])
                    if m1 != m3 != L_list[i]:
                        m2 = L_list[i]
                    elif m1 != m3 != L_list[j]:
                        m2 = L_list[j]
                    else:
                        m2 = l_list[k]
                    if m1 ** 2 >= (m2 ** 2)+(m3 ** 2):
                        c += 1
                        print(i,j,k)
    print(c)

Submission status: Wrong Answer

Solution code:
import itertools
N = int(input())
L = 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 L[i] != L[j] and L[j] != L[k] and  L[i] != L[k]: 
                K = [L[i],L[j],L[k]]
                m = max(K)
                K.remove(m)
                if m < K[0] + K[1]:
                    res += 1
                    print(i+1,j+1,k+1)
print(res)

Submission status: Wrong Answer

Solution code:
N = int(input())
L = list(map(int, input().split()))
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
                #print(L[i], L[j], L[k], count)
            else:
                #print(L[i], L[j], L[k])
                break
            ans = ans + count
            #print(ans)
print(ans)

Submission status: Wrong Answer

Solution code:
from itertools import combinations

n = int(input())
lst = list(map(int, input().split()))
comb = combinations(lst, 3)
count = 0

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

Submission status: Wrong Answer

Solution code:
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]): 
        if (v[0]+v[1]>v[2]) and (v[1]+v[2]>v[0]) and (v[2]+v[0]>v[1]):
            #print(v)
            count += 1

print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
hen_list = list(map(int, input().split()))
count = 0

for x in hen_list:
  for y in hen_list:
    for z in hen_list:
      if (z > x and z > y and y > x) and z*z == x*x + y*y:
        count += 1

print(count)

Submission status: Wrong Answer

Solution code:
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]**2<a[j]**2+a[k]**2 or a[j]**2<a[i]**2+a[k]**2 or a[k]**2<a[i]**2+a[j]**2:
                    s += 1
print(s)

Submission status: Wrong Answer

Solution code:
x = int(input())
d = list(map(int, input().split()))
count = 0
if x < 3:
  print(0)
else:
  for i in range(len(d)):
    for j in range(i+1,len(d)):
      for k in range(j+1,len(d)):
        temp = []
        temp.extend([d[i],d[j],d[k]])
        temp.sort()
        if temp[0] + temp[1] > temp[2] and len(list(set(temp))) == 3:
          count += 1
print(count)