input_numbers=list(map(int,input().split()))
sum_number=0
def my_gen(a):
i=0
while i <= a:
yield i
i += 1
for i in my_gen(input_numbers[0]):
sum_number += i**input_numbers[1]
print(sum_number%1000000009)
I tried not using generator, but it was too slow. so, tried again with generator and it was slow too.
How can I make this faster?//
More information: My scoring bot is saying Time out. and (1<=input_numbers[0]<=1,000,000,000) (1<=input_numbers[1]<=50)
& Numpy cant be used