HumanEval/55

 

def fib(n: int):
    """Return n-th Fibonacci number.
    >>> fib(10)
    55
    >>> fib(1)
    1
    >>> fib(8)
    21
    """
 

solution

 

    if n == 0: return 0
    if n <= 2: return 1
    a, b = 1, 1
    for _ in range(3, n + 1):
        a, b, = b, a + b
    return b

 

base input

 [[10], [1], [8], [11], [12]] 

plus input

 [[0], [1], [False], [True], [16], [2], [17], [15], [14], [63], [64], [13], [3], [71], [72], [70], [35], [62], [69], [12], [36], [34], [61], [67], [4], [5], [11], [66], [10], [65], [74], [73], [75], [44], [28], [18], [6], [45], [68], [8], [29], [7], [27], [86], [60]] 

Generations

claude-3-haiku-20240307. fail_base: False, fail_plus: True

  Here's the completed code for the Fibonacci function:

```python
def fib(n: int):
    """Return n-th Fibonacci number.
    >>> fib(10)
    55
    >>> fib(1)
    1
    >>> fib(8)
    21
    """
    if n <= 1:
        return n
    else:
        return (fib(n-1) + fib(n-2))

code-millenials-34b. fail_base: True, fail_plus: True

  def fib(n: int):
    if n <= 0:
        return "Input should be a positive integer."
    elif n == 1:
        return 0
    elif n == 2:
        return 1
    else:
        a, b = 0, 1
        for _ in range(2, n):
            a, b = b, a + b
        return b

# Test cases
print(fib(10))  # Should print: 55
print(fib(1))   # Should print: 0
print(fib(8))   # Should print: 21

speechless-coding-7b-16k-tora. fail_base: False, fail_plus: True

  def fib(n: int):
    if n <= 0:
        raise ValueError("Input must be a positive integer")
    elif n == 1:
        return 1
    elif n == 2:
        return 1
    else:
        a, b = 1, 1
        for _ in range(3, n + 1):
            a, b = b, a + b
        return b


if __name__ == "__main__":
    import doctest
    doctest.testmod()

claude-3-opus-20240229. fail_base: False, fail_plus: True

  Here's the completed code wrapped in a markdown block:

```python
def fib(n: int):
    """Return n-th Fibonacci number.
    >>> fib(10)
    55
    >>> fib(1)
    1
    >>> fib(8)
    21
    """
    if n <= 0:
        return 0
    elif n == 1:
        return 1
    else:
        return fib(n - 1) + fib(n - 2)

mixtral-8x7b-instruct. fail_base: False, fail_plus: True

  def fib(n: int):
    """Return n-th Fibonacci number.
    >>> fib(10)
    55
    >>> fib(1)
    1
    >>> fib(8)
    21
    """
    if n <= 0:
        return "Input should be positive integer."
    elif n == 1:
        return 1
    elif n == 2:
        return 1
    else:
        a, b = 1, 1
        for _ in range(n - 2):
            a, b = b, a + b
        return b

mixtral-8x22b-instruct-v0.1. fail_base: False, fail_plus: False

  def fib(n: int) -> int:
    """Return n-th Fibonacci number.
    >>> fib(10)
    55
    >>> fib(1)
    1
    >>> fib(8)
    21
    """
    if n <= 0:
        return 0
    elif n == 1:
        return 1
    else:
        a, b = 0, 1
        for _ in range(2, n + 1):
            a, b = b, a + b
        return b

code-llama-multi-34b. fail_base: False, fail_plus: True

  

def fib(n: int):
    """Return n-th Fibonacci number.
    >>> fib(10)
    55
    >>> fib(1)
    1
    >>> fib(8)
    21
    """
    if n == 1:
        return 1
    elif n == 2:
        return 1
    else:
        return fib(n - 1) + fib(n - 2)


if __name__ == "__main__":
    import doctest
    doctest.testmod()

