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:
# -*- coding: utf-8 -*-
import io, sys
from decimal import Decimal

def main():
    N = int( sys.stdin.readline() )
    A_list = [Decimal( sys.stdin.readline() ) for _ in range(N)]

    mul = set()

    for i in range(len(A_list)):
        for j in range(i+1, len(A_list)):
            calc = A_list[i] * A_list[j]

            if calc % 1 == 0:
                mul.add(calc)
    
    print(len(mul))


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
a = []
for i in range(n):
    a.append(float(input()))
    
ans = 0
for i in range(n):
    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())
a = [float(input()) for i in range(N)]

count = 0
for i in range(N):
  a1 = a.pop(0)
  if len(str(a1)) >= 9:
    continue
  
  for a2 in a:
    ans = a1 * a2

    if ans.is_integer():
      count += 1

print(count)

Submission status: Wrong Answer

Solution code:
from decimal import Decimal
n = int(input())
ls1 = []
c = 0
for i in range(n):
    ls1.append(float(input()))
for i in range(n):
    for j in range(i+1,n):
        k = (ls1[i]*ls1[j])
        if k == int(k):
            print(k,ls1[i],ls1[j])
            c += 1
print(c)

Submission status: Wrong Answer

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

int_cnt = 0
lst = [[0 for _ in range(10)] for _ in range(20)]
lst2 = [[0 for _ in range(21)] for _ in range(31)]
for num in alst:
    if num % 1 == 0:
        int_cnt += 1
        b = 0
        f = 0
        while num % 2 == 0:
            b += 1
            num //= 2
        while num % 5 == 0:
            f += 1
            num //= 5
        lst[b][f] += 1
    else:
        num *= 10 ** 9
        b = 19
        f = 19
        while num % 2 == 0:
            b -= 1
            num //= 2
        while num % 5 == 0:
            f -= 1
            num //= 5
        lst2[b][f] += 1
        
ans = int_cnt * (int_cnt - 1) // 2

for i in range(20):
    for j in range(10):
        cnt = 0
        for k in range(11 + i):
            for l in range(11 + j):
                cnt += lst2[k][l]
        ans += cnt * lst[i][j]
        
cnt = 0    
for i in range(11):
    cnt2 = 0
    cnt3 = 0
    for j in range(10, 21 - i):
        for k in range(31):
            cnt2 += lst2[k][j]
    for j in range(21):
        cnt3 += lst2[i][j]
    cnt += cnt2 * cnt3
print(ans + cnt)

Submission status: Wrong Answer

Solution code:
import sys
import math
import copy
import heapq
from fractions import *
from decimal import *
from functools import cmp_to_key
from bisect import bisect_left, bisect_right
from collections import defaultdict, deque, Counter
sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = float("inf")
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)

def nck(n, k, kaijyo):
    return (npk(n, k, kaijyo) * divide(kaijyo[k])) % MOD

def npk(n, k, kaijyo):
    if k == 0 or k == n:
        return n % MOD
    return (kaijyo[n] * divide(kaijyo[n-k])) % MOD

