TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: 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.

Submission attempts (in order):
#N = int(input())
#LL = [int(n) for n in input().split(" ")]


N = 10
LL = [9,4,6,1,9,6,10,6,6,8]
OO = [n for n in range(N)]

import copy
import itertools

def makeCombination(candidate, n, lessFlag):
    if len(candidate) <= 0:
        return [[]]
    _candidate = [n for n in candidate]
    _candidate = sorted(_candidate)
    result = []
    if lessFlag is False:
        tmp = list(set(list(itertools.combinations(_candidate, n))))
        for t in tmp:
            result.append(list(t))
    else:
        for i in range(n):
            result += makeCombination(candidate, i + 1, False)
        result += [[]]
    return result

def triangle(ll):
    lll = copy.deepcopy(ll)

    maxlen = max(lll)

    lll.remove(maxlen)

    if lll[0] + lll[1] > maxlen:
        return True
    return False

ok = 0
candidates = makeCombination(OO, 3, False)
for cand in candidates:
    a = LL[cand[0]]
    b = LL[cand[1]]
    c = LL[cand[2]]
    if a != b and b != c and a != c:
        if triangle([a, b, c]):
            ok += 1
print(ok)


N = int(input())
LL = [int(n) for n in input().split(" ")]


#N = 10
#LL = [9,4,6,1,9,6,10,6,6,8]
OO = [n for n in range(N)]

import copy
import itertools

def makeCombination(candidate, n, lessFlag):
    if len(candidate) <= 0:
        return [[]]
    _candidate = [n for n in candidate]
    _candidate = sorted(_candidate)
    result = []
    if lessFlag is False:
        tmp = list(set(list(itertools.combinations(_candidate, n))))
        for t in tmp:
            result.append(list(t))
    else:
        for i in range(n):
            result += makeCombination(candidate, i + 1, False)
        result += [[]]
    return result

def triangle(ll):
    lll = copy.deepcopy(ll)

    maxlen = max(lll)

    lll.remove(maxlen)

    if lll[0] + lll[1] > maxlen:
        return True
    return False

ok = 0
candidates = makeCombination(OO, 3, False)
for cand in candidates:
    a = LL[cand[0]]
    b = LL[cand[1]]
    c = LL[cand[2]]
    if a != b and b != c and a != c:
        if triangle([a, b, c]):
            ok += 1
print(ok)


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
l = list(map(int,input().split()))

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

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

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

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

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


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import itertools
N = int(input())
L = list(map(int,input().split()))
res = 0
for i in range(N):
    for j in range(i+1,N):
        for k in range(j+1,N):
            if L[i] != L[j] and L[j] != L[k] and  L[i] != L[k]: 
                K = [L[i],L[j],L[k]]
                m = max(K)
                K.remove(m)
                if m < K[0] + K[1]:
                    res += 1
                    print(i+1,j+1,k+1)
print(res)

import itertools
N = int(input())
L = list(map(int,input().split()))
res = 0
for i in itertools.combinations(L,3):
    i = list(i)
    i.sort()
    if i[0] != i[1] and i[1] != i[2]: 
        if i[2] < i[0]+i[1]:
            res += 1
print(res)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N = int(input())
L = list(map(int,input().split()))
count = 0
for i in range(len(L)):
    for j in range(i+1,len(L)):
        for k in range(j+1,len(L)):
            if L[i] <= L[j] + L[k] and L[j] <= L[i] + L[k] and L[k] <= L[i] + L[j]:
                count += 1
print(count)
            

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

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

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
# -*- coding: utf-8 -*-

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

for a in range(N - 2):
    for b in range(N - 2):
        for count in range(N - 2):
            x = L[a], L[a + b + 1], L[a + 1 + count]
            mylist = list(x)
            mylist.sort()
            if mylist[0] + mylist[1] > mylist[2]:
                t += 1

print(t)


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

t = 0

