TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: We have a two-dimensional grid with H \times W squares. There are M targets to destroy in this grid - the position of the i-th target is \left(h_i, w_i \right).  Takahashi will choose one square in this grid, place a bomb there, and ignite it. The bomb will destroy all targets that are in the row or the column where the bomb is placed. It is possible to place the bomb at a square with a target.  Takahashi is trying to maximize the number of targets to destroy. Find the maximum number of targets that can be destroyed.

Submission attempts (in order):
import numpy as np

def solve(H, W, M, h, w):
    f = [0] * H
    g = [0] * W
    for r, c in zip(h, w):
        f[r-1] += 1
        g[c-1] += 1
    r = np.argmax(f)
    c = np.argmax(g)
    print(f[r], g[c])
    return f[r] + g[c] - int((r+1, c+1) in set(zip(h, w)))

H, W, M = map(int, input().split())
h, w = zip(*[map(int, input().split()) for i in range(M)])
print(solve(H, W, M, h, w))


import numpy as np

def solve(H, W, M, h, w):
    f = [0] * (H+1)
    g = [0] * (W+1)
    for r, c in zip(h, w):
        f[r] += 1
        g[c] += 1
    r = np.argmax(f)
    c = np.argmax(g)
    return f[r] + g[c] - int((r, c) in set(zip(h, w)))

H, W, M = map(int, input().split())
h, w = zip(*[map(int, input().split()) for i in range(M)])
print(solve(H, W, M, h, w))

def solve(H, W, M, h, w):
    f = [0] * (H+1)
    g = [0] * (W+1)
    for r, c in zip(h, w):
        f[r] += 1
        g[c] += 1
    p = max(f)
    q = max(g)
    num = len(list(filter(p.__eq__, f))) * len(list(filter(q.__eq__, g)))
    num -= len(list(filter(lambda _: f[_[0]] + g[_[1]] == p + q, zip(h, w))))
    return p + q - (num <= 0)

H, W, M = map(int, input().split())
h, w = zip(*[map(int, input().split()) for i in range(M)])
print(solve(H, W, M, h, w))

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: We have a two-dimensional grid with H \times W squares. There are M targets to destroy in this grid - the position of the i-th target is \left(h_i, w_i \right).  Takahashi will choose one square in this grid, place a bomb there, and ignite it. The bomb will destroy all targets that are in the row or the column where the bomb is placed. It is possible to place the bomb at a square with a target.  Takahashi is trying to maximize the number of targets to destroy. Find the maximum number of targets that can be destroyed.

Submission attempts (in order):
H, W, M = map(int, input().split())
bom = [[0]*W for _ in range(H)]
row = [0] * H
col = [0] * W

for _ in range(M):
    h, w = map(int, input().split())
    bom[h-1][w-1] += 1
    row[h-1] += 1
    col[w-1] += 1

max_row = max(row)
max_col = max(col)
ans = max_row + max_col - 1

max_ix_row = [i for i, v in enumerate(row) if v == max_row]
max_ix_col = [i for i, v in enumerate(col) if v == max_col]

flag = False
"""
for i in max_ix_row:
    for j in max_ix_col:
        if not bom[i][j]:
            ans += 1
            flag = True
            break
    
    if flag:
        break"""

print(ans)


H, W, M = map(int, input().split())
bom = set()
row = [0] * H
col = [0] * W

for _ in range(M):
    h, w = map(int, input().split())
    bom.add((h-1, w-1))
    row[h-1] += 1
    col[w-1] += 1

max_row = max(row)
max_col = max(col)
ans = max_row + max_col - 1

p, q = [], []

for i in range(H):
    if row[i] == max_row:
        p.append(i)

for j in range(W):
    if col[j] == max_col:
        q.append(j)

flag = False
for i in p:
    for j in q:
        if (i, j) not in bom:
            ans += 1
            flag = True
            break
    if flag:
        break

print(ans)


Verdicts: Runtime Error

Accepted
Problem: We have a two-dimensional grid with H \times W squares. There are M targets to destroy in this grid - the position of the i-th target is \left(h_i, w_i \right).  Takahashi will choose one square in this grid, place a bomb there, and ignite it. The bomb will destroy all targets that are in the row or the column where the bomb is placed. It is possible to place the bomb at a square with a target.  Takahashi is trying to maximize the number of targets to destroy. Find the maximum number of targets that can be destroyed.

Submission attempts (in order):
H, W, M = map(int, input().split())

h = [0] * W
w = [0] * H
Mem = []
for _ in range(M):
  i, j = map(int, input().split())
  Mem.append((i, j))
  h[i-1] += 1
  w[j-1] += 1

