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


N = int(input())
Ln = list(map(int,input().split()))
Ln.sort()
n = 0
for i in range(N):
    for j in range(i+1,N):
        for k in range(j+1,N):
            if Ln[i]+Ln[j]>Ln[k] and Ln[i]!=Ln[j] and Ln[j]!=Ln[k]:
                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):
import itertools

n = int(input())
nums = list(map(int,input().split()))
count= 0
for i, j, k in itertools.combinations(nums, 3):
    I = i**2
    J = j **2
    K = k **2
    if I == J + K:
        count += 1
    elif J == I + K:
        count += 1
    elif K == I + J:
        count += 1
                    
print(count)

import itertools

n = int(input())
nums = list(map(int, input().split()))
count = 0
for i, j, k in itertools.combinations(nums, 3):
    if i != j and i != k and j != k:
        L = [i, j, k]
        L = sorted(L)
        if L[2] < L[0] + L[1]:
            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):
x=eval(input())
num=list(map(int,input().split()))
res=0
for i in num:
    for j in num:
        for k in num[::-1]:
            if i==j or i==k or j==k:
                continue
            else:
                if j-k<i and j+k>i:
                    res+=1
print(res/6)

x=eval(input())
num=sorted(list(map(int,input().split())))
res=0
for i in range(x):
    for j in range(i):
        for k in range(x-1,i,-1):
            if num[i]==num[j] or num[i]==num[k] or num[j]==num[k]:
                continue
            else:
                if num[j]-num[k]<num[i] and num[j]+num[i]>num[k]:
                    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):
k = int(input())

an = input().split()

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

ln = sorted(an)

print(ln)

ans = 0

for i in range(k):
    for j in range(i,k):
        for l in range(j,k):
            a1 = int(ln[i])
            a2 = int(ln[j])
            a3 = int(ln[l])
            if a1!=a2 and a2 != a3:
                m = a1 + a2
                if a3 < m:
                    ans += 1

print(ans)

k = int(input())

an = input().split()

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

ln = sorted(an)

ans = 0

for i in range(k):
    for j in range(i,k):    
        for l in range(j,k):
            a1 = int(ln[i])
            a2 = int(ln[j])
            a3 = int(ln[l])
            if a1!=a2 and a2 != a3:
                m = a1 + a2
                if a3 < m:
                    ans += 1

print(ans)

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()))
cnt=0
for i in range(1,N-2,1):
  for j in range(2,N-1,1):
    for k in range(3,N,1):
      if L[i]!=L[j] and L[j]!=L[k] and L[k]!=L[i] and \
      L[i]+L[j]>L[k] and L[j]+L[k]>L[i] and L[k]+L[i]>L[j]:
        cnt=cnt+1
print(cnt)

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


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


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())

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

N = int(input())

ans = 0
L = list(map(int, input().split()))
for i in range(N):
  for j in range(i+1, N):
    if L[i] == L[j]:
      continue
    for k in range(j+1, N):
      if L[i] == L[k] or L[j] == L[k]:
        continue
      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)


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(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)

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)
 
if __name__ == "__main__":
    solve()

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):
s=int(input())
a=list(map(int, input().split()))
a=list(set(a))
s=len(a)
count=0
a.sort()
#print(a)
for i in range(s):
  for j in range(i+1,s):
    for k in range(j+1,s):
      #print(i,j,k)
      ij = a[i]+a[j]
      jk = a[j]+a[k]
      ki = a[k]+a[i]
      
      #print(a[i],a[j],a[k])
      if (ij > a[k]) and (jk > a[i])and (ki > a[j]):
        count +=1
print(count)

s=int(input())
a=list(map(int, input().split()))
count=0
a.sort()
#print(a)
for i in range(s):
  for j in range(i+1,s):
    for k in range(j+1,s):
      #print('tttt',i,j,k,a[i],a[j],a[k])
      if a[i]==a[j]: continue
      if a[j]==a[k]: continue
      if a[k]==a[i]: continue

     
      ij = a[i]+a[j]
      jk = a[j]+a[k]
      ki = a[k]+a[i]
      
      #print(a[i b],a[j],a[k])
      if (ij > a[k]) and (jk > a[i])and (ki > a[j]):
        #print(i,j,k,a[i],a[j],a[k])
        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()
count=0

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

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

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

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] and L[j] != L[k] and L[i] != L[k]:
        if L[i] + L[j] > L[k] and L[j] + L[k] > L[i] and L[i] + L[k] > L[j]:
          ans += 1

