Driver code
if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT a = [ 1 , 1 , 2 , 2 , 2 , 3 ] NEW_LINE n = len ( a ) NEW_LINE queries = [ [ 0 , 4 ] , [ 1 , 2 ] , [ 2 , 5 ] , [ 2 , 3 ] , [ 2 , 4 ] ] NEW_LINE q = len ( queries ) ; NEW_LINE k = 3 NEW_LINE print ( getFinalSum ( a , n , queries , q , k ) ) NEW_LINE DEDENT