for a in range(N):
    for b in range(a + 1, N):
        for c in range(b + 1, N):

            if l[a] < l[b] < l[c] and l[a] + l[b] > l[c]:
                t += 1

print(t)


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a = input()
b = list(map(int,input().split()))
c = b.sort()
d = 0

if a <= 2:
  print("0")
elif :
  for i in len(b):
    for j in (i+1,len(b)):
      for k in (k+1,len(b)):
        if c[i]+c[j] > c[k]:
          d += 1
  print(str(d))         
        

a = int(input())
b = list(map(int,input().split()))
b.sort()
d = 0
 
if a <= 2:
  print("0")
else :
  for i in range(len(b)):
    for j in range(i+1,len(b)):
      for k in range(j+1,len(b)):
        if b[i]+b[j] > b[k]:
          d += 1
  print(str(d)) 

a = int(input())
b = list(map(int,input().split()))
b.sort()
d = 0
 
if a <= 2:
  print("0")
else :
  for i in range(len(b)):
    for j in range(i+1,len(b)):
      for k in range(j+1,len(b)):
        if b[i]+b[j] > b[k] and b[i] != b[j] and b[j] != b[k]:
          d += 1
  print(str(d)) 

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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)))

import itertools
N = int(input())
a = list(map(int,input().split()))
count=0
for a in list(itertools.combinations(a,3)):
  if a[0]!=a[1] and a[1]!=a[2] and a[0]!=a[2]:
    if a[1]+a[2]>a[0] and a[0]+a[2]>a[1] and a[0]+a[1]>a[2]:
      count+=1
  
print(count)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N = int(input())
L = sorted(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 L[i] + L[j] > L[k]:
                ans += 1
print(ans)


N = int(input())
L = sorted(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 L[i] < L[j] < L[k] and L[i] + L[j] > L[k]:
                ans += 1
print(ans)


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import itertools

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

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

print(count)

import itertools

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

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

print(count)

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

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

import itertools

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

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

print(count)

import itertools

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

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

print(count)

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

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N = int(input())
L_list = list(map(int,input().split()))


conter = 0

for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if a==b or b==c or c==a or a+b<=c or b+c<=a or c+a<=b:
                continue
            counter += 1


print(counter)

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


counter = 0

for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            a = L_list[i]
            b = L_list[j]
            c = L_list[k]
            if a==b or b==c or c==a or a+b<=c or b+c<=a or c+a<=b:
                continue
            counter += 1


print(counter)

Verdicts: Runtime Error

Accepted
Problem: 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.

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

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N = int(input())
L = list(map(int,input().split()))



ans = 0

for i in range(len(L)):
    for j in range(i+1,len(L)):
        for k in range(j+1,len(L)):
            #print("L[i]:",L[i],"L[j]:",L[j],"L[k]:",L[k])
            if 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[j] != L[k] and L[k] != L[i]:
                #print("L[i]:",L[i],"L[j]:",L[j],"L[k]:",L[k])
                ans += 1

prinr(ans)

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


ans = 0

for i in range(len(L)):
    for j in range(i+1,len(L)):
        for k in range(j+1,len(L)):
            #print("L[i]:",L[i],"L[j]:",L[j],"L[k]:",L[k])
            if 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[j] != L[k] and L[k] != L[i]:
                #print("L[i]:",L[i],"L[j]:",L[j],"L[k]:",L[k])
                ans += 1

prinr(ans)

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



ans = 0

for i in range(len(L)):
    for j in range(i+1,len(L)):
        for k in range(j+1,len(L)):
            #print("L[i]:",L[i],"L[j]:",L[j],"L[k]:",L[k])
            if 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[j] != L[k] and L[k] != L[i]:
                #print("L[i]:",L[i],"L[j]:",L[j],"L[k]:",L[k])
                ans += 1

prinr(ans)

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


ans = 0

for i in range(len(L)):
    for j in range(i+1,len(L)):
        for k in range(j+1,len(L)):
            #print("L[i]:",L[i],"L[j]:",L[j],"L[k]:",L[k])
            if 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[j] != L[k] and L[k] != L[i]:
                #print("L[i]:",L[i],"L[j]:",L[j],"L[k]:",L[k])
                ans += 1

prinr(ans)

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



ans = 0

for i in range(len(L)):
    for j in range(i+1,len(L)):
        for k in range(j+1,len(L)):
            #print("L[i]:",L[i],"L[j]:",L[j],"L[k]:",L[k])
            if 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[j] != L[k] and L[k] != L[i]:
                #print("L[i]:",L[i],"L[j]:",L[j],"L[k]:",L[k])
                ans += 1

print(ans)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import itertools

n = int(input())
l = list(map(int, input().split()))
cnt = 0
for a, b, c in itertools.combinations(l, 3) :
    if max([a, b, c]) < (sum([a, b, c]) - max([a, b, c])) :
        if len([a, b, c]) == len(set([a, b, c])) :
            print(a, b, c)
            cnt += 1
print(cnt)

import itertools

n = int(input())
l = list(map(int, input().split()))
cnt = 0
for a, b, c in itertools.combinations(l, 3) :
    if max([a, b, c]) < (sum([a, b, c]) - max([a, b, c])) :
        if len([a, b, c]) == len(set([a, b, c])) :
            cnt += 1
print(cnt)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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)

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)