print(ans)

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

ans = 0
for i in range(N):
  for j in range(i+1, N):
    for k in range(j+1, N):
      if L[i] == L[j] or L[j] == L[k] or L[i] == L[k]:
        continue
      if L[i] + L[j] <= L[k] or L[j] + L[k] <= L[i] or L[i] + L[k] <= L[j]:
        continue
      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()))
L.sort()
ans = 0
for i in range(len(L)-2):
  for j in range(i+1,len(L)-1):
    for k in range(j+1,len(L)):
        if L[i] + L[j] >= L[k] and L[i] <= L[j] + L[k] and  L[j] <= L[i] + L[k]:
          if L[i] != L[j] and L[j] != L[k] and L[k] != L[i]:
            ans += 1
print(ans)

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


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)


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


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):

def istri(a, b, c):
	f = False
	if a == b or b == c or c == a:
		return f
	elif a < b+c and b < c+a and c < a+b:
		f = True
	return f

n = int(input())
l = list(map(int, input().split()))
ans = 0
# print(l)
# print(istri(l[0], l[1], l[2]))


for i in range(n-2):
	for j in range(1, n-1):
		for k in range(2, n-2):
			if istri(l[i], l[j], l[k]):
				ans += 1
print(ans)		



def istri(a, b, c):
	f = False
	if a == b or b == c or c == a:
		return f
	elif a < b+c and b < c+a and c < a+b:
		f = True
	return f

n = int(input())
l = list(map(int, input().split()))
ans = 0
# print(l)
# print(istri(l[0], l[1], l[2]))


for i in range(n-2):
	for j in range(i+1, n-1):
		for k in range(j+1, n):
			if istri(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):
x,k,d = map(int, input.split())
x = abs(x)
kd = k*d

if kd<=x:
    print(x-kd)
else:
    count = x // d
    k_dash = k - count
    x -= count * d
    if k_dash % 2 == 0:
        print(x)
    else:
        print(d-x)    


from itertools import combinations
n = int(input())
l = list(map(int, input().split()))
comb = list(combinations(range(n), 3))
ans = 0
for i,j,k in comb:
    a = l[i]
    b = l[j]
    c = l[k]

    if a == b:
        continue
    if b == c:
        continue
    if c == a:
        continue
    if sum([a,b,c]) <= 2 * max(a,b,c):
        continue
    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())
A = list(map(int, input().split()))
A.sort()
a=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[k]>A[j] and A[k]+A[j]>A[i]:
                a+=1
print(a)

N = int(input())
A = list(map(int, input().split()))
A.sort()
a=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[k]>A[j] and A[k]+A[j]>A[i] and A[i]!=A[j] and A[k]!=A[j] and A[i]!=A[k]:
                a+=1
print(a)

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

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

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

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

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

	return count

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

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

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

Verdicts: Runtime Error

Runtime Error

Wrong Answer

Wrong Answer

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 = [int(w) for w in input().split()]

d = {}

for i in x:
    d[i] = d.get(i, 0) + 1
    
ans = 0
l = list(d.keys())
l = sorted(l)
print(l)
for i in range(len(l)-2):
    for j in range(i+1, len(l)-1):
        for k in range(j+1, len(l)):
            if l[k] < l[i] + l[j]:
                #print(l[i], l[j], l[k])
                ans += d[l[i]]*d[l[j]]*d[l[k]]
            
            else:
                break
            
print(ans)

n = int(input())
x = [int(w) for w in input().split()]

d = {}

for i in x:
    d[i] = d.get(i, 0) + 1
    
ans = 0
l = list(d.keys())
l = sorted(l)
#print(l)
for i in range(len(l)-2):
    for j in range(i+1, len(l)-1):
        for k in range(j+1, len(l)):
            if l[k] < l[i] + l[j]:
                #print(l[i], l[j], l[k])
                ans += d[l[i]]*d[l[j]]*d[l[k]]
            
            else:
                break
            
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())
count=0

a=list(map(int,input().split()))
a.sort()

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


N=int(input())
count=0

a=list(map(int,input().split()))
a.sort()
print(a)
if N>=3:
    for i in range(N-2):
        for j in range(i+1,N-1):
            for k in range(j+1,N):
                if a[i]!=a[j]!=a[k]!=a[i]:
                    if a[k]<a[i]+a[j]:
                            count+=1
                        