h_idx = h.index(max(h))
w_idx = w.index(max(w))

ans = max(h) + max(w)
if (h_idx + 1, w_idx + 1) in Mem:
  ans -= 1

print(ans)

H, W, M = map(int, input().split())
 
h = [0] * H
w = [0] * W
Mem = [tuple(map(int, input().split())) for _ in range(M) ]
for i, j in Mem:
  h[i-1] += 1
  w[j-1] += 1

maxh = max(h)
maxw = max(w)
 
listh = {i for i, v in enumerate(h, 1) if v == maxh}
listw = {j for j, v in enumerate(w, 1) if v == maxw}

cnt = len(listh) * len(listw)

for i, j in Mem:
  if i in listh and j in listw:
    cnt -= 1
 
if cnt:
  ans = maxh + maxw
else:
  ans = maxh + maxw - 1

print(ans)

Verdicts: Runtime Error

Accepted
Problem: We have a two-dimensional grid with H \times W squares. There are M targets to destroy in this grid - the position of the i-th target is \left(h_i, w_i \right).  Takahashi will choose one square in this grid, place a bomb there, and ignite it. The bomb will destroy all targets that are in the row or the column where the bomb is placed. It is possible to place the bomb at a square with a target.  Takahashi is trying to maximize the number of targets to destroy. Find the maximum number of targets that can be destroyed.

Submission attempts (in order):
H, W, M = map(int, input().split())
A = [list(map(int, input().split())) for i in range(M)]

b = 0
indexh = 0
indexw = 0
takasa = []
haba = []
ans = 0

for i in range(1, H+1):
    for j in range(M):
        if A[j][0] == i:
            b += 1
    takasa.append(b)
    b=0

for i in range(1, W+1):
    for j in range(M):
        if A[j][1] == i:
            b += 1
    haba.append(b)
    b=0

ans = max(takasa) + max(haba)
if [takasa.index(max(takasa))+1, haba.index(max(haba))+1] in A:
    ans -= 1
print(ans)

H, W, M = map(int, input().split())
A = [list(map(int, input().split())) for i in range(M)]

hl, wl = [0]*H, [0]*W
for i,j in A:
    hl[i-1] += 1
    wl[j-1] += 1

mt,mh = max(hl),max(wl)

a = 0
for i,j in A:
    if hl[i-1] == mt and wl[j-1] == mh:
        a += 1

print(mt+mh-1 if a == hl.count(mt) * wl.count(mh) else mt+mh)

Verdicts: Wrong Answer

Accepted
Problem: We have a two-dimensional grid with H \times W squares. There are M targets to destroy in this grid - the position of the i-th target is \left(h_i, w_i \right).  Takahashi will choose one square in this grid, place a bomb there, and ignite it. The bomb will destroy all targets that are in the row or the column where the bomb is placed. It is possible to place the bomb at a square with a target.  Takahashi is trying to maximize the number of targets to destroy. Find the maximum number of targets that can be destroyed.

Submission attempts (in order):
H,W,M=map(int,input().split())
mine=[list(map(int,input().split()))for i in range(M)]
mine_h=[0]*H
mine_w=[0]*W
ans=0
for i in range(M):
    mine_h[mine[i][0]-1]+=1
max_h=max(mine_h)
for i in mine_h:
    tmp=0
    if i ==max_h:
        mine_w=[0]*W
        for j in range(M):
            if mine[j][0]-1!=i:
                mine_w[mine[j][0]-1]+=1
        tmp=max_h+max(mine_w)
        if tmp>ans:
            ans=tmp
print(ans)


H,W,M=map(int,input().split())
mine_h=[0]*H
mine_w=[0]*W
val=-1
mine=set()
for i in range(M):
    a,b=map(int,input().split())
    mine_h[a-1]+=1
    mine_w[b-1]+=1
    mine.add((a,b))
max_h=max(mine_h)
max_w=max(mine_w)
h_index=[i+1 for i, x in enumerate(mine_h)if x == max_h]
w_index=[i+1 for i, x in enumerate(mine_w)if x == max_w]
for i in h_index:
    for j in w_index:
        if (i,j) in mine:
            continue
        else:
            val=0
            break
print(max_h+max_w+val)

Verdicts: Runtime Error

Accepted
Problem: We have a two-dimensional grid with H \times W squares. There are M targets to destroy in this grid - the position of the i-th target is \left(h_i, w_i \right).  Takahashi will choose one square in this grid, place a bomb there, and ignite it. The bomb will destroy all targets that are in the row or the column where the bomb is placed. It is possible to place the bomb at a square with a target.  Takahashi is trying to maximize the number of targets to destroy. Find the maximum number of targets that can be destroyed.

