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())
print(n)
l = list(map(int,input().split()))

res = 0
for t0 in range(0,len(l)-2):
    for t1 in range(t0+1,len(l)-1):
        for t2 in range(t1+1,len(l)):

             if (l[t0] + l[t1] > l[t2] and l[t0] + l[t2] > l[t1] and l[t1] + l[t2] > l[t0] and l[t0]!=l[t1] and l[t1]!=l[t2] and l[t0]!=l[t2]):
                 res += 1        

print(res)

Submission status: Wrong Answer

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



res = 0

for t0 in range(0,len(l)-2):
    for t1 in range(t0+1,len(l)-1):
        for t2 in range(t1+1,len(l)):

             if (l[t0] + l[t1] > l[t2] and l[t0] + l[t2] > l[t1] and l[t1] + l[t2] > l[t0] and l[t0]!=l[t1] and l[t1]!=l[t2] and l[t0]!=l[t2]):
                 res += 1
                 print(l[t0],l[t1],l[t2])

print(res)

Submission status: Wrong Answer

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


print(l)
res = 0

for t0 in range(0,len(l)-2):
    for t1 in range(t0+1,len(l)-1):
        for t2 in range(t1+1,len(l)):

             if (l[t0] + l[t1] > l[t2] and l[t0] + l[t2] > l[t1] and l[t1] + l[t2] > l[t0] and l[t0]!=l[t1] and l[t1]!=l[t2] and l[t0]!=l[t2]):
                 res += 1
                 print(l[t0],l[t1],l[t2])

print(res)

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline


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

    ans = 0
    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 not ((a != b) and (b != c) and (c != a)): continue
                if not ((a + b > c) and (b + c > a) and (c + a > b)): continue
                ans += 1

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

N = input()
L = input().split(' ')

l = len(L)
L = [int(s) for s in L]
L.sort()
if len(L) < 3:
    print(0)
    exit
  
a = 0
for i in range(l - 2):
    for j in range(i + 1, l - 1):
        for k in range(j + 1, l):
            if (L[i] + L[j]) > L[k]:
                if (L[i] != L[j]) and (L[k] != L[j]) and (L[i] != L[k]):
                    a += 1
print(int(a))

Submission status: Wrong Answer

Solution code:
N = int(input())
L = map(int, input().split())
L = list(set(L))
L.sort()
ret = 0
N_ = len(L)
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] > L[k]:
          ret += 1
print(ret)

Submission status: Wrong Answer

Solution code:
N = int(input())

L = map(int, input().split())
L = list(set(L))
L.sort()
ret = 0
N_ = len(L)
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] < L[k]:
          ret += 1
print(ret)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
import collections
def getCount(c):
    count = 0
    if c > 2:
        count = (c * (c - 1) * (c - 2)) / 6
    count += (c * (c - 1)) / 2
    return count
N = input()
L = input().split(' ')
L_2 = set(L)
c = collections.Counter(L)
#c = {s:int(c[s]) for s in c}
#print(c)
l = len(L)
L_2 = tuple(set(L))
L = [int(s) for s in L]
L_2 = [int(s) for s in L_2]
if len(L_2) < 3:
    print(0)
    exit
a = (l * (l - 1) * (l - 2)) / 6
for v in c:
    if c[v] > 1:
        a -= ((l - c[v]) * getCount(c[v]))

l_2 = len(L_2)
a_2 = (l_2 * (l_2 - 1) * (l_2 - 2)) / 6      
count = 0
index = 0
for i in range(l_2):
    for j in range(i + 1, l_2):
        for k in range(j + 1, l_2):
            #print(L_2[i], L_2[j], L_2[k])
            #m = (L[k] + L[j]) % L2[i]
            #if m % L[j] == 0 or m % L[k] == 0 or m == 0:
            #    print('重複', L[i], L[j], L[k])
            #    a -= 1
            if ((L_2[i] + L_2[j]) <= L_2[k]) or ((L_2[k] + L_2[j]) <= L_2[i]) or ((L_2[i] + L_2[k]) <= L_2[j]):
                #print('条件を満たさない三角形', L_2[i], L_2[j], L_2[k])
                a -= c[str(L_2[i])]
            count += 1
