import math


def ncr(n, r):
    """
    Returns the number of ways to choose r items from n items without repetition and without order.

    :param n: A non-negative integer.

    :param r: A non-negative integer.

    :return: An integer representing the number of ways to choose r items from n items without repetition
             and without order.
    """
    if not isinstance(n, int) or n < 0:
        raise Exception("n must be a non-negative int")
    if not isinstance(r, int) or r < 0:
        raise Exception("r must be a non-negative int")
    if n < r:
        return 0
    f = math.factorial
    return f(n) // f(r) // f(n-r)