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: Runtime Error

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

Submission status: Runtime Error

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+=1i

print(ans)

Submission status: Runtime Error

Solution code:
#B-making trinagle
#while文を入れる場所がわからなかった
#import bisectってなんやねん
N = int(input())
A = list(map(int, input().split()))
A = sorted(A)
cnt = 0

def judge():
    if m == a + b:
        return "ok!"
    elif m >= a  b:
        return "high"
    else:
        return "low"

while True:
for i in range(N-2):
    a = list[i]
    for j in range(i + 1, N-1):
        b = list[j]
        if a == b:
            return True
        else:
            m = i + j
            while True:
            def judge(c)

cnt = m - j
print (cnt)

Submission status: Runtime Error

Solution code:
N=int(input())
L = map(int,input().split())
count = 0
for i in L:
for j in L:
for k in L:
while all (i<j<k and k>i+k):
  count += 1
  print(count)

Submission status: Runtime Error

Solution code:
import itertools
N = int(input())
li = []
for i in range(N):
    li.append(input())
li = [int(s) for s in li]

if N <3:
    print(0)
else:
    
    count = 0
    for conb in itertools.combinations(li, 3):
        if (conb[0]!=conb[1]!=conb[2]!=conb[0]) and max(conb)<(conb[0]+conb[1]+conb[2]-max(conb)):
            count +=1
    print(count)

Submission status: Runtime Error

Solution code:
n=int(inout())
i = list(map(int, input().split()))
ans=0
for i in range(n-2):
    for j in range(i+1,n-1):
        if n[i]==n[j]:
            pass
        else:
            for k in range(j+1,n):
                if n[i]==n[k] and n[j]==n[k]:
                    pass
                else:
                    z=max(n[i],n[j],n[k])
                    if n[i]+n[k]+n[j]-z>z:
                        ans+=1
pint(ans)

Submission status: Runtime Error

Solution code:
import itertools

N = int(input())
li = []
for i in range(N):
    li.append(input())
li = [int(s) for s in li]

count = 0
for conb in itertools.combinations(li, 3):
    if (conb[0]!=conb[1]!=conb[2]!=conb[0]) and max(conb)<(conb[0]+conb[1]+conb[2]-max(conb)):
        count +=1
print(count)

Submission status: Runtime Error

Solution code:
import itertools
N = int(input())
L = list(set([int(input()) for i in range(N)]))
cnt = 0
if len(L) < 3:
  print(0)
for i in itertools.conbinations(L, 3):
  if i[0]**2 + i[1]**2 == i[2]**2 or i[0]**2 + i[2]**2 == i[1]**2 or i[1]**2 + i[2]**2 == i[0]**2:
    cnt += 1
print(cnt)

Submission status: Runtime Error

Solution code:
from math import factorial
n = int(input())
i = list(input().split())
new_i = [x for x in set(i) if i.count(x) > 1]
nCr = factorial(n) // factorial(3) // factorial(n - 3)
for s in new_i:
    nCr = nCr // factorial(i.count(s))
print(nCr)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
from itertools import combinations

n = int(input())
ls_str_l = input().split()

if n < 3:
  print(0)
else:
  ls_l = []
  for l in ls_str_l:
    ls_l.append(int(l))
  
  count = 0
  ls_tri_n = list(combinations(ls_l, 3))
  for ls_tri in ls_tri_n:
    if ls_tri[0] == ls_tri[1] or ls_tri[0] == ls_tri[2] or ls_tri[1] == ls_tri[2]:
      continue
    if ls_tri[0] + ls_tri[1] > ls_tri[2] and ls_tri[0] + ls_tri[2] > ls_tri[1] and \
        ls_tri[1] + ls_tri[2] > ls_tri[0] :
      count += 1

print(count)

Submission status: Runtime Error

Solution code:
N = int(input())
L = list(map(int,input().split()))
L = sorted(L)
ln = len(L)
ansl = []
nonans = 0

for i in range(ln-2):
   for j in range(1,ln -1):
      for k in range(2, ln):
         if L[i] + L[j] > L[k] and L[i] != L[j] and L[j] != L[k] and L[k] != L[i]:
            ansl.append([L[i], L[j], L[k]])

for i in range(ln-1):
   for j in range(i + 1, ln):
      if ansl[i] == ansl[j]:
         nonans += 1
            

print(len(ansl) - nonans -1)

Submission status: Runtime Error