print(int(a))

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
import collections
def getCount(c):
    count = 0
    if c > 2:
        count = (c * (c - 1) * (c - 2)) / 6
    count += (c * (c - 1)) / 2
    return count
N = input()
L = input().split(' ')
L_2 = set(L)
c = collections.Counter(L)
#c = {s:int(c[s]) for s in c}
#print(c)
l = len(L)
L_2 = tuple(set(L))
L = [int(s) for s in L]
L_2 = [int(s) for s in L_2]
if len(L_2) < 3:
    exit
a = (l * (l - 1) * (l - 2)) / 6
for v in c:
    if c[v] > 1:
        a -= ((l - c[v]) * getCount(c[v]))

l_2 = len(L_2)
a_2 = (l_2 * (l_2 - 1) * (l_2 - 2)) / 6      
count = 0
index = 0
for i in range(l_2):
    for j in range(i + 1, l_2):
        for k in range(j + 1, l_2):
            #print(L_2[i], L_2[j], L_2[k])
            #m = (L[k] + L[j]) % L2[i]
            #if m % L[j] == 0 or m % L[k] == 0 or m == 0:
            #    print('重複', L[i], L[j], L[k])
            #    a -= 1
            if ((L_2[i] + L_2[j]) <= L_2[k]) or ((L_2[k] + L_2[j]) <= L_2[i]) or ((L_2[i] + L_2[k]) <= L_2[j]):
                #print('条件を満たさない三角形', L_2[i], L_2[j], L_2[k])
                a -= c[str(L_2[i])]
            count += 1
print(int(a))

Submission status: Wrong Answer

Solution code:

import sys
import math
# from collections import Counter
input = sys.stdin.readline
# import numpy as np

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

def inps():
    return str(input())
    
def inlt():
    return(list(map(int,input().split())))
    
def inlst():
    return(list(map(str,input().split())))
    
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split())) 

def tri(arr):
    cnt = 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]:
                    cnt+=1
    return cnt
n = inp()
arr = inlt()
print(tri(arr))

Submission status: Wrong Answer

Solution code:
#B
N = int(input())
L = list(map(int, input().split()))
L.sort(reverse= True)
M = 0
for i in range(N):
    for j in range(i):
        for k in range(j):
            if (i != j) and (i != k) and (j != k):
                if (L[i] != L[j]) and (L[i] != L[k]) and (L[j] != L[k]):
                    if ((L[i]+L[j]) > L[k]) and ((L[j]+L[k]) > L[i]) and ((L[i]+L[k]) > L[j]) :
                        M += 1 
                        print(L[i],L[j],L[k],M)       
# 出力
print(M)

Submission status: Wrong Answer

Solution code:
# AtCoder Beginner Contest 175
# B - Making Triangle

import bisect

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

L.sort()

ans=0
print(L)
for i in range (N):
    for j in range (i+1,N):
        if L[i]==L[j]:
            pass
        else:
            ab=L[i]+L[j]
            c=bisect.bisect_left(L,ab)
            bequalc=bisect.bisect_right(L,L[j])
            ans+=c-(bequalc)

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
L=list(map(int,input().split()))
import itertools
p = list(itertools.combinations(L, 3))

cnt=0
for j in range(len(p)):
    m =p[j].index(max(p[j]))
    if len(list(set(p[j]))) ==3:
        if m==0:
            if abs(p[j][1]-p[j][2]) < p[j][m] < p[j][1]+p[j][2]:
                cnt+=1
        elif m==1:
            if abs(p[j][0]-p[j][2]) < p[j][m] < p[j][0]+p[j][2]:
                cnt+=1 
        elif m==2:
            if abs(p[j][0]-p[j][1]) < p[j][m] < p[j][0]+p[j][1]:
                cnt+=1

Submission status: Wrong Answer

Solution code:
n = int(input())
list_l = str(input())
list_l = list_l.split(" ")
list_l = [int(x) for x in list_l]
re = 0
save = []
for ia, a in enumerate(list_l):
    for ib, b in enumerate(list_l):
        if ib > ia:
            for ic,c in enumerate(list_l):
                if ic > ib:
                    if {ia,ib,ic} not in save:
                        if a + b > c and a + c > b and b + c > a:
                            re += 1
                            save.append({ia,ib,ic})
                            print(save)

print(re)