Submission attempts (in order):
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  H,W,M=LI()
  h=[0]*H
  w=[0]*W
  lh=[]
  lw=[]
  d={}
  for _ in range(M):
    a,b=LI()
    a-=1
    b-=1
    lh.append(a)
    lw.append(b)
    h[a]+=1
    w[b]+=1
    d[(a,b)]=1

  h_koho=[]
  w_koho=[]

  h_max=max(h)
  w_max=max(w)

  for i,x in enumerate(lh):
    if x==h_max:
      h_koho.append(x)
  for i,x in enumerate(lw):
    if x==w_max:
      w_koho.append(x)

  for x in h_koho:
    for y in w_koho:
      if (x,y) not in d:
        return h_max+w_max

  return h_max+w_max-1

# main()
print(main())


import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  H,W,M=LI()
  h=[0]*H
  w=[0]*W
  d={}
  for _ in range(M):
    a,b=LI()
    a-=1
    b-=1
    h[a]+=1
    w[b]+=1
    d[(a,b)]=1

  h_koho=[]
  w_koho=[]

  h_max=max(h)
  w_max=max(w)

  for i,x in enumerate(h):
    if x==h_max:
      h_koho.append(i)
  for i,x in enumerate(w):
    if x==w_max:
      w_koho.append(i)

  for x in h_koho:
    for y in w_koho:
      if (x,y) not in d:
        return h_max+w_max

  return h_max+w_max-1

# main()
print(main())


Verdicts: Wrong Answer

Accepted
Problem: We have a two-dimensional grid with H \times W squares. There are M targets to destroy in this grid - the position of the i-th target is \left(h_i, w_i \right).  Takahashi will choose one square in this grid, place a bomb there, and ignite it. The bomb will destroy all targets that are in the row or the column where the bomb is placed. It is possible to place the bomb at a square with a target.  Takahashi is trying to maximize the number of targets to destroy. Find the maximum number of targets that can be destroyed.

Submission attempts (in order):
H, W, M = map(int, input().split())
lis =[]
Hlis = [0]*H
Mlis = [0]*M
for _ in range(M):
    Ch, Cm = map(int, input().split())
    Hlis[Ch-1] += 1
    Mlis[Cm-1] += 1
    lis.append([Ch, Cm])

Hmax = max(Hlis)
Hidx = Hlis.index(Hmax)+1
Mmax = max(Mlis)
Midx = Mlis.index(Mmax)+1

if [Hidx, Midx] in lis:
    print(Hmax + Mmax -1)
else:
    print(Hmax+Mmax)

import sys
H, W, M = map(int, input().split())
lis =set()
Hlis = [0]*H
Wlis = [0]*W
for _ in range(M):
    Ch, Cm = map(int, input().split())
    Hlis[Ch-1] += 1
    Wlis[Cm-1] += 1
    lis.add((Ch, Cm))

Hmax = max(Hlis)
Hidx = [i+1 for i, v in enumerate(Hlis) if v == Hmax]
Wmax = max(Wlis)
Widx = [i+1 for i, v in enumerate(Wlis) if v == Wmax]

for i in range(len(Hidx)):
    for j in range(len(Widx)):
        if (Hidx[i], Widx[j]) not in lis:
            print(Hmax+Wmax)
            sys.exit()
else:
    print(Hmax + Wmax -1)

Verdicts: Runtime Error

Accepted
Problem: We have a two-dimensional grid with H \times W squares. There are M targets to destroy in this grid - the position of the i-th target is \left(h_i, w_i \right).  Takahashi will choose one square in this grid, place a bomb there, and ignite it. The bomb will destroy all targets that are in the row or the column where the bomb is placed. It is possible to place the bomb at a square with a target.  Takahashi is trying to maximize the number of targets to destroy. Find the maximum number of targets that can be destroyed.

Submission attempts (in order):
H,W,M = map(int,input().split())
Hlist= {}
Wlist ={}
HWlist = []
for i in range(M):
    h,w = map(int,input().split())
    if h not in Hlist:
        Hlist[h] = 1
    else:
        Hlist[h] += 1
    if w not in Wlist:
        Wlist[w] = 1
    else:
        Wlist[w] += 1
    HWlist.append([h,w])
h = max([(v,k) for k,v in Hlist.items()])[1]
w = max([(v,k) for k,v in Wlist.items()])[1]
Answer = Hlist[h] + Wlist[w]
if [h,w] in HWlist:
    Answer -= 1
