prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Add typing to maths/segmented_sieve.py
  ### Describe your change:
  
  
  
  * [ ] Add an algorithm?
  * [ ] Fix a bug or typo in an existing algorithm?
  * [ ] Documentation change?
  
  ### Checklist:
  * [ ] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md).
  * [ ] This pull request is all my own work -- I have not plagiarized.
  * [ ] I know that pull requests will not be merged if they fail the automated tests.
  * [ ] This PR only changes one algorithm file.  To ease review, please open separate PRs for separate algorithms.
  * [ ] All new Python files are placed inside an existing directory.
  * [ ] All filenames are in all lowercase characters with no spaces or dashes.
  * [ ] All functions and variable names follow Python naming conventions.
  * [ ] All function parameters and return values are annotated with Python [type hints](https://docs.python.org/3/library/typing.html).
  * [ ] All functions have [doctests](https://docs.python.org/3/library/doctest.html) that pass the automated testing.
  * [ ] All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.
  * [ ] If this pull request resolves one or more open issues then the commit message contains `Fixes: #{$ISSUE_NO}`.
  
  
  </issue>
  <code>
  [start of maths/segmented_sieve.py]
  1 """Segmented Sieve."""
  2 
  3 import math
  4 
  5 
  6 def sieve(n):
  7     """Segmented Sieve."""
  8     in_prime = []
  9     start = 2
  10     end = int(math.sqrt(n))  # Size of every segment
  11     temp = [True] * (end + 1)
  12     prime = []
  13 
  14     while start <= end:
  15         if temp[start] is True:
  16             in_prime.append(start)
  17             for i in range(start * start, end + 1, start):
  18                 temp[i] = False
  19         start += 1
  20     prime += in_prime
  21 
  22     low = end + 1
  23     high = min(2 * end, n)
  24 
  25     while low <= n:
  26         temp = [True] * (high - low + 1)
  27         for each in in_prime:
  28 
  29             t = math.floor(low / each) * each
  30             if t < low:
  31                 t += each
  32 
  33             for j in range(t, high + 1, each):
  34                 temp[j - low] = False
  35 
  36         for j in range(len(temp)):
  37             if temp[j] is True:
  38                 prime.append(j + low)
  39 
  40         low = high + 1
  41         high = min(high + end, n)
  42 
  43     return prime
  44 
  45 
  46 print(sieve(10**6))
  47
  [end of maths/segmented_sieve.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/maths/segmented_sieve.py b/maths/segmented_sieve.py
  --- a/maths/segmented_sieve.py
  +++ b/maths/segmented_sieve.py
  @@ -3,7 +3,7 @@
   import math
   
   
  -def sieve(n):
  +def sieve(n: int) -> list[int]:
       """Segmented Sieve."""
       in_prime = []
       start = 2
  
verification_info: {"golden_diff": "diff --git a/maths/segmented_sieve.py b/maths/segmented_sieve.py\n--- a/maths/segmented_sieve.py\n+++ b/maths/segmented_sieve.py\n@@ -3,7 +3,7 @@\n import math\r\n \r\n \r\n-def sieve(n):\r\n+def sieve(n: int) -> list[int]:\r\n     \"\"\"Segmented Sieve.\"\"\"\r\n     in_prime = []\r\n     start = 2\n", "issue": "Add typing to maths/segmented_sieve.py\n### Describe your change:\r\n\r\n\r\n\r\n* [ ] Add an algorithm?\r\n* [ ] Fix a bug or typo in an existing algorithm?\r\n* [ ] Documentation change?\r\n\r\n### Checklist:\r\n* [ ] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md).\r\n* [ ] This pull request is all my own work -- I have not plagiarized.\r\n* [ ] I know that pull requests will not be merged if they fail the automated tests.\r\n* [ ] This PR only changes one algorithm file.  To ease review, please open separate PRs for separate algorithms.\r\n* [ ] All new Python files are placed inside an existing directory.\r\n* [ ] All filenames are in all lowercase characters with no spaces or dashes.\r\n* [ ] All functions and variable names follow Python naming conventions.\r\n* [ ] All function parameters and return values are annotated with Python [type hints](https://docs.python.org/3/library/typing.html).\r\n* [ ] All functions have [doctests](https://docs.python.org/3/library/doctest.html) that pass the automated testing.\r\n* [ ] All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.\r\n* [ ] If this pull request resolves one or more open issues then the commit message contains `Fixes: #{$ISSUE_NO}`.\r\n\n", "before_files": [{"content": "\"\"\"Segmented Sieve.\"\"\"\r\n\r\nimport math\r\n\r\n\r\ndef sieve(n):\r\n    \"\"\"Segmented Sieve.\"\"\"\r\n    in_prime = []\r\n    start = 2\r\n    end = int(math.sqrt(n))  # Size of every segment\r\n    temp = [True] * (end + 1)\r\n    prime = []\r\n\r\n    while start <= end:\r\n        if temp[start] is True:\r\n            in_prime.append(start)\r\n            for i in range(start * start, end + 1, start):\r\n                temp[i] = False\r\n        start += 1\r\n    prime += in_prime\r\n\r\n    low = end + 1\r\n    high = min(2 * end, n)\r\n\r\n    while low <= n:\r\n        temp = [True] * (high - low + 1)\r\n        for each in in_prime:\r\n\r\n            t = math.floor(low / each) * each\r\n            if t < low:\r\n                t += each\r\n\r\n            for j in range(t, high + 1, each):\r\n                temp[j - low] = False\r\n\r\n        for j in range(len(temp)):\r\n            if temp[j] is True:\r\n                prime.append(j + low)\r\n\r\n        low = high + 1\r\n        high = min(high + end, n)\r\n\r\n    return prime\r\n\r\n\r\nprint(sieve(10**6))\r\n", "path": "maths/segmented_sieve.py"}]}