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:
import sys
import heapq, functools, collections
import math, random
from collections import Counter, defaultdict

# available on Google, not available on Codeforces
# import numpy as np
# import scipy

def process(num):
    cnt_2 = 0
    cnt_5 = 0

    while num%2 == 0:
        num = num//2
        cnt_2 += 1
    
    while num%5 == 0:
        num = num//5
        cnt_5 += 1
    
    # return min(14,cnt_2-15), min(14,cnt_5-15)
    return cnt_2-9, cnt_5-9


def solve(lst):  # fix inputs here
    console("----- solving ------")

    grid = [[0 for _ in range(90)] for _ in range(90)]

    console(lst)
    for num in lst:
        x,y = process(num)
        console(x,y)
        grid[x+45][y+45] += 1
    # return a string (i.e. not a list or matrix)

    # console(np.array(grid))

    res = 0

    for i in range(-44,44):
        for j in range(-44,44):
            smaller_cnt = 0
            # smaller_cnt -= grid[10+i][10+j]
            for x in range(45-i,90):
                for y in range(45-j,90):
                    smaller_cnt += grid[x][y]
            # val = grid[10+i][10+j] * smaller_cnt + (grid[10+i][10+j] * (grid[10+i][10+j] - 1))
            if i >= 0 and j >= 0:
                val = grid[45+i][45+j] * (smaller_cnt - grid[45+i][45+j]) 
                val += (grid[45+i][45+j] * (grid[45+i][45+j]-1))
            else:
                val = (grid[45+i][45+j]) * smaller_cnt
            if val != 0:
                console(i,j,smaller_cnt,val)
            # val = max(0,val)
            res += val
    console(res)
    return res//2


def console(*args):  # the judge will not read these print statement
    # print('\033[36m', *args, '\033[0m', file=sys.stderr)
    return

# fast read all
lst = sys.stdin.readlines()

# for case_num in [1]:
    # read line as a string
    # strr = input()

    # read line as an integer
    # nrows = int(input())
    
    # read one line and parse each word as a string
    # lst = input().split()

    # read one line and parse each word as an integer
    # lst = list(map(int,input().split()))

    # read matrix and parse as integers (after reading read nrows)
    # lst = list(map(int,input().split()))
    # nrows = lst[0]  # index containing information, please change
lst = [int(10**9 * float(x)) for x in lst[1:]]

res = solve(lst)  # please change
    
    # Google - case number required
    # print("Case #{}: {}".format(case_num+1, res))

    # Codeforces - no case number required
print(res)

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 = []
for i in range(n):
    r = FI()
    A += [r]

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
for i in range(-35, 35):
    for j in range(-20, 20):
        for k in range(-35, 35):
            for l in range(-20, 20):
                if i + k >= 0 and j + l >= 0:
                    if i == k and j == l:
                        ans += D[i][j] * (D[k][l] - 1)
                    else:
                        ans += D[i][j] * D[k][l]



