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

FF= []

count =0
for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            print(i,j,k)
            a = L[i]
            b = L[j]
            c = L[k]
            if a != b and b != c and a != c and a + b > c and b + c > a and c + a > b:
                    FF.append(str(a) + str(b) + str(c))
print(len(FF))

Submission status: Wrong Answer

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


if len(S) < 3:
    print(0)
else:
    for i in S:
        if L.count(i) > 1:
             X.append(L.count(i))
            
    ans = len(list(itertools.combinations(S, 3)))
    for i in X:
        ans *= i
    print(ans)

Submission status: Wrong Answer

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

b = list(a)
cnt = []

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

Submission status: Wrong Answer

Solution code:
import numpy as np
bars = list(map(int, input().split(" ")))

length = len(bars)

def check_triangle(a, b, c):
    if a == b or b == c or c == a:
        return 0
    if ((a + b) > c) and ((b + c) > a) and ((c + a) > b):
        return 1
    else:
        return 0


count = 0
for i, li in enumerate(bars):
    for k in range(i+1, length):
        res = np.sum([check_triangle(bars[i], bars[k], bars[j]) for j in range(k+1, length)])
        count += int(res)
print(count)

Submission status: Wrong Answer

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


def check_tri(a, b, c):
    if a + b > c and b + c > a and c + a > b:
        return True
    else:
        return False


def print_ans(lr):
    """Test Case
    >>> print_ans([4, 4, 9, 7, 5])
    5
    >>> print_ans([4, 5, 4, 3, 3, 5])
    8
    >>> print_ans([9, 4, 6, 1, 9, 6, 10, 6, 6, 8])
    39
    >>> print_ans([1,1])
    0
    """
    ans = 0
    c = collections.Counter(lr)
    target = itertools.combinations(list(c.keys()), 3)
    for t in target:
        if check_tri(t[0], t[1], t[2]):
            tmp = (c[t[0]] * c[t[1]] * c[t[2]])
            ans += tmp
    print(ans)


if __name__ == '__main__':
    N = int(input().rstrip())
    lr = [input().rstrip() for _ in range(N)]
    print_ans(lr)

Submission status: Wrong Answer

Solution code:
import itertools

#import length
S = input()
#import list
l = input().split()

i = 0

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

print(i)

Submission status: Wrong Answer

Solution code:
import itertools
num = int(input())
lis = list(map(int,input().split()))
tri = list(itertools.combinations(lis,3))
print(tri)
count = 0

for i in range(len(tri)):
    a = tri[i][0]
    b = tri[i][1]
    c = tri[i][2]
    if len(tri[i]) == len(set(tri[i])):
        if a+b > c and b+c > a and a+c > b:
            count += 1

print(count)

Submission status: Wrong Answer

Solution code:
input_n = input()
n = int(input_n)

input_L = input()
L = str(input_L)

listL = L.split(' ')

max = 0
tmp1 = 0
tmp2 = 0
result = 0

for i in range(n - 2):
    for j in range(i + 1, n - 1):
        for k in range(j + 1, n):
            if int(listL[i]) > int(listL[j]):
                max = int(listL[i])
                tmp1 = int(listL[j])
            else :
                max = int(listL[j])
                tmp1 = int(listL[i])
            if int(listL[k]) > max:
                tmp2 = max
                max = int(listL[k])
            else :
                tmpw = int(listL[k])
            if max < (tmp1 + tmp2):
                result += 1

print(str(result))

Submission status: Wrong Answer

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

b = list(a)
cnt = []

for i in range(len(list(b))) :
        for j in range(len(list(b))) :
                for k in range(len(list(b))):
                        if i != j and j != k and k != i :
                                d = [b[i],b[j],b[k]]
                                m = max(d) 
                                if m < sum(d) - m :
                                        cnt.append(1)
                                else :
                                        None
                        else :
                                None
                                
print(sum(cnt))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

L = sorted(l, reverse=False)

ans = 0

for i in range(len(L)):
    for j in range(len(L)):
        for k in range(len(L)):
            if L[i] < L[j] < L[k]:
                if L[i]**2 + L[j]**2 == L[k]**2:
                    ans += 1
                else:
                    continue

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 < 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:
N = int(input())
L = list(map(int,input().split()))

FF= []

