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

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


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

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 = 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 len(set([l[i], l[j], l[k]])) == 3 and max(l[i], l[j], l[k]) < sum([l[i], l[j], l[k]]) - max(l[i], l[j], l[k]):
                    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 len(set([l[i], l[j], l[k]])) == 3 and max(l[i], l[j], l[k]) < sum([l[i], l[j], l[k]]) - max(l[i], l[j], l[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):
N=int(input())
s=list(map(int,input().split()))
s.sort()
cnt=0
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[k]>s[j] and s[j]+s[k]>s[i]:
                if s[i]!=s[j] and s[i]!=s[k] and s[j]!=s[k]:
                    print(i,j,k)
                    cnt+=1
            else:
                break
print(cnt)

N=int(input())
s=list(map(int,input().split()))
s.sort()
cnt=0
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[k]>s[j] and s[j]+s[k]>s[i]:
                if s[i]!=s[j] and s[i]!=s[k] and s[j]!=s[k]:
                    cnt+=1
            else:
                break
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())

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

li = list(itertools.combinations(li, 3))

# print(li)
count = 0

for i in li:
    print(i)
    amari = sum(i) - max(i)
    if amari > max(i):
        if len(set(i)) == 3:
            count += 1

print(count)




import itertools

n = int(input())

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

li = list(itertools.combinations(li, 3))

count = 0

for i in li:
    amari = sum(i) - max(i)
    if amari > max(i):
        if len(set(i)) == 3:
            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())

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

print(count)


n = int(input())

list1 = input().split()
list2 = []
for i in range(0,len(list1)):
    list2.append(int(list1[i]))
count = 0
if(n<=2):
    count = 0
for i in range(n):
    if(i+2==len(list2)):
        continue
    for j in range(i+1,n):
        if(i+1==len(list2)):
            continue
        for k in range(j+1,n):
            if(list2[i] != list2[j] and list2[i] != list2[k] and list2[j] != list2[k]):
                ma = max(list2[i],list2[j],list2[k])
                mi = min(list2[i],list2[j],list2[k])
                tyuukann = list2[i]+list2[j]+list2[k]-ma-mi
                if(ma<mi+tyuukann):
                    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):
import collections

def main():
    n = int(input())
    l = list(map(int, input().split()))
    
    if n<3:
        print(0)
        return
    
    leng = n
    ans = 0
    for i in range(leng-2):
        a = l[i]
        for j in range(i+1, leng-1):
            b = l[j]
            if a==b:
                continue
            
            for j in range(j+1, leng):
                c = l[j]
                if c==a or c==b:
                    continue
                print(a,b,c)
                if a<b+c:
                    if b<c+a:
                        if c<a+b:
                            ans += 1
    print(ans)

if __name__ == "__main__":
    main()

import collections

def main():
    n = int(input())
    l = list(map(int, input().split()))
    
    if n<3:
        print(0)
        return
    
    leng = n
    ans = 0
    for i in range(leng-2):
        a = l[i]
        for j in range(i+1, leng-1):
            b = l[j]
            if a==b:
                continue
            
            for j in range(j+1, leng):
                c = l[j]
                if c==a or c==b:
                    continue
                
                if a<b+c:
                    if b<c+a:
                        if c<a+b:
                            ans += 1
    print(ans)

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):
from itertools import combinations
import numpy as np

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

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

print(count)


from itertools import combinations

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

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

  print(count)


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

a = 0
for i in itertools.permutations(l,3):
    if i[0] < i[1] and i[1] < i[2] and i[2]*i[2] == i[0]*i[0] + i[1]*i[1]:
        a += 1

print(a)


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

a = 0
for i in itertools.permutations(l,3):
    if i[0] < i[1] and i[1] < i[2] and i[0] + i[1] > i[2] and i[0] + i[2] > i[0] and i[1] + i[2] > i[0]:
        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 = set(map(int, input().split()))
A = list(A)
a_len = len(A)
answer = []
for i in range(0, a_len-2):
  for j in range(i+1, a_len-1):
    for k in range(j+1, a_len):
      answer.append([A[i], A[j], A[k]])

answer_len = len(answer)
print(f"{answer_len}")


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

N = int(input())
A = list(map(int, input().split()))
A = sorted(A)
a_len = len(A)
answer = []
for i in range(0, a_len-2):
  for j in range(i+1, a_len-1):
    for k in range(j+1, a_len):
      answer.append([A[i], A[j], A[k]])

answer = [i for i in answer if mulit(i)]
answer_len = len(answer)
print(f"{answer_len}")

