Problem:
 Score : 300 points    Problem Statement 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.      Constraints  2 \leq N \leq 200\,000  0 < A_i < 10^4  A_i is given with at most 9 digits after the decimal.         Input Input is given from Standard Input in the following format.  N  A_1  A_2  \vdots  A_N       Output Print the number of pairs with integer product A_i \cdot A_j (and i < j ).        Sample Input 1 5
7.5
2.4
17.000000001
17
16.000000000      Sample Output 1 3  There are 3 pairs with integer product:   7.5 \cdot 2.4 = 18  7.5 \cdot 16 = 120  17 \cdot 16 = 272        Sample Input 2 11
0.9
1
1
1.25
2.30000
5
70
0.000000001
9999.999999999
0.999999999
1.000000001      Sample Output 2 8

Solution (Python):
n = int(input())
r = [[0 for _ in range(19)] for _ in range(19)]
ans = 0
for _ in range(n):
  x = int(float(input()) * 10**9+0.1)
  y2 = -9
  y5 = -9
  while x % 2 == 0:
    x //= 2
    y2 += 1
  while x % 5 == 0:
    x //= 5
    y5 += 1
  y2 = min(18,y2+9)
  y5 = min(18,y5+9)
  r[y2][y5] += 1
  
  if y2 >= 9 and y5 >= 9:
    
    ans -= 1
for i2 in range(19):
  for i5 in range(19):
    for j2 in range(19):
      for j5 in range(19):
        if i2 + j2 >= 18 and i5 + j5 >= 18:
          ans += r[i2][i5] * r[j2][j5]
          
            

  
print(ans//2)

Solution (Python):
N = int(input())
A = {}

for _ in range(N):
  a = round(float(input())*10**9)
  
  pow2 = 0
  pow5 = 0
  while a % 2 == 0 and pow2 < 18:
    pow2 += 1
    a //= 2
  while a % 5 ==0 and pow5 < 18:
    pow5 += 1
    a //= 5
  if (pow2, pow5) not in A:
    A[(pow2, pow5)] = 0
  A[(pow2, pow5)] += 1
  

ans = 0
for p1, c1 in A.items():
  for p2, c2 in A.items():
    if p1[0] + p2[0] < 18 or p1[1] + p2[1] < 18:
      continue
    if p1 == p2:
      ans += c1 * (c1 - 1)
    else:
      ans += c1 * c2
print(ans // 2)

Solution (Python):
import sys
import numpy as np
import numba
from numba import njit, b1, i4, i8, f8

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

@njit((i8[:], ), cache=True)
def main(A):
    counts = np.zeros((19, 19), np.int64)
    for x in A:
        e = 0
        while x % 2 == 0:
            x, e = x // 2, e + 1
        f = 0
        while x % 5 == 0:
            x, f = x // 5, f + 1
        e = min(e, 18)
        f = min(f, 18)
        counts[e, f] += 1
    
    x = 0
    for a in range(361):
        for b in range(361):
            i, j = divmod(a, 19)
            k, l = divmod(b, 19)
            if i + k >= 18 and j + l >= 18:
                x += counts[i, j] * counts[k, l]
    
    for a in range(361):
        i, j = divmod(a, 19)
        if i + i >= 18 and j + j >= 18:
            x -= counts[i, j]
    return x // 2

N = int(readline())
A = np.array(read().split(), np.float64)

A = np.rint(10**9 * A).astype(np.int64)

print(main(A))