Submission status: Wrong Answer

Solution code:
n = int(input())
list_l = str(input())
list_l = list_l.split(" ")
list_l = [int(x) for x in list_l]
re = 0

for ia, a in enumerate(list_l):
    for ib, b in enumerate(list_l):
        if ib != ia:
            for ic,c in enumerate(list_l):
                if ic != ia and ic != ib:
                    if a + b <=c or a + c <= b or b + c <= a:
                        re += 1

print(re)

Submission status: Wrong Answer

Solution code:
n = int(input())
list_l = str(input())
list_l = list_l.split(" ")
list_l = [int(x) for x in list_l]
re = 0

for ia, a in enumerate(list_l):
    for ib, b in enumerate(list_l):
        if ib != ia:
            for ic,c in enumerate(list_l):
                if ic != ia and ic != ib:
                    if a + b <=c and a + c <= b and b + c <= a:
                        re += 1

print(re)

Submission status: Wrong Answer

Solution code:
n = int(input())
list_l = str(input())
list_l = list_l.split(" ")
list_l = [int(x) for x in list_l]
re = 0
for a in list_l:
    for b in list_l:
        if b != a:
            for c in list_l:
                if c != a and c != b:
                    if a + b <=c and a + c <= b and b + c <= a:
                        re += 1

print(re)

Submission status: Wrong Answer

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

count = 0

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

print(count)

Submission status: Wrong Answer

Solution code:
from itertools import combinations

N, *L = map(int, open(0).read().split())

result = 0
for a, b, c in combinations(set(L), 3):
    if a + b > c and b + c > a and c + a > b:
        result += 1
print(result)

Submission status: Wrong Answer

Solution code:
from collections import Counter
from bisect import bisect_left
import sys
input = sys.stdin.readline


def main():
    _ = int(input())
    L = list(map(int, input().split()))
    counter = Counter(L)
    L = list(set(L))
    cumsum = []
    total = 0
    for l in L:
        total += counter[l]
        cumsum.append(total)

    n = len(L)
    L.sort()
    ans = 0
    for i in range(n-2):
        for j in range(i+1, n-1):
            a, b = L[i], L[j]
            limit = a + b
            k = bisect_left(L, limit, lo=j+1)
            pattern = counter[a] * counter[b] * (cumsum[k-1] - cumsum[j])
            ans += pattern

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
import collections
def getCount(c):
    count = 0
    if c > 2:
        count = (c * (c - 1) * (c - 2)) / 6
    count += (c * (c - 1)) / 2
    return count
N = input()
L = input().split(' ')
L_2 = set(L)
c = collections.Counter(L)
#c = {s:int(c[s]) for s in c}
#print(c)
l = len(L)
L_2 = tuple(set(L))
L = [int(s) for s in L]
L_2 = [int(s) for s in L_2]
if len(L_2) < 3:
    exit
a = (l * (l - 1) * (l - 2)) / 6
for v in c:
    if c[v] > 1:
        a -= ((l - c[v]) * getCount(c[v]))

l_2 = len(L_2)
a_2 = (l_2 * (l_2 - 1) * (l_2 - 2)) / 6      
count = 0
index = 0
for i in range(l_2):
    for j in range(i + 1, l_2):
        for k in range(j + 1, l_2):
            #print(L_2[i], L_2[j], L_2[k])
            #m = (L[k] + L[j]) % L2[i]
            #if m % L[j] == 0 or m % L[k] == 0 or m == 0:
            #    print('重複', L[i], L[j], L[k])
            #    a -= 1
            if ((L_2[i] + L_2[j]) <= L_2[k]) or (abs(L_2[i] - L_2[j]) >= L_2[k]):
                #print('条件を満たさない三角形', L_2[i], L_2[j], L_2[k])
                a -= c[str(L_2[i])]
            count += 1
print(int(a))

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np

def main():
    N = int(sys.stdin.readline().rstrip())
    L = [int(x) for x in sys.stdin.readline().rstrip().split()]
    L = np.array(L)
    # L.sort()
    # print(L)
    cnt = 0

    if N < 3:
        print(0)
        return


    for i in range(N - 2):
        for j in range(i+1, N - 1):
            for k in range(j+1, N):
                print((i+1, j+1, k+1), L[i], L[j], L[k])
                if L[i] == L[j] or L[j] == L[k] or L[k] == L[i]:
                    continue
                cnt += 1 if L[i] + L[j] > L[k] and L[k] + L[i] > L[j] and L[j] + L[k] > L[i]else 0

    print(cnt)