count =0
for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+2,N):
            a = L[i]
            b = L[j]
            c = L[k]
            if a != b != c and a + b > c and b + c > a and c + a > b:
                    FF.append(str(a) + str(b) + str(c))
                    count += 1
if len(FF) == 0:
    print(0)
else:
    print(len(FF)+1)

Submission status: Wrong Answer

Solution code:
import itertools

n = int(input())
l_list = [int(x) for x in input().split()]
count = 0

all = list(itertools.permutations(l_list, 3))
for i in all:
    if i[0] < i[1] < i[2]:
        count += 1

print(count)

Submission status: Wrong Answer

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

if n < 3 :
    print(0)
    exit(0)

l = sorted(l)

cnt = 0

for x in range(len(l)):
    for y in range(x+1, len(l)):
        su = l[x] + l[y]
        for z in range(y+1, len(l)):
            if l[x] == l[y] or l[x] == l[z] or l[y] == l[z]:
                continue
            if su > l[z]:
                cnt += 1
                print(l[x], l[y], l[z])
            else:
                break

    continue

print(cnt)

Submission status: Wrong Answer

Solution code:
import itertools
N = int(input())
L = sorted(list(map(int,input().split())))
SS = itertools.combinations(L,3)
count = []

for x,y,z in SS:
    if x + y > z and x + z > y and y + z > x:
        count.append((x,y,z))
l = len(set(count))
print(l)

Submission status: Wrong Answer

Solution code:
a = [input().split() for l in range(2)]
count = 0
N = int(a[0][0])
for i in range(N):
    for j in range(i):
        for k in range(j):
           if int(a[1][i]) != int(a[1][j]) and int(a[1][j]) != int(a[1][k]) and int(a[1][k]) != int(a[1][i]):
                if int(a[1][i]) > abs(int(a[1][j])-int(a[1][k])):
                    count = count + 1
print(count)

Submission status: Wrong Answer

Solution code:
import itertools
N=int(input())
LN=list(input().split(' '))
print(LN)
LN.sort(key=int)
LN_sort=list(dict.fromkeys(LN))
print(LN_sort)
cbn=list(itertools.combinations(LN_sort,3))
cnt=int(0)
for i in range(len(cbn)):
    if int(cbn[i][0])+int(cbn[i][1])>int(cbn[i][2]):
        cnt+=LN.count(cbn[i][0])*LN.count(cbn[i][1])*LN.count(cbn[i][2])

print(cnt)

Submission status: Wrong Answer

Solution code:
import itertools

n = int(input())
l_list = [int(x) for x in input().split()]
count = 0
result = []

all = list(itertools.permutations(l_list, 3))

for i in set(all):
    if i[0] < i[1] < i[2]:
        result.append(i)

print(result)

Submission status: Wrong Answer

Solution code:
n = int(input())

list1 = input().split()
list2 = []
for i in range(0,len(list1)):
    list2.append(int(list1[i]))
count = 0
if(n<=2):
    count = 0
for i in range(n):
    if(i+2==len(list1)):
        continue
    for j in range(i,n):
        for k in range(j,n):
            if(list2[i] != list2[j] and list2[i] != list2[k] and list2[j] != list2[k]):
                count = count + 1

print(count)

Submission status: Wrong Answer

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

if n < 3 :
    print(0)
    exit(0)

l = sorted(l)

cnt = 0

for x in range(len(l)):
    for y in range(x+1, len(l)):
        su = l[x] + l[y]
        for z in range(y+1, len(l)):
            if l[x] == l[y] or l[x] == l[z] or l[y] == l[z]:
                break
            if su > l[z]:
                cnt += 1
            else:
                break

    continue

print(cnt)

Submission status: Wrong Answer

Solution code:
#B
N = int(input())
L = list(map(int, input().split()))
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:
import itertools
N = int(input())
L = list(map(int, input().strip().split()))
print(L);
t_count = 0;
three_numbers = list(itertools.combinations(L, 3))
print(three_numbers)

for i in range(len(three_numbers)):
    three_number = three_numbers[i];
    print(three_number)
    li = three_number[0]
    lj = three_number[1]
    lk = three_number[2]
    print(li);
    print(lj);
    print(lk);

    if li == lj:
        continue;
    elif li == lk:
        continue;
    elif lj == lk:
        continue;

    if li+lj <= lk:
        continue;
    elif li+lk <= lj:
        continue;
    elif lj+lk <= li:
        continue;
    t_count+=1;
            