print(count)

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

N=int(input())
count=0

a=list(map(int,input().split()))
a.sort()

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


Verdicts: Wrong Answer

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):
from itertools import permutations
N = int(input())
L = list(map(int, input().split()))
ans = 0
for l in permutations(L, 3):
    if set(l) != 3:
        continue
    if sum(l) - max(l) > max(l):
        ans += 1
print(ans)

from itertools import combinations
N = int(input())
L = list(map(int, input().split()))
ans = 0
for l in combinations(L, 3):
    if set(l) != 3:
        continue
    a = l[0]
    b = l[1]
    c = l[2]
    if a + b > c and b + c > a and c + a > b:
        ans += 1
print(ans)

from itertools import permutations
N = int(input())
L = list(map(int, input().split()))
ans = 0
for l in permutations(L, 3):
    if set(l) != 3:
        continue
    a = l[0]
    b = l[1]
    c = l[2]
    if a + b > c and b + c > a and c + a > b:
        ans += 1
print(ans)

from itertools import combinations
N = int(input())
L = list(map(int, input().split()))
ans = 0
for l in combinations(L, 3):
    a = l[0]
    b = l[1]
    c = l[2]
    if a == b or b == c or c == a:
        continue
    if a + b > c and b + c > a and c + a > b:
        ans += 1
print(ans)

Verdicts: Wrong Answer

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):
s = input()
ans = 0
for i in N:
  for j in range(i+1,N):
    for k in range(j+1,N):
      if k<i+j and i!=j and j!=k:
        ans +=1

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

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

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

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

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

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: 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):
n = int(input())
l = sorted(set(map(int, input().split())))
n = len(l)
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(map(int, input().split()))
n = len(l)
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] > l[j] > l[i]:
        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):
def main():
    n = int(input())
    l = list(map(int,input().split()))
    cnt = 0

    for i in range(n):
        for j in range(i+1,n):
            for k in range(j+1,n):
                if l[i] + l[j] > l[k] and l[i] != l[j]:
                    if l[j] + l[k] > l[i] and l[j] != l[k]:
                        if l[k] + l[i] > l[j] and l[k] != l[i]:
                            cnt += 1
                            print(i,j,k)
                
    print(cnt)
if __name__ == "__main__":
    main()


def main():
    n = int(input())
    l = list(map(int,input().split()))
    cnt = 0

    for i in range(n):
        for j in range(i+1,n):
            for k in range(j+1,n):
                if l[i] + l[j] > l[k] and l[i] != l[j]:
                    if l[j] + l[k] > l[i] and l[j] != l[k]:
                        if l[k] + l[i] > l[j] and l[k] != l[i]:
                            cnt += 1
                
    print(cnt)
if __name__ == "__main__":
    main()


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

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

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

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


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())
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)

import itertools

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)

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 = int(input().split())

L2 = list(set(L)) 

ans = 0

for i in range(len(L2)):
  for j in range(i+1, len(L2)):
    for k in range(j+1, len(L2)):
      l = [L2[i], L2[j], L2[k]]
      l = sorted(l, reverse = True)
      if l[0] < l[1] + l[2]:
        ans += L.count(L2[i]) * L.count(L2[j]) * L.count(L2[k])

print(ans)      
    


N = int(input())
L = int(input().split())
L2 = set(L) 

ans = 0

for i in len(L2):
  for j in range(i+1, len(L2)):
    for k in range(i+2, len(L2)):
      l = [i, j, k]
      l = sorted(l, reverse = True)
      if l[0] < l[1] + l[2]:
        ans += L.count(i) * L.count(j) * L.count(k)

print(ans)      
    


N = int(input())
L = int(input().split(' '))
L2 = set(L) 

ans = 0

for i in len(L2):
  for j in range(i+1, len(L2)):
    for k in range(j+1, len(L2)):
      l = [L2[i], L2[j], L2[k]]
      l = sorted(l, reverse = True)
      if l[0] < l[1] + l[2]:
        ans += L.count(L2[i]) * L.count(L2[j]) * L.count(L2[k])

print(ans)      
    


N = int(input())
L = int(input().split())
L2 = set(L) 

ans = 0

for i in len(L2):
  for j in range(i+1, len(L2)):
    for k in range(i+2, len(L2)):
      l = [L2[i], L2[j], L2[k]]
      l = sorted(l, reverse = True)
      if l[0] < l[1] + l[2]:
        ans += L.count(L2[i]) * L.count(L2[j]) * L.count(L2[k])