main()

Submission status: Wrong Answer

Solution code:
N = int(input())
L = list(map(int, input().split()))
L.sort()
cnt = 0
for i in range(N):
  Li = L[i]
  for j in range(N):
    Lj = L[j]
    if Li != Lj:
      for k in range(N):
        Lk = L[k]
        if Lk != Lj and Lk != Li:
          if Lk < Li + Lj:
            cnt += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
n = int(input())
lis = [int(x) for x in input().split()]
lis.sort()
lis2 = []
ans = 0
for i in range(n-2):
  for y in range(i+1, n-1):
    for z in range(y+1,n):
      if lis[i] != lis[y] and lis[y] != lis[z] and lis[i] != lis[z] and lis[i]+lis[y] > lis[z]:
        lis2.append([lis[i],lis[y],lis[z]])
print(lis2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import itertools

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

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

print(cnt)

Submission status: Wrong Answer

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

ans=0
for i in range(N-2):
    a=L[i]
    for j in range(i+1,N-1):
        b=L[j]
        if a==b:
            continue
        for k in range(j+1,N):
            c=L[i]
            if b==c:
                continue
            ans+=a+b>c

print(ans)

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
l = list(map(int,input().split()))
count = 0
x = []
e = []
for i in range(len(l)-2):
    for j in range(i+1,len(l)-1):
        if l[i]!=l[j]:
            for k in range(j+1,len(l)):
                if l[i]!=l[k] and l[j]!=l[k]:
                    x.append([i+1,j+1,k+1])
                    e.append([l[i],l[j],l[k]])
count = 0           
for i in range(len(x)):
    sorted(e[i])
    t =  int(x[i][0])-1
    s = int(x[i][1])-1
    q = int(x[i][2])-1
    if e[t] + e[s] >e[q]:
        count +=1
print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
l = list(map(int,input().split()))
count = 0
x = []
e = []
for i in range(len(l)-2):
    for j in range(i+1,len(l)-1):
        if l[i]!=l[j]:
            for k in range(j+1,len(l)):
                if l[i]!=l[k] and l[j]!=l[k]:
                    x.append([i+1,j+1,k+1])
                    e.append([l[i],l[j],l[k]])
count = 0           
for i in range(len(x)):
    sorted(e[i])
    t =  int(x[i][0])-1
    s = int(x[i][1])-1
    q = int(x[i][2])-1
    print([l[t],l[s],l[q]])
    if e[t] + e[s] >e[q]:
        count +=1
print(count)

Submission status: Wrong Answer

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

for i in range(len(lis) - 2):
  for j in range(i + 1, len(lis) - 1):
    for k in range(j + 1, len(lis)):
      if lis[k] < lis[i] + lis[j]:
        c += 1
        
print(c)

Submission status: Wrong Answer

Solution code:
N = int(input())

ans = 0
L = list(map(int, input().split()))
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[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 = list(map(int, input().split()))
la = 0
lb = 0
lc = 0
cnt = 0
list =[]

for a in range(len(l_list)):
 if a == 0 or a > 0 and l_list[a] != l_list[a-1]:
  la = l_list[a]
  b = a+1
  for b in range(len(l_list)):
   lb = l_list[b]
   if la != lb:
    c = b+1
    for c in range(len(l_list)):
     lc = l_list[c]
     if la != lb and lb != lc and la != lc and la+lb+lc-max([la, lb, lc]) > max([la, lb, lc]):
       cnt += 1
       l_li = [a,b,c]
       l_li = sorted(l_li)
       list.append(l_li) 
list = [tuple(d) for d in list]
listl = set(list)
print(len(listl))

Submission status: Wrong Answer

Solution code:
n = int(input())
l = list(map(int, input().split()))
ans = 0
l.sort(reverse = True)

print(l)


for i in range(n):
    for j in range(n):
        for k in range(n):
            if l[i] == l[j] or l[i] == l[k] or l[j] == l[k]:
                continue
            elif l[i] < l[j] + l[k]:
                ans += 1

print(ans // 6)

Submission status: Wrong Answer

Solution code:
n = int(input())
l = list(map(int,input().split()))
count = 0
x = []
for i in range(len(l)-2):
    for j in range(i+1,len(l)-1):
        if l[i]!=l[j]:
            for k in range(j+1,len(l)):
                if l[i]!=l[k] and l[j]!=l[k]:
                    x.append([i+1,j+1,k+1])
                    
print(len(x))

Submission status: Wrong Answer

Solution code:
N=int(input())
import itertools
A = list(map(int, input().split())) 

count=0
if len(A)<=2:
    print(0)
else:
    for ｔ in itertools.combinations(A, 3):
        if t[2]<t[0]+t[1] and t[1]<t[0]+t[2] and t[0]<t[1]+t[2] and t[0]!=t[1]!=t[2]!=t[0]:
            print(t)
            count+=1

    print(count)

Submission status: Wrong Answer

Solution code:
N=int(input())
import itertools
A = list(map(int, input().split())) 

count=0
if N<=2:
    print(0)
else:
    for ｔ in itertools.combinations(A, 3):
        if t[2]<t[0]+t[1] and t[1]<t[0]+t[2] and t[0]<t[1]+t[2] and t[0]!=t[1]!=t[2]!=t[0]:
            print(t)
            count+=1

    print(count)

Submission status: Wrong Answer

Solution code:
import sys
from itertools import combinations


def main():
    ll = read_ll()
    result = c(ll)
    print(result)

def c(ll):
    count = 0
    for i, j, k in combinations(ll, 3):
        if i != j and j != k and i != k:
            if i + j > k:
                count += 1
    return count

def read_ll():
    n = int(input())

    ll = input().split()
    ll = list(map(int, ll))
    ll.sort()
    return ll

if __name__ == 'main':
    main()

Submission status: Wrong Answer

Solution code:
import itertools

Length = int(input())
inputList = input()

seq = [int(x) for x in inputList.split(' ')]

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

def b(line):
	list = []
	for i in range(len(line)):
		if line[i][0] + line[i][1] > line[i][2] and line[i][1] + line[i][2] > line[i][0] and line[i][2] + line[i][0] > line[i][1]:
			list.append(line[i])
			continue
		else:
			continue
	return list

print(len(b(a)))

Submission status: Wrong Answer

Solution code:
N=int(input())
import itertools
A = list(map(int, input().split())) 

count=0
for ｔ in itertools.combinations(A, 3):
    if t[2]<t[0]+t[1] and t[1]<t[0]+t[2] and t[0]<t[1]+t[2] and t[0]!=t[1]!=t[2]!=t[0]:
        print(t)
        count+=1

print(count)

Submission status: Wrong Answer

Solution code:
n=int(input())
l=list(map(int,input().split()))
ans=0
for a in l:
  for b in l:
    for c in l:
      if (a==b or b==c or a==c):
        continue
      if max([a,b,c])<a+b+c-max([a,b,c]):
        ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
import itertools

Length = int(input())
inputList = input()

seq = [int(x) for x in inputList.split(' ')]

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

def b(line):
	list = []
	for i in range(len(line)):
		if line[i][0] + line[i][1] > line[i][2] and line[i][1] + line[i][2] > line[i][0] and line[i][2] + line[i][0] > line[i][1]:
			list.append(line[i])
			continue
		else:
			continue
	return list

print(b(a))

Submission status: Wrong Answer

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


count = 0

for i in l:
    for j in l:
        for k in l:
            if i+j>k & j+k>i & k+i>j & i!=j!=k:
                    count += 1

print(count)

Submission status: Wrong Answer

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

N = int(input())
L = sorted(list(map(int, input().split(" "))), reverse=True)
C = dict(Counter(L))
L = sorted(list(set(L)), reverse=True)
print(L)

if N<3 or len(L)<3:
    print(0)
    exit()
li = []
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:
                break
            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])
                if _li in li:
                    continue
                li.append(_li)
cnt = 0
for l in li:
    a = C[L[l[0]]]
    b = C[L[l[1]]]
    c = C[L[l[2]]]
    cnt += (a * b * c)
print(cnt)

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]!=L[k]:
                sum_=L[i]+L[j]+L[k]
                if max(L[i],L[j],L[k])*2<sum_:
                    count+=1                