print(t_count);

Submission status: Wrong Answer

Solution code:
import itertools
N=int(input())
LN=list(input().split(' '))
print(LN)
LN.sort()
LN_sort=list(dict.fromkeys(LN))
print(LN_sort)
cbn=list(itertools.combinations(LN_sort,3))
cnt=int(0)
for i in range(len(cbn)):
    if int(cbn[i][0])+int(cbn[i][1])>int(cbn[i][2]):
        cnt+=LN.count(cbn[i][0])*LN.count(cbn[i][1])*LN.count(cbn[i][2])

print(cnt)

Submission status: Wrong Answer

Solution code:
a = [input().split() for l in range(2)]
count = 0
N = int(a[0][0])
for i in range(N):
    for j in range(i):
        for k in range(j):
           if int(a[1][i]) != int(a[1][j]) and int(a[1][j]) != int(a[1][k]) and int(a[1][k]) != int(a[1][i]):
                if int(a[1][i]) > abs(int(a[1][j])-int(a[1][k])):
                    print(a[1][i])
                    count = count + 1
print(count)

Submission status: Wrong Answer

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

cnt = 0

for i in range(0, n-2):
    t = l[i]
    for b in range(i+1, n-1):
        s = l[b]
        if (t != s):
            for k in range(b+1, n):
                if(l[k] != s):
                    a = s + l[k]
                    if(a >= t):
                        cnt += 1

print(cnt)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = map(int,input().split())
cnt = 0
t = sorted(s)
 
for i in range(n):
    a = t[i]
    for j in range(i+1, n):
        b = t[j]
        for k in range(j+1, n):
            c = a + b
            if t[k] != c and a != b and b != t[k] and a != t[k]:
                cnt += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
# a+b > c AND b+c > a AND c+a > b

import itertools
triangle = 0

N = int(input())
L = [int(x) for x in input().split(" ")]


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

print(triangle)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
def func():
    a=int(input())
    b = list(map(int,input().split()))
    f = [[[0 for i3 in range(100)] for i2 in range(100)] for i1 in range(100)]
    #print(a)
    #for i in range(a):
    #    print(b[i])
    z=0
    for i in range(a-2):
        ii=i
        p=b[ii]
        for j in range(a-1-ii):
            jj=ii+j+1
            q=b[jj]
            for k in range(a-1-jj):
                kk=jj+k+1
                r=b[kk]
                if p+q>r:
                    if p!=q and q!=r and r!=p:
                        z=z+1
    print(z)

func()

Submission status: Wrong Answer

Solution code:
import itertools
N = int(input())
L = list(map(int, input().strip().split()))
print(L);
set_L = list(set(L));
print(set_L);
t_count = 0;
three_numbers = list(itertools.combinations(set_L, 3))
print(three_numbers)

for i in range(len(three_numbers)):
    three_number = three_numbers[i];
    print(three_number)
    li = three_number[0]
    lj = three_number[1]
    lk = three_number[2]
    print(li);
    print(lj);
    print(lk);

    if li == lj:
        continue;
    elif li == lk:
        continue;
    elif lj == lk:
        continue;

    if li+lj <= lk:
        continue;
    elif li+lk <= lj:
        continue;
    elif lj+lk <= li:
        continue;
    t_count+=1;
            
print(t_count);

Submission status: Wrong Answer

Solution code:
def MakingTriangle():
    
    num = int(input())

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

    count = 0

    if num <= 2:
        print(0)
        
    else:
        
        for i in range(num - 2):
            
            for j in range(i+1, num-1):
            
                for k in range(j+1, num):
                    if data[i] != data[j] and data[j] != data[k] and data[i] != data[k]:
                        
                        if (data[i] + data[i+1] > data[j]) and (data[i+1] + data[j] > data[i]) and (data[j] + data[i] > data[i+1]):
                            
                            count = count + 1
            
        print(count)
        
if __name__ == '__main__':
    MakingTriangle()

Submission status: Wrong Answer

Solution code:
def solve():
    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
                        break

    print(count)

if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
def solve():
    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())