Qwen--Qwen1.5-72B-Chat. fail_base: False, fail_plus: True

  def fib(n: int) -> int:
    """Return n-th Fibonacci number."""
    if n <= 0:
        return 0
    elif n == 1:
        return 1
    else:
        return fib(n-1) + fib(n-2)

# Test cases
assert fib(10) == 55
assert fib(1) == 1
assert fib(8) == 21

mistral-large-latest. fail_base: False, fail_plus: True

  Sure, here is the Python code for the Fibonacci function:

```python
def fib(n: int):
    """Return n-th Fibonacci number.
    >>> fib(10)
    55
    >>> fib(1)
    1
    >>> fib(8)
    21
    """
    if n <= 0:
        return "Input should be positive integer."
    elif n == 1 or n == 2:
        return 1
    else:
        a, b = 1, 1
        for _ in range(n - 2):
            a, b = b, a + b
        return b
```
This function uses a loop to calculate the n-th Fibonacci number. It starts with the first two Fibonacci numbers, 1 and 1, and then in each iteration of the loop, it updates `a` and `b` to be the last two Fibonacci numbers calculated so far. When the loop finishes, `b` is the n-th Fibonacci number.

HuggingFaceH4--starchat2-15b-v0.1. fail_base: False, fail_plus: True

  def fib(n: int):
    """Return n-th Fibonacci number.
    >>> fib(10)
    55
    >>> fib(1)
    1
    >>> fib(8)
    21
    """
    if n <= 0:
        raise ValueError("Input must be a positive integer.")
    elif n == 1:
        return 1
    else:
        fib_minus_2, fib_minus_1 = 0, 1
        for _ in range(2, n + 1):
            fib_minus_2, fib_minus_1 = fib_minus_1, fib_minus_2 + fib_minus_1
        return fib_minus_1

# Test cases
assert fib(10) == 55
assert fib(1) == 1
assert fib(8) == 21

codegemma-7b. fail_base: False, fail_plus: False

  def fib(n: int):
    if n == 0:
        return 0
    elif n == 1:
        return 1
    else:
        fib_nums = [0, 1]
        for i in range(2, n + 1):
            fib_nums.append(fib_nums[-1] + fib_nums[-2])
        return fib_nums[n]

print(fib(10))
print(fib(1))
print(fib(8))

code-llama-multi-13b. fail_base: False, fail_plus: True

  

def fib(n: int):
    """Return n-th Fibonacci number.
    >>> fib(10)
    55
    >>> fib(1)
    1
    >>> fib(8)
    21
    """
    if n == 1:
        return 1
    elif n == 2:
        return 1
    else:
        return fib(n - 1) + fib(n - 2)


def fib_iter(n: int):
    """Return n-th Fibonacci number.
    >>> fib_iter(10)
    55
    >>> fib_iter(1)
    1
    >>> fib_iter(8)
    21
    """
    a, b = 1, 1
    for _ in range(n - 1):
        a, b = b, a + b
    return a


def fib_iter_2(n: int):
    """Return n-th Fibonacci number.
    >>> fib_iter_2(10)
    55
    >>> fib_iter_2(1)
    1
    >>> fib_iter_2(8)
    21
    """
    a, b = 1, 1
    for _ in range(n - 1):
        a, b = b, a + b
    return a


def fib_iter_3(n: int):
    """Return n-th Fibonacci number.
    >>> fib_iter_3(10)
    55
    >>> fib_iter_3(1)
    1
    >>> fib_iter_3(8)
    21
    """
    a, b = 1, 1
    for _ in range(n - 1):
        a, b = b, a + b
    return a


def fib_iter_4(n: int):
    """Return n-th Fibonacci number.
    >>> fib_iter_4(10)
    55
    >>> fib_iter_4(1)
    1
    >>> fib_iter_4(8)
    21
    """
    a, b = 1, 1
    for _ in range(n - 1):
        a, b = b, a + b
    return a


