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:
def A():
    s = input()
    if s == 'SSS': print(3)
    elif s=='RSS' or s=='SSR': print(2)
    elif s=='RRR': print(0)
    else: print(1)

def B():
    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):
                s = a[i] + a[j] + a[k]
                if s > 2 * max(a[i], a[j], a[k]): cnt += 1
    print(cnt)

def C():
    x, k, d = map(int, input().split())
    if abs(x) > k * d:
        print(abs(x) - k*d)
    else:
        tm = abs(x) // d
        x = abs(x) % d
        k -= tm
        if k % 2 == 0:
            print(x)
        else:
            print(d-x)
B()

Submission status: Wrong Answer

Solution code:
l=list(map(int, input().split()))
#l=list(l)
le=len(l)
count=0
for i in range(le-2):
    for j in range(i+1,le-1):
        #print(i)
        if l[j]!=l[i]:
            #print(i)
            for k in range(j+1,le):
                a,b,c=[l[i],l[j],l[k]]
                if a==c or b==c:
                    break
                if a+b>c and b+c>a and c+a>b:
                    count+=1
                    #print(i+1,j+1,k+1)
print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())
count = 0
L = list(map(int, input().split()))
for i,li in enumerate(L[:-2]):
  for j,lj in enumerate(L[i+1:-1]):
    for k,lk in enumerate(L[i+j+1:]):
      if (li != lj) and (lj != lk):
#        la,lb,lc = sorted([li,lj,lk])
        if li + lj > lk and lj + lk > li and lk + li > lj:
#          print(i+1,i+j+1,i+j+k+1,li,lj,lk)
          count += 1
print(count)

Submission status: Wrong Answer

Solution code:
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 h in range(j+1,n):
            if l[i] != l[j] != l[h]:
                mnum = max(l[i],l[j],l[h])
                if mnum < l[i] + l[j] + l[h] - mnum:
                    ans+=1
print(ans)

Submission status: Wrong Answer

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

print(l)
ans = 0

for a in range(n):
    for b in range(a+1,n):
        for c in range(b+1,n):
            if  l[a] != l[b] != l[c] and l[a]+l[b] > l[c]:
                ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
lArr = list(map(int, input().split(" ")))
lArr.sort()

ans = 0

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

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
L = list(map(int, input().split()))
L.sort(reverse=True)
count = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(i+2,n):
            if L[i] != L[j] and L[i] != L[k] and L[j] != L[k] and L[i] < L[j] + L[k]:
                count += 1

print(count)

Submission status: Wrong Answer

Solution code:
from itertools import combinations

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

ans = 0
for i, j, k in combinations(range(N),3):
  ell = sorted([L[i], L[j], L[k]])
  if ell[2] < ell[0] + ell[1] and ell[0] != ell[1]:
    ans += 1
print(ans)

Submission status: Wrong Answer

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

          print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
 
lst = list(input().split())
 
ans = 1
for i in range(0, n):
  	for j in range(i + 1, n):
      		for k in range(j + 1, n):
          			if lst[i] + lst[j] > lst[k]:
              				ans += 1
            
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
 
lst = list(input().split())
 
ans = 1
for i in range(0, n):
  	for j in range(i + 1, n):
      		for k in range(j + 1, n):
          			if lst[i] + lst[j] > lst[k] or lst[i] + lst[k] > lst[j] or lst[k] + lst[j] > lst[i]:
              				ans += 1
            
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
l = list(map(int,input().split()))
ans = 0
if N < 3 :
    print(ans)
for m in range(N-2) :
    for n in range(m+1,N-1) :
        for k in range(n+1,N) :
            if len(set([l[m],l[n],l[k]])) == 3 and 2 * max(l[m],l[n],l[k]) < sum([l[m],l[n],l[k]]) :
                ans += 1
            else :
                continue
print(ans)

Submission status: Wrong Answer

Solution code:
import itertools
import sys
N = int(input())
if N < 3:
  print(0)
  sys.exit()

#辺を取得してint型に変換
hen_list = input().split()
for i in range(len(hen_list)):
    hen_list[i] = int(hen_list[i])
    
count = 0
for tri in itertools.combinations(hen_list, 3):
    if tri[0] != tri[1] and tri[0] != tri[2] and tri[1] != tri[2]:
        count += 1
