Problem p02588 (python)

Fixed submission:
import numpy as np
from decimal import Decimal

N = int(input())

nums = [Decimal(input()) for _ in range(N)]

two_fives = []


for i, num in enumerate(nums):
    int_converted = int(num * (10**9))
    
    two_div_count = 0
    while int_converted % 2 == 0:
        two_div_count += 1
        int_converted //= 2
    
    five_div_count = 0
    while int_converted % 5 == 0:
        five_div_count += 1
        int_converted //= 5

    two_fives.append((two_div_count,five_div_count))


ok_count = 0

two_five_exists = np.zeros((19,19), dtype=int)

for i in range(N):    
    two_count, five_count = two_fives[i]
    two_count = min(18, two_count)
    five_count = min(18, five_count)
    ok_count += two_five_exists[two_count, five_count]

    two_pair = 18 - two_count
    five_pair = 18 - five_count
    two_five_exists[two_pair:, five_pair:] += 1

print(ok_count)

Buggy submission (verdict: Runtime Error):
import numpy as np
from decimal import Decimal

N = int(input())

nums = [Decimal(input()) for _ in range(N)]

two_fives = []


for i, num in enumerate(nums):
    int_converted = int(num * (10**9))
    
    two_div_count = 0
    while int_converted % 2 == 0:
        two_div_count += 1
        int_converted //= 2
    
    five_div_count = 0
    while int_converted % 5 == 0:
        five_div_count += 1
        int_converted //= 5

    two_fives.append((two_div_count,five_div_count))


ok_count = 0

two_five_exists = np.zeros((19,19), dtype=int)

for i in range(N):    
    two_count, five_count = two_fives[i]
    ok_count += two_five_exists[two_count, five_count]
    
    two_pair = min(18, 18 - two_count)
    five_pair = min(18, 18 - five_count)
    two_five_exists[two_pair:, five_pair:] += 1

print(ok_count)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())

nums = [float(input()) for _ in range(N)]

two_fives = []


for i, num in enumerate(nums):
    int_converted = int(num * (10**9))
    
    two_div_count = 0
    while int_converted % 2 == 0:
        two_div_count += 1
        int_converted //= 2
    
    five_div_count = 0
    while int_converted % 5 == 0:
        five_div_count += 1
        int_converted //= 5

    two_fives.append((two_div_count,five_div_count))


ok_count = 0

two_five_exists = np.zeros((19,19), dtype=int)

for i in range(N):    
    two_count, five_count = two_fives[i]
    ok_count += two_five_exists[two_count, five_count]
    
    two_pair = 18 - two_count
    five_pair = 18 - five_count    
    two_five_exists[two_pair:, five_pair:] += 1

print(ok_count)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())

nums = [float(input()) for _ in range(N)]

two_fives = []


for i, num in enumerate(nums):
    int_converted = int(num * (10**9))
    
    two_div_count = 0
    while int_converted % 2 == 0:
        two_div_count += 1
        int_converted //= 2
    
    five_div_count = 0
    while int_converted % 5 == 0:
        five_div_count += 1
        int_converted //= 5

    two_fives.append((two_div_count,five_div_count))


ok_count = 0

two_five_exists = np.zeros((19,19), dtype=int)

for i in range(N):    
    two_count, five_count = two_fives[i]
    ok_count += two_five_exists[two_count, five_count]
    
    two_pair = 18 - two_count
    five_pair = 18 - five_count    
    two_five_exists[two_pair:, five_pair:] += 1

print(ok_count)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())

nums = [float(input()) for _ in range(N)]

two_fives = []


for i, num in enumerate(nums):
    int_converted = int(num * (10**9))
    
    two_div_count = 0
    while int_converted % 2 == 0:
        two_div_count += 1
        int_converted //= 2
    
    five_div_count = 0
    while int_converted % 5 == 0:
        five_div_count += 1
        int_converted //= 5

    two_fives.append((two_div_count,five_div_count))


ok_count = 0

two_five_exists = np.zeros((19,19), dtype=int)

for i in range(N):    
    two_count, five_count = two_fives[i]
    ok_count += two_five_exists[two_count, five_count]
    
    two_pair = 18 - two_count
    five_pair = 18 - five_count    
    two_five_exists[two_pair:, five_pair:] += 1

print(ok_count)

Buggy submission (verdict: Runtime Error):
N = int(input())

nums = [float(input()) for _ in range(N)]

two_fives = []


for i, num in enumerate(nums):
    int_converted = num * (10**9)
    assert int_converted.is_integer()
    int_converted = int(int_converted)

    two_div_count = 0
    while int_converted % 2 == 0:
        two_div_count += 1
        int_converted //= 2
        
    
    five_div_count = 0
    while int_converted % 5 == 0:
        five_div_count += 1
        int_converted //= 5

    two_fives.append((two_div_count,five_div_count))


ok_count = 0
for i in range(N):
    for j in range(i+1,N):
        two_sum = two_fives[i][0] + two_fives[j][0]
        five_sum = two_fives[i][1] + two_fives[j][1]
        if two_sum >= 18 and five_sum >= 18:
            ok_count += 1

print(ok_count)