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



Sample input:
5
7.5
2.4
17.000000001
17
16.000000000


Sample output:
3

Submission status: Wrong Answer

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gcd
from operator import mul
from functools import reduce
from operator import mul
from pprint import pprint



sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.readline())
def FI(): return float(sys.stdin.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


n = I()
A = []
c = 0
for i in range(n):
    r = FI()
    A += [r]
    if r % 1 == 0:
        c += 1

D = defaultdict(lambda:defaultdict(int))
for j in range(n):
    cnt1 = 0
    cnt2 = 0
    while A[j] % 1:
        A[j] *= 10
        cnt1 -= 1
        cnt2 -= 1
    while A[j] % 2 == 0:
        A[j] /= 2
        cnt1 += 1
    while A[j] % 5 == 0:
        A[j] /= 5
        cnt2 += 1
    D[cnt1][cnt2] += 1

ans = 0
cnt2 = 0
for i in range(-25, 25):
    for j in range(-13, 13):
        for k in range(-25, 25):
            for l in range(-13, 13):
                if i + k >= 0 and j + l >= 0:
                    if i == k and j == l:
                        ans += D[i][j] * (D[k][l] - 1)
                        # cnt2 += D[i][j] * (D[k][l] - 1) // 2
                        #
                    else:
                        ans += D[i][j] * D[k][l]

print(ans // 2)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math
import bisect

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n = readInt()
a = [round(float(input())*10**9) for i in range(n)]
c = Counter([i%10**9 for i in a])
ans = 0

for i in c:
	if i!=0:
		for j in range(0,len(a)):
			if i*a[j]%10**18==0:
				ans+=1

if c[0]>1:
	c1 = (math.factorial(2)*math.factorial(c[0]-2))
	if c1!=0:
		c1 = math.factorial(c[0])//c1
else:
	c1 = 0

print(ans+c1)

Submission status: Wrong Answer

Solution code:
n=int(input())
data = []
count = 0
for i in range(n):
    data.append(input())
print(data)
for i in range(n):
    for j in range(i+1,n):
        if (len(data[i]) <= len(data[j])):
            data_s = data[i]
            data_l = data[j]
        if (len(data[i]) > len(data[j])):
            data_s = data[j]
            data_l = data[i]
        first = data_s[0]
        second = data_s[1:]
        size_s = len(data_s)
        size_l = len(data_l)
        if(data_l[size_s*(-1)+1:]== second):
            if(first in data_l[0:size_l-size_s+1]):
                count=count+1

print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())
a = [[0 for _ in range(100)] for _ in range(100)]
s = [[0 for _ in range(100)] for _ in range(100)]
x = [[0 for _ in range(2)] for _ in range(N)]
for i in range(N):
  x[i][0] = 50
  x[i][1] = 50
  S = input()
  A = float(S)
  if "." in S:
    ten = len(S) - S.index(".") - 1
    for j in range(len(S)-1):
      if S[len(S)-1-j] == 0:
        ten -= 1
      else:
        break
    x[i][0] += ten
    x[i][1] += ten
    A *= 10 ** ten
  while A % 5 == 0:
    A /= 5
    x[i][0] -= 1
  while A % 2 == 0:
    A /= 2
    x[i][1] -= 1
  a[x[i][0]][x[i][1]] += 1
for i in range(99):
  for j in range(99):
    s[i+1][j+1] = s[i][j+1] + s[i+1][j] - s[i][j] + a[i][j]
ans = 0
for i in range(N):
  if x[i][0] <= 50 and x[i][1] <= 50:
    ans -= 1
  ans += s[100-x[i][0]+1][100-x[i][1]+1]
print(ans//2)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [round(float(input()) * 10**9) for _ in range(n)]
cs = [[0] * 20 for _ in range(20)]

dc = []
for i in a:
    x = 0
    for _ in range(19):
        if i % 2 == 0:
            i //= 2
            x += 1
    y = 0
    for _ in range(19):
        if i % 5 == 0:
            i //= 5
            y += 1

    cs[18-x][18-y] += 1
    dc.append((x, y))
for i in range(20):
    for j in range(19):
        cs[i][j+1] += cs[i][j]
for i in range(20):
    for j in range(19):
        cs[j+1][i] += cs[j][i]


ans = 0
for x, y in dc:
    ans += cs[x][y]
for i in a:
    if i % 10**9 == 0:
        ans -= 1
ans //= 2

print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    from sys import stdin
    import numpy as np
    # read
    readline = stdin.readline
    n = int(readline())
    a = [float(readline()) for _ in range(n)]
    a = np.array(a)
    count = 0
    for i in range(n - 1):
        b = a[i + 1:]
        count = count + np.count_nonzero((b * a[i]) % 1 == 0)
    print(count)


main()

Submission status: Wrong Answer

Solution code:
import itertools
n=int(input())
A=[float(input()) for _ in range(n)]
cnt=0

combl=list(itertools.combinations(A,2))

for comb in combl:
    fcomb=comb[0]*comb[1]

    if fcomb.is_integer()==True:
        cnt+=1
print(cnt)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[float(input()) for i in range(n)]
cou=0
for i in range(n):
  for j in range(n):
    if i<j:
      if a[i]==int(a[i]) and a[j]==int(a[j]):
        
        cou+=1

      else:

        b=a[i]*a[j]
        c=b-int(b)
        if c==0:
          
          cou+=1
print(cou)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [float(input()) for i in range(N)]
#A = [len(input()) for i in range(N)]
count = 0
B = []
C = []

for i in range(N):
    if A[i] % 1 == 0:
        B.append(A[i])
    elif A[i] % 0.00001 == 0:
        C.append(A[i])

for i in range(len(B)):
    count += i

for i in B:
    for j in C:
        if ((i * j) % 1 == 0):
            count += 1

for i in range(len(C)):
    for j in range(i+1, len(C)):
        if ((C[i] * (10 ** 4)) * (C[j] * (10 ** 4))) % (1 * (10 ** 4) ** 2) == 0:
            count += 1

#for i in range(len(B)):
#    for j in range(i+1, len(B)):
#        if ((B[i] * (10 ** 4)) * (A[j] * (10 ** 4))) % (1 * ((10 ** 4) ** 2)) == 0:
#            count += 1
print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
alis = []
ans = 0
for _ in range(0,n):
  a = float(input())
  alis.append(a)
  
for i in range(0,n):
  for j in range(0,i):
    if int(alis[i]) * int(alis[j]) == alis[i] * alis[j]:
      ans += 1
      
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [float(input()) for i in range(n)]
ans = 0
a = [int(i*1e10) for i in a]

for i in range(n-1):
    for j in range(i+1, n):
        if (a[i]*a[j])%1e20 == 0:
            ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
import math
from decimal import Decimal

n = int(input())
a = []
for _ in range(n):
    a.append(Decimal(input()))
count = 0
for i in range(n-1):
    ai = a[i]
    for j in range(n-i-1):
        result = Decimal(ai * a[i + j + 1])
        if result % 1 == 1:
            count += 1

print(count)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
N = int(input())
K = []
for i in range(N):
    a = list(input())
    s = ""
    t = 1
    for j in a[::-1]:
        if t == 1 and j == "0":
            pass
        elif t == 1 and j == ".":
            pass
        else:
            s += j
            t = 0
    K.append(float(s[::-1]))

T = []
for i in K:
    t = 0
    c = 0
    for j in str(i):
        if t == 1:
            c += 1
        if j == ".":
            t = 1
    T.append([int(i*(10**c)), 10**c])

P = []
for i in T:
    a = i[0]
    b = i[1]
    while(True):
        if a % 5 != 0 or b % 5 != 0:
            break
        a = a//5
        b = b//5
    while (True):
        if a % 2 != 0 or b % 2 != 0:
            break
        a = a // 2
        b = b // 2
    P.append([a, b])

S = []
L = defaultdict(int)
for i in P:
    a = i[0]
    b = i[1]
    for j in range(1, int(a**(0.5))+1):
        if a % j == 0:
            S.append([b, j])
            L[(j, b)] += 1

ans = 0
for i in S:
    ans += L[(i[0], i[1])]
print(ans//2)

Submission status: Wrong Answer

Solution code:
import pprint
N=int(input())
l2=[]
bit2=45
bit5=20
#table=[[0 for _ in range(20)] for _ in range(15)]
#table=[[0 for _ in range(45)] for _ in range(20)]
table=[[0 for _ in range(bit2)] for _ in range(bit5)]

for i in range(N):
    pf={}
    n=float(input())
    #print(n)
    kake=1
    n=n*pow(10,9)
    kake=10**9
    count2=0
    count5=0
    #print(n,kake)
    while n/2==n//2:
        n=n//2
        count2=count2+1
    while n/5==n//5:
        n=n//5
        count5=count5+1
    x=kake/(pow(2,count2)*pow(5,count5))
    table[count5][count2]=table[count5][count2]+1
    l2.append([count2,count5])
#pprint.pprint(table)
#print(l2)
ans=0
for i in range(bit5):
    for j in range(bit2):
        num=table[i][j]
        min2=max(0,18-j)
        min5=max(0,18-i)
        cnt=0
        if num>0:
            #print(min2,min5,i,j)
            for k in range(min5,bit5):
                for l in range(min2,bit2):
                    cnt=cnt+table[k][l]
            if (min2<=j)and(min5<=i):
                cnt=cnt-1
            ans=ans+num*cnt
            #print(ans)
print(ans//2)

Submission status: Wrong Answer

Solution code:
N = int(input())
sum = []
for i in range(N):
    s = input()
    if '.' in s:
        s = float(s)
        sum.append(s)
    else:
        s = int(s)
        sum.append(s)
count = 0
for i in range(len(sum)):
    for j in range(len(sum)):
        if i < j:
            a = sum[i]*sum[j]
            if a == int(a):
                count+=1
print(count)

Submission status: Wrong Answer

Solution code:
import sys
N = int(input())
#整数と整数
#有限整数は、「2^t × 5^f」で表せる。
#A = sys.stdin.readlines()
MN = [[0 for i in range(33)] for j in range(33)]
#MN[i][j] = プラスi-9,マイナスi-9
for _ in range(N):
    a = input()
    two = 0
    five = 0
    ten = 0
    if "." in a:
        shosuten = a.index(".")
        ten = len(a) - shosuten - 1
        a = int("".join([hoge for hoge in a if hoge != "."]))
        two = ten
        five = ten
    else:
        a = int(a)
        two = 0
        five = 0  
    while a%5 == 0:
        a //= 5
        five -= 1
    while a%2 == 0:
        a //= 2
        two -= 1
    MN[two+16][five+16] += 1
    

ans = 0
selfu = 0
for two1 in range(33):
    for two2 in range(33):
        if two1 + two2 > 32:
            break
        for five1 in range(33):
            for five2 in range(33):
                abe = MN[two1][five1]
                nana = MN[two2][five2]
                if two1 + two2 <=32 and five1 + five2 <= 32:
                    if two1 == two2 and five1 == five2:
                        if abe:
                            ans += abe*(nana-1)
                    else:
                        ans += abe*nana
                if five1 + five2 > 32:
                    break
print(ans//2)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[]
for i in range(n):
  s=input()
  if "." in s:
    s+="0"*(9-(len(s)-s.find(".")-1))
    s=s.replace(".","")
  else:s+="0"*9
  s=int(s)
  if s%100000!=0:continue
  a.append(int(s)//100000)
n=len(a)
tf=[[0]*9 for _ in range(9)]
for x in a:
  two=0
  five=0
  while x%2==0:
    x//=2
    two+=1
  while x%5==0:
    x//=5
    five+=1
  two=min(two,8)
  five=min(five,8)
  tf[two][five]+=1
ans=0
for t1 in range(9):
  for f1 in range(9):
    for t2 in range(9):
      for f2 in range(9):
        if t1+t2<8 or f1+f2<8:continue
        if t1==t2 and f1==f2:
          ans+=tf[t1][f1]*(tf[t1][f1]-1)
        else:
          ans+=tf[t1][f1]*tf[t2][f2]
print(ans//2)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    from collections import defaultdict
    dd = defaultdict(int)
    M=10**10

    
    for _ in range(N):
        c=input()
        if float(c)==0:
            dd[10,10]+=1
        else:
            c2=float(c)
            c=int(c2*M)
            i=0
            j=0
            while c%2==0:
                c=c//2
                i+=1
            while c%5==0:
                c=c//5
                j+=1
            i-=10
            j-=10
            i=min(i,10)
            j=min(j,10)
            dd[(i,j)]+=1

    ans=0
    
    #dd同士の重複に注意
    
    K=[]
    V=[]
    for k,v in dd.items():
        K.append(k)
        V.append(v)
        
    
    for iiii in range(len(K)):
        k=K[iiii]
        v=V[iiii]
    
        ii,jj=k
        for i in range(-10,11):
            for j in range(-10,11):
                if ii+i>=0 and jj+j>=0:
                    if ii==i and jj==j:
                        temp=dd[(i,j)]
                        ans+=temp*(temp-1)
                    else:
                        ans+=dd[(i,j)]*v
        # print(k,v,ans)
                    
                    
                    
    print(ans//2)
            
    

            
                    
                       

 
               

main()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
N = int(input())
dic = defaultdict(int)
for i in range(N):
    A = int(float(input())*10**9+0.0000000001)
    two = 0
    five = 0
    while A % 2 == 0:
        A //= 2
        two += 1
    while A % 5 == 0:
        A //= 5
        five += 1
    dic[(two,five)] += 1
ans = 0
for T1,F1 in dic.keys():
    for T2,F2 in dic.keys():
        if T1+T2 >= 18 and F1+F2 >= 18:
            X = dic[(T1,F1)]
            Y = dic[(T2,F2)]
            if T1 == T2 and F1 == F2:
                ans += X*(X-1)
            else:
                ans += X*Y
print(ans//2)

Submission status: Wrong Answer

Solution code:
from scipy.special import comb

n = int(input())
count = 0
a = []
b = []
for i in range(n):
  x = float(input())
  if x.is_integer():
    count = count + 1
    b.append(x)
  else:
    a.append(x)
#  整数×整数
sum = comb(count, 2, exact= True)

#  小数×小数
for i in range(len(a)):
  x = a[i]
  for j in range(len(b)):
    if (x * b[j]).is_integer():
      sum = sum + 1

# 小数×商数
for i in range(len(a)):
  for j in range(i, len(a)-1):
    if (a[i]* a[j]).is_integer():
        sum = sum + 1
print(sum)

Submission status: Wrong Answer

Solution code:
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]
from decimal import Decimal
n=int(input())
alist=[0]*200001
blist=[]
clist=[]
num2=0
num=0
for i in range(n):
  a=float(input())
  if a.is_integer():
    num+=1
    for i in make_divisors(int(a)):
      alist[i]+=1
  else:
    b=str(a)
    c=Decimal(b).as_integer_ratio()
    blist.append(c[1])
    clist.append(c)
    num2+=1
ans=0
for i in blist:
  if i<200001:
    ans+=alist[i]
ans+=num*(num-1)//2
for i in range(num2):
  for j in range(i+1,num2):
    if clist[i][0]%clist[j][1]==0:
      if clist[i][1]%clist[j][0]==0:
        ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
#from pprint import pprint

N = int(input())


p = 19
q = 19

count = 0###両方9以上のやつ

data = [[0 for j in range(q)] for i in range(p)]
for i in range(N):
    A = int(float(input()) * (10**9))
    a = 0
    b = 0
    AA = A
    while AA%2 ==0:
        AA //=2
        a += 1
    AA = A
    while AA%5==0:
        AA //= 5
        b += 1
    data[min(a,18)][min(b,18)] += 1

    if a >= 9 and b >= 9:
        count += 1

S = [[0 for j in range(q)] for i in range(p)]

S[p-1][q-1] = data[p-1][q-1]

for i in range(p-2,-1,-1):
    S[i][q-1] = S[i+1][q-1] + data[i][q-1]

for i in range(q-2,-1,-1):
    S[p-1][i] = S[p-1][i+1] + data[p-1][i]

for i in range(p-2,-1,-1):
    for j in range(q-2,-1,-1):
        S[i][j] = data[i][j] + S[i+1][j] + S[i][j+1] - S[i+1][j+1]

ans = 0

'''
for i in range(19):
    for j in range(19-i):
        if i == 9 and j == 9:
            continue
        ans += S[18-i][18-j] * data[i][j]

###和が18のものと和が18のものの組みは2回足されているので引く
###(9,9),(9,9)はのぞく
for i in range(9):
    ans -= data[i][18-i] * data[18-i][i]

###
#ans += data[9][9]*(data[9][9]-1)//2 + data[9][9]*(S[9][9]-data[9][9])

ans += count*(count-1)//2

#pprint(data)
#pprint(S)
print(ans)
'''

for i in range(19):
    for j in range(19):
        if i >= 9 and j >= 9:
            ans += (S[18-i][18-j] -1)*data[i][j]
        else:
            ans += (S[18-i][18-j])*data[i][j]

print(ans//2)

Submission status: Wrong Answer

Solution code:
n = int(input())
a_lst = []
for i in range(n):
    x = float(input())
    # x *= 10 ** 9
    a_lst.append(x)
startnum = 1
ans = 0
for i in a_lst:
    for j in range(startnum, n):
        # print(i, j)
        # if (i * xx % 1 == 0):
        if ((i * 10 ** 9 * a_lst[j] * 10 ** 9) / (10 ** 18)) % 1 == 0:
            # print(i, a_lst[j], j)

            ans += 1
    startnum += 1
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
N = int(input())
#整数と整数
#有限整数は、「2^t × 5^f」で表せる。
#A = sys.stdin.readlines()
MN = [[0 for i in range(33)] for j in range(33)]
#MN[i][j] = プラスi-9,マイナスi-9
for _ in range(N):
    a = input()
    two = 0
    five = 0
    ten = 0
    if "." in a:
        shosuten = a.index(".")
        ten = len(a) - shosuten - 1
        a = int("".join([hoge for hoge in a if hoge != "."]))
        two = ten
        five = ten
    else:
        a = int(a)
        two = 0
        five = 0  
    while a%5 == 0:
        a //= 5
        five -= 1
    while a%2 == 0:
        a //= 2
        two -= 1
    MN[two+16][five+16] += 1
    

ans = 0
selfu = 0
for two1 in range(33):
    for two2 in range(two1+1):
        for five1 in range(33):
            for five2 in range(five1+1):
                abe = MN[two1][five1]
                nana = MN[two2][five2]
                if two1 + two2 <=32 and five1 + five2 <= 32:
                    if two1 == two2 and five1 == five2:
                        if abe:
                            ans += abe*(nana-1)//2
                    else:
                        ans += abe*nana
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
L = []
for i in range(n):
    s = float(input())
    L.append(s)

cnt = 0
for i in range(n-1):
    for j in range(i+1,n):
        #print(L[i]," ",L[j]," ",int(L[i]*10**9)*int(L[j]*10**9),int(L[i]*10**9)*int(L[j]*10**9) == L[i]*L[j]*10**18)
        if L[i]*L[j]%1 == 0 and int(L[i]*10**9)*int(L[j]*10**9) == L[i]*L[j]*10**18 :
            
            cnt +=1
print(cnt)

Submission status: Wrong Answer

Solution code:
import sys
N = int(input())
#整数と整数
#有限整数は、「2^t × 5^f」で表せる。
#A = sys.stdin.readlines()
MN = [[0 for i in range(33)] for j in range(33)]
#MN[i][j] = プラスi-9,マイナスi-9
for _ in range(N):
    a = input()
    two = 0
    five = 0
    ten = 0
    if "." in a:
        shosuten = a.index(".")
        ten = len(a) - shosuten - 1
        a = int("".join([hoge for hoge in a if hoge != "."]))
        two = ten
        five = ten
    else:
        a = int(a)
        two = 0
        five = 0  
    while a%5 == 0:
        a //= 5
        five -= 1
    while a%2 == 0:
        a //= 2
        two -= 1
    MN[two+16][five+16] += 1
    print(two,five)
    

ans = 0
selfu = 0
for two1 in range(33):
    for two2 in range(two1+1):
        for five1 in range(33):
            for five2 in range(five1+1):
                abe = MN[two1][five1]
                nana = MN[two2][five2]
                if two1 + two2 <=32 and five1 + five2 <= 32:
                    if two1 == two2 and five1 == five2:
                        if abe:
                            ans += abe*(nana-1)
                    else:
                        ans += abe*nana
print(ans//2)

Submission status: Wrong Answer

Solution code:
n=int(input())
A=[input() for i in range(n)]
print()
X=[]
Y=[]
Z=[]
for a in A:
    b=a.split('.')
    if len(b)==1:
        X.append(int(b[0]))
    elif int(b[1])==0:
        X.append(int(b[0]))
    elif len(b[1])<=6:
        Y.append(int(b[1])/10.0**(len(b[1])))
        if len(b[1]) == 1:
            Z.append(float(a))

ans=(len(X)*(len(X)-1))//2


for x in X:
    for y in Y:
        if (x*y).is_integer():
            ans+=1

for i in range(len(Z)):
    for j in range(i+1,len(Z)):
        if (Z[i]*Z[j]).is_integer():
            ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
def is_integer(n):
    try:
        float(n)
    except ValueError:
        return False
    else:
        return float(n).is_integer()
        
N = int(input())

A = []
count = 0
for i in range(N):
    A.append(float(input()))
    
for i in range(N):
    for j in range(i + 1,N):
        # print(str(A[i] * A[j]))
        if is_integer(A[i] * A[j]):
            count+=1
            # print("yes")


print(count)

Submission status: Wrong Answer

Solution code:
import itertools

integers = []
floaters = []
for i in range(int(input())):
  value = float(input())
  if value.is_integer():
    integers.append(value)
  else:
    floaters.append(value)
    
count = len(integers) / 2

floater_integer = list(itertools.product(floaters, integers))
for value in floater_integer:
  result = value[0] * value[1]
  if result.is_integer():
    count += 1
floater_floater = list(itertools.combinations(floaters, 2))
for value in floater_floater:
  result = value[0] * value[1]
  if result.is_integer():
    count += 1
    
print(int(count))

Submission status: Wrong Answer

Solution code:
import sys
from collections import Counter

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 19
MOD = 10 ** 19 + 7
EPS = 10 ** -10

def gcd(a, b):
    while b: a, b = b, a % b
    return a

N = INT()
K = 10**9
L = 10**18
A = [0] * N
C = Counter()
cnt0 = 0
for i in range(N):
    a = float(input())
    A[i] = int(a * K)
    if A[i] == 0:
        cnt0 += 1
    else:
        C[gcd(A[i], L)] += 1

ans = 0
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
ans += cnt0*(cnt0-1) // 2
for v in C.values():
    ans += v * cnt0
print(ans)

Submission status: Wrong Answer

Solution code:

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)

Submission status: Wrong Answer

Solution code:
import math
from decimal import Decimal

n = int(input())
a = []
for _ in range(n):
    a.append(Decimal(input()))
count = 0
for i in range(n-1):
    for j in range(n-i-1):
        result = Decimal(a[i] * a[i + j + 1])
        if math.isclose(result % 1, 0.0, abs_tol=1e-10):
            count += 1

print(count)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
n=int(input())
alist=[0]*n
cnt=0
for i in range(n):
  a=float(input())
  alist[i]=a
  if a.is_integer():
    cnt+=1
k=int(cnt*(cnt-1)*(1/2))
print(k)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math
import bisect

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n = readInt()
a = [round(float(input())*10**9) for i in range(n)]
c = Counter([i%10**9 for i in a])
ans = 0

for i in c:
	if i!=0:
		for j in range(0,len(a)):
			if i*a[j]%10**18==0:
				ans+=1

try:
	c1 = math.factorial(c[0])//(math.factorial(2)*math.factorial(c[0]-2))
except:
	c1 = 0

print(ans+c1)

Submission status: Wrong Answer

Solution code:
import numpy as np

ary = []
seisu = []
kouho = 0
answer = 0
n = int(input())

for i in range(n):
    ary.append(float(input()))

for i in range(n):
    if(i >= n-1):
        break
    for j in range(n):
        if(j >= n-1):
            break
        if(i>j):
            continue
        kouho = ary[i] * ary[j+1]
        #print(ary[i],'*',ary[j+1],'=',kouho)
        if(kouho%1==0):
            seisu.append(kouho)

answer = len(seisu)
print(answer)
#print(seisu)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
N = int(input())
dic = defaultdict(int)
for i in range(N):
    A = int(float(input())*10**9)
    two = 0
    five = 0
    while A % 2 == 0:
        A //= 2
        two += 1
    while A % 5 == 0:
        A //= 5
        five += 1
    dic[(two,five)] += 1
ans = 0
for T1,F1 in dic.keys():
    for T2,F2 in dic.keys():
        if T1+T2 >= 18 and F1+F2 >= 18:
            X = dic[(T1,F1)]
            Y = dic[(T2,F2)]
            if T1 == T2 and F1 == F2:
                ans += X*(X-1)
            else:
                ans += X*Y
print(ans//2)

Submission status: Wrong Answer

Solution code:
def main():
    from sys import stdin
    import numpy as np
    # read
    readline = stdin.readline
    n = int(readline())
    a = [float(readline()) for _ in range(n)]
    a = np.array(a)
    count = 0
    for i in range(n - 1):
        count = count + np.count_nonzero((a * np.roll(a, i + 1)) % 1 == 0)
    print(int(count / 2))


main()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math
import bisect

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n = readInt()
a = [int(float(input())*10**9) for i in range(n)]
c = Counter([i%10**9 for i in a])
ans = 0

for i in c:
	if i!=0:
		for j in range(0,len(a)):
			if i*a[j]%10**18==0:
				ans+=1

try:
	c1 = math.factorial(c[0])//(math.factorial(2)*math.factorial(c[0]-2))
except:
	c1 = 0

print(ans+c1)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/python
# -*- coding: UTF-8 -*-

import sys
from decimal import Decimal


def std_in():
    return sys.stdin.readline().strip()


def main():
    n = int(std_in())
    a = list()
    b = list()
    z = Decimal("0")
    for i in range(n):
        tmp = Decimal(std_in())
        if (tmp - Decimal(int(tmp))) == z:
            a.append(tmp)
        else:
            b.append(tmp)
    al = len(a)
    bl = len(b)
    counter = al * (al-1) * 0.5
    for i in a:
        for j in b:
            p = i * j
            if (p - Decimal(int(p))) == z:
                counter += 1
    for i in range(bl-1):
        for j in range(i+1, bl):
            p = b[i] * b[j]
            if (p - Decimal(int(p))) == z:
                counter += 1
    print(counter)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
epsilon = 0.000001

def solve():
    N = int(input())
    nums = [float(input()) for _ in range(N)]
    ans = 0
    for i, num in enumerate(nums):
        for j in range(i + 1, N):
            if abs(int(num * nums[j]) - (num * nums[j])) < epsilon:
                ans += 1
    return ans


if __name__ == '__main__':
    print(solve())

Submission status: Wrong Answer

Solution code:
n = int(input())

a = []

for i in range(n):
    a.append(float(input()) * 10 ** 9)

count = 0
for i in range(len(a)):
    for j in range(len(a)):
        if i != j and i < j:
            temp = a[i] * a[j] / 10 ** 18
            #print(temp, int(temp))
            if temp - int(temp) == 0:
                count += 1

print(count)

Submission status: Wrong Answer

Solution code:
#from pprint import pprint

N = int(input())


p = 19
q = 19

count = 0###両方9以上のやつ

data = [[0 for j in range(q)] for i in range(p)]
for i in range(N):
    A = int(float(input()) * (10**9))
    a = 0
    b = 0
    AA = A
    while AA%2 ==0:
        AA //=2
        a += 1
    AA = A
    while AA%5==0:
        AA //= 5
        b += 1
    data[min(a,18)][min(b,18)] += 1

    if a >= 9 and b >= 9:
        count += 1

S = [[0 for j in range(q)] for i in range(p)]

S[p-1][q-1] = data[p-1][q-1]

for i in range(p-2,-1,-1):
    S[i][q-1] = S[i+1][q-1] + data[i][q-1]

for i in range(q-2,-1,-1):
    S[p-1][i] = S[p-1][i+1] + data[p-1][i]

for i in range(p-2,-1,-1):
    for j in range(q-2,-1,-1):
        S[i][j] = data[i][j] + S[i+1][j] + S[i][j+1] - S[i+1][j+1]

ans = 0

for i in range(19):
    for j in range(19-i):
        if i == 9 and j == 9:
            continue
        ans += S[18-i][18-j] * data[i][j]

###和が18のものと和が18のものの組みは2回足されているので引く
###(9,9),(9,9)はのぞく
for i in range(9):
    ans -= data[i][18-i] * data[18-i][i]

###
#ans += data[9][9]*(data[9][9]-1)//2 + data[9][9]*(S[9][9]-data[9][9])

ans += count*(count-1)//2

#pprint(data)
#pprint(S)
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

ary = []
seisu = []
kouho = 0
answer = 0
n = int(input())

for i in range(n):
    ary.append(float(input()))

for i in range(n):
    if(i >= n-1):
        break
    for j in range(n):
        if(j >= n-1):
            break
        if(i>j):
            continue
        kouho = ary[i] * ary[j+1]
        print(ary[i],'*',ary[j+1],'=',kouho)
        if(kouho%1==0):
            seisu.append(kouho)

answer = len(seisu)
print(answer)