def fib_iter_5(n: int):
    """Return n-th

deepseek-coder-6.7b-instruct. fail_base: True, fail_plus: True

  Sure, here is the Python function in a markdown style code block:

```python
def fib(n: int):
    """
    Return n-th Fibonacci number.

    Examples:
    >>> fib(10)
    55
    >>> fib(1)
    1
    >>> fib(8)
    21
    """
```

This function is a simple implementation of the Fibonacci sequence, which is a series of numbers in which each number is the sum of the two preceding ones. The function takes an integer `n` as input and returns the `n`-th Fibonacci number.

Please note that the function is not complete. It only defines the function signature and the docstring. You would need to implement the Fibonacci calculation inside the function to make it work.

open-hermes-2.5-code-290k-13b. fail_base: False, fail_plus: True

  
def fib(n: int):
    if n <= 0:
        return "Invalid input. Please enter a positive integer."
    elif n == 1:
        return 1
    elif n == 2:
        return 1
    else:
        a, b = 1, 1
        for _ in range(n - 2):
            a, b = b, a + b
        return b

print(fib(10))  # Output: 55
print(fib(1))   # Output: 1
print(fib(8))   # Output: 21

speechless-coder-ds-6.7b. fail_base: False, fail_plus: True

  def fib(n: int):
    """Return n-th Fibonacci number.
    >>> fib(10)
    55
    >>> fib(1)
    1
    >>> fib(8)
    21
    """
    if n <= 0:
        return "Input should be a positive integer."
    elif n == 1:
        return 1
    else:
        a, b = 0, 1
        for _ in range(2, n + 1):
            a, b = b, a + b
        return b

codegemma-7b-it. fail_base: False, fail_plus: True

  def fib(n: int):
    """Return n-th Fibonacci number.
    >>> fib(10)
    55
    >>> fib(1)
    1
    >>> fib(8)
    21
    """
    if n <= 1:
        return n
    return fib(n - 1) + fib(n - 2)

deepseek-coder-33b. fail_base: False, fail_plus: True

  

def fib(n: int):
    """Return n-th Fibonacci number.
    >>> fib(10)
    55
    >>> fib(1)
    1
    >>> fib(8)
    21
    """
    if n == 1:
        return 1
    elif n == 2:
        return 1
    else:
        return fib(n - 1) + fib(n - 2)

mistralai--Mistral-7B-Instruct-v0.2. fail_base: False, fail_plus: True

  

def fib(n: int):
    """Return n-th Fibonacci number.
    >>> fib(10)
    55
    >>> fib(1)
    1
    >>> fib(8)
    21
    """
def fib(n: int):
    """Return n-th Fibonacci number."""
    if n <= 0:
        raise ValueError("Input should be positive integer")
    if n == 1:
        return 1
    elif n == 2:
        return 1
    else:
        a, b = 1, 1
        for _ in range(n - 2):
            a, b = b, a + b
        return b

xwincoder-34b. fail_base: False, fail_plus: True

  def fib(n: int) -> int:
    """Return n-th Fibonacci number.
    >>> fib(10)
    55
    >>> fib(1)
    1
    >>> fib(8)
    21
    """
    if n <= 0:
        raise ValueError("n must be a positive integer")
    elif n == 1:
        return 1
    elif n == 2:
        return 1
    else:
        a, b = 1, 1
        for _ in range(n - 2):
            a, b = b, a + b
        return b

code-13b. fail_base: True, fail_plus: True

  def fib(n: int):
    """Return n-th Fibonacci number.
    >>> fib(10)
    55
    >>> fib(1)
    1
    >>> fib(8)
    21
    """
    if n <= 0:
        return "Input should be a positive integer."
    elif n == 1:
        return 0
    elif n == 2:
        return 1
    else:
        a, b = 0, 1
        for _ in range(2, n):
            a, b = b, a + b
        return b

print(fib(10))  # Output: 55
print(fib(1))   # Output: 1
print(fib(8))   # Output: 21
print(fib(0))   # Output: Input should be a positive integer.
print(fib(-10)) # Output: Input should be a positive integer.

wizardcoder-15b. fail_base: False, fail_plus: True

  Here's the Python script for the problem:

```python
def fib(n: int) -> int:
    """Return n-th Fibonacci number."""
    if n <= 1:
        return n
    else:
        return fib(n-1) + fib(n-2)
```

This script defines a function `fib` that takes an integer `n` as input and returns the `n`-th Fibonacci number. The function uses recursion to calculate the Fibonacci number. If `n` is less than or equal to 1, the function returns `n` itself. Otherwise, it recursively calls itself with `n-1` and `n-2` as inputs and returns the sum of the two results.

The function is annotated with a return type of `int` to indicate that it returns an integer value. The function also includes a docstring that describes what the function does.

Here are some test cases to verify that the function works correctly:

```python
>>> fib(10)
55
>>> fib(1)
1
>>> fib(8)
21
```

These test cases verify that the function returns the correct Fibonacci numbers for different inputs.

mistral-7b-codealpaca. fail_base: True, fail_plus: True

  

def fib(n: int):
    """Return n-th Fibonacci number.
    >>> fib(10)
    55
    >>> fib(1)
    1
    >>> fib(8)
    21
    """
    if n <= 0:
        raise ValueError("Input must be a positive integer.")
    elif n == 1:
        return 0
    elif n == 2:
        return 1
    else:
        a, b = 0, 1
        for _ in range(n - 2):
            a, b = b, a + b
        return b

deepseek-coder-33b-instruct. fail_base: True, fail_plus: True

  Here is the Python function implemented in a markdown style code block:

```python
def fib(n: int):
    """Return n-th Fibonacci number.
    >>> fib(10)
    55
    >>> fib(1)
    1
    >>> fib(8)
    21
    """
    if n <= 0:
        print("Input should be a positive integer.")
    elif n == 1:
        return 0
    elif n == 2:
        return 1
    else:
        a, b = 0, 1
        for i in range(2, n):
            a, b = b, a + b
        return b
```

This function uses a loop to calculate the n-th Fibonacci number. It starts with the first two Fibonacci numbers (0 and 1) and then iteratively updates them to the next two Fibonacci numbers until it reaches the n-th number.
<|EOT|>

phi-2. fail_base: False, fail_plus: True

  

def fib(n: int):
    """Return n-th Fibonacci number.
    >>> fib(10)
    55
    >>> fib(1)
    1
    >>> fib(8)
    21
    """
    if n == 0:
        return 0
    elif n == 1:
        return 1
    else:
        return fib(n-1) + fib(n-2)

def fib_memo(n, memo={}):
    """Return n-th Fibonacci number.
    >>> fib_memo(10)
    55
    >>> fib_memo(1)
    1
    >>> fib_memo(8)
    21
    """
    if n in memo:
        return memo[n]
    elif n == 0:
        memo[n] = 0
        return 0
    elif n == 1:
        memo[n] = 1
        return 1
    else:
        memo[n] = fib_memo(n-1, memo) + fib_memo(n-2, memo)
        return memo[n]

def fib_tab(n):
    """Return n-th Fibonacci number.
    >>> fib_tab(10)
    55
    >>> fib_tab(1)
    1
    >>> fib_tab(8)
    21
    """
    if n == 0:
        return 0
    elif n == 1:
        return 1
    else:
        a, b = 0, 1
        for i in range(2, n+1):
            a, b = b, a+b
        return b

def fib_iter(n):
    """Return n-th Fibonacci number.
    >>> fib_iter(10)
    55
    >>> fib_iter(1)
    1
    >>> fib_iter(8)
    21
    """
    if n == 0:
        return 0
    elif n == 1:
        return 1
    else:
        a, b = 0, 1
        for i in range(2, n+1):
            a, b = b, a+b
        return b

def fib_iter_memo(n, memo={}):
    """Return n-th Fibonacci number.
    >>> fib_iter_memo(10)
    55
    >>> fib_iter_memo(1)