from itertools import combinations

n = int(input())
num_list = list(map(int, input().split()))
combination = combinations(num_list, 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)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())

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

# permutations using library function 
from itertools import combinations 
  
# Get all permutations of [1, 2, 3]
L=set(L)
perm = combinations(L, 3) 
  
# Print the obtained permutations 
count=0
for i in list(perm):
  if i[0]+i[1]>i[2]:
    count +=1
print(count)

n = int(input())

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

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import itertools


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)

import itertools


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

i = 0
if len(l) < 3:
    print('0')
else:

    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)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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)

import numpy as np
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)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
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)

import itertools
num = int(input())
lis = list(map(int,input().split()))
tri = list(itertools.combinations(lis,3))
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)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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)

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:
        count += 1

print(count)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import collections
import itertools

N = int(input())
L = list(map(int, input().split()))
C = collections.Counter(L)
Comb = []
ans = 0


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

for i in itertools.combinations(sorted(C.keys()), 3):
    Comb.append(i)

for i in Comb:
    a = L.count(i[0])
    b = L.count(i[1])
    c = L.count(i[2])
    if b + c > a:
        ans += a*b*c

print(ans)


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

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

print(ans)


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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]:
          ans += 1
  print(ans)

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)

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)

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)

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)

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



Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
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)

n = int(input())
lis = [int(x) for x in input().split()]
lis.sort()
nas = 0
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]:
        ans += 1

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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)


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)



import itertools
N=int(input())
LN=list(input().split(' '))
LN.sort(key=int)
LN_sort=list(dict.fromkeys(LN))
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)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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)

n=int(input())
x=list(map(int,input().split()))
x=sorted(x,reverse=True)
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]
   if l1<l2+l3 and l1!=l2 and l2!=l3:
      cnt+=1
print(cnt)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
l = map(int, input().split())
l.sort()

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

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
l = list(map(int, input().split(" ")))
ans = 0
first_num = []
second_num = []


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

print(ans)

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

arr_arr = []

for i in range(n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            arr = sorted([l[i], l[j], l[k]])
            if (arr[0] + arr[1] > arr[2]) and ((arr[0] != arr[1])and(arr[1] != arr[2])):
                arr_arr.append(arr)

print(len(arr_arr))

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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)


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


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n = len(L)
c = 0
result = []
for i in range(n):
    for j in range(i+1, n):
        for k in range(j+1, n):
            
            if abs(L[i]-L[j])<L[k]<L[i]+L[j] and  L[i]!=L[j] and L[j]!=L[k]:
                #print(L[i], L[j], L[k])
                c += 1