def fact_and_inv(SIZE):
    inv = [0] * SIZE  # inv[j] = j^{-1} mod MOD
    fac = [0] * SIZE  # fac[j] = j! mod MOD
    finv = [0] * SIZE  # finv[j] = (j!)^{-1} mod MOD
    inv[1] = 1
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    for i in range(2, SIZE):
        inv[i] = MOD - (MOD // i) * inv[MOD % i] % MOD
        fac[i] = fac[i - 1] * i % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD

    return fac, finv

def renritsu(A, Y):
    # example 2x + y = 3, x + 3y = 4
    # A = [[2,1], [1,3]])
    # Y = [[3],[4]] または [3,4]
    A = np.matrix(A)
    Y = np.matrix(Y)
    Y = np.reshape(Y, (-1, 1))
    X = np.linalg.solve(A, Y)

    # [1.0, 1.0]
    return X.flatten().tolist()[0]

class TwoDimGrid:
    # 2次元座標 -> 1次元
    def __init__(self, h, w, wall="#"):
        self.h = h
        self.w = w
        self.size = (h+2) * (w+2)
        self.wall = wall
        self.get_grid()
        # self.init_cost()

    def get_grid(self):
        grid = [self.wall * (self.w + 2)]
        for i in range(self.h):
            grid.append(self.wall + getS() + self.wall)

        grid.append(self.wall * (self.w + 2))
        self.grid = grid
    def init_cost(self):
        self.cost = [INF] * self.size

    def pos(self, x, y):
        # 壁も含めて0-indexed 元々の座標だけ考えると1-indexed
        return y * (self.w + 2) + x
    def getgrid(self, x, y):
        return self.grid[y][x]
    def get(self, x, y):
        return self.cost[self.pos(x, y)]
    def set(self, x, y, v):
        self.cost[self.pos(x, y)] = v
        return
    def show(self):
        for i in range(self.h+2):
            print(self.cost[(self.w + 2) * i:(self.w + 2) * (i+1)])
    def showsome(self, tgt):
        for t in tgt:
            print(t)
        return
    def showsomejoin(self, tgt):
        for t in tgt:
            print("".join(t))
        return

    def search(self):
        grid = self.grid
        move = [(0, 1), (0, -1), (1, 0), (-1, 0)]
        move_eight = [(0, 1), (0, -1), (1, 0), (-1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
        # for i in range(1, self.h+1):
        #     for j in range(1, self.w+1):
        #         cx, cy = j, i
        #         for dx, dy in move_eight:
        #             nx, ny = dx + cx, dy + cy

def so(n):
    ret = []
    for i in range(2, int(math.sqrt(n) + 2)):
        if n % i == 0:
            ret.append(i)

    if ret == []:
        return [n]
    else:
        return ret

def getnig(n):
    ni, go = 0, 0
    while n % 2 == 0:
        ni += 1
        n //= 2
    while n % 5 == 0:
        go += 1
        n //= 5

    return min(18, ni), min(18, go)


def solve():
    # n = getN()
    # nums = []
    # bunsi = [0 for i in range(100)]
    # sei = 0
    # for i in range(n):
    #     S = getS()
    #     if "." not in S:
    #         sei += 1
    #         for sso in so(int(S)):
    #             bunsi[sso] += 1
    #
    #     else:
    #         nums.append(float(S))
    #
    # print(bunsi)
    # print(nums)
    # # for num in nums:
    # #     for s in so(num):
    # #         bunsi[s] += 1
    # # for
    n = getN()
    nums= []
    nigolis = [[0 for i in range(19)] for j in range(19)]
    for i in range(n):
        S = getS()
        num = (Fraction(Decimal(S) * Decimal(1000000000)).numerator)
        # num *= 10 ** 9
        ni, go = getnig(num)
        nigolis[ni][go] += 1
        nums.append((ni,go))
    # print(nums)
    for i in range(18):
        for j in range(18):
            nigolis[i][j+1] += nigolis[i][j]
    # for nigo in nigolis:
    #     print(nigo)
    ans = 0
    for tn, tg in nums:
        for i in range(18-tn, 19):
            if tg == 18:
                ans += nigolis[i][-1]
            else:
                ans += nigolis[i][-1] - nigolis[i][18-tg-1]

        if tn >= 9 and tg >= 9:
            ans -= 1
        # print(ans)

    print(ans // 2)
    # a = (Fraction(Decimal("0.3") * Decimal(1000000000)).numerator)
    # print(type(a))
def main():
    n = getN()
    for _ in range(n):
        solve()

    return
if __name__ == "__main__":
    # main()
    solve()

Submission status: Wrong Answer

Solution code:
N = int(input()) 

A = []
T = 0
M = 0

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

def is_integer(n):
    try:
        float(n)
    except ValueError:
        return False
    else:
        return float(n).is_integer()

c = 0
for i in range(N-1):
    for j in range(N - i -1):
        T = A[i] * A[i + j+1]
        c += 1
        if is_integer(T):
            M += 1
    c = 0
            

print(M)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = []
for _ in range(N):
    S.append(float(input()))
ans = 0
    
while len(S) != 0:
    tmp = S[0]
    S.pop(0)
    for i in list(map(lambda x: x * tmp,S)):
        if i.is_integer():
            ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
#N = 1

A = [float(input()) for _ in range(N)]
A = [math.modf(i*10000) for i in A]

counter = 0
for i in range(N-1):
	for j in range(i+1, N):
		num = (A[i][0]*A[j][0] + A[i][0]*A[j][1] + A[i][1]*A[j][0] + A[i][1]*A[j][1])/10000/10000
		print(num)
		if int(num)==num:
			counter += 1
print(counter)

Submission status: Wrong Answer

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

for i in range(n-1):
    print('test')
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
int5=[0,0,0,0,0,0,0,0,0]
int2=[0,0,0,0,0,0,0,0,0]
int_other=[0,0,0,0,0,0,0,0,0]
deci5=[0,0,0,0,0,0,0,0,0]
deci2=[0,0,0,0,0,0,0,0,0]
deci_other=[0,0,0,0,0,0,0,0,0]
for i in range(n):
  a=float(input())
  if a.is_integer():
    a=int(a)
    j=0
    while a%10==0:
      j+=1
      a//=10
    if a%2==0:
      int2[j]+=1
    elif a%5==0:
      int5[j]+=1
    else:
      int_other[j]+=1
  else:
    a*=1000000000
    a=int(a)
    j=8
    while a%10==0:
      j-=1
      a//=10
    if a%2==0:
      deci2[j]+=1
    elif a%5==0:
      deci5[j]+=1
    else:
      deci_other[j]+=1
ans=deci2[0]*deci5[0]
if sum(int2)+sum(int5)+sum(int_other)>=1:
  ans+=(sum(int2)+sum(int5)+sum(int_other))*(sum(int2)+sum(int5)+sum(int_other)-1)//2
for i in range(9):
  for j in range(i,9):
    ans+=deci2[i]*int5[j]
    ans+=deci5[i]*int2[j]
for i in range(9):
  for j in range(i+1,9):
    ans+=deci_other[i]*(int2[j]+int5[j]+int_other[j])
print(ans)

Submission status: Wrong Answer

Solution code:
data = []
count = 0
n=int(input())

for i in range(n):
    data.append(float(input()))
#print(data)
for i in range(n-1):
     for j in range(i+1,n):
            if(data[i] * data[j] == int(data[i] * data[j])):
                 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(len(decs)):
    a = decs[i]
    if a < 1:
        t = bisect_left(decs, 1 // a)
    else:
        t = i + 1
    for j in range(t, len(decs)):
        t = a * decs[j]
        if t == int(t):
            result += 1

    t = bisect_left(ints, 1 // a)
    for j in range(t, len(ints)):
        t = a * decs[j]
        if t == int(t):
            result += 1

print(result)

Submission status: Wrong Answer

Solution code:
n = int(input())
nums = []
for i in range(n):
    nums.append(float(input()))
f = 0
multipleList = []
for i in range(n):
    f += 1
    for j in range(f,n):
        multipleList.append(str(nums[i]*nums[j]))
integerList = [integer for integer in multipleList if integer[-1] == '0']
count = 0
for integer in integerList:
    index = integer.index('.')
    if integer[index+1:] == '0':
        count += 1
print(count)

Submission status: Wrong Answer

Solution code:
from fractions import Decimal

def is_int(x, y):
    p = x * y
    r = p - int(p) <= 1e-10
    return r


n = int(input())
arr = []
for _ in range(n):
    arr.append(Decimal(input()))

count = 0
for i, x in enumerate(arr):
    for y in arr[i + 1:]:
        count += is_int(x, y)

print(count)

Submission status: Wrong Answer

Solution code:
def is_integer_num(n):
    if isinstance(n, int):
        return True
    if isinstance(n, float):
        return n.is_integer()
    return False
n = int(input())
s = [input() for i in range(n)]
j = 0
for p in range(0,n):
    for q in range(p+1,n):
        if is_integer_num(float(s[p])*float(s[q])) == True:
            j = j + 1
        else:
            j = j
print(j)

Submission status: Wrong Answer

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

N=int(input())
A=[input().strip() for i in range(N)]

X=[]

for a in A:
    TWO=0
    FIVE=0

    if "." in a:
        x=a.split(".")
        L=len(x[1])
        #print(x,L)
        TWO-=L
        FIVE-=L

        x=int("".join(x))

        #print(x)

        while x%2==0:
            x//=2
            TWO+=1

        while x%5==0:
            x//=5
            FIVE+=1

        #print(TWO,FIVE)

    else:
        x=int(a)
        while x%2==0:
            x//=2
            TWO+=1

        while x%5==0:
            x//=5
            FIVE+=1

    X.append((TWO,FIVE))

LIST=[[0]*100 for i in range(100)]

for x,y in X:
    LIST[x+15][y+15]+=1

#for l in LIST:
#    print(*l)

#print()

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

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

#for l in LIST:
#    print(*l)

ANS=0

for x,y in X:
    x2=-x
    y2=-y

    if x>=x2 and y>=y2:
        ANS-=1

    ANS+=LIST[x2+15][y2+15]

    #print(x,y,ANS)

print(ANS//2)

Submission status: Wrong Answer

Solution code:
n = int(raw_input())
G = []

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

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

Submission status: Wrong Answer

Solution code:
import sys
import copy
import math

count = int(sys.stdin.readline())
values = []
for i in range(count):
    values.append(float(sys.stdin.readline()))
values2 = copy.copy(values)
for i in range(count):
    v, _ = math.modf(values[i])
    if v != 0 and str(v)[-1] != '5':
        values2[i] = None
result = 0
for i in range(count):
    for j in range(i+1, count):
        if values2[j] is not None:
            v, _ = math.modf(values[i] * values[j])
            if v == 0:
                result += 1
print(result)

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) or c1 == 9 or 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:
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])

	for j in range(1, 50):
		ans += table[50][j] * tablesum[50][100 - j]

	print(ans)


if __name__ == '__main__':
	main()

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)
#     print(f)
# print(max(q))

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])
        p = a[i] * a[j]
        if p.denominator == 1:
            ans.add(p)

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

Submission status: Wrong Answer

Solution code:
N = int(input())
lst = []
new_lst = []
c = 0
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)
for b in new_lst:
    if b.is_integer():
        c += 1
    else:
        c += 0