print(Answer)

H,W,M = map(int,input().split())
Hlist= {}
Wlist ={}
HWlist = []
for i in range(M):
    h,w = map(int,input().split())
    if h not in Hlist:
        Hlist[h] = 1
    else:
        Hlist[h] += 1
    if w not in Wlist:
        Wlist[w] = 1
    else:
        Wlist[w] += 1
    HWlist.append([h,w])
h2 = max([(v,k) for k,v in Hlist.items()])
h = h2[1]
hmax = h2[0]
Dua2 = []
for k,v in Hlist.items():
    if v == hmax:
        Dua2.append(k)
w2 = max([(v,k) for k,v in Wlist.items()])
w = w2[1]
wmax = w2[0]
Dua = []
for k,v in Wlist.items():
    if v == wmax:
        Dua.append(k)
Answer = Hlist[h] + Wlist[w]
Wld = set()
Hld = set()
sign = 0
for i in range(M):
    if HWlist[i][0] == h:
        Wld.add(HWlist[i][1])
for _ in range(len(Dua)):
    if Dua[_] not in Wld:
        break
    elif _ == len(Dua)-1:
        sign -= 1
for i in range(M):
    if HWlist[i][1] == w:
        Hld.add(HWlist[i][0])
for _ in range(len(Dua2)):
    if Dua2[_] not in Hld:
        break
    elif _ == len(Dua2)-1:
        sign -= 1
if sign == -2:
    Answer -= 1
print(Answer)

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())
hen = []

hen = list(int(x) for x in input().split())


hen_u = set(hen.sort())

tri = 0

for a in hen_u:
    for b in hen_u:
        if(a == b):
            continue
        for c in hen_u:
            if(a == c)or(b == c):
                continue
            if(a+b >c)and(b+c >a)and(c+a >b):
                tri += 1

print(tri)

N = int(input())
hen = []

hen = list(int(x) for x in input().split())
hen.sort()



tri = 0

for a in hen:
    for b in hen:
        if(a == b)or (a > b):
            continue
        for c in hen:
            if(a == c)or(b == c) or (a > c) or (b > c):
                continue
            if(a+b >c)and(b+c >a)and(c+a >b):
                tri += 1

print(tri)

Verdicts: Runtime Error

Accepted
Problem: We have sticks numbered 1, \cdots, N. The length of Stick i (1 \leq i \leq N) is L_i.  In how many ways can we choose three of the sticks with different lengths that can form a triangle?  That is, find the number of triples of integers (i, j, k) (1 \leq i < j < k \leq N) that satisfy both of the following conditions:    * L_i, L_j, and L_k are all different.   * There exists a triangle whose sides have lengths L_i, L_j, and L_k.

Submission attempts (in order):
n = int(input())
l = map(int,input().split())
if len(l) < 3:
  print(0)
  exit()
count = 0
l = sorted(l)
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]:
        count += 1
print(count)
    

n = int(input())
l = map(int,input().split())
count = 0
if len(l) < 3:
  print(0)
  exit()
l = sorted(l)
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]:
        count += 1
print(count)
    

n = int(input())
l = list(map(int,input().split()))
if len(l) < 3:
  print(0)
  exit()
count = 0
l = sorted(l)
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]:
        count += 1
print(count)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: We have sticks numbered 1, \cdots, N. The length of Stick i (1 \leq i \leq N) is L_i.  In how many ways can we choose three of the sticks with different lengths that can form a triangle?  That is, find the number of triples of integers (i, j, k) (1 \leq i < j < k \leq N) that satisfy both of the following conditions:    * L_i, L_j, and L_k are all different.   * There exists a triangle whose sides have lengths L_i, L_j, and L_k.

Submission attempts (in order):
N = int(input())
a = list(map(int,input().split()))
s = 0
for i in range(N):
    for j in range(N):
        for k in range(N):
            if a[i] != a[j] and a[j] != a[k] and a[i] != a[k] and i<j and j<k:
                if a[i]**2<a[j]**2+a[k]**2 or a[j]**2<a[i]**2+a[k]**2 or a[k]**2<a[i]**2+a[j]**2:
                    s += 1
print(s)

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

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 = sorted(l, reverse = True)

cnt = 0

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

print(cnt)

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

cnt = 0

for i in range(0, n-2):
    t = l[i]
    for b in range(i+1, n-1):
        s = l[b]
        if (t != s):
            for k in range(b+1, n):
                a = s + l[k]
                if(a > t and s != l[k]):
                    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 numpy as np