print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
l = list(map(int, input().split()))
c = 0
i = 1
while i < n:
  j = i + 1
  while j < n:
    k = j + 1
    while k < n:
      if l[i] != l[j] and l[j] != l[k] and l[k] != l[i] and abs(l[j]-l[k]) < l[i] < l[j] + l[k]:
        c += 1
      k += 1
    j += 1
  i += 1
print(c)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = (int(x) for x in input().split())

b = list(a)
cnt = 0

for i in range(len(list(b))) :
        for j in range(len(list(b))) :
                for k in range(len(list(b))):
                        c = [i,j,k]
                        if len(c) == len(set(c)) :
                                d = [b[i],b[j],b[k]]
                                m = max(d) 
                                if m < sum(d) - m :
                                        cnt += 1
                                else :
                                        None
                        else :
                                None
                                
print(int(cnt/6))

Submission status: Wrong Answer

Solution code:
import itertools
N = int(input())
L = []
for val in map(int, input().split()):
    L.append(val)
# for i in range(N):
#     L.append(int(input()))


L.sort()
distinct_L = {}

for l in L:
    distinct_L[l] = L.count(l)

cnt = 0
asd = []
single = []
multi = []
for key in distinct_L:
    # print(key, distinct_L[key])
    if(distinct_L[key] > 1):
        single.append(key)
    else:
        multi.append(key)