print(count)

Submission status: Wrong Answer

Solution code:
n=int(input())
s=set(map(int,input().split()))
L=[]
for e in s:
	L.append(e)
l=len(L)
L.sort()
count=0
for i in range(0,l):
	for j in range(0,i):
		for k in range(0,j):
			if(L[i]<L[j]+L[k]):
				count+=1
print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
sticks=int(input())
lengths=input()
list=lengths.split()
i=len(list)-1
empty=[]
for items in list:
    while i>=0:
        if items<list[i]:
            empty.append((items,list[i]))
        i=i-1
    i=len(list)-1
count=0

for item in empty:
    while i>=0:
        if item[-1]<list[i]:
            count=count+1
        i=i-1
    i=len(list)-1
print(count)

Submission status: Wrong Answer

Solution code:
from itertools import combinations

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

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

print(count)

Submission status: Wrong Answer

Solution code:
sticks=int(input())
lengths=input()
list=lengths.split()
i=len(list)-1
j=i-1
k=i-2
empty=[]
if sticks<3:
    print(0)
else:
    while i>=2:
        while j>=1:
            while k>=0:
                if list[i]!=list[j]and list[j]!=list[k]and list[j]!=list[k]:
                    empty.append((list[i],list[j],list[k]))
                k=k-1
            j=j-1
            k=j-1
        i=i-1
        j-i-1
        k=k-1
    print(len(empty))

Submission status: Wrong Answer

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

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

count = 0
for i in range(N):
    for j in range(i, N):
        for k in range(j, N):
            if ls[i] != ls[j] != ls[k] and is_triangle(ls[i], ls[j], ls[k]):
                # print(i+1, j+1, k+1)
                count += 1

print(count)

Submission status: Wrong Answer

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

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

print(a, l)

Submission status: Wrong Answer

Solution code:
sticks=int(input())
length=input()
list=length.split()
i=len(list)-1
empty=[]
j=i-1
k=i-2
if sticks<3:
    print(0)
else:
    while i>=2:
        while j>=1:
            while k>=0:
                if list[i]!=list[j]and list[i]!=list[k]and list[j]!=list[k]:
                    empty.append((list[i],list[j],list[k]))
                k=k-1
            j=j-1
            k=j-1
        i=i-1
        j=i-1
        k=j-1
    print(len(empty))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

kosu = 0

if N <= 2:
    print(kosu)

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

print(kosu)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import itertools

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

for i in Combi:
    a = int(i[0])
    b = int(i[1])
    c = int(i[2])
    if((a+b)> c and a!=b != c and  a<b <c ):
        count+=1
        print(i)

print(count)

Submission status: Wrong Answer

Solution code:
import itertools

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

Combination = list(itertools.permutations(L, 3))
count = 0
Combination.sort()
for i in Combination:
    # a+b>c かつ b+c>a かつ c+a>b
    a = int(i[0])
    b = int(i[1])
    c = int(i[2])
    if((a+b)> c and a!=b != c and  a<b <c ):
        count+=1
        print(i)

print(count)

Submission status: Wrong Answer

Solution code:
import itertools

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

Combination = list(itertools.permutations(L, 3))
count = 0
for i in Combination:
    # a+b>c かつ b+c>a かつ c+a>b
    a = int(i[0])
    b = int(i[1])
    c = int(i[2])
    if((a+b)> c and (b+c) >a and (c+a) >b and a!=b and b!= c and a!= c and a<b and b<c and a<c):
        count+=1
        print(i)

print(count)

Submission status: Wrong Answer

Solution code:
import itertools

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

Combination = list(itertools.permutations(L, 3))
count = 0
for i in Combination:
    # a+b>c かつ b+c>a かつ c+a>b
    a = int(i[0])
    b = int(i[1])
    c = int(i[2])
    if((a+b)> c and (b+c) >a and (c+a) >b and a!=b and b!= c and a!= c and a<b and b<c):
        count+=1
        print(i)

print(count)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

ans = 0
for i in range(N):
    for j in range(i):
        for k in range(j):
            if L[i] != L[j] != 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
print(ans)

