Skip to content

Latest commit

 

History

History
192 lines (190 loc) · 4.51 KB

File metadata and controls

192 lines (190 loc) · 4.51 KB

Results of Code LLama 34B on HumanEval/24

Date: 01 September, 2023
Model: codellama-34b-instruct
Temperature: 0.2
Passing runs: 0
Total runs: 10
Success rate: 0%

Prompt

def largest_divisor(n: int) -> int:
    """ For a given number n, find the largest number that divides n evenly, smaller than n
    >>> largest_divisor(15)
    5
    """

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

Correct solution

def largest_divisor(n: int) -> int:
    """ For a given number n, find the largest number that divides n evenly, smaller than n
    >>> largest_divisor(15)
    5
    """for i in reversed(range(n)):
        if n % i == 0:
            return i

Unit tests

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


def check(candidate):
    assert candidate(3) == 1
    assert candidate(7) == 1
    assert candidate(10) == 5
    assert candidate(100) == 50
    assert candidate(49) == 7

Runs

❌ Run 1

Start time: 2023-09-01 02:48:15
Duration: 4.99s
Result: Fail

def largest_divisor(n: int) -> int:
    """ For a given number n, find the largest number that divides n evenly, smaller than n
    >>> largest_divisor(15)
    5
    """
    for i in range(n, 1, -1):
        if n % i == 0:
            return i
    return 1

❌ Run 2

Start time: 2023-09-01 02:51:18
Duration: 5.15s
Result: Fail

def largest_divisor(n: int) -> int:
    """ For a given number n, find the largest number that divides n evenly, smaller than n
    >>> largest_divisor(15)
    5
    """
    for i in range(n, 1, -1):
        if n % i == 0:
            return i
    return 1

❌ Run 3

Start time: 2023-09-01 02:54:13
Duration: 5.18s
Result: Fail

def largest_divisor(n: int) -> int:
    """ For a given number n, find the largest number that divides n evenly, smaller than n
    >>> largest_divisor(15)
    5
    """
    for i in range(n, 1, -1):
        if n % i == 0:
            return i
    return 1

❌ Run 4

Start time: 2023-09-01 02:57:11
Duration: 5.33s
Result: Fail

def largest_divisor(n: int) -> int:
    """ For a given number n, find the largest number that divides n evenly, smaller than n
    >>> largest_divisor(15)
    5
    """
    for i in range(n, 1, -1):
        if n % i == 0:
            return i
    return 1

❌ Run 5

Start time: 2023-09-01 03:00:08
Duration: 4.98s
Result: Fail

def largest_divisor(n: int) -> int:
    """ For a given number n, find the largest number that divides n evenly, smaller than n
    >>> largest_divisor(15)
    5
    """
    for i in range(n, 1, -1):
        if n % i == 0:
            return i
    return 1

❌ Run 6

Start time: 2023-09-01 03:03:11
Duration: 5.47s
Result: Fail

def largest_divisor(n: int) -> int:
    """ For a given number n, find the largest number that divides n evenly, smaller than n
    >>> largest_divisor(15)
    5
    """
    for i in range(n, 1, -1):
        if n % i == 0:
            return i
    return 1

❌ Run 7

Start time: 2023-09-01 03:06:13
Duration: 4.63s
Result: Fail

def largest_divisor(n: int) -> int:
    """ For a given number n, find the largest number that divides n evenly, smaller than n
    >>> largest_divisor(15)
    5
    """
    for i in range(n, 1, -1):
        if n % i == 0:
            return i
    return 1

❌ Run 8

Start time: 2023-09-01 03:09:19
Duration: 6.48s
Result: Fail

def largest_divisor(n: int) -> int:
    """ For a given number n, find the largest number that divides n evenly, smaller than n
    >>> largest_divisor(15)
    5
    """
    for i in range(n, 1, -1):
        if n % i == 0:
            return i
    return 1

❌ Run 9

Start time: 2023-09-01 03:12:11
Duration: 4.78s
Result: Fail

def largest_divisor(n: int) -> int:
    """ For a given number n, find the largest number that divides n evenly, smaller than n
    >>> largest_divisor(15)
    5
    """
    for i in range(n, 1, -1):
        if n % i == 0:
            return i
    return 1

❌ Run 10

Start time: 2023-09-01 03:15:16
Duration: 5.97s
Result: Fail

def largest_divisor(n: int) -> int:
    """ For a given number n, find the largest number that divides n evenly, smaller than n
    >>> largest_divisor(15)
    5
    """
    for i in range(n, 1, -1):
        if n % i == 0:
            return i
    return 1