def gcd(a, b):
    """
    gcd(a : int, b : int) -> int

    Use Euclid's algorithm to find the greatest common divisor.
    """
    if a > b:
        a, b = b, a
    while b != 0:
        a, b = b, a % b
    return a
