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

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

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

n=int(input())
l=list(map(int, input().split()))
#l=list(l)
count=0
for i in range(n-2):
    for j in range(i+1,n-1):
        #print(i)
        if l[j]!=l[i]:
            #print(i)
            for k in range(j+1,n):
                a,b,c=[l[i],l[j],l[k]]
                if a!=c and b!=c:
                    if a+b>c and b+c>a and c+a>b:
                        count+=1
                    #print(i+1,j+1,k+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 = input()
L = [int(e) for e in input().split()]
c = 0
for i in range(N):
  for j in range(i, N):
    for k in range(j, N):
      if L[i] != L[j] and L[j] != L[k] and L[k] != L[i]:
        if L[i] < L[j] + L[k] or L[j] > L[k] + L[i] or L[k] > L[i] + L[j]:
          c += 1
print(c)

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

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

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

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

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

if len(set(L)) >= 3:
  for i in range(N):
    for j in range(i+1, N):
      for k in range(j+1, N):
        if L[i] != L[j] and L[j] != L[k] and L[k] != L[i]:
          if L[i] != L[j] + L[k] and L[j] != L[k] + L[i] and L[k] != L[i] + L[j]:
            print(i+1, j+1, k+1)
            c += 1
print(c)

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

if len(set(L)) >= 3:
  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] and L[j] < L[k] + L[i] and L[k] < L[i] + L[j]:
            c += 1
print(c)

Verdicts: Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

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

Submission attempts (in order):
n = int(input())
l = input()
a = l.split(' ')
new_l = []
countl = 0

for i in range(n):
    new_l.append(int(a[i]))

new_l.sort()

for i in range(n):
    for j in range(i+1,n-i):
        if(new_l[i]==new_l[j]):
            countl += 1

count = 0

for i in range(n): # i=0-5
    for j in range(i+1, n): # j=i+1 to 4-i
        for k in range(j+1, n): # k=i+j
            print(new_l[i], new_l[j], new_l[k])

            if(new_l[i] + new_l[j] > new_l[k]):
                if(new_l[i]!=new_l[j] and new_l[j]!=new_l[k]):
                    count += 1

print(count)


n = int(input())
l = input()
a = l.split(' ')
new_l = []
countl = 0

for i in range(n):
    new_l.append(int(a[i]))

new_l.sort()

for i in range(n):
    for j in range(i+1,n-i):
        if(new_l[i]==new_l[j]):
            countl += 1

count = 0

for i in range(n): # i=0-5
    for j in range(i+1, n): # j=i+1 to 4-i
        for k in range(j+1, n): # k=i+j
            if(new_l[i] + new_l[j] > new_l[k]):
                if(new_l[i]!=new_l[j] and new_l[j]!=new_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 = list(map(int, input().split()))

cnt = 0
for i in combinations(L, 3):
    longest = max(i)
    rest = sum(i) - max(i)
    if longest < rest and i[0] != i[1] and i[0] != i[2] and i[1] != i[2] :
        cnt += 1
print(cnt)

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

from itertools import combinations

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

ans = 0
x = 0

l.sort()


for i in l :
    z = x + 1
    for j in l[z:]:
        y =z + 1
        for k in l[y:]:
            if i != j != k and  i < j < k:
                    ans += 1

print(ans)

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

ans = 0

l.sort()

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

print(ans)

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

ans = 0

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

print(ans)

Verdicts: Wrong Answer

Wrong Answer

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

Submission attempts (in order):
import itertools

N = int(input())
L = list(map(int,input().split()))
 
l_list = list(itertools.combinations(L, 3))

res = 0
 
for tri in l_list:
  l = list(tri)
  l.sort()
  if (l[0] + l[1] > l[2]):
  	res += 1
    
print(res)

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

l_list = list(itertools.combinations(L, 3))

res = 0

for tri in l_list:
  tri.sort()
  if tri[0] + tri[1] > tri[2]
  	res += 1
    
print(res)

import itertools

N = int(input())
L = list(map(int,input().split()))
 
l_list = list(itertools.combinations(L, 3))

res = 0
 
for tri in l_list:
  l = list(tri)
  l.sort()
  if (len(l) != len(set(l))):
    continue
  if (l[0] + l[1] > l[2]):
  	res += 1
    
print(res)

Verdicts: Wrong Answer

Runtime Error

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

Submission attempts (in order):
N=int(input())
Ls = list(map(int,input().split()))
score=0
for i in range(0,N-2):
  a = Ls[i]
  for j in range(i+1, N-1):
      b = Ls[j]
      for k in range(j+1, N):
        c = Ls[k]
        if ((a+b>c)&(a+c>b)&(b+c>a)&(a!=b)&(a!=c)&(b!=c)):
          score+=1
          L_list=[i,j,k]
          print(L_list)
print(score)

N=int(input())
Ls = list(map(int,input().split()))
score=0
for i in range(0,N-2):
  a = Ls[i]
  for j in range(i+1, N-1):
      b = Ls[j]
      for k in range(j+1, N):
        c = Ls[k]
        if ((a+b>c)&(a+c>b)&(b+c>a)&(a!=b)&(a!=c)&(b!=c)):
          score+=1

print(score)

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("" )))
S = set(L)
X = []

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

import itertools
N = int(input())
L = list(map(int,input().split(" ")))
S = set(L)
X = []


