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:
n = int(raw_input())
G = []

for i in range(22):
    G.append([])
    for j in range(22):
        G[i].append(0)

ans = 0
    
for i in range(n):
    c2 = c5 = 0
    p = int(float(raw_input()) * (1e9))
    while (p%2==0):
        p/=2
        c2+=1
    while (p%5==0):
        p/=5
        c5+=1
    c2 = min(c2,18)
    c5 = min(c5,18)
    for j in range(20):
        for k in range(20):
            if (j+c2 >= 18 and k+c5 >= 18):
                ans += G[j][k]
    G[c2][c5] += 1
print ans

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N = int(input())
	D = defaultdict(int)
	table = [[0] * 100 for i in range(100)]
	tablesum = [[0] * 100 for i in range(100)]
	for i in range(N):
		A = input()
		num = ""
		mod5 = 0
		mod2 = 0
		for j in range(len(A)):
			if A[-1 - j] == ".":
				mod5 -= j
				mod2 -= j
			else:
				num += A[-1 - j]

		num = int(num[::-1])
		while True:
			if num % 2 == 0:
				mod2 += 1
				num = int(num // 2)
			else:
				break
		while True:
			if num % 5 == 0:
				mod5 += 1
				num = int(num // 5)
			else:
				break

		table[50 + mod2][50 + mod5] += 1
		tablesum[50 + mod2][50 + mod5] += 1
		# print(mod2, mod5)

	ans = 0
	# 累積
	for i in range(98, -1, -1):
		for j in range(98, -1, -1):
			tablesum[i][j] += tablesum[i + 1][j]

	for i in range(98, -1, -1):
		for j in range(98, -1, -1):
			tablesum[i][j] += tablesum[i][j + 1]

	ans += (tablesum[50][50]) * (tablesum[50][50] - 1) // 2

	for i in range(1, 50):
		for j in range(1, 100):
			ans += table[i][j] * tablesum[100 - i][100 - j]
			# if table[i][j] * tablesum[100 - i][100 - j] > 0:
				# print(i, j)
				# print(table[i][j], tablesum[100 - i][100 - j])

	print(ans)


if __name__ == '__main__':
	main()

Submission status: Wrong Answer

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

n=int(input())
a=[]
for i in range(n):
    x=float(input())
    x=int(x*10**9)
    a.append(x)

b=[]
for i in a:
    x=i
    count2=0
    while x%2==0:
        x=x//2
        count2+=1
    count5 = 0
    while x % 5 == 0:
        x = x // 5
        count5 += 1

    b.append((count2,count5))

imos=[[0]*50 for i in range(50)]

for i in b:
    imos[0][0]+=1
    imos[i[0]+1][0]-=1
    imos[0][i[1]+1]-=1
    imos[i[0]+1][i[1]+1]+=1

for i in range(49):
    for j in range(49):
        imos[i][j+1]+=imos[i][j]
for j in range(49):
    for i in range(49):
        imos[i+1][j]+=imos[i][j]

ans=0
for i in b:
    x=18-i[0]
    y=18-i[1]
    x=max(x,0)
    y=max(y,0)
    ans+=imos[x][y]

for i in b:
    if i[0]*2>=18 and i[1]*2>=18:
        ans-=1

ans=ans//2
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [0] * N
for i in range(N):
    A[i] = float(input())*(10**9)
from itertools import combinations
base = list(combinations(A,2))
floatans=0
for i in range(len(base)):
    a=base[i][0]*base[i][1]
    if a%(10**18)==0:
        floatans+=1
print(floatans)

Submission status: Wrong Answer

Solution code:
N=int(input())
a=[float(input()) for n in range(N)]
b=0
c=0
if float.is_integer(a[N-1]) is True:
    c+=1
for v in range(N-1):
  for i in range(N-1):
        if float.is_integer(a[v]*a[i+1]) is True:
          b+=1
print(b-c)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = []
count = 0

for _ in range(N):
  A.append(float(input()))

for i in range(N):
  for j in range(N):
    if i < j:
      num1 = A[i] * A[j]
      num2 = int(A[i] * A[j])
      if num1 == num2:
        count += 1

print(count)

Submission status: Wrong Answer

Solution code:
N=int(input())
ans=0
A=[0]*N
a=""
b=""
for i in range(N):
  s=input()
  if "." not in s:
    a=s
    b="000000000"
  else:
    a,b=s.split(".")
    b=b.ljust(9,"0")
    if b[-4:]!="0000":
      continue
  A[i]=int(a+b)
  for j in range(i):
    if i!=j:
      if A[i]*A[j]%(10**18)==0:
        ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
import itertools
n = int(input())
a = [input() for i in range(n)]
count = 0
comb = list(itertools.combinations(a,2))
for i in range(len(comb)):
  aa = float(comb[i][0]) * float(comb[i][1])
  if aa.is_integer():
    count = count +1
print(count)

Submission status: Wrong Answer

Solution code:
from bisect import bisect_left
from decimal import Decimal

N, *A = map(Decimal, open(0).read().split())
N = int(N)
A.sort()

ints = [d for d in A if int(d) == d]
decs = [d for d in A if int(d) != d]

result = len(ints) * (len(ints) - 1) // 2
for i in range(N):
    a = A[i]
    if a == int(a):
        continue
    for j in range(i + 1, N):
        t = a * A[j]
        if t == int(t):
            result += 1
print(result)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = []
for _ in range(N):
    A.append(float(input()))

l = N
count = 0
while l>0:
    for i in range(1,l):
        if (A[0]*A[i]).is_integer():
            count += 1
            #print("{}*{}={}".format(A[0],A[i],A[0]*A[i]))
    A.pop(0)
    l = len(A)

print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from bisect import bisect_left
from decimal import Decimal

N, *A = map(Decimal, open(0).read().split())
N = int(N)
A.sort()

ints = [d for d in A if int(d) == d]
decs = [d for d in A if int(d) != d]

result = len(ints) * (len(ints) - 1) // 2
for i in range(N):
    a = A[i]
    if a == int(a):
        continue
    if a < 1:
        t = bisect_left(A, 1 / a)
    else:
        t = i + 1
    for j in range(t, N):
        t = a * A[j]
        if t == int(t):
            result += 1
print(result)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [float(input()) for _ in range(n)]
ans = 0

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

Submission status: Wrong Answer

Solution code:
import numpy as np
N=int(input())
A=np.empty(N)
for i in range(N):
  a=float(input())
  A[i] = a
count=0
for i in range(N):
  for j in range(i,N):
    if A[i]*A[j].is_integer():
      count=count+1
print(count)

Submission status: Wrong Answer

Solution code:
import sys
readline = sys.stdin.readline
from decimal import Decimal

N = int(readline())
A = [float(readline()) for _ in range(N)]


G = 10**10
Aint = [int(a) for a in A if int(a) == a]
Afl = [int(a*G) for a in A if int(a) != a]


H = 200
geta = 100
Grid = [[0]*H for _ in range(H)]


i25 = []
for ai in Aint:
    i2 = 0
    i5 = 0
    while ai%2 == 0:
        ai //= 2
        i2 += 1
    while ai%5 == 0:
        ai //= 5
        i5 += 1
    i25.append((i2, i5)) 

for af in Afl:
    i2 = -10
    i5 = -10
    while af%2 == 0:
        af //= 2
        i2 += 1
    while af%5 == 0:
        af //= 5
        i5 += 1
    i25.append((i2, i5)) 


for i2, i5 in i25:
    Grid[geta+i2][geta+i5] += 1

for i in range(geta+90, geta-90, -1):
    for j in range(geta+90, geta-90, -1):
        Grid[i][j] += Grid[i][j+1]

for j in range(geta+90, geta-90, -1):
    for i in range(geta+90, geta-90, -1):
        Grid[i][j] += Grid[i+1][j]


lai = len(Aint)
ans = 0
for i2, i5 in i25:
    ans += Grid[geta-i2][geta-i5]
    #print(i2, i5, Grid[geta-i2][geta-i5])
print((ans-lai)//2)

Submission status: Wrong Answer

Solution code:
n = input()
n = int(n)
a = []
tp = 0
for i in range(n):
  tp = input()
  tp = float(tp)
  a.append(tp)
ans = 0
for num in range(len(a)):
  for idx in range(len(a)):
    if num != idx:
    	c = a[num]*a[idx]
    	if c.is_integer() == True:
      		ans += 1
print(int(ans/2))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = []
howmany = [[0] * (19) for _ in range(19)]
for i in range(n):
    x = float(input())
    x = int(x * 10 ** 9)
    cnt_2, cnt_5 = 0, 0
    while x % 2 == 0:
        x //= 2
        cnt_2 += 1
    while x % 5 == 0:
        x //= 5
        cnt_5 += 1
    cnt_2 = min(cnt_2, 18)
    cnt_5 = min(cnt_5, 18)
    howmany[cnt_2][cnt_5] += 1
    a.append((cnt_2, cnt_5))

for i in range(18, -1, -1):
    for j in range(18, 0, -1):
        howmany[i][j-1] += howmany[i][j]

for i in range(18, 0, -1):
    for j in range(18, -1, -1):
        howmany[i-1][j] += howmany[i][j]

#print(*howmany, sep='\n')

cnt = 0
for i in range(n):
    l, r = a[i]
    if l >= 9 and r >= 9:
        cnt += howmany[18-l][18-r] - 1
    else:
        cnt += howmany[18-l][18-r]


print(cnt // 2)

Submission status: Wrong Answer

Solution code:
from bisect import bisect_left
from decimal import Decimal

N, *A = map(Decimal, open(0).read().split())
N = int(N)
A.sort()

ints = [d for d in A if int(d) == d]
decs = [d for d in A if int(d) != d]

result = len(ints) * (len(ints) - 1) // 2
for i in range(N):
    a = A[i]
    if a == int(a):
        continue
    if a < 1:
        t = bisect_left(A, 1 // a)
    else:
        t = i + 1
    for j in range(t, N):
        t = a * A[j]
        if t == int(t):
            result += 1
print(result)

Submission status: Wrong Answer

Solution code:
n=int(input())
a = [input().split() for l in range(n)]

def is_integer(n):
    try:
        float(n)
    except ValueError:
        return False
    else:
        return float(n).is_integer()
t=0
for i in range(0,n-1):
    for j in range (i+1,n):
        if is_integer(a[i][0]) == True and is_integer(a[j][0]) == True:
            t=t+1
        elif is_integer(float(a[i][0])*float(a[j][0])) == True:
            t=t+1
            
print(t)

Submission status: Wrong Answer

Solution code:

#import collections  
#from collections import defaultdict  
#for _ in range(int(input())):
import math
n=int(input())
#w=[int(x) for x in input().split()]
a=[]
for i in range(n):    
    a.append(float(input()))
ans=0
for i in range(n):
    if a[i]==0:
       ans+=(n-1)
       continue
    for j in range(i+1,n):
        #x= a[i]*a[j]
        if (a[i]*a[j]).is_integer():
           ans+=1 
print(ans)

Submission status: Wrong Answer

Solution code:
import math as ma
l = []
n = int (input ())
for i in range (n):
  a = input ()
  l.append (a)
l = [float(s) for s in l]
z = 0
x = 0
y = 1
while x < n:
  while y < n:
    if l[x]*l[y] == ma.ceil (l[x]*l[y]):
      z += 1
    y += 1
  x += 1
  y = x+1
print (z)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = []
for i in range(N):
    X = float(input())
    A.append(int(X*10**9))
T = [[0]*2 for i in range(N)]
max2 = 0
max5 = 0
for i in range(N):

    X = A[i]
    cnt = 0
    while X%5==0:
        cnt+=1
        X = X//5
    T[i][0]=cnt
    max5 = max(max5,cnt)

    X = A[i]
    cnt = 0
    while X%2==0:
        cnt+=1
        X = X//2
    T[i][1]=cnt
    max2 = max(max2,cnt)

S = [[0]*(max2+1) for i in range(max5+1)]

for i in range(N):
    S[T[i][0]][T[i][1]]+=1

out = 0
for j1 in range(max2+1):
    for i1 in range(max5+1):
        for j2 in range(max2+1):
            for i2 in range(max5+1):
                X = S[i1][j1]
                Y = S[i2][j2]
                if i1+i2>=18 and j1+j2>=18:
                    if i1==i2 and j1==j2:
                        out += X*(X-1)
                    else:
                        out += X*Y
print(out//2)

Submission status: Wrong Answer

Solution code:
import sys
#import string
#from collections import defaultdict, deque, Counter
#import bisect
#import heapq
#import math
#from itertools import accumulate
#from itertools import permutations as perm
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as combr
#from fractions import gcd
#import numpy as np

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def solve():
    n = int(stdin.readline().rstrip())
    #A, B, C = map(int, stdin.readline().rstrip().split())
    #l = list(map(int, stdin.readline().rstrip().split()))
    #numbers = [[int(c) for c in l.strip().split()] for l in sys.stdin]
    #word = [stdin.readline().rstrip() for _ in range(n)]
    #number = [[int(c) for c in stdin.readline().rstrip()] for _ in range(n)]
    ans = [[0] * n for i in range(n)]
    As = []
    As.append(float(stdin.readline().rstrip())*10**9)
    for i in range(n-1):
        a = float(stdin.readline().rstrip())*10**9
        for j in range(len(As)):
            if (As[j] * a )%10**18 == 0:
                ans[i+1][j+1] = 1
        As.append(a)
    s = 0
    for i in range(len(ans)):
        s += sum(ans[i])
    print(s)

if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
N = int(input())
lst = []
new_lst = []
for x in range(0, N):
    ele = float(input())
    lst.append(ele)
for i in lst:
    for j in lst:
        a = i * j
        new_lst.append(a)
b = {}
for c in new_lst:
    if c in b:
        b[c] += 1
    else:
        b[c] = 1
print(len([d for d in b if b[d] == 2]))

Submission status: Wrong Answer

Solution code:
N = int(input())

A = [float(input()) for i in range(N)]

count = 0

#print(1.0 % 1 == 0)

for i in range(N):
    for j in range(i+1, N):
        if ((A[i] * (10 ** 9)) * (A[j] * (10 ** 9))) % (1 * ((10 ** 9) ** 2)) == 0:
            count += 1

print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())

a = []

for i in range(n):
    temp = float(input())
    if temp * 1000 - int(temp * 1000) == 0:
        a.append(temp)

count = 0

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

print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())

a = []

for i in range(n):
    temp = float(input())
    if temp * 100 - int(temp * 100) == 0:
        a.append(temp)

count = 0

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

print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(sorted(map(lambda x: float(input(x)), range(n))))
c = 0
for i in range(n-1):
    for j in range(i+1, n):
        if a[i] == a[j]: continue
        p = a[i]*a[j]
        c += int(p)==p
print(c)

Submission status: Wrong Answer

Solution code:
from decimal import Decimal

n = int(input())
a = [Decimal(input()) for i in range(n)]

count = 0
for i, an in enumerate(a):
    for j, am in enumerate(a):
        if i >= j:
            continue
        v = an * am
        if v % 1 == 0:
            print("{}*{}={}".format(an, am, v))
            count = count + 1
print(count)

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
        kouho = ary[i] * ary[j]
        if(kouho % 1 == 0):
            seisu.append(kouho)

answer = len(seisu)
print(answer)

Submission status: Wrong Answer

Solution code:
N = int(input())
a = [float(input()) for i in range(N)]
ans = 0
for i in range(N-1):
    for j in range(i+1, N):
        t = a[i] * a[j]
        if t.is_integer():
            ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
A=[0]*N
count=0
for i in range(N):
  A[i]=float(input())
for i in range(N):
  for j in range(N):
    if i<j and (A[i]*A[j]).is_integer()==True :
      count+=1
print(count)

Submission status: Wrong Answer

Solution code:
from fractions import Fraction

N = int(input())
a = []
p = []
q = [] 
for _ in range(N):
    f = Fraction(input())
    a.append(f)
    p.append(f.numerator)
    q.append(f.denominator)

ans = set()
for i in range(N):
    for j in range(i + 1, N):
        if p[i] % q[j] == 0 and p[j] % q[i] == 0:
            ans.add(a[i] * a[j])

# print(ans)
print(len(ans))

Submission status: Wrong Answer

Solution code:
N=int(input())
A=[]
for i in range(N):
  a=float(input())
  A.append(a)
count=0
for i in range(N):
  for j in range(i,N):
    if A[i]*A[j].is_integer():
      count=count+1
print(count)

Submission status: Wrong Answer

Solution code:
import sys
import bisect
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 = [divide(int(float(input())*1e9)) for _ in range(n)]
    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()

Submission status: Wrong Answer

Solution code:
n = int(input())
nums = []
for i in range(n):
    i = input()
    if '.' in i:
        i = float(i)
    else:
        i = int(i)
    nums.append(i)
count = 0
for k in range(len(nums)):
    for v in range(k + 1, len(nums)) :
        result = nums[k] * nums[v]
        if isinstance(result, int) == True or result.is_integer() == True:
            count += 1
print(count)

Submission status: Wrong Answer

Solution code:
from decimal import Decimal

n = int(input())
a = [Decimal(input()) for i in range(n)]

count = 0
for i, an in enumerate(a):
    for j, am in enumerate(a):
        if i == j:
            continue
        v = an * am
        if v % 1 == 0:
            print("{}*{}={}".format(an, am, v))
            count = count + 1
print(int(count / 2))

Submission status: Wrong Answer

Solution code:
n=int(input())
li=[]
for i in range(0,n):
    li.append(float(input()))

ans=0
for i in range(0,n):
    for j in range(i+1,n):
        if(int(li[i]*li[j])==li[i]*li[j]):
            ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
A=[0]*N
for i in range(N):
  A[i]=float(input())*1000000000
ans=0
for i in range(N-1):
  for j in range(i+1,N):
    if A[i]*A[j]%1000000000000000000==0:
      ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
import itertools

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

#print(N.is_integer())
for i in range(N):
  v = float(input())
  A.append(v)

sum = 0
for i in itertools.combinations(A, 2):
  v = i[0] * i[1]
  if v.is_integer() == True:
    sum += 1
print(sum)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [input() for _ in range(N)]

from collections import Counter
ctr = Counter()

for a in A:
    of = 0
    if '.' in a:
        of = a[::-1].index('.')
        a = a.replace('.', '')
    a = int(a)
    ni = go = -of
    while a%2==0:
        a//=2
        ni += 1
    while a%5==0:
        a//=5
        go += 1
    ctr[(ni,go)] += 1

ans = 0
for (ni1,go1),v1 in ctr.items():
    for (ni2,go2),v2 in ctr.items():
        if ni1+ni2 < 0 or go1+go2 < 0: continue
        print(ni1,go1, ni2,go2)
        if ni1==ni2 and go1==go2:
            ans += v1*(v1-1)
        else:
            ans += v1*v2
print(ans//2)

Submission status: Wrong Answer

Solution code:
n = int(input())

a = []

for i in range(n):
    temp = float(input())
    if temp * 10 - int(temp * 10) == 0:
        a.append(temp)

count = 0

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

print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())

A = []
for _ in range(N):
    a = float(input())
    A.append(a)


product =[]
for i in range(N):
    for j in range(i+1,N):
        product.append(A[i]*A[j])


count = 0
for k in range(len(product)):
    if product[k].is_integer() == True:
        count += 1
        
print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())
a = [float(input()) for i in range(N)]
print(a)
count = 0
for i in range(N):
  a1 = a.pop(0)
  for a2 in a:
    ans = a1 * a2
    print(a1, a2, ans)
    if ans.is_integer():
      count += 1

print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [float(input()) for _ in range(N)]
ans = 0

for i, a in enumerate(A):
    for j, b in enumerate(A):
        if i != j and i < j:
            tmp = a * b
            if tmp.is_integer():
                ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
an_list=[]
Ans = 0
for i in range(n):
    an = float(input())
    an_list.append(an)
    for j in range(i):
        b = an * an_list[j]
        if b.is_integer():
            Ans += 1
print(Ans)

Submission status: Wrong Answer

Solution code:
###############################################
#                                             #
#   author: raghav_0901 (Raghav Dalmia)       #
#   updated on: 09-08-2020,  5:48:55 pm IST   #
#                                             #
###############################################


from math import *


def _in():
    arr = [int(x) for x in input().split(' ')]
    return arr[0] if len(arr) == 1 else arr


def isInt(n):
    for i in range(18):
        if(n == 0 or n % 10 != 0):
            return 0
        n = n // 10
    return 1


if __name__ == "__main__":
    n = int(input())
    arr = []
    for i in range(n):
        arr.append(float(input()))

    ans = 0
    for i in range(0, n - 1):
        for j in range(i + 1, n):
            ans = ans + isInt((arr[i] * (10**9)) * (arr[j] * (10**9)))

    print(ans)

Submission status: Wrong Answer

Solution code:
from decimal import Decimal
N = int(input())

A = [Decimal(input()) for i in range(N)]

cnt = 0
for i in range(N):
    if len(str(A[i])[len(str(int(A[i])))+1:])>=5:
        break
    for j in range(i+1,N):
        prod = A[i]*A[j]
        if prod == int(prod):


            cnt += 1

print(cnt)

Submission status: Wrong Answer

Solution code:
from decimal import Decimal
N = int(input())

A = [Decimal(input()) for i in range(N)]

cnt = 0
for i in range(N):
    if len(str(A[0])[len(str(int(A[0])))+1:])>=5:
        break
    for j in range(i+1,N):
        prod = A[i]*A[j]
        if prod == int(prod):


            cnt += 1

print(cnt)

Submission status: Wrong Answer

Solution code:
n=int(input())
a = [input().split() for l in range(n)]

def is_integer(n):
    try:
        float(n)
    except ValueError:
        return False
    else:
        return float(n).is_integer()
t=0
for i in range(0,n-1):
    for j in range (i+1,n):
        if is_integer(float(a[i][0])*float(a[j][0])) == True:
            t=t+1

print(t)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
a = int(input())
 
# 浮動小数点の入力
num_list = []
for i in range(a):
  num_list.append(float(input()))
 
count = 0
for i in num_list:
  for j in num_list:
    if i != j and isinstance(i*j, int):
      count += 1
 
# 出力
print("{}".format(int(count/2)))

Submission status: Wrong Answer

Solution code:
N = int(input())
a = [float(input()) for i in range(N)]
cnt = 0
for i in range(N):
	for j in range(i+1,N):
		#print("i,j",i,j)
		#print(a[i]*a[j],(a[i]*a[j]).is_integer())
		#print("cnt",cnt)
		if (a[i]*a[j]).is_integer():
			cnt += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
import sys
def input():
    return sys.stdin.readline()[:-1]


def main():
    N = int(input())
    A = [input() for _ in range(N)]
    ans = 0
    for i in range(N):
        for j in range(i + 1, N):
            a = float(A[i]) * float(A[j]) 
            #print(a,'aaaaa') 
            if a.is_integer() == True:
                ans += 1
                print(A[i], A[j], a)
    print(ans)

    
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())

a = []

for i in range(n):
    temp = float(input())
    if temp * 10 - int(temp * 10) == 0:
        a.append(temp)

count = 0

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

print(count)

Submission status: Wrong Answer

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()

def calc(x):
    n = int(x * 10 ** 9)
    a = 0
    b = 0
    while n % 2 == 0:
        n //= 2
        a += 1
    while n % 5 == 0:
        n //= 5
        b += 1
    return (min(a, 18), min(b, 18))

ans = 0
N = int(input())
X = [[0] * 19 for _ in range(19)]
for _ in range(N):
    a, b = calc(float(input()))
    if a >= 9 and b >= 9:
        ans -= 1
    X[a][b] += 1

Y = [x[:] for x in X]

for i in range(18)[::-1]:
    for j in range(19):
        Y[i][j] += Y[i+1][j]
for i in range(19):
    for j in range(18)[::-1]:
        Y[i][j] += Y[i][j+1]

for i in range(19):
    for j in range(19):
        ans += X[i][j] * Y[18-i][18-j]
print(ans // 2)

Submission status: Wrong Answer

Solution code:
data = []
N = int(input())
cnt = 0
for i in range(N):
    data.append(float(input()))
for i in range(N-1):
    for j in range(i+1, N):
        a = data[i]
        b = data[j]
        if a*b == int(a*b):
            cnt += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
n=int(input())
a = [input().split() for l in range(n)]

def is_integer(n):
    try:
        float(n)
    except ValueError:
        return False
    else:
        return float(n).is_integer()
t=0
for i in range(0,n-1):
    for j in range (i+1,n):
        if is_integer(float(a[i][0])*float(a[j][0])) == True:
            t=t+1
            print([i,j])
print(t)

Submission status: Wrong Answer

Solution code:
N = int(input())
l = []
for i in range(N):
  a = float(input())
  l.append(a)
count = 0
for i in range(N):
  for j in range(i+1,N):
    an = l[i]*l[j]
    if an.is_integer()==True:
      count += 1
print(count)

Submission status: Wrong Answer

Solution code:
from collections import deque
import math

def Next(): return input()
def NextInt(): return int(Next())
def NextInts(): return map(int,input().split())
def Nexts(): return map(str,input().split())
def NextIntList(): return list(map(int,input().split()))
def RowInts(n): return [input() for i in range(n)]

n = int(input())
da = [[0 for i in range(50)] for j in range(50)]
ans = 0
for i in range(n):
    now = round(float(input())*1000000000)
    # print(now)
    a, b = 0, 0
    while(now%5 == 0):
        now //= 5
        a += 1
    while(now%2 == 0):
        now //= 2
        b += 1
    da[a][b] += 1
    print(a, b)
    if a >= 9 and b >= 9: ans -= 1

print(da)
print(ans)

for i in range(50):
    for j in range(50):
        for k in range(50):
            for l in range(50):
                if i+k >= 18 and j+l>= 18:
                    ans += da[i][j]*da[k][l]

print(ans//2)

Submission status: Wrong Answer

Solution code:
N=int(input())
nums=[]
count=0
for i in range(N):
  a=float(input())
  nums.append(a)
k=1
for i in range(N):
  for j in range(k, N):
    if nums[i]*nums[j]*10**9-int(nums[i]*nums[j])*10**9==0:
      count+=1
    k+=1

print(count)

Submission status: Wrong Answer

Solution code:
from fractions import Fraction

N = int(input())
a = []
p = []
q = [] 
for _ in range(N):
    f = Fraction(input())
    a.append(f)
    p.append(f.numerator)
    q.append(f.denominator)

ans = set()
for i in range(N):
    for j in range(i, N):
        if p[i] % q[j] == 0 and p[j] % q[i] == 0:
            ans.add(a[i] * a[j])

# print(ans)
print(len(ans))

Submission status: Wrong Answer

Solution code:
# problem a
# score 300
from collections import defaultdict
N = int(input())
A = []
from decimal import Decimal
for i in range(N):
    x = float(input())
    x = Decimal(x*(10**9))
    x=int(x)
    A.append(x)
remove = 0
for i in range(N):
    if (A[i]**2) % (10**18) == 0:
        remove += 1
D = defaultdict(int)
data = []
for x in A:
    order2 = 0
    order5 = 0
    K = x
    while K % 2 == 0:
        order2 += 1
        K = K//2
    while K % 5 == 0:
        order5 += 1
        K = K//5
    data.append((order2, order5))
    for i in range(order2+1):
        for j in range(order5+1):
            D[2**i*5**j] += 1
ans = 0
for ord2, ord5 in data:
    new_ord2 = max(0, 18-ord2)
    new_ord5 = max(0, 18-ord5)
    ans += D[(2**new_ord2)*(5**new_ord5)]
ans-=remove
ans = ans//2
print(ans)

Submission status: Wrong Answer

Solution code:
param_n = int(input())

list_num = list()
for i in range(param_n):
  list_num.append(float(input()))
  
len_list_num = len(list_num)

list_time = list()
for i_first in range(len_list_num - 1):
  list_time = list_time + [list_num[i_first]*list_num[i_second] for i_second in range(i_first + 1, len_list_num)]

print([i.is_integer() for i in list_time].count(True))

Submission status: Wrong Answer

Solution code:
N=int(input())
nums=[]
count=0
for i in range(N):
  a=float(input())
  nums.append(a)
k=1
for i in range(N):
  for j in range(k, N):
    if nums[i]*nums[j]*10**9-int(nums[i]*nums[j]*10**9)==0:
      count+=1
    k+=1

print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [int(float(input()) * 10**9) for i in range(n)]
for i in range(n):
    if a[i]%(10**5) == 0:
        a[i] //= (10**5)
    else:
        a[i] = -1
ans = 0
for i in range(n-1):
    for j in range(i+1,n):
        if a[i] > 0 and a[j] > 0 and a[i]*a[j] %(10**8) == 0:
            ans += 1
            # print(a[i],a[j])
print(ans)
# print(a)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = [float(input()) for _ in range(N)]
S.sort()
for i in range(len(S)):
    S[i]=S[i]-int(S[i])
cnt = 0
for i in range(len(S)):
    for j in range(i+1, len(S)):
        if (S[i]*S[j]).is_integer():
            cnt +=1
print(cnt)