
"""simple docstring"""






class 			_SCREAMING_SNAKE_CASE					:  # Public class to implement a graph






			def __init__(					self       ,   __A       ,   __A       ,   __A       )			->     None:
						lowerCAmelCase_    :List[str]			     =  row
						lowerCAmelCase_    :Tuple			     =  col
						lowerCAmelCase_    :str			     =  graph






			def  __lowerCAmelCase (					self       ,   __A       ,   __A       ,   __A       )			->     bool:
						return (
						    0 <= i < self.ROW
						    and 0 <= j < self.COL
						    and not visited[i][j]
						    and self.graph[i][j]
						)






			def  __lowerCAmelCase (					self       ,   __A       ,   __A       ,   __A       )			->     None:
						# Checking all 8 elements surrounding nth element
						lowerCAmelCase_    :int			     =  [-1, -1, -1, 0, 0, 1, 1, 1]  # Coordinate order
						lowerCAmelCase_    :Tuple			     =  [-1, 0, 1, -1, 1, -1, 0, 1]
						lowerCAmelCase_    :int			     =  True  # Make those cells visited
						for k in range(8       ):
									if self.is_safe(i + row_nbr[k]       ,   j + col_nbr[k]       ,   __A       ):
												self.diffs(i + row_nbr[k]       ,   j + col_nbr[k]       ,   __A       )






			def  __lowerCAmelCase (					self       )			->     int:  # And finally, count all islands.
						lowerCAmelCase_    :int			     =  [[False for j in range(self.COL       )] for i in range(self.ROW       )]
						lowerCAmelCase_    :Optional[int]			     =  0
						for i in range(self.ROW       ):
									for j in range(self.COL       ):
												if visited[i][j] is False and self.graph[i][j] == 1:
															self.diffs(__A       ,   __A       ,   __A       )
															count += 1
						return count












"""simple docstring"""


from __future__ import annotations


def 					UpperCAmelCase__       (snake_case__							:					list[int]		,   snake_case__							:					int    ):
  """simple docstring"""

  if len(snake_case__    ) < k or k < 0:
    raise ValueError("""Invalid Input"""    )
  _snake_case							:		Optional[int]								=  sum(array[:k]    )
  for i in range(len(snake_case__    ) - k    ):
    _snake_case							:		Optional[Any]								=  current_sum - array[i] + array[i + k]
    _snake_case							:		List[str]								=  max(snake_case__		,   snake_case__    )
  return max_sum


if __name__ == "__main__":
     from doctest import testmod
     from random import randint

     testmod()
     A_						=				[randint(-10_00, 10_00) for i in range(1_00)]
     A_						=				randint(0, 1_10)
     print(F'''The maximum sum of {k} consecutive elements is {max_sum_in_array(array,k)}''')