def mulit(a):
  a_copy = list(a)
  return len(a) == len(set(a_copy))
def isTriangle(x):
  return x[0] + x[1] > x[2]

N = int(input())
A = list(map(int, input().split()))
A = sorted(A)
a_len = len(A)
answer = []
for i in range(0, a_len-2):
  for j in range(i+1, a_len-1):
    for k in range(j+1, a_len):
      answer.append([A[i], A[j], A[k]])
      
answer = [i for i in answer if mulit(i)]
answer = [i for i in answer if isTriangle(i)]
answer_len = len(answer)
print(f"{answer_len}")


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

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

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

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

print(ans)


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

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

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

print(ans)


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

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

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

print(ans)


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

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

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

print(ans)

Verdicts: 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().strip().split()))
print(L);
t_count = 0;
three_numbers = list(itertools.combinations(L, 3))
print(three_numbers)

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

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

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

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

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

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

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

import itertools
N = int(input())
L = list(map(int, input().strip().split()))
#print(L);
t_count = 0;
three_numbers = list(itertools.combinations(L, 3))
#print(three_numbers)

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

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

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

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()))
ans=0
for a in l:
  for b in l:
    for c in l:
      if (a==b or b==c or a==c):
        continue
      if max([a,b,c])<a+b+c-max([a,b,c]):
        ans+=1
print(ans)

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


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 = input()
t = map(int,input().split())
cnt = 0
list = itertools.combinations(t,3)
for i in list:
    if i[0]+i[1]>i[2] and i[1]+i[2]>i[0] and i[2]+i[0]>i[1] and i[0]!=i[1] and i[1]!=i[2] and i[2]!=i[0]:
        cnt += 1
        print(i)

print(cnt)

import itertools
N = input()
t = map(int,input().split())
cnt = 0
list = itertools.combinations(t,3)
for i in list:
    if i[0]+i[1]>i[2] and i[1]+i[2]>i[0] and i[2]+i[0]>i[1]:
        cnt += 1

print(cnt)


import itertools
N = input()
t = map(int,input().split())
cnt = 0
list = itertools.combinations(t,3)
for i in list:
    if i[0]+i[1]>i[2] and i[1]+i[2]>i[0] and i[2]+i[0]>i[1] and i[0]!=i[1] and i[1]!=i[2] and i[2]!=i[0]:
        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())
boulist=list(map(int,input().split()))
boulist.sort(reverse=True)

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

print(count)




n=int(input())
boulist=list(map(int,input().split()))
boulist.sort(reverse=True)
print(boulist)
count=0
for i in range(n):
  for j in range(i,n):
    for k in range(j,n):
      if boulist[j] != boulist[k] and boulist[i] != boulist[j] and boulist[i]+boulist[j]>boulist[k]:
        count+=1

print(count)




n=int(input())
boulist=list(map(int,input().split()))
boulist.sort(reverse=True)

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

print(count)




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

l=int(input())
n= list(map(int, input().split()))
ans=0
for i in range(l-2):
    for j in range(i+1,l-1):
        if n[i]==n[j]:
            pass
        else:
            for k in range(j+1,l):
                if n[i]==n[k] or n[j]==n[k]:
                    pass
                else:
                    z=max(n[i],n[j],n[k])
                    if n[i]+n[k]+n[j]-z>z:
                        ans+=1
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
for i in range(n):
  for j in range(n):
    for k in range(n):
      if i != j and j != k:
        if i + j > k:
          if j + k > i:
            if k + i > 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(n):
    for k in range(n):
      if l[i] != l[j] and l[j] != l[k] and l[k] != l[i]:
        if i + j > k:
          if j + k > i:
            if k + i > j:
              ans += 1
              
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 j != k and k != i:
        if i + j > k:
          if j + k > i:
            if k + i > 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(n):
    for k in range(n):
      if l[i] != l[j] and l[j] != l[k]:
        if i + j > k:
          if j + k > i:
            if k + i > j:
              ans += 1
              
print(ans)


def factorial_cor(n):
    fact = 1
    for integer in range(1, n + 1):
        fact *= integer
    return fact
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 j != k and k != i:
        if i + j > k:
          if j + k > i:
            if k + i > j:
              ans += 1
              
              
          
print(ans // factorial_cor(3))


Verdicts: 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):
#B
N = int(input())
L = list(map(int, input().split()))
M = 0
for i in range(N):
    for j in range(N):
        for k in range(N):
                if i != j and j != k and i != k:
                    if i+j >= k or j+k >= i or i+k >= j :
                        M += 1        