print(c)

Submission status: Wrong Answer

Solution code:
n=int(input())
A=[float(input()) for _ in range(n)]
multiple=[]
for i in range(n-1):
    c=n-1
    for j in range(c):
        multiple.append(A[i]*A[j])
        c-=1
result=[]
print(multiple)
for num in multiple:
    if num.is_integer():
        result.append(num)
    else:
        continue
print(len(result))

Submission status: Wrong Answer

Solution code:
N = int(input())

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

count = 0
v = 0.0
for i in range(N):
  for j in range(i+1, N):
    v = A[i] * A[j]
    if v.is_integer():
      count += 1

print(count)

Submission status: Wrong Answer

Solution code:
arr = list()
for i in range(int(input())):
    arr.append(float(input()))
count = 0
for i in range(len(arr)):
    for j in range(i + 1, len(arr)):
        if int((arr[i] - int(arr[i])) * (arr[j] - int(arr[j]))) - ((arr[i] - int(arr[i])) * (arr[j] - int(arr[j]))) >= 0:
            count += 1
print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [input().split('.')[-1] for _ in range(n)]
ans = 0

for i in range(n-1):
    for j in range(i+1, n):
        s = 'test'
print(ans)

Submission status: Wrong Answer

Solution code:
n =  input()
a = []
for i in range(int(n)):
	b = input ()
	a.append(b)