Solution code:
N = int(input())
list_L = list(map(int, input().split()))
set_L = set(list_L)
num_N = [0] * 100
for i in range(len(list_L)):
    num = list_L[i]
    num_N[num-1] += 1

import itertools
d = list(itertools.combinations(set_L,3))
ans = 0
for item in d:
    a, b, c = item[0], item[1], item[2]
    if a + b <= c or b + c <= a or c + a <= b:
        continue
    cur = 1 * num_N[a-1] * num_N[b-1] * num_N[c-1]
    ans += cur
print(ans)

Submission status: Runtime Error

Solution code:
input()
x = list(map(int, input().split()))
x.sort()
x=np.array(x)
ans=0
for i in x[:-2]:
    y = x[x>i]
    for j in y:
        z = y[y>j]
        for k in z:
            if i+j>k:
                ans+=1
print(ans)

Submission status: Runtime Error

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


def print_ans(X, K, D):
    """Test Case
    >>> print_ans(6, 2, 4)
    2
    >>> print_ans(7, 4, 3)
    1
    >>> print_ans(10, 1, 2)
    8
    >>> print_ans(1000000000000000,1000000000000000,1000000000000000)
    1000000000000000
    """
    # 移動しない
    if K % 2 == 0 and D >= abs(X):
        print(abs(X))
    elif K % 2 != 0 and D >= abs(X):
        print(min(abs(X-D), abs(X+D)))
    elif abs(X) - D * K >= 0:
        print(abs(abs(X) - D * K))
    else:
        # near 0
        tmp = abs(X) // D
        rest_K = K - tmp
        a = abs(abs(X) - tmp * D)
        b = abs(abs(X) - (tmp + 1) * D)
        if rest_K % 2 == 0:
            print(a)
        else:
            print(b)


if __name__ == '__main__':
    X, K, D = map(int, input().rstrip().split())
    print_ans(X, K, D)

Submission status: Runtime Error

Solution code:
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)
resolve()

Submission status: Runtime Error

Solution code:
from itertools import combinations
import numpy as np

n = int(input())
ls_str_l = input().split()

if n < 3:
  print(0)
else:
  ls_l = []
  for l in ls_str_l:
    ls_l.append(int(l))
  
  count = 0
  ls_tri_n = list(combinations(ls_l, 3))
  # print(ls_tri_n)
  for ls_tri in ls_tri_n:
    # print(ls_tri)
    if ls_tri[0] == ls_tri[1] or ls_tri[0] == ls_tri[2] or ls_tri[1] == ls_tri[2]:
      continue
    max_idx = np.argmax(ls_tri)
    min_idx = np.argmin(ls_tri)
    mid_idx = None
    # print(max_idx, min_idx)
    for i in range(3):
      if i != max_idx and i != min_idx:
        mid_idx = i
    if ls_tri[min_idx] ** 2 + ls_tri[mid_idx] ** 2 == ls_tri[max_idx] ** 2:
      count += 1

print(count)

Submission status: Runtime Error

Solution code:
X,D,C = map(int,input().split())
count=abs(X)
a = X//C
b = X%C
if a>D:
  print(count-D*C)
elif a==D:
  print(b)
elif a<D:
  D = D-a
  if D%2==0:
    print(b)
  else:
    print(min(abs(b-C),abs(b+C)))

Submission status: Runtime Error

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

if len(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: Runtime Error

Solution code:
from itertools import combinations

n = int(input())
list = list(map(int, input().split()))
combination = combinations(lst, 3)
count = 0
for i in combination:
  if i[0] != i[1] and i[1] != i[2] and i[0] != i[2]:
    if i[0] + i[1] > i[2] and i[1] + i[2] > i[0] and i[0] + i[2] > i[1]:
      count += 1

print(count)

Submission status: Runtime Error

Solution code:
n = int(input())
lst = list(map(int, input().split()))
comb = combinations(lst, 3)
count = 0
for i in comb:
  if i[0] != i[1] and i[1] != i[2] and i[0] != i[2]:
    if i[0] + i[1] > i[2] and i[1] + i[2] > i[0] and i[0] + i[2] > i[1]:
      count += 1
print(count)

Submission status: Runtime Error

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 = ij + ic
            k = ij + ic +ik
            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: Runtime Error

Solution code:
num_list =[]
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]:
        num_list.append(L[i])
        num_list.append(L[j])
        num_list.append(L[k])
        num_list.sort()
        if num_list[0]+num_list[1] > num_list[2]:
          ans += 1
          num_list.clear()
        else:
          num_list.clear()