print(M)

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

print(M)

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

print(M)

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

print(M)

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

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

print(ans)


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

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

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

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

N = int(input())
L = map(int, input().split())
cnt = 0
for i in range(N-2):
        # L[i]
    for j in range(i+1,N-1):
        # L[j]
        for k in range(j+1,N):
            print(i,j,k)
            if L[i] == L[j] or L[i] == L[k] or L[j] == L[k]:
                continue
            if L[i] + L[j] <= L[k] or L[i] + L[k] <= L[j] or L[j] + L[k] <= L[i]:
                continue
            cnt += 1
print(cnt)

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

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())
if n < 3:
  print(0)
  exit()
l = map(int,input().split())
l.sort()
c = 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] and l[j] != l[k]:
        c += 1
print(c)

n = int(input())
if n < 3:
  print(0)
  exit()
l = map(int,input().split())
l = sorted(l)
c = 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] and l[j] != l[k]:
        c += 1
print(c)


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().rstrip())
edgeList = sorted([int(_) for _ in input().rstrip().split(" ")])n = int(input().rstrip())
edgeList = [int(_) for _ in input().rstrip().split(" ")]
cnt = 0
for i in range(n):
  for j in range(i+1, n):
    if edgeList[i] != edgeList[j]:
      for k in range(j+1, n):
        cnt += (edgeList[i] != edgeList[k] and 
                edgeList[j] != edgeList[k] and 
                edgeList[i] + edgeList[j] > edgeList[k] and 
                edgeList[j] + edgeList[k] > edgeList[i] and 
                edgeList[k] + edgeList[i] > edgeList[j])
print(cnt)

n = int(input().rstrip())
edgeList = [int(x) for x in input().rstrip().split(" ")]
cnt = 0
for i in range(n-2):
  for j in range(i+1, n-1):
    if edgeList[i] != edgeList[j]:
      for k in range(j+1, n):
        cnt += (edgeList[i] != edgeList[k] and 
                edgeList[j] != edgeList[k] and 
                edgeList[i] + edgeList[j] > edgeList[k] and 
                edgeList[j] + edgeList[k] > edgeList[i] and 
                edgeList[k] + edgeList[i] > edgeList[j])
print(cnt)

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(i) for i in input().split()]

l.sort()

def func(one,two,three):
  if len(set([one,two,three]))==3 and one+two>three:
    return True
  return False

ans=0
for i in range(n-2):
  for j in range(i+1,n-1):
    for k in range(j+1,n):
      one=l[i]
      two=l[j]
      three0l[k]
      if func(one,two,three):
        ans+=1
        
print(ans)
      

n=int(input())
l=[int(i) for i in input().split()]
 
l.sort()
 
def func(one,two,three):
  if len({one,two,three})==3 and one+two>three:
    return True
  return False
 
ans=0
for i in range(n-2):
  for j in range(i+1,n-1):
    for k in range(j+1,n):
      one=l[i]
      two=l[j]
      three=l[k]
      if func(one,two,three):
        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()))
c = 0
i = 1
while i < n:
  j = i + 1
  while j < n:
    k = j + 1
    while k < n:
      if l[i] != l[j] and l[j] != l[k] and l[k] != l[i] and abs(l[j]-l[k]) < l[i] < l[j] + l[k]:
        c += 1
      k += 1
    j += 1
  i += 1
print(c)


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

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

N = int(input())

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

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


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


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

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

import math
import itertools

N = int(input())

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

for num in line_set:
    cnt = line.count(num)
    dic[num] = cnt
    
pattern = list(itertools.combinations(line_set, 3))

sum_ = 0
for lis in pattern:
    a, b, c = lis
    if a + b > c and b + c > a and a + c > b:
        sum_ += dic[a]*dic[b]*dic[c]
print(sum_)

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()))
c = 0

for i in range(N):
  for j in range(i+1,N):
    for k in range(j+1,N):
      if i!=j and j!=k and k!=i:
        if i + j + k > 2 * max(i,j,k):
          c +=1

print(c)

N = int(input())
l = []
c = 0

for i in range(1,N+1):
  a = int(input())
  l.append(a)

for j in range(1,N+1):
  for k in range(1,N+1):
    if j == k:
      continue
    for m in range(1,N+1):
      if (j == m) or (k == m):
        continue
      if (l[j] + l[k] > l[m]) or (l[j] + k[m] > l[k]) or (l[k] + l[m] > l[j]):
        c += 1

print(c)