print(ans)      
    


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

L2 = list(set(L)) 

ans = 0

for i in range(len(L2)):
  for j in range(i+1, len(L2)):
    for k in range(j+1, len(L2)):
      l = [L2[i], L2[j], L2[k]]
      l = sorted(l, reverse = True)
      if l[0] < l[1] + l[2]:
        ans += L.count(L2[i]) * L.count(L2[j]) * L.count(L2[k])

print(ans)      
    

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

L2 = list(set(L)) 

ans = 0

for i in range(len(L2)):
  for j in range(i+1, len(L2)):
    for k in range(j+1, len(L2)):
      l = [L2[i], L2[j], L2[k]]
      l = sorted(l, reverse = True)
      if l[0] < l[1] + l[2]:
        ans += L.count(L2[i]) * L.count(L2[j]) * L.count(L2[k])

print(ans)      
    


Verdicts: Runtime Error

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



for i in L:
    for j in L:
        for k in L:
            if i != j and i != k and j != k:
                if i + j > k and i + k > j and j + k > i:
                    if i > j > k:
                        ans += 1
                        print(i,j,k)
                    
print(ans)

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



for i in L:
    for j in L:
        for k in L:
            if i != j and i != k and j != k:
                if i + j > k and i + k > j and j + k > i:
                    if i > j > 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()))


count = 0

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

print(count)

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


count = 0

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

print(count)

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

count = 0

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

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):
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)


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


n = int(input())
L = list(map(int,input().split()))
L = list(set(L))
l = len(L)
ans = 0
for i in range(l):
  for j in range(i+1, l):
    for k in range(j+1, l):
      if L[i] + L[j] > L[k] :
        ans += 1
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] and L[i] + L[j] > L[k] :
        ans += 1
print(ans) 
      

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

A.sort()
counter = 0
print(A)
for i in A:
  print('i:'+str(i))
  second = [m for m in A if i < m]
  for j in second:
    print('j:'+str(j))
    third = [n for n in second if j < n]
    if len(third) > 0:
      for k in third:
      	counter += 1
      	print(i,j,third[0])
print(counter)

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

A.sort()
counter = 0
for i in A:
  second = [m for m in A if i < m]
  for j in second:
    third = [n for n in second if j < n]
    if len(third) > 0:
      for k in third:
        if i + j > k:
          counter += 1
print(counter)

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()))
a=0
for i in range(n):
  for j in range(i+1, n):
    for k in range(j+1, n):
      tot = l[i]+l[j]+l[k]
      maxl = max(l[i],l[j],l[k])
      if l[i]!=l[j] and l[i]!=l[k] and l[j]!=l[k] and tot>2*maxl:
        a+=1
        print(i,j,k)
print(a)

n=int(input())
l=list(map(int, input().split()))
a=0
for i in range(n):
  for j in range(i+1, n):
    for k in range(j+1, n):
      tot = l[i]+l[j]+l[k]
      maxl = max(l[i],l[j],l[k])
      if l[i]!=l[j] and l[i]!=l[k] and l[j]!=l[k] and tot>2*maxl:
        a+=1
print(a)

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=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)

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])
                
                b+=c_i*c_m*c_n

print(b)

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 < 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)

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)

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

print(score)

N = int(input())

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

le = len(L)

score = 0

for i in range(le):
    for j in range(i+1,le):
        for k in range(j+1,le):
            if (L[i] + L[j] > L[k] and
                L[i] + L[k] > L[j] and
                    L[k] + L[j] > L[i] ):
                         if (L[i] != L[j] and
                            L[i] != L[k] and
                            L[k] != L[j]):
                                score += 1

print(score)

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())
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)
      

N = int(input())
L= list(map(int, input().split()))
Ls = list(set(L))
res=[]
for i in range(len(Ls)):
  for j in range(i+1,len(Ls)):
    for k in range(j+1,len(Ls)):
      tmp=[Ls[i],Ls[j],Ls[k]]
      if sum(tmp) > 2*max(tmp):
        res.append(tmp)
        
c=0
for i in range(len(res)):
  ctmp=L.count(res[i][0])*L.count(res[i][1])*L.count(res[i][2])
  c+=ctmp
print(c)

Verdicts: Runtime Error

Accepted