Buggy python submission (verdict: Runtime Error):
#!/usr/bin python3
# -*- coding: utf-8 -*-

n = int(input())
dp = [[0]*20 for _ in range(20)]
dq = [[0]*20 for _ in range(20)]

for i in range(n):
    s = input()
    x = s.find('.')
    if x == -1:
        s = s + '0'*9
    else:
        s = s.replace('.','') + '0'*(10-(len(s)-x))
    s = int(s)
    d2 = 0
    d5 = 0
    for _ in range(20):
        if s%2 == 0:
            s = s//2
            d2 += 1
        else:
            break
    for _ in range(20):
        if s%5 == 0:
            s = s//5
            d5 += 1
        else:
            break
    dp[d2][d5] += 1
    dq[d2][d5] += 1

for i in range(19,-1,-1):
    for j in range(19,0,-1):
        dp[i][j-1]+=dp[i][j]
for j in range(19,-1,-1):
    for i in range(19,0,-1):
        dp[i-1][j]+=dp[i][j]
ret = 0
for i in range(18):
    for j in range(18):
        ret += dq[i][j] * dp[18-i][18-j]
ret -= dp[9][9]
print(ret//2)


Fixed submission:
#!/usr/bin python3
# -*- coding: utf-8 -*-

n = int(input())
dp = [[0]*19 for _ in range(19)]
dq = [[0]*19 for _ in range(19)]

for i in range(n):
    s = input()
    x = s.find('.')
    if x == -1:
        s = s + '0'*9
    else:
        s = s.replace('.','') + '0'*(10-(len(s)-x))
    s = int(s)
    d2 = 0
    d5 = 0
    for _ in range(18):
        if s%2 != 0:
            break
        s = s//2
        d2 += 1
    for _ in range(18):
        if s%5 != 0:
            break
        s = s//5
        d5 += 1
    dp[d2][d5] += 1
    dq[d2][d5] += 1

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

ret = 0
for i in range(19):
    for j in range(19):
        if dq[i][j] == 0:
            continue
        ret += dq[i][j] * dp[18-i][18-j]
ret -= dp[9][9]
print(ret//2)

Buggy python submission (verdict: Runtime Error):
#!/usr/bin python3
# -*- coding: utf-8 -*-

n = int(input())
dp = [[0]*20 for _ in range(20)]
dq = [[0]*20 for _ in range(20)]

for i in range(n):
    s = input()
    x = s.find('.')
    if x == -1:
        s = s + '0'*9
    else:
        s = s.replace('.','') + '0'*(10-(len(s)-x))
    s = int(s)
    d2 = 0
    d5 = 0
    for i in range(20):
        if s%2 == 0:
            s = s//2
            d2 += 1
        else:
            break
    for i in range(20):
        if s%5 == 0:
            s = s//5
            d5 += 1
        else:
            break
    dp[d2][d5] += 1
    dq[d2][d5] += 1

for i in list(range(19))[::-1]:
    for j in list(range(19))[::-1]:
        dp[i][j-1]+=dp[i][j]
for j in list(range(19))[::-1]:
    for i in list(range(19))[::-1]:
        dp[i-1][j]+=dp[i][j]
ret = 0
for i in range(20):
    for j in range(20):
        ret += dq[i][j] * dp[18-i][18-j]
ret -= dp[9][9]
print(ret//2)

Fixed submission:
#!/usr/bin python3
# -*- coding: utf-8 -*-

n = int(input())
dp = [[0]*19 for _ in range(19)]
dq = [[0]*19 for _ in range(19)]

for i in range(n):
    s = input()
    x = s.find('.')
    if x == -1:
        s = s + '0'*9
    else:
        s = s.replace('.','') + '0'*(10-(len(s)-x))
    s = int(s)
    d2 = 0
    d5 = 0
    for _ in range(18):
        if s%2 != 0:
            break
        s = s//2
        d2 += 1
    for _ in range(18):
        if s%5 != 0:
            break
        s = s//5
        d5 += 1
    dp[d2][d5] += 1
    dq[d2][d5] += 1

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

ret = 0
for i in range(19):
    for j in range(19):
        if dq[i][j] == 0:
            continue
        ret += dq[i][j] * dp[18-i][18-j]
ret -= dp[9][9]
print(ret//2)

Buggy python submission (verdict: Runtime Error):
#!/usr/bin python3
# -*- coding: utf-8 -*-

n = int(input())
dp = [[0]*19 for _ in range(19)]
dq = [[0]*19 for _ in range(19)]

for i in range(n):
    s = input()
    x = s.find('.')
    if x == -1:
        s = s + '0'*9
    else:
        s = s.replace('.','') + '0'*(10-(len(s)-x))
    s = int(s)
    d2 = 0
    d5 = 0
    for i in range(19):
        if s%2 == 0:
            s = s//2
            d2 += 1
        else:
            break
    for i in range(19):
        if s%5 == 0:
            s = s//5
            d5 += 1
        else:
            break
    dp[d2][d5] += 1
    dq[d2][d5] += 1

for i in range(17, - 1, -1):
    for j in range(17, - 1, -1):
        dp[i][j-1]+=dp[i][j]
for j in range(17, - 1, -1):
    for i in range(17, - 1, -1):
        dp[i-1][j]+=dp[i][j]
ret = 0
for i in range(19):
    for j in range(19):
        ret += dq[i][j] * dp[18-i][18-j]
ret -= dp[9][9]
print(ret//2)

Fixed submission:
#!/usr/bin python3
# -*- coding: utf-8 -*-

n = int(input())
dp = [[0]*19 for _ in range(19)]
dq = [[0]*19 for _ in range(19)]

for i in range(n):
    s = input()
    x = s.find('.')
    if x == -1:
        s = s + '0'*9
    else:
        s = s.replace('.','') + '0'*(10-(len(s)-x))
    s = int(s)
    d2 = 0
    d5 = 0
    for _ in range(18):
        if s%2 != 0:
            break
        s = s//2
        d2 += 1
    for _ in range(18):
        if s%5 != 0:
            break
        s = s//5
        d5 += 1
    dp[d2][d5] += 1
    dq[d2][d5] += 1

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

ret = 0
for i in range(19):
    for j in range(19):
        if dq[i][j] == 0:
            continue
        ret += dq[i][j] * dp[18-i][18-j]
ret -= dp[9][9]
print(ret//2)