ans = 0

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = input()
N = int(N)
A = list()
i = 0
j = 1
s = 0
for i in range (N):
    a = input()
    a = float(a)
    A.append(a)
for i in range (N - 1):
    I = i
    for i in range (j):
        v = A[i] * A[j]
        if v.is_integer() == True:
            s = s + 1
            print('('  + str(i) + ',' + str(j) + ')')
            print(A[i] * A[j])
            print('')
        i = i + 1
    j = j + 1
    i = 0
print(s)

Submission status: Wrong Answer

Solution code:
from decimal import *
import math

N = int(input())
A = []
ans = 0
for _ in range(N):
    A.append(Decimal(input()))
for i in range(len(A)-1):
    for j in range(i+1, len(A)):
        if math.modf(float(A[i]*A[j]))[0] == 0:
            print(A[i],A[j],A[i]*A[j])
            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())
  A[i]*=10**9
for i in range(N):
  for j in range(N):
    if i<j and (A[i]*A[j]/10**18).is_integer()==True :
      count+=1
print(count)

Submission status: Wrong Answer

Solution code:
def permute(list, s):
    if list == 1:
        return s
    else:
        return [ y * x if x!=y else None
                 for y in permute(1, s)
                 for x in permute(list - 1, s)
                 ]

N = int(input())
a = []
for x in range (N):
    a.append(float(input()))

res = permute(2,a)
res = set(res)
ans = 0
for x in res:
    print(x)
    if x is not None:
        if x.is_integer():
            ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