from numba import *

import sys
read = sys.stdin.buffer.read


# N = int(input())
# length = np.array(input().split(), np.int64)
length = np.array(read.split(), np.int64)[1:]


length = np.sort(length)

@njit((i8[:],), cache=True)
def calc(length):
    cnt = 0
    
    for i in range(N):
        for j in range(i + 1, N):
            for k in range(j + 1, N):
                l1, l2, l3 = length[i], length[j], length[k]
                if (l1 != l2 and l1 != l3 and l2 != l3):
                    if (l1 + l2 > l3):
                        cnt += 1
    
    return (cnt)

ans = calc(length)
print(ans)



import numpy as np
from numba import *

import sys
read = sys.stdin.buffer.read


N = int(input())
# length = np.array(input().split(), np.int64)
length = np.array(read.split(), np.int64)[1:]


length = np.sort(length)

@njit((i8[:],), cache=True)
def calc(length):
    cnt = 0
    
    for i in range(N):
        for j in range(i + 1, N):
            for k in range(j + 1, N):
                l1, l2, l3 = length[i], length[j], length[k]
                if (l1 != l2 and l1 != l3 and l2 != l3):
                    if (l1 + l2 > l3):
                        cnt += 1
    
    return (cnt)

ans = calc(length)
print(ans)



import numpy as np
from numba import *


N = int(input())
length = np.array(input().split(), np.int64)


length = np.sort(length)


def calc(length):
    cnt = 0
    
    for i in range(N):
        for j in range(i + 1, N):
            for k in range(j + 1, N):
                l1, l2, l3 = length[i], length[j], length[k]
                if (l1 != l2 and l1 != l3 and l2 != l3):
                    if (l1 + l2 > l3):
                        cnt += 1
    
    return (cnt)

ans = calc(length)
print(ans)


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):
#! env/bin/local python3
# -*- coding: utf-8 -*-

from itertools import combinations


def is_tri(_a, _b, _c):
    if _a + _b > _c and _b + _c > _a and _c + _a > _b:
        return True
    else:
        return False


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

h = combinations(sticks, 3)

counter = 0
for a, b, c in h:
    if is_tri(a, b, c):
        a, b, c = sorted([a, b, c])
        if a != b and b != c:
            print(a, b, c)
            counter += 1

print(counter)


#! env/bin/local python3
# -*- coding: utf-8 -*-

from itertools import combinations


def is_tri(_a, _b, _c):
    if _a + _b > _c and _b + _c > _a and _c + _a > _b:
        return True
    else:
        return False


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

h = combinations(sticks, 3)

counter = 0
for a, b, c in h:
    if is_tri(a, b, c):
        if a != b and b != c and a != c:
            print(a, b, c)
            counter += 1

print(counter)


#! env/bin/local python3
# -*- coding: utf-8 -*-

from itertools import combinations


def is_tri(_a, _b, _c):
    if (_a + _b > _c) and (_b + _c > _a) and (_c + _a > _b):
        return True
    else:
        return False


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

h = combinations(sticks, 3)

counter = 0
for a, b, c in h:
    if is_tri(a, b, c):
        a, b, c = sorted([a, b, c])
        if (a != b) and (b != c):
            print(a, b, c)
            counter += 1

print(counter)


#! env/bin/local python3
# -*- coding: utf-8 -*-

from itertools import combinations


def is_tri(_a, _b, _c):
    if (_a + _b > _c) and (_b + _c > _a) and (_c + _a > _b):
        return True
    else:
        return False


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

h = combinations(sticks, 3)

counter = 0
for a, b, c in h:
    if is_tri(a, b, c):
        
        if (a != b) and (b != c) and (c != a):
            counter += 1

print(counter)


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())
if n < 3:
  print(0)
else:
  s = 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):
        m = max(s[i], s[j], s[k])
        su = s[i] + s[j] + s[k]
        if m < su - m:
          c += 1
  print(c)

n = int(input())
if n < 3:
  print(0)
else:
  s = 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):
        m = max(s[i], s[j], s[k])
        su = s[i] + s[j] + s[k]
        if m < su - m and s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
          c += 1
          print(i, j, k)
  print(c)

n = int(input())
if n < 3:
  print(0)
else:
  s = 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):
        m = max(s[i], s[j], s[k])
        su = s[i] + s[j] + s[k]
        if m < su - m and s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
          c += 1
  print(c)

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

cnt = 0
for i in range(N):
  for j in range(i + 1, N):
    for k in range(j + 1, N):
      a = L[i]
      b = L[j]
      c = L[k]
      if a == b or b == c or c == a:
        continue
      if a + b < c or b + c < a or c + a < b:
        continue
      cnt += 1