Submission status: Wrong Answer

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

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

print(c)

Submission status: Wrong Answer

Solution code:
n = int(input())
l = list(map(int, input().split()))
ans = 0
l = sorted(l)
for i in range(n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            if l[i] != l[j]:
                if 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(" ")))
ans = 0
first_num = []
second_num = []


for i in range(len(l) - 2):
    if l[i] in first_num:
        continue
    first_num.append(l[i])
    for j in range(i+1, len(l) - 1):
        if l[j] in second_num:
            continue
        second_num.append(l[j])
        for k in range(j+1, len(l)):
            print([l[i], l[j], l[k]])
            arr = sorted([l[i], l[j], l[k]])
            if arr[0] + arr[1] > arr[2]:
                ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
from pdb import main


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

    if len(ls) < 3:
        return 0

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

                if li + lj > lk:
                    ans += 1

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n=int(input())
l=list(map(int,input().split()))
ls=sorted(l)
m=0
for i in ls:
    for j in ls:
        for k in ls:
            if i==j or j==k or i==k:pass
            elif i<j<k:
                if i+j>k:
                    m+=1
                    print(i,j,k)
print(m)

Submission status: Wrong Answer

Solution code:
n=int(input())
l=list(map(int,input().split()))
ls=sorted(l)
m=0
for i in ls:
    for j in ls:
        for k in ls:
            if i==j or j==k or i==k:pass
            elif i<j<k:
                if i+j>=k:
                    m+=1
print(m)

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# 175 B
N = int(input())
L = list(map(int, input().split()))
L.sort()
ans = 0
if N <3:
    print(0)

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

Submission status: Wrong Answer

Solution code:
# 175 B
N = int(input())
L = list(map(int, input().split()))
ans = 0
if N <3:
    print(0)

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

Submission status: Wrong Answer

Solution code:
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):
            L2=[L[i],L[j],L[k]]
            L2.sort()
            print(L2)
            if L2[0]+L2[1]>L2[2] and L2[0] != L2[1] and L2[1] != L2[2] and L2[2] != L2[0]:
                count+=1
                
print(count)

Submission status: Wrong Answer

Solution code:
N=int(input())
L=list(map(int,input().split()))
count=0
for a in range(N):
    for b in range(N):
        for c in range(N):
            if L[a]<(L[b]+L[c]) and L[b]<(L[a]+L[c]) and L[c]<(L[b]+L[a]) and a!=b and b!=c and c!=a and L[a]!=L[b] and L[a]!=L[c] and L[c]!=L[b]:
                count=count+1
            else:
                continue
print(count)

Submission status: Wrong Answer

Solution code:
N=int(input())
L=list(map(int,input().split()))
count=0
for a in range(N):
    for b in range(N):
        for c in range(N):
            if L[a]<(L[b]+L[c]) and L[b]<(L[a]+L[c]) and L[c]<(L[b]+L[a]) and a!=b and b!=c and c!=a:
                count=count+1
            else:
                continue
print(count)

Submission status: Wrong Answer

Solution code:
n=int(input())
l=list(sorted(list(map(int,input().split())),reverse=True))
count=0
if n<3:
  print(count)
else:
  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]:
          count=count
        elif l[i]<l[j]+l[k]:
          count+=1
print(count)

Submission status: Wrong Answer

Solution code:
n=int(input())
l=sorted(list(map(int,input().split())),reverse=True)
count=0
if n<3:
  print(count)
else:
  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]:
          count=count
        elif l[i]<l[j]+l[k]:
          count+=1
print(count)

Submission status: Wrong Answer

Solution code:
n=int(input())
l=sorted(list(map(int,input().split())),reverse=True)
count=0
if n<3:
  print(count)
else:
  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
        elif l[i]<l[j]+l[k]:
          count+=1
print(count)

Submission status: Wrong Answer

Solution code:
n=int(input())
l=sorted(list(map(int,input().split())),reverse=True)
count=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] or l[j]==l[k] or l[k]==l[i]:
          continue
        elif l[i]<l[j]+l[k]:
          count+=1
print(count)

Submission status: Wrong Answer

Solution code:
n=int(input())
l=sorted(list(map(int,input().split())),reverse=True)
count=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] or l[j]==l[k] or l[k]==l[i]:
          continue
        elif l[i]<l[j]+l[k]:
          count+=1