if len(S) < 3:
    print(0)
else:
    for i in S:
        if L.count(i) > 1:
             X.append(L.count(i))
            
    ans = len(list(itertools.combinations(S, 3)))
    for i in X:
        ans *= i
    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] & l[j] < l[k]:
        if l[i] != l[j] != l[k]:
          if l[i] + l[j] + l[k] > max(l[i],l[j],l[k])*2:
            ans += 1

print(ans)
      



Verdicts: Runtime Error

Wrong Answer

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

Submission attempts (in order):
n = int(input())
ls = sorted(list(map(int, input().split())))
print(ls)
cnt = 0
for i in range(len(ls) - 2):
    a = ls[i]
    for j in range(i+1, len(ls) - 1):
        b = ls[j]
        for k in range(j+1, len(ls)):
            c = ls[k]
            if a==b or a==c or b==c:
                continue
            if a+b > c and b+c > a and c+a > b:
                cnt += 1
print(cnt)

n = int(input())
ls = sorted(list(map(int, input().split())))
print(ls)
cnt = 0
for i in range(len(ls) - 2):
    a = ls[i]
    for j in range(i+1, len(ls) - 1):
        b = ls[j]
        for k in range(j+1, len(ls)):
            c = ls[k]
            if a==b or a==c or b==c:
                continue
            if a+b > c and b+c > a and c+a > b:
                print(i+1, j+1, k+1)
                cnt += 1
print(cnt)

n = int(input())
ls = sorted(list(map(int, input().split())))
cnt = 0
for i in range(len(ls) - 2):
    a = ls[i]
    for j in range(i+1, len(ls) - 1):
        b = ls[j]
        for k in range(j+1, len(ls)):
            c = ls[k]
            if a==b or a==c or b==c:
                continue
            if a+b > c and b+c > a and c+a > b:
                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())
array=list(map(int,input().split()))
array1=array.sort()
import itertools
list1=itertools.combinations(array1,3)
ans=0
for n in range(len(list1)):
  if list[n][0]!=list[n][1] and list[n][1]!=list[n][2]:
    if list[n][0]+list[n][1]>list[n][2]:
      ans=ans+1
print(ans)

N=int(input())
array=list(map(int,input().split()))
array1=array.sort()
import itertools
list1=list(itertools.combinations(array1,3))
ans=0
for n in range(len(list1)):
  if list[n][0]!=list[n][1] and list[n][1]!=list[n][2]:
    if list[n][0]+list[n][1]>list[n][2]:
      ans=ans+1
print(ans)

N=int(input())
array=list(map(int,input()))
array1=array.sort()
import itertools
list1=itertools.combinations(array1,3)
ans=0
for n in range(len(list1)):
  if list[n][0]!=list[n][1] and list[n][1]!=list[n][2]:
    if list[n][0]+list[n][1]>list[n][2]:
      ans=ans+1
print(ans)

n=input()
array=list(map(int,input()))
array1=array.sort()
import itertools
list1=itertools.combinations(array1,3)
ans=0
for n in range(len(list1)):
  if list[n][0]!=list[n][1] and list[n][1]!=list[n][2]:
    if list[n][0]+list[n][1]>list[n][2]:
      ans=ans+1
print(ans)

N=int(input())
array=list(map(int,input().split()))
array.sort()
import itertools
list1=list(itertools.combinations(array,3))
ans=0
for n in range(len(list1)):
  if list[n][0]!=list[n][1] and list[n][1]!=list[n][2]:
    if list[n][0]+list[n][1]>list[n][2]:
      ans=ans+1
print(ans)

N=int(input())
array=list(map(int,input().split()))
array1=sorted(array)
import itertools
list1=list(itertools.combinations(array1,3))
ans=0
for n in range(len(list1)):
  if list[n][0]!=list[n][1] and list[n][1]!=list[n][2]:
    if list[n][0]+list[n][1]>list[n][2]:
      ans=ans+1
print(ans)

N=int(input())
array=list(map(int,input().split()))
array1=sorted(array)
import itertools
list1=list(itertools.combinations(array1,3))
ans=0
for n in range(len(list1)):
  if list1[n][0]!=list1[n][1] and list1[n][1]!=list1[n][2]:
    if list1[n][0]+list1[n][1]>list1[n][2]:
      ans=ans+1
print(ans)

Verdicts: Runtime Error

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()))
count = 0
x = []
e = []
for i in range(len(l)-2):
    for j in range(i+1,len(l)-1):
        if l[i]!=l[j]:
            for k in range(j+1,len(l)):
                if l[i]!=l[k] and l[j]!=l[k]:
                    x.append([i+1,j+1,k+1])
                    e.append([l[i],l[j],l[k]])
count = 0           
for i in range(len(x)):
    sorted(e[i])
    t =  int(x[i][0])-1
    s = int(x[i][1])-1
    q = int(x[i][2])-1
    print([l[t],l[s],l[q]])
    if e[t] + e[s] >e[q]:
        count +=1
print(count)

n = int(input())
l = list(map(int,input().split()))
count = 0
x = []
for i in range(len(l)-2):
    for j in range(i+1,len(l)-1):
        if l[i]!=l[j]:
            for k in range(j+1,len(l)):
                if l[i]!=l[k] and l[j]!=l[k]:
                    x.append([i+1,j+1,k+1])
                    