print(cnt)

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):
      a = L[i]
      b = L[j]
      c = L[k]
      if a == b or b == c or c == a:
        continue
      if a + b <= c or b + c <= a or c + a <= b:
        continue
      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):
# -*- coding: utf-8 -*-
N = int(input())
bar = [int(n) for n in input().split(' ')]
count = 0
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 (bar[i] != bar[j]) and (bar[j] != bar[k]) and (bar[k] != bar[i]):
                    if (bar[i] + bar[j] > bar[k]) and (bar[i] + bar[k] > bar[j]) and (bar[k] + bar[j] > bar[i]):
                        count += 1
                        print(bar[i], bar[j], bar[k])

print(count)

# -*- coding: utf-8 -*-
N = int(input())
bar = [int(n) for n in input().split(' ')]
count = 0
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 (bar[i] != bar[j]) and (bar[j] != bar[k]) and (bar[k] != bar[i]):
                    if (bar[i] + bar[j] > bar[k]) and (bar[i] + bar[k] > bar[j]) and (bar[k] + bar[j] > bar[i]):
                        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):
r=int(input())
x=list(map(int,input().split())
setx=list(set(x))
setx.sort()
cx=[]
for i in setx:
    cx.append(x.count(i))
ans=0
A=0
while A<=len(setx)-3:
    B=A+1
    while B<=len(setx)-2:
        C=B+1
        while C<=len(setx)-1:
            if setx[A]+setx[B]>setx[C]:
                ans+=cx[A]*cx[B]*cx[C]
            C+=1
        B+=1
    A+=1
print(ans)

r=int(input())
x=list(map(int,input().split())
setx=list(set(x))
setx.sort()
cx=[]
for i in setx:
    cx.append(x.count(i))
ans=0
A=0
while A<=len(setx)-3:
    B=A+1
    while B<=len(setx)-2:
        C=B+1
        while C<=len(setx)-1:
            if setx[A]+setx[B]>setx[C]:
                ans+=cx[A]*cx[B]*cx[C]
            C+=1
        B+=1
    A+=1
print(ans)

r=int(input())
x=list(map(int,input().split()))
setx=list(set(x))
setx.sort()
cx=[]
for i in setx:
    cx.append(x.count(i))
ans=0
A=0
while A<=len(setx)-3:
    B=A+1
    while B<=len(setx)-2:
        C=B+1
        while C<=len(setx)-1:
            if setx[A]+setx[B]>setx[C]:
                ans+=cx[A]*cx[B]*cx[C]
            C+=1
        B+=1
    A+=1
print(ans)


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


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):
            L2=[L[i],L[j],L[k]]
            L2.sort()
            if L2[0]+L2[1]>L2[2] and L2[0] != L2[1] and L2[1] != L2[2] and L2[2] != L2[0]:
                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 itertools

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

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

import itertools

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

cnt = 0
for v in itertools.combinations(l, 3):
    t = set(v)
    if len(t) == len(v) and (abs(v[0] - v[1]) < v[2] < v[0] + v[1]):
        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())
c=0
for i in range(1,N):
       for j in range(i,N):
       		for k in range(j,N):
       			if l[i]!=l[j] and l[j]!=l[k] and l[k]!=l[i]:
       				if l[i]+l[j]>l[k] and l[j]+l[k]>l[i] and l[i]+l[k]>l[j]:
       							c=c+1
print(c)

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


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

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


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


Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: We have sticks numbered 1, \cdots, N. The length of Stick i (1 \leq i \leq N) is L_i.  In how many ways can we choose three of the sticks with different lengths that can form a triangle?  That is, find the number of triples of integers (i, j, k) (1 \leq i < j < k \leq N) that satisfy both of the following conditions:    * L_i, L_j, and L_k are all different.   * There exists a triangle whose sides have lengths L_i, L_j, and L_k.

Submission attempts (in order):
import itertools

n = int(input())
dt = input()
l = dt.split()
print(l)
count = 0
for team in itertools.combinations(l,3):
    team1 = list(team)
    for i in range(3):
        team1[i] = int(team1[i])
        
    if team1[0] != team1[1] and team1[1] != team1[2] and team1[0] != team1[2]:
        if team1[0] + team1[1] > team1[2] and team1[0] + team1[2] > team1[1] and team1[1] + team1[2] > team1[0]:
            count += 1

print(count)


import itertools