cnt += len(list(itertools.combinations(single, 3)))
for key in multi:
    cnt += distinct_L[key] * len(list(itertools.combinations(single, 2)))

for multi_list in list(itertools.combinations(multi, 2)):
    temp = 1
    for key in multi_list:
        temp = temp*distinct_L[key]
    cnt += temp * len(single)

for multi_list2 in list(itertools.combinations(multi, 3)):
    temp = 1
    for key in multi_list2:
        temp = temp*distinct_L[key]
    cnt += temp

print(cnt)

Submission status: Wrong Answer

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

C = 0
for i in range(N-2):
    if P[-(i + 1)] <(P[-(i+2)] + P[-(i+3)]):
        C+= 1
print(C)

Submission status: Wrong Answer

Solution code:
import itertools

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

ijk=[x for x in range(n)]

ijkl=list(itertools.permutations(ijk,3))

a=[]
for ii in ijkl:
  if ii[0]<ii[1]<ii[2]:
    a.append(ii)

a=set(a)
ans=0

for aa in a:
  list_=[]
  list_.append(aa[0]) 
  list_.append(aa[1])
  list_.append(aa[2])     
  if len(l) == len(set(l)):


    max_=max(l[aa[0]],l[aa[1]],l[aa[2]])
    sum_=sum(list_)
    if max_ < (sum_-max_):
      ans+=1

print(ans)

Submission status: Wrong Answer

Solution code:
from itertools import *

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

array = []
tmp = []
ans = 0

for i in range(1, n+1): array.append(i)
print(array)

array = list(combinations(array, 3))
print(array, len(array))

for i in range(len(array)):
    print(array[i])
    print(array[i][0]-1, array[i][1]-1, array[i][2]-1)
    print(l[array[i][0]-1],l[array[i][1]-1],l[array[i][2]-1])
    hoge = [l[array[i][0]-1],l[array[i][1]-1],l[array[i][2]-1]]
    print(hoge)
    if len(set(hoge)) == 3: tmp.append(hoge)
print(tmp)        

for i in range(len(tmp)):
    if len(tmp[i]) == 3:
        ans += 1
print(ans)

Submission status: Wrong Answer

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

cnt=0

for i in range(len(l)):
    for j in range(len(l)):
        for k in range(len(l)):
            if i<j<k:
                if l[k]<l[i]+l[j] and l[i]!=l[j]:
                    cnt+=1


print(cnt)

Submission status: Wrong Answer

Solution code:
N = int(input())
Klist = (input().strip()).split(" ")
Llist = list(map(int, Klist))
#print(Llist)

cnt = 0
for i in range (0, N):
    for j in range (i+1, N):
        for k in range (j+1, N):
            if abs(Llist[j] - Llist[k]) < Llist[i] < Llist[j] + Llist[k]:
                cnt += 1

print(cnt)