print(len(x))


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

ans = 0

for i in range(N):
    for j in range(i,N):
        if i==j:
            continue
        else:
            for k in range(j,N):
                if i==k:
                    continue
                elif j==k:
                    continue
                else:
                    temp_max = max(L[i],L[j],L[k])
                    if L[i]+L[j]+L[k] > 2*temp_max:
                        if L[i]==L[j] or L[j]==L[k] or L[k]==L[i]:
                            continue
                        else:
                            ans += 1
                            print(i+1,j+1,k+1)

print(ans)

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

ans = 0

for i in range(N):
    for j in range(i,N):
        if i==j:
            continue
        else:
            for k in range(j,N):
                if i==k:
                    continue
                elif j==k:
                    continue
                else:
                    temp_max = max(L[i],L[j],L[k])
                    if L[i]+L[j]+L[k] > 2*temp_max:
                        if L[i]==L[j] or L[j]==L[k] or L[k]==L[i]:
                            continue
                        else:
                            ans += 1

print(ans)

Verdicts: Wrong Answer

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

Submission attempts (in order):
N = int(input())
s = 0
L = input().split()
for i in range(N-2): 
    for j in range(i+1, N-1, 1):
        for k in range(j+1, N, 1):
            if i < j < k:
                a = int(L[i])
                b = int(L[j])
                c = int(L[k])
                if a != b:
                    if b != c:
                        if c != a:
                            s += 1
           
print(s)                

N = int(input())
s = 0
L = map(int, input().split())
L = sorted(L)
for i in range(N-2): 
    a = L[i]
    for j in range(i+1, N-1, 1):
        b = L[j]
        for k in range(j+1, N, 1):
            c = L[k]
            if a != b and b != c and c != a:
                if (a + b) > c and (b +c) > a and (c + a) > b:
                    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):
import itertools
import math
n=int(input())
l=list(map(int,input().split()))
c = list(itertools.combinations(l, 3))
count=0
r=math.factorial(len(l)) // (math.factorial(len(l) - 3) * 6)
print(r)
for i in range(r):
    if c[i][0]==c[i][1] or c[i][1]==c[i][2] or c[i][2]==c[i][0]:
        pass
    else:
        if c[i][0]+c[i][1]>c[i][2] and c[i][1]+c[i][2]>c[i][0] and c[i][2]+c[i][0]>c[i][1]:
            count+=1
        else:
            pass
print(count)

import itertools
import math
n=int(input())
l=list(map(int,input().split()))
c = list(itertools.combinations(l, 3))
count=0
r=math.factorial(len(l)) / (math.factorial(len(l) - 3) * 6)
for i in range(r):
    if c[i][0]==c[i][1] or c[i][1]==c[i][2] or c[i][2]==c[i][0]:
        pass
    else:
        if c[i][0]+c[i][1]>c[i][2] and c[i][1]+c[i][2]>c[i][0] and c[i][2]+c[i][0]>c[i][1]:
            count+=1
        else:
            pass
print(count)

import itertools
import math
n=int(input())
l=list(map(int,input().split()))
if len(l)<=2:
    print('0')
else:
    c = list(itertools.combinations(l, 3))
    count=0
    r=math.factorial(len(l)) // (math.factorial(len(l) - 3) * 6)
    print(r)
    for i in range(r):
        if c[i][0]==c[i][1] or c[i][1]==c[i][2] or c[i][2]==c[i][0]:
            pass
        else:
            if c[i][0]+c[i][1]>c[i][2] and c[i][1]+c[i][2]>c[i][0] and c[i][2]+c[i][0]>c[i][1]:
                count+=1
            else:
                pass
    print(count)

import itertools
import math
n=int(input())
l=list(map(int,input().split()))
c = list(itertools.combinations(l, 3))
count=0
r=math.factorial(len(l)) / (math.factorial(len(l) - 3) * 6)
print(r)
for i in range(r):
    if c[i][0]==c[i][1] or c[i][1]==c[i][2] or c[i][2]==c[i][0]:
        pass
    else:
        if c[i][0]+c[i][1]>c[i][2] and c[i][1]+c[i][2]>c[i][0] and c[i][2]+c[i][0]>c[i][1]:
            count+=1
        else:
            pass
print(count)

import itertools
import math
n=int(input())
l=list(map(int,input().split()))
if len(l)<=2:
    print('0')
else:
    c = list(itertools.combinations(l, 3))
    count=0
    r=math.factorial(len(l)) // (math.factorial(len(l) - 3) * 6)
    for i in range(r):
        if c[i][0]==c[i][1] or c[i][1]==c[i][2] or c[i][2]==c[i][0]:
            pass
        else:
            if c[i][0]+c[i][1]>c[i][2] and c[i][1]+c[i][2]>c[i][0] and c[i][2]+c[i][0]>c[i][1]:
                count+=1
            else:
                pass
    print(count)

Verdicts: Runtime Error

Runtime Error

Wrong Answer

Runtime Error

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

Submission attempts (in order):
num_list =[]
ans = 0
for i in range(N):
  for j in range(N):
    for k in range(N):
      if L[i]!=L[j] and L[j]!=L[k] and L[i]!=L[k]:
        num_list.append(L[i])
        num_list.append(L[j])
        num_list.append(L[k])
        num_list.sort()
        if num_list[0]+num_list[1] > num_list[2]:
          ans += 1
          num_list.clear()
        else:
          num_list.clear()