bigcode--starcoder2-15b-instruct-v0.1. fail_base: False, fail_plus: True

  def fib(n: int):
    """Return n-th Fibonacci number.
    >>> fib(10)
    55
    >>> fib(1)
    1
    >>> fib(8)
    21
    """
    if n <= 2:
        return 1
    return fib(n - 1) + fib(n - 2)

white-rabbit-neo-33b-v1. fail_base: False, fail_plus: True

  def fib(n: int):
    """Return n-th Fibonacci number.
    >>> fib(10)
    55
    >>> fib(1)
    1
    >>> fib(8)
    21
    """
    if n <= 1:
        return n
    else:
        return fib(n-1) + fib(n-2)

microsoft--Phi-3-mini-4k-instruct. fail_base: False, fail_plus: True

  def fib(n: int) -> int:
    """Return n-th Fibonacci number.

    Args:
    n (int): The position of the Fibonacci number to return.

    Returns:
    int: The n-th Fibonacci number.

    Examples:
    >>> fib(10)
    55
    >>> fib(1)
    1
    >>> fib(8)
    21
    """
    if n <= 0:
        raise ValueError("n must be a positive integer")
    elif n == 1:
        return 1
    elif n == 2:
        return 1

    a, b = 1, 1
    for _ in range(3, n + 1):
        a, b = b, a + b

    return b