Submission status: Wrong Answer

Solution code:
count = 0
N = int(input())
L = list(map(int, input().split())) #1行にN個の整数を入力したい.
L.sort(reverse=True) #リストLを降順に並び替えたい(昇順の時は"()"の中身は何も書かない)
for i in range(0, N-2):
    for j in range(1, N-1):
        for k in range(2, N-1):
            if L[i] == L[j] or L[j] == L[k] or L[i] == L[k]:
                count += 0
            elif L[i] < L[j] + L[k]:
                #print(L[i])
                count += 1
print(count)

Submission status: Wrong Answer

Solution code:
import itertools
N = int(input())
L = list(map(int,input().split(" ")))
S = set(L)
f = 0

if len(S) < 3:
    print(0)
else:
    X = set(list(itertools.combinations(L, 3)))
    ans = len(X)
    for i in X:
        if len(set(i)) < 3:
            ans -=1
            f += 1
    if f > 0:
      ans += 1
    print(ans)

Submission status: Wrong Answer

Solution code:
import itertools

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

ijk=[x for x in range(n)]

ijkl=list(itertools.permutations(ijk,3))

a=[]
for ii in ijkl:
  if ii[0]<ii[1]<ii[2]:
    a.append(ii)

a=set(a)
ans=0

for aa in a:
  list_=[]
  if l[aa[0]] != l[aa[1]] != l[aa[2]]:
    list_.append(l[aa[0]])
    list_.append(l[aa[1]])
    list_.append(l[aa[2]])

    max_=max(l[aa[0]],l[aa[1]],l[aa[2]])
    sum_=sum(list_)
    if max_ < (sum_-max_):
      ans+=1

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
s = 0
L = input().split()
for i in range(N-2): 
    for j in range(i+1, N-1, 1):
        for k in range(j+1, N, 1):
            if i < j < k:
                a = int(L[i])
                b = int(L[j])
                c = int(L[k])
                if a != b:
                    if b != c:
                        if c != a:
                            s += 1
           
print(s)

Submission status: Wrong Answer

Solution code:
import itertools

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

ijk=[x for x in range(n)]

ijkl=list(itertools.permutations(ijk,3))

a=[]
for ii in ijkl:
  if ii[0]<ii[1]<ii[2]:
    a.append(ii)

ans=0

for aa in a:
  list_=[]
  if l[aa[0]] != l[aa[1]] != l[aa[2]]:
    list_.append(l[aa[0]])
    list_.append(l[aa[1]])
    list_.append(l[aa[2]])

    max_=max(l[aa[0]],l[aa[1]],l[aa[2]])
    sum_=sum(list_)
    if max_ < (sum_-max_):
      ans+=1

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
long_list = input().split()
count = 0
for i in range(N):
    long_i = int(long_list[i])
    for j in range(N-i-1):
        long_j = int(long_list[i+j+1])
        for k in range(N-i-j-2):
            long_k = int(long_list[i+j+k+2])
            if long_i == long_j or long_j == long_k or long_k == long_i:
                pass
            elif long_i + long_j > long_k or long_i + long_k > long_j or long_j + long_k > long_i:
                count += 1    
            else:
                pass

print("{0}".format(count))

Submission status: Wrong Answer

Solution code:
count = 0
N = int(input())
L = list(map(int, input().split())) #1行にN個の整数を入力したい.
L.sort(reverse=True) #リストLを降順に並び替えたい(昇順の時は"()"の中身は何も書かない)
A = len(L)
for i in range(0, A-2):
    for j in range(1, A-1):
        for k in range(2, A):
            if L[i] == L[j] or L[j] == L[k] or L[i] == L[k]:
                count += 0
            elif L[i] < L[j] + L[k]:
                print(L[i])
                count += 1
print(count)

Submission status: Wrong Answer

Solution code:
from itertools import combinations

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

# 三角形
# a+b > c 

result = []
for idx in combinations(list(range(len(l))), 3):
    if (l[idx[0]] != l[idx[1]] and l[idx[1]] != l[idx[2]] and l[idx[2]] != l[idx[0]]):
        if (l[idx[0]]+l[idx[1]] > l[idx[2]]):
            result.append([idx[0]+1,idx[1]+1,idx[2]+1])
print(len(result))