print(int(ans/6))


N = int(input())
L = list(map(int, input().split()))
num_list =[]
ans = 0
for i in range(N):
  for j in range(N):
    for k in range(N):
      if L[i]!=L[j] and L[j]!=L[k] and L[i]!=L[k]:
        num_list.append(L[i])
        num_list.append(L[j])
        num_list.append(L[k])
        num_list.sort()
        if num_list[0]+num_list[1] > num_list[2]:
          ans += 1
          num_list.clear()
        else:
          num_list.clear()
print(int(ans/6))


Verdicts: Runtime Error

Accepted
Problem: You are given N real values A_1, A_2, \ldots, A_N. Compute the number of pairs of indices (i, j) such that i < j and the product A_i \cdot A_j is integer.

Submission attempts (in order):
# A

n = int(input())
a_l = [int(float(input()) * 10**9) for x in range(n)]

list = [[0] * 18 for x in range(18)]
b_l = [0, 0] * n

for i in range(n):
    _t2 = 0
    _t5 = 0
    _a = a_l[i]
    while _a % 2 == 0 and _t2 < 18:
        _t2 += 1
        _a /= 2

    _a = a_l[i]
    while _a % 5 == 0 and _t5 < 18:
        _t5 += 1
        _a /= 5
    
    list[_t2][_t5] += 1
    b_l[i] = [_t2, _t5]
    
ans = 0
for i in range(n):
    _t,_f = b_l[i]
    for j in range(18-_t,19):
        for k in range(18-_f,19):
            ans += list[j][k]
    if _t >= 9 and _f >= 9:
        ans -= 1
        