speechless-codellama-34b. fail_base: False, fail_plus: False

  def fib(n: int) -> int:
    if n <= 1:
        return n
    else:
        a, b = 0, 1
        for _ in range(n - 1):
            a, b = b, a + b
        return b
```

This script defines a function `fib` that takes an integer `n` as input and returns the `n`-th Fibonacci number. The function uses a loop to calculate the Fibonacci number iteratively, starting with the first two Fibonacci numbers `0` and `1`. The loop updates the values of `a` and `b` to the next two Fibonacci numbers in the sequence until the `n`-th number is reached. The function then returns the `n`-th Fibonacci number.

meta-llama-3-70b-instruct. fail_base: False, fail_plus: True

  def fib(n: int) -> int:
    """Return n-th Fibonacci number."""
    if n <= 0:
        raise ValueError("n must be a positive integer")
    elif n == 1:
        return 1
    elif n == 2:
        return 1
    else:
        a, b = 1, 1
        for _ in range(2, n):
            a, b = b, a + b
        return b

# Test cases
print(fib(10))  # 55
print(fib(1))  # 1
print(fib(8))  # 21

code-llama-70b-instruct. fail_base: False, fail_plus: True

  def fib(n: int):
    """Return n-th Fibonacci number.
    >>> fib(10)
    55
    >>> fib(1)
    1
    >>> fib(8)
    21
    """
    if n < 0:
        raise ValueError("n must be non-negative")
    if n == 0:
        return 0
    elif n == 1:
        return 1
    else:
        return fib(n-1) + fib(n-2)

if __name__ == "__main__":
    import doctest
    doctest.testmod()

opencodeinterpreter-ds-33b. fail_base: False, fail_plus: False

  ```python
def fib(n: int):
    """Return n-th Fibonacci number.
    >>> fib(10)
    55
    >>> fib(1)
    1
    >>> fib(8)
    21
    """
    if n <= 0:
        return 0
    elif n == 1:
        return 1
    else:
        a, b = 0, 1
        for _ in range(2, n + 1):
            a, b = b, a + b
        return b

openchat. fail_base: False, fail_plus: True

  def fib(n: int):
    if n == 0:
        return 0
    elif n == 1:
        return 1
    else:
        return fib(n-1) + fib(n-2)