print(int(ans/6))

Submission status: Runtime Error

Solution code:
n = int(input())

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

l.sort()

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

Submission status: Runtime Error

Solution code:
x=[]
n=int(input())
for i in range(0,n):
    xa=int(input())
    x.append(xa)
count=0
for i in range(0,n-2):
    for j in range(i,n-1):
        if(x[i]==x[j]):
            continue
        for k in range(j,n):
            if((x[i]==x[k])or(x[j]==x[k])):
                continue
            if ((x[i]+x[j]>x[k])and(x[i]+x[k]>x[j])and(x[j]+x[k]>x[i])):
                count+=1
print(count)

Submission status: Runtime Error

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

count = 0
for a in itertools.combinations(L, 3):
    if len(set(a)) != 3:
        continue
    a = sorted(a)
    if a[2] < a[0] + a[1]:
        count += 1
print(count)

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

Solution code:
import itertools
import math
n=int(input())
l=list(map(int,input().split()))
c = list(itertools.combinations(l, 3))
count=0
r=math.factorial(len(l)) / (math.factorial(len(l) - 3) * 6)
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)

Submission status: Runtime Error

Solution code:
import itertools
import math
n=int(input())
l=list(map(int,input().split()))
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)

Submission status: Runtime Error

Solution code:
import java.io.*;
import java.util.*;

public class Main {
    private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    private static StringTokenizer st;

    private static int readInt() throws IOException {
        while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
        return Integer.parseInt(st.nextToken());
    }

    public static void main(String[] args) throws IOException {
        int N = readInt();
        int[] l = new int[N];
        for (int i = 0; i < N; i++) {
            l[i] = readInt();
        }
        Arrays.sort(l);

        int res = 0;
        for (int i = 0; i < N; i++) {
            for (int j = i + 1; j < N; j++) {
                for (int k = j + 1; k < N; k++) {
                    if (l[i] < l[j] && l[j] < l[k] && l[i] + l[j] > l[k]) res++;
                }
            }
        }

        System.out.println(res);
    }
}

Submission status: Runtime Error

Solution code:
ｎ = int(input())
A = list(map(int,input().split()))
cnt = 0

def triang(n,A):
  if n < 3:
    return 0

  for i in range len(A):
    for h in range len(A):
      if i == h:
        continue
      for g in range len(A):
        if i == g:
          continue
        if h == g:
          continue
        if A(i) + A(h) > A(g) and A(i) + A(g) > A(h) and A(g) + A(h) > A(i):
          cnt = cnt+1
    return cnt
  
C = triang(n,A)
print(C)

Submission status: Runtime Error

Solution code:
import itertools
import math
n=int(input())
l=list(map(int,input().split()))
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)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
x=[]
n=int(input())
for i in range(0,n):
    xa=int(input())
    x.append(xa)
count=0
for i in range(0,n-2):
    for j in range(i,n-1):
        if(x[i]==x[j]):
            continue
        for k in range(j,n):
            if((x[i]==x[k])or(x[j]==x[k])):
               continue
            if ((x[i]+x[j]>x[k])or(x[i]+x[k]>x[j])or(x[j]+x[k]>x[i])):
                count+=1
print(count)

Submission status: Runtime Error

Solution code:
N = int(input())
L = sorted(list(map(int, input().split())))
a=L[0]
b=L[1]
ans = 0
for i in range(N):  # １番短い棒
    for j in range(i + 1, N):  # 真ん中の長さの棒
	  if b<L[i]>a+b:
   	  ans+=1
print(ans)

Submission status: Runtime Error

Solution code:
import itertools
import numpy as np

N = int(input(''))
L = (list(map(int, input('').split(' '))))
L = np.array(sorted(L))
set_L = set(L)
if len(set_L) <= 2:
    print(0)
else:
    K = {i:len(L[L==i]) for i in set_L}
    
i = 0
for team in itertools.combinations(K.keys(), 3):
    if (team[0] < team[1] + team[2]) & (team[1] < team[0] + team[2]) & (team[2] < team[0] + team[1]):
        i += K[team[0]]*K[team[1]]*K[team[2]]
print(i)

Submission status: Runtime Error

Solution code:
n = int(input())

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

s = l.sort()

ans = 0
if n <3:
  print(0)
else:
  for i in range(n-2):
    for j in range(i+1,n-1):
      for k in range(j+1,n):
        if s[i] + s[j] > s[k] and s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
          ans += 1
  print(ans)