a = [float(input()) for i in range(N)]
ans = 0
b = []
c = []
for i in range(N):
    if a[i].is_integer():
        b.append(a[i])
        ans += int(len(b) * (len(b)-1) / 2)
    else:
        c.append(a[i])
for i in range(len(c)):
    for j in range(len(b)):
        if (c[i]*b[j]).is_integer():
            ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
import decimal
N=int(input())
A=np.empty(N)
for i in range(N):
  decimal.getcontext().prec = 9
  a = decimal.Decimal(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:
# agc047_a.py
# https://atcoder.jp/contests/agc047/tasks/agc047_a

global FLAG_LOG
FLAG_LOG = False


def log(value):
    # FLAG_LOG = True
    # FLAG_LOG = False
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    # S = lines[0]
    N = int(lines[0])
    # N, M = list(map(int, lines[0].split()))
    # values = list(map(int, lines[0].split()))
    # values = list(map(int, lines[2].split()))
    values = list()
    for i in range(N):
        values.append(float(lines[i+1]))
    # valueses = list()
    # for i in range(N):
    #     valueses.append(list(map(int, lines[i+1].split())))

    cnt = 0
    for i in range(N-1):
        for j in range(i+1, N):
            a = values[i] * (10**9)
            b = values[j] * (10**9)
            su = a * b
            # tmp = int(su)
            # if su == tmp:
            #     log(f'OK : i=[{i}], j=[{j}], su=[{str(su)}], tmp=[{str(tmp)}]')
            #     cnt += 1
            # else:
            #     # log(f'NG : i=[{i}], j=[{j}], su=[{str(su)}], tmp=[{str(tmp)}]')
            #     pass
            q, mod = divmod(a*b, 10**18)
            if mod == 0:
                cnt += 1

    return [cnt]


# 引数を取得
def get_input_lines():
    line = input()
    N = int(line)
    lines = list()
    lines.append(line)
    for _ in range(N):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['5', '7.5', '2.4', '17.000000001', '17', '16.000000000']
        lines_export = [3]
    if pattern == 2:
        lines_input = ['11', '0.9', '1', '1', '1.25', '2.30000', '5', '70', '0.000000001', '9999.999999999', '0.999999999', '1.000000001']
        lines_export = [8]
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode


# 主処理
def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines()
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')
    # finished = time.time()
    # duration = finished - started
    # print(f'duration=[{duration}]')


# 起動処理
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
import copy
import math

count = int(sys.stdin.readline())
values = []
for i in range(count):
    values.append(float(sys.stdin.readline()))
values2 = copy.copy(values)
for i in range(count):
    v, _ = math.modf(values[i] * 10)
    if v != 0:
        values2[i] = None
result = 0
for i in range(count):
    for j in range(i+1, count):
        if values2[j] is not None:
            v, _ = math.modf(values[i] * values[j])
            if v == 0:
                result += 1
print(result)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
a = [float(input()) for i in range(N)]
t = 0
for i in range(N):
    for j in range(N):
        if i != j:
            s = a[i]*a[j]
            b,c = math.modf(s)
            if b == 0:
                t += 1
print(int(t/2))

Submission status: Wrong Answer

Solution code:
N=int(input())
A = [0.0]*N
for i in range(N):
  A[i] = float(input())

ans = 0
  
for i in range(N-1):
  for j in range(i+1, N):
    if (((A[i]*1000000000) * (A[j]*1000000000))/1000000000000000000).is_integer():
      ans += 1
  
  
print(N)
print(A)
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
import math
import copy
import heapq
from fractions import *
from decimal import *
from functools import cmp_to_key
from bisect import bisect_left, bisect_right
from collections import defaultdict, deque, Counter
sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = float("inf")
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)

def nck(n, k, kaijyo):
    return (npk(n, k, kaijyo) * divide(kaijyo[k])) % MOD

def npk(n, k, kaijyo):
    if k == 0 or k == n:
        return n % MOD
    return (kaijyo[n] * divide(kaijyo[n-k])) % MOD

