Problem p02900 (python)

Fixed submission:
def slove():
    import sys
    import fractions
    input = sys.stdin.readline
    a, b = list(map(int, input().rstrip('\n').split()))
    gcd = fractions.gcd(a, b)
    cnt = 1
    for i in range(2, int(gcd ** 0.5) + 1):
        if gcd % i == 0:
            cnt += 1
            while True:
                if gcd % i == 0:
                    gcd //= i
                else:
                    break
    if gcd != 1:
        cnt += 1
    print(cnt)


if __name__ == '__main__':
    slove()

Buggy submission (verdict: Runtime Error):
def slove():
    import sys
    import fractions
    input = sys.stdin.readline
    a, b = list(map(int, input().rstrip('\n').split()))
    gcd = fractions.gcd(a, b)
    if gcd == 1:
        print(1)
    else:
        ls = [True] * (gcd + 1)
        ls[0] = False
        ls[1] = False
        c = 1
        for i in range(int(len(ls) ** 0.5) + 2):
            if ls[i]:
                if a % i == 0 and b % i == 0:
                    c += 1
                for j in range(i, len(ls), i):
                    ls[j] = False
        print(c)


if __name__ == '__main__':
    slove()

Buggy submission (verdict: Runtime Error):
def slove():
    import sys
    import fractions
    input = sys.stdin.readline
    a, b = list(map(int, input().rstrip('\n').split()))
    gcd = fractions.gcd(a, b)
    if gcd == 1:
        print(1)
    else:
        ls = [True] * (gcd + 1)
        ls[0] = False
        ls[1] = False
        c = [1]
        for i in range(int(len(ls) ** 0.5) + 2):
            if ls[i]:
                if a % i == 0 and b % i == 0:
                    c.append(i)
                for j in range(i, len(ls), i):
                    ls[j] = False
        print(len(c))


if __name__ == '__main__':
    slove()

Buggy submission (verdict: Runtime Error):
def slove():
    import sys
    import fractions
    input = sys.stdin.readline
    a, b = list(map(int, input().rstrip('\n').split()))
    gcd = fractions.gcd(a, b)
    if gcd == 1:
        print(1)
    else:
        ls = [True] * (gcd + 1)
        ls[0] = False
        ls[1] = False
        c = [1]
        for i in range(2, int(len(ls) ** 0.5) + 2):
            if ls[i]:
                if a % i == 0 and b % i == 0:
                    c.append(i)
                for j in range(i, len(ls), i):
                    ls[j] = False
        print(c)
        print(len(c))


if __name__ == '__main__':
    slove()

Buggy submission (verdict: Runtime Error):
def slove():
    import sys
    import fractions
    input = sys.stdin.readline
    a, b = list(map(int, input().rstrip('\n').split()))
    gcd = fractions.gcd(a, b)
    ls = [True] * (gcd + 1)
    ls[0] = False
    ls[1] = False
    c = [1]
    for i in range(2, int(len(ls) ** 0.5) + 1):
        if ls[i]:
            if a % i == 0 and b % i == 0:
                c.append(i)
            for j in range(i, len(ls), i):
                ls[j] = False
    print(len(c))


if __name__ == '__main__':
    slove()

Buggy submission (verdict: Runtime Error):
def slove():
    import sys
    import fractions
    input = sys.stdin.readline
    a, b = list(map(int, input().rstrip('\n').split()))
    gcd = fractions.gcd(a, b)
    ls = [True] * (gcd + 1)
    ls[0] = False
    ls[1] = False
    c = [1]
    for i in range(2, int(gcd ** 0.5) + 1):
        if ls[i]:
            if a % i == 0 and b % i == 0:
                c.append(i)
            for j in range(i, gcd, i):
                ls[j] = False
    print(len(c))


if __name__ == '__main__':
    slove()

Buggy submission (verdict: Runtime Error):
def slove():
    import sys
    import fractions
    input = sys.stdin.readline
    a, b = list(map(int, input().rstrip('\n').split()))
    gcd = fractions.gcd(a, b)
    ls = [True] * (gcd + 1)
    ls[0] = False
    ls[1] = False
    c = [1]
    for i in range(2, gcd + 1):
        if ls[i]:
            if a % i == 0 and b % i == 0:
                c.append(i)
            for j in range(i, gcd + 1, i):
                ls[j] = False
    print(len(c))


if __name__ == '__main__':
    slove()