x=list(map(int,input().split()))
x=sorted(x,reverse=True)
print(x)
cnt=0
for i in range(0,n-2):
 l1=x[i]
 for j in range(i+1,n-1):
  l2=x[j]
  for k in range(j+1,n):
   l3=x[k]
   print(l1,l2,l3)
   if l1<l2+l3 and l1!=l2 and l2!=l3:
      cnt+=1
print(cnt)

Submission status: Wrong Answer

Solution code:
N=int(input())
L=map(int,input().split())
L=list(L)
L_un=list(set(L))
Lunc=len(L_un)
b=0

for i in range(0,Lunc):
    for m in range(i+1,Lunc):
        for n in range(m+1,Lunc):
            if L_un[i]+L_un[m]>L_un[n] and L_un[m]+L_un[n]>L_un[i] and L_un[n]+L_un[i]>L_un[m]:
                c_i=L.count(L_un[i])
                c_m=L.count(L_un[m])
                c_n=L.count(L_un[n])
                
                print(L_un[i],c_i)
                print(L_un[m],c_m)
                print(L_un[n],c_n)
                
                b+=c_i*c_m*c_n

print(b)

Submission status: Wrong Answer

Solution code:
N = int(input())
L = [int(e) for e in input().split()]
c = 0
 
if N >= 3:
  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]:
            c += 1
print(c)

Submission status: Wrong Answer

Solution code:
import collections
import itertools
def resolve():
    n = int(input())
    l = list(map(int, input().split()))
    c = collections.Counter(l)
    keys = c.keys()
    key_combinations = set(itertools.combinations(keys, 3))

    result = 0
    for combination in key_combinations:
        max_key = max(combination)
        if sum(combination) - max_key > max_key:
            # 三角形になる
            one_combination_result = 1
            for key in combination:
                one_combination_result = one_combination_result * c[key]
            result += one_combination_result
    print(result)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python

import sys
import argparse
import logging
#import math

logging.basicConfig(filename='logger.log', level=logging.DEBUG)
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)


def f(n: int, l_list: list, i: int = None, j: int = None, k: int = None) -> int:
    '''
    >>> f(0, [])
    0
    >>> f(1, [1])
    0
    >>> f(2, [1, 1])
    0
    >>> f(3, [1, 1, 1])
    0
    >>> f(3, [1, 1, 2])
    0
    >>> f(3, [1, 2, 2])
    0
    >>> f(3, [1, 2, 3])
    0
    >>> f(3, [1, 2, 4])
    0
    >>> f(3, [1, 3, 4])
    0
    >>> f(3, [2, 3, 4])
    1
    >>> f(5, [4, 4, 9, 7, 5])
    5
    >>> f(6, [4, 5, 4, 3, 3, 5])
    8
    >>> f(10, [9, 4, 6, 1, 9, 6, 10, 6, 6, 8])
    39
    '''
    if n <= 2:
        return 0
    result = 0
    for i in range(0, n-2):
        for j in range(i+1, n-1):
            for k in range(j+1, n):
                logger.debug("(n, i,j,k)=(%d, %d,%d,%d)" % (n, i, j, k))
                li = l_list[i]
                lj = l_list[j]
                lk = l_list[k]
                l_ijk = sorted([l_list[i], l_list[j], l_list[k]])
                if l_ijk[0] + l_ijk[1] > l_ijk[2]:
                    if li != lj and lj != lk and lk != li:
                        logger.debug("yes")
                        result += 1
    return result


if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument(
            '--doctest', action='store_true', default=False)
    args = parser.parse_args()
    if args.doctest:
        import doctest
        doctest.testmod(verbose=True)
        sys.exit()

    n = int(sys.stdin.readline().rstrip())
    l_list = sys.stdin.readline().rstrip().split()
    print(f(n, l_list))

Submission status: Wrong Answer

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

if N >= 3:
  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]:
            print(i+1, j+1, k+1)
            c += 1
print(c)

Submission status: Wrong Answer

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

if len(set(L)) >= 3:
  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]:
            print(i+1, j+1, k+1)
            c += 1
print(c)

Submission status: Wrong Answer

Solution code:
n = int(input())
l_before = input()

l = l_before.split(' ')
lnum = len(l)


i = 0
j = 0
k = 0

count = 0