Submission status: Runtime Error

Solution code:
import math
mod = 10**9+7
def I(): return int(input())
def LI(): return list(map(int,input().split()))
def MI(): return map(int,input().split())
def LLI(n): return [list(map(int, input().split())) for _ in range(n)]

N = I()
L = LI()
count =0
for i in range(N-2):
  for j in range(i+1,N-1):
    for k in range(j+1,N):
      flag = 0
      l1 = [L[i],L[j],L[k]]
      l = sorted(l1)
      for n in range(3):
        if(l.count(l[i])>1):
          flag = 1
      if(flag == 0):
        if(l[1]-l[0] < l[2] and l[1]+l[0] > l[2]):
          count += 1
print(count)

Submission status: Runtime Error

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

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

ans = 0
for i in range(0, N - 2):
    for j in range(i + 1, N - 1):
        for k in range(j + 1, N):
            arr = [L[i], L[j], L[k]]
            arr.sort()
            if (arr[0] != arr[1] & arr[1] != arr[2]):
                if (arr[2] < arr[0] + arr[1]):
                    ans = ans + 1

print(ans)

Submission status: Runtime Error

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

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

ans = 0
for i in range(0, N - 2):
    for j in range(i + 1, N - 1):
        for k in range(j + 1, N):
            arr = [L[i], L[j], L[k]]
            arr.sort()
            if (arr[0] != arr[1] & arr[1] != arr[2]):
                if (arr[2] < arr[0] + arr[1]):
                    ans = ans + 1

print(ans)

Submission status: Runtime Error

Solution code:

if N <= 2:
    print(0)
else:
    for i, d in enumerate(set_dup):
        count = 0
        for n in nums:
            if n == d:
                count += 1
        set_dup[i] = count

    count = 0
    for a in range(len(set_nums)):
        for b in range(a+1, len(set_nums)):
            for c in range(b+1, len(set_nums)):
                if set_nums[a] + set_nums[b] > set_nums[c]:
                    count += set_dup[a] * set_dup[b] * set_dup[c]
    print(count)

Submission status: Runtime Error

Solution code:
def ab(a,b,c):
	if((a+b>c) and (a+c>b) and (b+c>a)):
		return 1
	else:
		return 0
n=input()
n=int(n)
l=get_array()
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(ab(l[i],l[j],l[k])):
					#print(i,j,k)
					c+=1
print(c)

Submission status: Runtime Error

Solution code:
重複なimport sys
import math


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n = inint()
L = inintl()

ans = 0

for i in range(n):
    for j in range(n):
        for k in range(n):
            if i < j < k and (L[i]+L[j] > L[k] and L[j]+L[k] > L[i] and L[k]+L[i] > L[j]) and (L[i] != L[j] and L[i] != L[k] and L[j] != L[k]):
                ans += 1

print(ans)

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

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

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

ans = 0
for i in range(0, N - 2):
    for j in range(i + 1, N - 1):
        for k in range(j + 1, N):
            arr = [L[i], L[j], L[k]]
            arr.sort()
            if (arr[0] != arr[1] & arr[1] != arr[2]):
                if (arr[2] < arr[0] + arr[1]):
                    ans = ans + 1

print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())

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

l.sort()

ans = 0
if n <3:
  print(0)
else:
  for i in range(n-2):
    for j in range(i+1,n-1):
      for k in range(j+1,n):
        if l[i] + l[j] > l[k]　and l[j] + l[k] > l[i]　and l[k] + l[i] > l[j]:
          ans += 1
  print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
ans = 0
for i in range(N):
    for j in range(i+1, N):
        count = 0
        for k in range(j + 1, N):
            if L[i] + L[j]  > L[k]  and L[i] < L[j]:
                count += 1
                #print(L[i], L[j], L[k], count)
            else:
                #print(L[i], L[j], L[k])
                break
            ans = ans + count
            #print(ans)
print(ans)

Submission status: Runtime Error

Solution code:
from itertools import combinations

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
l = list(map(int,input().split()))
ans = 0
g = set(l)
m = list(g)
m.sort()
for i in range(n):
  judge = 0
  for j in range(i+1,n):
    for k in range(j+1,n):
      if(m[i]<m[j]+m[k]):
        ans += 1
      else:
        break
    if(judge==0):
      break
print(ans)

Submission status: Runtime Error