deepseek-coder-7b-instruct-v1.5. fail_base: False, fail_plus: False

  def fib(n: int):
    """Return n-th Fibonacci number.
    >>> fib(10)
    55
    >>> fib(1)
    1
    >>> fib(8)
    21
    """
    if n <= 0:
        return 0
    elif n == 1:
        return 1
    else:
        a, b = 0, 1
        for _ in range(2, n + 1):
            a, b = b, a + b
        return b

speechless-starcoder2-7b. fail_base: False, fail_plus: False

  def fib(n: int):
    """Return n-th Fibonacci number.
    >>> fib(10)
    55
    >>> fib(1)
    1
    >>> fib(8)
    21
    """
    if n <= 0:
        return 0
    elif n == 1:
        return 1
    else:
        a, b = 0, 1
        for _ in range(n - 1):
            a, b = b, a + b
        return b

wizardcoder-7b. fail_base: False, fail_plus: True

  Here's the Python script for the given problem:

```python
def fib(n: int):
    """Return n-th Fibonacci number."""
    if n <= 1:
        return n
    else:
        return fib(n-1) + fib(n-2)
```

This function uses recursion to calculate the n-th Fibonacci number. It checks if the input `n` is less than or equal to 1, and if so, it returns `n`. Otherwise, it returns the sum of the previous two Fibonacci numbers. This continues until the base case is reached, which is when `n` is 0 or 1. The function will keep calling itself until it reaches the base case, and then it will start returning the values it has already calculated. 

octocoder. fail_base: False, fail_plus: True

  

def fib(n: int):
    """Return n-th Fibonacci number.
    >>> fib(10)
    55
    >>> fib(1)
    1
    >>> fib(8)
    21
    """

    if n == 0:
        return 0
    elif n == 1:
        return 1
    else:
        return fib(n - 1) + fib(n - 2)


Answer: from typing import List

gemma-1.1-7b-it. fail_base: False, fail_plus: True

  def fib(n: int):
    """Return n-th Fibonacci number.

    >>> fib(10)
    55
    >>> fib(1)
    1
    >>> fib(8)
    21
    """
    if n < 2:
        return n
    else:
        return fib(n-1) + fib(n-2)

gpt-3.5-turbo. fail_base: False, fail_plus: True

  Here's the code to complete the problem:

```python
def fib(n: int):
    """Return n-th Fibonacci number."""
    if n <= 0:
        return None
    elif n == 1:
        return 1
    elif n == 2:
        return 1
    else:
        fib_prev = 1
        fib_curr = 1
        for _ in range(3, n+1):
            fib_next = fib_prev + fib_curr
            fib_prev = fib_curr
            fib_curr = fib_next
        return fib_curr

print(fib(10))  # Output: 55
print(fib(1))   # Output: 1
print(fib(8))   # Output: 21
```

This code defines a function `fib` that takes an integer `n` as input and returns the n-th Fibonacci number. The function uses a loop to calculate the Fibonacci number iteratively. The first two Fibonacci numbers are defined as 1, and for n > 2, the n-th Fibonacci number is the sum of the previous two Fibonacci numbers. The function handles the base cases where n <= 0, n = 1, and n = 2 separately. Finally, the code includes some test cases to verify the correctness of the function.

codebooga-34b. fail_base: False, fail_plus: True

  

def fib(n: int):
    """Return n-th Fibonacci number.
    >>> fib(10)
    55
    >>> fib(1)
    1
    >>> fib(8)
    21
    """
    if n <= 1:
        return n
    else:
        return fib(n-1) + fib(n-2)

deepseek-coder-1.3b-instruct. fail_base: False, fail_plus: False

  Here is the implementation of the function in Python:

```python
def fib(n: int):
    """
    Return n-th Fibonacci number.
    
    >>> fib(10)
    55
    >>> fib(1)
    1
    >>> fib(8)
    21
    """
    if n <= 0:
        return 0
    elif n == 1:
        return 1
    else:
        a, b = 0, 1
        for _ in range(2, n+1):
            a, b = b, a + b
        return b
```