n = int(input())
dt = input()
l = dt.split()
print(l)
count = 0
for team in itertools.combinations(l,3):
    team1 = list(team)
    for i in range(3):
        team1[i] = int(team1[i])
        
    if team1[0] != team1[1] and team1[1] != team1[2] and team1[0] != team1[2]:
        if team1[0] + team1[1] > team1[2] and team1[0] + team1[2] > team1[1] and team1[1] + team1[2] > team1[0]:
            count += 1

print(count)


import itertools

n = int(input())
dt = input()
l = dt.split()
print(l)
count = 0
for team in itertools.combinations(l,3):
    team1 = list(team)
    for i in range(3):
        team1[i] = int(team1[i])
        
    if team1[0] != team1[1] and team1[1] != team1[2] and team1[0] != team1[2]:
        if team1[0] + team1[1] > team1[2] and team1[0] + team1[2] > team1[1] and team1[1] + team1[2] > team1[0]:
            count += 1

print(count)


import itertools

n = int(input())
dt = input()
l = dt.split()
count = 0
for team in itertools.combinations(l,3):
    team1 = list(team)
    for i in range(3):
        team1[i] = int(team1[i])
        
    if team1[0] != team1[1] and team1[1] != team1[2] and team1[0] != team1[2]:
        if team1[0] + team1[1] > team1[2] and team1[0] + team1[2] > team1[1] and team1[1] + team1[2] > team1[0]:
            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):
# a+b > c AND b+c > a AND c+a > b

import itertools
triangle = 0

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


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

print(triangle)

# a+b > c AND b+c > a AND c+a > b

import itertools
triangle = 0

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


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

print(triangle)

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

n=int(input())
li=list(map(int,input().split()))
ans=0
li.sort()
for i in range(0,n-2):
  for j in range(i+1,n-1):
    for k in range(j+1,n):
      if(li[i]+li[j]>li[k] and len(set([li[i],li[j],li[k]]))>2):
        # print(li[i],li[j],li[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):
def sides(a,b,c):
  if a + b > c:
    return True
  return False
res = 0
N = int(input())
nums = list(map(int,input().split()))
nums = sorted(nums)
for x in range(N-2):
  for y in range(x+1,N-1):
    for z in range(y+1,N):
      print(x,y,z)
      print(nums[x],nums[y],nums[z],"nums")
      if nums[x] != nums[y] and nums[x] != nums[z] and nums[y] != nums[z] and sides(x,y,z):
        res += 1
print(res)

def sides(a,b,c):
  if a + b > c:
    return True
  return False
res = 0
N = int(input())
nums = list(map(int,input().split()))
nums = sorted(nums)
for x in range(N-2):
  for y in range(x+1,N-1):
    for z in range(y+1,N):
      if nums[x] != nums[y] and nums[x] != nums[z] and nums[y] != nums[z] and sides(nums[x],nums[y],nums[z]):
        res += 1
print(res)

Verdicts: Wrong Answer

Accepted
Problem: We have sticks numbered 1, \cdots, N. The length of Stick i (1 \leq i \leq N) is L_i.  In how many ways can we choose three of the sticks with different lengths that can form a triangle?  That is, find the number of triples of integers (i, j, k) (1 \leq i < j < k \leq N) that satisfy both of the following conditions:    * L_i, L_j, and L_k are all different.   * There exists a triangle whose sides have lengths L_i, L_j, and L_k.

Submission attempts (in order):
n=int(input())
l=list(map(int,input().split()))
count=0
for i in range (n-2):
    for j in range (i+1,n-1):
        if l[i]==l[j]:
            continue
        l[i]+l[j]
        for k in range (j+1,n):
            if l[k]==l[i] or l[k]==l[l]:
                continue
            if l[k]<l[i]+l[j] and l[i]<l[j]+l[k] and l[j]<l[k]+l[i] :
                count+=1
print(count)
    


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

count=0
for i in range (n-2):
    for j in range (i+1,n-1):
        if l[i]==l[j]:
            continue
        for k in range (j+1,n):
            
            if l[k]==l[i] or l[k]==l[j]:
                continue
            if l[k]<l[i]+l[j] and l[i]<l[j]+l[k] and l[j]<l[k]+l[i] :
                count+=1
print(count)
    



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

ans = 0
for ele in list2:
    a = ele[0]
    b = ele[1]
    c = ele[2]
    if a == b or b == c or c == a:
        continue
    if abs(a-b) < c and c < a+b:
        ans += 1