Solution code:
n = input()
lst = list(map(int,input().split()))
ans = 0
for i in range (n - 2):
  for j in range (i + 1, n - 1):
    for k in range (j + 1, n):
      lst2 = [lst[i], lst[j], lst[k]]
      lst3 = sorted(lst2)
      if(lst3[2] < lst3[1] + lst3[0]):
        ans = ans + 1
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
l = list(map(int,input().split()))
ans = 0
g = set(l)
m = list(g)
m.sort()
for i in range(n):
  judge = 0
  for j in range(i+1,n):
    for k in range(j+1,n):
      if(m[i]<[j]+[k]):
        ans += 1
      else:
        break
    if(judge==0):
      break
print(ans)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
n = int(input())
sum = 0
if n < 3:
  print(0)
else:
  number = list(map(int, input().split()))
  for i in range(n):
    for j in range(n):
      for k in range(n):
        if a != b and a != c and b != c:
          if a + b > c and a + c > b and b + c > a:
            sum += 1

print(sum)

Submission status: Runtime Error

Solution code:
n=int(input())
l=list(map(int,input().split()))
l.sort()
s=0
i=0
while s==0:
  if l[i]==l[i+1]:
    l.remove(l[i])
  else:
    i+=1
    if len(l)-1==i:
      s+=1
a=len(l)
print((a*(a-1)*(a-2)/6)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
Ls= list(map(int, input().split()))
count=0
for i in range(len(N)):
  for j in range(i,len(N)):
    for k in range(j,len(N)):
      tmp=[Ls[i],Ls[j],Ls[k]]
      if sum(tmp) < 2 * max(tmp):
        count+=1

print(count)

Submission status: Runtime Error

Solution code:
import itertools

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

N = int(input())
bars = [int(i) for i in input().split(" ")]

cnt = 0

for bar in itertools.combinations(bars, 3):
    if chkTrg(bar[0],bar[1],bar[2]):
        cnt += 1

print(cnt)import itertools

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

N = int(input())
bars = [int(i) for i in input().split(" ")]

cnt = 0

for bar in itertools.combinations(bars, 3):
    if chkTrg(bar[0],bar[1],bar[2]):
        cnt += 1

print(cnt)

Submission status: Runtime Error

Solution code:
import itertools

def f(a, b, c):
    return a+b > c


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

a=0
for t in itertools.combinations(l, 3):
    if f(t):
        a += 1

print(a)

Submission status: Runtime Error

Solution code:
// #include "pch.h"
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <climits>
#include <string>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <ctime>
#include <cassert>
#include <fstream>
#include <stack>
#include <random>

typedef long long ll;
typedef std::pair<int, int> Pii;
typedef std::pair<long long, long long> Pll;
typedef std::pair<double, double> Pdd;

#define rip(i, n, s) for (int i = (s);i < (int)( n ); i++)
#define all(a) a.begin(), a.end()
#define MM << " " <<

template<typename T>
using MaxHeap = std::priority_queue<T>;
template<typename T>
using MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<typename T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template<typename T>
void vdeb(std::vector<T> &da) {
    for (int i = 0;i < da.size();i++) {
        if (i == da.size() - 1) std::cout << da[i];
        else std::cout << da[i] << ' ';
    }
    std::cout << '\n';
}
template<typename T>
void vdeb(std::vector<std::vector<T>> &da) {
    for (int i = 0;i < da.size();i++) {
        std::cout << i << ' ';
        vdeb(da[i]);
    }
    std::cout << '\n';
}

using namespace std;

int main() {
    int n; cin >> n;
    vector<ll> da(n);
    ll ans = 0;
    rip(i,n,0) cin >> da[i];
    rip(i,n,0) {
        rip(j, i, 0) {
            rip(k,j,0) {
                if(da[i] != da[j] && da[j] != da[k] && da[k] != da[i] && max({da[i], da[j], da[k]})*2 < da[i] + da[j] + da[k]) {
                    // cout << da[i] MM da[j] MM da[k] << endl;
                    // cout << i MM j MM  k  << endl;
                    ++ans;
                }
            }
        }
    }
    cout << ans << endl;
}

Submission status: Runtime Error

Solution code:
vn = int(input())
ll = 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):
            a,b,c = ll[i], ll[j], ll[k]
            if a == b or b == c or c == a:
                continue
            vs = [a,b,c]
            vs.sort()
            if vs[0] + vs[1] > vs[2]: 
                cnt += 1
                # print(vs)

print(cnt)

Submission status: Runtime Error

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