def fact_and_inv(SIZE):
    inv = [0] * SIZE  # inv[j] = j^{-1} mod MOD
    fac = [0] * SIZE  # fac[j] = j! mod MOD
    finv = [0] * SIZE  # finv[j] = (j!)^{-1} mod MOD
    inv[1] = 1
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    for i in range(2, SIZE):
        inv[i] = MOD - (MOD // i) * inv[MOD % i] % MOD
        fac[i] = fac[i - 1] * i % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD

    return fac, finv

def renritsu(A, Y):
    # example 2x + y = 3, x + 3y = 4
    # A = [[2,1], [1,3]])
    # Y = [[3],[4]] または [3,4]
    A = np.matrix(A)
    Y = np.matrix(Y)
    Y = np.reshape(Y, (-1, 1))
    X = np.linalg.solve(A, Y)

    # [1.0, 1.0]
    return X.flatten().tolist()[0]

class TwoDimGrid:
    # 2次元座標 -> 1次元
    def __init__(self, h, w, wall="#"):
        self.h = h
        self.w = w
        self.size = (h+2) * (w+2)
        self.wall = wall
        self.get_grid()
        # self.init_cost()

    def get_grid(self):
        grid = [self.wall * (self.w + 2)]
        for i in range(self.h):
            grid.append(self.wall + getS() + self.wall)

        grid.append(self.wall * (self.w + 2))
        self.grid = grid
    def init_cost(self):
        self.cost = [INF] * self.size

    def pos(self, x, y):
        # 壁も含めて0-indexed 元々の座標だけ考えると1-indexed
        return y * (self.w + 2) + x
    def getgrid(self, x, y):
        return self.grid[y][x]
    def get(self, x, y):
        return self.cost[self.pos(x, y)]
    def set(self, x, y, v):
        self.cost[self.pos(x, y)] = v
        return
    def show(self):
        for i in range(self.h+2):
            print(self.cost[(self.w + 2) * i:(self.w + 2) * (i+1)])
    def showsome(self, tgt):
        for t in tgt:
            print(t)
        return
    def showsomejoin(self, tgt):
        for t in tgt:
            print("".join(t))
        return

    def search(self):
        grid = self.grid
        move = [(0, 1), (0, -1), (1, 0), (-1, 0)]
        move_eight = [(0, 1), (0, -1), (1, 0), (-1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
        # for i in range(1, self.h+1):
        #     for j in range(1, self.w+1):
        #         cx, cy = j, i
        #         for dx, dy in move_eight:
        #             nx, ny = dx + cx, dy + cy

def so(n):
    ret = []
    for i in range(2, int(math.sqrt(n) + 2)):
        if n % i == 0:
            ret.append(i)

    if ret == []:
        return [n]
    else:
        return ret

def getnig(n):
    ni, go = 0, 0
    while n % 2 == 0:
        ni += 1
        n //= 2
    while n % 5 == 0:
        go += 1
        n //= 5

    return min(18, ni), min(18, go)


def solve():
    # n = getN()
    # nums = []
    # bunsi = [0 for i in range(100)]
    # sei = 0
    # for i in range(n):
    #     S = getS()
    #     if "." not in S:
    #         sei += 1
    #         for sso in so(int(S)):
    #             bunsi[sso] += 1
    #
    #     else:
    #         nums.append(float(S))
    #
    # print(bunsi)
    # print(nums)
    # # for num in nums:
    # #     for s in so(num):
    # #         bunsi[s] += 1
    # # for
    n = getN()
    nums= []
    nigolis = [[0 for i in range(19)] for j in range(19)]
    for i in range(n):
        num = float(getS())
        num *= 10 ** 9
        ni, go = getnig(num)
        nigolis[ni][go] += 1
        nums.append((ni,go))
    # print(nums)
    for i in range(18):
        for j in range(18):
            nigolis[i][j+1] += nigolis[i][j]
    # for nigo in nigolis:
    #     print(nigo)
    ans = 0
    for tn, tg in nums:
        for i in range(18-tn, 19):
            if tg == 18:
                ans += nigolis[i][-1]
            else:
                ans += nigolis[i][-1] - nigolis[i][18-tg-1]

        if tn >= 9 and tg >= 9:
            ans -= 1
        # print(ans)

    print(ans // 2)
    # print(Fraction(Decimal("0.3")).denominator)
def main():
    n = getN()
    for _ in range(n):
        solve()

    return
if __name__ == "__main__":
    # main()
    solve()

Submission status: Wrong Answer

Solution code:
data = []
count = 0
n=int(input())

for i in range(n):
    data.append(float(input()))
#print(data)
for i in range(n):
     for j in range(len(data)):
         if(i<j):
             if(data[i] * data[j] == int(data[i] * data[j])):
                 count += 1
print(count)