Skip to content

Latest commit

 

History

History
216 lines (214 loc) · 4.98 KB

13.md

File metadata and controls

216 lines (214 loc) · 4.98 KB

Results of GPT-4 on HumanEval/13

Date: 18 July, 2023
Model: gpt-4
Temperature: 0.2
Passing runs: 10
Total runs: 10
Success rate: 100%

Prompt

Tokens: 96

def greatest_common_divisor(a: int, b: int) -> int:
    """ Return a greatest common divisor of two integers a and b
    >>> greatest_common_divisor(3, 5)
    1
    >>> greatest_common_divisor(25, 15)
    5
    """

The above is an incomplete Python code fragment. Return the complete and correct code with no additional text.

Correct solution

def greatest_common_divisor(a: int, b: int) -> int:
    """ Return a greatest common divisor of two integers a and b
    >>> greatest_common_divisor(3, 5)
    1
    >>> greatest_common_divisor(25, 15)
    5
    """while b:
        a, b = b, a % b
    return a

Unit tests

METADATA = {
    'author': 'jt',
    'dataset': 'test'
}


def check(candidate):
    assert candidate(3, 7) == 1
    assert candidate(10, 15) == 5
    assert candidate(49, 14) == 7
    assert candidate(144, 60) == 12

Runs

✅ Run 1

Start time: 2023-07-18 18:52:47
Duration: 7.41s
Completion tokens: 91
Result: Pass

def greatest_common_divisor(a: int, b: int) -> int:
    """ Return a greatest common divisor of two integers a and b
    >>> greatest_common_divisor(3, 5)
    1
    >>> greatest_common_divisor(25, 15)
    5
    """
    while b != 0:
        a, b = b, a % b
    return abs(a)

✅ Run 2

Start time: 2023-07-18 18:52:37
Duration: 10.28s
Completion tokens: 91
Result: Pass

def greatest_common_divisor(a: int, b: int) -> int:
    """ Return a greatest common divisor of two integers a and b
    >>> greatest_common_divisor(3, 5)
    1
    >>> greatest_common_divisor(25, 15)
    5
    """
    while b != 0:
        a, b = b, a % b
    return abs(a)

✅ Run 3

Start time: 2023-07-18 18:52:30
Duration: 7.22s
Completion tokens: 91
Result: Pass

def greatest_common_divisor(a: int, b: int) -> int:
    """ Return a greatest common divisor of two integers a and b
    >>> greatest_common_divisor(3, 5)
    1
    >>> greatest_common_divisor(25, 15)
    5
    """
    while b != 0:
        a, b = b, a % b
    return abs(a)

✅ Run 4

Start time: 2023-07-18 18:52:21
Duration: 8.4s
Completion tokens: 90
Result: Pass

def greatest_common_divisor(a: int, b: int) -> int:
    """ Return a greatest common divisor of two integers a and b
    >>> greatest_common_divisor(3, 5)
    1
    >>> greatest_common_divisor(25, 15)
    5
    """
    while b != 0:
        a, b = b, a % b
    return a

✅ Run 5

Start time: 2023-07-18 18:52:14
Duration: 6.63s
Completion tokens: 91
Result: Pass

def greatest_common_divisor(a: int, b: int) -> int:
    """ Return a greatest common divisor of two integers a and b
    >>> greatest_common_divisor(3, 5)
    1
    >>> greatest_common_divisor(25, 15)
    5
    """
    while b != 0:
        a, b = b, a % b
    return abs(a)

✅ Run 6

Start time: 2023-07-18 18:52:07
Duration: 7.09s
Completion tokens: 91
Result: Pass

def greatest_common_divisor(a: int, b: int) -> int:
    """ Return a greatest common divisor of two integers a and b
    >>> greatest_common_divisor(3, 5)
    1
    >>> greatest_common_divisor(25, 15)
    5
    """
    while b != 0:
        a, b = b, a % b
    return abs(a)

✅ Run 7

Start time: 2023-07-18 18:51:58
Duration: 8.79s
Completion tokens: 90
Result: Pass

def greatest_common_divisor(a: int, b: int) -> int:
    """ Return a greatest common divisor of two integers a and b
    >>> greatest_common_divisor(3, 5)
    1
    >>> greatest_common_divisor(25, 15)
    5
    """
    while b != 0:
        a, b = b, a % b
    return a

✅ Run 8

Start time: 2023-07-18 18:51:50
Duration: 8.55s
Completion tokens: 91
Result: Pass

def greatest_common_divisor(a: int, b: int) -> int:
    """ Return a greatest common divisor of two integers a and b
    >>> greatest_common_divisor(3, 5)
    1
    >>> greatest_common_divisor(25, 15)
    5
    """
    while b != 0:
        a, b = b, a % b
    return abs(a)

✅ Run 9

Start time: 2023-07-18 18:51:42
Duration: 7.92s
Completion tokens: 91
Result: Pass

def greatest_common_divisor(a: int, b: int) -> int:
    """ Return a greatest common divisor of two integers a and b
    >>> greatest_common_divisor(3, 5)
    1
    >>> greatest_common_divisor(25, 15)
    5
    """
    while b != 0:
        a, b = b, a % b
    return abs(a)

✅ Run 10

Start time: 2023-07-18 18:51:35
Duration: 7.15s
Completion tokens: 90
Result: Pass

def greatest_common_divisor(a: int, b: int) -> int:
    """ Return a greatest common divisor of two integers a and b
    >>> greatest_common_divisor(3, 5)
    1
    >>> greatest_common_divisor(25, 15)
    5
    """
    while b != 0:
        a, b = b, a % b
    return a