print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
l=sorted(list(map(int,input().split())),reverse=True)
count=0
if n<3:
  print("0")
else:
  for i in range(n-2):
    for j in range(n-2-i):
      for k in range(n-2-i-j):
        if l[i]<l[1+j]+l[2+k] and l[i]!=l[1+j]!=l[2+k]:
          count+=1
print(count)

Submission status: Wrong Answer

Solution code:
n=int(input())
l=sorted(list(map(int,input().split())),reverse=True)
count=0
if n<3:
  print("0")
else:
  for i in range(n-2):
    for j in range(n-2-i):
      for k in range(n-2-i-j):
        if l[i]<l[j]+l[k] and l[i]!=l[j]!=l[k]:
          count+=1
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+1, N):
    for k in range(j+1, N):
      if i != j != 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)

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):
    for k in range(j, N):
      if i != j != 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)

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):
    for k in range(j, N):
      if L[i] != 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)

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

Submission status: Wrong Answer

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

ans = 0

l.sort()

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)

Submission status: Wrong Answer

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

ans = 0
x = 0

l.sort()


for i in l :
    z = x + 1
    for j in l[z:]:
        y =z + 1
        for k in l[y:]:
            if i != j != k and  i < j < k:
                    ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
k = int(input())

an = input().split()

for i in range(len(an)):
    an[i] = int(an[i])

ln = sorted(an)

print(ln)

ans = 0

for i in range(k):
    for j in range(i,k):
        for l in range(j,k):
            a1 = int(ln[i])
            a2 = int(ln[j])
            a3 = int(ln[l])
            if a1!=a2 and a2 != a3:
                m = a1 + a2
                if a3 < m:
                    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 <= 2:print(0);exit()
for i in range(n):
  for j in range(i+1,n):
    for k in range(j+1,n):
      if l[i]+l[j] > l[k]:
        ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
num = input().split()
list = input().split()


import itertools
num = 0

for i in itertools.combinations(list, 3):
  #print(i)
  if int(i[0]) + int(i[1]) > int(i[2])  and int(i[0]) + int(i[2]) >int(i[1]) and int(i[1]) + int(i[2]) > int(i[0]) and int(i[0]) != int(i[1]) != int(i[2]):
    num += 1
print(num)

Submission status: Wrong Answer

Solution code:
a=int(input())
b=list(map(int,input().split()))
c=0
for i in range(a):
  for k in range(a):
    for h in range(a):
      if b[i]+b[k]>=b[h]:
        c=c+1
print(c)

Submission status: Wrong Answer

Solution code:
N=int(input())
L=input()
ans=int(0)
M=L.replace(" ",",")
S=list(L.split())
s=[int(t) for t in S]
s.sort()
    
for i in range (1,N):
    for j in range (i+1,N):
        for k in range (j+1,N):
            if s[i]<s[j]+s[k]:
                ans +=1
            else :
                pass
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
ls = sorted(list(map(int, input().split())))
print(ls)
cnt = 0
for i in range(len(ls) - 2):
    a = ls[i]
    for j in range(i+1, len(ls) - 1):
        b = ls[j]
        for k in range(j+1, len(ls)):
            c = ls[k]
            if a==b or a==c or b==c:
                continue
            if a+b > c and b+c > a and c+a > b:
                cnt += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
n = int(input())
ls = sorted(list(map(int, input().split())))
print(ls)
cnt = 0
for i in range(len(ls) - 2):
    a = ls[i]
    for j in range(i+1, len(ls) - 1):
        b = ls[j]
        for k in range(j+1, len(ls)):
            c = ls[k]
            if a==b or a==c or b==c:
                continue
            if a+b > c and b+c > a and c+a > b:
                print(i+1, j+1, k+1)
                cnt += 1
print(cnt)

Submission status: Wrong Answer

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

c = 0

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


print(c)

Submission status: Wrong Answer

Solution code:
def findnumberofTriangles(arr,n):
	n = len(arr) 
	arr.sort() 
	count = 0
	for i in range(0, n-2): 
		k = i + 2
		for j in range(i + 1, n): 
			while (k < n and (arr[i]!=arr[j]!=arr[k]) and 
                   (arr[i] + arr[j] > arr[k])): 
				k += 1
			if(k>j): 
				count += k - j - 1

	return count