print(ans // 2)


# A

n = int(input())
a_l = [int(float(input()) * 10**9) for x in range(n)]

list = [[0] * 361 for x in range(361)]
b_l = [0, 0] * n

for i in range(n):
    _t2 = 0
    _t5 = 0
    _a = a_l[i]
    while _a % 2 == 0 or _t2 < 19:
        _t2 += 1
        _a /= 2

    _a = a_l[i]
    while _a % 5 == 0 or _t5 < 19:
        _t5 += 1
        _a /= 5
    
    list[min(_t2,18)][min(_t5,18)] += 1
    b_l[i] = [min(_t2,18), min(_t5,18)]
    
ans = 0
for i in range(n):
    _t,_f = b_l[i]
    for j in range(18-_t,19):
        for k in range(18-_f,19):
            ans += list[j][k]
    if _t >= 9 and _f >= 9:
        ans -= 1
        
print(ans // 2)


# A

from decimal import *

n = int(input())
a_l = [int(Decimal(input()) * 10**9) for x in range(n)]

list = [[0] * 19 for _ in range(19)]
cs_list = [[0] * 19 for _ in range(19)]
b_l = [0, 0] * n

for i in range(n):
    _t2 = 0
    _t5 = 0
    _a = a_l[i]
    while _a % 2 == 0 and _t2 < 18:
        _t2 += 1
        _a /= 2

    _a = a_l[i]
    while _a % 5 == 0 and _t5 < 18:
        _t5 += 1
        _a /= 5
    
    list[_t2][_t5] += 1
    b_l[i] = [_t2, _t5]

for i in range(19):
    for j in range(19):
        for k in range(i+1):
            for l in range(j+1):
                cs_list[k][l] += list[i][j]

ans = 0
for i in range(n):
    _t,_f = b_l[i]
    if _t >= 9 and _f >= 9:
        ans -= 1
    ans += cs_list[18-_t][18-_f]
        
print(ans // 2)


Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: You are given N real values A_1, A_2, \ldots, A_N. Compute the number of pairs of indices (i, j) such that i < j and the product A_i \cdot A_j is integer.

Submission attempts (in order):
def divide(n, p):
    c = 0
    while n%p == 0 and c < 18:
        c += 1
        n //= p
    return c
    

n = int(input())
dp = [[0]*19 for _ in range(19)]
    
for i in range(n):
    s = float(input())
    s = int(1000000000*s)
    c1, c2 = divide(s, 2), divide(s, 5)
    dp[c1][c2] += 1
    
ans = 0
for i1 in range(19):
    for j1 in range(19):
        for i2 in range(19):
            for j2 in range(19):
                if i1+i2 >= 18 and j1+j2 >= 18:
                    if i1 == i2 and j1 == j2:
                        ans += dp[i1][j1]*(dp[i1][j1]-1)//2
                    elif i1 < i2:
                        ans += dp[i1][j1]*dp[i2][j2]
            
        
print(ans//2)

import sys
from decimal import Decimal
input = sys.stdin.readline


def divide(n):
    c1, c2 = 0, 0
    while (n%2 == 0):
        c1 += 1
        n //= 2
    while (n%5 == 0):
        c2 += 1
        n //= 5
    c1, c2 = min(18, c1), min(18, c2)
    return (c1, c2)
    

def main():
    n = int(input())
    a = [divide(int(Decimal(float(input()))*1e9)) for _ in range(n)]

    dp = [[0]*20 for _ in range(20)]
    for i in range(n):
        c1, c2 = a[i]
        dp[c1][c2] += 1
    
    for i in range(18, -1, -1):
        for j in range(18, -1, -1):
            dp[i][j] += dp[i+1][j]+dp[i][j+1]-dp[i+1][j+1]

    ans = 0
    for i in range(n):
        c1, c2 = a[i]
        if (c1 >= 9 and c2 >= 9):
            ans -= 1
        ans += dp[18-c1][18-c2]
        
    print(ans//2)
    

if __name__ == "__main__":
    main()


import sys
input = sys.stdin.readline


def divide(n):
    c1, c2 = 0, 0
    while (n%2 == 0):
        c1 += 1
        n //= 2
    while (n%5 == 0):
        c2 += 1
        n //= 5
    return (c1, c2)
    

def main():
    n = int(input())
    a = [None]*n
    for i in range(n):
        sub = input().replace("\n", "")
        if "." in sub:
            x, y = map(str, sub.split("."))
            s = int(x)*1000000000+10**(9-len(y))*int(y)
        else:
            s = int(sub)
            s *= 1000000000
        a[i] = divide(s)

    dp = [[0]*100 for _ in range(100)]
    for i in range(n):
        c1, c2 = a[i]
        dp[c1][c2] += 1
    
    for i in range(98, -1, -1):
        for j in range(98, -1, -1):
            dp[i][j] += dp[i+1][j]+dp[i][j+1]-dp[i+1][j+1]

    ans = 0
    for i in range(n):
        c1, c2 = a[i]
        if (c1 >= 9 and c2 >= 9):
            ans -= 1
        if c1 >= 18 and c2 >= 18:
            ans += dp[0][0]
            continue
        if c1 >= 18:
            ans += dp[0][18-c2]
            continue
        if c2 >= 18:
            ans += dp[18-c1][0]
            continue
        ans += dp[18-c1][18-c2]
        
    print(ans//2)
    
    
    
if __name__ == "__main__":
    main()


Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: You are given N real values A_1, A_2, \ldots, A_N. Compute the number of pairs of indices (i, j) such that i < j and the product A_i \cdot A_j is integer.

Submission attempts (in order):
n=int(input())
from decimal import Decimal as D
# A=[]
excel=[[0]*20 for i in range(50)]
query=[]
for i in range(n):
    q=input()
    q=D(q)
    q=int(q*10**9)
    num2=0 ;num5=0
    k=q
    for i in range(50):
        if k%2==0:
            k//=2
            num2+=1
        else:break
    k=q
    for i in range(20):
        if k%5==0:
            k//=5
            num5+=1
        else:break
    excel[num2][num5]+=1
    query.append([max(0,18-num2),max(0,18-num5)])

A=[[0] * 20 for i in range(50)] 
for i in range(49,-1,-1):
    for j in range(19,-1,-1):
        if i==49 and j==19:
            A[i][j]=excel[i][j]
        elif i==49:
            A[i][j]=A[i][j+1]+excel[i][j]
        elif j==19:
            A[i][j]=A[i+1][j] + excel[i][j]
        else:
            A[i][j]=excel[i][j]+ A[i+1][j]+A[i][j+1]-A[i+1][j+1]

ans=0
for l in query:
    num2,num5=l
    if num2<=9 and num5<=9:
        ans+=A[num2][num5]-1
    else:a
        ans+=A[num2][num5]


 #   print(excel[:][i] , A[:][i])
print(ans//2)


n=int(input())
from decimal import Decimal as D
# A=[]
excel=[[0]*20 for i in range(50)]
query=[]
for i in range(n):
    q=input()
    q=D(q)
    q=int(q*10**9)
    num2=0 ;num5=0
    k=q
    for i in range(50):
        if k%2==0:
            k//=2
            num2+=1
        else:break
    k=q
    for i in range(20):
        if k%5==0:
            k//=5
            num5+=1
        else:break
    excel[num2][num5]+=1
    query.append([max(0,18-num2),max(0,18-num5)])

A=[[0] * 20 for i in range(50)] 
for i in range(49,-1,-1):
    for j in range(19,-1,-1):
        if i==49 and j==19:
            A[i][j]=excel[i][j]
        elif i==49:
            A[i][j]=A[i][j+1]+excel[i][j]
        elif j==19:
            A[i][j]=A[i+1][j] + excel[i][j]
        else:
            A[i][j]=excel[i][j]+ A[i+1][j]+A[i][j+1]-A[i+1][j+1]

ans=0
for l in query:
    num2,num5=l
    if num2<=9 and num5<=9:
        ans+=A[num2][num5]-1
    else:
        ans+=A[num2][num5]


 #   print(excel[:][i] , A[:][i])
print(ans//2)


Verdicts: Runtime Error

Accepted
Problem: You are given N real values A_1, A_2, \ldots, A_N. Compute the number of pairs of indices (i, j) such that i < j and the product A_i \cdot A_j is integer.

Submission attempts (in order):
import math
from collections import defaultdict

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

n = int(input())
A = []
d = defaultdict(int)
mod = 10 ** 9
for _ in range(n):
    a = int(round(float(input()) * mod))
    A.append(a)
    div_list = make_divisors(a)
    for div in div_list:
        d[div] += 1
ans = 0
for a in A:
    if a % mod != 0:
        t = (mod // math.gcd(a, mod)) * mod
        ans += d[int(t)]
ans += d[mod] * (d[mod] - 1) // 2
print(ans)

from collections import defaultdict
def calc(x):
    c2, c5 = 0, 0
    if '.' in x:
        x = x.rstrip('0')
        cnt = len(x) - x.index('.') - 1
        c2, c5 = -cnt, -cnt
    x = int(x.replace('.', ''))
    while x % 2 == 0:
        c2 += 1
        x = x // 2
    while x % 5 == 0:
        c5 += 1
        x = x // 5
    return c2, c5
    
    
d = defaultdict(int)
n = int(input())
A = []
for _ in range(n):
    a = input()
    c2, c5 = calc(a)
    d[(c2, c5)] += 1
ans = 0
key = list(d.keys())
for i in range(len(key)):
    c2, c5 = key[i]
    v = d[(c2, c5)]
    if (c2 >= 0) & (c5 >= 0):
        ans += v * (v - 1) // 2
    for j in range(i + 1, len(key)):
        n2, n5 = key[j]
        if ((n2 + c2) >= 0) & ((n5 + c5) >= 0):
            ans += v * d[(n2, n5)]
print(ans)            

Verdicts: Wrong Answer

Accepted
Problem: You are given N real values A_1, A_2, \ldots, A_N. Compute the number of pairs of indices (i, j) such that i < j and the product A_i \cdot A_j is integer.

Submission attempts (in order):
import collections
import sys
input=sys.stdin.readline

def calc(n):
  cnt_2=0
  cnt_5=0
  while n%2==0 and cnt_2<18:
    cnt_2+=1
    n//=2
  while n%5==0 and cnt_5<18:
    cnt_5+=1
    n//=5
  return [cnt_2,cnt_5]

n=int(input())
dic=collections.defaultdict(int)
ans=0
for _ in range(n):
  tmp=input()
  if '.' in tmp:
    pos=tmp.index('.')
    d=len(tmp)-(pos+1)
    tmp=tmp[:pos]+tmp[pos+1:]+'0'*(9-d)
  else:
    tmp+='0'*9
  tmp=int(tmp)
  cnt_2,cnt_5=calc(tmp)
  dic[(cnt_2,cnt_5)]+=1
  if 18<=min(cnt_2*2,cnt_5*2):
    ans-=1
for a1,b1 in dic.keys():
  for a2,b2 in dic.keys():
    if min(a1+a2,b1+b2)>=18:
      ans+=dic[(a1,b1)]*dic[(a2,b2)]
print(ans//2)

import collections

def calc(n):
  cnt_2=0
  cnt_5=0
  while n%2==0 and cnt_2<18:
    cnt_2+=1
    n//=2
  while n%5==0 and cnt_5<18:
    cnt_5+=1
    n//=5
  return [cnt_2,cnt_5]

n=int(input())
dic=collections.defaultdict(int)
ans=0
for _ in range(n):
  tmp=input()
  if '.' in tmp:
    pos=tmp.index('.')
    d=len(tmp)-(pos+1)
    tmp=tmp[:pos]+tmp[pos+1:]+'0'*(9-d)
  else:
    tmp+='0'*9
  tmp=int(tmp)
  cnt_2,cnt_5=calc(tmp)
  dic[(cnt_2,cnt_5)]+=1
  if 18<=min(cnt_2*2,cnt_5*2):
    ans-=1
for a1,b1 in dic.keys():
  for a2,b2 in dic.keys():
    if min(a1+a2,b1+b2)>=18:
      ans+=dic[(a1,b1)]*dic[(a2,b2)]
print(ans//2)

Verdicts: Runtime Error

Accepted
Problem: You are given N real values A_1, A_2, \ldots, A_N. Compute the number of pairs of indices (i, j) such that i < j and the product A_i \cdot A_j is integer.

Submission attempts (in order):
n=int(input())
num=[[0]*23 for _ in range(40)]
for i in range(n):
	s=input()
	two=0;five=0
	if "." not in s:
		s=int(s)
		while s%2==0:
			s//=2
			two+=1
		while s%5==0:
			s//=5
			five+=1
	else:
		a,b=s.split(".")
		l=len(b)
		s=int(a)*10**l+int(b)
		five=-l;two=-l
		while s%2==0:
			s//=2
			two+=1
		while s%5==0:
			s//=5
			five+=1	
	num[two+9][five+9]+=1
ans=0
for i in range(40):
	for j in range(23):
		for k in range(i,40):
			for l in range(j,23):
				if i+k>=18 and j+l>=18:
					if (i,j)==(k,l):
						ans+=num[i][j]*(num[i][j]-1)//2
					else:
						ans+=num[i][j]*num[k][l]
print(ans)


import sys
input=sys.stdin.readline
n=int(input())
num=[[0]*23 for _ in range(40)]
for i in range(n):
	s=int(float(input())*(10**9)+0.5)
	two=-9;five=-9
	while s%2==0:
		s//=2
		two+=1
	while s%5==0:
		s//=5
		five+=1
	num[two+9][five+9]+=1
ans=0
for i in range(40):
	for j in range(23):
		for k in range(18-i,40):
			for l in range(18-j,23):
				if (i,j)==(k,l):
					ans+=num[i][j]*(num[i][j]-1)
				else:
					ans+=num[i][j]*num[k][l]
print(ans//2)


Verdicts: Wrong Answer

Accepted
Problem: You are given N real values A_1, A_2, \ldots, A_N. Compute the number of pairs of indices (i, j) such that i < j and the product A_i \cdot A_j is integer.

Submission attempts (in order):
n = int(input())
a = [float(input()) for _ in range(n)]
a = [i*10**9 for i in a]
MAX = 50
p_mat = [[0 for _ in range(MAX)] for _ in range(MAX)]

for i in a:
    b_cnt = 0
    while i % 2 == 0:
        i /= 2
        b_cnt += 1
    f_cnt = 0
    while i % 5 == 0:
        i /= 5
        f_cnt += 1
    p_mat[b_cnt][f_cnt] += 1

ans = 0
for b1 in range(MAX):
    for f1 in range(MAX):
        for b2 in range(MAX):
            for f2 in range(MAX):
                if b1+b2 >= 18 and f1+f2 >= 18:
                    if b1 == b2 and f1 == f2 and p_mat[b1][f1] > 0:
                        ans += p_mat[b1][f1] * (p_mat[b2][f2] - 1)
                    else:
                        ans += p_mat[b1][f1] * p_mat[b2][f2]
print(ans//2)

import collections
from decimal import Decimal

n = int(input())
a = [Decimal(input()) for _ in range(n)]
a = [int(i*10**9) for i in a]
MAX = 19
p_dict = collections.defaultdict(int)

for i in a:
    b_cnt = 0
    while i % 2 == 0 and b_cnt < 18:
        i //= 2
        b_cnt += 1
    f_cnt = 0
    while i % 5 == 0 and f_cnt < 18:
        i //= 5
        f_cnt += 1
    p_dict[(b_cnt, f_cnt)] += 1

ans = 0
for b1, f1 in p_dict:
    for b2, f2 in p_dict:
        if b1+b2 >= 18 and f1+f2 >= 18:
            if b1 == b2 and f1 == f2:
                ans += p_dict[(b1, f1)] * (p_dict[(b2, f2)] - 1)
            else:
                ans += p_dict[(b1, f1)] * p_dict[(b2, f2)]
print(ans//2)

Verdicts: Wrong Answer

Accepted
Problem: You are given N real values A_1, A_2, \ldots, A_N. Compute the number of pairs of indices (i, j) such that i < j and the product A_i \cdot A_j is integer.

Submission attempts (in order):
N=int(input())
D={}
from decimal import Decimal
A=[Decimal(input()) for _ in range(N)]
A=[int(i*10**9) for i in A]
for i in range(N):
  x=A[i]
  y=x
  tcnt,fcnt=0,0
  while x%2==0 and tcnt<18:
    tcnt+=1
    x=x//2
  while y%5==0 and fcnt<18:
    fcnt+=1
    y=y//5
  A[fcnt][tcnt]+=1

cnt=0
for i in range(19):
  for j in range(19):
    for k in range(19):
      for l in range(19):
        if i+k>=18 and j+l>=18:
          if i!=k and j!=l:
            d=A[i][j]
            e=A[k][l]
            p=d*e
          elif i==k and j==l:
            d=A[i][j]
            p=d*(d-1)
          else:
            d=A[i][j]
            e=A[k][l]
            p=d*e
          cnt+=p
print(cnt//2)

N=int(input())
D={}
from decimal import Decimal
B=[Decimal(input()) for _ in range(N)]
B=[int(i*10**9) for i in B]
A=[[0]*19 for i in range(19)]
for i in range(N):
  x=B[i]
  y=x
  tcnt,fcnt=0,0
  while x%2==0 and tcnt<18:
    tcnt+=1
    x=x//2
  while y%5==0 and fcnt<18:
    fcnt+=1
    y=y//5
  A[fcnt][tcnt]+=1

cnt=0
for i in range(19):
  for j in range(19):
    for k in range(19):
      for l in range(19):
        if i+k>=18 and j+l>=18:
          if i!=k and j!=l:
            d=A[i][j]
            e=A[k][l]
            p=d*e
          elif i==k and j==l:
            d=A[i][j]
            p=d*(d-1)
          else:
            d=A[i][j]
            e=A[k][l]
            p=d*e
          cnt+=p
print(cnt//2)

Verdicts: Runtime Error

Accepted
Problem: You are given N real values A_1, A_2, \ldots, A_N. Compute the number of pairs of indices (i, j) such that i < j and the product A_i \cdot A_j is integer.

Submission attempts (in order):

from fractions import Fraction

n = int(input())
a = []
b = []
for i in range(0,n):
	c = float(input())
	a.append(c)
	f = Fraction(a[i])
	b.append(f)

x = []
y = []

for i in range(0,n):
	x.append(b[i].numerator)
	y.append(b[i].denominator)

count = 0

for i in range(0,n)	:
	for j in range(i+1,n):
		if (x[i]*x[j]) % (y[i]*y[j]) == 0:
			count += 1

print(count)

from math import gcd
from collections import Counter
import sys

N = int(input())
K = 10**9
L = 10**18
A = [0] * N
C = Counter()
ans = 0

for i in range(N):
	A[i] = round(K * float(input()))
	C[gcd(A[i],L)] += 1 
	
for k1,v1 in C.items():
	for k2 ,v2 in C.items():
		if k1 == k2:
			if k1*k2 % L == 0:
				ans += v1*(v1-1)/2
		elif k1 < k2:
			if k1*k2 % L == 0:
				ans += v1 * v2

int(print(ans))
			
	
	

from math import gcd
from collections import Counter
import sys

N = int(input())
K = 10**9
L = 10**18
A = [0] * N
C = Counter()
ans = 0

for i in range(N):
	A[i] = round(K * float(input()))
	C[gcd(A[i],L)] += 1 
	
for k1,v1 in C.items():
	for k2 ,v2 in C.items():
		if k1 == k2:
			if k1*k2 % L == 0:
				ans += v1*(v1-1)/2
		elif k1 < k2:
			if k1*k2 % L == 0:
				ans += v1 * v2

print(int(ans))
			
	
	

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: You are given N real values A_1, A_2, \ldots, A_N. Compute the number of pairs of indices (i, j) such that i < j and the product A_i \cdot A_j is integer.

Submission attempts (in order):
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

def is_ok(arg):
    return a[i][j]+a[arg][j] >= 0

def meguru_bisect(ng, ok):
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok

n = INT()
a = []
for i in range(n):
    A = int(float(input())*10**9)
    m2 = m5 = -9
    while A % 10 == 0:
        A //= 10
        m2 += 1
        m5 += 1
    while A % 2 == 0:
        A //= 2
        m2 += 1
    while A % 5 == 0:
        A //= 5
        m5 += 1
    a.append([m2, m5])
a.sort()

ans = 0
for i in range(n):
    j = 0
    tmp = meguru_bisect(i, n)
    if tmp < n:
        j = 1
        ans += n - meguru_bisect(min(i, tmp-1), n)
print(ans)

from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n = INT()
a = [[0]*19 for i in range(19)]
for i in range(n):
    A = int(float(input())*10**9+0.5)
    m2 = m5 = 0
    while A % 2 == 0:
        A //= 2
        m2 += 1
    while A % 5 == 0:
        A //= 5
        m5 += 1
    m2 = min(m2, 18)
    m5 = min(m5, 18)
    a[m2][m5] += 1

ans = 0
for i in range(19):
    for j in range(19):
        for k in range(19):
            for l in range(19):
                if i + k >= 18 and j + l >= 18:
                    if i == k and j == l:
                        ans += a[i][j] * ( a[k][l] - 1 )
                    else:
                        ans += a[i][j] * a[k][l]
ans //= 2
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: You are given N real values A_1, A_2, \ldots, A_N. Compute the number of pairs of indices (i, j) such that i < j and the product A_i \cdot A_j is integer.

Submission attempts (in order):
from numba import njit
import numpy as np
@njit
def main(n,a):
  k=60
  mp=np.zeros((k,k),np.int32)
  o=k//2
  ary=[]
  for i in range(n):
    b=list(a[i].split('.'))
    b.append('0')
    x=int(b[0])
    y=int((b[1]+'0'*9)[:9])
    x=x*pow(10,9)+y
    # x10^9
    cnt5=-9
    xx=x
    while xx>1:
      if xx%5==0:
        cnt5+=1
        xx//=5
      else:
        break
    cnt2=-9
    xx=x
    while xx>1:
      if xx%2==0:
        cnt2+=1
        xx//=2
      else:
        break
    #if 0<=cnt5+o<23 and 0<=cnt2+o<23:
    mp[cnt5+o,cnt2+o]+=1
    ary.append([cnt5+o,cnt2+o])

  ans=0
  for i in range(k-1,0,-1):
    for j in range(k):
      mp[j][i-1]+=mp[j][i]
  for i in range(k-1,0,-1):
    for j in range(k):
      mp[i-1][j]+=mp[i][j]
  for x,y in ary:
    if x>=o and y>=o:
      i=1
    else:
      i=0
    x-=o
    x*=-1
    x+=o
    y-=o
    y*=-1
    y+=o
    ans+=mp[x,y]-i
  print(ans//2)
  #mp[o,o]+=10
  #print(mp)

n=int(input())
a=np.array([input() for _ in range(n)])
main(n,a)



n=int(input())
a=[input() for _ in range(n)]
m=30
c=[[0]*m for _ in range(m)]
k=9
ary=[]
for b in a:
  b=b.split('.')
  bint,bfl=0,0
  bint=int(b[0])*10**9
  if len(b)>1:
    tmp=('1'+b[1]+'000000000000')[:10]
    bfl=int(tmp)
    bfl-=10**9
  tmp=bint+bfl
  t=tmp
  n5=0
  while t%5==0:
    t//=5
    n5+=1
  t=tmp
  n2=0
  while t%2==0:
    t//=2
    n2+=1
  n2=min(n2,k+9)
  n5=min(n5,k+9)
  c[n2][n5]+=1
  ary.append([n2,n5])
cc=[[0]*(m+1) for _ in range(m+1)]
for i in range(m):
  for j in range(m):
    cc[i+1][j+1]+=cc[i+1][j]+c[i][j]
for i in range(m):
  for j in range(m):
    cc[i+1][j+1]+=cc[i][j+1]
ans=0

for i,j in ary:
  if i>=k and j>=k:ans-=1
  tmp=cc[-1][-1]-cc[-1][2*k-j]-cc[2*k-i][-1]+cc[2*k-i][2*k-j]
  ans+=tmp
ans//=2
print(ans)
"""
c[k][k]+=7
for x in c:
  print(x)
print('======')
for x in cc:
  print(x)
"""

Verdicts: Runtime Error

Accepted