print(ans // 2)

Submission status: Wrong Answer

Solution code:
import numpy as np

n = int(input())
a = list()
for _ in range(n):
    a.append(float(input()))

a_np = np.array(a)

a_np_array = list()
for i in range(n):   
    a_np_array.append(a_np*a[i])
a_np_array = np.array(a_np_array)
a_np_array = np.triu(a_np_array, k=1)

cnt=0
for i in a_np_array:
    for j in i:
        if j != 0:
            if j.is_integer():
                cnt+=1
print(cnt)

Submission status: Wrong Answer

Solution code:
from collections import Counter
N = int(input())
A = [float(input()) for i in range(N)]

counter = Counter()

for i in range(N):
    tmp = A[i]*10000
    if tmp.is_integer():
        tmp = int(tmp)
        cnt2 = 0
        cnt5 = 0
        while tmp%2 == 0:
            tmp //= 2
            cnt2 += 1
        while tmp%5 == 0:
            tmp //= 5
            cnt5 += 1
        counter[(cnt2,cnt5)] += 1
ans = 0
for i in range(15):
    for j in range(7):
        for a in range(8-i,15):
            for b in range(8-j,7):
                if i == a and j == b:
                    ans += counter[(i,j)]*(counter[(i,j)]-1)
                else:
                    ans += counter[(i,j)]*counter[(a,b)]
print(ans//2)

Submission status: Wrong Answer

Solution code:
import bisect
from heapq import heappush, heappop
n = int(input())
a = []
for i in range(n):
    temp = float(input()) * (10**9)
    if temp%1 == 0:
        # print(temp)
        a.append(int(temp))
b = []
d = {0:0,1:0,2:0,3:0,4:0,5:0}
p = [[]for i in range(19)]
for i in a:
    cnt2 = 0
    cnt5 = 0
    while i%2 == 0:
        i //= 2
        cnt2 += 1
    while i%5 == 0:
        i //= 5
        cnt5 += 1
    p[min(18,cnt2)].append(-cnt5)
    # d[min(5,cnt5)] += 1
    # b.append([cnt2,cnt5])
# print(b)
# print(d)
ans = 0
for i in range(19):
    p[i] = sorted(p[i])
# print(p)
for i in range(19):
    while p[i]:
        t = p[i].pop()
        # print(t)
        # for j in p[i]:
        for k in range(max(0,18-i),19):
            # print(k,p[k],t,bisect.bisect_right(p[k],-18-t))
            ans += bisect.bisect_right(p[k],-18-t)
print(ans)
# for i in range(len(a)-1):
#     for j in range(i+1,len(a)):
#         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())
import itertools
a=tanaka=tottori=[]
for i in range(n):
    aha=input()
    if aha[0]=="0":
        aha=aha.replace("0","1",1)
    aha=float(aha)
 
    a.append(aha)
 
i=kazu=0
 
 
for j in itertools.combinations(a,2):
    
    kari=j[0]*j[1]
    if kari.is_integer():
        kazu+=1
        
        tanaka.append([j])
        
    
    
#print (tanaka)
print(kazu)

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) * 100
    A.append(a)
for i in range (N - 1):
    I = i
    for i in range (j):
        o = A[i] * A[j] / 10000
        if o.is_integer() == True:
            s = s + 1
        i = i + 1
    j = j + 1
    i = 0
print(s)

Submission status: Wrong Answer

Solution code:
n = int(input())

int_cnt = 0
int_25 = [[0 for _ in range(10)] for _ in range(10)]
float_25 = [[0 for _ in range(10)] for _ in range(10)]
float_2 = [[0 for _ in range(10)] for _ in range(10)]
float_5 = [[0 for _ in range(10)] for _ in range(10)]

for _ in range(n):
    a = float(input())
    if a % 1 == 0:
        int_cnt += 1
        t = 0
        while a % 2 == 0:
            a //= 2
            t += 1
        t = min(t, 9)
        f = 0
        while a % 5 == 0:
            a //= 5
            f += 1
        f = min(f, 9)
        int_25[t][f] += 1
    else:
        a *= 10 ** 9
        a = int(a)
        cnt = 9
        while a % 10 == 0:
            a //= 10
            cnt -= 1
        t = 0
        while a % 2 == 0:
            a //= 2
            t += 1
        f = 0
        while a % 5 == 0:
            a //= 5
            f += 1
        t = min(t, 9)
        f = min(f, 9)
        float_25[max(0, cnt - t)][max(0, cnt - f)] += 1
        float_2[t][max(0, cnt - f)] += 1
        float_5[max(0, cnt - t)][f] += 1

ans = int_cnt * (int_cnt - 1) // 2

for i in range(10):
    for j in range(10):
        for k in range(i + 1):
            for l in range(j + 1):
                ans += int_25[i][j] * float_25[k][l]

for i in range(10):
    for j in range(10):
        for k in range(10):
            for l in range(10):
                if (i - j > 0) and (k - l > 0):
                    ans += float_2[i][l] * float_5[j][k]
    
print(ans)

Submission status: Wrong Answer

Solution code:
def solution(A):
    
    count = 0
    # iterate each index
    for i in range(0, len(A)-1): # until 1 index before the end of A
        for j in range(i+1, len(A)):
#            print(i, j)
#            print(A[i], A[j])
#            if A[i] < A[j]:
#            print(A[i], A[j])
#            multiply = (Decimal(A[i]) * Decimal(A[j]))
            multiply = float(A[i] * A[j])
            if A[i] == 0.999999999 or A[j] == 0.999999999:
                continue
            if multiply.is_integer():
#                print(multiply)
#                print(A[i], A[j], multiply)
                count += 1
    
    return count

if __name__ == '__main__':
    N = int(input())
    A = []
    for _ in range(N):
        A.append(float(input()))
        
    print(solution(A))

Submission status: Wrong Answer

Solution code:
import numpy as np
import math

N = int(input())
A = np.array([float(input())],dtype=np.float128)
ans = 0

def hikaku(A, tmp):
    tmp_ans = 0
    for A_i in A:
        tmptmp = A_i*tmp
        if abs(tmptmp - round(tmptmp)) < 1e-14:
            tmp_ans += 1
    return tmp_ans

for _ in range(N-1):
    tmp = float(input())
    ans += hikaku(A, tmp)
    A = np.append(A, tmp)
    
print(ans)

Submission status: Wrong Answer

Solution code:
import sys

readline = sys.stdin.readline
class Bit:
    def __init__(self, lst):
        t = 1
        while (t << 1) <= len(lst):
            for i in range(t, len(lst) - t + 1, t << 1):
                lst[i + t - 1] += lst[i - 1]
            t <<= 1
        self.lst = lst

    def add(self, pos, value):
        pos += 1
        while pos <= len(self.lst):
            self.lst[pos - 1] += value
            pos += pos & (-pos)

    def update(self, pos, value):
        diff = value - self.at(pos)
        self.add(pos, diff)

    def at(self, pos):
        return self.sum(pos + 1) - self.sum(pos)
    
    def sum(self, pos):
        # sum of [0, pos)
        if pos == 0:
            return 0
        s = 0
        while pos > 0:
            s += self.lst[pos - 1]
            #pos -= pos & (-pos)
            pos &= ~(-pos)
        return s
    
def solve():
    N = int(readline())
    A = [float(readline()) for i in range(N)]

    C = [0] * N
    c5s = set()

    for i, a in enumerate(A):
        b = a * (10 ** 9)
        c2, c5 = -9, -9
        while b % 2 == 0:
            b //= 2
            c2 += 1
        
        while b % 5 == 0:
            b //= 5
            c5 += 1
        
        C[i] = (c2, c5)
        c5s.add(c5)
        c5s.add(-c5)

    c5_to_i = {c5: i for i, c5 in enumerate(sorted(c5s))}
    
    C.sort()

    c5_comp = [c5_to_i[c5] for c2, c5 in C]
    
    bit = Bit([0] * len(c5_to_i))

    c5_max = max(c5 for c2, c5 in C)


    ans = 0
    j = N - 1
    for i, (c2, c5) in enumerate(C):
        if c2 < 0:
            l, r = i, N
            while l + 1 < r:
                m = (l + r) // 2
                if C[m][0] + c2 >= 0:
                    r = m
                else:
                    l = m
            if r == N:
                continue
            
            while j >= r:
                bit.add(c5_comp[j], 1)
                j -= 1
            
            ans += bit.sum(c5_to_i[c5_max] + 1) - bit.sum(c5_to_i[-c5])
        else:
            while j < i:
                j += 1
                bit.add(c5_comp[j], -1)
            
            while j > i:
                bit.add(c5_comp[j], 1)
                j -= 1

            ans += bit.sum(c5_to_i[c5_max] + 1) - bit.sum(c5_to_i[-c5])
    
    print(ans)


solve()

Submission status: Wrong Answer

Solution code:
import copy
import math
import time
import statistics
import math
from decimal import Decimal
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN, ROUND_DOWN

# a = get_int()
def get_int():
    return int(input())
# a = get_string()
def get_string():
    return input()
# a_list = get_int_list()
def get_int_list():
    return [int(x) for x in input().split()]
# a_list = get_string_list():
def get_string_list():
    return input().split()
# a, b = get_int_multi()
def get_int_multi():
    return map(int, input().split())
# a_list = get_string_char_list()
def get_string_char_list():
    return list(str(input()))
# print("{} {}".format(a, b))
# for num in range(0, a):
# a_list[idx]
# a_list = [0] * a
'''
while (idx < n) and ():

    idx += 1
'''



def main():
    start = time.time()

    n = get_int()
    youso2 = []
    youso5 = []

    ans = 0
    for i in range(0,n):
        s = input()

        if not ('.' in s):
            count2 = 0
            wk = int(s)
            for ii in range(1, 15):
                if wk % 2 == 0:
                    count2 += 1
                    wk = wk // 2
                else:
                    break

            count5 = 0
            wk = int(s)
            for ii in range(1, 15):
                if wk % 5 == 0:
                    count5 += 1
                    wk = wk // 5
                else:
                    break

            youso2.append(count2)
            youso5.append(count5)

        else:
            s_i, s_d = s.split('.')

            count2 = 0
            wk = int(s_d)
            for ii in range(1, 35):
                if (wk * 2) % 10 == 0:
                    wk = wk * 2 / 5
                    count2 += 1
                else:
                    break

            youso2.append(-len(s_d) + count2)

            count5 = 0
            wk = int(s_d)
            for ii in range(1,15):
                if (wk * 5) % 10 == 0:
                    wk = wk * 5 / 5
                    count5 += 1
                else:
                    break

            youso5.append(-len(s_d) + count5)

    #print(time.time() - start)
    #print(youso2)
    #print(youso5)

    ans = 0
    for i in range(0, n):
        for ii in range(i+1,n):
            if (youso2[i] + youso2[ii] >= 0) and (youso5[i] + youso5[ii] >= 0):
                ans += 1


    print(ans)
    #print(time.time() - start)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:

# creating an empty list 
lst = [] 
count = 0
# number of elemetns as input 
n = int(input()) 

# iterating till the range 
for i in range(0, n): 
	lst.append(float(input())) # adding the element 
	

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




print(count)

Submission status: Wrong Answer

Solution code:
def solve():
    from collections import defaultdict
    from fractions import Fraction
    n = int(input())
    d = defaultdict(int)
    ans0 = 0
    for i in range(n):
        x = Fraction(input())
        cnt0, cnt5, cnt2 = 0, 0, 0
        for j in range(5):
            if x % 1 == 0:
                break
            else:
                x *= 10
                cnt0 += 1
        if cnt0 == 5:
            continue
        for j in range(4):
            if x % 5 != 0:
                break
            else:
                x //= 5
                cnt5 += 1
        for j in range(4):
            if x % 2 != 0:
                break
            else:
                x //= 2
                cnt2 += 1
        d[(cnt0, cnt2, cnt5)] += 1
        ans0 += cnt0
    ans_f = 0
    for a, b, c in d:
        if a == 0:
            continue
        k = d[(a, b, c)]
        l = 0
        for x, y, z in d:
            if a == x and b == y and c == z:
                continue
            if b + y >= a and c + z >= a:
                l += d[(x, y, z)]
        ans_f += k * l
    print((ans0 - 1) * (ans0 - 2) + ans_f)

    return
solve()

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()

c = {}
intc = 0
ints = []
decs = []
for d in A:
    if d in c:
        c[d] += 1
        if d == int(d):
            intc += 1
    else:
        c[d] = 1
        if d == int(d):
            intc += 1
            ints.append(d)
        else:
            decs.append(d)

p = []
for i in range(len(decs)):
    a = decs[i]
    t = 10
    while True:
        a *= 10
        if a == int(a):
            p.append(t // 10)
            break
        t *= 10

result = intc * (intc - 1) // 2
for i in range(len(decs)):
    a = decs[i]

    t = 1
    b = a
    while True:
        b *= 10
        if b == int(b):
            p = t
            break
        t *= 10

    t = max(bisect_left(decs, p), i + 1)
    for j in range(t, len(decs)):
        b = decs[j]
        t = a * b
        if t == int(t):
            result += c[a] * c[b]

    t = bisect_left(ints, p)
    for j in range(t, len(ints)):
        b = ints[j]
        t = a * b
        if t == int(t):
            result += c[a] * c[b]

print(result)

Submission status: Wrong Answer

Solution code:
import sys
import heapq, functools, collections
import math, random
from collections import Counter, defaultdict

# available on Google, not available on Codeforces
# import numpy as np
# import scipy

def process(num):
    cnt_2 = 0
    cnt_5 = 0

    while num%2 == 0:
        num = num//2
        cnt_2 += 1
    
    while num%5 == 0:
        num = num//5
        cnt_5 += 1
    
    return min(14,cnt_2-15), min(14,cnt_5-15)
    # return min(9,cnt_2-9), min(9,cnt_5-9)


def solve(lst):  # fix inputs here
    console("----- solving ------")

    grid = [[0 for _ in range(30)] for _ in range(30)]

    console(lst)
    for num in lst:
        x,y = process(num)
        console(x,y)
        grid[x+15][y+15] += 1
    # return a string (i.e. not a list or matrix)

    # console(np.array(grid))

    res = 0

    for i in range(-14,14):
        for j in range(-14,14):
            smaller_cnt = 0
            # smaller_cnt -= grid[10+i][10+j]
            for x in range(15-i,30):
                for y in range(15-j,30):
                    smaller_cnt += grid[x][y]
            # val = grid[10+i][10+j] * smaller_cnt + (grid[10+i][10+j] * (grid[10+i][10+j] - 1))
            if i >= 0 and j >= 0:
                val = grid[15+i][15+j] * (smaller_cnt - grid[15+i][15+j]) 
                val += (grid[15+i][15+j] * (grid[15+i][15+j]-1))
            else:
                val = (grid[15+i][15+j]) * smaller_cnt
            if val != 0:
                console(i,j,smaller_cnt,val)
            # val = max(0,val)
            res += val
    console(res)
    return res//2


def console(*args):  # the judge will not read these print statement
    print('\033[36m', *args, '\033[0m', file=sys.stderr)
    return

# fast read all
# sys.stdin.readlines()

# for case_num in [1]:
    # read line as a string
    # strr = input()

    # read line as an integer
nrows = int(input())
    
    # read one line and parse each word as a string
    # lst = input().split()

    # read one line and parse each word as an integer
    # lst = list(map(int,input().split()))

    # read matrix and parse as integers (after reading read nrows)
    # lst = list(map(int,input().split()))
    # nrows = lst[0]  # index containing information, please change
grid = []
for _ in range(nrows):
    grid.append(10**6 * int(10**9 * float(input())))

res = solve(grid)  # please change
    
    # Google - case number required
    # print("Case #{}: {}".format(case_num+1, res))

    # Codeforces - no case number required
print(res)

Submission status: Wrong Answer

Solution code:
n = int(input())

int_cnt = 0
int_25 = [[0 for _ in range(10)] for _ in range(10)]
float_25 = [[0 for _ in range(10)] for _ in range(10)]
float_2 = [0 for _ in range(10)]
float_5 = [0 for _ in range(10)]

for _ in range(n):
    a = float(input())
    if a % 1 == 0:
        int_cnt += 1
        t = 0
        while a % 2 == 0:
            a //= 2
            t += 1
        t = min(t, 9)
        f = 0
        while a % 5 == 0:
            a //= 5
            f += 1
        f = min(f, 9)
        int_25[t][f] += 1
    else:
        a *= 10 ** 9
        a = int(a)
        cnt = 9
        while a % 10 == 0:
            a //= 10
            cnt -= 1
        t = 0
        while a % 2 == 0:
            a //= 2
            t += 1
        f = 0
        while a % 5 == 0:
            a //= 5
            f += 1
        t = min(t, 9)
        f = min(f, 9)
        float_25[max(0, cnt - t)][max(0, cnt - f)] += 1
        float_2[t] += 1
        float_5[f] += 1

ans = int_cnt * (int_cnt - 1) // 2

for i in range(10):
    for j in range(10):
        for k in range(i + 1):
            for l in range(j + 1):
                ans += int_25[i][j] * float_25[k][l]
                
for i in range(2, 10):
    for j in range(2, 10):
        ans += float_2[i] * float_5[j]
    
print(ans)

Submission status: Wrong Answer

Solution code:
import pprint
N=int(input())
l2=[]
bit2=50
bit5=22
#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)
    n=n*pow(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
    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,num)
            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:
from decimal import Decimal, getcontext
getcontext().prec = 30

def five(x):
    cnt = 0
    while x%5==0:
        cnt+= 1
        x = x//5
    return cnt

def two(x):
    cnt = 0
    while x%2==0:
        cnt+= 1
        x = x//2
    return cnt

N = int(input())

F = []
for i in range(N):
    A = Decimal(input())
    A = int(A*(10**9))
    F.append((five(A), two(A)))

F.sort()

j = 0
temp = 0
dp = [0]*19
k = 0
for i in range(N):
    if N-1-j <= i:
        dp[min(F[i][1], 18)] -= 1
    while N-1-j> i and F[i][0]+F[N-1-j][0] >= 18:

        dp[min(F[N-1-j][1],18)] += 1
        j += 1
    k = sum(dp[:18-F[i][1]])
    temp += min(j, N-i-1) - k
print(temp)

Submission status: Wrong Answer

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

for i in range(0,len(a)-1):
    if float(float(a[i][0])*10000).is_integer() == True:
        for j in range (i+1,len(a)):
            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:
from decimal import Decimal
N = int(input())
nu=[]
de=[]
integ=[]
for i in range(N):
    a=input()
    aa=Decimal(a).as_integer_ratio() #(1,3)など
    if aa[1]==1:
        integ.append(aa[0])
    elif aa[1]<10**2:
        nu.append(aa[0])
        de.append(aa[1])
ans=int(len(integ)*(len(integ)-1)/2)
for i in range(len(nu)):
    for j in range(len(integ)):
        if integ[j]%de[i]==0:
            ans+=1
for i in range(len(nu)-1):
    for j in range(i+1,len(nu)):
        if nu[i]%de[j]==0 and nu[j]%de[i]==0:
            ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
nums = [float(input())*1000000000 for _ in range(n)]
counter = 0
for i in range(n):
	for j in range(i):
		seki = nums[i]*nums[j]
		if(seki%1000000000000000000 == 0):
			counter += 1
print(counter)

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) * 1000000000
    A.append(a)
for i in range (N - 1):
    I = i
    for i in range (j):
        v = A[i] * A[j]
        if v / 1000000000000000000 == v//1000000000000000000:
            s = s + 1
        i = i + 1
    j = j + 1
    i = 0
print(s)

Submission status: Wrong Answer

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

for i in range(0,len(a)-1):
    if float(float(a[i][0])*1000).is_integer() == True:
        for j in range (i+1,len(a)):
            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:
import numpy as np

n = int(input())
a = list()
for _ in range(n):
    a.append(float(input()))

a_np = np.array(a)

a_np_array = list()
for i in range(n):   
    a_np_array.append(a_np*a[i])
a_np_array = np.array(a_np_array)
a_np_array = np.triu(a_np_array, k=1)

ans_list = list()
for i, value in enumerate(a_np_array):
    ans_list.append(np.delete(value, i))
    
cnt=0
for i in ans_list:
    for j in i:
        if j != 0:
            if j.is_integer():
                cnt+=1
print(cnt)

Submission status: Wrong Answer

Solution code:
n=int(input())
a = [input().split() for l in range(n)]
print(a,n,len(a))
t=0

for i in range(0,len(a)-1):
    if float(float(a[i][0])*1000).is_integer() == True:
        for j in range (i+1,len(a)):
            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:
import sys
import numpy as np


input = sys.stdin.readline
n = int(input())
a = np.array(float(input()))
cnt = 0
for _ in range(n - 1):
    x = float(input())
    if (x * 10000) % 1 == 0:
        cnt += np.count_nonzero(a * x % 1 == 0)
        a = np.append(a, x)
print(cnt)

Submission status: Wrong Answer

Solution code:
from collections import Counter
n = int(input())
a = [float(input()) for i in range(n)]
a_mod = [int((float(a[i])*10**9)%10**9) for i in range(n)]
c = Counter([int(float(a[i])*10**9) for i in range(n)])
c_mod = Counter(a_mod)

c_inv = Counter([])
ans = 0
for k, v in c_mod.items():
    if k == 0:
        ans += v*(v-1)//2
    else:
        for k2, v2 in c.items():
            if k*k2%pow(10, 18) == 0:
                ans += v * v2
print(ans)

Submission status: Wrong Answer

Solution code:
def mult(x,y,dec):
    e=x*y
    return (e%(10**dec)==0)


def go(x,y):
    count=0
    if '.' in x and '.' in y:
        p,q= x.index('.'), y.index('.')
        a,b= x[(p+1):],y[(q+1):]
        count+=mult(int(a),int(b),max(len(a),len(b)))
    elif '.' in x:
        p= x.index('.')
        a= x[(p+1):]
        count+=mult(int(a),int(y),len(a))
    elif '.' in y:
        q = y.index('.')
        a = y[(q + 1):]
        count += mult(int(a),int(x), len(a))
    else:
        count+=1

    return count
n=int(input())
a=[]
for i in range(n):
    r=input()
    if '.' in r:
        q=r.index('.')
        if int(r[(q+1):])==0:
            r=r[:q]
    a.append(r)
count=0
for i in range(n):
    for j in range(i+1,n):
        count+=go(a[i],a[j])
print(count)

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])
d = [i for i in a if i%10**9==0]
e = [i for i in a if i%10**9!=0]
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
ans2=0
for i in d:
	for j in e:
		if i*j%10**18==0:
			ans2+=1
ans+=ans2//2
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)