I am not writing and spiking English good, do not be so angry, please
There is a list of int and natural numbers k,m. Print the min i that is true a[i] + a[i+1] + ... + a[i + k] == m. If there is not such i then print 0. Don't use nested loops and more than one list.
Input:
n, k and m (m <= 10000, 0 < k < n <= 30000), n - number of elements in list. At the next raw elements |i|<100
Output:
Answer
One of the tests:
Input:
4 1 22
9 13 10 -11
Output:
1
My code:
, not the test I have shown!!!
Maybe You know what is the problem. If "yes",please write me!
There is a list of int and natural numbers k,m. Print the min i that is true a[i] + a[i+1] + ... + a[i + k] == m. If there is not such i then print 0. Don't use nested loops and more than one list.
Input:
n, k and m (m <= 10000, 0 < k < n <= 30000), n - number of elements in list. At the next raw elements |i|<100
Output:
Answer
One of the tests:
Input:
4 1 22
9 13 10 -11
Output:
1
My code:
n, k, m = (int(x) for x in input().split()) a = [int(x) for x in input().split()] rez=0 for i in range(n): if sum(a[i:i+k+1])==m: rez=i+1 break print(rez if rez else 0)Code fails on the last of test


Maybe You know what is the problem. If "yes",please write me!