N = int(input())
A = list(map(int,input().split()))
print(findnumberofTriangles(A,N))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))
cnt = 0
A.sort()
for i in range(0,N):
  for j in range(i+1,N):
    for k in range(j+1,N):
      if (A[i]+A[j])>A[k] and (A[i]!=A[k]!=A[j]):
        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(0,N-2):
  for j in range(i+1,N-1):
    for k in range(j+1,N):
      if (i+j)>k and (j+k)>i and (i+k)>j and i!=k and j!=k and i!=j:
        cnt+=1
        
print(cnt)

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    L = list(map(int, input().split()))
    L = sorted(L)
    print(L)
    count = 0

    for i in range(N-2):
        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]:
                    count += 1

    print(count)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    L = list(map(int, input().split()))
    L = sorted(L)
    print(L)
    count = 0

    for i in range(N-2):
        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]:
                    print(i,j,k)
                    count += 1
                    print(count)

    print(count)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())
L = list(map(int, input().split()))
 
ans = 0
if(N >= 3):
  t = []
  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[i] != L[k]) & (L[j] != L[k]) & (abs(L[j]-L[k]) < L[i]) & (L[i] < L[j]+L[k])): t.append((L[i], L[j], L[k]))
  ans = len(set(t))

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
L = list(map(int, input().split()))
 
ans = 0
if(N >= 3):
  t = []
  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[j] != L[k]) & (abs(L[j]-L[k]) < L[i]) & (L[i] < L[j]+L[k])): t.append((L[i], L[j], L[k]))
  ans = len(set(t))
 
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
L = list(map(int, input().split()))
 
ans = 0
if(N >= 3):
  t = []
  for i in range(N):
    for j in range(i+1, N):
      for k in range(j+1, N):
        if((abs(L[j]-L[k]) < L[i]) & (L[i] < L[j]+L[k])): t.append((L[i], L[j], L[k]))
  ans = len(set(t))

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
L = list(map(int, input().split()))
 
ans = 0
t = []
if(N >= 3):
  for i in range(N):
    for j in range(i+1, N):
      for k in range(j+1, N):
        if((abs(L[j]-L[k]) < L[i]) & (L[i] < L[j]+L[k])): t.append((L[i], L[j], L[k]))

print(len(set(t)))

Submission status: Wrong Answer

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

for i in range(N):
  for j in range(i+1,N):
    for k in range(j+1,N):
      if i!=j and j!=k and k!=i:
        if i + j + k > 2 * max(i,j,k):
          c +=1

print(c)

Submission status: Wrong Answer

Solution code:
import itertools
 
N=int(input())
L=list(map(int,input().split()))
 
if len(L)<3:
    Lis=[]
    print(0)
else:
    Lis=list(itertools.combinations(L,3))
 
numb=len(Lis)
count=0
 
for i in range(numb):
    if len(L)<3:
        break
 
    if Lis[i][0]==Lis[i][1] or Lis[i][0]==Lis[i][2] or Lis[i][1]==Lis[i][2]:
        pass
    else:
        bpc=Lis[i][1]+Lis[i][2]
        bmc=abs(Lis[i][1]-Lis[i][2])
        if bmc<Lis[i][0] and Lis[i][0]<bpc:
            count+=1
 
print(count)

Submission status: Wrong Answer

Solution code:
import itertools
 
N=int(input())
L=list(map(int,input().split()))
 
if len(L)<3:
    Lis=[]
    print(0)
else:
    Lis=list(itertools.combinations(L,3))
 
numb=len(Lis)
count=0
 
for i in range(numb):
    if len(L)<3:
        break
 
    if Lis[i][0]==Lis[i][1] or Lis[i][0]==Lis[i][2] or Lis[i][1]==Lis[i][2]:
        pass
    else:
        bpc=Lis[i][1]+Lis[i][2]
        bmc=abs(Lis[i][1]-Lis[i][2])
        if bmc<Lis[i][0] and Lis[i][0]<bpc:
            count+=1
 
print(count)