print(ans//6)



import itertools

n = int(input())
list = list(map(int, input().split()))
list2 = itertools.permutations(list, 3)

ans = 0
for ele in list2:
    a = ele[0]
    b = ele[1]
    c = ele[2]
    if a == b or b == c or c == a:
        continue
    if abs(a-b) < c and c < a+b:
        print(ele)
        ans += 1
print(ans//6)


import itertools

n = int(input())
list = list(map(int, input().split()))
list2 = itertools.combinations(list, 3)

ans = 0
for ele in list2:
    a = ele[0]
    b = ele[1]
    c = ele[2]
    if a == b or b == c or c == a:
        continue
    if abs(a-b) < c and c < a+b:
        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):
import itertools

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

ans=0
lis = sorted(lis)
print(lis)

for v in itertools.combinations(lis, 3):
    if (not(v[0]==v[1] or v[1]==v[2] or v[0]==v[2])) and (v[0]+v[1]>v[2]):
        # print(v)
        ans+=1

print(ans)

import itertools

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

# lis = list(set(lis))
ans=0
lis = sorted(lis)
for pair in itertools.combinations(lis, 3):
    if pair[0]**2 + pair[1]**2 == pair[2]**2:
        ans+=1

print(ans)

import itertools

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

ans=0
lis = sorted(lis)
# print(lis)

for v in itertools.combinations(lis, 3):
    if (not(v[0]==v[1] or v[1]==v[2] or v[0]==v[2])) and (v[0]+v[1]>v[2]):
        # print(v)
        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())
A = list(map(int, input().split()))
count = 0
def make_sankaku(san):
    if san[0] == san[1] or san[1] == san[2] or san[2] == san[0]:
        return False
    else:
        san.sort()
        if san[2] - san[0] >= san[1]:
            return False
    return True
All_a = []
if len(A) <3:
    count = 0
else:
    for i in range(len(A)):
        for k in range(i+1, len(A)):
            for l in range(k + 1 ,len(A)):
                if make_sankaku([A[i], A[k], A[l]]):
                    print(i,k,l)
                    if [A[i], A[k], A[l]] not in All_a:
                        print([A[i], A[k], A[l]])
                        count += 1
print(count)

N = int(input())
A = list(map(int, input().split()))
count = 0
def make_sankaku(san):
    if san[0] == san[1] or san[1] == san[2] or san[2] == san[0]:
        return False
    else:
        san.sort()
        if san[2] - san[0] >= san[1]:
            return False
    return True
All_a = []
if len(A) <3:
    count = 0
else:
    for i in range(len(A)):
        for k in range(i+1, len(A)):
            for l in range(k + 1 ,len(A)):
                if make_sankaku([A[i], A[k], A[l]]):
                    if [A[i], A[k], A[l]] not in All_a:
                        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())) 
if n<=2:
  print(0)
  exit()
  
cnt = 0
for i in range(n):
  for j in range(n):
    for k in range(n):
      if (l[i]-l[j])*(l[j]-l[k])*(l[k]-l[i])==0:
        continue
      if l[i]<l[j]+l[k] and l[j]<l[i]+l[k] and l[k]<l[i]+l[j]:
        cnt+= 1
print(cnt)


n=int(input()) 
l = list(map(int,input().split())) 
if n<=2:
  print(0)
  exit()
  
cnt = 0
for i in range(n):
  for j in range(n):
    for k in range(n):
      if l[i]<l[j]+l[k] and l[j]<l[i]+l[k] and l[k]<l[i]+l[j]:
        cnt+= 1
print(cnt)

n=int(input()) 
l = list(map(int,input().split())) 
if n<=2:
  print(0)
  exit()
  
cnt = 0
for i in range(n-2):
  for j in range(i+1,n-1):
    for k in range(j+1,n):
      if (l[i]-l[j])*(l[j]-l[k])*(l[k]-l[i])==0:
        continue
      if l[i]<l[j]+l[k] and l[j]<l[i]+l[k] and l[k]<l[i]+l[j]:
        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):
import itertools
n=int(input())
l=list(map(int,input().split()))

ans=0
for pair in itertools.combinations(l,3):
    pair=list(pair)
    pair.sort()
    print(pair)
    if pair[0]+pair[1]>pair[2]>abs(pair[0]-pair[1]) and pair[0]!=pair[1]!=pair[2]:
        ans+=1
print(ans)


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

ans=0
for pair in itertools.combinations(l,3):
    pair=list(pair)
    pair.sort()
    
    if pair[0]+pair[1]>pair[2]>abs(pair[0]-pair[1]) and pair[0]!=pair[1]!=pair[2]:
        ans+=1
print(ans)


Verdicts: Wrong Answer

Accepted