print(c)

n = len(L)
c = 0
result = []
for i in range(n):
    for j in range(i+1, n):
        for k in range(j+1, n):
            
            if abs(L[i]-L[j])<L[k]<L[i]+L[j] and  L[i]!=L[j] and L[j]!=L[k]:
                print(L[i], L[j], L[k])
                c += 1
print(c)

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

n = len(L)
c = 0
result = []
for i in range(n):
    for j in range(i+1, n):
        for k in range(j+1, n):
            
            if abs(L[i]-L[j])<L[k]<L[i]+L[j] and  L[i]!=L[j]!=L[k]:
                #print(L[i], L[j], L[k])
                c += 1

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

n = len(L)
c = 0
result = []
for i in range(n):
    for j in range(i+1, n):
        for k in range(j+1, n):
            if L[i]!=L[j] and L[j]!=L[k] and L[i]!=L[k]:
                if L[i]+L[j]>L[k] and L[j]+L[k]>L[i] and L[i]+L[k]>L[j]:
                    #print(L[i], L[j], L[k])
                    c += 1
print(c)

Verdicts: Runtime Error

Runtime Error

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):


def main():
    N, D = map(int, input().split(" "))
    xy = []
    for i in range(N):
        xy.append(list(map(int, input().split(" "))))
    D2 = D **2
    cnt = 0
    for i in range(N):
        if xy[i][0] **2 + xy[i][1] **2 <= D2:
            cnt += 1
    print(cnt)

if __name__ == "__main__":
    main()


def main():
    N = int(input())
    L = list(map(int, input().split(" ")))
    cnt = 0
    for i in range(N-2):
        for j in range(i + 1, N-1):
            for k in range(j + 1, N):
                l1 = L[i]
                l2 = L[j]
                l3 = L[k]
                l_max = max(l1, l2, l3)
                if l1 == l2 or l2 == l3 or l3 == l1:
                    continue
                if (l1+l2+l3) - l_max <= l_max:
                    continue
                cnt += 1
    print(cnt)


if __name__ == "__main__":
    main()

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
l_list = list(map(int,input().split()))
l_list.sort()
count = 0
for i in range(0, n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            a = list[i]
            b = list[j]
            c = list[k]
            if a == b or b == c or c == b:
                continue
            if a + b > c:
                count += 1
            else:
                break
print(count)


n = int(input())
l_list = list(map(int,input().split()))
l_list.sort()
count = 0
for i in range(0, n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            a = l_list[i]
            b = l_list[j]
            c = l_list[k]
            if a == b or b == c or c == b:
                continue
            if a + b > c:
                count += 1
            else:
                break
print(count)


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N = int(input(""))
L = map(int, input("").split(" "))
L = sorted(L)

n = 0

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

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

n = 0

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
def main():
    N = int(input())
    L = list(map(int, input().split()))
    L = sorted(L)
    print(L)
    count = 0

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

    print(count)

if __name__ == '__main__':
    main()

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

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

    print(count)


if __name__ == '__main__':
    main()

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

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

    print(count)

if __name__ == '__main__':
    

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

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

    print(count)


if __name__ == '__main__':
    main()

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):



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)

N = int(input())
A = map(int, input().split())
A = sorted(A, reverse = False)
count = 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] != A[k]) and (A[k] < A[i] + A[j]):
                count += 1

print (count)

Verdicts: Runtime Error

Accepted
Problem: 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.

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

# -*- coding: utf-8 -*-
n=int(input())
if n<3:
  print(0)
else:
  cnt=0
  l_list=list(map(int,input().split()))
  sl_list=sorted(l_list)
  for i in range(n):
    for j in range(i+1,n):
      for g in range(j+1,n):
        m=sl_list[i]
        f=sl_list[j]
        d=sl_list[g]
        if m!=f and f!=d and d!=m:
          if d<m+f:
            cnt+=1
  print(cnt)

Verdicts: Wrong Answer

Accepted