N=int(input())
l=[]
c=0

for i in range(N):
  a = int(input())
  l.append(a)

for j in range(N):
  for k in range(j+1,N):
    for m in range(k+1,N):
      if (l[j]==l[k] or l[k]==l[m] or l[j]==l[m]):
        continue
      if ((l[j] + l[k] > l[m]) and (l[k] + l[m] > l[j]) and (l[j] + l[m] > l[k])):
        c += 1

print(c)


N = int(input())
l = []
c = 0

for i in range(N):
  a = int(input())
  l.append(a)

for j in range(N):
  for k in range(j+1,N):
    for m in range(k+1,N):
      if (l[j] + l[k] > l[m]) and (l[k] + l[m] > l[j]) and (l[j] + l[m] > l[k]):
        c += 1

print(c)


N=int(input())
l=[]
c=0

for i in range(N):
	a = int(input())
	l.append(a)

for j in range(N):
  	for k in range(j+1,N):
    	for m in range(k+1,N):
      		if l[j]==l[k] or l[k]==l[m] or l[j]==l[m]:
        		continue
      		if (l[j] + l[k] > l[m]) and (l[k] + l[m] > l[j]) and (l[j] + l[m] > l[k]):
        		c += 1

print(c)


N = int(input())
l = []
c = 0

for i in range(N):
  a = int(input())
  l.append(a)

for j in range(N):
  for k in range(j+1,N):
    for m in range(k+1,N):
      if l[j]==l[k] or l[k]==l[m] or l[j]==l[m]:
        continue
      if (l[j] + l[k] > l[m]) and (l[k] + l[m] > l[j]) and (l[j] + l[m] > l[k]):
        c += 1

print(c)

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

Verdicts: Wrong Answer

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

FF= []

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

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

FF= []

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

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

FF= []

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

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

FF= []

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

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):
mport itertools as it


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


c = it.combinations(s, 3)

for i in c:
    if i[0] == i[1] or i[1] == i[2] or i[2] == i[0]:
        continue
    if (i[0] + i[1]) > i[2]:
        count += 1

print(count)

import itertools as it


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


c = it.combinations(s, 3)

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

n = int(input())
l = list(map(int, input().split()))
cnt = 0
for i in range(len(l)):
    for j in range(i, len(l)):
        for k in range(j, len(l)):
            if i != j and j != k and k != i:
                if i <= j <= k <= 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]:
                            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 sys
n = int(input())
l = list(map(int,input().split()))
counter = 0
if n < 3:
    print(0)
    sys.exit(0)
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            data0 = l[i]
            data1 = l[j]
            data2 = l[k]
            if (data0 != data1) and (data0 != data2) and (data1 != data2):
                if (data0 + data1 + data2 - max(data0,data1,data2)*2) > 0:
                    print(str(i+1) + ' ' + str(j+1) + ' ' + str(k+1))
                    counter += 1    
print(counter)

import sys
n = int(input())
l = list(map(int,input().split()))
counter = 0
if n < 3:
    print(0)
    sys.exit(0)
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            data0 = l[i]
            data1 = l[j]
            data2 = l[k]
            if (data0 != data1) and (data0 != data2) and (data1 != data2):
                if (data0 + data1 + data2 - max(data0,data1,data2)*2) > 0:
                    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()))
l.sort()

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

n = int(input())

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

count = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            if l[i] + l[j] > l[k] and len(set([l[i], l[j], l[k]])) == 3:
                # print(i+1, j+1, k+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):
def ab(a,b,c):
	if((a+b>c) and (a+c>b) and (b+c>a)):
		return 1
	else:
		return 0
n=input()
n=int(n)
l=get_array()
c=0
for i in range(n):
	for j in range(i+1,n):
		for k in range(j+1,n):
			if(l[i]!=l[j] and l[j]!=l[k] and l[k]!=l[i]):
				if(ab(l[i],l[j],l[k])):
					#print(i,j,k)
					c+=1
print(c)	

def get_array():
    l=list(map(int, input().split()))
    return l
def ab(a,b,c):
	if((a+b>c) and (a+c>b) and (b+c>a)):
		return 1
	else:
		return 0
n=input()
n=int(n)
l=get_array()
c=0
for i in range(n):
	for j in range(i+1,n):
		for k in range(j+1,n):
			if(l[i]!=l[j] and l[j]!=l[k] and l[k]!=l[i]):
				if(ab(l[i],l[j],l[k])):
					#print(i,j,k)
					c+=1
print(c)	

Verdicts: Runtime Error

Accepted