This function uses a simple iterative approach to calculate the n-th Fibonacci number. The base cases are handled separately, as the first and second Fibonacci numbers are 0 and 1, respectively. For the rest of the numbers, the function iteratively updates the two variables `a` and `b` to the last two Fibonacci numbers, and then updates the next Fibonacci number to the sum of the last two.

speechless-mistral-7b. fail_base: False, fail_plus: False

  def fib(n: int):
    if n <= 1:
        return n
    else:
        a, b = 0, 1
        for _ in range(2, n + 1):
            a, b = b, a + b
        return b


# Test cases
print(fib(10))  # Output: 55
print(fib(1))   # Output: 1
print(fib(8))   # Output: 21
```

xdan-l1-chat. fail_base: False, fail_plus: True

  def fib(n: int):
    if n <= 1:
        return n
    else:
        return fib(n-1) + fib(n-2)

solar-10.7b-instruct. fail_base: False, fail_plus: False

  

def fib(n: int):
    """Return n-th Fibonacci number.
    >>> fib(10)
    55
    >>> fib(1)
    1
    >>> fib(8)
    21
    """
def fib(n: int) -> int:
    if n <= 0:
        return 0
    elif n == 1:
        return 1
    else:
        a, b = 0, 1
        for i in range(1, n):
            a, b = b, a + b
        return b

claude-3-sonnet-20240229. fail_base: False, fail_plus: True

  Here's the code to complete the `fib` function:

```python
def fib(n: int):
    """Return n-th Fibonacci number.
    >>> fib(10)
    55
    >>> fib(1)
    1
    >>> fib(8)
    21
    """
    if n <= 0:
        return 0
    elif n == 1:
        return 1
    else:
        return fib(n-1) + fib(n-2)

code-33b. fail_base: False, fail_plus: False

  
def fib(n: int):
    """Return n-th Fibonacci number.
    >>> fib(10)
    55
    >>> fib(1)
    1
    >>> fib(8)
    21
    """
    if n == 0:
        return 0
    elif n == 1:
        return 1
    else:
        a, b = 0, 1
        for _ in range(2, n + 1):
            a, b = b, a + b
        return b

# Test cases
print(fib(10))  # Should print 55
print(fib(1))   # Should print 1
print(fib(8))   # Should print 21

starcoder2-15b-oci. fail_base: False, fail_plus: True

  

def fib(n: int):
    """Return n-th Fibonacci number.
    >>> fib(10)
    55
    >>> fib(1)
    1
    >>> fib(8)
    21
    """

    if n <= 1:
        return n
    return fib(n - 1) + fib(n - 2)

# Test the function

speechless-starcoder2-15b. fail_base: True, fail_plus: True

  def fib(n: int):
    if n <= 0:
        return "Input should be a positive integer."
    elif n == 1:
        return 0
    elif n == 2:
        return 1
    else:
        fib_values = [0, 1]
        for i in range(2, n):
            fib_values.append(fib_values[i-1] + fib_values[i-2])
        return fib_values[-1]

python-code-13b. fail_base: False, fail_plus: True

  def fib(n: int) -> int:
    """Return n-th Fibonacci number.
    >>> fib(10)
    55
    >>> fib(1)
    1
    >>> fib(8)
    21
    """

    if n <= 1:
        return n
    else:
        return fib(n-1) + fib(n-2)

opencodeinterpreter-ds-6.7b. fail_base: False, fail_plus: False

  ```python
def fib(n: int):
    if n <= 0:
        return 0
    elif n == 1:
        return 1
    else:
        a, b = 0, 1
        for _ in range(2, n + 1):
            a, b = b, a + b
        return b

# Test cases
print(fib(10))  # Expected output: 55
print(fib(1))   # Expected output: 1
print(fib(8))   # Expected output: 21
```