for ic in range(lnum):
    for jc in range(lnum-ic-1):
        for kc in range(lnum-ic-jc-1):
            i = ic
            j = ic + jc
            k = ic + jc +kc
            if i + j >= k:
                count = count + 1
            else:
                if i + k >= j:
                    count = count + 1
                else:
                    if k + j >= i:
                        count = count + 1

print(count)

Submission status: Wrong Answer

Solution code:
def mulit(a):
  a_copy = list(a)
  return len(a) == len(set(a_copy))

N = int(input())
A = list(map(int, input().split()))
A = sorted(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 = [i for i in answer if mulit(i)]
answer_len = len(answer)
print(f"{answer_len}")

Submission status: Wrong Answer

Solution code:
n = int(input())
s = map(int,input().split())
cnt = 0
t = sorted(s)

for i in range(n):
    a = t[i]
    for j in range(i, n):
        b = t[j]
        for k in range(j, n):
            c = a + b
            if t[k] != c and a != b and b != t[k] and a != t[k]:
                cnt += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import itertools

# 棒の本数
n = int(input())

# 棒のリスト
lods = list(map(int, input().split()))

# 3本なければ三角形は作れない
if (n<3):
  print(0)

# 確認
count = 0
for data in itertools.combinations(lods, 3):
  if (data[0] != data[1]
      and data[1] != data[2]
      and data[2] != data[0]
      and (data[0]+data[1]) > data[2]
      and (data[1]+data[2]) > data[0]
      and (data[2]+data[0]) > data[1]):
    count += 1

print(count)

Submission status: Wrong Answer

Solution code:
import itertools

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

cnt = 0
for v in itertools.combinations(l, 3):
    t = set(v)
    print(v)
    if len(t) == len(v) and (abs(v[0] - v[1]) < v[2] < v[0] + v[1]):
        cnt += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
import itertools
N = int(input())
L = list(map(int,input().split()))
ans=0
for v in itertools.combinations(list(range(N)), 3):
  if max(L[v[0]],L[v[1]],L[v[2]])<L[v[0]]+L[v[1]]+L[v[2]]-max(L[v[0]],L[v[1]],L[v[2]]):
    if L[v[0]]!=L[v[1]]!=L[v[2]]:
      ans+=1
    
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

N = int(input())
ls = [int(s) for s in input().split()]

count = 0

for i in range(0, N-2):
  for j in range(i+1, N-1):
    l1 = ls[i]
    l2 = ls[j]
    if l2 == l1:
      continue
    for k in range(j+1, N):
      l3 = ls[k]
      if l3 in {l1, l2}:
        continue
      max_num = max((l1, l2, l3))
      if 2 * max_num < l1 + l2 + l3:
        print("OK", ls[i], ls[j], ls[k])
        count += 1

print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

sLength = set(L)
count = 0

for i in sLength:
    for j in sLength:
        for k in sLength:
            if i!=j and i!=k and j!=k:
                m = max([i,j,k])
                if i+j+k-2*m>0:
                    count+=1

print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())
L = [int(e) for e in input().split()]
c = 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]:
          c += 1
print(c)

Submission status: Wrong Answer

Solution code:
N = int(input()) #1行目のNを取得する
list = list(map(int, input().split()))
i=0
j=1
k=2
kosuu=0

while i<N-3:
  while j<=N-2:
    while k<=N-1:
      x=list[i]
      y=list[j]
      z=list[k]
      if x+y>z and y+z>x and z+x>y and x!=y and y!=z and z!=x:
        kosuu+=1
      k+=1
      
    j+=1
    k=j+1
  i+=1
  j=i+1
  k=j+1
print(kosuu)

Submission status: Wrong Answer

Solution code:
from sys import stdin
import itertools

N = stdin.readline().rstrip()
L = [int(x) for x in stdin.readline().rstrip().split()]

tmp = set()
cnt = 0
for s in itertools.combinations(L, 3):
    a = s[0]
    b = s[1]
    c = s[2]
    if a+b > c and b+c > a and c+a > b:
        if a != b and b != c and a != c:
            cnt = cnt + 1
            print(s)

print(cnt)

Submission status: Wrong Answer

Solution code:
import bisect
import collections
n=int(input())
l=sorted(list(map(int,input().split())))
ma=l[-1]
d=collections.Counter(l)
ans=0
for i in range(1,ma-2):
  for j in range(i+1,ma-1):
    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:
N = int(input())
A = list(map(int, input().split()))
count = 0
def make_sankaku(san):
    if san[0] == san[1] or san[1] == san[2] or san[2] == san[0]:
        return False
    else:
        san.sort()
        if san[2] - san[0] >= san[1]:
            return False
    return True
All_a = []
if len(A) <3:
    count = 0
else:
    for i in range(len(A)):
        for k in range(i+1, len(A)):
            for l in range(k + 1 ,len(A)):
                if make_sankaku([A[i], A[k], A[l]]):
                    print(i,k,l)
                    if [A[i], A[k], A[l]] not in All_a:
                        print([A[i], A[k], A[l]])
                        count += 1
print(count)

Submission status: Wrong Answer

Solution code:
import itertools

n = int(input())
l_list = [int(x) for x in input().split()]
count = 0

for all in itertools.permutations(l_list, 3):
    if all[0] < all[1] < all[2]:
        count += 1

print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())

ans = 0

bou = list(map(int,input().split()))
bou.sort(reverse=True)
l_bou = len(bou)
for i in range(l_bou):
    for j in range(i+1, l_bou):
        for k in range(j+1, l_bou):
            if ((bou[i] is not bou[j]) and (bou[j] is not bou[k]) and (bou[i] is not bou[k])): 
                if (bou[i] < bou[j] + bou[k]):
                    ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
import math
import itertools

#def combinations_count(n, r = 3):
#    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N = int(input())

line = list(map(int, input().split(" ")))
line_set = set(line)
dic = {}

for num in line_set:
    cnt = line.count(num)
    dic[num] = cnt

#dif_num = len(line_set)
#comb = combinations_count(dif_num)
#print(comb)

#for i in dic.values():
#    comb *= i
    
print(dic)
#print(dif_num)
#print(comb)
print(list(itertools.combinations(line_set, 3)))
pattern = list(itertools.combinations(line_set, 3))

sum_ = 0
for lis in pattern:
    prod = 1
    for num in lis:
        prod *= dic[num]
    sum_ += prod
print(sum_)

Submission status: Wrong Answer

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

ans = 0
if len(L) <= 2 :
    print(ans)
else:
    for lists in itertools.combinations(L,3):
        if sum(lists) - max(lists) > max(lists):
            if len(lists) != len(set(lists)):
                continue
            else:
                ans += 1


        else:
            continue

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
l = input()
a = l.split(' ')
new_l = []
countl = 0

for i in range(n):
    new_l.append(int(a[i]))

new_l.sort()

for i in range(n):
    for j in range(i+1,n-i):
        if(new_l[i]==new_l[j]):
            countl += 1

count = 0

for i in range(n): # i=0-5
    for j in range(i+1, n): # j=i+1 to 4-i
        for k in range(j+1, n): # k=i+j
            print(new_l[i], new_l[j], new_l[k])

            if(new_l[i] + new_l[j] > new_l[k]):
                if(new_l[i]!=new_l[j] and new_l[j]!=new_l[k]):
                    count += 1

print(count)

Submission status: Wrong Answer

Solution code:
def find(lst):
  d={}
  for i in lst:
    d.setdefault(i,0)
    d[i]+=1
  ans=0
  d1={}
  for i in d.keys():
    if d[i]==1:
      ans+=1
    else:
      d1.setdefault(d[i],0)
      d1[d[i]]+=1
  if len(list(d1.keys()))>0:
    for i in d1.keys():
      ans+=pow(i,d1[i])

  return ans

n=int(input())
lst=list(map(int,input().split()))
print(find(lst))

Submission status: Wrong Answer

Solution code:
import itertools
import math
n=int(input())
l=list(map(int,input().split()))
if len(l)<=2:
    print('0')
else:
    c = list(itertools.combinations(l, 3))
    count=0
    r=math.factorial(len(l)) // (math.factorial(len(l) - 3) * 6)
    print(r)
    for i in range(r):
        if c[i][0]==c[i][1] or c[i][1]==c[i][2] or c[i][2]==c[i][0]:
            pass
        else:
            if c[i][0]+c[i][1]>c[i][2] and c[i][1]+c[i][2]>c[i][0] and c[i][2]+c[i][0]>c[i][1]:
                count+=1
            else:
                pass
    print(count)